From 813d9e8175b30e2b4dfdf9aa67f3088e38115f2f Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 28 Jan 2013 16:29:10 -0400 Subject: [PATCH 001/983] 8006676: Integrate Nashorn into new build system Reviewed-by: jlaskey --- jdk/THIRD_PARTY_README | 24 +++++++++++------------ jdk/make/launchers/Makefile | 4 ++++ jdk/makefiles/CompileLaunchers.gmk | 5 +++++ jdk/makefiles/CreateJars.gmk | 8 ++++++++ jdk/test/tools/launcher/VersionCheck.java | 1 + 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 6dc1b331638..61834ab7a5a 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France Tlcom +Copyright (c) 2000-2011 France TÈlÈcom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬© 2001,2003 Keith Packard +Copyright ¬¨¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode® Consortium Name and +Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode® Standard, subject to Terms and + works conforming to the Unicode¬Æ Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of + Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.’s exclusive + website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark - Policy”) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark + Policy‚Äù) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode’s prior written + assign any part of this Agreement without Unicode‚Äôs prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode’s net income. + Unicode‚Äôs net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index be16512e478..4be80722894 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,6 +77,10 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) +$(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ + -J-XX:-TieredCompilation \ + -J-Xms2G \ + -J-Xmx2G, ) $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ diff --git a/jdk/makefiles/CompileLaunchers.gmk b/jdk/makefiles/CompileLaunchers.gmk index 354fea12044..f1ceeedfd34 100644 --- a/jdk/makefiles/CompileLaunchers.gmk +++ b/jdk/makefiles/CompileLaunchers.gmk @@ -311,6 +311,11 @@ $(eval $(call SetupLauncher,jps,\ $(eval $(call SetupLauncher,jrunscript,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }')) +$(eval $(call SetupLauncher,jjs,\ + -DJAVA_ARGS='{ "-J-XX:-TieredCompilation"$(COMMA) \ + "-J-Xms2G"$(COMMA) "-J-Xmx2G"$(COMMA) \ + "jdk.nashorn.tools.Shell"$(COMMA) }')) + $(eval $(call SetupLauncher,jsadebugd,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \ -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \ diff --git a/jdk/makefiles/CreateJars.gmk b/jdk/makefiles/CreateJars.gmk index 21c3ca98bfb..d67ab5a65f6 100644 --- a/jdk/makefiles/CreateJars.gmk +++ b/jdk/makefiles/CreateJars.gmk @@ -1046,6 +1046,14 @@ endif ########################################################################################## +# Import nashorn.jar from nashorn dist dir. +$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar + +########################################################################################## + -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk ########################################################################################## diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java index c30ef424011..dd15d04570f 100644 --- a/jdk/test/tools/launcher/VersionCheck.java +++ b/jdk/test/tools/launcher/VersionCheck.java @@ -73,6 +73,7 @@ public class VersionCheck extends TestHelper { "jmap", "jps", "jrunscript", + "jjs", "jsadebugd", "jstack", "jstat", From d56ceaa96bd493fee496887df21e6d76745391bb Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 28 Jan 2013 16:29:34 -0400 Subject: [PATCH 002/983] 8006676: Integrate Nashorn into new build system Reviewed-by: jlaskey --- common/autoconf/generated-configure.sh | 16 ++++++++ common/autoconf/source-dirs.m4 | 15 ++++++- common/autoconf/spec.gmk.in | 3 ++ common/bin/compare.sh | 30 +++++++++++++- common/makefiles/Main.gmk | 14 +++++-- common/makefiles/MakeBase.gmk | 3 +- make/nashorn-rules.gmk | 56 ++++++++++++++++++++++++++ make/scripts/hgforest.sh | 2 +- 8 files changed, 132 insertions(+), 7 deletions(-) create mode 100644 make/nashorn-rules.gmk diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index ff6a41fc001..ee55de77f12 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -738,6 +738,7 @@ BUILD_OUTPUT OVERRIDE_SRC_ROOT ADD_SRC_ROOT JDK_TOPDIR +NASHORN_TOPDIR HOTSPOT_TOPDIR JAXWS_TOPDIR JAXP_TOPDIR @@ -15627,6 +15628,7 @@ CORBA_TOPDIR="$SRC_ROOT/corba" JAXP_TOPDIR="$SRC_ROOT/jaxp" JAXWS_TOPDIR="$SRC_ROOT/jaxws" HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" +NASHORN_TOPDIR="$SRC_ROOT/nashorn" JDK_TOPDIR="$SRC_ROOT/jdk" @@ -15637,6 +15639,7 @@ JDK_TOPDIR="$SRC_ROOT/jdk" + ############################################################################### # # Pickup additional source for a component from outside of the source root @@ -15867,6 +15870,19 @@ $as_echo_n "checking if hotspot should be overridden... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $HOTSPOT_TOPDIR" >&5 $as_echo "yes with $HOTSPOT_TOPDIR" >&6; } fi +if test "x$with_override_nashorn" != x; then + CURDIR="$PWD" + cd "$with_override_nashorn" + NASHORN_TOPDIR="`pwd`" + cd "$CURDIR" + if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then + as_fn_error $? "You have to override nashorn with a full nashorn repo!" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if nashorn should be overridden" >&5 +$as_echo_n "checking if nashorn should be overridden... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $NASHORN_TOPDIR" >&5 +$as_echo "yes with $NASHORN_TOPDIR" >&6; } +fi if test "x$with_override_jdk" != x; then CURDIR="$PWD" cd "$with_override_jdk" diff --git a/common/autoconf/source-dirs.m4 b/common/autoconf/source-dirs.m4 index eacd056066b..bb0aba1b826 100644 --- a/common/autoconf/source-dirs.m4 +++ b/common/autoconf/source-dirs.m4 @@ -33,12 +33,14 @@ CORBA_TOPDIR="$SRC_ROOT/corba" JAXP_TOPDIR="$SRC_ROOT/jaxp" JAXWS_TOPDIR="$SRC_ROOT/jaxws" HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" +NASHORN_TOPDIR="$SRC_ROOT/nashorn" JDK_TOPDIR="$SRC_ROOT/jdk" AC_SUBST(LANGTOOLS_TOPDIR) AC_SUBST(CORBA_TOPDIR) AC_SUBST(JAXP_TOPDIR) AC_SUBST(JAXWS_TOPDIR) AC_SUBST(HOTSPOT_TOPDIR) +AC_SUBST(NASHORN_TOPDIR) AC_SUBST(JDK_TOPDIR) ]) @@ -233,7 +235,18 @@ if test "x$with_override_hotspot" != x; then fi AC_MSG_CHECKING([if hotspot should be overridden]) AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR]) -fi +fi +if test "x$with_override_nashorn" != x; then + CURDIR="$PWD" + cd "$with_override_nashorn" + NASHORN_TOPDIR="`pwd`" + cd "$CURDIR" + if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then + AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!]) + fi + AC_MSG_CHECKING([if nashorn should be overridden]) + AC_MSG_RESULT([yes with $NASHORN_TOPDIR]) +fi if test "x$with_override_jdk" != x; then CURDIR="$PWD" cd "$with_override_jdk" diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 5fde9e7cf16..f7c61f9d228 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -141,6 +141,7 @@ CORBA_TOPDIR:=@CORBA_TOPDIR@ JAXP_TOPDIR:=@JAXP_TOPDIR@ JAXWS_TOPDIR:=@JAXWS_TOPDIR@ HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@ +NASHORN_TOPDIR:=@NASHORN_TOPDIR@ COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@ # Location where build customization files may be found @@ -230,6 +231,7 @@ JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk +NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images JCE_OUTPUTDIR=$(BUILD_OUTPUT)/jce-release @@ -238,6 +240,7 @@ CORBA_DIST=$(CORBA_OUTPUTDIR)/dist JAXP_DIST=$(JAXP_OUTPUTDIR)/dist JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist HOTSPOT_DIST=@HOTSPOT_DIST@ +NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist BUILD_HOTSPOT=@BUILD_HOTSPOT@ diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 1e1ceb08ae6..0ba46727acc 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -350,9 +350,15 @@ compare_zip_file() { OTHER_DIR=$2 WORK_DIR=$3 ZIP_FILE=$4 + # Optionally provide different name for other zipfile + OTHER_ZIP_FILE=$5 THIS_ZIP=$THIS_DIR/$ZIP_FILE - OTHER_ZIP=$OTHER_DIR/$ZIP_FILE + if [ -n "$OTHER_ZIP_FILE" ]; then + OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE + else + OTHER_ZIP=$OTHER_DIR/$ZIP_FILE + fi THIS_SUFFIX="${THIS_ZIP##*.}" OTHER_SUFFIX="${OTHER_ZIP##*.}" @@ -962,6 +968,9 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1 echo "[FILTER] List filenames in the image to compare, works for jars, zips, libs and execs" echo "Example:" echo "bash ./common/bin/compareimages.sh CodePointIM.jar" + echo "" + echo "-2zips Compare two zip files only" + echo "" exit 10 fi @@ -1023,6 +1032,13 @@ while [ -n "$1" ]; do -execs) CMP_EXECS=true ;; + -2zips) + CMP_2_ZIPS=true + THIS_FILE=$2 + OTHER_FILE=$3 + shift + shift + ;; *) CMP_NAMES=false CMP_PERMS=false @@ -1041,6 +1057,18 @@ while [ -n "$1" ]; do shift done +if [ "$CMP_2_ZIPS" = "true" ]; then + THIS_DIR="$(dirname $THIS_FILE)" + THIS_DIR="$(cd "$THIS_DIR" && pwd )" + OTHER_DIR="$(dirname $OTHER_FILE)" + OTHER_DIR="$(cd "$OTHER_DIR" && pwd )" + THIS_FILE_NAME="$(basename $THIS_FILE)" + OTHER_FILE_NAME="$(basename $OTHER_FILE)" + echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME + compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME + exit +fi + if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then CMP_NAMES=true CMP_PERMS=true diff --git a/common/makefiles/Main.gmk b/common/makefiles/Main.gmk index c96747f090c..104a8fdccdb 100644 --- a/common/makefiles/Main.gmk +++ b/common/makefiles/Main.gmk @@ -116,13 +116,19 @@ jdk-only: start-make @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET)) @$(call TargetExit) +nashorn: jdk nashorn-only +nashorn-only: start-make + @$(call TargetEnter) + @($(CD) $(NASHORN_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk) + @$(call TargetExit) + demos: jdk demos-only demos-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos) @$(call TargetExit) -images: source-tips demos images-only +images: source-tips demos nashorn images-only images-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) @@ -173,7 +179,7 @@ $(OUTPUT_ROOT)/source_tips: FRC # Remove everything, except the output from configure. -clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs +clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*) @$(ECHO) Cleaned all build artifacts. @@ -203,6 +209,8 @@ clean-hotspot: $(call CleanComponent,hotspot) clean-jdk: $(call CleanComponent,jdk) +clean-nashorn: + $(call CleanComponent,nashorn) clean-images: $(call CleanComponent,images) clean-overlay-images: @@ -216,6 +224,6 @@ clean-docs: .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only .PHONY: all test clean dist-clean bootcycle-images start-make -.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build +.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build FRC: # Force target diff --git a/common/makefiles/MakeBase.gmk b/common/makefiles/MakeBase.gmk index 708cbada085..4c1ecc8c8b7 100644 --- a/common/makefiles/MakeBase.gmk +++ b/common/makefiles/MakeBase.gmk @@ -51,8 +51,9 @@ decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely- -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \ -e 's|X00|X|g' | tr '\n' '$2' +# Subst in an extra $ to prevent it from disappearing. define ListPathsSafely_If - $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1))))) + $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(subst $$,$$$$,$(wordlist $3,$4,$($1)))))) endef define ListPathsSafely_Printf diff --git a/make/nashorn-rules.gmk b/make/nashorn-rules.gmk new file mode 100644 index 00000000000..a205f2ea97e --- /dev/null +++ b/make/nashorn-rules.gmk @@ -0,0 +1,56 @@ +# +# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################ +# NASHORN TARGETS +################################################################ + +NASHORN_BUILD_ARGUMENTS = \ + $(COMMON_BUILD_ARGUMENTS) \ + ALT_OUTPUTDIR=$(NASHORN_OUTPUTDIR) \ + ALT_BOOTDIR=$(BOOTDIR) \ + ALT_JDK_IMPORT_PATH=$(JDK_IMPORT_PATH) + +ifeq ($(BUILD_LANGTOOLS), true) + NASHORN_BUILD_ARGUMENTS += ALT_LANGTOOLS_DIST=$(ABS_LANGTOOLS_DIST) +endif + +nashorn: nashorn-build +nashorn-build: + $(MKDIR) -p $(NASHORN_OUTPUTDIR) + @$(call MakeStart,nashorn,all) + ($(CD) $(NASHORN_TOPDIR)/make && \ + $(MAKE) $(NASHORN_BUILD_ARGUMENTS) all) + @$(call MakeFinish,nashorn,all) + +nashorn-clobber:: + $(MKDIR) -p $(NASHORN_OUTPUTDIR) + @$(call MakeStart,nashorn,clobber) + ($(CD) $(NASHORN_TOPDIR)/make && \ + $(MAKE) $(NASHORN_BUILD_ARGUMENTS) clobber) + @$(call MakeFinish,nashorn,clobber) + +.PHONY: nashorn nashorn-build nashorn-clobber + diff --git a/make/scripts/hgforest.sh b/make/scripts/hgforest.sh index ed937f3711e..f30d3eb7768 100644 --- a/make/scripts/hgforest.sh +++ b/make/scripts/hgforest.sh @@ -40,7 +40,7 @@ pull_default="" repos="" repos_extra="" if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - subrepos="corba jaxp jaxws langtools jdk hotspot" + subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" if [ -f .hg/hgrc ] ; then pull_default=`hg paths default` if [ "${pull_default}" = "" ] ; then From 383e963093f4b9663f59719f1ed3847a94a8d43c Mon Sep 17 00:00:00 2001 From: James Laskey Date: Wed, 6 Feb 2013 13:37:03 -0400 Subject: [PATCH 003/983] 8007666: nashorn missing from hgforest.sh Reviewed-by: jlaskey --- common/bin/hgforest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh index cbda87160ba..e4cb76a45a3 100644 --- a/common/bin/hgforest.sh +++ b/common/bin/hgforest.sh @@ -96,7 +96,7 @@ pull_default="" repos="" repos_extra="" if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - subrepos="corba jaxp jaxws langtools jdk hotspot" + subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" if [ -f .hg/hgrc ] ; then pull_default=`hg paths default` if [ "${pull_default}" = "" ] ; then From eba603edcf540627aec0d5ac3e6bfef1da8c2d61 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 18 Feb 2013 19:01:59 -0400 Subject: [PATCH 004/983] 8008420: Fix Nashorn forest to build with NEWBUILD=false Reviewed-by: jjh --- Makefile | 7 +++++++ make/nashorn-rules.gmk | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index f9162f0b641..f7b9d1b35e3 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,7 @@ include ./make/corba-rules.gmk include ./make/jaxp-rules.gmk include ./make/jaxws-rules.gmk include ./make/jdk-rules.gmk +include ./make/nashorn-rules.gmk include ./make/install-rules.gmk include ./make/sponsors-rules.gmk include ./make/deploy-rules.gmk @@ -174,6 +175,11 @@ ifeq ($(BUILD_JDK), true) clobber:: jdk-clobber endif +ifeq ($(BUILD_NASHORN), true) + generic_build_repo_series:: $(NASHORN) + clobber:: nashorn-clobber +endif + ifeq ($(BUILD_DEPLOY), true) generic_build_repo_series:: $(DEPLOY) clobber:: deploy-clobber @@ -336,6 +342,7 @@ deploy_fastdebug_only: BUILD_HOTSPOT=false \ BUILD_JDK=false \ BUILD_LANGTOOLS=false \ + BUILD_NASHORN=false \ BUILD_CORBA=false \ BUILD_JAXP=false \ BUILD_JAXWS=false \ diff --git a/make/nashorn-rules.gmk b/make/nashorn-rules.gmk index a205f2ea97e..a86a0475ced 100644 --- a/make/nashorn-rules.gmk +++ b/make/nashorn-rules.gmk @@ -37,6 +37,9 @@ ifeq ($(BUILD_LANGTOOLS), true) NASHORN_BUILD_ARGUMENTS += ALT_LANGTOOLS_DIST=$(ABS_LANGTOOLS_DIST) endif +# Default targets +NASHORN = nashorn-build + nashorn: nashorn-build nashorn-build: $(MKDIR) -p $(NASHORN_OUTPUTDIR) From 6ac18a4c3b1ca84127fdae0bce1da42a3aa988cb Mon Sep 17 00:00:00 2001 From: James Laskey Date: Tue, 19 Feb 2013 10:02:55 -0400 Subject: [PATCH 005/983] 8008446: Tweaks to make all NEWBUILD=false round 2 Reviewed-by: jjh --- make/Defs-internal.gmk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/make/Defs-internal.gmk b/make/Defs-internal.gmk index 6f40f763bc9..15374ff7c51 100644 --- a/make/Defs-internal.gmk +++ b/make/Defs-internal.gmk @@ -100,6 +100,7 @@ ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)") ABS_JAXWS_TOPDIR:=$(call OptFullPath,"$(JAXWS_TOPDIR)") ABS_JDK_TOPDIR:=$(call OptFullPath,"$(JDK_TOPDIR)") ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)") +ABS_NASHORN_TOPDIR:=$(call OptFullPath,"$(NASHORN_TOPDIR)") ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)") ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)") ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)") @@ -165,6 +166,15 @@ ifeq ($(JDK_SRC_AVAILABLE),true) endif endif +NASHORN_SRC_AVAILABLE := $(call MkExists,$(NASHORN_TOPDIR)/make/Makefile) +ifndef BUILD_NASHORN + ifdef ALT_NASHORN_DIST + BUILD_NASHORN := false + else + BUILD_NASHORN := $(NASHORN_SRC_AVAILABLE) + endif +endif + DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile) ifndef BUILD_DEPLOY BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE) @@ -308,6 +318,10 @@ ifndef ALT_JAXWS_DIST JAXWS_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxws ABS_JAXWS_DIST = $(JAXWS_OUTPUTDIR)/dist endif +ifndef ALT_NASHORN_DIST + NASHORN_OUTPUTDIR = $(ABS_OUTPUTDIR)/nashorn + ABS_NASHORN_DIST = $(NASHORN_OUTPUTDIR)/dist +endif # Common make arguments (supplied to all component builds) COMMON_BUILD_ARGUMENTS = \ From 9441d55bcae9f25bbf0e9b4ae0da2987a14e2327 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Thu, 21 Feb 2013 15:25:07 -0400 Subject: [PATCH 006/983] 8008447: Tweaks to make all NEWBUILD=false round 3 Reviewed-by: jjh, sundar --- jdk/make/launchers/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index 4be80722894..e88742a992b 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,10 +77,12 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) +ifeq ("$(NEWBUILD)","true") $(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ -J-XX:-TieredCompilation \ -J-Xms2G \ -J-Xmx2G, ) +endif $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ From 9f4d8efb2217275fbdff5004165d3df705926fce Mon Sep 17 00:00:00 2001 From: James Laskey Date: Thu, 21 Feb 2013 15:25:31 -0400 Subject: [PATCH 007/983] 8008447: Tweaks to make all NEWBUILD=false round 3 Reviewed-by: jjh, sundar --- make/jdk-rules.gmk | 3 +++ make/sanity-rules.gmk | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/make/jdk-rules.gmk b/make/jdk-rules.gmk index 42ba6adf627..dc6b5556dd0 100644 --- a/make/jdk-rules.gmk +++ b/make/jdk-rules.gmk @@ -62,6 +62,9 @@ endif ifeq ($(BUILD_JAXWS), true) JDK_BUILD_ARGUMENTS += ALT_JAXWS_DIST=$(ABS_JAXWS_DIST) endif +ifeq ($(BUILD_NASHORN), true) + JDK_BUILD_ARGUMENTS += ALT_NASHORN_DIST=$(ABS_NASHORN_DIST) +endif ifeq ($(BUILD_HOTSPOT), true) JDK_BUILD_ARGUMENTS += ALT_HOTSPOT_IMPORT_PATH=$(HOTSPOT_DIR)/import diff --git a/make/sanity-rules.gmk b/make/sanity-rules.gmk index 544dba10ffd..ee3d6f88ab1 100644 --- a/make/sanity-rules.gmk +++ b/make/sanity-rules.gmk @@ -182,6 +182,14 @@ ifeq ($(JDK_SRC_AVAILABLE), true) "" >> $(WARNING_FILE) endif endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + ifneq ($(BUILD_NASHORN), true) + @$(ECHO) "WARNING: You are not building the NASHORN sources.\n" \ + " The nashorn files will be obtained from \n" \ + " the location set in ALT_JDK_IMPORT_PATH. \n" \ + "" >> $(WARNING_FILE) + endif +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) ifneq ($(BUILD_DEPLOY), true) @$(ECHO) "WARNING: You are not building the DEPLOY sources.\n" \ @@ -268,6 +276,9 @@ endif ifeq ($(JDK_SRC_AVAILABLE), true) @$(ECHO) " JDK_TOPDIR = $(JDK_TOPDIR)" >> $(MESSAGE_FILE) endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + @$(ECHO) " NASHORN_TOPDIR = $(NASHORN_TOPDIR)" >> $(MESSAGE_FILE) +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) @$(ECHO) " DEPLOY_TOPDIR = $(DEPLOY_TOPDIR)" >> $(MESSAGE_FILE) endif @@ -303,6 +314,9 @@ endif ifeq ($(JDK_SRC_AVAILABLE), true) @$(ECHO) " BUILD_JDK = $(BUILD_JDK) " >> $(MESSAGE_FILE) endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + @$(ECHO) " BUILD_NASHORN = $(BUILD_NASHORN) " >> $(MESSAGE_FILE) +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) @$(ECHO) " BUILD_DEPLOY = $(BUILD_DEPLOY) " >> $(MESSAGE_FILE) endif From ff7ec1f667147714920c41cc182bcc5299c4983f Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 10:23:11 -0400 Subject: [PATCH 008/983] 8008721: Tweaks to make all NEWBUILD=false round 4 Reviewed-by: jjh --- jdk/make/launchers/Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index e88742a992b..47645158793 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,12 +77,7 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) -ifeq ("$(NEWBUILD)","true") -$(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ - -J-XX:-TieredCompilation \ - -J-Xms2G \ - -J-Xmx2G, ) -endif +$(call make-launcher, jjs, jdk.nashorn.tools.Shell, , ) $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ From e99848e82df223de70c6dd5fcd67c8058dadb0e5 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 17:45:37 -0400 Subject: [PATCH 009/983] 8008756: THIRD_PARTY_README contains Unicode Reviewed-by: jjh --- jdk/THIRD_PARTY_README | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 61834ab7a5a..6dc1b331638 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France TÈlÈcom +Copyright (c) 2000-2011 France Tlcom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬¨¬© 2001,2003 Keith Packard +Copyright ¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and +Privacy Policy. For trademark usage, see the Unicode® Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode¬Æ Standard, subject to Terms and + works conforming to the Unicode® Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of + Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive + website indicates your acknowledgement of Unicode, Inc.’s exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark - Policy‚Äù) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark + Policy”) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode‚Äôs prior written + assign any part of this Agreement without Unicode’s prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode‚Äôs net income. + Unicode’s net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy From 22e895a8979c6b14f8c87d8458e3d0af7c9bae42 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 18:03:07 -0400 Subject: [PATCH 010/983] 8008757: NEWBUILD=true has separate launcher code for jjs Reviewed-by: jjh --- jdk/makefiles/CompileLaunchers.gmk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jdk/makefiles/CompileLaunchers.gmk b/jdk/makefiles/CompileLaunchers.gmk index 8d6f606acfc..501c986082e 100644 --- a/jdk/makefiles/CompileLaunchers.gmk +++ b/jdk/makefiles/CompileLaunchers.gmk @@ -312,9 +312,7 @@ $(eval $(call SetupLauncher,jrunscript,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }')) $(eval $(call SetupLauncher,jjs,\ - -DJAVA_ARGS='{ "-J-XX:-TieredCompilation"$(COMMA) \ - "-J-Xms2G"$(COMMA) "-J-Xmx2G"$(COMMA) \ - "jdk.nashorn.tools.Shell"$(COMMA) }')) + -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }')) $(eval $(call SetupLauncher,jsadebugd,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \ From 636021664aecb3ed1fd8d6419e624baa379a09d3 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 22:58:48 -0400 Subject: [PATCH 011/983] 8008774: nashorn missing from dependencies after merge with tl Reviewed-by: jjh --- common/makefiles/Main.gmk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/makefiles/Main.gmk b/common/makefiles/Main.gmk index 30a966d9b21..c43f590707c 100644 --- a/common/makefiles/Main.gmk +++ b/common/makefiles/Main.gmk @@ -137,7 +137,7 @@ demos-only: start-make # Note: This double-colon rule is intentional, to support # custom make file integration. -images:: source-tips demos images-only +images:: source-tips demos nashorn images-only images-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) @@ -241,8 +241,8 @@ clean-docs: $(call CleanComponent,docs) $(call CleanComponent,docstemp) -.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install -.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only +.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install +.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only .PHONY: all test clean dist-clean bootcycle-images start-make .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build .PHONY: profiles profiles-only profiles-oscheck From b5a3cc405ba9f7e113dcd1ac80135bd4a7cf0cd1 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 23:36:47 -0400 Subject: [PATCH 012/983] 8008775: Remove non-ascii from jdk/THIRD_PARTY_README Reviewed-by: jjh --- jdk/THIRD_PARTY_README | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 6dc1b331638..458e7537479 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France Tlcom +Copyright (c) 2000-2011 France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬© 2001,2003 Keith Packard +Copyright ¬¨¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode® Consortium Name and +Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode® Standard, subject to Terms and + works conforming to the Unicode¬Æ Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of + Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.’s exclusive + website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark - Policy”) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark + Policy‚Äù) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode’s prior written + assign any part of this Agreement without Unicode‚Äôs prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode’s net income. + Unicode‚Äôs net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy From 8f734f4dcff290797f5ffc99dc13ebc97bd7d813 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 23 Apr 2013 09:37:31 +0200 Subject: [PATCH 013/983] 8011081: Improve jhat Properly escape HTML output Reviewed-by: alanb, mschoene, sundar --- .../hat/internal/server/AllClassesQuery.java | 2 +- .../tools/hat/internal/server/ClassQuery.java | 10 +++++----- .../tools/hat/internal/server/HttpReader.java | 10 +++------- .../internal/server/InstancesCountQuery.java | 4 ++-- .../sun/tools/hat/internal/server/OQLHelp.java | 5 +---- .../sun/tools/hat/internal/server/OQLQuery.java | 15 +++------------ .../tools/hat/internal/server/QueryHandler.java | 17 +++++++++++++++-- .../hat/internal/server/RefsByTypeQuery.java | 6 +++--- 8 files changed, 33 insertions(+), 36 deletions(-) diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java index d44a8fc2ecf..bdf01b8d5c6 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java @@ -84,7 +84,7 @@ class AllClassesQuery extends QueryHandler { lastPackage = pkg; printClass(clazz); if (clazz.getId() != -1) { - out.print(" [" + clazz.getIdString() + "]"); + print(" [" + clazz.getIdString() + "]"); } out.println("
"); } diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java index 1d5782390ce..f13572a22cc 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/ClassQuery.java @@ -112,12 +112,12 @@ class ClassQuery extends QueryHandler { out.println("

Instances

"); printAnchorStart(); - out.print("instances/" + encodeForURL(clazz)); + print("instances/" + encodeForURL(clazz)); out.print("\">"); out.println("Exclude subclasses
"); printAnchorStart(); - out.print("allInstances/" + encodeForURL(clazz)); + print("allInstances/" + encodeForURL(clazz)); out.print("\">"); out.println("Include subclasses
"); @@ -126,19 +126,19 @@ class ClassQuery extends QueryHandler { out.println("

New Instances

"); printAnchorStart(); - out.print("newInstances/" + encodeForURL(clazz)); + print("newInstances/" + encodeForURL(clazz)); out.print("\">"); out.println("Exclude subclasses
"); printAnchorStart(); - out.print("allNewInstances/" + encodeForURL(clazz)); + print("allNewInstances/" + encodeForURL(clazz)); out.print("\">"); out.println("Include subclasses
"); } out.println("

References summary by Type

"); printAnchorStart(); - out.print("refsByType/" + encodeForURL(clazz)); + print("refsByType/" + encodeForURL(clazz)); out.print("\">"); out.println("References summary by type"); diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/HttpReader.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/HttpReader.java index f86c8caa8e2..f08c9875c67 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/HttpReader.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/HttpReader.java @@ -41,21 +41,17 @@ package com.sun.tools.hat.internal.server; import java.net.Socket; -import java.net.ServerSocket; -import java.net.InetAddress; import java.io.InputStream; import java.io.BufferedInputStream; import java.io.IOException; -import java.io.Writer; import java.io.BufferedWriter; import java.io.PrintWriter; -import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.BufferedOutputStream; import com.sun.tools.hat.internal.model.Snapshot; import com.sun.tools.hat.internal.oql.OQLEngine; +import com.sun.tools.hat.internal.util.Misc; public class HttpReader implements Runnable { @@ -87,7 +83,7 @@ public class HttpReader implements Runnable { outputError("Protocol error"); } int data; - StringBuffer queryBuf = new StringBuffer(); + StringBuilder queryBuf = new StringBuilder(); while ((data = in.read()) != -1 && data != ' ') { char ch = (char) data; queryBuf.append(ch); @@ -217,7 +213,7 @@ public class HttpReader implements Runnable { private void outputError(String msg) { out.println(); out.println(""); - out.println(msg); + out.println(Misc.encodeHtml(msg)); out.println(""); } diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java index 724b549ca4b..7e87543ef99 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/InstancesCountQuery.java @@ -102,7 +102,7 @@ class InstancesCountQuery extends QueryHandler { int count = clazz.getInstancesCount(false); print("" + count); printAnchorStart(); - out.print("instances/" + encodeForURL(classes[i])); + print("instances/" + encodeForURL(classes[i])); out.print("\"> "); if (count == 1) { print("instance"); @@ -121,7 +121,7 @@ class InstancesCountQuery extends QueryHandler { } print("("); printAnchorStart(); - out.print("newInstances/" + encodeForURL(classes[i])); + print("newInstances/" + encodeForURL(classes[i])); out.print("\">"); print("" + newInst + " new"); out.print(") "); diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLHelp.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLHelp.java index 6aaa909109a..730d2b7672d 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLHelp.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLHelp.java @@ -54,10 +54,7 @@ class OQLHelp extends QueryHandler { out.print((char)ch); } } catch (Exception exp) { - out.println(exp.getMessage()); - out.println("
");
-            exp.printStackTrace(out);
-            out.println("
"); + printException(exp); } } } diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLQuery.java index 8e5ec5e2894..3e99bbcbb74 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLQuery.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/OQLQuery.java @@ -32,10 +32,7 @@ package com.sun.tools.hat.internal.server; -import com.sun.tools.hat.internal.model.*; import com.sun.tools.hat.internal.oql.*; -import com.sun.tools.hat.internal.util.ArraySorter; -import com.sun.tools.hat.internal.util.Comparer; /** * This handles Object Query Language (OQL) queries. @@ -68,7 +65,7 @@ class OQLQuery extends QueryHandler { out.println("

"); out.println(""); out.println("

"); @@ -91,10 +88,7 @@ class OQLQuery extends QueryHandler { try { out.println(engine.toHtml(o)); } catch (Exception e) { - out.println(e.getMessage()); - out.println("
");
-                             e.printStackTrace(out);
-                             out.println("
"); + printException(e); } out.println(""); return false; @@ -102,10 +96,7 @@ class OQLQuery extends QueryHandler { }); out.println(""); } catch (OQLException exp) { - out.println(exp.getMessage()); - out.println("
");
-            exp.printStackTrace(out);
-            out.println("
"); + printException(exp); } } diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/QueryHandler.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/QueryHandler.java index deda0f48058..9a6d93de06a 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/QueryHandler.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/QueryHandler.java @@ -36,6 +36,7 @@ import java.io.PrintWriter; import com.sun.tools.hat.internal.model.*; import com.sun.tools.hat.internal.util.Misc; +import java.io.StringWriter; import java.net.URLEncoder; import java.io.UnsupportedEncodingException; @@ -96,7 +97,7 @@ abstract class QueryHandler { } protected void error(String msg) { - out.println(msg); + println(msg); } protected void printAnchorStart() { @@ -160,7 +161,6 @@ abstract class QueryHandler { out.println("null"); return; } - String name = clazz.getName(); printAnchorStart(); out.print("class/"); print(encodeForURL(clazz)); @@ -208,6 +208,15 @@ abstract class QueryHandler { } } + protected void printException(Throwable t) { + println(t.getMessage()); + out.println("
");
+        StringWriter sw = new StringWriter();
+        t.printStackTrace(new PrintWriter(sw));
+        print(sw.toString());
+        out.println("
"); + } + protected void printHex(long addr) { if (snapshot.getIdentifierSize() == 4) { out.print(Misc.toHex((int)addr)); @@ -223,4 +232,8 @@ abstract class QueryHandler { protected void print(String str) { out.print(Misc.encodeHtml(str)); } + + protected void println(String str) { + out.println(Misc.encodeHtml(str)); + } } diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java index 5e7de9a8866..3337b471590 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java @@ -89,7 +89,7 @@ public class RefsByTypeQuery extends QueryHandler { out.println("

"); printClass(clazz); if (clazz.getId() != -1) { - out.println("[" + clazz.getIdString() + "]"); + println("[" + clazz.getIdString() + "]"); } out.println("

"); @@ -125,9 +125,9 @@ public class RefsByTypeQuery extends QueryHandler { JavaClass clazz = classes[i]; out.println(""); out.print(""); - out.print(clazz.getName()); + print(clazz.getName()); out.println(""); out.println(""); out.println(map.get(clazz)); From 7ca524c5cd9a36f350d8bb8ba5770df69427e706 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Tue, 7 May 2013 13:37:03 -0700 Subject: [PATCH 014/983] 8013506: Better Pack200 data handling Reviewed-by: jrose, kizune, mschoene --- jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp index 93bf3301546..f7b95b47368 100644 --- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp +++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -340,6 +340,10 @@ uLong jar::get_dostime(int modtime) { struct tm sbuf; (void)memset((void*)&sbuf,0, sizeof(sbuf)); struct tm* s = gmtime_r(&t, &sbuf); + if (s == NULL) { + fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n"); + exit(2); + } modtime_cache = modtime; dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday, s->tm_hour, s->tm_min, s->tm_sec); @@ -384,7 +388,7 @@ bool jar::deflate_bytes(bytes& head, bytes& tail) { } deflated.empty(); - zs.next_out = (uchar*) deflated.grow(len + (len/2)); + zs.next_out = (uchar*) deflated.grow(add_size(len, (len/2))); zs.avail_out = (int)deflated.size(); zs.next_in = (uchar*)head.ptr; From e8457abad47c8c47beafcdbb394bbaf88b30753e Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 9 May 2013 09:52:55 -0700 Subject: [PATCH 015/983] 8013510: Augment image writing code Reviewed-by: bae, prr --- .../com/sun/imageio/plugins/jpeg/JPEGImageReader.java | 5 +++++ .../com/sun/imageio/plugins/jpeg/JPEGImageWriter.java | 4 ++-- jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java index d69200c1408..0b7a865074a 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java @@ -1165,6 +1165,11 @@ public class JPEGImageReader extends ImageReader { target = imRas; } int [] bandSizes = target.getSampleModel().getSampleSize(); + for (int i = 0; i < bandSizes.length; i++) { + if (bandSizes[i] <= 0 || bandSizes[i] > 8) { + throw new IIOException("Illegal band size: should be 0 < size <= 8"); + } + } /* * If the process is sequential, and we have restart markers, diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java index b8564176df8..d9723e7ba20 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java @@ -495,8 +495,8 @@ public class JPEGImageWriter extends ImageWriter { // handle <= 8-bit samples. We now check the band sizes and throw // an exception for images, such as USHORT_GRAY, with > 8 bits // per sample. - if (bandSizes[i] > 8) { - throw new IIOException("Sample size must be <= 8"); + if (bandSizes[i] <= 0 || bandSizes[i] > 8) { + throw new IIOException("Illegal band size: should be 0 < size <= 8"); } // 4450894 part 2: We expand IndexColorModel images to full 24- // or 32-bit in grabPixels() for each scanline. For indexed diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c index 7411c34bb83..4934c748f61 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c @@ -2674,6 +2674,15 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage bandSize = (*env)->GetIntArrayElements(env, bandSizes, NULL); + for (i = 0; i < numBands; i++) { + if (bandSize[i] <= 0 || bandSize[i] > JPEG_BAND_SIZE) { + (*env)->ReleaseIntArrayElements(env, bandSizes, + bandSize, JNI_ABORT); + JNU_ThrowByName(env, "javax/imageio/IIOException", "Invalid Image"); + return JNI_FALSE;; + } + } + for (i = 0; i < numBands; i++) { if (bandSize[i] != JPEG_BAND_SIZE) { if (scale == NULL) { From 7dacefeca149e32a783e18398b5974d6c53bb867 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Tue, 14 May 2013 12:51:59 +0400 Subject: [PATCH 016/983] 8014093: Improve parsing of images Reviewed-by: prr, jgodinez --- .../native/sun/awt/image/awt_parseImage.c | 443 ++++++------------ .../native/sun/awt/image/awt_parseImage.h | 11 +- .../native/sun/awt/medialib/awt_ImagingLib.c | 114 +---- 3 files changed, 151 insertions(+), 417 deletions(-) diff --git a/jdk/src/share/native/sun/awt/image/awt_parseImage.c b/jdk/src/share/native/sun/awt/image/awt_parseImage.c index e11a8dbee8c..8d6e9a3ed80 100644 --- a/jdk/src/share/native/sun/awt/image/awt_parseImage.c +++ b/jdk/src/share/native/sun/awt/image/awt_parseImage.c @@ -873,363 +873,204 @@ setHints(JNIEnv *env, BufImageS_t *imageP) { return 1; } -/* - * This routine will fill in a buffer of data for either 1 band or all - * bands (if band == -1). - */ #define MAX_TO_GRAB (10240) -int awt_getPixelByte(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned char *bufferP) { - int w = rasterP->width; - int h = rasterP->height; - int numBands = rasterP->numBands; +typedef union { + void *pv; + unsigned char *pb; + unsigned short *ps; +} PixelData_t; + + +int awt_getPixels(JNIEnv *env, RasterS_t *rasterP, void *bufferP) { + const int w = rasterP->width; + const int h = rasterP->height; + const int numBands = rasterP->numBands; int y; int i; - int maxLines = (h < MAX_TO_GRAB/w ? h : MAX_TO_GRAB/w); + int maxLines; jobject jsm; - int off; + int off = 0; jarray jdata = NULL; jobject jdatabuffer; int *dataP; - int maxBytes = w; + int maxSamples; + PixelData_t p; + + if (bufferP == NULL) { + return -1; + } + + if (rasterP->dataType != BYTE_DATA_TYPE && + rasterP->dataType != SHORT_DATA_TYPE) + { + return -1; + } + + p.pv = bufferP; + + if (!SAFE_TO_MULT(w, numBands)) { + return -1; + } + maxSamples = w * numBands; + + maxLines = maxSamples > MAX_TO_GRAB ? 1 : (MAX_TO_GRAB / maxSamples); + if (maxLines > h) { + maxLines = h; + } + + if (!SAFE_TO_MULT(maxSamples, maxLines)) { + return -1; + } + + maxSamples *= maxLines; jsm = (*env)->GetObjectField(env, rasterP->jraster, g_RasterSampleModelID); jdatabuffer = (*env)->GetObjectField(env, rasterP->jraster, g_RasterDataBufferID); - jdata = (*env)->NewIntArray(env, maxBytes*rasterP->numBands*maxLines); + + jdata = (*env)->NewIntArray(env, maxSamples); if (JNU_IsNull(env, jdata)) { JNU_ThrowOutOfMemoryError(env, "Out of Memory"); return -1; } - /* Here is the generic code */ - if (band >= 0) { - int dOff; - if (band >= numBands) { + for (y = 0; y < h; y += maxLines) { + if (y + maxLines > h) { + maxLines = h - y; + maxSamples = w * numBands * maxLines; + } + + (*env)->CallObjectMethod(env, jsm, g_SMGetPixelsMID, + 0, y, w, + maxLines, jdata, jdatabuffer); + + if ((*env)->ExceptionOccurred(env)) { (*env)->DeleteLocalRef(env, jdata); - JNU_ThrowInternalError(env, "Band out of range."); return -1; } - off = 0; - for (y=0; y < h; ) { - (*env)->CallObjectMethod(env, jsm, g_SMGetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - dOff = band; - for (i=0; i < maxBytes; i++, dOff += numBands) { - bufferP[off++] = (unsigned char) dataP[dOff]; - } - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - if (y+maxLines < h) { - y += maxLines; - } - else { - y++; - maxBytes = w; - } - } - } - else { - off = 0; - maxBytes *= numBands; - for (y=0; y < h; ) { - (*env)->CallObjectMethod(env, jsm, g_SMGetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - for (i=0; i < maxBytes; i++) { - bufferP[off++] = (unsigned char) dataP[i]; - } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - if (y+maxLines < h) { - y += maxLines; - } - else { - y++; - maxBytes = w*numBands; - } - } - - } - (*env)->DeleteLocalRef(env, jdata); - - return 0; -} -int awt_setPixelByte(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned char *bufferP) { - int w = rasterP->width; - int h = rasterP->height; - int numBands = rasterP->numBands; - int y; - int i; - int maxLines = (h < MAX_TO_GRAB/w ? h : MAX_TO_GRAB/w); - jobject jsm; - int off; - jarray jdata = NULL; - jobject jdatabuffer; - int *dataP; - int maxBytes = w; - - jsm = (*env)->GetObjectField(env, rasterP->jraster, g_RasterSampleModelID); - jdatabuffer = (*env)->GetObjectField(env, rasterP->jraster, - g_RasterDataBufferID); - /* Here is the generic code */ - jdata = (*env)->NewIntArray(env, maxBytes*rasterP->numBands*maxLines); - if (JNU_IsNull(env, jdata)) { - JNU_ThrowOutOfMemoryError(env, "Out of Memory"); - return -1; - } - if (band >= 0) { - int dOff; - if (band >= numBands) { + dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, + NULL); + if (dataP == NULL) { (*env)->DeleteLocalRef(env, jdata); - JNU_ThrowInternalError(env, "Band out of range."); return -1; } - off = 0; - for (y=0; y < h; y+=maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; - } - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - dOff = band; - for (i=0; i < maxBytes; i++, dOff += numBands) { - dataP[dOff] = bufferP[off++]; - } - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - (*env)->CallVoidMethod(env, jsm, g_SMSetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - } - } - else { - off = 0; - maxBytes *= numBands; - for (y=0; y < h; y+=maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; + switch (rasterP->dataType) { + case BYTE_DATA_TYPE: + for (i = 0; i < maxSamples; i ++) { + p.pb[off++] = (unsigned char) dataP[i]; } - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; + break; + case SHORT_DATA_TYPE: + for (i = 0; i < maxSamples; i ++) { + p.ps[off++] = (unsigned short) dataP[i]; } - for (i=0; i < maxBytes; i++) { - dataP[i] = bufferP[off++]; - } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - (*env)->CallVoidMethod(env, jsm, g_SMSetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); + break; } + (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, + JNI_ABORT); } - (*env)->DeleteLocalRef(env, jdata); - return 0; + return 1; } -int awt_getPixelShort(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned short *bufferP) { - int w = rasterP->width; - int h = rasterP->height; - int numBands = rasterP->numBands; + +int awt_setPixels(JNIEnv *env, RasterS_t *rasterP, void *bufferP) { + const int w = rasterP->width; + const int h = rasterP->height; + const int numBands = rasterP->numBands; + int y; int i; - int maxLines = (h < MAX_TO_GRAB/w ? h : MAX_TO_GRAB/w); + int maxLines; jobject jsm; - int off; + int off = 0; jarray jdata = NULL; jobject jdatabuffer; int *dataP; - int maxBytes = w*maxLines; + int maxSamples; + PixelData_t p; + + if (bufferP == NULL) { + return -1; + } + + if (rasterP->dataType != BYTE_DATA_TYPE && + rasterP->dataType != SHORT_DATA_TYPE) + { + return -1; + } + + p.pv = bufferP; + + if (!SAFE_TO_MULT(w, numBands)) { + return -1; + } + maxSamples = w * numBands; + + maxLines = maxSamples > MAX_TO_GRAB ? 1 : (MAX_TO_GRAB / maxSamples); + if (maxLines > h) { + maxLines = h; + } + + if (!SAFE_TO_MULT(maxSamples, maxLines)) { + return -1; + } + + maxSamples *= maxLines; jsm = (*env)->GetObjectField(env, rasterP->jraster, g_RasterSampleModelID); jdatabuffer = (*env)->GetObjectField(env, rasterP->jraster, g_RasterDataBufferID); - jdata = (*env)->NewIntArray(env, maxBytes*rasterP->numBands*maxLines); + + jdata = (*env)->NewIntArray(env, maxSamples); if (JNU_IsNull(env, jdata)) { JNU_ThrowOutOfMemoryError(env, "Out of Memory"); return -1; } - /* Here is the generic code */ - if (band >= 0) { - int dOff; - if (band >= numBands) { + + for (y = 0; y < h; y += maxLines) { + if (y + maxLines > h) { + maxLines = h - y; + maxSamples = w * numBands * maxLines; + } + dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, + NULL); + if (dataP == NULL) { (*env)->DeleteLocalRef(env, jdata); - JNU_ThrowInternalError(env, "Band out of range."); return -1; } - off = 0; - for (y=0; y < h; y += maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; - } - (*env)->CallObjectMethod(env, jsm, g_SMGetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - dOff = band; - for (i=0; i < maxBytes; i++, dOff += numBands) { - bufferP[off++] = (unsigned short) dataP[dOff]; + switch (rasterP->dataType) { + case BYTE_DATA_TYPE: + for (i = 0; i < maxSamples; i ++) { + dataP[i] = p.pb[off++]; } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - } - } - else { - off = 0; - maxBytes *= numBands; - for (y=0; y < h; y+=maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; + break; + case SHORT_DATA_TYPE: + for (i = 0; i < maxSamples; i ++) { + dataP[i] = p.ps[off++]; } - (*env)->CallObjectMethod(env, jsm, g_SMGetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - for (i=0; i < maxBytes; i++) { - bufferP[off++] = (unsigned short) dataP[i]; - } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); + break; } + (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, + JNI_ABORT); + + (*env)->CallVoidMethod(env, jsm, g_SMSetPixelsMID, + 0, y, w, + maxLines, jdata, jdatabuffer); + + if ((*env)->ExceptionOccurred(env)) { + (*env)->DeleteLocalRef(env, jdata); + return -1; + } } (*env)->DeleteLocalRef(env, jdata); - return 0; -} -int awt_setPixelShort(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned short *bufferP) { - int w = rasterP->width; - int h = rasterP->height; - int numBands = rasterP->numBands; - int y; - int i; - int maxLines = (h < MAX_TO_GRAB/w ? h : MAX_TO_GRAB/w); - jobject jsm; - int off; - jarray jdata = NULL; - jobject jdatabuffer; - int *dataP; - int maxBytes = w; - - jsm = (*env)->GetObjectField(env, rasterP->jraster, g_RasterSampleModelID); - jdatabuffer = (*env)->GetObjectField(env, rasterP->jraster, - g_RasterDataBufferID); - if (band >= numBands) { - JNU_ThrowInternalError(env, "Band out of range."); - return -1; - } - /* Here is the generic code */ - jdata = (*env)->NewIntArray(env, maxBytes*rasterP->numBands*maxLines); - if (JNU_IsNull(env, jdata)) { - JNU_ThrowOutOfMemoryError(env, "Out of Memory"); - return -1; - } - if (band >= 0) { - int dOff; - off = 0; - for (y=0; y < h; y+=maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; - } - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - dOff = band; - for (i=0; i < maxBytes; i++, dOff += numBands) { - dataP[dOff] = bufferP[off++]; - } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - (*env)->CallVoidMethod(env, jsm, g_SMSetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - } - } - else { - off = 0; - maxBytes *= numBands; - for (y=0; y < h; y+=maxLines) { - if (y+maxLines > h) { - maxBytes = w*numBands; - maxLines = h - y; - } - dataP = (int *) (*env)->GetPrimitiveArrayCritical(env, jdata, - NULL); - if (dataP == NULL) { - (*env)->DeleteLocalRef(env, jdata); - return -1; - } - for (i=0; i < maxBytes; i++) { - dataP[i] = bufferP[off++]; - } - - (*env)->ReleasePrimitiveArrayCritical(env, jdata, dataP, - JNI_ABORT); - - (*env)->CallVoidMethod(env, jsm, g_SMSetPixelsMID, - 0, y, w, - maxLines, jdata, jdatabuffer); - } - - } - - (*env)->DeleteLocalRef(env, jdata); - return 0; + + return 1; } diff --git a/jdk/src/share/native/sun/awt/image/awt_parseImage.h b/jdk/src/share/native/sun/awt/image/awt_parseImage.h index b92bb0c2833..02dfd1a2154 100644 --- a/jdk/src/share/native/sun/awt/image/awt_parseImage.h +++ b/jdk/src/share/native/sun/awt/image/awt_parseImage.h @@ -188,13 +188,8 @@ void awt_freeParsedRaster(RasterS_t *rasterP, int freeRasterP); void awt_freeParsedImage(BufImageS_t *imageP, int freeImageP); -int awt_getPixelByte(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned char *bufferP); -int awt_setPixelByte(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned char *bufferP); -int awt_getPixelShort(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned short *bufferP); -int awt_setPixelShort(JNIEnv *env, int band, RasterS_t *rasterP, - unsigned short *bufferP); +int awt_getPixels(JNIEnv *env, RasterS_t *rasterP, void *bufferP); + +int awt_setPixels(JNIEnv *env, RasterS_t *rasterP, void *bufferP); #endif /* AWT_PARSE_IMAGE_H */ diff --git a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c index 25764213888..e3af348adda 100644 --- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c +++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c @@ -700,22 +700,7 @@ Java_sun_awt_image_ImagingLib_convolveRaster(JNIEnv *env, jobject this, /* Means that we couldn't write directly into the destination buffer */ if (ddata == NULL) { - unsigned char *bdataP; - unsigned short *sdataP; - - /* Punt for now */ - switch (dstRasterP->dataType) { - case BYTE_DATA_TYPE: - bdataP = (unsigned char *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelByte(env, -1, dstRasterP, bdataP) >= 0) ; - break; - case SHORT_DATA_TYPE: - sdataP = (unsigned short *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelShort(env, -1, dstRasterP, sdataP) >= 0) ; - break; - default: - retStatus = 0; - } + retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst)); } /* Release the pinned memory */ @@ -1119,24 +1104,9 @@ fprintf(stderr,"Flags : %d\n",dst->flags); /* Means that we couldn't write directly into the destination buffer */ if (ddata == NULL) { - unsigned char *bdataP; - unsigned short *sdataP; - /* Need to store it back into the array */ if (storeRasterArray(env, srcRasterP, dstRasterP, dst) < 0) { - /* Punt for now */ - switch (dst->type) { - case MLIB_BYTE: - bdataP = (unsigned char *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelByte(env, -1, dstRasterP, bdataP) >= 0) ; - break; - case MLIB_SHORT: - sdataP = (unsigned short *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelShort(env, -1, dstRasterP, sdataP) >= 0) ; - break; - default: - retStatus = 0; - } + retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst)); } } @@ -1704,21 +1674,7 @@ Java_sun_awt_image_ImagingLib_lookupByteRaster(JNIEnv *env, * the destination buffer */ if (ddata == NULL) { - unsigned char* bdataP; - unsigned short* sdataP; - - switch (dstRasterP->dataType) { - case BYTE_DATA_TYPE: - bdataP = (unsigned char *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelByte(env, -1, dstRasterP, bdataP) >= 0) ; - break; - case SHORT_DATA_TYPE: - sdataP = (unsigned short *) mlib_ImageGetData(dst); - retStatus = (awt_setPixelShort(env, -1, dstRasterP, sdataP) >= 0) ; - break; - default: - retStatus = 0; - } + retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst)); } /* Release the LUT */ @@ -2298,7 +2254,6 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP, mlib_image **mlibImagePP, void **dataPP, int isSrc) { void *dataP; unsigned char *cDataP; - unsigned short *sdataP; int dataType = BYTE_DATA_TYPE; int width; int height; @@ -2484,8 +2439,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP, return -1; } if (isSrc) { - cDataP = (unsigned char *) mlib_ImageGetData(*mlibImagePP); - if (awt_getPixelByte(env, -1, rasterP, cDataP) < 0) { + if (awt_getPixels(env, rasterP, mlib_ImageGetData(*mlibImagePP)) < 0) { (*sMlibSysFns.deleteImageFP)(*mlibImagePP); return -1; } @@ -2499,8 +2453,7 @@ allocateRasterArray(JNIEnv *env, RasterS_t *rasterP, return -1; } if (isSrc) { - sdataP = (unsigned short *) mlib_ImageGetData(*mlibImagePP); - if (awt_getPixelShort(env, -1, rasterP, sdataP) < 0) { + if (awt_getPixels(env, rasterP, mlib_ImageGetData(*mlibImagePP)) < 0) { (*sMlibSysFns.deleteImageFP)(*mlibImagePP); return -1; } @@ -2550,60 +2503,6 @@ freeDataArray(JNIEnv *env, jobject srcJdata, mlib_image *srcmlibImP, } } -static int -storeDstArray(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP, - mlibHintS_t *hintP, mlib_image *mlibImP, void *ddata) { - RasterS_t *rasterP = &dstP->raster; - - /* Nothing to do since it is the same image type */ - if (srcP->imageType == dstP->imageType - && srcP->imageType != java_awt_image_BufferedImage_TYPE_CUSTOM - && srcP->imageType != java_awt_image_BufferedImage_TYPE_BYTE_INDEXED - && srcP->imageType != java_awt_image_BufferedImage_TYPE_BYTE_BINARY) { - /* REMIND: Should check the ICM LUTS to see if it is the same */ - return 0; - } - - /* These types are compatible with TYPE_INT_RGB */ - if (srcP->imageType == java_awt_image_BufferedImage_TYPE_INT_RGB - && (dstP->imageType == java_awt_image_BufferedImage_TYPE_INT_ARGB || - dstP->imageType == java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE)){ - return 0; - } - - if (hintP->cvtSrcToDefault && - (srcP->cmodel.isAlphaPre == dstP->cmodel.isAlphaPre)) { - if (srcP->cmodel.isAlphaPre) { - if (dstP->imageType == - java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE) - { - return 0; - } - if (!srcP->cmodel.supportsAlpha && - dstP->imageType == java_awt_image_BufferedImage_TYPE_INT_RGB){ - return 0; - } - } - else { - /* REMIND: */ - } - } - - if (dstP->cmodel.cmType == DIRECT_CM_TYPE) { - /* Just need to move bits */ - if (mlibImP->type == MLIB_BYTE) { - return awt_setPixelByte(env, -1, &dstP->raster, - (unsigned char *) mlibImP->data); - } - else if (mlibImP->type == MLIB_SHORT) { - return awt_setPixelByte(env, -1, &dstP->raster, - (unsigned char *) mlibImP->data); - } - } - - return 0; -} - #define ERR_BAD_IMAGE_LAYOUT (-2) #define CHECK_DST_ARRAY(start_offset, elements_per_pixel) \ @@ -2716,8 +2615,7 @@ storeImageArray(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP, } } else if (mlibImP->type == MLIB_SHORT) { - return awt_setPixelShort(env, -1, rasterP, - (unsigned short *) mlibImP->data); + return awt_setPixels(env, rasterP, mlibImP->data); } } else { From 38c8e922af160aeb9e4a054cd779d63011960bd4 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Mon, 20 May 2013 14:39:17 +0400 Subject: [PATCH 017/983] 8013744: Better tabling for AWT Reviewed-by: art, malenkov, skoivu --- jdk/src/share/classes/javax/swing/JTable.java | 18 +++++++++++------- .../share/classes/javax/swing/UIDefaults.java | 12 +++--------- .../javax/swing/text/DefaultFormatter.java | 8 ++++++-- .../javax/swing/text/NumberFormatter.java | 6 +++++- .../classes/sun/swing/SwingLazyValue.java | 3 ++- .../classes/sun/swing/SwingUtilities2.java | 13 +++++++++++++ 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index bed8e5ca93e..3bb97ddfd44 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -52,6 +52,7 @@ import java.text.MessageFormat; import javax.print.attribute.*; import javax.print.PrintService; +import sun.reflect.misc.ReflectUtil; import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; @@ -5462,14 +5463,15 @@ public class JTable extends JComponent implements TableModelListener, Scrollable // they have the option to replace the value with // null or use escape to restore the original. // For Strings, return "" for backward compatibility. - if ("".equals(s)) { - if (constructor.getDeclaringClass() == String.class) { - value = s; - } - return super.stopCellEditing(); - } - try { + if ("".equals(s)) { + if (constructor.getDeclaringClass() == String.class) { + value = s; + } + return super.stopCellEditing(); + } + + SwingUtilities2.checkAccess(constructor.getModifiers()); value = constructor.newInstance(new Object[]{s}); } catch (Exception e) { @@ -5493,6 +5495,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable if (type == Object.class) { type = String.class; } + ReflectUtil.checkPackageAccess(type); + SwingUtilities2.checkAccess(type.getModifiers()); constructor = type.getConstructor(argTypes); } catch (Exception e) { diff --git a/jdk/src/share/classes/javax/swing/UIDefaults.java b/jdk/src/share/classes/javax/swing/UIDefaults.java index 9f304e742c7..3bd1297dd58 100644 --- a/jdk/src/share/classes/javax/swing/UIDefaults.java +++ b/jdk/src/share/classes/javax/swing/UIDefaults.java @@ -53,6 +53,7 @@ import java.security.PrivilegedAction; import sun.reflect.misc.MethodUtil; import sun.reflect.misc.ReflectUtil; +import sun.swing.SwingUtilities2; import sun.util.CoreResourceBundleControl; /** @@ -1101,7 +1102,7 @@ public class UIDefaults extends Hashtable } ReflectUtil.checkPackageAccess(className); c = Class.forName(className, true, (ClassLoader)cl); - checkAccess(c.getModifiers()); + SwingUtilities2.checkAccess(c.getModifiers()); if (methodName != null) { Class[] types = getClassArray(args); Method m = c.getMethod(methodName, types); @@ -1109,7 +1110,7 @@ public class UIDefaults extends Hashtable } else { Class[] types = getClassArray(args); Constructor constructor = c.getConstructor(types); - checkAccess(constructor.getModifiers()); + SwingUtilities2.checkAccess(constructor.getModifiers()); return constructor.newInstance(args); } } catch(Exception e) { @@ -1124,13 +1125,6 @@ public class UIDefaults extends Hashtable }, acc); } - private void checkAccess(int modifiers) { - if(System.getSecurityManager() != null && - !Modifier.isPublic(modifiers)) { - throw new SecurityException("Resource is not accessible"); - } - } - /* * Coerce the array of class types provided into one which * looks the way the Reflection APIs expect. This is done diff --git a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java index b67966ab70a..ac5bc72e76f 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java @@ -24,7 +24,8 @@ */ package javax.swing.text; -import sun.reflect.misc.ConstructorUtil; +import sun.reflect.misc.ReflectUtil; +import sun.swing.SwingUtilities2; import java.io.Serializable; import java.lang.reflect.*; @@ -247,7 +248,9 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter Constructor cons; try { - cons = ConstructorUtil.getConstructor(vc, new Class[]{String.class}); + ReflectUtil.checkPackageAccess(vc); + SwingUtilities2.checkAccess(vc.getModifiers()); + cons = vc.getConstructor(new Class[]{String.class}); } catch (NoSuchMethodException nsme) { cons = null; @@ -255,6 +258,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter if (cons != null) { try { + SwingUtilities2.checkAccess(cons.getModifiers()); return cons.newInstance(new Object[] { string }); } catch (Throwable ex) { throw new ParseException("Error creating instance", 0); diff --git a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java index 9500dcc03b7..672a92e5b63 100644 --- a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java +++ b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java @@ -27,6 +27,8 @@ package javax.swing.text; import java.lang.reflect.*; import java.text.*; import java.util.*; +import sun.reflect.misc.ReflectUtil; +import sun.swing.SwingUtilities2; /** * NumberFormatter subclasses InternationalFormatter @@ -427,10 +429,12 @@ public class NumberFormatter extends InternationalFormatter { valueClass = value.getClass(); } try { + ReflectUtil.checkPackageAccess(valueClass); + SwingUtilities2.checkAccess(valueClass.getModifiers()); Constructor cons = valueClass.getConstructor( new Class[] { String.class }); - if (cons != null) { + SwingUtilities2.checkAccess(cons.getModifiers()); return cons.newInstance(new Object[]{string}); } } catch (Throwable ex) { } diff --git a/jdk/src/share/classes/sun/swing/SwingLazyValue.java b/jdk/src/share/classes/sun/swing/SwingLazyValue.java index 2d1aa9cf847..a9e6f2c1bc8 100644 --- a/jdk/src/share/classes/sun/swing/SwingLazyValue.java +++ b/jdk/src/share/classes/sun/swing/SwingLazyValue.java @@ -30,6 +30,7 @@ import java.lang.reflect.AccessibleObject; import java.security.AccessController; import java.security.PrivilegedAction; import javax.swing.UIDefaults; +import sun.reflect.misc.ReflectUtil; /** * SwingLazyValue is a copy of ProxyLazyValue that does not snapshot the @@ -63,7 +64,7 @@ public class SwingLazyValue implements UIDefaults.LazyValue { public Object createValue(final UIDefaults table) { try { - Object cl; + ReflectUtil.checkPackageAccess(className); Class c = Class.forName(className, true, null); if (methodName != null) { Class[] types = getClassArray(args); diff --git a/jdk/src/share/classes/sun/swing/SwingUtilities2.java b/jdk/src/share/classes/sun/swing/SwingUtilities2.java index c6134885adf..57f7bb39cdc 100644 --- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java +++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java @@ -1311,6 +1311,19 @@ public class SwingUtilities2 { } } + /** + * Utility method that throws SecurityException if SecurityManager is set + * and modifiers are not public + * + * @param modifiers a set of modifiers + */ + public static void checkAccess(int modifiers) { + if (System.getSecurityManager() != null + && !Modifier.isPublic(modifiers)) { + throw new SecurityException("Resource is not accessible"); + } + } + /** * Returns true if EventQueue.getCurrentEvent() has the permissions to * access the system clipboard and if it is allowed gesture (if From 9a9e180fdd52a65f07849cdd40c72bacd150b99d Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 20 May 2013 15:26:42 +0400 Subject: [PATCH 018/983] 8014102: Improve image conversion Reviewed-by: mschoene, prr, jgodinez --- .../native/sun/awt/medialib/awt_ImagingLib.c | 94 +++++++++++++------ 1 file changed, 63 insertions(+), 31 deletions(-) diff --git a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c index e3af348adda..5b5f2acda71 100644 --- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c +++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c @@ -1985,21 +1985,25 @@ expandPacked(JNIEnv *env, BufImageS_t *img, ColorModelS_t *cmP, return 0; } +#define NUM_LINES 10 + static int cvtCustomToDefault(JNIEnv *env, BufImageS_t *imageP, int component, unsigned char *dataP) { - ColorModelS_t *cmP = &imageP->cmodel; - RasterS_t *rasterP = &imageP->raster; + const RasterS_t *rasterP = &imageP->raster; + const int w = rasterP->width; + const int h = rasterP->height; + int y; - jobject jpixels = NULL; + jintArray jpixels = NULL; jint *pixels; unsigned char *dP = dataP; -#define NUM_LINES 10 - int numLines = NUM_LINES; + int numLines = h > NUM_LINES ? NUM_LINES : h; + /* it is safe to calculate the scan length, because width has been verified * on creation of the mlib image */ - int scanLength = rasterP->width * 4; + const int scanLength = w * 4; int nbytes = 0; if (!SAFE_TO_MULT(numLines, scanLength)) { @@ -2008,42 +2012,70 @@ cvtCustomToDefault(JNIEnv *env, BufImageS_t *imageP, int component, nbytes = numLines * scanLength; - for (y=0; y < rasterP->height; y+=numLines) { - /* getData, one scanline at a time */ - if (y+numLines > rasterP->height) { - numLines = rasterP->height - y; + jpixels = (*env)->NewIntArray(env, nbytes); + if (JNU_IsNull(env, jpixels)) { + JNU_ThrowOutOfMemoryError(env, "Out of Memory"); + return -1; + } + + for (y = 0; y < h; y += numLines) { + if (y + numLines > h) { + numLines = h - y; nbytes = numLines * scanLength; } - jpixels = (*env)->CallObjectMethod(env, imageP->jimage, - g_BImgGetRGBMID, 0, y, - rasterP->width, numLines, - jpixels,0, rasterP->width); - if (jpixels == NULL) { - JNU_ThrowInternalError(env, "Can't retrieve pixels."); + + (*env)->CallObjectMethod(env, imageP->jimage, + g_BImgGetRGBMID, 0, y, + w, numLines, + jpixels, 0, w); + if ((*env)->ExceptionOccurred(env)) { + (*env)->DeleteLocalRef(env, jpixels); return -1; } pixels = (*env)->GetPrimitiveArrayCritical(env, jpixels, NULL); + if (pixels == NULL) { + (*env)->DeleteLocalRef(env, jpixels); + return -1; + } + memcpy(dP, pixels, nbytes); dP += nbytes; + (*env)->ReleasePrimitiveArrayCritical(env, jpixels, pixels, JNI_ABORT); } + + /* Need to release the array */ + (*env)->DeleteLocalRef(env, jpixels); + return 0; } static int cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component, unsigned char *dataP) { - ColorModelS_t *cmP = &imageP->cmodel; - RasterS_t *rasterP = &imageP->raster; + const RasterS_t *rasterP = &imageP->raster; + const int w = rasterP->width; + const int h = rasterP->height; + int y; + jintArray jpixels = NULL; jint *pixels; unsigned char *dP = dataP; -#define NUM_LINES 10 - int numLines = NUM_LINES; - int nbytes = rasterP->width*4*NUM_LINES; - jintArray jpixels; + int numLines = h > NUM_LINES ? NUM_LINES : h; + + /* it is safe to calculate the scan length, because width has been verified + * on creation of the mlib image + */ + const int scanLength = w * 4; + + int nbytes = 0; + if (!SAFE_TO_MULT(numLines, scanLength)) { + return -1; + } + + nbytes = numLines * scanLength; jpixels = (*env)->NewIntArray(env, nbytes); if (JNU_IsNull(env, jpixels)) { @@ -2051,14 +2083,15 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component, return -1; } - for (y=0; y < rasterP->height; y+=NUM_LINES) { - if (y+numLines > rasterP->height) { - numLines = rasterP->height - y; - nbytes = rasterP->width*4*numLines; + for (y = 0; y < h; y += numLines) { + if (y + numLines > h) { + numLines = h - y; + nbytes = numLines * scanLength; } + pixels = (*env)->GetPrimitiveArrayCritical(env, jpixels, NULL); if (pixels == NULL) { - /* JNI error */ + (*env)->DeleteLocalRef(env, jpixels); return -1; } @@ -2067,12 +2100,11 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component, (*env)->ReleasePrimitiveArrayCritical(env, jpixels, pixels, 0); - /* setData, one scanline at a time */ - /* Fix 4223648, 4184283 */ (*env)->CallVoidMethod(env, imageP->jimage, g_BImgSetRGBMID, 0, y, - rasterP->width, numLines, jpixels, 0, - rasterP->width); + w, numLines, jpixels, + 0, w); if ((*env)->ExceptionOccurred(env)) { + (*env)->DeleteLocalRef(env, jpixels); return -1; } } From 5c6c0246ccc0e07d49ec855a939deb8b1ac42e54 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 20 May 2013 19:49:20 +0400 Subject: [PATCH 019/983] 8012071: Better Building of Beans Reviewed-by: art, skoivu --- jdk/src/share/classes/java/beans/Beans.java | 6 ++++++ .../beans/DefaultPersistenceDelegate.java | 3 +++ .../share/classes/java/beans/MetaData.java | 19 +++++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/jdk/src/share/classes/java/beans/Beans.java b/jdk/src/share/classes/java/beans/Beans.java index 2183d224167..a457fa41805 100644 --- a/jdk/src/share/classes/java/beans/Beans.java +++ b/jdk/src/share/classes/java/beans/Beans.java @@ -42,6 +42,8 @@ import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.io.StreamCorruptedException; +import java.lang.reflect.Modifier; + import java.net.URL; import java.security.AccessController; @@ -222,6 +224,10 @@ public class Beans { throw ex; } + if (!Modifier.isPublic(cl.getModifiers())) { + throw new ClassNotFoundException("" + cl + " : no public access"); + } + /* * Try to instantiate the class. */ diff --git a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java index 3c6c7c2a3d3..6891692c30b 100644 --- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java @@ -221,6 +221,9 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { // Write out the properties of this instance. private void initBean(Class type, Object oldInstance, Object newInstance, Encoder out) { for (Field field : type.getFields()) { + if (!ReflectUtil.isPackageAccessible(field.getDeclaringClass())) { + continue; + } int mod = field.getModifiers(); if (Modifier.isFinal(mod) || Modifier.isStatic(mod) || Modifier.isTransient(mod)) { continue; diff --git a/jdk/src/share/classes/java/beans/MetaData.java b/jdk/src/share/classes/java/beans/MetaData.java index 61f51d4bb3f..d733b6f1eab 100644 --- a/jdk/src/share/classes/java/beans/MetaData.java +++ b/jdk/src/share/classes/java/beans/MetaData.java @@ -42,6 +42,7 @@ import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.lang.reflect.InvocationTargetException; import java.security.AccessController; @@ -56,7 +57,7 @@ import javax.swing.plaf.ColorUIResource; import sun.swing.PrintColorUIResource; -import java.util.Objects; +import static sun.reflect.misc.ReflectUtil.isPackageAccessible; /* * Like the Intropector, the MetaData class @@ -850,13 +851,15 @@ static final class java_awt_AWTKeyStroke_PersistenceDelegate extends Persistence static class StaticFieldsPersistenceDelegate extends PersistenceDelegate { protected void installFields(Encoder out, Class cls) { - Field fields[] = cls.getFields(); - for(int i = 0; i < fields.length; i++) { - Field field = fields[i]; - // Don't install primitives, their identity will not be preserved - // by wrapping. - if (Object.class.isAssignableFrom(field.getType())) { - out.writeExpression(new Expression(field, "get", new Object[]{null})); + if (Modifier.isPublic(cls.getModifiers()) && isPackageAccessible(cls)) { + Field fields[] = cls.getFields(); + for(int i = 0; i < fields.length; i++) { + Field field = fields[i]; + // Don't install primitives, their identity will not be preserved + // by wrapping. + if (Object.class.isAssignableFrom(field.getType())) { + out.writeExpression(new Expression(field, "get", new Object[]{null})); + } } } } From d86660d21bbc69c1991b3d7ea3ce582e080cfcdb Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Fri, 31 May 2013 21:25:42 +0400 Subject: [PATCH 020/983] 8012277: Improve AWT DataFlavor Reviewed-by: art, skoivu --- .../java/awt/datatransfer/DataFlavor.java | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java index acbc0fe659d..3c1691545f4 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java +++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java @@ -30,6 +30,9 @@ import java.nio.*; import java.util.*; import sun.awt.datatransfer.DataTransferer; +import sun.reflect.misc.ReflectUtil; + +import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION; /** * A {@code DataFlavor} provides meta information about data. {@code DataFlavor} @@ -116,26 +119,36 @@ public class DataFlavor implements Externalizable, Cloneable { ClassLoader fallback) throws ClassNotFoundException { - ClassLoader systemClassLoader = (ClassLoader) - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - ClassLoader cl = Thread.currentThread(). - getContextClassLoader(); - return (cl != null) - ? cl - : ClassLoader.getSystemClassLoader(); - } - }); - + ReflectUtil.checkPackageAccess(className); try { - return Class.forName(className, true, systemClassLoader); - } catch (ClassNotFoundException e2) { - if (fallback != null) { - return Class.forName(className, true, fallback); - } else { - throw new ClassNotFoundException(className); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(GET_CLASSLOADER_PERMISSION); } + ClassLoader loader = ClassLoader.getSystemClassLoader(); + try { + // bootstrap class loader and system class loader if present + return Class.forName(className, true, loader); + } + catch (ClassNotFoundException exception) { + // thread context class loader if and only if present + loader = Thread.currentThread().getContextClassLoader(); + if (loader != null) { + try { + return Class.forName(className, true, loader); + } + catch (ClassNotFoundException e) { + // fallback to user's class loader + } + } + } + } catch (SecurityException exception) { + // ignore secured class loaders + } + if (fallback != null) { + return Class.forName(className, true, fallback); + } else { + throw new ClassNotFoundException(className); } } From 81621f63cad78c5a6ebf95d536a2e887bf253f08 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 8 May 2013 09:21:59 +0800 Subject: [PATCH 021/983] 8014341: Better service from Kerberos servers Read incoming data safely and take care of null return value Reviewed-by: valeriep, ahgross --- jdk/src/share/classes/sun/security/krb5/KdcComm.java | 12 ++++++++---- .../sun/security/krb5/internal/NetClient.java | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/jdk/src/share/classes/sun/security/krb5/KdcComm.java b/jdk/src/share/classes/sun/security/krb5/KdcComm.java index 80c0af48e00..c3048aaf64a 100644 --- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java +++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java @@ -246,11 +246,15 @@ public final class KdcComm { savedException = e; } } - if (ibuf == null && savedException != null) { - if (savedException instanceof IOException) { - throw (IOException) savedException; + if (ibuf == null) { + if (savedException != null) { + if (savedException instanceof IOException) { + throw (IOException) savedException; + } else { + throw (KrbException) savedException; + } } else { - throw (KrbException) savedException; + throw new IOException("Cannot get a KDC reply"); } } return ibuf; diff --git a/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java b/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java index 1f5b15bb7e6..7502cf00e9a 100644 --- a/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java +++ b/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java @@ -31,6 +31,8 @@ package sun.security.krb5.internal; +import sun.misc.IOUtils; + import java.io.*; import java.net.*; @@ -100,17 +102,15 @@ class TCPClient extends NetClient { return null; } - byte data[] = new byte[len]; - count = readFully(data, len); - if (count != len) { + try { + return IOUtils.readFully(in, len, true); + } catch (IOException ioe) { if (Krb5.DEBUG) { System.out.println( ">>>DEBUG: TCPClient could not read complete packet (" + len + "/" + count + ")"); } return null; - } else { - return data; } } From c7d65c420780466e944fdf59f3a5140c73c2d8cf Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 13 Jun 2013 10:21:06 +0800 Subject: [PATCH 022/983] 8013739: Better LDAP resource management Reviewed-by: ahgross, mchung, xuelei --- .../com/sun/jndi/ldap/VersionHelper12.java | 15 ++++++++---- jdk/src/share/classes/java/lang/System.java | 4 ++++ jdk/src/share/classes/java/lang/Thread.java | 24 +++++++++++++++++-- .../classes/sun/misc/JavaLangAccess.java | 8 +++++++ 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java b/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java index 9e8854a460c..63e6bd280ba 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java @@ -25,11 +25,12 @@ package com.sun.jndi.ldap; -import java.net.URL; import java.net.URLClassLoader; import java.net.MalformedURLException; +import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; +import sun.misc.SharedSecrets; final class VersionHelper12 extends VersionHelper { @@ -82,12 +83,16 @@ final class VersionHelper12 extends VersionHelper { } Thread createThread(final Runnable r) { + final AccessControlContext acc = AccessController.getContext(); + // 4290486: doPrivileged is needed to create a thread in + // an environment that restricts "modifyThreadGroup". return AccessController.doPrivileged( - new PrivilegedAction() { - public Thread run() { - return new Thread(r); + new PrivilegedAction() { + public Thread run() { + return SharedSecrets.getJavaLangAccess() + .newThreadWithAcc(r, acc); + } } - } ); } } diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java index 52a5e0de823..445b4e1a959 100644 --- a/jdk/src/share/classes/java/lang/System.java +++ b/jdk/src/share/classes/java/lang/System.java @@ -26,6 +26,7 @@ package java.lang; import java.io.*; import java.lang.reflect.Executable; +import java.security.AccessControlContext; import java.util.Properties; import java.util.PropertyPermission; import java.util.StringTokenizer; @@ -1251,6 +1252,9 @@ public final class System { public String newStringUnsafe(char[] chars) { return new String(chars, true); } + public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) { + return new Thread(target, acc); + } }); } } diff --git a/jdk/src/share/classes/java/lang/Thread.java b/jdk/src/share/classes/java/lang/Thread.java index bb175ff89ad..d97f03d4e24 100644 --- a/jdk/src/share/classes/java/lang/Thread.java +++ b/jdk/src/share/classes/java/lang/Thread.java @@ -340,6 +340,15 @@ class Thread implements Runnable { sleep(millis); } + /** + * Initializes a Thread with the current AccessControlContext. + * @see #init(ThreadGroup,Runnable,String,long,AccessControlContext) + */ + private void init(ThreadGroup g, Runnable target, String name, + long stackSize) { + init(g, target, name, stackSize, null); + } + /** * Initializes a Thread. * @@ -348,9 +357,11 @@ class Thread implements Runnable { * @param name the name of the new Thread * @param stackSize the desired stack size for the new thread, or * zero to indicate that this parameter is to be ignored. + * @param acc the AccessControlContext to inherit, or + * AccessController.getContext() if null */ private void init(ThreadGroup g, Runnable target, String name, - long stackSize) { + long stackSize, AccessControlContext acc) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -396,7 +407,8 @@ class Thread implements Runnable { this.contextClassLoader = parent.getContextClassLoader(); else this.contextClassLoader = parent.contextClassLoader; - this.inheritedAccessControlContext = AccessController.getContext(); + this.inheritedAccessControlContext = + acc != null ? acc : AccessController.getContext(); this.target = target; setPriority(priority); if (parent.inheritableThreadLocals != null) @@ -448,6 +460,14 @@ class Thread implements Runnable { init(null, target, "Thread-" + nextThreadNum(), 0); } + /** + * Creates a new Thread that inherits the given AccessControlContext. + * This is not a public constructor. + */ + Thread(Runnable target, AccessControlContext acc) { + init(null, target, "Thread-" + nextThreadNum(), 0, acc); + } + /** * Allocates a new {@code Thread} object. This constructor has the same * effect as {@linkplain #Thread(ThreadGroup,Runnable,String) Thread} diff --git a/jdk/src/share/classes/sun/misc/JavaLangAccess.java b/jdk/src/share/classes/sun/misc/JavaLangAccess.java index 888d4ea8c46..45222f3652e 100644 --- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java +++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java @@ -27,6 +27,8 @@ package sun.misc; import java.lang.annotation.Annotation; import java.lang.reflect.Executable; +import java.security.AccessControlContext; + import sun.reflect.ConstantPool; import sun.reflect.annotation.AnnotationType; import sun.nio.ch.Interruptible; @@ -107,4 +109,10 @@ public interface JavaLangAccess { * @return a newly created string whose content is the character array */ String newStringUnsafe(char[] chars); + + /** + * Returns a new Thread with the given Runnable and an + * inherited AccessControlContext. + */ + Thread newThreadWithAcc(Runnable target, AccessControlContext acc); } From 0be0627640342d268cad10b1aa1e47fc92312162 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 13 Jun 2013 10:31:21 +0800 Subject: [PATCH 023/983] 8015731: Subject java.security.auth.subject to improvements Reviewed-by: skoivu, mullan --- jdk/src/share/classes/javax/security/auth/Subject.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/javax/security/auth/Subject.java b/jdk/src/share/classes/javax/security/auth/Subject.java index 1caaad400e2..1128d8c1011 100644 --- a/jdk/src/share/classes/javax/security/auth/Subject.java +++ b/jdk/src/share/classes/javax/security/auth/Subject.java @@ -1297,8 +1297,14 @@ public final class Subject implements java.io.Serializable { { ObjectInputStream.GetField fields = ois.readFields(); subject = (Subject) fields.get("this$0", null); - elements = (LinkedList) fields.get("elements", null); which = fields.get("which", 0); + + LinkedList tmp = (LinkedList) fields.get("elements", null); + if (tmp.getClass() != LinkedList.class) { + elements = new LinkedList(tmp); + } else { + elements = tmp; + } } } From 73c5ae165c4ba53d8d168683c24af3241ccb5233 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 13 Jun 2013 12:14:37 -0700 Subject: [PATCH 024/983] 8014098: Better profile validation Reviewed-by: bae, mschoene, prr --- .../share/native/sun/java2d/cmm/lcms/cmsio0.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c b/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c index 5bad907e2d7..a18d75c3b5b 100644 --- a/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c +++ b/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c @@ -1074,6 +1074,27 @@ cmsHPROFILE CMSEXPORT cmsOpenProfileFromMem(const void* MemPtr, cmsUInt32Number } +static +cmsBool SanityCheck(_cmsICCPROFILE* profile) +{ + cmsIOHANDLER* io = profile->IOhandler; + if (!io) { + return FALSE; + } + + if (!io->Seek || + !(io->Seek==NULLSeek || io->Seek==MemorySeek || io->Seek==FileSeek)) + { + return FALSE; + } + if (!io->Read || + !(io->Read==NULLRead || io->Read==MemoryRead || io->Read==FileRead)) + { + return FALSE; + } + + return TRUE; +} // Dump tag contents. If the profile is being modified, untouched tags are copied from FileOrig static @@ -1087,6 +1108,7 @@ cmsBool SaveTags(_cmsICCPROFILE* Icc, _cmsICCPROFILE* FileOrig) cmsTagTypeSignature TypeBase; cmsTagTypeHandler* TypeHandler; + if (!SanityCheck(FileOrig)) return FALSE; for (i=0; i < Icc -> TagCount; i++) { @@ -1292,8 +1314,8 @@ cmsBool CMSEXPORT cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, cmsUIn // Should we just calculate the needed space? if (MemPtr == NULL) { - *BytesNeeded = cmsSaveProfileToIOhandler(hProfile, NULL); - return TRUE; + *BytesNeeded = cmsSaveProfileToIOhandler(hProfile, NULL); + return (*BytesNeeded == 0 ? FALSE : TRUE); } // That is a real write operation From a968eabd507357fa7bb923eb8098dd420ebd8685 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 14 Jun 2013 15:49:41 +0100 Subject: [PATCH 025/983] 8011157: Improve CORBA portablility Fix also reviewed by Alexander Fomin Reviewed-by: alanb, coffeys, skoivu --- common/makefiles/RMICompilation.gmk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/makefiles/RMICompilation.gmk b/common/makefiles/RMICompilation.gmk index 4727412e958..acbc7054ceb 100644 --- a/common/makefiles/RMICompilation.gmk +++ b/common/makefiles/RMICompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 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 @@ -60,11 +60,11 @@ define SetupRMICompilation ifneq (,$$($1_RUN_IIOP)) $1_TARGETS += $$($1_TIE_FILES) - $1_ARGS += -iiop + $1_ARGS += -iiop -emitPermissionCheck endif ifneq (,$$($1_RUN_IIOP_STDPKG)) $1_TARGETS += $$($1_TIE_STDPKG_FILES) - $1_ARGS2 := -iiop -standardPackage + $1_ARGS2 := -iiop -emitPermissionCheck -standardPackage endif ifneq (,$$($1_KEEP_GENERATED)) From ae96f935a2cb24cf785ee38817c46fd42519bc69 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 14 Jun 2013 15:49:54 +0100 Subject: [PATCH 026/983] 8011157: Improve CORBA portablility Fix also reviewed by Alexander Fomin Reviewed-by: alanb, coffeys, skoivu --- jdk/make/com/sun/jmx/Makefile | 2 ++ .../modelmbean/RequiredModelMBean.java | 8 ++++++-- .../management/remote/rmi/RMIConnector.java | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/jdk/make/com/sun/jmx/Makefile b/jdk/make/com/sun/jmx/Makefile index 62435751673..02ef6b07998 100644 --- a/jdk/make/com/sun/jmx/Makefile +++ b/jdk/make/com/sun/jmx/Makefile @@ -130,11 +130,13 @@ $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class $(RMIC) -classpath "$(CLASSDESTDIR)" \ -d $(CLASSDESTDIR) \ -iiop -v1.2 \ + -emitPermissionCheck \ $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%)) $(RMIC) $(HOTSPOT_INTERPRETER_FLAG) -classpath "$(CLASSDESTDIR)" \ -d $(CLASSDESTDIR) \ -iiop -v1.2 \ -standardPackage \ + -emitPermissionCheck \ $(subst /,.,$(<:$(CLASSDESTDIR)/%.class=%)) @$(java-vm-cleanup) diff --git a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java index 6d28adaf0f7..0afd70f9423 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java +++ b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.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 @@ -298,11 +298,15 @@ public class RequiredModelMBean RequiredModelMBean.class.getName(), "setModelMBeanInfo(ModelMBeanInfo)", "Setting ModelMBeanInfo to " + printModelMBeanInfo(mbi)); + int noOfNotifications = 0; + if (mbi.getNotifications() != null) { + noOfNotifications = mbi.getNotifications().length; + } MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(), "setModelMBeanInfo(ModelMBeanInfo)", "ModelMBeanInfo notifications has " + - (mbi.getNotifications()).length + " elements"); + noOfNotifications + " elements"); } modelMBeanInfo = (ModelMBeanInfo)mbi.clone(); diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index 53e6754e6ed..4ddfb8fee38 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,6 +61,7 @@ import java.rmi.server.RemoteRef; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; import java.security.ProtectionDomain; import java.util.Arrays; import java.util.Collections; @@ -128,7 +129,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable Map environment) { if (rmiServer == null && address == null) throw new IllegalArgumentException("rmiServer and jmxServiceURL both null"); - initTransients(); this.rmiServer = rmiServer; @@ -2370,13 +2370,21 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } } - private static RMIConnection shadowIiopStub(Object stub) + private static RMIConnection shadowIiopStub(Object stub) throws InstantiationException, IllegalAccessException { - Object proxyStub = proxyStubClass.newInstance(); + Object proxyStub = null; + try { + proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return proxyStubClass.newInstance(); + } + }); + } catch (PrivilegedActionException e) { + throw new InternalError(); + } IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub)); return (RMIConnection) proxyStub; } - private static RMIConnection getConnection(RMIServer server, Object credentials, boolean checkStub) From 3f85c00fb2c68a4762e7b8851eb9c06158fd4146 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 14 Jun 2013 16:31:55 +0100 Subject: [PATCH 027/983] 8011157: Improve CORBA portablility Fix also reviewed by Alexander Fomin Reviewed-by: alanb, coffeys, skoivu --- .../corba/se/impl/transport/SelectorImpl.java | 4 +- .../sun/rmi/rmic/iiop/StubGenerator.java | 75 ++++++++++++++++++- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java index 7bd98805ab7..054071b7d8b 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.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 @@ -55,7 +55,7 @@ import com.sun.corba.se.impl.orbutil.ORBUtility; /** * @author Harold Carr */ -public class SelectorImpl +class SelectorImpl extends Thread implements diff --git a/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java b/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java index aa3c6bea2f5..0d41c1edb90 100644 --- a/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java +++ b/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,9 @@ package sun.rmi.rmic.iiop; import java.io.File; import java.io.IOException; +import java.io.SerializablePermission; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Vector; import java.util.Hashtable; import java.util.Enumeration; @@ -49,6 +52,7 @@ import com.sun.corba.se.impl.util.Utility; import com.sun.corba.se.impl.util.PackagePrefixChecker; import sun.rmi.rmic.Main; + /** * An IIOP stub/tie generator for rmic. * @@ -78,6 +82,7 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator { protected boolean castArray = false; protected Hashtable transactionalObjects = new Hashtable() ; protected boolean POATie = false ; + protected boolean emitPermissionCheck = false; /** * Default constructor for Main to use. @@ -193,6 +198,9 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator { } else if (argv[i].equals("-standardPackage")) { standardPackage = true; argv[i] = null; + } else if (argv[i].equals("-emitPermissionCheck")) { + emitPermissionCheck = true; + argv[i] = null; } else if (arg.equals("-xstubbase")) { argv[i] = null; if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) { @@ -390,9 +398,22 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator { writePackageAndImports(p); +// generate +// import java.security.AccessController; +// import java.security.PrivilegedAction; +// import java.io.SerializablePermission; + if (emitPermissionCheck) { + p.pln("import java.security.AccessController;"); + p.pln("import java.security.PrivilegedAction;"); + p.pln("import java.io.SerializablePermission;"); + p.pln(); + p.pln(); + } + // Declare the stub class; implement all remote interfaces. p.p("public class " + currentClass); + p.p(" extends " + getName(stubBaseClass)); p.p(" implements "); if (remoteInterfaces.length > 0) { @@ -422,6 +443,57 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator { writeIds( p, theType, false ); p.pln(); + if (emitPermissionCheck) { + + // produce the following generated code for example + // private static Void checkPermission() { + // SecurityManager sm = System.getSecurityManager(); + // if (sm != null) { + // sm.checkPermission(new SerializablePermission( + // "enableSubclassImplementation")); // testing + // } + // return null; + // } + // + // private _XXXXX_Stub(Void ignore) { + // } + // + // public _XXXXX_Stub() { + // this(checkPermission()); + // } + // + // where XXXXX is the name of the remote interface + + p.pln(); + p.plnI("private static Void checkPermission() {"); + p.plnI("SecurityManager sm = System.getSecurityManager();"); + p.pln("if (sm != null) {"); + p.pI(); + p.plnI("sm.checkPermission(new SerializablePermission("); + p.plnI("\"enableSubclassImplementation\"));"); + p.pO(); + p.pO(); + p.pOln("}"); + p.pln("return null;"); + p.pO(); + p.pOln("}"); + p.pln(); + p.pO(); + + p.pI(); + p.pln("private " + currentClass + "(Void ignore) { }"); + p.pln(); + + p.plnI("public " + currentClass + "() { "); + p.pln("this(checkPermission());"); + p.pOln("}"); + p.pln(); + } + + if (!emitPermissionCheck) { + p.pI(); + } + // Write the _ids() method... p.plnI("public String[] _ids() { "); @@ -815,7 +887,6 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator { CompoundType theType) throws IOException { // Wtite the method declaration and opening brace... - String methodName = method.getName(); String methodIDLName = method.getIDLName(); From ccc1dc9103b704a619a638c35d93f689c6798d16 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Thu, 20 Jun 2013 08:51:47 +0200 Subject: [PATCH 028/983] 8014085: Better serialization support in JMX classes Reviewed-by: alanb, dfuchs, skoivu --- .../management/MBeanNotificationInfo.java | 22 ++++- .../javax/management/remote/JMXPrincipal.java | 23 ++++- .../management/remote/JMXServiceURL.java | 99 +++++++++++++------ .../management/remote/NotificationResult.java | 53 +++++++--- .../remote/TargetedNotification.java | 34 +++++-- 5 files changed, 176 insertions(+), 55 deletions(-) diff --git a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java index b4bbbe80292..dfa4ab1f8ff 100644 --- a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java @@ -25,6 +25,9 @@ package javax.management; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.util.Arrays; /** @@ -67,7 +70,7 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable /** * @serial The different types of the notification. */ - private final String[] types; + private String[] types; /** @see MBeanInfo#arrayGettersSafe */ private final transient boolean arrayGettersSafe; @@ -114,9 +117,8 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable notifType, though it doesn't explicitly allow it either. */ - if (notifTypes == null) - notifTypes = NO_TYPES; - this.types = notifTypes; + this.types = (notifTypes != null && notifTypes.length > 0) ? + notifTypes.clone() : NO_TYPES; this.arrayGettersSafe = MBeanInfo.arrayGettersSafe(this.getClass(), MBeanNotificationInfo.class); @@ -203,4 +205,16 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable hash ^= types[i].hashCode(); return hash; } + + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = ois.readFields(); + String[] t = (String[])gf.get("types", null); + + if (t == null) { + throw new InvalidObjectException("Trying to deserialize an invalid " + + "instance of " + MBeanNotificationInfo.class + + "[types=null]"); + } + types = t.length == 0 ? t : t.clone(); + } } diff --git a/jdk/src/share/classes/javax/management/remote/JMXPrincipal.java b/jdk/src/share/classes/javax/management/remote/JMXPrincipal.java index 258c537e277..5cb0c3739bc 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXPrincipal.java +++ b/jdk/src/share/classes/javax/management/remote/JMXPrincipal.java @@ -26,6 +26,9 @@ package javax.management.remote; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.security.Principal; @@ -64,9 +67,7 @@ public class JMXPrincipal implements Principal, Serializable { * null. */ public JMXPrincipal(String name) { - if (name == null) - throw new NullPointerException("illegal null input"); - + validate(name); this.name = name; } @@ -130,4 +131,20 @@ public class JMXPrincipal implements Principal, Serializable { public int hashCode() { return name.hashCode(); } + + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = ois.readFields(); + String principalName = (String)gf.get("name", null); + try { + validate(principalName); + this.name = principalName; + } catch (NullPointerException e) { + throw new InvalidObjectException(e.getMessage()); + } + } + + private static void validate(String name) throws NullPointerException { + if (name == null) + throw new NullPointerException("illegal null input"); + } } diff --git a/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java b/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java index 143966bad68..4b1c376eda1 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java +++ b/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java @@ -29,6 +29,9 @@ package javax.management.remote; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.net.InetAddress; @@ -297,7 +300,7 @@ public class JMXServiceURL implements Serializable { If we're given an explicit host name that is illegal we have to reject it. (Bug 5057532.) */ try { - validateHost(host); + validateHost(host, port); } catch (MalformedURLException e) { if (logger.fineOn()) { logger.fine("JMXServiceURL", @@ -336,36 +339,82 @@ public class JMXServiceURL implements Serializable { validate(); } - private void validate() throws MalformedURLException { + private static final String INVALID_INSTANCE_MSG = + "Trying to deserialize an invalid instance of JMXServiceURL"; + private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = inputStream.readFields(); + String h = (String)gf.get("host", null); + int p = (int)gf.get("port", -1); + String proto = (String)gf.get("protocol", null); + String url = (String)gf.get("urlPath", null); + if (proto == null || url == null || h == null) { + StringBuilder sb = new StringBuilder(INVALID_INSTANCE_MSG).append('['); + boolean empty = true; + if (proto == null) { + sb.append("protocol=null"); + empty = false; + } + if (h == null) { + sb.append(empty ? "" : ",").append("host=null"); + empty = false; + } + if (url == null) { + sb.append(empty ? "" : ",").append("urlPath=null"); + } + sb.append(']'); + throw new InvalidObjectException(sb.toString()); + } + + if (h.contains("[") || h.contains("]")) { + throw new InvalidObjectException("Invalid host name: " + h); + } + + try { + validate(proto, h, p, url); + this.protocol = proto; + this.host = h; + this.port = p; + this.urlPath = url; + } catch (MalformedURLException e) { + throw new InvalidObjectException(INVALID_INSTANCE_MSG + ": " + + e.getMessage()); + } + + } + + private void validate(String proto, String h, int p, String url) + throws MalformedURLException { // Check protocol - - final int protoEnd = indexOfFirstNotInSet(protocol, protocolBitSet, 0); - if (protoEnd == 0 || protoEnd < protocol.length() - || !alphaBitSet.get(protocol.charAt(0))) { + final int protoEnd = indexOfFirstNotInSet(proto, protocolBitSet, 0); + if (protoEnd == 0 || protoEnd < proto.length() + || !alphaBitSet.get(proto.charAt(0))) { throw new MalformedURLException("Missing or invalid protocol " + - "name: \"" + protocol + "\""); + "name: \"" + proto + "\""); } // Check host - - validateHost(); + validateHost(h, p); // Check port - - if (port < 0) - throw new MalformedURLException("Bad port: " + port); + if (p < 0) + throw new MalformedURLException("Bad port: " + p); // Check URL path - - if (urlPath.length() > 0) { - if (!urlPath.startsWith("/") && !urlPath.startsWith(";")) - throw new MalformedURLException("Bad URL path: " + urlPath); + if (url.length() > 0) { + if (!url.startsWith("/") && !url.startsWith(";")) + throw new MalformedURLException("Bad URL path: " + url); } } - private void validateHost() throws MalformedURLException { - if (host.length() == 0) { + private void validate() throws MalformedURLException { + validate(this.protocol, this.host, this.port, this.urlPath); + } + + private static void validateHost(String h, int port) + throws MalformedURLException { + + if (h.length() == 0) { if (port != 0) { throw new MalformedURLException("Cannot give port number " + "without host name"); @@ -373,12 +422,6 @@ public class JMXServiceURL implements Serializable { return; } - validateHost(host); - } - - private static void validateHost(String h) - throws MalformedURLException { - if (isNumericIPv6Address(h)) { /* We assume J2SE >= 1.4 here. Otherwise you can't use the address anyway. We can't call @@ -663,22 +706,22 @@ public class JMXServiceURL implements Serializable { /** * The value returned by {@link #getProtocol()}. */ - private final String protocol; + private String protocol; /** * The value returned by {@link #getHost()}. */ - private final String host; + private String host; /** * The value returned by {@link #getPort()}. */ - private final int port; + private int port; /** * The value returned by {@link #getURLPath()}. */ - private final String urlPath; + private String urlPath; /** * Cached result of {@link #toString()}. diff --git a/jdk/src/share/classes/javax/management/remote/NotificationResult.java b/jdk/src/share/classes/javax/management/remote/NotificationResult.java index cbc79755099..9e7cfaac31d 100644 --- a/jdk/src/share/classes/javax/management/remote/NotificationResult.java +++ b/jdk/src/share/classes/javax/management/remote/NotificationResult.java @@ -25,6 +25,9 @@ package javax.management.remote; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.Serializable; /** @@ -76,17 +79,7 @@ public class NotificationResult implements Serializable { public NotificationResult(long earliestSequenceNumber, long nextSequenceNumber, TargetedNotification[] targetedNotifications) { - if (targetedNotifications == null) { - final String msg = "Notifications null"; - throw new IllegalArgumentException(msg); - } - - if (earliestSequenceNumber < 0 || nextSequenceNumber < 0) - throw new IllegalArgumentException("Bad sequence numbers"); - /* We used to check nextSequenceNumber >= earliestSequenceNumber - here. But in fact the opposite can legitimately be true if - notifications have been lost. */ - + validate(targetedNotifications, earliestSequenceNumber, nextSequenceNumber); this.earliestSequenceNumber = earliestSequenceNumber; this.nextSequenceNumber = nextSequenceNumber; this.targetedNotifications = (targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone()); @@ -138,7 +131,39 @@ public class NotificationResult implements Serializable { getTargetedNotifications().length; } - private final long earliestSequenceNumber; - private final long nextSequenceNumber; - private final TargetedNotification[] targetedNotifications; + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = ois.readFields(); + TargetedNotification[] tNotifs = (TargetedNotification[])gf.get("targetedNotifications", null); + long snStart = gf.get("earliestSequenceNumber", -1L); + long snNext = gf.get("nextSequenceNumber", -1L); + try { + validate(tNotifs, snStart, snNext); + + this.targetedNotifications = tNotifs.length == 0 ? tNotifs : tNotifs.clone(); + this.earliestSequenceNumber = snStart; + this.nextSequenceNumber = snNext; + } catch (IllegalArgumentException e) { + throw new InvalidObjectException(e.getMessage()); + } + } + + private long earliestSequenceNumber; + private long nextSequenceNumber; + private TargetedNotification[] targetedNotifications; + + private static void validate(TargetedNotification[] targetedNotifications, + long earliestSequenceNumber, + long nextSequenceNumber) + throws IllegalArgumentException { + if (targetedNotifications == null) { + final String msg = "Notifications null"; + throw new IllegalArgumentException(msg); + } + + if (earliestSequenceNumber < 0 || nextSequenceNumber < 0) + throw new IllegalArgumentException("Bad sequence numbers"); + /* We used to check nextSequenceNumber >= earliestSequenceNumber + here. But in fact the opposite can legitimately be true if + notifications have been lost. */ + } } diff --git a/jdk/src/share/classes/javax/management/remote/TargetedNotification.java b/jdk/src/share/classes/javax/management/remote/TargetedNotification.java index c4b58dfba90..03aa0ca6235 100644 --- a/jdk/src/share/classes/javax/management/remote/TargetedNotification.java +++ b/jdk/src/share/classes/javax/management/remote/TargetedNotification.java @@ -26,6 +26,9 @@ package javax.management.remote; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.Serializable; import javax.management.Notification; @@ -73,12 +76,9 @@ public class TargetedNotification implements Serializable { */ public TargetedNotification(Notification notification, Integer listenerID) { + validate(notification, listenerID); // If we replace integer with int... // this(notification,intValue(listenerID)); - if (notification == null) throw new - IllegalArgumentException("Invalid notification: null"); - if (listenerID == null) throw new - IllegalArgumentException("Invalid listener ID: null"); this.notif = notification; this.id = listenerID; } @@ -115,13 +115,13 @@ public class TargetedNotification implements Serializable { * @serial A notification to transmit to the other side. * @see #getNotification() **/ - private final Notification notif; + private Notification notif; /** * @serial The ID of the listener to which the notification is * targeted. * @see #getListenerID() **/ - private final Integer id; + private Integer id; //private final int id; // Needed if we use int instead of Integer... @@ -130,4 +130,26 @@ public class TargetedNotification implements Serializable { // IllegalArgumentException("Invalid listener ID: null"); // return id.intValue(); // } + + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = ois.readFields(); + Notification notification = (Notification)gf.get("notif", null); + Integer listenerId = (Integer)gf.get("id", null); + try { + validate(notification, listenerId); + this.notif = notification; + this.id = listenerId; + } catch (IllegalArgumentException e) { + throw new InvalidObjectException(e.getMessage()); + } + } + + private static void validate(Notification notif, Integer id) throws IllegalArgumentException { + if (notif == null) { + throw new IllegalArgumentException("Invalid notification: null"); + } + if (id == null) { + throw new IllegalArgumentException("Invalid listener ID: null"); + } + } } From d0a47b3b30d11d264021b383ecfe09ebe62a3ecb Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 1 Jul 2013 15:17:24 +0400 Subject: [PATCH 029/983] 8017287: Better resource disposal Reviewed-by: prr, vadim, skoivu --- jdk/src/share/classes/sun/java2d/Disposer.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/sun/java2d/Disposer.java b/jdk/src/share/classes/sun/java2d/Disposer.java index dcedfe3846e..7be5c3acc92 100644 --- a/jdk/src/share/classes/sun/java2d/Disposer.java +++ b/jdk/src/share/classes/sun/java2d/Disposer.java @@ -155,8 +155,7 @@ public class Disposer implements Runnable { rec = null; clearDeferredRecords(); } catch (Exception e) { - System.out.println("Exception while removing reference: " + e); - e.printStackTrace(); + System.out.println("Exception while removing reference."); } } } @@ -182,7 +181,6 @@ public class Disposer implements Runnable { rec.dispose(); } catch (Exception e) { System.out.println("Exception while disposing deferred rec."); - e.printStackTrace(); } } deferredRecords.clear(); @@ -233,8 +231,7 @@ public class Disposer implements Runnable { } } } catch (Exception e) { - System.out.println("Exception while removing reference: " + e); - e.printStackTrace(); + System.out.println("Exception while removing reference."); } finally { pollingQueue = false; } From 2fc3e6741814a67fe89734348d091dea3f32e529 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 3 Jul 2013 10:14:02 +0200 Subject: [PATCH 030/983] 8012146: Improve tool support Reviewed-by: ksrini, dholmes, alanb, anthony --- jdk/makefiles/CompileLaunchers.gmk | 6 ++---- jdk/makefiles/Images.gmk | 5 +++++ jdk/test/Makefile | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/jdk/makefiles/CompileLaunchers.gmk b/jdk/makefiles/CompileLaunchers.gmk index 90348b6360f..253fe0231c8 100644 --- a/jdk/makefiles/CompileLaunchers.gmk +++ b/jdk/makefiles/CompileLaunchers.gmk @@ -52,8 +52,7 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN) else - ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) \ - $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) + ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) endif # @@ -62,8 +61,7 @@ endif # devloper documentation of JAWT and what worked with OpenJDK6. # ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),) - ORIGIN_ARG+=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) \ - $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)) + ORIGIN_ARG+=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) endif define SetupLauncher diff --git a/jdk/makefiles/Images.gmk b/jdk/makefiles/Images.gmk index d265f4cd587..492cf544ab5 100644 --- a/jdk/makefiles/Images.gmk +++ b/jdk/makefiles/Images.gmk @@ -218,6 +218,11 @@ ifeq ($(OPENJDK_TARGET_OS), linux) JDK_LIB_FILES += jexec endif +ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),) # If Linux or Solaris + JDK_LIB_FILES += $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \ + $(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) +endif + # Find all files to copy from $(JDK_OUTPUTDIR)/lib # Jar files are not expected to be here ALL_JDKOUT_LIB_LIST := $(call not-containing,_the.,$(filter-out %.jar,\ diff --git a/jdk/test/Makefile b/jdk/test/Makefile index de6b4a783ff..aac9ef4227b 100644 --- a/jdk/test/Makefile +++ b/jdk/test/Makefile @@ -521,7 +521,8 @@ jdk_other: $(call TestDirs, \ com/sun/org/apache/xerces \ com/sun/corba \ com/sun/tracing \ - sun/usagetracker) + sun/usagetracker \ + misc) $(call RunAgentvmBatch) # Stable agentvm testruns (minus items from PROBLEM_LIST) From f0b7243841e85efcaeda0e7789f961b8201c4d9b Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Wed, 3 Jul 2013 15:10:11 -0700 Subject: [PATCH 031/983] 8011071: Better crypto provider handling Reviewed-by: hawtin, valeriep --- .../com/sun/crypto/provider/DHPrivateKey.java | 18 +------ .../sun/security/ec/ECPrivateKeyImpl.java | 10 +--- .../sun/security/jgss/GSSCredentialImpl.java | 4 +- .../classes/sun/security/pkcs/PKCS8Key.java | 13 +---- .../classes/sun/security/pkcs11/P11Key.java | 48 +------------------ .../sun/security/provider/DSAPrivateKey.java | 7 +-- .../security/rsa/RSAPrivateCrtKeyImpl.java | 27 +---------- .../sun/security/rsa/RSAPrivateKeyImpl.java | 9 +--- 8 files changed, 9 insertions(+), 127 deletions(-) diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHPrivateKey.java b/jdk/src/share/classes/com/sun/crypto/provider/DHPrivateKey.java index 1653a239960..cb50886f6eb 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/DHPrivateKey.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/DHPrivateKey.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 @@ -279,22 +279,6 @@ javax.crypto.interfaces.DHPrivateKey, Serializable { return new DHParameterSpec(this.p, this.g); } - public String toString() { - String LINE_SEP = System.getProperty("line.separator"); - - StringBuffer strbuf - = new StringBuffer("SunJCE Diffie-Hellman Private Key:" - + LINE_SEP + "x:" + LINE_SEP - + Debug.toHexString(this.x) - + LINE_SEP + "p:" + LINE_SEP - + Debug.toHexString(this.p) - + LINE_SEP + "g:" + LINE_SEP - + Debug.toHexString(this.g)); - if (this.l != 0) - strbuf.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l); - return strbuf.toString(); - } - private void parseKeyBits() throws InvalidKeyException { try { DerInputStream in = new DerInputStream(this.key); diff --git a/jdk/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java b/jdk/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java index 3bc90ce8071..b974c3ca86c 100644 --- a/jdk/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java +++ b/jdk/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, 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 @@ -152,12 +152,4 @@ public final class ECPrivateKeyImpl extends PKCS8Key implements ECPrivateKey { throw new InvalidKeyException("Invalid EC private key", e); } } - - // return a string representation of this key for debugging - public String toString() { - return "Sun EC private key, " + params.getCurve().getField().getFieldSize() - + " bits\n private value: " - + s + "\n parameters: " + params; - } - } diff --git a/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java b/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java index 584e1784c8a..65f6847fd3e 100644 --- a/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.java +++ b/jdk/src/share/classes/sun/security/jgss/GSSCredentialImpl.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 @@ -651,7 +651,7 @@ public class GSSCredentialImpl implements ExtendedGSSCredential { buffer.append(element.isAcceptorCredential() ? " Accept" : ""); buffer.append(" ["); - buffer.append(element.toString()); + buffer.append(element.getClass()); buffer.append(']'); } catch (GSSException e) { // skip to next element diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS8Key.java b/jdk/src/share/classes/sun/security/pkcs/PKCS8Key.java index c53b421da66..59512f11b6e 100644 --- a/jdk/src/share/classes/sun/security/pkcs/PKCS8Key.java +++ b/jdk/src/share/classes/sun/security/pkcs/PKCS8Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -304,17 +304,6 @@ public class PKCS8Key implements PrivateKey { return encodedKey.clone(); } - /* - * Returns a printable representation of the key - */ - public String toString () - { - HexDumpEncoder encoder = new HexDumpEncoder (); - - return "algorithm = " + algid.toString () - + ", unparsed keybits = \n" + encoder.encodeBuffer (key); - } - /** * Initialize an PKCS8Key object from an input stream. The data * on that input stream must be encoded using DER, obeying the diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Key.java b/jdk/src/share/classes/sun/security/pkcs11/P11Key.java index dd0ec5f7ee1..e85d27efbb3 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/P11Key.java +++ b/jdk/src/share/classes/sun/security/pkcs11/P11Key.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 @@ -552,27 +552,6 @@ abstract class P11Key implements Key, Length { fetchValues(); return coeff; } - public String toString() { - fetchValues(); - StringBuilder sb = new StringBuilder(super.toString()); - sb.append("\n modulus: "); - sb.append(n); - sb.append("\n public exponent: "); - sb.append(e); - sb.append("\n private exponent: "); - sb.append(d); - sb.append("\n prime p: "); - sb.append(p); - sb.append("\n prime q: "); - sb.append(q); - sb.append("\n prime exponent p: "); - sb.append(pe); - sb.append("\n prime exponent q: "); - sb.append(qe); - sb.append("\n crt coefficient: "); - sb.append(coeff); - return sb.toString(); - } } // RSA non-CRT private key @@ -628,15 +607,6 @@ abstract class P11Key implements Key, Length { fetchValues(); return d; } - public String toString() { - fetchValues(); - StringBuilder sb = new StringBuilder(super.toString()); - sb.append("\n modulus: "); - sb.append(n); - sb.append("\n private exponent: "); - sb.append(d); - return sb.toString(); - } } private static final class P11RSAPublicKey extends P11Key @@ -812,11 +782,6 @@ abstract class P11Key implements Key, Length { fetchValues(); return params; } - public String toString() { - fetchValues(); - return super.toString() + "\n x: " + x + "\n p: " + params.getP() - + "\n q: " + params.getQ() + "\n g: " + params.getG(); - } } private static final class P11DHPrivateKey extends P11Key @@ -876,11 +841,6 @@ abstract class P11Key implements Key, Length { fetchValues(); return params; } - public String toString() { - fetchValues(); - return super.toString() + "\n x: " + x + "\n p: " + params.getP() - + "\n g: " + params.getG(); - } } private static final class P11DHPublicKey extends P11Key @@ -1001,12 +961,6 @@ abstract class P11Key implements Key, Length { fetchValues(); return params; } - public String toString() { - fetchValues(); - return super.toString() - + "\n private value: " + s - + "\n parameters: " + params; - } } private static final class P11ECPublicKey extends P11Key diff --git a/jdk/src/share/classes/sun/security/provider/DSAPrivateKey.java b/jdk/src/share/classes/sun/security/provider/DSAPrivateKey.java index b521e3d2fbd..97e7ef8d7da 100644 --- a/jdk/src/share/classes/sun/security/provider/DSAPrivateKey.java +++ b/jdk/src/share/classes/sun/security/provider/DSAPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -142,11 +142,6 @@ implements java.security.interfaces.DSAPrivateKey, Serializable { } } - public String toString() { - return "Sun DSA Private Key \nparameters:" + algid + "\nx: " + - Debug.toHexString(x) + "\n"; - } - protected void parseKeyBits() throws InvalidKeyException { try { DerInputStream in = new DerInputStream(key); diff --git a/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java b/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java index b289ef2efaa..7e68c427e52 100644 --- a/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java +++ b/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, 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 @@ -225,29 +225,4 @@ public final class RSAPrivateCrtKeyImpl } return b; } - - // return a string representation of this key for debugging - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("Sun RSA private CRT key, "); - sb.append(n.bitLength()); - sb.append(" bits\n modulus: "); - sb.append(n); - sb.append("\n public exponent: "); - sb.append(e); - sb.append("\n private exponent: "); - sb.append(d); - sb.append("\n prime p: "); - sb.append(p); - sb.append("\n prime q: "); - sb.append(q); - sb.append("\n prime exponent p: "); - sb.append(pe); - sb.append("\n prime exponent q: "); - sb.append(qe); - sb.append("\n crt coefficient: "); - sb.append(coeff); - return sb.toString(); - } - } diff --git a/jdk/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java b/jdk/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java index f9a7c340bf4..1a7df130463 100644 --- a/jdk/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java +++ b/jdk/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, 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 @@ -98,11 +98,4 @@ public final class RSAPrivateKeyImpl extends PKCS8Key implements RSAPrivateKey { public BigInteger getPrivateExponent() { return d; } - - // return a string representation of this key for debugging - public String toString() { - return "Sun RSA private key, " + n.bitLength() + " bits\n modulus: " - + n + "\n private exponent: " + d; - } - } From 455cd24c9541114abe0a297a27be30c219fe399c Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Mon, 8 Jul 2013 16:15:39 +0400 Subject: [PATCH 032/983] 8008589: Better MBean permission validation Better MBean permission validation Reviewed-by: skoivu, dfuchs, mchung, sjiang --- .../management/MBeanTrustPermission.java | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/jdk/src/share/classes/javax/management/MBeanTrustPermission.java b/jdk/src/share/classes/javax/management/MBeanTrustPermission.java index 040f0ddd653..605201a9f8d 100644 --- a/jdk/src/share/classes/javax/management/MBeanTrustPermission.java +++ b/jdk/src/share/classes/javax/management/MBeanTrustPermission.java @@ -26,6 +26,9 @@ package javax.management; import java.security.BasicPermission; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; /** * This permission represents "trust" in a signer or codebase. @@ -75,15 +78,31 @@ public class MBeanTrustPermission extends BasicPermission { */ public MBeanTrustPermission(String name, String actions) { super(name, actions); - /* Check that actions is a null empty string */ - if (actions != null && actions.length() > 0) - throw new IllegalArgumentException("MBeanTrustPermission " + - "actions must be null: " + - actions); + validate(name,actions); + } - if (!name.equals("register") && !name.equals("*")) - throw new IllegalArgumentException("MBeanTrustPermission: " + - "Unknown target name " + + private static void validate(String name, String actions) { + /* Check that actions is a null empty string */ + if (actions != null && actions.length() > 0) { + throw new IllegalArgumentException("MBeanTrustPermission actions must be null: " + + actions); + } + + if (!name.equals("register") && !name.equals("*")) { + throw new IllegalArgumentException("MBeanTrustPermission: Unknown target name " + "[" + name + "]"); + } + } + + private void readObject(ObjectInputStream in) + throws IOException, ClassNotFoundException { + + // Reading private fields of base class + in.defaultReadObject(); + try { + validate(super.getName(),super.getActions()); + } catch (IllegalArgumentException e) { + throw new InvalidObjectException(e.getMessage()); + } } } From c11a760a1b1481f5a2442c3d70d563fd25e8f6fc Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Thu, 26 Sep 2013 23:05:29 -0700 Subject: [PATCH 033/983] 8025720: Separate temporal interface layer Remove ZoneId and Chronology from TemporalField interface Reviewed-by: sherman --- .../classes/java/time/format/Parsed.java | 2 +- .../classes/java/time/temporal/IsoFields.java | 13 +++++++++-- .../java/time/temporal/JulianFields.java | 7 +++--- .../java/time/temporal/TemporalField.java | 23 +++++++++++-------- .../java/time/temporal/WeekFields.java | 9 ++++---- .../time/format/TCKDateTimeParseResolver.java | 12 ++++------ 6 files changed, 39 insertions(+), 27 deletions(-) diff --git a/jdk/src/share/classes/java/time/format/Parsed.java b/jdk/src/share/classes/java/time/format/Parsed.java index 908c7decaef..a86697a31f3 100644 --- a/jdk/src/share/classes/java/time/format/Parsed.java +++ b/jdk/src/share/classes/java/time/format/Parsed.java @@ -262,7 +262,7 @@ final class Parsed implements TemporalAccessor { while (changedCount < 50) { for (Map.Entry entry : fieldValues.entrySet()) { TemporalField targetField = entry.getKey(); - TemporalAccessor resolvedObject = targetField.resolve(fieldValues, chrono, zone, resolverStyle); + TemporalAccessor resolvedObject = targetField.resolve(fieldValues, this, resolverStyle); if (resolvedObject != null) { if (resolvedObject instanceof ChronoZonedDateTime) { ChronoZonedDateTime czdt = (ChronoZonedDateTime) resolvedObject; diff --git a/jdk/src/share/classes/java/time/temporal/IsoFields.java b/jdk/src/share/classes/java/time/temporal/IsoFields.java index bb19c299875..e8ccff15f60 100644 --- a/jdk/src/share/classes/java/time/temporal/IsoFields.java +++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java @@ -69,6 +69,7 @@ import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.WEEKS; import static java.time.temporal.ChronoUnit.YEARS; +import java.time.DateTimeException; import java.time.Duration; import java.time.LocalDate; import java.time.ZoneId; @@ -343,7 +344,7 @@ public final class IsoFields { } @Override public ChronoLocalDate resolve( - Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { Long yearLong = fieldValues.get(YEAR); Long qoyLong = fieldValues.get(QUARTER_OF_YEAR); if (yearLong == null || qoyLong == null) { @@ -351,6 +352,7 @@ public final class IsoFields { } int y = YEAR.checkValidIntValue(yearLong); // always validate long doq = fieldValues.get(DAY_OF_QUARTER); + ensureIso(partialTemporal); LocalDate date; if (resolverStyle == ResolverStyle.LENIENT) { date = LocalDate.of(y, 1, 1).plusMonths(Math.multiplyExact(Math.subtractExact(qoyLong, 1), 3)); @@ -464,7 +466,7 @@ public final class IsoFields { } @Override public ChronoLocalDate resolve( - Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { Long wbyLong = fieldValues.get(WEEK_BASED_YEAR); Long dowLong = fieldValues.get(DAY_OF_WEEK); if (wbyLong == null || dowLong == null) { @@ -472,6 +474,7 @@ public final class IsoFields { } int wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR); // always validate long wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR); + ensureIso(partialTemporal); LocalDate date = LocalDate.of(wby, 1, 4); if (resolverStyle == ResolverStyle.LENIENT) { long dow = dowLong; // unvalidated @@ -568,6 +571,12 @@ public final class IsoFields { return Chronology.from(temporal).equals(IsoChronology.INSTANCE); } + private static void ensureIso(TemporalAccessor temporal) { + if (isIso(temporal) == false) { + throw new DateTimeException("Resolve requires IsoChronology"); + } + } + private static ValueRange getWeekRange(LocalDate date) { int wby = getWeekBasedYear(date); date = date.withDayOfYear(1).withYear(wby); diff --git a/jdk/src/share/classes/java/time/temporal/JulianFields.java b/jdk/src/share/classes/java/time/temporal/JulianFields.java index 326f20d222f..f950d87201b 100644 --- a/jdk/src/share/classes/java/time/temporal/JulianFields.java +++ b/jdk/src/share/classes/java/time/temporal/JulianFields.java @@ -291,13 +291,14 @@ public final class JulianFields { //----------------------------------------------------------------------- @Override public ChronoLocalDate resolve( - Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { long value = fieldValues.remove(this); + Chronology chrono = Chronology.from(partialTemporal); if (resolverStyle == ResolverStyle.LENIENT) { - return chronology.dateEpochDay(Math.subtractExact(value, offset)); + return chrono.dateEpochDay(Math.subtractExact(value, offset)); } range().checkValidValue(value, this); - return chronology.dateEpochDay(value - offset); + return chrono.dateEpochDay(value - offset); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/temporal/TemporalField.java b/jdk/src/share/classes/java/time/temporal/TemporalField.java index e757734510c..51903ede30f 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalField.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java @@ -62,7 +62,6 @@ package java.time.temporal; import java.time.DateTimeException; -import java.time.ZoneId; import java.time.chrono.Chronology; import java.time.format.ResolverStyle; import java.util.Locale; @@ -338,6 +337,13 @@ public interface TemporalField { * complete {@code LocalDate}. The resolve method will remove all three * fields from the map before returning the {@code LocalDate}. *

+ * A partially complete temporal is used to allow the chronology and zone + * to be queried. In general, only the chronology will be needed. + * Querying items other than the zone or chronology is undefined and + * must not be relied on. + * The behavior of other methods such as {@code get}, {@code getLong}, + * {@code range} and {@code isSupported} is unpredictable and the results undefined. + *

* If resolution should be possible, but the data is invalid, the resolver * style should be used to determine an appropriate level of leniency, which * may require throwing a {@code DateTimeException} or {@code ArithmeticException}. @@ -350,16 +356,14 @@ public interface TemporalField { * instances that can produce a date, such as {@code EPOCH_DAY}. *

* Not all {@code TemporalAccessor} implementations are accepted as return values. - * Implementations must accept {@code ChronoLocalDate}, {@code ChronoLocalDateTime}, - * {@code ChronoZonedDateTime} and {@code LocalTime}. - *

- * The zone is not normally required for resolution, but is provided for completeness. + * Implementations that call this method must accept {@code ChronoLocalDate}, + * {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. *

* The default implementation must return null. * * @param fieldValues the map of fields to values, which can be updated, not null - * @param chronology the effective chronology, not null - * @param zone the effective zone, not null + * @param partialTemporal the partially complete temporal to query for zone and + * chronology; querying for other things is undefined and not recommended, not null * @param resolverStyle the requested type of resolve, not null * @return the resolved temporal object; null if resolving only * changed the map, or no resolve occurred @@ -368,8 +372,9 @@ public interface TemporalField { * by querying a field on the temporal without first checking if it is supported */ default TemporalAccessor resolve( - Map fieldValues, Chronology chronology, - ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, + TemporalAccessor partialTemporal, + ResolverStyle resolverStyle) { return null; } diff --git a/jdk/src/share/classes/java/time/temporal/WeekFields.java b/jdk/src/share/classes/java/time/temporal/WeekFields.java index b3eb1383450..0edfa73e217 100644 --- a/jdk/src/share/classes/java/time/temporal/WeekFields.java +++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java @@ -892,7 +892,7 @@ public final class WeekFields implements Serializable { @Override public ChronoLocalDate resolve( - Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { final long value = fieldValues.get(this); final int newValue = Math.toIntExact(value); // broad limit makes overflow checking lighter // first convert localized day-of-week to ISO day-of-week @@ -915,19 +915,20 @@ public final class WeekFields implements Serializable { int dow = localizedDayOfWeek(isoDow); // build date + Chronology chrono = Chronology.from(partialTemporal); if (fieldValues.containsKey(YEAR)) { int year = YEAR.checkValidIntValue(fieldValues.get(YEAR)); // validate if (rangeUnit == MONTHS && fieldValues.containsKey(MONTH_OF_YEAR)) { // week-of-month long month = fieldValues.get(MONTH_OF_YEAR); // not validated yet - return resolveWoM(fieldValues, chronology, year, month, newValue, dow, resolverStyle); + return resolveWoM(fieldValues, chrono, year, month, newValue, dow, resolverStyle); } if (rangeUnit == YEARS) { // week-of-year - return resolveWoY(fieldValues, chronology, year, newValue, dow, resolverStyle); + return resolveWoY(fieldValues, chrono, year, newValue, dow, resolverStyle); } } else if ((rangeUnit == WEEK_BASED_YEARS || rangeUnit == FOREVER) && fieldValues.containsKey(weekDef.weekBasedYear) && fieldValues.containsKey(weekDef.weekOfWeekBasedYear)) { // week-of-week-based-year and year-of-week-based-year - return resolveWBY(fieldValues, chronology, dow, resolverStyle); + return resolveWBY(fieldValues, chrono, dow, resolverStyle); } return null; } diff --git a/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java b/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java index 4ef01317b2e..b99d9bb4730 100644 --- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java +++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java @@ -927,8 +927,7 @@ public class TCKDateTimeParseResolver { } @Override public TemporalAccessor resolve( - Map fieldValues, Chronology chronology, - ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { return LocalTime.MIDNIGHT.plusNanos(fieldValues.remove(this)); } }; @@ -979,8 +978,7 @@ public class TCKDateTimeParseResolver { } @Override public TemporalAccessor resolve( - Map fieldValues, Chronology chronology, - ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { fieldValues.remove(this); return LocalDateTime.of(2010, 6, 30, 12, 30); } @@ -1032,8 +1030,7 @@ public class TCKDateTimeParseResolver { } @Override public TemporalAccessor resolve( - Map fieldValues, Chronology chronology, - ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { return ThaiBuddhistChronology.INSTANCE.dateNow(); } }; @@ -1082,8 +1079,7 @@ public class TCKDateTimeParseResolver { } @Override public TemporalAccessor resolve( - Map fieldValues, Chronology chronology, - ZoneId zone, ResolverStyle resolverStyle) { + Map fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) { return ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, ZoneId.of("Europe/Paris")); } }; From f2ea6795a76bbbaf4c99158d772c946b1f0b0e1e Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Tue, 9 Jul 2013 21:35:04 +0100 Subject: [PATCH 034/983] 8025719: Change Chronology to an interface Split Chronology and add AbstractChronology Reviewed-by: darcy --- .../java/time/chrono/AbstractChronology.java | 783 ++++++++++++++++++ .../java/time/chrono/ChronoLocalDate.java | 2 +- .../java/time/chrono/ChronoLocalDateTime.java | 2 +- .../java/time/chrono/ChronoZonedDateTime.java | 2 +- .../classes/java/time/chrono/Chronology.java | 710 ++-------------- .../java/time/chrono/HijrahChronology.java | 8 +- .../java/time/chrono/IsoChronology.java | 2 +- .../java/time/chrono/JapaneseChronology.java | 2 +- .../java/time/chrono/MinguoChronology.java | 2 +- .../share/classes/java/time/chrono/Ser.java | 4 +- .../time/chrono/ThaiBuddhistChronology.java | 2 +- .../java/time/chrono/CopticChronology.java | 8 +- 12 files changed, 864 insertions(+), 663 deletions(-) create mode 100644 jdk/src/share/classes/java/time/chrono/AbstractChronology.java diff --git a/jdk/src/share/classes/java/time/chrono/AbstractChronology.java b/jdk/src/share/classes/java/time/chrono/AbstractChronology.java new file mode 100644 index 00000000000..89b728e88c9 --- /dev/null +++ b/jdk/src/share/classes/java/time/chrono/AbstractChronology.java @@ -0,0 +1,783 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package java.time.chrono; + +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; +import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.DAY_OF_WEEK; +import static java.time.temporal.ChronoField.DAY_OF_YEAR; +import static java.time.temporal.ChronoField.EPOCH_DAY; +import static java.time.temporal.ChronoField.ERA; +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; +import static java.time.temporal.ChronoField.YEAR; +import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.WEEKS; +import static java.time.temporal.TemporalAdjuster.nextOrSame; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectStreamException; +import java.io.Serializable; +import java.time.DateTimeException; +import java.time.DayOfWeek; +import java.time.format.ResolverStyle; +import java.time.temporal.ChronoField; +import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalField; +import java.time.temporal.ValueRange; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.ServiceLoader; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import sun.util.logging.PlatformLogger; + +/** + * An abstract implementation of a calendar system, used to organize and identify dates. + *

+ * The main date and time API is built on the ISO calendar system. + * The chronology operates behind the scenes to represent the general concept of a calendar system. + *

+ * See {@link Chronology} for more details. + * + * @implSpec + * This class is separated from the {@code Chronology} interface so that the static methods + * are not inherited. While {@code Chronology} can be implemented directly, it is strongly + * recommended to extend this abstract class instead. + *

+ * This class must be implemented with care to ensure other classes operate correctly. + * All implementations that can be instantiated must be final, immutable and thread-safe. + * Subclasses should be Serializable wherever possible. + * + * @since 1.8 + */ +public abstract class AbstractChronology implements Chronology { + + /** + * ChronoLocalDate order constant. + */ + static final Comparator DATE_ORDER = + (Comparator & Serializable) (date1, date2) -> { + return Long.compare(date1.toEpochDay(), date2.toEpochDay()); + }; + /** + * ChronoLocalDateTime order constant. + */ + static final Comparator> DATE_TIME_ORDER = + (Comparator> & Serializable) (dateTime1, dateTime2) -> { + int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay()); + if (cmp == 0) { + cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay()); + } + return cmp; + }; + /** + * ChronoZonedDateTime order constant. + */ + static final Comparator> INSTANT_ORDER = + (Comparator> & Serializable) (dateTime1, dateTime2) -> { + int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond()); + if (cmp == 0) { + cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano()); + } + return cmp; + }; + + /** + * Map of available calendars by ID. + */ + private static final ConcurrentHashMap CHRONOS_BY_ID = new ConcurrentHashMap<>(); + /** + * Map of available calendars by calendar type. + */ + private static final ConcurrentHashMap CHRONOS_BY_TYPE = new ConcurrentHashMap<>(); + + /** + * Register a Chronology by its ID and type for lookup by {@link #of(String)}. + * Chronologies must not be registered until they are completely constructed. + * Specifically, not in the constructor of Chronology. + * + * @param chrono the chronology to register; not null + * @return the already registered Chronology if any, may be null + */ + static Chronology registerChrono(Chronology chrono) { + return registerChrono(chrono, chrono.getId()); + } + + /** + * Register a Chronology by ID and type for lookup by {@link #of(String)}. + * Chronos must not be registered until they are completely constructed. + * Specifically, not in the constructor of Chronology. + * + * @param chrono the chronology to register; not null + * @param id the ID to register the chronology; not null + * @return the already registered Chronology if any, may be null + */ + static Chronology registerChrono(Chronology chrono, String id) { + Chronology prev = CHRONOS_BY_ID.putIfAbsent(id, chrono); + if (prev == null) { + String type = chrono.getCalendarType(); + if (type != null) { + CHRONOS_BY_TYPE.putIfAbsent(type, chrono); + } + } + return prev; + } + + /** + * Initialization of the maps from id and type to Chronology. + * The ServiceLoader is used to find and register any implementations + * of {@link java.time.chrono.AbstractChronology} found in the bootclass loader. + * The built-in chronologies are registered explicitly. + * Calendars configured via the Thread's context classloader are local + * to that thread and are ignored. + *

+ * The initialization is done only once using the registration + * of the IsoChronology as the test and the final step. + * Multiple threads may perform the initialization concurrently. + * Only the first registration of each Chronology is retained by the + * ConcurrentHashMap. + * @return true if the cache was initialized + */ + private static boolean initCache() { + if (CHRONOS_BY_ID.get("ISO") == null) { + // Initialization is incomplete + + // Register built-in Chronologies + registerChrono(HijrahChronology.INSTANCE); + registerChrono(JapaneseChronology.INSTANCE); + registerChrono(MinguoChronology.INSTANCE); + registerChrono(ThaiBuddhistChronology.INSTANCE); + + // Register Chronologies from the ServiceLoader + @SuppressWarnings("rawtypes") + ServiceLoader loader = ServiceLoader.load(AbstractChronology.class, null); + for (AbstractChronology chrono : loader) { + String id = chrono.getId(); + if (id.equals("ISO") || registerChrono(chrono) != null) { + // Log the attempt to replace an existing Chronology + PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono"); + logger.warning("Ignoring duplicate Chronology, from ServiceLoader configuration " + id); + } + } + + // finally, register IsoChronology to mark initialization is complete + registerChrono(IsoChronology.INSTANCE); + return true; + } + return false; + } + + //----------------------------------------------------------------------- + /** + * Obtains an instance of {@code Chronology} from a locale. + *

+ * See {@link Chronology#ofLocale(Locale)}. + * + * @param locale the locale to use to obtain the calendar system, not null + * @return the calendar system associated with the locale, not null + * @throws java.time.DateTimeException if the locale-specified calendar cannot be found + */ + static Chronology ofLocale(Locale locale) { + Objects.requireNonNull(locale, "locale"); + String type = locale.getUnicodeLocaleType("ca"); + if (type == null || "iso".equals(type) || "iso8601".equals(type)) { + return IsoChronology.INSTANCE; + } + // Not pre-defined; lookup by the type + do { + Chronology chrono = CHRONOS_BY_TYPE.get(type); + if (chrono != null) { + return chrono; + } + // If not found, do the initialization (once) and repeat the lookup + } while (initCache()); + + // Look for a Chronology using ServiceLoader of the Thread's ContextClassLoader + // Application provided Chronologies must not be cached + @SuppressWarnings("rawtypes") + ServiceLoader loader = ServiceLoader.load(Chronology.class); + for (Chronology chrono : loader) { + if (type.equals(chrono.getCalendarType())) { + return chrono; + } + } + throw new DateTimeException("Unknown calendar system: " + type); + } + + //----------------------------------------------------------------------- + /** + * Obtains an instance of {@code Chronology} from a chronology ID or + * calendar system type. + *

+ * See {@link Chronology#of(String)}. + * + * @param id the chronology ID or calendar system type, not null + * @return the chronology with the identifier requested, not null + * @throws java.time.DateTimeException if the chronology cannot be found + */ + static Chronology of(String id) { + Objects.requireNonNull(id, "id"); + do { + Chronology chrono = of0(id); + if (chrono != null) { + return chrono; + } + // If not found, do the initialization (once) and repeat the lookup + } while (initCache()); + + // Look for a Chronology using ServiceLoader of the Thread's ContextClassLoader + // Application provided Chronologies must not be cached + @SuppressWarnings("rawtypes") + ServiceLoader loader = ServiceLoader.load(Chronology.class); + for (Chronology chrono : loader) { + if (id.equals(chrono.getId()) || id.equals(chrono.getCalendarType())) { + return chrono; + } + } + throw new DateTimeException("Unknown chronology: " + id); + } + + /** + * Obtains an instance of {@code Chronology} from a chronology ID or + * calendar system type. + * + * @param id the chronology ID or calendar system type, not null + * @return the chronology with the identifier requested, or {@code null} if not found + */ + private static Chronology of0(String id) { + Chronology chrono = CHRONOS_BY_ID.get(id); + if (chrono == null) { + chrono = CHRONOS_BY_TYPE.get(id); + } + return chrono; + } + + /** + * Returns the available chronologies. + *

+ * Each returned {@code Chronology} is available for use in the system. + * The set of chronologies includes the system chronologies and + * any chronologies provided by the application via ServiceLoader + * configuration. + * + * @return the independent, modifiable set of the available chronology IDs, not null + */ + static Set getAvailableChronologies() { + initCache(); // force initialization + HashSet chronos = new HashSet<>(CHRONOS_BY_ID.values()); + + /// Add in Chronologies from the ServiceLoader configuration + @SuppressWarnings("rawtypes") + ServiceLoader loader = ServiceLoader.load(Chronology.class); + for (Chronology chrono : loader) { + chronos.add(chrono); + } + return chronos; + } + + //----------------------------------------------------------------------- + /** + * Creates an instance. + */ + protected AbstractChronology() { + } + + //----------------------------------------------------------------------- + /** + * Resolves parsed {@code ChronoField} values into a date during parsing. + *

+ * Most {@code TemporalField} implementations are resolved using the + * resolve method on the field. By contrast, the {@code ChronoField} class + * defines fields that only have meaning relative to the chronology. + * As such, {@code ChronoField} date fields are resolved here in the + * context of a specific chronology. + *

+ * {@code ChronoField} instances are resolved by this method, which may + * be overridden in subclasses. + *

    + *
  • {@code EPOCH_DAY} - If present, this is converted to a date and + * all other date fields are then cross-checked against the date. + *
  • {@code PROLEPTIC_MONTH} - If present, then it is split into the + * {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart + * then the field is validated. + *
  • {@code YEAR_OF_ERA} and {@code ERA} - If both are present, then they + * are combined to form a {@code YEAR}. In lenient mode, the {@code YEAR_OF_ERA} + * range is not validated, in smart and strict mode it is. The {@code ERA} is + * validated for range in all three modes. If only the {@code YEAR_OF_ERA} is + * present, and the mode is smart or lenient, then the last available era + * is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is + * left untouched. If only the {@code ERA} is present, then it is left untouched. + *
  • {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} - + * If all three are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is smart or strict, then the month and day are validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the first month in the requested year, + * then adding the difference in months, then the difference in days. + * If the mode is smart, and the day-of-month is greater than the maximum for + * the year-month, then the day-of-month is adjusted to the last day-of-month. + * If the mode is strict, then the three fields must form a valid date. + *
  • {@code YEAR} and {@code DAY_OF_YEAR} - + * If both are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the difference in days. + * If the mode is smart or strict, then the two fields must form a valid date. + *
  • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and + * {@code ALIGNED_DAY_OF_WEEK_IN_MONTH} - + * If all four are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the first month in the requested year, then adding + * the difference in months, then the difference in weeks, then in days. + * If the mode is smart or strict, then the all four fields are validated to + * their outer ranges. The date is then combined in a manner equivalent to + * creating a date on the first day of the requested year and month, then adding + * the amount in weeks and days to reach their values. If the mode is strict, + * the date is additionally validated to check that the day and week adjustment + * did not change the month. + *
  • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and + * {@code DAY_OF_WEEK} - If all four are present, then they are combined to + * form a date. The approach is the same as described above for + * years, months and weeks in {@code ALIGNED_DAY_OF_WEEK_IN_MONTH}. + * The day-of-week is adjusted as the next or same matching day-of-week once + * the years, months and weeks have been handled. + *
  • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code ALIGNED_DAY_OF_WEEK_IN_YEAR} - + * If all three are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the difference in weeks, then in days. + * If the mode is smart or strict, then the all three fields are validated to + * their outer ranges. The date is then combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the amount in weeks and days to reach their values. If the mode is strict, + * the date is additionally validated to check that the day and week adjustment + * did not change the year. + *
  • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code DAY_OF_WEEK} - + * If all three are present, then they are combined to form a date. + * The approach is the same as described above for years and weeks in + * {@code ALIGNED_DAY_OF_WEEK_IN_YEAR}. The day-of-week is adjusted as the + * next or same matching day-of-week once the years and weeks have been handled. + *
+ *

+ * The default implementation is suitable for most calendar systems. + * If {@link java.time.temporal.ChronoField#YEAR_OF_ERA} is found without an {@link java.time.temporal.ChronoField#ERA} + * then the last era in {@link #eras()} is used. + * The implementation assumes a 7 day week, that the first day-of-month + * has the value 1, that first day-of-year has the value 1, and that the + * first of the month and year always exists. + * + * @param fieldValues the map of fields to values, which can be updated, not null + * @param resolverStyle the requested type of resolve, not null + * @return the resolved date, null if insufficient information to create a date + * @throws java.time.DateTimeException if the date cannot be resolved, typically + * because of a conflict in the input data + */ + @Override + public ChronoLocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + // check epoch-day before inventing era + if (fieldValues.containsKey(EPOCH_DAY)) { + return dateEpochDay(fieldValues.remove(EPOCH_DAY)); + } + + // fix proleptic month before inventing era + resolveProlepticMonth(fieldValues, resolverStyle); + + // invent era if necessary to resolve year-of-era + ChronoLocalDate resolved = resolveYearOfEra(fieldValues, resolverStyle); + if (resolved != null) { + return resolved; + } + + // build date + if (fieldValues.containsKey(YEAR)) { + if (fieldValues.containsKey(MONTH_OF_YEAR)) { + if (fieldValues.containsKey(DAY_OF_MONTH)) { + return resolveYMD(fieldValues, resolverStyle); + } + if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) { + if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) { + return resolveYMAA(fieldValues, resolverStyle); + } + if (fieldValues.containsKey(DAY_OF_WEEK)) { + return resolveYMAD(fieldValues, resolverStyle); + } + } + } + if (fieldValues.containsKey(DAY_OF_YEAR)) { + return resolveYD(fieldValues, resolverStyle); + } + if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) { + if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) { + return resolveYAA(fieldValues, resolverStyle); + } + if (fieldValues.containsKey(DAY_OF_WEEK)) { + return resolveYAD(fieldValues, resolverStyle); + } + } + } + return null; + } + + void resolveProlepticMonth(Map fieldValues, ResolverStyle resolverStyle) { + Long pMonth = fieldValues.remove(PROLEPTIC_MONTH); + if (pMonth != null) { + if (resolverStyle != ResolverStyle.LENIENT) { + PROLEPTIC_MONTH.checkValidValue(pMonth); + } + // first day-of-month is likely to be safest for setting proleptic-month + // cannot add to year zero, as not all chronologies have a year zero + ChronoLocalDate chronoDate = dateNow() + .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth); + addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR)); + addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR)); + } + } + + ChronoLocalDate resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { + Long yoeLong = fieldValues.remove(YEAR_OF_ERA); + if (yoeLong != null) { + Long eraLong = fieldValues.remove(ERA); + int yoe; + if (resolverStyle != ResolverStyle.LENIENT) { + yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA); + } else { + yoe = Math.toIntExact(yoeLong); + } + if (eraLong != null) { + Era eraObj = eraOf(range(ERA).checkValidIntValue(eraLong, ERA)); + addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); + } else { + if (fieldValues.containsKey(YEAR)) { + int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR); + ChronoLocalDate chronoDate = dateYearDay(year, 1); + addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe)); + } else if (resolverStyle == ResolverStyle.STRICT) { + // do not invent era if strict + // reinstate the field removed earlier, no cross-check issues + fieldValues.put(YEAR_OF_ERA, yoeLong); + } else { + List eras = eras(); + if (eras.isEmpty()) { + addFieldValue(fieldValues, YEAR, yoe); + } else { + Era eraObj = eras.get(eras.size() - 1); + addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); + } + } + } + } else if (fieldValues.containsKey(ERA)) { + range(ERA).checkValidValue(fieldValues.get(ERA), ERA); // always validated + } + return null; + } + + ChronoLocalDate resolveYMD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); + return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + ValueRange domRange = range(DAY_OF_MONTH); + int dom = domRange.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH); + if (resolverStyle == ResolverStyle.SMART) { // previous valid + try { + return date(y, moy, dom); + } catch (DateTimeException ex) { + return date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); + } + } + return date(y, moy, dom); + } + + ChronoLocalDate resolveYD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); + return dateYearDay(y, 1).plus(days, DAYS); + } + int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR); + return dateYearDay(y, doy); // smart is same as strict + } + + ChronoLocalDate resolveYMAA(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); + long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1); + return date(y, 1, 1).plus(months, MONTHS).plus(weeks, WEEKS).plus(days, DAYS); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); + int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH); + ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); + } + return date; + } + + ChronoLocalDate resolveYMAD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); + long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); + return resolveAligned(date(y, 1, 1), months, weeks, dow); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); + int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); + ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); + if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); + } + return date; + } + + ChronoLocalDate resolveYAA(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); + long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1); + return dateYearDay(y, 1).plus(weeks, WEEKS).plus(days, DAYS); + } + int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); + int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR); + ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); + } + return date; + } + + ChronoLocalDate resolveYAD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); + long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); + return resolveAligned(dateYearDay(y, 1), 0, weeks, dow); + } + int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); + int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); + ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); + if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); + } + return date; + } + + ChronoLocalDate resolveAligned(ChronoLocalDate base, long months, long weeks, long dow) { + ChronoLocalDate date = base.plus(months, MONTHS).plus(weeks, WEEKS); + if (dow > 7) { + date = date.plus((dow - 1) / 7, WEEKS); + dow = ((dow - 1) % 7) + 1; + } else if (dow < 1) { + date = date.plus(Math.subtractExact(dow, 7) / 7, WEEKS); + dow = ((dow + 6) % 7) + 1; + } + return date.with(nextOrSame(DayOfWeek.of((int) dow))); + } + + /** + * Adds a field-value pair to the map, checking for conflicts. + *

+ * If the field is not already present, then the field-value pair is added to the map. + * If the field is already present and it has the same value as that specified, no action occurs. + * If the field is already present and it has a different value to that specified, then + * an exception is thrown. + * + * @param field the field to add, not null + * @param value the value to add, not null + * @throws java.time.DateTimeException if the field is already present with a different value + */ + void addFieldValue(Map fieldValues, ChronoField field, long value) { + Long old = fieldValues.get(field); // check first for better error message + if (old != null && old.longValue() != value) { + throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value); + } + fieldValues.put(field, value); + } + + //----------------------------------------------------------------------- + /** + * Compares this chronology to another chronology. + *

+ * The comparison order first by the chronology ID string, then by any + * additional information specific to the subclass. + * It is "consistent with equals", as defined by {@link Comparable}. + * + * @implSpec + * This implementation compares the chronology ID. + * Subclasses must compare any additional state that they store. + * + * @param other the other chronology to compare to, not null + * @return the comparator value, negative if less, positive if greater + */ + @Override + public int compareTo(Chronology other) { + return getId().compareTo(other.getId()); + } + + /** + * Checks if this chronology is equal to another chronology. + *

+ * The comparison is based on the entire state of the object. + * + * @implSpec + * This implementation checks the type and calls + * {@link #compareTo(java.time.chrono.Chronology)}. + * + * @param obj the object to check, null returns false + * @return true if this is equal to the other chronology + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof AbstractChronology) { + return compareTo((AbstractChronology) obj) == 0; + } + return false; + } + + /** + * A hash code for this chronology. + *

+ * The hash code should be based on the entire state of the object. + * + * @implSpec + * This implementation is based on the chronology ID and class. + * Subclasses should add any additional state that they store. + * + * @return a suitable hash code + */ + @Override + public int hashCode() { + return getClass().hashCode() ^ getId().hashCode(); + } + + //----------------------------------------------------------------------- + /** + * Outputs this chronology as a {@code String}, using the chronology ID. + * + * @return a string representation of this chronology, not null + */ + @Override + public String toString() { + return getId(); + } + + //----------------------------------------------------------------------- + /** + * Writes the Chronology using a + * dedicated serialized form. + *

+     *  out.writeByte(1);  // identifies this as a Chronology
+     *  out.writeUTF(getId());
+     * 
+ * + * @return the instance of {@code Ser}, not null + */ + Object writeReplace() { + return new Ser(Ser.CHRONO_TYPE, this); + } + + /** + * Defend against malicious streams. + * @return never + * @throws java.io.InvalidObjectException always + */ + private Object readResolve() throws ObjectStreamException { + throw new InvalidObjectException("Deserialization via serialization delegate"); + } + + void writeExternal(DataOutput out) throws IOException { + out.writeUTF(getId()); + } + + static Chronology readExternal(DataInput in) throws IOException { + String id = in.readUTF(); + return Chronology.of(id); + } + +} diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java index 58e4f5d5250..da5f0e719ce 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java @@ -262,7 +262,7 @@ public interface ChronoLocalDate * @see #isEqual */ static Comparator timeLineOrder() { - return Chronology.DATE_ORDER; + return AbstractChronology.DATE_ORDER; } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java index 4c2ddfd31a7..353673c9dcd 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java @@ -136,7 +136,7 @@ public interface ChronoLocalDateTime * @see #isEqual */ static Comparator> timeLineOrder() { - return Chronology.DATE_TIME_ORDER; + return AbstractChronology.DATE_TIME_ORDER; } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java index 033ab997fdd..caec8558e6e 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java @@ -137,7 +137,7 @@ public interface ChronoZonedDateTime * @see #isEqual */ static Comparator> timeLineOrder() { - return Chronology.INSTANT_ORDER; + return AbstractChronology.INSTANT_ORDER; } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/Chronology.java b/jdk/src/share/classes/java/time/chrono/Chronology.java index ed40f4138f0..22a7e69ae25 100644 --- a/jdk/src/share/classes/java/time/chrono/Chronology.java +++ b/jdk/src/share/classes/java/time/chrono/Chronology.java @@ -61,33 +61,8 @@ */ package java.time.chrono; -import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; -import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; -import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; -import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; -import static java.time.temporal.ChronoField.DAY_OF_MONTH; -import static java.time.temporal.ChronoField.DAY_OF_WEEK; -import static java.time.temporal.ChronoField.DAY_OF_YEAR; -import static java.time.temporal.ChronoField.EPOCH_DAY; -import static java.time.temporal.ChronoField.ERA; -import static java.time.temporal.ChronoField.MONTH_OF_YEAR; -import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; -import static java.time.temporal.ChronoField.YEAR; -import static java.time.temporal.ChronoField.YEAR_OF_ERA; -import static java.time.temporal.ChronoUnit.DAYS; -import static java.time.temporal.ChronoUnit.MONTHS; -import static java.time.temporal.ChronoUnit.WEEKS; -import static java.time.temporal.TemporalAdjuster.nextOrSame; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectStreamException; -import java.io.Serializable; import java.time.Clock; import java.time.DateTimeException; -import java.time.DayOfWeek; import java.time.Instant; import java.time.LocalDate; import java.time.LocalTime; @@ -97,28 +72,21 @@ import java.time.format.ResolverStyle; import java.time.format.TextStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; -import java.util.Comparator; -import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; -import java.util.ServiceLoader; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import sun.util.logging.PlatformLogger; /** * A calendar system, used to organize and identify dates. *

* The main date and time API is built on the ISO calendar system. - * This class operates behind the scenes to represent the general concept of a calendar system. + * The chronology operates behind the scenes to represent the general concept of a calendar system. * For example, the Japanese, Minguo, Thai Buddhist and others. *

* Most other calendar systems also operate on the shared concepts of year, month and day, @@ -179,130 +147,14 @@ import sun.util.logging.PlatformLogger; * CLDR type and, if applicable, the CLDR variant, * * @implSpec - * This class must be implemented with care to ensure other classes operate correctly. + * This interface must be implemented with care to ensure other classes operate correctly. * All implementations that can be instantiated must be final, immutable and thread-safe. * Subclasses should be Serializable wherever possible. * * @since 1.8 */ -public abstract class Chronology implements Comparable { +public interface Chronology extends Comparable { - /** - * ChronoLocalDate order constant. - */ - static final Comparator DATE_ORDER = - (Comparator & Serializable) (date1, date2) -> { - return Long.compare(date1.toEpochDay(), date2.toEpochDay()); - }; - /** - * ChronoLocalDateTime order constant. - */ - static final Comparator> DATE_TIME_ORDER = - (Comparator> & Serializable) (dateTime1, dateTime2) -> { - int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay()); - if (cmp == 0) { - cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay()); - } - return cmp; - }; - /** - * ChronoZonedDateTime order constant. - */ - static final Comparator> INSTANT_ORDER = - (Comparator> & Serializable) (dateTime1, dateTime2) -> { - int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond()); - if (cmp == 0) { - cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano()); - } - return cmp; - }; - - /** - * Map of available calendars by ID. - */ - private static final ConcurrentHashMap CHRONOS_BY_ID = new ConcurrentHashMap<>(); - /** - * Map of available calendars by calendar type. - */ - private static final ConcurrentHashMap CHRONOS_BY_TYPE = new ConcurrentHashMap<>(); - - /** - * Register a Chronology by its ID and type for lookup by {@link #of(java.lang.String)}. - * Chronologies must not be registered until they are completely constructed. - * Specifically, not in the constructor of Chronology. - * - * @param chrono the chronology to register; not null - * @return the already registered Chronology if any, may be null - */ - static Chronology registerChrono(Chronology chrono) { - return registerChrono(chrono, chrono.getId()); - } - - /** - * Register a Chronology by ID and type for lookup by {@link #of(java.lang.String)}. - * Chronos must not be registered until they are completely constructed. - * Specifically, not in the constructor of Chronology. - * - * @param chrono the chronology to register; not null - * @param id the ID to register the chronology; not null - * @return the already registered Chronology if any, may be null - */ - static Chronology registerChrono(Chronology chrono, String id) { - Chronology prev = CHRONOS_BY_ID.putIfAbsent(id, chrono); - if (prev == null) { - String type = chrono.getCalendarType(); - if (type != null) { - CHRONOS_BY_TYPE.putIfAbsent(type, chrono); - } - } - return prev; - } - - /** - * Initialization of the maps from id and type to Chronology. - * The ServiceLoader is used to find and register any implementations - * of {@link java.time.chrono.Chronology} found in the bootclass loader. - * The built-in chronologies are registered explicitly. - * Calendars configured via the Thread's context classloader are local - * to that thread and are ignored. - *

- * The initialization is done only once using the registration - * of the IsoChronology as the test and the final step. - * Multiple threads may perform the initialization concurrently. - * Only the first registration of each Chronology is retained by the - * ConcurrentHashMap. - * @return true if the cache was initialized - */ - private static boolean initCache() { - if (CHRONOS_BY_ID.get("ISO") == null) { - // Initialization is incomplete - - // Register built-in Chronologies - registerChrono(HijrahChronology.INSTANCE); - registerChrono(JapaneseChronology.INSTANCE); - registerChrono(MinguoChronology.INSTANCE); - registerChrono(ThaiBuddhistChronology.INSTANCE); - - // Register Chronologies from the ServiceLoader - @SuppressWarnings("rawtypes") - ServiceLoader loader = ServiceLoader.load(Chronology.class, null); - for (Chronology chrono : loader) { - String id = chrono.getId(); - if (id.equals("ISO") || registerChrono(chrono) != null) { - // Log the attempt to replace an existing Chronology - PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono"); - logger.warning("Ignoring duplicate Chronology, from ServiceLoader configuration " + id); - } - } - - // finally, register IsoChronology to mark initialization is complete - registerChrono(IsoChronology.INSTANCE); - return true; - } - return false; - } - - //----------------------------------------------------------------------- /** * Obtains an instance of {@code Chronology} from a temporal object. *

@@ -320,7 +172,7 @@ public abstract class Chronology implements Comparable { * @return the chronology, not null * @throws DateTimeException if unable to convert to an {@code Chronology} */ - public static Chronology from(TemporalAccessor temporal) { + static Chronology from(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); Chronology obj = temporal.query(TemporalQuery.chronology()); return (obj != null ? obj : IsoChronology.INSTANCE); @@ -367,31 +219,8 @@ public abstract class Chronology implements Comparable { * @return the calendar system associated with the locale, not null * @throws DateTimeException if the locale-specified calendar cannot be found */ - public static Chronology ofLocale(Locale locale) { - Objects.requireNonNull(locale, "locale"); - String type = locale.getUnicodeLocaleType("ca"); - if (type == null || "iso".equals(type) || "iso8601".equals(type)) { - return IsoChronology.INSTANCE; - } - // Not pre-defined; lookup by the type - do { - Chronology chrono = CHRONOS_BY_TYPE.get(type); - if (chrono != null) { - return chrono; - } - // If not found, do the initialization (once) and repeat the lookup - } while (initCache()); - - // Look for a Chronology using ServiceLoader of the Thread's ContextClassLoader - // Application provided Chronologies must not be cached - @SuppressWarnings("rawtypes") - ServiceLoader loader = ServiceLoader.load(Chronology.class); - for (Chronology chrono : loader) { - if (type.equals(chrono.getCalendarType())) { - return chrono; - } - } - throw new DateTimeException("Unknown calendar system: " + type); + static Chronology ofLocale(Locale locale) { + return AbstractChronology.ofLocale(locale); } //----------------------------------------------------------------------- @@ -415,41 +244,8 @@ public abstract class Chronology implements Comparable { * @return the chronology with the identifier requested, not null * @throws DateTimeException if the chronology cannot be found */ - public static Chronology of(String id) { - Objects.requireNonNull(id, "id"); - do { - Chronology chrono = of0(id); - if (chrono != null) { - return chrono; - } - // If not found, do the initialization (once) and repeat the lookup - } while (initCache()); - - // Look for a Chronology using ServiceLoader of the Thread's ContextClassLoader - // Application provided Chronologies must not be cached - @SuppressWarnings("rawtypes") - ServiceLoader loader = ServiceLoader.load(Chronology.class); - for (Chronology chrono : loader) { - if (id.equals(chrono.getId()) || id.equals(chrono.getCalendarType())) { - return chrono; - } - } - throw new DateTimeException("Unknown chronology: " + id); - } - - /** - * Obtains an instance of {@code Chronology} from a chronology ID or - * calendar system type. - * - * @param id the chronology ID or calendar system type, not null - * @return the chronology with the identifier requested, or {@code null} if not found - */ - private static Chronology of0(String id) { - Chronology chrono = CHRONOS_BY_ID.get(id); - if (chrono == null) { - chrono = CHRONOS_BY_TYPE.get(id); - } - return chrono; + static Chronology of(String id) { + return AbstractChronology.of(id); } /** @@ -462,24 +258,8 @@ public abstract class Chronology implements Comparable { * * @return the independent, modifiable set of the available chronology IDs, not null */ - public static Set getAvailableChronologies() { - initCache(); // force initialization - HashSet chronos = new HashSet<>(CHRONOS_BY_ID.values()); - - /// Add in Chronologies from the ServiceLoader configuration - @SuppressWarnings("rawtypes") - ServiceLoader loader = ServiceLoader.load(Chronology.class); - for (Chronology chrono : loader) { - chronos.add(chrono); - } - return chronos; - } - - //----------------------------------------------------------------------- - /** - * Creates an instance. - */ - protected Chronology() { + static Set getAvailableChronologies() { + return AbstractChronology.getAvailableChronologies(); } //----------------------------------------------------------------------- @@ -492,7 +272,7 @@ public abstract class Chronology implements Comparable { * @return the chronology ID, not null * @see #getCalendarType() */ - public abstract String getId(); + String getId(); /** * Gets the calendar type of the calendar system. @@ -507,13 +287,17 @@ public abstract class Chronology implements Comparable { * @return the calendar system type, null if the calendar is not defined by CLDR/LDML * @see #getId() */ - public abstract String getCalendarType(); + String getCalendarType(); //----------------------------------------------------------------------- /** * Obtains a local date in this chronology from the era, year-of-era, * month-of-year and day-of-month fields. * + * @implSpec + * The default implementation combines the era and year-of-era into a proleptic + * year before calling {@link #date(int, int, int)}. + * * @param era the era of the correct type for the chronology, not null * @param yearOfEra the chronology year-of-era * @param month the chronology month-of-year @@ -522,7 +306,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @throws ClassCastException if the {@code era} is not of the correct type for the chronology */ - public ChronoLocalDate date(Era era, int yearOfEra, int month, int dayOfMonth) { + default ChronoLocalDate date(Era era, int yearOfEra, int month, int dayOfMonth) { return date(prolepticYear(era, yearOfEra), month, dayOfMonth); } @@ -536,12 +320,16 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth); + ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth); /** * Obtains a local date in this chronology from the era, year-of-era and * day-of-year fields. * + * @implSpec + * The default implementation combines the era and year-of-era into a proleptic + * year before calling {@link #dateYearDay(int, int)}. + * * @param era the era of the correct type for the chronology, not null * @param yearOfEra the chronology year-of-era * @param dayOfYear the chronology day-of-year @@ -549,7 +337,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @throws ClassCastException if the {@code era} is not of the correct type for the chronology */ - public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { + default ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); } @@ -562,7 +350,7 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear); + ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear); /** * Obtains a local date in this chronology from the epoch-day. @@ -574,7 +362,7 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate dateEpochDay(long epochDay); + ChronoLocalDate dateEpochDay(long epochDay); //----------------------------------------------------------------------- /** @@ -585,13 +373,14 @@ public abstract class Chronology implements Comparable { *

* Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. - *

- * This implementation uses {@link #dateNow(Clock)}. + * + * @implSpec + * The default implementation invokes {@link #dateNow(Clock)}. * * @return the current local date using the system clock and default time-zone, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow() { + default ChronoLocalDate dateNow() { return dateNow(Clock.systemDefaultZone()); } @@ -604,11 +393,14 @@ public abstract class Chronology implements Comparable { * Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. * + * @implSpec + * The default implementation invokes {@link #dateNow(Clock)}. + * * @param zone the zone ID to use, not null * @return the current local date using the system clock, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow(ZoneId zone) { + default ChronoLocalDate dateNow(ZoneId zone) { return dateNow(Clock.system(zone)); } @@ -619,11 +411,14 @@ public abstract class Chronology implements Comparable { * Using this method allows the use of an alternate clock for testing. * The alternate clock may be introduced using {@link Clock dependency injection}. * + * @implSpec + * The default implementation invokes {@link #date(TemporalAccessor)} )}. + * * @param clock the clock to use, not null * @return the current local date, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow(Clock clock) { + default ChronoLocalDate dateNow(Clock clock) { Objects.requireNonNull(clock, "clock"); return date(LocalDate.now(clock)); } @@ -647,7 +442,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @see ChronoLocalDate#from(TemporalAccessor) */ - public abstract ChronoLocalDate date(TemporalAccessor temporal); + ChronoLocalDate date(TemporalAccessor temporal); /** * Obtains a local date-time in this chronology from another temporal object. @@ -670,7 +465,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date-time * @see ChronoLocalDateTime#from(TemporalAccessor) */ - public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { + default ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { try { return date(temporal).atTime(LocalTime.from(temporal)); } catch (DateTimeException ex) { @@ -702,7 +497,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date-time * @see ChronoZonedDateTime#from(TemporalAccessor) */ - public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { + default ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { try { ZoneId zone = ZoneId.from(temporal); try { @@ -728,7 +523,7 @@ public abstract class Chronology implements Comparable { * @return the zoned date-time, not null * @throws DateTimeException if the result exceeds the supported range */ - public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { + default ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return ChronoZonedDateTimeImpl.ofInstant(this, instant, zone); } @@ -746,7 +541,7 @@ public abstract class Chronology implements Comparable { * @param prolepticYear the proleptic-year to check, not validated for range * @return true if the year is a leap year */ - public abstract boolean isLeapYear(long prolepticYear); + boolean isLeapYear(long prolepticYear); /** * Calculates the proleptic-year given the era and year-of-era. @@ -764,7 +559,7 @@ public abstract class Chronology implements Comparable { * such as if the year is invalid for the era * @throws ClassCastException if the {@code era} is not of the correct type for the chronology */ - public abstract int prolepticYear(Era era, int yearOfEra); + int prolepticYear(Era era, int yearOfEra); /** * Creates the chronology era object from the numeric value. @@ -785,7 +580,7 @@ public abstract class Chronology implements Comparable { * @return the calendar system era, not null * @throws DateTimeException if unable to create the era */ - public abstract Era eraOf(int eraValue); + Era eraOf(int eraValue); /** * Gets the list of eras for the chronology. @@ -796,7 +591,7 @@ public abstract class Chronology implements Comparable { * * @return the list of eras for the chronology, may be immutable, not null */ - public abstract List eras(); + List eras(); //----------------------------------------------------------------------- /** @@ -815,7 +610,7 @@ public abstract class Chronology implements Comparable { * @return the range of valid values for the field, not null * @throws DateTimeException if the range for the field cannot be obtained */ - public abstract ValueRange range(ChronoField field); + ValueRange range(ChronoField field); //----------------------------------------------------------------------- /** @@ -825,28 +620,16 @@ public abstract class Chronology implements Comparable { * suitable for presentation to the user. * The parameters control the style of the returned text and the locale. * + * @implSpec + * The default implementation behaves as the the formatter was used to + * format the chronology textual name. + * * @param style the style of the text required, not null * @param locale the locale to use, not null * @return the text value of the chronology, not null */ - public String getDisplayName(TextStyle style, Locale locale) { - return new DateTimeFormatterBuilder().appendChronologyText(style).toFormatter(locale).format(toTemporal()); - } - - /** - * Converts this chronology to a {@code TemporalAccessor}. - *

- * A {@code Chronology} can be fully represented as a {@code TemporalAccessor}. - * However, the interface is not implemented by this class as most of the - * methods on the interface have no meaning to {@code Chronology}. - *

- * The returned temporal has no supported fields, with the query method - * supporting the return of the chronology using {@link TemporalQuery#chronology()}. - * - * @return a temporal equivalent to this chronology, not null - */ - private TemporalAccessor toTemporal() { - return new TemporalAccessor() { + default String getDisplayName(TextStyle style, Locale locale) { + TemporalAccessor temporal = new TemporalAccessor() { @Override public boolean isSupported(TemporalField field) { return false; @@ -864,6 +647,7 @@ public abstract class Chronology implements Comparable { return TemporalAccessor.super.query(query); } }; + return new DateTimeFormatterBuilder().appendChronologyText(style).toFormatter(locale).format(temporal); } //----------------------------------------------------------------------- @@ -876,82 +660,8 @@ public abstract class Chronology implements Comparable { * As such, {@code ChronoField} date fields are resolved here in the * context of a specific chronology. *

- * {@code ChronoField} instances are resolved by this method, which may - * be overridden in subclasses. - *

    - *
  • {@code EPOCH_DAY} - If present, this is converted to a date and - * all other date fields are then cross-checked against the date. - *
  • {@code PROLEPTIC_MONTH} - If present, then it is split into the - * {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart - * then the field is validated. - *
  • {@code YEAR_OF_ERA} and {@code ERA} - If both are present, then they - * are combined to form a {@code YEAR}. In lenient mode, the {@code YEAR_OF_ERA} - * range is not validated, in smart and strict mode it is. The {@code ERA} is - * validated for range in all three modes. If only the {@code YEAR_OF_ERA} is - * present, and the mode is smart or lenient, then the last available era - * is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is - * left untouched. If only the {@code ERA} is present, then it is left untouched. - *
  • {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} - - * If all three are present, then they are combined to form a date. - * In all three modes, the {@code YEAR} is validated. - * If the mode is smart or strict, then the month and day are validated. - * If the mode is lenient, then the date is combined in a manner equivalent to - * creating a date on the first day of the first month in the requested year, - * then adding the difference in months, then the difference in days. - * If the mode is smart, and the day-of-month is greater than the maximum for - * the year-month, then the day-of-month is adjusted to the last day-of-month. - * If the mode is strict, then the three fields must form a valid date. - *
  • {@code YEAR} and {@code DAY_OF_YEAR} - - * If both are present, then they are combined to form a date. - * In all three modes, the {@code YEAR} is validated. - * If the mode is lenient, then the date is combined in a manner equivalent to - * creating a date on the first day of the requested year, then adding - * the difference in days. - * If the mode is smart or strict, then the two fields must form a valid date. - *
  • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and - * {@code ALIGNED_DAY_OF_WEEK_IN_MONTH} - - * If all four are present, then they are combined to form a date. - * In all three modes, the {@code YEAR} is validated. - * If the mode is lenient, then the date is combined in a manner equivalent to - * creating a date on the first day of the first month in the requested year, then adding - * the difference in months, then the difference in weeks, then in days. - * If the mode is smart or strict, then the all four fields are validated to - * their outer ranges. The date is then combined in a manner equivalent to - * creating a date on the first day of the requested year and month, then adding - * the amount in weeks and days to reach their values. If the mode is strict, - * the date is additionally validated to check that the day and week adjustment - * did not change the month. - *
  • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and - * {@code DAY_OF_WEEK} - If all four are present, then they are combined to - * form a date. The approach is the same as described above for - * years, months and weeks in {@code ALIGNED_DAY_OF_WEEK_IN_MONTH}. - * The day-of-week is adjusted as the next or same matching day-of-week once - * the years, months and weeks have been handled. - *
  • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code ALIGNED_DAY_OF_WEEK_IN_YEAR} - - * If all three are present, then they are combined to form a date. - * In all three modes, the {@code YEAR} is validated. - * If the mode is lenient, then the date is combined in a manner equivalent to - * creating a date on the first day of the requested year, then adding - * the difference in weeks, then in days. - * If the mode is smart or strict, then the all three fields are validated to - * their outer ranges. The date is then combined in a manner equivalent to - * creating a date on the first day of the requested year, then adding - * the amount in weeks and days to reach their values. If the mode is strict, - * the date is additionally validated to check that the day and week adjustment - * did not change the year. - *
  • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code DAY_OF_WEEK} - - * If all three are present, then they are combined to form a date. - * The approach is the same as described above for years and weeks in - * {@code ALIGNED_DAY_OF_WEEK_IN_YEAR}. The day-of-week is adjusted as the - * next or same matching day-of-week once the years and weeks have been handled. - *
- *

- * The default implementation is suitable for most calendar systems. - * If {@link ChronoField#YEAR_OF_ERA} is found without an {@link ChronoField#ERA} - * then the last era in {@link #eras()} is used. - * The implementation assumes a 7 day week, that the first day-of-month - * has the value 1, that first day-of-year has the value 1, and that the - * first of the month and year always exists. + * The default implementation, which explains typical resolve behaviour, + * is provided in {@link AbstractChronology}. * * @param fieldValues the map of fields to values, which can be updated, not null * @param resolverStyle the requested type of resolve, not null @@ -959,233 +669,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if the date cannot be resolved, typically * because of a conflict in the input data */ - public ChronoLocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { - // check epoch-day before inventing era - if (fieldValues.containsKey(EPOCH_DAY)) { - return dateEpochDay(fieldValues.remove(EPOCH_DAY)); - } - - // fix proleptic month before inventing era - resolveProlepticMonth(fieldValues, resolverStyle); - - // invent era if necessary to resolve year-of-era - ChronoLocalDate resolved = resolveYearOfEra(fieldValues, resolverStyle); - if (resolved != null) { - return resolved; - } - - // build date - if (fieldValues.containsKey(YEAR)) { - if (fieldValues.containsKey(MONTH_OF_YEAR)) { - if (fieldValues.containsKey(DAY_OF_MONTH)) { - return resolveYMD(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) { - if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) { - return resolveYMAA(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(DAY_OF_WEEK)) { - return resolveYMAD(fieldValues, resolverStyle); - } - } - } - if (fieldValues.containsKey(DAY_OF_YEAR)) { - return resolveYD(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) { - if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) { - return resolveYAA(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(DAY_OF_WEEK)) { - return resolveYAD(fieldValues, resolverStyle); - } - } - } - return null; - } - - void resolveProlepticMonth(Map fieldValues, ResolverStyle resolverStyle) { - Long pMonth = fieldValues.remove(PROLEPTIC_MONTH); - if (pMonth != null) { - if (resolverStyle != ResolverStyle.LENIENT) { - PROLEPTIC_MONTH.checkValidValue(pMonth); - } - // first day-of-month is likely to be safest for setting proleptic-month - // cannot add to year zero, as not all chronologies have a year zero - ChronoLocalDate chronoDate = dateNow() - .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth); - addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR)); - addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR)); - } - } - - ChronoLocalDate resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { - Long yoeLong = fieldValues.remove(YEAR_OF_ERA); - if (yoeLong != null) { - Long eraLong = fieldValues.remove(ERA); - int yoe; - if (resolverStyle != ResolverStyle.LENIENT) { - yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA); - } else { - yoe = Math.toIntExact(yoeLong); - } - if (eraLong != null) { - Era eraObj = eraOf(range(ERA).checkValidIntValue(eraLong, ERA)); - addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); - } else { - if (fieldValues.containsKey(YEAR)) { - int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR); - ChronoLocalDate chronoDate = dateYearDay(year, 1); - addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe)); - } else if (resolverStyle == ResolverStyle.STRICT) { - // do not invent era if strict - // reinstate the field removed earlier, no cross-check issues - fieldValues.put(YEAR_OF_ERA, yoeLong); - } else { - List eras = eras(); - if (eras.isEmpty()) { - addFieldValue(fieldValues, YEAR, yoe); - } else { - Era eraObj = eras.get(eras.size() - 1); - addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); - } - } - } - } else if (fieldValues.containsKey(ERA)) { - range(ERA).checkValidValue(fieldValues.get(ERA), ERA); // always validated - } - return null; - } - - ChronoLocalDate resolveYMD(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); - long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); - return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS); - } - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - ValueRange domRange = range(DAY_OF_MONTH); - int dom = domRange.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH); - if (resolverStyle == ResolverStyle.SMART) { // previous valid - try { - return date(y, moy, dom); - } catch (DateTimeException ex) { - return date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); - } - } - return date(y, moy, dom); - } - - ChronoLocalDate resolveYD(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); - return dateYearDay(y, 1).plus(days, DAYS); - } - int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR); - return dateYearDay(y, doy); // smart is same as strict - } - - ChronoLocalDate resolveYMAA(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); - long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1); - return date(y, 1, 1).plus(months, MONTHS).plus(weeks, WEEKS).plus(days, DAYS); - } - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); - int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH); - ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); - if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); - } - return date; - } - - ChronoLocalDate resolveYMAD(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); - long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); - return resolveAligned(date(y, 1, 1), months, weeks, dow); - } - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); - int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); - ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); - if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); - } - return date; - } - - ChronoLocalDate resolveYAA(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); - long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1); - return dateYearDay(y, 1).plus(weeks, WEEKS).plus(days, DAYS); - } - int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); - int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR); - ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); - if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); - } - return date; - } - - ChronoLocalDate resolveYAD(Map fieldValues, ResolverStyle resolverStyle) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - if (resolverStyle == ResolverStyle.LENIENT) { - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); - long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); - return resolveAligned(dateYearDay(y, 1), 0, weeks, dow); - } - int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); - int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); - ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); - if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); - } - return date; - } - - ChronoLocalDate resolveAligned(ChronoLocalDate base, long months, long weeks, long dow) { - ChronoLocalDate date = base.plus(months, MONTHS).plus(weeks, WEEKS); - if (dow > 7) { - date = date.plus((dow - 1) / 7, WEEKS); - dow = ((dow - 1) % 7) + 1; - } else if (dow < 1) { - date = date.plus(Math.subtractExact(dow, 7) / 7, WEEKS); - dow = ((dow + 6) % 7) + 1; - } - return date.with(nextOrSame(DayOfWeek.of((int) dow))); - } - - /** - * Adds a field-value pair to the map, checking for conflicts. - *

- * If the field is not already present, then the field-value pair is added to the map. - * If the field is already present and it has the same value as that specified, no action occurs. - * If the field is already present and it has a different value to that specified, then - * an exception is thrown. - * - * @param field the field to add, not null - * @param value the value to add, not null - * @throws DateTimeException if the field is already present with a different value - */ - void addFieldValue(Map fieldValues, ChronoField field, long value) { - Long old = fieldValues.get(field); // check first for better error message - if (old != null && old.longValue() != value) { - throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value); - } - fieldValues.put(field, value); - } + ChronoLocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle); //----------------------------------------------------------------------- /** @@ -1215,7 +699,7 @@ public abstract class Chronology implements Comparable { * @param days the number of years, may be negative * @return the period in terms of this chronology, not null */ - public ChronoPeriod period(int years, int months, int days) { + default ChronoPeriod period(int years, int months, int days) { return new ChronoPeriodImpl(this, years, months, days); } @@ -1226,107 +710,43 @@ public abstract class Chronology implements Comparable { * The comparison order first by the chronology ID string, then by any * additional information specific to the subclass. * It is "consistent with equals", as defined by {@link Comparable}. - *

- * The default implementation compares the chronology ID. - * Subclasses must compare any additional state that they store. * * @param other the other chronology to compare to, not null * @return the comparator value, negative if less, positive if greater */ @Override - public int compareTo(Chronology other) { - return getId().compareTo(other.getId()); - } + int compareTo(Chronology other); /** * Checks if this chronology is equal to another chronology. *

* The comparison is based on the entire state of the object. - *

- * The default implementation checks the type and calls {@link #compareTo(Chronology)}. * * @param obj the object to check, null returns false * @return true if this is equal to the other chronology */ @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Chronology) { - return compareTo((Chronology) obj) == 0; - } - return false; - } + boolean equals(Object obj); /** * A hash code for this chronology. *

- * The default implementation is based on the ID and class. - * Subclasses should add any additional state that they store. + * The hash code should be based on the entire state of the object. * * @return a suitable hash code */ @Override - public int hashCode() { - return getClass().hashCode() ^ getId().hashCode(); - } + int hashCode(); //----------------------------------------------------------------------- /** - * Outputs this chronology as a {@code String}, using the ID. + * Outputs this chronology as a {@code String}. + *

+ * The format should include the entire state of the object. * * @return a string representation of this chronology, not null */ @Override - public String toString() { - return getId(); - } - - //----------------------------------------------------------------------- - /** - * Writes the Chronology using a - * dedicated serialized form. - * @serialData - *

-     *  out.writeByte(1);  // identifies a Chronology
-     *  out.writeUTF(getId());
-     * 
- * - * @return the instance of {@code Ser}, not null - */ - Object writeReplace() { - return new Ser(Ser.CHRONO_TYPE, this); - } - - /** - * Defend against malicious streams. - * @return never - * @throws InvalidObjectException always - */ - private Object readResolve() throws InvalidObjectException { - throw new InvalidObjectException("Deserialization via serialization delegate"); - } - - /** - * Write the Chronology id to the stream. - * @param out the output stream - * @throws IOException on any error during the write - */ - void writeExternal(DataOutput out) throws IOException { - out.writeUTF(getId()); - } - - /** - * Reads the Chronology id and creates the Chronology. - * @param in the input stream - * @return the Chronology - * @throws IOException on errors during the read - * @throws DateTimeException if the Chronology cannot be returned - */ - static Chronology readExternal(DataInput in) throws IOException { - String id = in.readUTF(); - return Chronology.of(id); - } + String toString(); } diff --git a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java index 7d4485809c9..277b1010fe4 100644 --- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java +++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java @@ -214,7 +214,7 @@ import sun.util.logging.PlatformLogger; * * @since 1.8 */ -public final class HijrahChronology extends Chronology implements Serializable { +public final class HijrahChronology extends AbstractChronology implements Serializable { /** * The Hijrah Calendar id. @@ -308,8 +308,8 @@ public final class HijrahChronology extends Chronology implements Serializable { try { INSTANCE = new HijrahChronology("Hijrah-umalqura"); // Register it by its aliases - Chronology.registerChrono(INSTANCE, "Hijrah"); - Chronology.registerChrono(INSTANCE, "islamic"); + AbstractChronology.registerChrono(INSTANCE, "Hijrah"); + AbstractChronology.registerChrono(INSTANCE, "islamic"); } catch (DateTimeException ex) { // Absence of Hijrah calendar is fatal to initializing this class. PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono"); @@ -336,7 +336,7 @@ public final class HijrahChronology extends Chronology implements Serializable { try { // Create and register the variant HijrahChronology chrono = new HijrahChronology(id); - Chronology.registerChrono(chrono); + AbstractChronology.registerChrono(chrono); } catch (DateTimeException ex) { // Log error and continue PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono"); diff --git a/jdk/src/share/classes/java/time/chrono/IsoChronology.java b/jdk/src/share/classes/java/time/chrono/IsoChronology.java index 9638f6eea4f..eb71a1fe65c 100644 --- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java +++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java @@ -120,7 +120,7 @@ import java.util.Objects; * * @since 1.8 */ -public final class IsoChronology extends Chronology implements Serializable { +public final class IsoChronology extends AbstractChronology implements Serializable { /** * Singleton instance of the ISO chronology. diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java index b01707e63ab..09e5b692ef2 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java @@ -120,7 +120,7 @@ import sun.util.calendar.LocalGregorianCalendar; * * @since 1.8 */ -public final class JapaneseChronology extends Chronology implements Serializable { +public final class JapaneseChronology extends AbstractChronology implements Serializable { static final LocalGregorianCalendar JCAL = (LocalGregorianCalendar) CalendarSystem.forName("japanese"); diff --git a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java index db75a8645d6..af0be986c93 100644 --- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java +++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java @@ -105,7 +105,7 @@ import java.util.Map; * * @since 1.8 */ -public final class MinguoChronology extends Chronology implements Serializable { +public final class MinguoChronology extends AbstractChronology implements Serializable { /** * Singleton instance for the Minguo chronology. diff --git a/jdk/src/share/classes/java/time/chrono/Ser.java b/jdk/src/share/classes/java/time/chrono/Ser.java index 5a4e3c12623..317a7696497 100644 --- a/jdk/src/share/classes/java/time/chrono/Ser.java +++ b/jdk/src/share/classes/java/time/chrono/Ser.java @@ -161,7 +161,7 @@ final class Ser implements Externalizable { out.writeByte(type); switch (type) { case CHRONO_TYPE: - ((Chronology) object).writeExternal(out); + ((AbstractChronology) object).writeExternal(out); break; case CHRONO_LOCAL_DATE_TIME_TYPE: ((ChronoLocalDateTimeImpl) object).writeExternal(out); @@ -231,7 +231,7 @@ final class Ser implements Externalizable { private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException { switch (type) { - case CHRONO_TYPE: return Chronology.readExternal(in); + case CHRONO_TYPE: return AbstractChronology.readExternal(in); case CHRONO_LOCAL_DATE_TIME_TYPE: return ChronoLocalDateTimeImpl.readExternal(in); case CHRONO_ZONE_DATE_TIME_TYPE: return ChronoZonedDateTimeImpl.readExternal(in); case JAPANESE_DATE_TYPE: return JapaneseDate.readExternal(in); diff --git a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java index 4ffd15bfcc6..c41aa34c0f1 100644 --- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java +++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java @@ -106,7 +106,7 @@ import java.util.Map; * * @since 1.8 */ -public final class ThaiBuddhistChronology extends Chronology implements Serializable { +public final class ThaiBuddhistChronology extends AbstractChronology implements Serializable { /** * Singleton instance of the Buddhist chronology. diff --git a/jdk/test/java/time/tck/java/time/chrono/CopticChronology.java b/jdk/test/java/time/tck/java/time/chrono/CopticChronology.java index c111eed3658..c72b7370de8 100644 --- a/jdk/test/java/time/tck/java/time/chrono/CopticChronology.java +++ b/jdk/test/java/time/tck/java/time/chrono/CopticChronology.java @@ -59,13 +59,11 @@ package tck.java.time.chrono; import static java.time.temporal.ChronoField.EPOCH_DAY; import java.io.Serializable; - +import java.time.chrono.AbstractChronology; +import java.time.chrono.Era; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.time.temporal.ValueRange; -import java.time.chrono.Chronology; -import java.time.chrono.Era; - import java.util.Arrays; import java.util.List; import java.util.Locale; @@ -95,7 +93,7 @@ import java.util.Locale; *

Implementation notes

* This class is immutable and thread-safe. */ -public final class CopticChronology extends Chronology implements Serializable { +public final class CopticChronology extends AbstractChronology implements Serializable { /** * Singleton instance of the Coptic chronology. From 8379a071b6408db6a1089a3c079638719cf34acf Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Thu, 11 Jul 2013 12:59:03 -0400 Subject: [PATCH 035/983] 8016256: Make finalization final Add private methods to final methods check Reviewed-by: coleenp, acorn, ahgross --- hotspot/src/share/vm/classfile/classFileParser.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 65cd2333a9d..f764057f101 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -4481,9 +4481,8 @@ void ClassFileParser::check_final_method_override(instanceKlassHandle this_klass for (int index = 0; index < num_methods; index++) { Method* m = methods->at(index); - // skip private, static and methods - if ((!m->is_private()) && - (!m->is_static()) && + // skip static and methods + if ((!m->is_static()) && (m->name() != vmSymbols::object_initializer_name())) { Symbol* name = m->name(); From be5469fc716a7868f4ae4b705502dbb1bee0bc03 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Thu, 11 Jul 2013 13:32:36 -0700 Subject: [PATCH 036/983] 8014987: Augment serialization handling Reviewed-by: alanb, coffeys, skoivu --- .../classes/java/io/ObjectInputStream.java | 15 +++++++------- .../classes/java/io/ObjectOutputStream.java | 20 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/classes/java/io/ObjectInputStream.java b/jdk/src/share/classes/java/io/ObjectInputStream.java index ca0400539f9..0e41b08dc3e 100644 --- a/jdk/src/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java @@ -490,11 +490,12 @@ public class ObjectInputStream public void defaultReadObject() throws IOException, ClassNotFoundException { - if (curContext == null) { + SerialCallbackContext ctx = curContext; + if (ctx == null) { throw new NotActiveException("not in call to readObject"); } - Object curObj = curContext.getObj(); - ObjectStreamClass curDesc = curContext.getDesc(); + Object curObj = ctx.getObj(); + ObjectStreamClass curDesc = ctx.getDesc(); bin.setBlockDataMode(false); defaultReadFields(curObj, curDesc); bin.setBlockDataMode(true); @@ -528,11 +529,12 @@ public class ObjectInputStream public ObjectInputStream.GetField readFields() throws IOException, ClassNotFoundException { - if (curContext == null) { + SerialCallbackContext ctx = curContext; + if (ctx == null) { throw new NotActiveException("not in call to readObject"); } - Object curObj = curContext.getObj(); - ObjectStreamClass curDesc = curContext.getDesc(); + Object curObj = ctx.getObj(); + ObjectStreamClass curDesc = ctx.getDesc(); bin.setBlockDataMode(false); GetFieldImpl getField = new GetFieldImpl(curDesc); getField.readFields(); @@ -1967,7 +1969,6 @@ public class ObjectInputStream private void defaultReadFields(Object obj, ObjectStreamClass desc) throws IOException { - // REMIND: is isInstance check necessary? Class cl = desc.forClass(); if (cl != null && obj != null && !cl.isInstance(obj)) { throw new ClassCastException(); diff --git a/jdk/src/share/classes/java/io/ObjectOutputStream.java b/jdk/src/share/classes/java/io/ObjectOutputStream.java index f7a94bb0342..c99aeb9cd67 100644 --- a/jdk/src/share/classes/java/io/ObjectOutputStream.java +++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java @@ -430,11 +430,12 @@ public class ObjectOutputStream * OutputStream */ public void defaultWriteObject() throws IOException { - if ( curContext == null ) { + SerialCallbackContext ctx = curContext; + if (ctx == null) { throw new NotActiveException("not in call to writeObject"); } - Object curObj = curContext.getObj(); - ObjectStreamClass curDesc = curContext.getDesc(); + Object curObj = ctx.getObj(); + ObjectStreamClass curDesc = ctx.getDesc(); bout.setBlockDataMode(false); defaultWriteFields(curObj, curDesc); bout.setBlockDataMode(true); @@ -452,11 +453,12 @@ public class ObjectOutputStream */ public ObjectOutputStream.PutField putFields() throws IOException { if (curPut == null) { - if (curContext == null) { + SerialCallbackContext ctx = curContext; + if (ctx == null) { throw new NotActiveException("not in call to writeObject"); } - Object curObj = curContext.getObj(); - ObjectStreamClass curDesc = curContext.getDesc(); + Object curObj = ctx.getObj(); + ObjectStreamClass curDesc = ctx.getDesc(); curPut = new PutFieldImpl(curDesc); } return curPut; @@ -1516,7 +1518,11 @@ public class ObjectOutputStream private void defaultWriteFields(Object obj, ObjectStreamClass desc) throws IOException { - // REMIND: perform conservative isInstance check here? + Class cl = desc.forClass(); + if (cl != null && obj != null && !cl.isInstance(obj)) { + throw new ClassCastException(); + } + desc.checkDefaultSerialize(); int primDataSize = desc.getPrimDataSize(); From 79bda234fe58acb682b3be6ee3fa064d6fdcec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Borggr=C3=A9n-Franck?= Date: Mon, 15 Jul 2013 14:44:50 +0200 Subject: [PATCH 037/983] 8014349: (cl) Class.getDeclaredClass problematic in some class loader configurations Reviewed-by: mchung, ahgross, darcy --- jdk/src/share/classes/java/lang/Class.java | 18 +++++++++++++++++- jdk/src/share/native/java/lang/Class.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index df4d457367d..eb11681ac00 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -1221,9 +1221,25 @@ public final class Class implements java.io.Serializable, * type, or void,then this method returns null. * * @return the declaring class for this class + * @throws SecurityException + * If a security manager, s, is present and the caller's + * class loader is not the same as or an ancestor of the class + * loader for the declaring class and invocation of {@link + * SecurityManager#checkPackageAccess s.checkPackageAccess()} + * denies access to the package of the declaring class * @since JDK1.1 */ - public native Class getDeclaringClass(); + @CallerSensitive + public Class getDeclaringClass() throws SecurityException { + final Class candidate = getDeclaringClass0(); + + if (candidate != null) + candidate.checkPackageAccess( + ClassLoader.getClassLoader(Reflection.getCallerClass()), true); + return candidate; + } + + private native Class getDeclaringClass0(); /** diff --git a/jdk/src/share/native/java/lang/Class.c b/jdk/src/share/native/java/lang/Class.c index e53d3f73b79..b0ba34349d8 100644 --- a/jdk/src/share/native/java/lang/Class.c +++ b/jdk/src/share/native/java/lang/Class.c @@ -69,7 +69,7 @@ static JNINativeMethod methods[] = { {"getDeclaredConstructors0","(Z)[" CTR, (void *)&JVM_GetClassDeclaredConstructors}, {"getProtectionDomain0", "()" PD, (void *)&JVM_GetProtectionDomain}, {"getDeclaredClasses0", "()[" CLS, (void *)&JVM_GetDeclaredClasses}, - {"getDeclaringClass", "()" CLS, (void *)&JVM_GetDeclaringClass}, + {"getDeclaringClass0", "()" CLS, (void *)&JVM_GetDeclaringClass}, {"getGenericSignature0", "()" STR, (void *)&JVM_GetClassSignature}, {"getRawAnnotations", "()" BA, (void *)&JVM_GetClassAnnotations}, {"getConstantPool", "()" CPL, (void *)&JVM_GetClassConstantPool}, From 1f1524301201ef37f3180a9b9659eb45d598afa0 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 15 Jul 2013 20:24:39 -0700 Subject: [PATCH 038/983] 8017291: Cast Proxies Aside Reviewed-by: alanb, ahgross --- jdk/src/share/classes/java/lang/ClassLoader.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java index f26eafd980a..3735cd3a782 100644 --- a/jdk/src/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/share/classes/java/lang/ClassLoader.java @@ -57,6 +57,7 @@ import sun.misc.URLClassPath; import sun.misc.VM; import sun.reflect.CallerSensitive; import sun.reflect.Reflection; +import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; /** @@ -486,6 +487,13 @@ public abstract class ClassLoader { private void checkPackageAccess(Class cls, ProtectionDomain pd) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { + if (ReflectUtil.isNonPublicProxyClass(cls)) { + for (Class intf: cls.getInterfaces()) { + checkPackageAccess(intf, pd); + } + return; + } + final String name = cls.getName(); final int i = name.lastIndexOf('.'); if (i != -1) { From fb90cdbe873ae541008c71cbc04107b6b893a660 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 16 Jul 2013 21:11:54 +0400 Subject: [PATCH 039/983] 8019617: Better view of objects Reviewed-by: art, skoivu --- .../javax/swing/text/html/ObjectView.java | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java index 4e43cfb6d70..00d3a42c3a6 100644 --- a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java +++ b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java @@ -31,6 +31,9 @@ import javax.swing.text.*; import java.beans.*; import java.lang.reflect.*; +import sun.reflect.misc.MethodUtil; +import sun.reflect.misc.ReflectUtil; + /** * Component decorator that implements the view interface * for <object> elements. @@ -87,6 +90,7 @@ public class ObjectView extends ComponentView { AttributeSet attr = getElement().getAttributes(); String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID); try { + ReflectUtil.checkPackageAccess(classname); Class c = Class.forName(classname, true,Thread.currentThread(). getContextClassLoader()); Object o = c.newInstance(); @@ -115,28 +119,6 @@ public class ObjectView extends ComponentView { return comp; } - /** - * Get a Class object to use for loading the - * classid. If possible, the Classloader - * used to load the associated Document is used. - * This would typically be the same as the ClassLoader - * used to load the EditorKit. If the documents - * ClassLoader is null, - * Class.forName is used. - */ - private Class getClass(String classname) throws ClassNotFoundException { - Class klass; - - Class docClass = getDocument().getClass(); - ClassLoader loader = docClass.getClassLoader(); - if (loader != null) { - klass = loader.loadClass(classname); - } else { - klass = Class.forName(classname); - } - return klass; - } - /** * Initialize this component according the KEY/VALUEs passed in * via the <param> elements in the corresponding @@ -170,7 +152,7 @@ public class ObjectView extends ComponentView { } Object [] args = { value }; try { - writer.invoke(comp, args); + MethodUtil.invoke(writer, comp, args); } catch (Exception ex) { System.err.println("Invocation failed"); // invocation code From b9c256373a815672c9c560483097de86ddfacebe Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Tue, 16 Jul 2013 14:06:04 -0700 Subject: [PATCH 040/983] 8012425: Transform TransformerFactory Reviewed-by: alanb, dfuchs, mullan --- .../internal/xsltc/trax/TransformerImpl.java | 2 + .../xalan/internal/xsltc/trax/Util.java | 7 ++ .../validation/StreamValidatorHelper.java | 35 +++--- .../jaxp/validation/ValidatorHandlerImpl.java | 2 + .../internal/parsers/AbstractSAXParser.java | 37 +++--- .../internal/parsers/XML11Configuration.java | 111 +++++++++--------- .../xml/internal/utils/XMLReaderManager.java | 20 +++- 7 files changed, 122 insertions(+), 92 deletions(-) diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java index 63446e734e2..7c33c91a8c8 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java @@ -271,6 +271,7 @@ public final class TransformerImpl extends Transformer _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD); _readerManager = XMLReaderManager.getInstance(_useServicesMechanism); _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); + _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing); //_isIncremental = tfactory._incremental; } @@ -286,6 +287,7 @@ public final class TransformerImpl extends Transformer */ public void setSecureProcessing(boolean flag) { _isSecureProcessing = flag; + _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing); } /** * Return the state of the services mechanism feature. diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java index 25c45c04be9..b287a351db4 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java @@ -105,6 +105,13 @@ public final class Util { if (reader == null) { try { reader= XMLReaderFactory.createXMLReader(); + try { + reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, + xsltc.isSecureProcessing()); + } catch (SAXNotRecognizedException e) { + System.err.println("Warning: " + reader.getClass().getName() + ": " + + e.getMessage()); + } } catch (Exception e ) { try { diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java index 1b4f6875611..95fe7d8d8ec 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java @@ -20,28 +20,27 @@ package com.sun.org.apache.xerces.internal.jaxp.validation; -import java.lang.ref.SoftReference; -import java.io.IOException; - -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; -import javax.xml.transform.stream.StreamSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.XMLConstants; - import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.parsers.XML11Configuration; +import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; +import java.io.IOException; +import java.lang.ref.SoftReference; +import javax.xml.XMLConstants; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; import org.xml.sax.SAXException; /** @@ -86,6 +85,11 @@ final class StreamValidatorHelper implements ValidatorHelper { Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY; private static final String DEFAULT_TRANSFORMER_IMPL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"; + + /** Property id: security manager. */ + private static final String SECURITY_MANAGER = + Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; + // // Data // @@ -165,6 +169,9 @@ final class StreamValidatorHelper implements ValidatorHelper { private XMLParserConfiguration initialize() { XML11Configuration config = new XML11Configuration(); + if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) { + config.setProperty(SECURITY_MANAGER, new SecurityManager()); + } config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER)); config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER)); XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java index 3f493517209..2c3a9842c5e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java @@ -674,6 +674,8 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements SAXParserFactory.newInstance() : new SAXParserFactoryImpl(); spf.setNamespaceAware(true); try { + spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, + fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); reader = spf.newSAXParser().getXMLReader(); // If this is a Xerces SAX parser, set the security manager if there is one if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) { diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java index 726f31e76b5..53ad2a6b605 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java @@ -20,16 +20,13 @@ package com.sun.org.apache.xerces.internal.parsers; -import java.io.IOException; -import java.util.Locale; - import com.sun.org.apache.xerces.internal.impl.Constants; -import com.sun.org.apache.xerces.internal.util.Status; -import com.sun.org.apache.xerces.internal.xs.PSVIProvider; -import com.sun.org.apache.xerces.internal.util.EntityResolverWrapper; import com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper; +import com.sun.org.apache.xerces.internal.util.EntityResolverWrapper; import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; +import com.sun.org.apache.xerces.internal.util.SecurityManager; +import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolHash; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.xni.Augmentations; @@ -48,15 +45,17 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; import com.sun.org.apache.xerces.internal.xs.AttributePSVI; import com.sun.org.apache.xerces.internal.xs.ElementPSVI; +import com.sun.org.apache.xerces.internal.xs.PSVIProvider; +import java.io.IOException; +import java.util.Locale; +import javax.xml.XMLConstants; import org.xml.sax.AttributeList; -import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.DocumentHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; -import org.xml.sax.Locator; import org.xml.sax.Parser; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; @@ -131,6 +130,10 @@ public abstract class AbstractSAXParser protected static final String DOM_NODE = Constants.SAX_PROPERTY_PREFIX + Constants.DOM_NODE_PROPERTY; + /** Property id: security manager. */ + private static final String SECURITY_MANAGER = + Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; + /** Recognized properties. */ private static final String[] RECOGNIZED_PROPERTIES = { LEXICAL_HANDLER, @@ -1645,19 +1648,13 @@ public abstract class AbstractSAXParser // Drop through and perform default processing // } - - // - // Xerces Features - // - - /* - else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) { - String feature = featureId.substring(XERCES_FEATURES_PREFIX.length()); - // - // Drop through and perform default processing - // + else if (featureId.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { + if (state) { + if (fConfiguration.getProperty(SECURITY_MANAGER )==null) { + fConfiguration.setProperty(SECURITY_MANAGER, new SecurityManager()); + } + } } - */ // // Default handling diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java index 32ac6a86d78..b33a5f4093e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java @@ -20,14 +20,6 @@ package com.sun.org.apache.xerces.internal.parsers; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Locale; -import java.util.Properties; -import javax.xml.XMLConstants; - import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl; import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl; @@ -53,7 +45,6 @@ import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter; import com.sun.org.apache.xerces.internal.util.FeatureState; import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; import com.sun.org.apache.xerces.internal.util.PropertyState; -import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; @@ -72,6 +63,11 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; +import javax.xml.XMLConstants; /** * This class is the configuration used to parse XML 1.0 and XML 1.1 documents. @@ -453,26 +449,26 @@ public class XML11Configuration extends ParserConfigurationSettings XMLGrammarPool grammarPool, XMLComponentManager parentSettings) { - super(parentSettings); + super(parentSettings); - // create a vector to hold all the components in use - // XML 1.0 specialized components - fComponents = new ArrayList(); - // XML 1.1 specialized components - fXML11Components = new ArrayList(); - // Common components for XML 1.1. and XML 1.0 - fCommonComponents = new ArrayList(); + // create a vector to hold all the components in use + // XML 1.0 specialized components + fComponents = new ArrayList(); + // XML 1.1 specialized components + fXML11Components = new ArrayList(); + // Common components for XML 1.1. and XML 1.0 + fCommonComponents = new ArrayList(); - // create table for features and properties - fFeatures = new HashMap(); - fProperties = new HashMap(); + // create table for features and properties + fFeatures = new HashMap(); + fProperties = new HashMap(); // add default recognized features final String[] recognizedFeatures = { CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl - VALIDATION, - NAMESPACES, + VALIDATION, + NAMESPACES, NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI, GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS, HONOUR_ALL_SCHEMALOCATIONS, NAMESPACE_GROWTH, @@ -483,47 +479,48 @@ public class XML11Configuration extends ParserConfigurationSettings // features might not have been set and it would cause a // not-recognized exception to be thrown. -Ac XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING, - EXTERNAL_GENERAL_ENTITIES, - EXTERNAL_PARAMETER_ENTITIES, - PARSER_SETTINGS, - XMLConstants.FEATURE_SECURE_PROCESSING + EXTERNAL_GENERAL_ENTITIES, + EXTERNAL_PARAMETER_ENTITIES, + PARSER_SETTINGS, + XMLConstants.FEATURE_SECURE_PROCESSING }; + addRecognizedFeatures(recognizedFeatures); - // set state for default features - fFeatures.put(VALIDATION, Boolean.FALSE); - fFeatures.put(NAMESPACES, Boolean.TRUE); - fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE); - fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE); - fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE); - fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE); - fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE); - fFeatures.put(NORMALIZE_DATA, Boolean.TRUE); - fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE); - fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE); - fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE); - fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE); - fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE); - fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE); - fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE); - fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); - fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); + // set state for default features + fFeatures.put(VALIDATION, Boolean.FALSE); + fFeatures.put(NAMESPACES, Boolean.TRUE); + fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE); + fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE); + fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE); + fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE); + fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE); + fFeatures.put(NORMALIZE_DATA, Boolean.TRUE); + fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE); + fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE); + fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE); + fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE); + fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE); + fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE); + fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE); + fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); + fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); // add default recognized properties final String[] recognizedProperties = { - SYMBOL_TABLE, - ERROR_HANDLER, - ENTITY_RESOLVER, + SYMBOL_TABLE, + ERROR_HANDLER, + ENTITY_RESOLVER, ERROR_REPORTER, ENTITY_MANAGER, DOCUMENT_SCANNER, DTD_SCANNER, DTD_PROCESSOR, DTD_VALIDATOR, - DATATYPE_VALIDATOR_FACTORY, - VALIDATION_MANAGER, - SCHEMA_VALIDATOR, - XML_STRING, + DATATYPE_VALIDATOR_FACTORY, + VALIDATION_MANAGER, + SCHEMA_VALIDATOR, + XML_STRING, XMLGRAMMAR_POOL, JAXP_SCHEMA_SOURCE, JAXP_SCHEMA_LANGUAGE, @@ -540,15 +537,15 @@ public class XML11Configuration extends ParserConfigurationSettings }; addRecognizedProperties(recognizedProperties); - if (symbolTable == null) { - symbolTable = new SymbolTable(); - } - fSymbolTable = symbolTable; - fProperties.put(SYMBOL_TABLE, fSymbolTable); + if (symbolTable == null) { + symbolTable = new SymbolTable(); + } + fSymbolTable = symbolTable; + fProperties.put(SYMBOL_TABLE, fSymbolTable); fGrammarPool = grammarPool; if (fGrammarPool != null) { - fProperties.put(XMLGRAMMAR_POOL, fGrammarPool); + fProperties.put(XMLGRAMMAR_POOL, fGrammarPool); } fEntityManager = new XMLEntityManager(); diff --git a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java index 28002037272..279ac53a71f 100644 --- a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java +++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java @@ -26,11 +26,13 @@ import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import java.util.HashMap; + import javax.xml.XMLConstants; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; @@ -63,6 +65,8 @@ public class XMLReaderManager { private HashMap m_inUse; private boolean m_useServicesMechanism = true; + + private boolean _secureProcessing; /** * protocols allowed for external DTD references in source file and/or stylesheet. */ @@ -118,7 +122,12 @@ public class XMLReaderManager { // TransformerFactory creates a reader via the // XMLReaderFactory if setXMLReader is not used reader = XMLReaderFactory.createXMLReader(); - + try { + reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _secureProcessing); + } catch (SAXNotRecognizedException e) { + System.err.println("Warning: " + reader.getClass().getName() + ": " + + e.getMessage()); + } } catch (Exception e) { try { // If unable to create an instance, let's try to use @@ -192,6 +201,15 @@ public class XMLReaderManager { m_useServicesMechanism = flag; } + /** + * Set feature + */ + public void setFeature(String name, boolean value) { + if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { + _secureProcessing = value; + } + } + /** * Get property value */ From a775b1ae8d7146b5e0ac513000884a4ecf680a58 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 18 Jul 2013 18:52:14 +0100 Subject: [PATCH 041/983] 8015743: Address internet addresses Reviewed-by: alanb, khazra, skoivu --- .../share/classes/java/net/Inet6Address.java | 496 +++++++++++------- .../share/classes/java/net/InetAddress.java | 9 +- jdk/src/share/native/java/net/Inet6Address.c | 15 +- jdk/src/share/native/java/net/net_util.c | 105 +++- jdk/src/share/native/java/net/net_util.h | 15 +- .../native/java/net/Inet6AddressImpl.c | 15 +- .../native/java/net/NetworkInterface.c | 18 +- .../native/java/net/PlainDatagramSocketImpl.c | 3 +- jdk/src/solaris/native/java/net/net_util_md.c | 8 +- .../native/java/net/Inet6AddressImpl.c | 16 +- .../native/java/net/NetworkInterface.c | 16 +- .../native/java/net/NetworkInterface_winXP.c | 12 +- .../java/net/TwoStacksPlainSocketImpl.c | 11 +- jdk/src/windows/native/java/net/net_util_md.c | 6 +- .../net/Inet6Address/serialize/Serialize.java | 181 ++++++- 15 files changed, 657 insertions(+), 269 deletions(-) diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java index 4a2d4e22473..8892631bb30 100644 --- a/jdk/src/share/classes/java/net/Inet6Address.java +++ b/jdk/src/share/classes/java/net/Inet6Address.java @@ -28,7 +28,10 @@ package java.net; import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamField; import java.util.Enumeration; +import java.util.Arrays; /** * This class represents an Internet Protocol version 6 (IPv6) address. @@ -177,37 +180,192 @@ class Inet6Address extends InetAddress { */ private transient int cached_scope_id; // 0 - /** - * Holds a 128-bit (16 bytes) IPv6 address. - * - * @serial - */ - byte[] ipaddress; + private class Inet6AddressHolder { - /** - * scope_id. The scope specified when the object is created. If the object - * is created with an interface name, then the scope_id is not determined - * until the time it is needed. - */ - private int scope_id; // 0 + private Inet6AddressHolder() { + ipaddress = new byte[INADDRSZ]; + } - /** - * This will be set to true when the scope_id field contains a valid - * integer scope_id. - */ - private boolean scope_id_set; // false + private Inet6AddressHolder( + byte[] ipaddress, int scope_id, boolean scope_id_set, + NetworkInterface ifname, boolean scope_ifname_set) + { + this.ipaddress = ipaddress; + this.scope_id = scope_id; + this.scope_id_set = scope_id_set; + this.scope_ifname_set = scope_ifname_set; + this.scope_ifname = ifname; + } - /** - * scoped interface. scope_id is derived from this as the scope_id of the first - * address whose scope is the same as this address for the named interface. - */ - private transient NetworkInterface scope_ifname; // null + /** + * Holds a 128-bit (16 bytes) IPv6 address. + */ + byte[] ipaddress; - /** - * set if the object is constructed with a scoped - * interface instead of a numeric scope id. - */ - private boolean scope_ifname_set; // false; + /** + * scope_id. The scope specified when the object is created. If the object + * is created with an interface name, then the scope_id is not determined + * until the time it is needed. + */ + int scope_id; // 0 + + /** + * This will be set to true when the scope_id field contains a valid + * integer scope_id. + */ + boolean scope_id_set; // false + + /** + * scoped interface. scope_id is derived from this as the scope_id of the first + * address whose scope is the same as this address for the named interface. + */ + NetworkInterface scope_ifname; // null + + /** + * set if the object is constructed with a scoped + * interface instead of a numeric scope id. + */ + boolean scope_ifname_set; // false; + + void setAddr(byte addr[]) { + if (addr.length == INADDRSZ) { // normal IPv6 address + System.arraycopy(addr, 0, ipaddress, 0, INADDRSZ); + } + } + + void init(byte addr[], int scope_id) { + setAddr(addr); + + if (scope_id >= 0) { + this.scope_id = scope_id; + this.scope_id_set = true; + } + } + + void init(byte addr[], NetworkInterface nif) + throws UnknownHostException + { + setAddr(addr); + + if (nif != null) { + this.scope_id = deriveNumericScope(ipaddress, nif); + this.scope_id_set = true; + this.scope_ifname = nif; + this.scope_ifname_set = true; + } + } + + String getHostAddress() { + String s = numericToTextFormat(ipaddress); + if (scope_ifname != null) { /* must check this first */ + s = s + "%" + scope_ifname.getName(); + } else if (scope_id_set) { + s = s + "%" + scope_id; + } + return s; + } + + public boolean equals(Object o) { + if (! (o instanceof Inet6AddressHolder)) { + return false; + } + Inet6AddressHolder that = (Inet6AddressHolder)o; + + return Arrays.equals(this.ipaddress, that.ipaddress); + } + + public int hashCode() { + if (ipaddress != null) { + + int hash = 0; + int i=0; + while (i= 0, or -1 to indicate not being set */ Inet6Address(String hostName, byte addr[], int scope_id) { - holder().hostName = hostName; - if (addr.length == INADDRSZ) { // normal IPv6 address - holder().family = IPv6; - ipaddress = addr.clone(); - } - if (scope_id >= 0) { - this.scope_id = scope_id; - scope_id_set = true; - } + holder.init(hostName, IPv6); + holder6 = new Inet6AddressHolder(); + holder6.init(addr, scope_id); } Inet6Address(String hostName, byte addr[]) { + holder6 = new Inet6AddressHolder(); try { initif (hostName, addr, null); } catch (UnknownHostException e) {} /* cant happen if ifname is null */ @@ -245,12 +397,14 @@ class Inet6Address extends InetAddress { Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException { + holder6 = new Inet6AddressHolder(); initif (hostName, addr, nif); } Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException { + holder6 = new Inet6AddressHolder(); initstr (hostName, addr, ifname); } @@ -341,17 +495,13 @@ class Inet6Address extends InetAddress { private void initif(String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException { - holder().hostName = hostName; + int family = -1; + holder6.init(addr, nif); + if (addr.length == INADDRSZ) { // normal IPv6 address - holder().family = IPv6; - ipaddress = addr.clone(); - } - if (nif != null) { - scope_ifname = nif; - scope_id = deriveNumericScope(nif); - scope_id_set = true; - scope_ifname_set = true; // for consistency + family = IPv6; } + holder.init(hostName, family); } /* check the two Ipv6 addresses and return false if they are both @@ -359,17 +509,22 @@ class Inet6Address extends InetAddress { * (ie. one is sitelocal and the other linklocal) * return true otherwise. */ - private boolean differentLocalAddressTypes(Inet6Address other) { - if (isLinkLocalAddress() && !other.isLinkLocalAddress()) + + private static boolean isDifferentLocalAddressType( + byte[] thisAddr, byte[] otherAddr) { + + if (Inet6Address.isLinkLocalAddress(thisAddr) && + !Inet6Address.isLinkLocalAddress(otherAddr)) { return false; - if (isSiteLocalAddress() && !other.isSiteLocalAddress()) + } + if (Inet6Address.isSiteLocalAddress(thisAddr) && + !Inet6Address.isSiteLocalAddress(otherAddr)) { return false; + } return true; } - private int deriveNumericScope(NetworkInterface ifc) - throws UnknownHostException - { + private static int deriveNumericScope (byte[] thisAddr, NetworkInterface ifc) throws UnknownHostException { Enumeration addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -378,46 +533,60 @@ class Inet6Address extends InetAddress { } Inet6Address ia6_addr = (Inet6Address)addr; /* check if site or link local prefixes match */ - if (!differentLocalAddressTypes(ia6_addr)){ + if (!isDifferentLocalAddressType(thisAddr, ia6_addr.getAddress())){ /* type not the same, so carry on searching */ continue; } /* found a matching address - return its scope_id */ - return ia6_addr.scope_id; + return ia6_addr.getScopeId(); } throw new UnknownHostException ("no scope_id found"); } - private int deriveNumericScope(String ifname) throws UnknownHostException { + private int deriveNumericScope (String ifname) throws UnknownHostException { Enumeration en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { - throw new UnknownHostException( - "could not enumerate local network interfaces"); + throw new UnknownHostException ("could not enumerate local network interfaces"); } while (en.hasMoreElements()) { NetworkInterface ifc = en.nextElement(); - if (ifc.getName().equals(ifname)) { - Enumeration addresses = ifc.getInetAddresses(); - while (addresses.hasMoreElements()) { - InetAddress addr = addresses.nextElement(); - if (!(addr instanceof Inet6Address)) { - continue; - } - Inet6Address ia6_addr = (Inet6Address)addr; - /* check if site or link local prefixes match */ - if (!differentLocalAddressTypes(ia6_addr)){ - /* type not the same, so carry on searching */ - continue; - } - /* found a matching address - return its scope_id */ - return ia6_addr.scope_id; - } + if (ifc.getName().equals (ifname)) { + return deriveNumericScope(holder6.ipaddress, ifc); } } - throw new UnknownHostException( - "No matching address found for interface : " +ifname); + throw new UnknownHostException ("No matching address found for interface : " +ifname); + } + + /** + * @serialField ipaddress byte[] + * @serialField scope_id int + * @serialField scope_id_set boolean + * @serialField scope_ifname_set boolean + * @serialField ifname String + */ + + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("ipaddress", byte[].class), + new ObjectStreamField("scope_id", int.class), + new ObjectStreamField("scope_id_set", boolean.class), + new ObjectStreamField("scope_ifname_set", boolean.class), + new ObjectStreamField("ifname", String.class) + }; + + private static final long FIELDS_OFFSET; + private static final sun.misc.Unsafe UNSAFE; + + static { + try { + sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe(); + FIELDS_OFFSET = unsafe.objectFieldOffset( + Inet6Address.class.getDeclaredField("holder6")); + UNSAFE = unsafe; + } catch (ReflectiveOperationException e) { + throw new Error(e); + } } /** @@ -427,35 +596,41 @@ class Inet6Address extends InetAddress { */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { + NetworkInterface scope_ifname = null; if (getClass().getClassLoader() != null) { throw new SecurityException ("invalid address type"); } - s.defaultReadObject(); + ObjectInputStream.GetField gf = s.readFields(); + byte[] ipaddress = (byte[])gf.get("ipaddress", null); + int scope_id = (int)gf.get("scope_id", -1); + boolean scope_id_set = (boolean)gf.get("scope_id_set", false); + boolean scope_ifname_set = (boolean)gf.get("scope_ifname_set", false); + String ifname = (String)gf.get("ifname", null); - if (ifname != null && !ifname.equals("")) { + if (ifname != null && !"".equals (ifname)) { try { scope_ifname = NetworkInterface.getByName(ifname); - if (scope_ifname != null) { - scope_ifname_set = true; - try { - scope_id = deriveNumericScope(scope_ifname); - } catch (UnknownHostException e) { - // typically should not happen, but it may be that - // the machine being used for deserialization has - // the same interface name but without IPv6 configured. - } - } else { + if (scope_ifname == null) { /* the interface does not exist on this system, so we clear * the scope information completely */ scope_id_set = false; scope_ifname_set = false; scope_id = 0; + } else { + scope_ifname_set = true; + try { + scope_id = deriveNumericScope (ipaddress, scope_ifname); + } catch (UnknownHostException e) { + // typically should not happen, but it may be that + // the machine being used for deserialization has + // the same interface name but without IPv6 configured. + } } } catch (SocketException e) {} - } + /* if ifname was not supplied, then the numeric info is used */ ipaddress = ipaddress.clone(); @@ -466,9 +641,38 @@ class Inet6Address extends InetAddress { ipaddress.length); } - if (holder().getFamily() != IPv6) { + if (holder.getFamily() != IPv6) { throw new InvalidObjectException("invalid address family type"); } + + Inet6AddressHolder h = new Inet6AddressHolder( + ipaddress, scope_id, scope_id_set, scope_ifname, scope_ifname_set + ); + + UNSAFE.putObject(this, FIELDS_OFFSET, h); + } + + /** + * default behavior is overridden in order to write the + * scope_ifname field as a String, rather than a NetworkInterface + * which is not serializable + */ + private synchronized void writeObject(ObjectOutputStream s) + throws IOException + { + String ifname = null; + + if (holder6.scope_ifname != null) { + ifname = holder6.scope_ifname.getName(); + holder6.scope_ifname_set = true; + } + ObjectOutputStream.PutField pfields = s.putFields(); + pfields.put("ipaddress", holder6.ipaddress); + pfields.put("scope_id", holder6.scope_id); + pfields.put("scope_id_set", holder6.scope_id_set); + pfields.put("scope_ifname_set", holder6.scope_ifname_set); + pfields.put("ifname", ifname); + s.writeFields(); } /** @@ -483,7 +687,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMulticastAddress() { - return ((ipaddress[0] & 0xff) == 0xff); + return holder6.isMulticastAddress(); } /** @@ -496,11 +700,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isAnyLocalAddress() { - byte test = 0x00; - for (int i = 0; i < INADDRSZ; i++) { - test |= ipaddress[i]; - } - return (test == 0x00); + return holder6.isAnyLocalAddress(); } /** @@ -513,11 +713,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isLoopbackAddress() { - byte test = 0x00; - for (int i = 0; i < 15; i++) { - test |= ipaddress[i]; - } - return (test == 0x00) && (ipaddress[15] == 0x01); + return holder6.isLoopbackAddress(); } /** @@ -530,6 +726,11 @@ class Inet6Address extends InetAddress { */ @Override public boolean isLinkLocalAddress() { + return holder6.isLinkLocalAddress(); + } + + /* static version of above */ + static boolean isLinkLocalAddress(byte[] ipaddress) { return ((ipaddress[0] & 0xff) == 0xfe && (ipaddress[1] & 0xc0) == 0x80); } @@ -544,6 +745,11 @@ class Inet6Address extends InetAddress { */ @Override public boolean isSiteLocalAddress() { + return holder6.isSiteLocalAddress(); + } + + /* static version of above */ + static boolean isSiteLocalAddress(byte[] ipaddress) { return ((ipaddress[0] & 0xff) == 0xfe && (ipaddress[1] & 0xc0) == 0xc0); } @@ -559,8 +765,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMCGlobal() { - return ((ipaddress[0] & 0xff) == 0xff - && (ipaddress[1] & 0x0f) == 0x0e); + return holder6.isMCGlobal(); } /** @@ -574,8 +779,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMCNodeLocal() { - return ((ipaddress[0] & 0xff) == 0xff - && (ipaddress[1] & 0x0f) == 0x01); + return holder6.isMCNodeLocal(); } /** @@ -589,8 +793,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMCLinkLocal() { - return ((ipaddress[0] & 0xff) == 0xff - && (ipaddress[1] & 0x0f) == 0x02); + return holder6.isMCLinkLocal(); } /** @@ -604,8 +807,7 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMCSiteLocal() { - return ((ipaddress[0] & 0xff) == 0xff - && (ipaddress[1] & 0x0f) == 0x05); + return holder6.isMCSiteLocal(); } /** @@ -619,10 +821,8 @@ class Inet6Address extends InetAddress { */ @Override public boolean isMCOrgLocal() { - return ((ipaddress[0] & 0xff) == 0xff - && (ipaddress[1] & 0x0f) == 0x08); + return holder6.isMCOrgLocal(); } - /** * Returns the raw IP address of this {@code InetAddress} object. The result * is in network byte order: the highest order byte of the address is in @@ -632,7 +832,7 @@ class Inet6Address extends InetAddress { */ @Override public byte[] getAddress() { - return ipaddress.clone(); + return holder6.ipaddress.clone(); } /** @@ -644,7 +844,7 @@ class Inet6Address extends InetAddress { * @since 1.5 */ public int getScopeId() { - return scope_id; + return holder6.scope_id; } /** @@ -655,7 +855,7 @@ class Inet6Address extends InetAddress { * @since 1.5 */ public NetworkInterface getScopedInterface() { - return scope_ifname; + return holder6.scope_ifname; } /** @@ -669,13 +869,7 @@ class Inet6Address extends InetAddress { */ @Override public String getHostAddress() { - String s = numericToTextFormat(ipaddress); - if (scope_ifname != null) { /* must check this first */ - s = s + "%" + scope_ifname.getName(); - } else if (scope_id_set) { - s = s + "%" + scope_id; - } - return s; + return holder6.getHostAddress(); } /** @@ -685,25 +879,7 @@ class Inet6Address extends InetAddress { */ @Override public int hashCode() { - if (ipaddress != null) { - - int hash = 0; - int i=0; - while (iFindClass(env, "java/net/Inet6Address"); CHECK_NULL(c); ia6_class = (*env)->NewGlobalRef(env, c); CHECK_NULL(ia6_class); - ia6_ipaddressID = (*env)->GetFieldID(env, ia6_class, "ipaddress", "[B"); + ia6h_class = (*env)->FindClass(env, "java/net/Inet6Address$Inet6AddressHolder"); + CHECK_NULL(ia6h_class); + ia6_holder6ID = (*env)->GetFieldID(env, ia6_class, "holder6", "Ljava/net/Inet6Address$Inet6AddressHolder;"); + CHECK_NULL(ia6_holder6ID); + ia6_ipaddressID = (*env)->GetFieldID(env, ia6h_class, "ipaddress", "[B"); CHECK_NULL(ia6_ipaddressID); - ia6_scopeidID = (*env)->GetFieldID(env, ia6_class, "scope_id", "I"); + ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I"); CHECK_NULL(ia6_scopeidID); ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I"); CHECK_NULL(ia6_cachedscopeidID); - ia6_scopeidsetID = (*env)->GetFieldID(env, ia6_class, "scope_id_set", "Z"); + ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z"); CHECK_NULL(ia6_scopeidID); - ia6_scopeifnameID = (*env)->GetFieldID(env, ia6_class, "scope_ifname", "Ljava/net/NetworkInterface;"); + ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;"); CHECK_NULL(ia6_scopeifnameID); ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "", "()V"); CHECK_NULL(ia6_ctrID); diff --git a/jdk/src/share/native/java/net/net_util.c b/jdk/src/share/native/java/net/net_util.c index 5d15f9d9b0e..d52577ce25b 100644 --- a/jdk/src/share/native/java/net/net_util.c +++ b/jdk/src/share/native/java/net/net_util.c @@ -94,6 +94,92 @@ extern jfieldID ia_holderID; extern jfieldID iac_addressID; extern jfieldID iac_familyID; +/** + * set_ methods return JNI_TRUE on success JNI_FALSE on error + * get_ methods that return +ve int return -1 on error + * get_ methods that return objects return NULL on error. + */ +jobject getInet6Address_scopeifname(JNIEnv *env, jobject iaObj) { + jobject holder; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, NULL); + return (*env)->GetObjectField(env, holder, ia6_scopeifnameID); +} + +int setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) { + jobject holder; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, JNI_FALSE); + (*env)->SetObjectField(env, holder, ia6_scopeifnameID, scopeifname); + return JNI_TRUE; +} + +int getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) { + jobject holder; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, -1); + return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID); +} + +int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) { + jobject holder; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, -1); + return (*env)->GetIntField(env, holder, ia6_scopeidID); +} + +int setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) { + jobject holder; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, JNI_FALSE); + (*env)->SetIntField(env, holder, ia6_scopeidID, scopeid); + if (scopeid > 0) { + (*env)->SetBooleanField(env, holder, ia6_scopeidsetID, JNI_TRUE); + } + return JNI_TRUE; +} + + +int getInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *dest) { + jobject holder, addr; + jbyteArray barr; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, JNI_FALSE); + addr = (*env)->GetObjectField(env, holder, ia6_ipaddressID); + CHECK_NULL_RETURN(addr, JNI_FALSE); + (*env)->GetByteArrayRegion(env, addr, 0, 16, (jbyte *)dest); + return JNI_TRUE; +} + +int setInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *address) { + jobject holder; + jbyteArray addr; + + init(env); + holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); + CHECK_NULL_RETURN(holder, JNI_FALSE); + addr = (jbyteArray)(*env)->GetObjectField(env, holder, ia6_ipaddressID); + if (addr == NULL) { + addr = (*env)->NewByteArray(env, 16); + CHECK_NULL_RETURN(addr, JNI_FALSE); + (*env)->SetObjectField(env, holder, ia6_ipaddressID, addr); + } + (*env)->SetByteArrayRegion(env, addr, 0, 16, (jbyte *)address); + return JNI_TRUE; +} + void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) { jobject holder; init(env); @@ -167,6 +253,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) { } else { static jclass inet6Cls = 0; jint scope; + int ret; if (inet6Cls == 0) { jclass c = (*env)->FindClass(env, "java/net/Inet6Address"); CHECK_NULL_RETURN(c, NULL); @@ -176,18 +263,11 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) { } iaObj = (*env)->NewObject(env, inet6Cls, ia6_ctrID); CHECK_NULL_RETURN(iaObj, NULL); - ipaddress = (*env)->NewByteArray(env, 16); - CHECK_NULL_RETURN(ipaddress, NULL); - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(him6->sin6_addr)); - - (*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress); - + ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr)); + CHECK_NULL_RETURN(ret, NULL); setInetAddress_family(env, iaObj, IPv6); scope = getScopeID(him); - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - if (scope > 0) - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); + setInet6Address_scopeid(env, iaObj, scope); } *port = ntohs(him6->sin6_port); } else @@ -247,9 +327,8 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj) if (family == AF_INET) { return JNI_FALSE; } - ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); - scope = (*env)->GetIntField(env, iaObj, ia6_scopeidID); - (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddrCur); + scope = getInet6Address_scopeid(env, iaObj); + getInet6Address_ipaddress(env, iaObj, (char *)caddrCur); if (NET_IsEqual(caddrNew, caddrCur) && cmpScopeID(scope, him)) { return JNI_TRUE; } else { diff --git a/jdk/src/share/native/java/net/net_util.h b/jdk/src/share/native/java/net/net_util.h index 0fd5b6c427f..d38a5f52fcf 100644 --- a/jdk/src/share/native/java/net/net_util.h +++ b/jdk/src/share/native/java/net/net_util.h @@ -58,6 +58,19 @@ extern jfieldID iac_familyID; extern jfieldID iac_hostNameID; extern jfieldID ia_preferIPv6AddressID; +/** (Inet6Address accessors) + * set_ methods return JNI_TRUE on success JNI_FALSE on error + * get_ methods that return int/boolean, return -1 on error + * get_ methods that return objects return NULL on error. + */ +extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj); +extern int setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname); +extern int getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj); +extern int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj); +extern int setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid); +extern int getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest); +extern int setInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *address); + extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address); extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family); extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h); @@ -93,12 +106,12 @@ extern jfieldID dp_bufLengthID; /* Inet6Address fields */ extern jclass ia6_class; +extern jfieldID ia6_holder6ID; extern jfieldID ia6_ipaddressID; extern jfieldID ia6_scopeidID; extern jfieldID ia6_cachedscopeidID; extern jfieldID ia6_scopeidsetID; extern jfieldID ia6_scopeifnameID; -extern jfieldID ia6_scopeifnamesetID; extern jmethodID ia6_ctrID; /************************************************************************ diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c index 4fc64867f8b..694826f3aba 100644 --- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c +++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c @@ -120,7 +120,6 @@ static jclass ni_ia4cls; static jclass ni_ia6cls; static jmethodID ni_ia4ctrID; static jmethodID ni_ia6ctrID; -static jfieldID ni_ia6ipaddressID; static int initialized = 0; /* @@ -156,7 +155,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "", "()V"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); initialized = 1; } @@ -303,6 +301,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, } while (iterator != NULL) { + int ret1; if (iterator->ai_family == AF_INET) { jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); if (IS_NULL(iaObj)) { @@ -315,26 +314,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, inetIndex++; } else if (iterator->ai_family == AF_INET6) { jint scope = 0; - jbyteArray ipaddress; jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); if (IS_NULL(iaObj)) { ret = NULL; goto cleanupAndReturn; } - ipaddress = (*env)->NewByteArray(env, 16); - if (IS_NULL(ipaddress)) { + ret1 = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); + if (!ret1) { ret = NULL; goto cleanupAndReturn; } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); + scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); + setInet6Address_scopeid(env, iaObj, scope); } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); setInetAddress_hostName(env, iaObj, host); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); inet6Index++; diff --git a/jdk/src/solaris/native/java/net/NetworkInterface.c b/jdk/src/solaris/native/java/net/NetworkInterface.c index 68633db5a18..1c999442168 100644 --- a/jdk/src/solaris/native/java/net/NetworkInterface.c +++ b/jdk/src/solaris/native/java/net/NetworkInterface.c @@ -118,7 +118,6 @@ static jclass ni_ibcls; static jmethodID ni_ia4ctrID; static jmethodID ni_ia6ctrID; static jmethodID ni_ibctrID; -static jfieldID ni_ia6ipaddressID; static jfieldID ni_ibaddressID; static jfieldID ni_ib4broadcastID; static jfieldID ni_ib4maskID; @@ -193,7 +192,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) { ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "", "()V"); ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "", "()V"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;"); ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;"); ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S"); @@ -332,11 +330,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 #ifdef AF_INET6 if (family == AF_INET6) { jbyte *bytes = (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr); - jbyteArray ipaddress = (*env)->GetObjectField(env, iaObj, ni_ia6ipaddressID); jbyte caddr[16]; int i; - - (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr); + getInet6Address_ipaddress(env, iaObj, (char *)caddr); i = 0; while (i < 16) { if (caddr[i] != bytes[i]) { @@ -670,21 +666,17 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) { int scope=0; iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); if (iaObj) { - jbyteArray ipaddress = (*env)->NewByteArray(env, 16); - if (ipaddress == NULL) { + int ret = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr)); + if (ret == JNI_FALSE) { return NULL; } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr)); scope = ((struct sockaddr_in6*)addrP->addr)->sin6_scope_id; if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - (*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj); + setInet6Address_scopeid(env, iaObj, scope); + setInet6Address_scopeifname(env, iaObj, netifObj); } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj) { diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c index 981bf534a66..09f8e5d0c61 100644 --- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c +++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c @@ -2148,8 +2148,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this, caddr[14] = ((address >> 8) & 0xff); caddr[15] = (address & 0xff); } else { - ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); - (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr); + getInet6Address_ipaddress(env, iaObj, caddr); } memcpy((void *)&(mname6.ipv6mr_multiaddr), caddr, sizeof(struct in6_addr)); diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c index 004b6aa5d92..d7ebbd5a7c9 100644 --- a/jdk/src/solaris/native/java/net/net_util_md.c +++ b/jdk/src/solaris/native/java/net/net_util_md.c @@ -782,7 +782,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr /* needs work. 1. family 2. clean up him6 etc deallocate memory */ if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) { struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him; - jbyteArray ipaddress; jbyte caddr[16]; jint address; @@ -803,8 +802,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr caddr[15] = (address & 0xff); } } else { - ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); - (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr); + getInet6Address_ipaddress(env, iaObj, (char *)caddr); } memset((char *)him6, 0, sizeof(struct sockaddr_in6)); him6->sin6_port = htons(port); @@ -840,7 +838,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr */ if (!cached_scope_id) { if (ia6_scopeidID) { - scope_id = (int)(*env)->GetIntField(env,iaObj,ia6_scopeidID); + scope_id = getInet6Address_scopeid(env, iaObj); } if (scope_id != 0) { /* check user-specified value for loopback case @@ -884,7 +882,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr if (family != IPv4) { if (ia6_scopeidID) { - him6->sin6_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_scopeidID); + him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj); } } #endif diff --git a/jdk/src/windows/native/java/net/Inet6AddressImpl.c b/jdk/src/windows/native/java/net/Inet6AddressImpl.c index 6f46d7eb642..c124f91f4d5 100644 --- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c +++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c @@ -77,7 +77,6 @@ static jclass ni_ia4cls; static jclass ni_ia6cls; static jmethodID ni_ia4ctrID; static jmethodID ni_ia6ctrID; -static jfieldID ni_ia6ipaddressID; static int initialized = 0; JNIEXPORT jobjectArray JNICALL @@ -101,7 +100,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "", "()V"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); initialized = 1; } if (IS_NULL(host)) { @@ -242,26 +240,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); inetIndex ++; } else if (iterator->ai_family == AF_INET6) { - jint scope = 0; - jbyteArray ipaddress; + jint scope = 0, ret1; jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); if (IS_NULL(iaObj)) { ret = NULL; goto cleanupAndReturn; } - ipaddress = (*env)->NewByteArray(env, 16); - if (IS_NULL(ipaddress)) { + ret1 = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); + + if (ret1 == JNI_FALSE) { ret = NULL; goto cleanupAndReturn; } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); + setInet6Address_scopeid(env, iaObj, scope); } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); setInetAddress_hostName(env, iaObj, host); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); inet6Index ++; diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c index c548930a913..edcccd4ae4c 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface.c +++ b/jdk/src/windows/native/java/net/NetworkInterface.c @@ -72,8 +72,6 @@ jmethodID ni_ia4Ctor; /* Inet4Address() */ jclass ni_ia6cls; /* Inet6Address */ jmethodID ni_ia6ctrID; /* Inet6Address() */ -jfieldID ni_ia6ipaddressID; -jfieldID ni_ia6ipaddressID; jclass ni_ibcls; /* InterfaceAddress */ jmethodID ni_ibctrID; /* InterfaceAddress() */ @@ -520,7 +518,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address"); ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "", "()V"); - ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B"); ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress"); ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls); @@ -621,19 +618,16 @@ jobject createNetworkInterface int scope; iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); if (iaObj) { - jbyteArray ipaddress = (*env)->NewByteArray(env, 16); - if (ipaddress == NULL) { + int ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr)); + if (ret == JNI_FALSE) { return NULL; } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr)); + scope = addrs->addr.him6.sin6_scope_id; if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - (*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj); + setInet6Address_scopeid(env, iaObj, scope); + setInet6Address_scopeifname(env, iaObj, netifObj); } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { free_netaddr(netaddrP); diff --git a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c index 1078d826afa..67374a02583 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c +++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c @@ -544,19 +544,15 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) int scope; iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); if (iaObj) { - jbyteArray ipaddress = (*env)->NewByteArray(env, 16); - if (ipaddress == NULL) { + int ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr)); + if (ret == JNI_FALSE) { return NULL; } - (*env)->SetByteArrayRegion(env, ipaddress, 0, 16, - (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr)); scope = addrs->addr.him6.sin6_scope_id; if (scope != 0) { /* zero is default value, no need to set */ - (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); - (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); - (*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj); + setInet6Address_scopeid(env, iaObj, scope); + setInet6Address_scopeifname(env, iaObj, netifObj); } - (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { free_netaddr(netaddrP); diff --git a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c index 6823ddc7c7c..f535073df38 100644 --- a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c +++ b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c @@ -728,7 +728,6 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this, setInetAddress_family(env, socketAddressObj, IPv4); (*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj); } else { - jbyteArray addr; /* AF_INET6 -> Inet6Address */ if (inet6Cls == 0) { jclass c = (*env)->FindClass(env, "java/net/Inet6Address"); @@ -751,14 +750,10 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this, NET_SocketClose(fd); return; } - addr = (*env)->GetObjectField (env, socketAddressObj, ia6_ipaddressID); - (*env)->SetByteArrayRegion (env, addr, 0, 16, (const char *)&him.him6.sin6_addr); + setInet6Address_ipaddress(env, socketAddressObj, (const char *)&him.him6.sin6_addr); setInetAddress_family(env, socketAddressObj, IPv6); - scope = him.him6.sin6_scope_id; - (*env)->SetIntField(env, socketAddressObj, ia6_scopeidID, scope); - if(scope>0) { - (*env)->SetBooleanField(env, socketAddressObj, ia6_scopeidsetID, JNI_TRUE); - } + setInet6Address_scopeid(env, socketAddressObj, him.him6.sin6_scope_id); + } /* fields common to AF_INET and AF_INET6 */ diff --git a/jdk/src/windows/native/java/net/net_util_md.c b/jdk/src/windows/native/java/net/net_util_md.c index 4e5cb50b0bc..6ddb2bcfd78 100644 --- a/jdk/src/windows/native/java/net/net_util_md.c +++ b/jdk/src/windows/native/java/net/net_util_md.c @@ -851,7 +851,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr family = (iafam == IPv4)? AF_INET : AF_INET6; if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) { struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him; - jbyteArray ipaddress; jbyte caddr[16]; jint address, scopeid = 0; jint cached_scope_id = 0; @@ -872,10 +871,9 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr caddr[15] = (address & 0xff); } } else { - ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); - scopeid = (jint)(*env)->GetIntField(env, iaObj, ia6_scopeidID); + getInet6Address_ipaddress(env, iaObj, (char *)caddr); + scopeid = getInet6Address_scopeid(env, iaObj); cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID); - (*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr); } memset((char *)him6, 0, sizeof(struct SOCKADDR_IN6)); diff --git a/jdk/test/java/net/Inet6Address/serialize/Serialize.java b/jdk/test/java/net/Inet6Address/serialize/Serialize.java index c563c8b115a..f7c6fe735fb 100644 --- a/jdk/test/java/net/Inet6Address/serialize/Serialize.java +++ b/jdk/test/java/net/Inet6Address/serialize/Serialize.java @@ -94,7 +94,26 @@ public class Serialize { } finally { ois.close(); } - System.out.println(nobj); + + nobj = (Inet6Address)InetAddress.getByAddress("foo.com", new byte[] { + (byte)0xfe,(byte)0x80,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0, + (byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)1 + }); + if (!test1(nobj, addr1)) { + throw new RuntimeException("failed with " + nobj.toString()); + } + nobj = (Inet6Address)InetAddress.getByAddress("x.bar.com", new byte[] { + (byte)0xfe,(byte)0xC0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0, + (byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)1 + }); + if (!test1(nobj, addr2)) { + throw new RuntimeException("failed with " + nobj.toString()); + } + nobj = (Inet6Address)InetAddress.getByName("::1"); + if (!test1(nobj, addr3)) { + throw new RuntimeException("failed with " + nobj.toString()); + } + System.out.println("All tests passed"); } @@ -113,4 +132,162 @@ public class Serialize { return false; } } - } + + static boolean test1 (Inet6Address obj, byte[] buf) throws Exception { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buf)); + Inet6Address nobj = (Inet6Address) ois.readObject(); + ois.close(); + + if (nobj.equals(obj)) { + return true; + } else { + return false; + } + } + + // Inet6Address instances serialized with JDK 6 + + static byte[] addr1 = { + (byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72, + (byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49, + (byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64, + (byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f, + (byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80, + (byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00, + (byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65, + (byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c, + (byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f, + (byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74, + (byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f, + (byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e, + (byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65, + (byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66, + (byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00, + (byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f, + (byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67, + (byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70, + (byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73, + (byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42, + (byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61, + (byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74, + (byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41, + (byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73, + (byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3, + (byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49, + (byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72, + (byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06, + (byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79, + (byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73, + (byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71, + (byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x02,(byte)0x74,(byte)0x00,(byte)0x07,(byte)0x66, + (byte)0x6f,(byte)0x6f,(byte)0x2e,(byte)0x63,(byte)0x6f,(byte)0x6d, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x70,(byte)0x75,(byte)0x72,(byte)0x00,(byte)0x02,(byte)0x5b, + (byte)0x42,(byte)0xac,(byte)0xf3,(byte)0x17,(byte)0xf8,(byte)0x06, + (byte)0x08,(byte)0x54,(byte)0xe0,(byte)0x02,(byte)0x00,(byte)0x00, + (byte)0x78,(byte)0x70,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x10, + (byte)0xfe,(byte)0x80,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x78 + }; + + static byte[] addr2 = { + (byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72, + (byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49, + (byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64, + (byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f, + (byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80, + (byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00, + (byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65, + (byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c, + (byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f, + (byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74, + (byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f, + (byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e, + (byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65, + (byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66, + (byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00, + (byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f, + (byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67, + (byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70, + (byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73, + (byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42, + (byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61, + (byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74, + (byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41, + (byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73, + (byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3, + (byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49, + (byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72, + (byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06, + (byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79, + (byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73, + (byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71, + (byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x02,(byte)0x74,(byte)0x00,(byte)0x09,(byte)0x78, + (byte)0x2e,(byte)0x62,(byte)0x61,(byte)0x72,(byte)0x2e,(byte)0x63, + (byte)0x6f,(byte)0x6d,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x70,(byte)0x75,(byte)0x72,(byte)0x00, + (byte)0x02,(byte)0x5b,(byte)0x42,(byte)0xac,(byte)0xf3,(byte)0x17, + (byte)0xf8,(byte)0x06,(byte)0x08,(byte)0x54,(byte)0xe0,(byte)0x02, + (byte)0x00,(byte)0x00,(byte)0x78,(byte)0x70,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x10,(byte)0xfe,(byte)0xc0,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, + (byte)0x78 + }; + + static byte[] addr3 = { + (byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72, + (byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49, + (byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64, + (byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f, + (byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80, + (byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00, + (byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65, + (byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c, + (byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f, + (byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74, + (byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f, + (byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e, + (byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65, + (byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66, + (byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00, + (byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61, + (byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f, + (byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67, + (byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70, + (byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73, + (byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42, + (byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61, + (byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74, + (byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41, + (byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73, + (byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3, + (byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49, + (byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72, + (byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06, + (byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79, + (byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73, + (byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71, + (byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x02,(byte)0x70,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x70,(byte)0x75,(byte)0x72, + (byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42,(byte)0xac,(byte)0xf3, + (byte)0x17,(byte)0xf8,(byte)0x06,(byte)0x08,(byte)0x54,(byte)0xe0, + (byte)0x02,(byte)0x00,(byte)0x00,(byte)0x78,(byte)0x70,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x10,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x01,(byte)0x78 + }; +} From 3d9f33759d5c2e1d6e6d8438d8ae78416bfac086 Mon Sep 17 00:00:00 2001 From: Masayoshi Okutsu Date: Fri, 19 Jul 2013 12:14:34 +0900 Subject: [PATCH 042/983] 8001029: Add new date/time capability Reviewed-by: mchung, hawtin --- jdk/src/share/classes/java/util/TimeZone.java | 140 +++++------------- .../util/TimeZone/SetDefaultSecurityTest.java | 67 +++++++++ 2 files changed, 107 insertions(+), 100 deletions(-) create mode 100644 jdk/test/java/util/TimeZone/SetDefaultSecurityTest.java diff --git a/jdk/src/share/classes/java/util/TimeZone.java b/jdk/src/share/classes/java/util/TimeZone.java index ba4abb91f2c..3075bff157a 100644 --- a/jdk/src/share/classes/java/util/TimeZone.java +++ b/jdk/src/share/classes/java/util/TimeZone.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,13 +39,9 @@ package java.util; import java.io.Serializable; -import java.lang.ref.SoftReference; import java.security.AccessController; import java.security.PrivilegedAction; import java.time.ZoneId; -import java.util.concurrent.ConcurrentHashMap; -import sun.misc.JavaAWTAccess; -import sun.misc.SharedSecrets; import sun.security.action.GetPropertyAction; import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfoFile; @@ -596,11 +592,26 @@ abstract public class TimeZone implements Serializable, Cloneable { private static native String getSystemGMTOffsetID(); /** - * Gets the default TimeZone for this host. - * The source of the default TimeZone - * may vary with implementation. - * @return a default TimeZone. - * @see #setDefault + * Gets the default {@code TimeZone} of the Java virtual machine. If the + * cached default {@code TimeZone} is available, its clone is returned. + * Otherwise, the method takes the following steps to determine the default + * time zone. + * + *

    + *
  • Use the {@code user.timezone} property value as the default + * time zone ID if it's available.
  • + *
  • Detect the platform time zone ID. The source of the + * platform time zone and ID mapping may vary with implementation.
  • + *
  • Use {@code GMT} as the last resort if the given or detected + * time zone ID is unknown.
  • + *
+ * + *

The default {@code TimeZone} created from the ID is cached, + * and its clone is returned. The {@code user.timezone} property + * value is set to the ID upon return. + * + * @return the default {@code TimeZone} + * @see #setDefault(TimeZone) */ public static TimeZone getDefault() { return (TimeZone) getDefaultRef().clone(); @@ -611,14 +622,11 @@ abstract public class TimeZone implements Serializable, Cloneable { * method doesn't create a clone. */ static TimeZone getDefaultRef() { - TimeZone defaultZone = getDefaultInAppContext(); + TimeZone defaultZone = defaultTimeZone; if (defaultZone == null) { - defaultZone = defaultTimeZone; - if (defaultZone == null) { - // Need to initialize the default time zone. - defaultZone = setDefaultZone(); - assert defaultZone != null; - } + // Need to initialize the default time zone. + defaultZone = setDefaultZone(); + assert defaultZone != null; } // Don't clone here. return defaultZone; @@ -676,95 +684,27 @@ abstract public class TimeZone implements Serializable, Cloneable { return tz; } - private static boolean hasPermission() { - boolean hasPermission = true; - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - try { - sm.checkPermission(new PropertyPermission - ("user.timezone", "write")); - } catch (SecurityException e) { - hasPermission = false; - } - } - return hasPermission; - } - /** - * Sets the TimeZone that is - * returned by the getDefault method. If zone - * is null, reset the default to the value it had originally when the - * VM first started. - * @param zone the new default time zone + * Sets the {@code TimeZone} that is returned by the {@code getDefault} + * method. {@code zone} is cached. If {@code zone} is null, the cached + * default {@code TimeZone} is cleared. This method doesn't change the value + * of the {@code user.timezone} property. + * + * @param zone the new default {@code TimeZone}, or null + * @throws SecurityException if the security manager's {@code checkPermission} + * denies {@code PropertyPermission("user.timezone", + * "write")} * @see #getDefault + * @see PropertyPermission */ public static void setDefault(TimeZone zone) { - if (hasPermission()) { - synchronized (TimeZone.class) { - defaultTimeZone = zone; - setDefaultInAppContext(null); - } - } else { - setDefaultInAppContext(zone); - } - } - - /** - * Returns the default TimeZone in an AppContext if any AppContext - * has ever used. null is returned if any AppContext hasn't been - * used or if the AppContext doesn't have the default TimeZone. - * - * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't - * been loaded. If so, it implies that AWTSecurityManager is not our - * SecurityManager and we can use a local static variable. - * This works around a build time issue. - */ - private static TimeZone getDefaultInAppContext() { - // JavaAWTAccess provides access implementation-private methods without using reflection. - JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess(); - - if (javaAWTAccess == null) { - return mainAppContextDefault; - } else { - if (!javaAWTAccess.isDisposed()) { - TimeZone tz = (TimeZone) - javaAWTAccess.get(TimeZone.class); - if (tz == null && javaAWTAccess.isMainAppContext()) { - return mainAppContextDefault; - } else { - return tz; - } - } - } - return null; - } - - /** - * Sets the default TimeZone in the AppContext to the given - * tz. null is handled special: do nothing if any AppContext - * hasn't been used, remove the default TimeZone in the - * AppContext otherwise. - * - * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't - * been loaded. If so, it implies that AWTSecurityManager is not our - * SecurityManager and we can use a local static variable. - * This works around a build time issue. - */ - private static void setDefaultInAppContext(TimeZone tz) { - // JavaAWTAccess provides access implementation-private methods without using reflection. - JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess(); - - if (javaAWTAccess == null) { - mainAppContextDefault = tz; - } else { - if (!javaAWTAccess.isDisposed()) { - javaAWTAccess.put(TimeZone.class, tz); - if (javaAWTAccess.isMainAppContext()) { - mainAppContextDefault = null; - } - } + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new PropertyPermission + ("user.timezone", "write")); } + defaultTimeZone = zone; } /** diff --git a/jdk/test/java/util/TimeZone/SetDefaultSecurityTest.java b/jdk/test/java/util/TimeZone/SetDefaultSecurityTest.java new file mode 100644 index 00000000000..e749ffe9420 --- /dev/null +++ b/jdk/test/java/util/TimeZone/SetDefaultSecurityTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8001029 + * @summary Make sure that TimeZone.setDefault throws a SecurityException if the + * security manager doesn't permit. + * @run main/othervm SetDefaultSecurityTest + */ + +import java.util.SimpleTimeZone; +import java.util.TimeZone; + +public class SetDefaultSecurityTest { + static final TimeZone NOWHERE = new SimpleTimeZone(Integer.MAX_VALUE, "Nowhere"); + + public static void main(String[] args) { + TimeZone defaultZone = TimeZone.getDefault(); + + // Make sure that TimeZone.setDefault works for trusted code + TimeZone.setDefault(NOWHERE); + if (!NOWHERE.equals(TimeZone.getDefault())) { + new RuntimeException("TimeZone.setDefault doesn't work for trusted code."); + } + // Restore defaultZone + TimeZone.setDefault(defaultZone); + if (!defaultZone.equals(TimeZone.getDefault())) { + new RuntimeException("TimeZone.setDefault doesn't restore defaultZone."); + } + + // Install a SecurityManager. + System.setSecurityManager(new SecurityManager()); + try { + TimeZone.setDefault(NOWHERE); + throw new RuntimeException("TimeZone.setDefault doesn't throw a SecurityException."); + } catch (SecurityException se) { + // OK + } + TimeZone tz = TimeZone.getDefault(); + if (!defaultZone.equals(tz)) { + throw new RuntimeException("Default TimeZone changed: " + tz); + } + } +} From 20511649934fed3e8094b69b5375107b965c62a9 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Fri, 19 Jul 2013 13:35:01 +0200 Subject: [PATCH 043/983] 8014534: Better profiling support Validation of parameters Reviewed-by: sspitsyn, skoivu, mchung --- .../com/sun/demo/jvmti/hprof/Tracker.java | 26 ++++++++++++++++-- jdk/src/share/demo/jvmti/hprof/hprof_class.c | 14 ++++++++-- jdk/src/share/demo/jvmti/hprof/hprof_event.c | 27 ++++++++++++++----- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/jdk/src/share/classes/com/sun/demo/jvmti/hprof/Tracker.java b/jdk/src/share/classes/com/sun/demo/jvmti/hprof/Tracker.java index f2e33d72454..96950870be2 100644 --- a/jdk/src/share/classes/com/sun/demo/jvmti/hprof/Tracker.java +++ b/jdk/src/share/classes/com/sun/demo/jvmti/hprof/Tracker.java @@ -53,7 +53,10 @@ public class Tracker { public static void ObjectInit(Object obj) { - if ( engaged != 0 ) { + if ( engaged != 0) { + if (obj == null) { + throw new IllegalArgumentException("Null object."); + } nativeObjectInit(Thread.currentThread(), obj); } } @@ -66,7 +69,10 @@ public class Tracker { public static void NewArray(Object obj) { - if ( engaged != 0 ) { + if ( engaged != 0) { + if (obj == null) { + throw new IllegalArgumentException("Null object."); + } nativeNewArray(Thread.currentThread(), obj); } } @@ -82,6 +88,14 @@ public class Tracker { public static void CallSite(int cnum, int mnum) { if ( engaged != 0 ) { + if (cnum < 0) { + throw new IllegalArgumentException("Negative class index"); + } + + if (mnum < 0) { + throw new IllegalArgumentException("Negative method index"); + } + nativeCallSite(Thread.currentThread(), cnum, mnum); } } @@ -95,6 +109,14 @@ public class Tracker { public static void ReturnSite(int cnum, int mnum) { if ( engaged != 0 ) { + if (cnum < 0) { + throw new IllegalArgumentException("Negative class index"); + } + + if (mnum < 0) { + throw new IllegalArgumentException("Negative method index"); + } + nativeReturnSite(Thread.currentThread(), cnum, mnum); } } diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_class.c b/jdk/src/share/demo/jvmti/hprof/hprof_class.c index f25f53ad934..fb16784476f 100644 --- a/jdk/src/share/demo/jvmti/hprof/hprof_class.c +++ b/jdk/src/share/demo/jvmti/hprof/hprof_class.c @@ -527,7 +527,12 @@ class_get_methodID(JNIEnv *env, ClassIndex index, MethodIndex mnum) jmethodID method; info = get_info(index); - HPROF_ASSERT(mnum < info->method_count); + if (mnum >= info->method_count) { + jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); + (*env)->ThrowNew(env, newExcCls, "Illegal mnum"); + + return NULL; + } method = info->method[mnum].method_id; if ( method == NULL ) { char * name; @@ -535,7 +540,12 @@ class_get_methodID(JNIEnv *env, ClassIndex index, MethodIndex mnum) jclass clazz; name = (char *)string_get(info->method[mnum].name_index); - HPROF_ASSERT(name!=NULL); + if (name==NULL) { + jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); + (*env)->ThrowNew(env, newExcCls, "Name not found"); + + return NULL; + } sig = (char *)string_get(info->method[mnum].sig_index); HPROF_ASSERT(sig!=NULL); clazz = class_get_class(env, index); diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_event.c b/jdk/src/share/demo/jvmti/hprof/hprof_event.c index 15dd4ddaa76..7892457d3f8 100644 --- a/jdk/src/share/demo/jvmti/hprof/hprof_event.c +++ b/jdk/src/share/demo/jvmti/hprof/hprof_event.c @@ -195,7 +195,12 @@ event_call(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum) HPROF_ASSERT(env!=NULL); HPROF_ASSERT(thread!=NULL); - HPROF_ASSERT(cnum!=0 && cnum!=gdata->tracker_cnum); + if (cnum == 0 || cnum == gdata->tracker_cnum) { + jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); + (*env)->ThrowNew(env, newExcCls, "Illegal cnum."); + + return; + } /* Prevent recursion into any BCI function for this thread (pstatus). */ if ( tls_get_tracker_status(env, thread, JNI_FALSE, @@ -204,8 +209,10 @@ event_call(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum) (*pstatus) = 1; method = class_get_methodID(env, cnum, mnum); - HPROF_ASSERT(method!=NULL); - tls_push_method(tls_index, method); + if (method != NULL) { + tls_push_method(tls_index, method); + } + (*pstatus) = 0; } } @@ -248,7 +255,13 @@ event_return(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum) HPROF_ASSERT(env!=NULL); HPROF_ASSERT(thread!=NULL); - HPROF_ASSERT(cnum!=0 && cnum!=gdata->tracker_cnum); + + if (cnum == 0 || cnum == gdata->tracker_cnum) { + jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); + (*env)->ThrowNew(env, newExcCls, "Illegal cnum."); + + return; + } /* Prevent recursion into any BCI function for this thread (pstatus). */ if ( tls_get_tracker_status(env, thread, JNI_FALSE, @@ -257,8 +270,10 @@ event_return(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum) (*pstatus) = 1; method = class_get_methodID(env, cnum, mnum); - HPROF_ASSERT(method!=NULL); - tls_pop_method(tls_index, thread, method); + if (method != NULL) { + tls_pop_method(tls_index, thread, method); + } + (*pstatus) = 0; } } From bd41c425d2a88e9e78897a43a5e3ea811d453ba4 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 22 Jul 2013 19:41:07 -0700 Subject: [PATCH 044/983] 8017196: Ensure Proxies are handled appropriately Reviewed-by: dfuchs, jrose, jdn, ahgross, chegar --- .../java/lang/invoke/MethodHandles.java | 15 ++++-- .../classes/java/lang/reflect/Proxy.java | 38 +++++++++++---- .../classes/sun/reflect/misc/ReflectUtil.java | 48 +++++++++++++++++++ 3 files changed, 88 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java index 3bf24bc8503..1c9a068ed92 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java @@ -433,7 +433,7 @@ public class MethodHandles { Lookup(Class lookupClass) { this(lookupClass, ALL_MODES); // make sure we haven't accidentally picked up a privileged class: - checkUnprivilegedlookupClass(lookupClass); + checkUnprivilegedlookupClass(lookupClass, ALL_MODES); } private Lookup(Class lookupClass, int allowedModes) { @@ -487,7 +487,7 @@ public class MethodHandles { // No permissions. newModes = 0; } - checkUnprivilegedlookupClass(requestedLookupClass); + checkUnprivilegedlookupClass(requestedLookupClass, newModes); return new Lookup(requestedLookupClass, newModes); } @@ -503,10 +503,19 @@ public class MethodHandles { /** Package-private version of lookup which is trusted. */ static final Lookup IMPL_LOOKUP = new Lookup(Object.class, TRUSTED); - private static void checkUnprivilegedlookupClass(Class lookupClass) { + private static void checkUnprivilegedlookupClass(Class lookupClass, int allowedModes) { String name = lookupClass.getName(); if (name.startsWith("java.lang.invoke.")) throw newIllegalArgumentException("illegal lookupClass: "+lookupClass); + + // For caller-sensitive MethodHandles.lookup() + // disallow lookup more restricted packages + if (allowedModes == ALL_MODES && lookupClass.getClassLoader() == null) { + if (name.startsWith("java.") || + (name.startsWith("sun.") && !name.startsWith("sun.invoke."))) { + throw newIllegalArgumentException("illegal lookupClass: " + lookupClass); + } + } } /** diff --git a/jdk/src/share/classes/java/lang/reflect/Proxy.java b/jdk/src/share/classes/java/lang/reflect/Proxy.java index dd5c2ad4336..f2e4eda4e62 100644 --- a/jdk/src/share/classes/java/lang/reflect/Proxy.java +++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java @@ -347,11 +347,11 @@ public class Proxy implements java.io.Serializable { * s.checkPermission} with * {@code RuntimePermission("getClassLoader")} permission * denies access. - *

  • the caller's class loader is not the same as or an - * ancestor of the class loader for the current class and + *
  • for each proxy interface, {@code intf}, + * the caller's class loader is not the same as or an + * ancestor of the class loader for {@code intf} and * invocation of {@link SecurityManager#checkPackageAccess - * s.checkPackageAccess()} denies access to any one of the - * given proxy interfaces.
  • + * s.checkPackageAccess()} denies access to {@code intf}. * * @throws NullPointerException if the {@code interfaces} array @@ -680,11 +680,11 @@ public class Proxy implements java.io.Serializable { * s.checkPermission} with * {@code RuntimePermission("getClassLoader")} permission * denies access; - *
  • the caller's class loader is not the same as or an - * ancestor of the class loader for the current class and + *
  • for each proxy interface, {@code intf}, + * the caller's class loader is not the same as or an + * ancestor of the class loader for {@code intf} and * invocation of {@link SecurityManager#checkPackageAccess - * s.checkPackageAccess()} denies access to any one of the - * given proxy interfaces.
  • + * s.checkPackageAccess()} denies access to {@code intf}; *
  • any of the given proxy interfaces is non-public and the * caller class is not in the same {@linkplain Package runtime package} * as the non-public interface and the invocation of @@ -795,7 +795,14 @@ public class Proxy implements java.io.Serializable { * @return the invocation handler for the proxy instance * @throws IllegalArgumentException if the argument is not a * proxy instance + * @throws SecurityException if a security manager, s, is present + * and the caller's class loader is not the same as or an + * ancestor of the class loader for the invocation handler + * and invocation of {@link SecurityManager#checkPackageAccess + * s.checkPackageAccess()} denies access to the invocation + * handler's class. */ + @CallerSensitive public static InvocationHandler getInvocationHandler(Object proxy) throws IllegalArgumentException { @@ -806,8 +813,19 @@ public class Proxy implements java.io.Serializable { throw new IllegalArgumentException("not a proxy instance"); } - Proxy p = (Proxy) proxy; - return p.h; + final Proxy p = (Proxy) proxy; + final InvocationHandler ih = p.h; + if (System.getSecurityManager() != null) { + Class ihClass = ih.getClass(); + Class caller = Reflection.getCallerClass(); + if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), + ihClass.getClassLoader())) + { + ReflectUtil.checkPackageAccess(ihClass); + } + } + + return ih; } private static native Class defineClass0(ClassLoader loader, String name, diff --git a/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java b/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java index efd85fca9cb..1f871e8de02 100644 --- a/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java +++ b/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java @@ -26,8 +26,10 @@ package sun.reflect.misc; +import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; +import java.util.Arrays; import sun.reflect.Reflection; public final class ReflectUtil { @@ -250,4 +252,50 @@ public final class ReflectUtil { String pkg = (i != -1) ? name.substring(0, i) : ""; return Proxy.isProxyClass(cls) && !pkg.equals(PROXY_PACKAGE); } + + /** + * Check if the given method is a method declared in the proxy interface + * implemented by the given proxy instance. + * + * @param proxy a proxy instance + * @param method an interface method dispatched to a InvocationHandler + * + * @throws IllegalArgumentException if the given proxy or method is invalid. + */ + public static void checkProxyMethod(Object proxy, Method method) { + // check if it is a valid proxy instance + if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { + throw new IllegalArgumentException("Not a Proxy instance"); +} + if (Modifier.isStatic(method.getModifiers())) { + throw new IllegalArgumentException("Can't handle static method"); + } + + Class c = method.getDeclaringClass(); + if (c == Object.class) { + String name = method.getName(); + if (name.equals("hashCode") || name.equals("equals") || name.equals("toString")) { + return; + } + } + + if (isSuperInterface(proxy.getClass(), c)) { + return; + } + + // disallow any method not declared in one of the proxy intefaces + throw new IllegalArgumentException("Can't handle: " + method); + } + + private static boolean isSuperInterface(Class c, Class intf) { + for (Class i : c.getInterfaces()) { + if (i == intf) { + return true; + } + if (isSuperInterface(i, intf)) { + return true; + } + } + return false; + } } From ff1d4ae90507ecf250df4852ffab15b037670f13 Mon Sep 17 00:00:00 2001 From: Sergey Gabdurakhmanov Date: Tue, 23 Jul 2013 09:30:58 +0400 Subject: [PATCH 045/983] 8016357: Update hotspot diagnostic class Add security check to HotSpotDiagnostic.dumpHeap Reviewed-by: fparain, sla, ahgross --- jdk/make/java/management/mapfile-vers | 2 +- jdk/makefiles/mapfiles/libmanagement/mapfile-vers | 2 +- .../com/sun/management/HotSpotDiagnosticMXBean.java | 5 +++++ .../classes/sun/management/HotSpotDiagnostic.java | 12 +++++++++++- .../share/native/sun/management/HotSpotDiagnostic.c | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/jdk/make/java/management/mapfile-vers b/jdk/make/java/management/mapfile-vers index 63c4fbf03cc..0ea2ab4eb06 100644 --- a/jdk/make/java/management/mapfile-vers +++ b/jdk/make/java/management/mapfile-vers @@ -57,7 +57,7 @@ SUNWprivate_1.1 { Java_sun_management_GcInfoBuilder_fillGcAttributeInfo; Java_sun_management_GcInfoBuilder_getLastGcInfo0; Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; - Java_sun_management_HotSpotDiagnostic_dumpHeap; + Java_sun_management_HotSpotDiagnostic_dumpHeap0; Java_sun_management_HotspotThread_getInternalThreadCount; Java_sun_management_HotspotThread_getInternalThreadTimes0; Java_sun_management_MemoryImpl_getMemoryManagers0; diff --git a/jdk/makefiles/mapfiles/libmanagement/mapfile-vers b/jdk/makefiles/mapfiles/libmanagement/mapfile-vers index b934fe8b748..724f7bb7100 100644 --- a/jdk/makefiles/mapfiles/libmanagement/mapfile-vers +++ b/jdk/makefiles/mapfiles/libmanagement/mapfile-vers @@ -57,7 +57,7 @@ SUNWprivate_1.1 { Java_sun_management_GcInfoBuilder_fillGcAttributeInfo; Java_sun_management_GcInfoBuilder_getLastGcInfo0; Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; - Java_sun_management_HotSpotDiagnostic_dumpHeap; + Java_sun_management_HotSpotDiagnostic_dumpHeap0; Java_sun_management_HotspotThread_getInternalThreadCount; Java_sun_management_HotspotThread_getInternalThreadTimes0; Java_sun_management_MemoryImpl_getMemoryManagers0; diff --git a/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java b/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java index 2fe8835259f..eaf5447b430 100644 --- a/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java +++ b/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java @@ -66,6 +66,11 @@ public interface HotSpotDiagnosticMXBean extends PlatformManagedObject { * cannot be created, opened, or written to. * @throws UnsupportedOperationException if this operation is not supported. * @throws NullPointerException if outputFile is null. + * @throws SecurityException + * If a security manager exists and its {@link + * java.lang.SecurityManager#checkWrite(java.lang.String)} + * method denies write access to the named file + * or the caller does not have ManagmentPermission("control"). */ public void dumpHeap(String outputFile, boolean live) throws java.io.IOException; diff --git a/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java b/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java index a6d3be1640f..7a4bd99f274 100644 --- a/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java +++ b/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java @@ -40,7 +40,17 @@ public class HotSpotDiagnostic implements HotSpotDiagnosticMXBean { public HotSpotDiagnostic() { } - public native void dumpHeap(String outputFile, boolean live) throws IOException; + public void dumpHeap(String outputFile, boolean live) throws IOException { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + security.checkWrite(outputFile); + Util.checkControlAccess(); + } + + dumpHeap0(outputFile, live); + } + + private native void dumpHeap0(String outputFile, boolean live) throws IOException; public List getDiagnosticOptions() { List allFlags = Flag.getAllFlags(); diff --git a/jdk/src/share/native/sun/management/HotSpotDiagnostic.c b/jdk/src/share/native/sun/management/HotSpotDiagnostic.c index 8d48b201109..cfa9e9ab8fa 100644 --- a/jdk/src/share/native/sun/management/HotSpotDiagnostic.c +++ b/jdk/src/share/native/sun/management/HotSpotDiagnostic.c @@ -29,7 +29,7 @@ #include "sun_management_HotSpotDiagnostic.h" JNIEXPORT void JNICALL -Java_sun_management_HotSpotDiagnostic_dumpHeap +Java_sun_management_HotSpotDiagnostic_dumpHeap0 (JNIEnv *env, jobject dummy, jstring outputfile, jboolean live) { jmm_interface->DumpHeap0(env, outputfile, live); From 2fac55ced5c5e37112d3d2ab6ed0f7f88a725838 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 17 Jul 2013 18:46:00 +0800 Subject: [PATCH 046/983] 8020696: Merge problem for KdcComm.java Reviewed-by: chegar --- jdk/src/share/classes/sun/security/krb5/KdcComm.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/sun/security/krb5/KdcComm.java b/jdk/src/share/classes/sun/security/krb5/KdcComm.java index ae3b0f098b7..3d50f9569d3 100644 --- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java +++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java @@ -227,15 +227,15 @@ public final class KdcComm { try { ibuf = sendIfPossible(obuf, tempKdc.next(), useTCP); } catch(Exception first) { + boolean ok = false; while(tempKdc.hasNext()) { try { ibuf = sendIfPossible(obuf, tempKdc.next(), useTCP); - if (ibuf != null) { - return ibuf; - } + ok = true; + break; } catch(Exception ignore) {} } - throw first; + if (!ok) throw first; } if (ibuf == null) { throw new IOException("Cannot get a KDC reply"); From 8b314fcc50688a3ae85c2caf68105e2759496c20 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 17 Jul 2013 09:31:39 -0700 Subject: [PATCH 047/983] 8017298: Better XML support Reviewed-by: alanb, dfuchs, mullan, lancea --- .../impl/XMLDocumentFragmentScannerImpl.java | 11 +- .../internal/impl/XMLEntityManager.java | 16 +- .../xerces/internal/impl/XMLScanner.java | 33 ++- .../internal/impl/msg/XMLMessages.properties | 1 + .../impl/xs/models/CMNodeFactory.java | 23 +- .../xs/traversers/XSAttributeChecker.java | 3 +- .../impl/xs/traversers/XSDHandler.java | 6 +- .../internal/jaxp/DocumentBuilderImpl.java | 4 +- .../xerces/internal/jaxp/SAXParserImpl.java | 6 +- .../validation/StreamValidatorHelper.java | 4 +- .../jaxp/validation/ValidatorHandlerImpl.java | 4 +- .../jaxp/validation/XMLSchemaFactory.java | 14 +- .../XMLSchemaValidatorComponentManager.java | 10 +- .../internal/parsers/AbstractSAXParser.java | 4 +- .../parsers/SecurityConfiguration.java | 6 +- .../xerces/internal/util/SecurityManager.java | 226 ------------------ .../xerces/internal/util/SymbolTable.java | 4 +- .../internal/utils/XMLSecurityManager.java | 147 ++++++++++++ .../internal/xinclude/XIncludeHandler.java | 10 +- .../com/sun/xml/internal/stream/Entity.java | 2 +- 20 files changed, 247 insertions(+), 287 deletions(-) delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java create mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index 82c009bbdd3..d76a7e22a7e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -50,9 +50,9 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.NamespaceSupport; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.xml.internal.stream.Entity; import javax.xml.XMLConstants; @@ -382,7 +382,7 @@ public class XMLDocumentFragmentScannerImpl protected boolean foundBuiltInRefs = false; - protected SecurityManager fSecurityManager = null; + protected XMLSecurityManager fSecurityManager = null; //skip element algorithm static final short MAX_DEPTH_LIMIT = 5 ; @@ -569,8 +569,10 @@ public class XMLDocumentFragmentScannerImpl // xerces features fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true); - fSecurityManager = (SecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); - fElementAttributeLimit = (fSecurityManager != null)?fSecurityManager.getElementAttrLimit():0; + fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); + fElementAttributeLimit = (fSecurityManager != null)? + fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0; + fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false); @@ -951,6 +953,7 @@ public class XMLDocumentFragmentScannerImpl // scan decl super.scanXMLDeclOrTextDecl(scanningTextDecl, fStrings); + fMarkupDepth--; // pseudo-attribute values diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java index ee6ff0a6b2e..5ecd1215a82 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java @@ -28,9 +28,9 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; import com.sun.org.apache.xerces.internal.util.*; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.URI; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; import com.sun.org.apache.xerces.internal.xni.XNIException; @@ -324,7 +324,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { // stores defaults for entity expansion limit if it has // been set on the configuration. - protected SecurityManager fSecurityManager = null; + protected XMLSecurityManager fSecurityManager = null; /** * True if the document entity is standalone. This should really @@ -1482,7 +1482,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { fEntityResolver = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER, null); fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null); fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null); - fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); + fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); // JAXP 1.5 feature fAccessExternalDTD = (String) componentManager.getProperty(ACCESS_EXTERNAL_DTD, EXTERNAL_ACCESS_DEFAULT); @@ -1499,7 +1499,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { // a class acting as a component manager but not // implementing that interface for whatever reason. public void reset() { - fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0; + fEntityExpansionLimit = (fSecurityManager != null)? + fSecurityManager.getLimit(XMLSecurityManager.Limit.ENTITY_EXPANSION_LIMIT):0; + // initialize state fStandalone = false; @@ -1635,8 +1637,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { } if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() && propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) { - fSecurityManager = (SecurityManager)value; - fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0; + fSecurityManager = (XMLSecurityManager)value; + fEntityExpansionLimit = (fSecurityManager != null)? + fSecurityManager.getLimit(XMLSecurityManager.Limit.ENTITY_EXPANSION_LIMIT):0; + } } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java index 0c66aa236fa..9fc489b3e02 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java @@ -499,7 +499,7 @@ public abstract class XMLScanner reportFatalError("SDDeclInvalid", new Object[] {standalone}); } } else { - reportFatalError("EncodingDeclRequired", null); + reportFatalError("SDDeclNameInvalid", null); } break; } @@ -564,7 +564,7 @@ public abstract class XMLScanner XMLString value) throws IOException, XNIException { - String name = fEntityScanner.scanName(); + String name = scanPseudoAttributeName(); // XMLEntityManager.print(fEntityManager.getCurrentEntity()); if (name == null) { @@ -616,6 +616,35 @@ public abstract class XMLScanner } // scanPseudoAttribute(XMLString):String + /** + * Scans the name of a pseudo attribute. The only legal names + * in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'. + * + * @return the name of the pseudo attribute or null + * if a legal pseudo attribute name could not be scanned. + */ + private String scanPseudoAttributeName() throws IOException, XNIException { + final int ch = fEntityScanner.peekChar(); + switch (ch) { + case 'v': + if (fEntityScanner.skipString(fVersionSymbol)) { + return fVersionSymbol; + } + break; + case 'e': + if (fEntityScanner.skipString(fEncodingSymbol)) { + return fEncodingSymbol; + } + break; + case 's': + if (fEntityScanner.skipString(fStandaloneSymbol)) { + return fStandaloneSymbol; + } + break; + } + return null; + } // scanPseudoAttributeName() + /** * Scans a processing instruction. *

    diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties index 1a5d62af9bb..d0db58ba98d 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties @@ -44,6 +44,7 @@ # 2.9 Standalone Document Declaration SDDeclInvalid = The standalone document declaration value must be \"yes\" or \"no\", not \"{0}\". + SDDeclNameInvalid = The standalone name in XML declaration may be misspelled. # 2.12 Language Identification XMLLangInvalid = The xml:lang attribute value \"{0}\" is an invalid language identifier. # 3. Logical Structures diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java index d1831661f88..e3c24dc8938 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java @@ -21,13 +21,13 @@ package com.sun.org.apache.xerces.internal.impl.xs.models; -import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; -import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; -import com.sun.org.apache.xerces.internal.util.SecurityManager ; -import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; -import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; -import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; +import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; +import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; +import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; /** * @@ -68,7 +68,7 @@ public class CMNodeFactory { // stores defaults for different security holes (maxOccurLimit in current context) if it has // been set on the configuration. - private SecurityManager fSecurityManager = null; + private XMLSecurityManager fSecurityManager = null; /** default constructor */ public CMNodeFactory() { @@ -77,10 +77,10 @@ public class CMNodeFactory { public void reset(XMLComponentManager componentManager){ fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER); try { - fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER); + fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER); //we are setting the limit of number of nodes to 3times the maxOccur value.. if(fSecurityManager != null){ - maxNodeLimit = fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY ; + maxNodeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY ; } } catch (XMLConfigurationException e) { @@ -150,8 +150,9 @@ public class CMNodeFactory { if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() && propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) { - fSecurityManager = (SecurityManager)value; - maxNodeLimit = (fSecurityManager != null) ? fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY : 0 ; + fSecurityManager = (XMLSecurityManager)value; + maxNodeLimit = (fSecurityManager != null) ? + fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY : 0 ; return; } if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() && diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java index 3744692c33d..34eaa8457bc 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java @@ -40,6 +40,7 @@ import com.sun.org.apache.xerces.internal.util.DOMUtil; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLSymbols; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xs.XSConstants; import java.util.HashMap; @@ -1194,7 +1195,7 @@ public class XSAttributeChecker { if (!optimize) { //Revisit :: IMO this is not right place to check // maxOccurNodeLimit. - int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit(); + int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT); if (max > maxOccurNodeLimit) { reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java index eba1ac0de20..1bfe85c841b 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java @@ -70,7 +70,6 @@ import com.sun.org.apache.xerces.internal.util.DOMUtil; import com.sun.org.apache.xerces.internal.util.DefaultErrorHandler; import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXInputSource; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.StAXInputSource; import com.sun.org.apache.xerces.internal.util.StAXLocationWrapper; import com.sun.org.apache.xerces.internal.util.SymbolHash; @@ -78,6 +77,7 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.grammars.Grammar; @@ -257,7 +257,7 @@ public class XSDHandler { * *

    Protected to allow access by any traverser.

    */ - protected SecurityManager fSecureProcessing = null; + protected XMLSecurityManager fSecureProcessing = null; private String fAccessExternalSchema; @@ -3501,7 +3501,7 @@ public class XSDHandler { fSecureProcessing = null; if( componentManager!=null ) { - fSecureProcessing = (SecurityManager) componentManager.getProperty(SECURE_PROCESSING, null); + fSecureProcessing = (XMLSecurityManager) componentManager.getProperty(SECURE_PROCESSING, null); } //set entity resolver diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java index 520bc87ea6a..bdb75becd22 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java @@ -36,7 +36,7 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator; import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer; import com.sun.org.apache.xerces.internal.parsers.DOMParser; -import com.sun.org.apache.xerces.internal.util.SecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; @@ -162,7 +162,7 @@ public class DocumentBuilderImpl extends DocumentBuilder // If the secure processing feature is on set a security manager. if (secureProcessing) { - domParser.setProperty(SECURITY_MANAGER, new SecurityManager()); + domParser.setProperty(SECURITY_MANAGER, new XMLSecurityManager()); /** * By default, secure processing is set, no external access is allowed. diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java index a57c1543d84..6dad379efba 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java @@ -34,8 +34,8 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator; import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.Status; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; @@ -151,7 +151,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser // If the secure processing feature is on set a security manager. if (secureProcessing) { - xmlReader.setProperty0(SECURITY_MANAGER, new SecurityManager()); + xmlReader.setProperty0(SECURITY_MANAGER, new XMLSecurityManager()); /** * By default, secure processing is set, no external access is allowed. * However, we need to check if it is actively set on the factory since we @@ -413,7 +413,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { try { - setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null); + setProperty(SECURITY_MANAGER, value ? new XMLSecurityManager() : null); } catch (SAXNotRecognizedException exc) { // If the property is not supported diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java index 95fe7d8d8ec..c560e1e8f54 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java @@ -24,7 +24,7 @@ import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.parsers.XML11Configuration; -import com.sun.org.apache.xerces.internal.util.SecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; @@ -170,7 +170,7 @@ final class StreamValidatorHelper implements ValidatorHelper { private XMLParserConfiguration initialize() { XML11Configuration config = new XML11Configuration(); if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) { - config.setProperty(SECURITY_MANAGER, new SecurityManager()); + config.setProperty(SECURITY_MANAGER, new XMLSecurityManager()); } config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER)); config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER)); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java index 2c3a9842c5e..c4de85d32c7 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java @@ -49,10 +49,10 @@ import com.sun.org.apache.xerces.internal.util.SAXLocatorWrapper; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolTable; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.URI; import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; import com.sun.org.apache.xerces.internal.util.XMLSymbols; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; @@ -679,7 +679,7 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements reader = spf.newSAXParser().getXMLReader(); // If this is a Xerces SAX parser, set the security manager if there is one if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) { - SecurityManager securityManager = (SecurityManager) fComponentManager.getProperty(SECURITY_MANAGER); + XMLSecurityManager securityManager = (XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER); if (securityManager != null) { try { reader.setProperty(SECURITY_MANAGER, securityManager); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java index 763fcdbd29f..1c004dcf4e1 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java @@ -41,11 +41,11 @@ import com.sun.org.apache.xerces.internal.util.DOMInputSource; import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXInputSource; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.StAXInputSource; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.grammars.Grammar; import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription; @@ -79,7 +79,7 @@ public final class XMLSchemaFactory extends SchemaFactory { private static final String XMLGRAMMAR_POOL = Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY; - /** Property identifier: SecurityManager. */ + /** Property identifier: XMLSecurityManager. */ private static final String SECURITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; @@ -108,8 +108,8 @@ public final class XMLSchemaFactory extends SchemaFactory { /** The ErrorHandlerWrapper */ private ErrorHandlerWrapper fErrorHandlerWrapper; - /** The SecurityManager. */ - private SecurityManager fSecurityManager; + /** The XMLSecurityManager. */ + private XMLSecurityManager fSecurityManager; /** The container for the real grammar pool. */ private XMLGrammarPoolWrapper fXMLGrammarPoolWrapper; @@ -137,7 +137,7 @@ public final class XMLSchemaFactory extends SchemaFactory { fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper); // Enable secure processing feature by default - fSecurityManager = new SecurityManager(); + fSecurityManager = new XMLSecurityManager(); fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); //by default, the secure feature is set to true, otherwise the default would have been 'file' @@ -365,7 +365,7 @@ public final class XMLSchemaFactory extends SchemaFactory { "jaxp-secureprocessing-feature", null)); } if (value) { - fSecurityManager = new SecurityManager(); + fSecurityManager = new XMLSecurityManager(); fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); fXMLSchemaLoader.setProperty(ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); } else { @@ -404,7 +404,7 @@ public final class XMLSchemaFactory extends SchemaFactory { "ProperyNameNull", null)); } if (name.equals(SECURITY_MANAGER)) { - fSecurityManager = (SecurityManager) object; + fSecurityManager = (XMLSecurityManager) object; fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); return; } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java index 241d02cbf85..66847d53998 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java @@ -39,9 +39,9 @@ import com.sun.org.apache.xerces.internal.util.FeatureState; import com.sun.org.apache.xerces.internal.util.NamespaceSupport; import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; import com.sun.org.apache.xerces.internal.util.PropertyState; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolTable; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; @@ -182,7 +182,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin private final HashMap fInitProperties = new HashMap(); /** Stores the initial security manager. */ - private final SecurityManager fInitSecurityManager; + private final XMLSecurityManager fInitSecurityManager; // // User Objects @@ -221,7 +221,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin if (System.getSecurityManager() != null) { _isSecureMode = true; - setProperty(SECURITY_MANAGER, new SecurityManager()); + setProperty(SECURITY_MANAGER, new XMLSecurityManager()); } else { fComponents.put(SECURITY_MANAGER, null); } @@ -242,7 +242,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin // if the secure processing feature is set to true, add a security manager to the configuration Boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING); if (Boolean.TRUE.equals(secureProcessing)) { - fInitSecurityManager = new SecurityManager(); + fInitSecurityManager = new XMLSecurityManager(); } else { fInitSecurityManager = null; @@ -308,7 +308,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin if (_isSecureMode && !value) { throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING); } - setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null); + setProperty(SECURITY_MANAGER, value ? new XMLSecurityManager() : null); return; } fConfigUpdated = true; diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java index 53ad2a6b605..eea7057417b 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java @@ -25,10 +25,10 @@ import com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper; import com.sun.org.apache.xerces.internal.util.EntityResolverWrapper; import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolHash; import com.sun.org.apache.xerces.internal.util.XMLSymbols; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; @@ -1651,7 +1651,7 @@ public abstract class AbstractSAXParser else if (featureId.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { if (state) { if (fConfiguration.getProperty(SECURITY_MANAGER )==null) { - fConfiguration.setProperty(SECURITY_MANAGER, new SecurityManager()); + fConfiguration.setProperty(SECURITY_MANAGER, new XMLSecurityManager()); } } } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java index df32bfa41d9..53d4ab4a0ea 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java @@ -23,8 +23,8 @@ package com.sun.org.apache.xerces.internal.parsers; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.SymbolTable; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; /** * This configuration allows Xerces to behave in a security-conscious manner; that is, @@ -106,8 +106,8 @@ public class SecurityConfiguration extends XIncludeAwareParserConfiguration XMLComponentManager parentSettings) { super(symbolTable, grammarPool, parentSettings); - // create the SecurityManager property: - setProperty(SECURITY_MANAGER_PROPERTY, new SecurityManager()); + // create the XMLSecurityManager property: + setProperty(SECURITY_MANAGER_PROPERTY, new XMLSecurityManager()); } // (SymbolTable,XMLGrammarPool) } // class SecurityConfiguration diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java deleted file mode 100644 index dd510b622bc..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * The Apache Software License, Version 1.1 - * - * - * Copyright (c) 2003 The Apache Software Foundation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.apache.org. For more - * information on the Apache Software Foundation, please see - * . - */ - -package com.sun.org.apache.xerces.internal.util; -import com.sun.org.apache.xerces.internal.impl.Constants; -import java.security.AccessController; -import java.security.PrivilegedAction; -/** - * This class is a container for parser settings that relate to - * security, or more specifically, it is intended to be used to prevent denial-of-service - * attacks from being launched against a system running Xerces. - * Any component that is aware of a denial-of-service attack that can arise - * from its processing of a certain kind of document may query its Component Manager - * for the property (http://apache.org/xml/properties/security-manager) - * whose value will be an instance of this class. - * If no value has been set for the property, the component should proceed in the "usual" (spec-compliant) - * manner. If a value has been set, then it must be the case that the component in - * question needs to know what method of this class to query. This class - * will provide defaults for all known security issues, but will also provide - * setters so that those values can be tailored by applications that care. - * - * @author Neil Graham, IBM - * - * @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $ - */ -public final class SecurityManager { - - // - // Constants - // - - // default value for entity expansion limit - private final static int DEFAULT_ENTITY_EXPANSION_LIMIT = 64000; - - /** Default value of number of nodes created. **/ - private final static int DEFAULT_MAX_OCCUR_NODE_LIMIT = 5000; - - // - // Data - // - - private final static int DEFAULT_ELEMENT_ATTRIBUTE_LIMIT = 10000; - - /** Entity expansion limit. **/ - private int entityExpansionLimit; - - /** W3C XML Schema maxOccurs limit. **/ - private int maxOccurLimit; - - private int fElementAttributeLimit; - // default constructor. Establishes default values for - // all known security holes. - /** - * Default constructor. Establishes default values - * for known security vulnerabilities. - */ - public SecurityManager() { - entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT ; - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - //We are reading system properties only once , - //at the time of creation of this object , - readSystemProperties(); - } - - /** - *

    Sets the number of entity expansions that the - * parser should permit in a document.

    - * - * @param limit the number of entity expansions - * permitted in a document - */ - public void setEntityExpansionLimit(int limit) { - entityExpansionLimit = limit; - } - - /** - *

    Returns the number of entity expansions - * that the parser permits in a document.

    - * - * @return the number of entity expansions - * permitted in a document - */ - public int getEntityExpansionLimit() { - return entityExpansionLimit; - } - - /** - *

    Sets the limit of the number of content model nodes - * that may be created when building a grammar for a W3C - * XML Schema that contains maxOccurs attributes with values - * other than "unbounded".

    - * - * @param limit the maximum value for maxOccurs other - * than "unbounded" - */ - public void setMaxOccurNodeLimit(int limit){ - maxOccurLimit = limit; - } - - /** - *

    Returns the limit of the number of content model nodes - * that may be created when building a grammar for a W3C - * XML Schema that contains maxOccurs attributes with values - * other than "unbounded".

    - * - * @return the maximum value for maxOccurs other - * than "unbounded" - */ - public int getMaxOccurNodeLimit(){ - return maxOccurLimit; - } - - public int getElementAttrLimit(){ - return fElementAttributeLimit; - } - - public void setElementAttrLimit(int limit){ - fElementAttributeLimit = limit; - } - - private void readSystemProperties(){ - - //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT - try { - String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT); - if(value != null && !value.equals("")){ - entityExpansionLimit = Integer.parseInt(value); - if (entityExpansionLimit < 0) - entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - } - else - entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - }catch(Exception ex){} - - try { - String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT); - if(value != null && !value.equals("")){ - maxOccurLimit = Integer.parseInt(value); - if (maxOccurLimit < 0) - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; - } - else - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; - }catch(Exception ex){} - - try { - String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); - if(value != null && !value.equals("")){ - fElementAttributeLimit = Integer.parseInt(value); - if ( fElementAttributeLimit < 0) - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - } - else - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - - }catch(Exception ex){} - - } - - private String getSystemProperty(final String propName) { - return AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty(propName); - } - }); - } -} // class SecurityManager diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java index b3d9ed7f925..8e62c1f1d75 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java @@ -173,7 +173,7 @@ public class SymbolTable { for (int i = 0; i < length; i++) { code = code * 37 + symbol.charAt(i); } - return code & 0x7FFFFFF; + return code & 0x7FFFFFFF; } // hash(String):int @@ -194,7 +194,7 @@ public class SymbolTable { for (int i = 0; i < length; i++) { code = code * 37 + buffer[offset + i]; } - return code & 0x7FFFFFF; + return code & 0x7FFFFFFF; } // hash(char[],int,int):int diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java new file mode 100644 index 00000000000..f70aeb7cb21 --- /dev/null +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.org.apache.xerces.internal.utils; + +import com.sun.org.apache.xerces.internal.impl.Constants; + +/** + * This class manages standard and implementation-specific limitations. + * + */ +public final class XMLSecurityManager { + + /** + * States of the settings of a property, in the order: default value, value + * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system + * properties, and jaxp api properties + */ + public static enum State { + //this order reflects the overriding order + DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY + } + + /** + * Limits managed by the security manager + */ + public static enum Limit { + ENTITY_EXPANSION_LIMIT(64000), + MAX_OCCUR_NODE_LIMIT(5000), + ELEMENT_ATTRIBUTE_LIMIT(10000); + + final int defaultValue; + + Limit(int value) { + this.defaultValue = value; + } + + int defaultValue() { + return defaultValue; + } + } + + /** + * Values of the limits as defined in enum Limit + */ + private final int[] limits; + /** + * States of the settings for each limit in limits above + */ + private State[] states = {State.DEFAULT, State.DEFAULT, State.DEFAULT, State.DEFAULT}; + + /** + * Default constructor. Establishes default values for known security + * vulnerabilities. + */ + public XMLSecurityManager() { + limits = new int[Limit.values().length]; + for (Limit limit : Limit.values()) { + limits[limit.ordinal()] = limit.defaultValue(); + } + //read system properties or jaxp.properties + readSystemProperties(); + } + + /** + * Sets the limit for a specific type of XML constructs. This can be either + * the size or the number of the constructs. + * + * @param type the type of limitation + * @param state the state of limitation + * @param limit the limit to the type + */ + public void setLimit(Limit limit, State state, int value) { + //only update if it shall override + if (state.compareTo(states[limit.ordinal()]) >= 0) { + limits[limit.ordinal()] = value; + states[limit.ordinal()] = state; + } + } + + /** + * Returns the limit set for the type specified + * + * @param limit the type of limitation + * @return the limit to the type + */ + public int getLimit(Limit limit) { + return limits[limit.ordinal()]; + } + + /** + * Read from system properties, or those in jaxp.properties + */ + private void readSystemProperties() { + getSystemProperty(Limit.ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT); + getSystemProperty(Limit.MAX_OCCUR_NODE_LIMIT, Constants.MAX_OCCUR_LIMIT); + getSystemProperty(Limit.ELEMENT_ATTRIBUTE_LIMIT, + Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); + } + + /** + * Read from system properties, or those in jaxp.properties + * + * @param limit the type of the property + * @param property the property name + */ + private void getSystemProperty(Limit limit, String property) { + try { + String value = SecuritySupport.getSystemProperty(property); + if (value != null && !value.equals("")) { + limits[limit.ordinal()] = Integer.parseInt(value); + states[limit.ordinal()] = State.SYSTEMPROPERTY; + return; + } + + value = SecuritySupport.readJAXPProperty(property); + if (value != null && !value.equals("")) { + limits[limit.ordinal()] = Integer.parseInt(value); + states[limit.ordinal()] = State.JAXPDOTPROPERTIES; + } + } catch (NumberFormatException e) { + //invalid setting ignored + } + } +} diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java index ba7284609e1..228cd72216d 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java @@ -37,7 +37,6 @@ import com.sun.org.apache.xerces.internal.util.AugmentationsImpl; import com.sun.org.apache.xerces.internal.util.HTTPInputSource; import com.sun.org.apache.xerces.internal.util.IntStack; import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; -import com.sun.org.apache.xerces.internal.util.SecurityManager; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.URI; import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; @@ -45,6 +44,7 @@ import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; @@ -292,7 +292,7 @@ public class XIncludeHandler protected SymbolTable fSymbolTable; protected XMLErrorReporter fErrorReporter; protected XMLEntityResolver fEntityResolver; - protected SecurityManager fSecurityManager; + protected XMLSecurityManager fSecurityManager; /** * comma-delimited list of protocols that are allowed for the purpose * of accessing external dtd or entity references @@ -525,8 +525,8 @@ public class XIncludeHandler // Get security manager. try { - SecurityManager value = - (SecurityManager)componentManager.getProperty( + XMLSecurityManager value = + (XMLSecurityManager)componentManager.getProperty( SECURITY_MANAGER); if (value != null) { @@ -681,7 +681,7 @@ public class XIncludeHandler return; } if (propertyId.equals(SECURITY_MANAGER)) { - fSecurityManager = (SecurityManager)value; + fSecurityManager = (XMLSecurityManager)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } diff --git a/jaxp/src/com/sun/xml/internal/stream/Entity.java b/jaxp/src/com/sun/xml/internal/stream/Entity.java index 0ae8228a3be..7bbdf692412 100644 --- a/jaxp/src/com/sun/xml/internal/stream/Entity.java +++ b/jaxp/src/com/sun/xml/internal/stream/Entity.java @@ -248,7 +248,7 @@ public abstract class Entity { public int fBufferSize = DEFAULT_BUFFER_SIZE; /** Default buffer size before we've finished with the XMLDecl: */ - public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 28; + public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 64; /** Default internal entity buffer size (1024). */ public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 1024; From dee5d80756e5d64b1971240bc6f014686d8e824b Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Wed, 17 Jul 2013 18:46:28 +0200 Subject: [PATCH 048/983] 8013502: Improve stream factories Reviewed-by: joehw, mullan, lancea --- jaxp/src/javax/xml/stream/FactoryFinder.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jaxp/src/javax/xml/stream/FactoryFinder.java b/jaxp/src/javax/xml/stream/FactoryFinder.java index 68f4ef21d66..886caa57ee0 100644 --- a/jaxp/src/javax/xml/stream/FactoryFinder.java +++ b/jaxp/src/javax/xml/stream/FactoryFinder.java @@ -253,7 +253,13 @@ class FactoryFinder { // Use the system property first try { - String systemProp = ss.getSystemProperty(factoryId); + + final String systemProp; + if (type.getName().equals(factoryId)) { + systemProp = ss.getSystemProperty(factoryId); + } else { + systemProp = System.getProperty(factoryId); + } if (systemProp != null) { dPrint("found system property, value=" + systemProp); // There's a bug here - because 'cl' is ignored. @@ -262,7 +268,8 @@ class FactoryFinder { } } catch (SecurityException se) { - if (debug) se.printStackTrace(); + throw new FactoryConfigurationError( + "Failed to read factoryId '" + factoryId + "'", se); } // Try read $java.home/lib/stax.properties followed by From eef8299094596d609d610228ba0775a04f6b6108 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 19 Jul 2013 16:29:26 +0200 Subject: [PATCH 049/983] 8019584: javax/management/remote/mandatory/loading/MissingClassTest.java failed in nightly against jdk7u45: java.io.InvalidObjectException: Invalid notification: null Reviewed-by: mchung, sjiang, dfuchs, ahgross --- .../management/remote/NotificationResult.java | 17 +++++++++-------- .../management/remote/TargetedNotification.java | 8 ++------ .../mandatory/loading/MissingClassTest.java | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/jdk/src/share/classes/javax/management/remote/NotificationResult.java b/jdk/src/share/classes/javax/management/remote/NotificationResult.java index 9e7cfaac31d..ff3978d99eb 100644 --- a/jdk/src/share/classes/javax/management/remote/NotificationResult.java +++ b/jdk/src/share/classes/javax/management/remote/NotificationResult.java @@ -132,16 +132,17 @@ public class NotificationResult implements Serializable { } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - ObjectInputStream.GetField gf = ois.readFields(); - TargetedNotification[] tNotifs = (TargetedNotification[])gf.get("targetedNotifications", null); - long snStart = gf.get("earliestSequenceNumber", -1L); - long snNext = gf.get("nextSequenceNumber", -1L); + ois.defaultReadObject(); try { - validate(tNotifs, snStart, snNext); + validate( + this.targetedNotifications, + this.earliestSequenceNumber, + this.nextSequenceNumber + ); - this.targetedNotifications = tNotifs.length == 0 ? tNotifs : tNotifs.clone(); - this.earliestSequenceNumber = snStart; - this.nextSequenceNumber = snNext; + this.targetedNotifications = this.targetedNotifications.length == 0 ? + this.targetedNotifications : + this.targetedNotifications.clone(); } catch (IllegalArgumentException e) { throw new InvalidObjectException(e.getMessage()); } diff --git a/jdk/src/share/classes/javax/management/remote/TargetedNotification.java b/jdk/src/share/classes/javax/management/remote/TargetedNotification.java index 03aa0ca6235..cc3d0dcc664 100644 --- a/jdk/src/share/classes/javax/management/remote/TargetedNotification.java +++ b/jdk/src/share/classes/javax/management/remote/TargetedNotification.java @@ -132,13 +132,9 @@ public class TargetedNotification implements Serializable { // } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - ObjectInputStream.GetField gf = ois.readFields(); - Notification notification = (Notification)gf.get("notif", null); - Integer listenerId = (Integer)gf.get("id", null); + ois.defaultReadObject(); try { - validate(notification, listenerId); - this.notif = notification; - this.id = listenerId; + validate(this.notif, this.id); } catch (IllegalArgumentException e) { throw new InvalidObjectException(e.getMessage()); } diff --git a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java index e70d0adfe6e..98eead895bf 100644 --- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java +++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4915825 4921009 4934965 4977469 + * @bug 4915825 4921009 4934965 4977469 8019584 * @summary Tests behavior when client or server gets object of unknown class * @author Eamonn McManus * @run clean MissingClassTest SingleClassLoader From 5b17a5cd6dc3ab591cc6a78cc394ed3fcbbb5c09 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 22 Jul 2013 19:38:08 -0700 Subject: [PATCH 050/983] 8017196: Ensure Proxies are handled appropriately Reviewed-by: dfuchs, jrose, jdn, ahgross, chegar --- .../rmi/InvocationHandlerFactoryImpl.java | 14 ++++++++++++-- .../proxy/CompositeInvocationHandlerImpl.java | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java index 37a5968d87d..076ed1929ea 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java @@ -43,6 +43,8 @@ import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ; import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ; import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ; +import java.security.AccessController; +import java.security.PrivilegedAction; public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory { @@ -114,24 +116,32 @@ public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory // which extends org.omg.CORBA.Object. This handler delegates all // calls directly to a DynamicStubImpl, which extends // org.omg.CORBA.portable.ObjectImpl. - InvocationHandler dynamicStubHandler = + final InvocationHandler dynamicStubHandler = DelegateInvocationHandlerImpl.create( stub ) ; // Create an invocation handler that handles any remote interface // methods. - InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl( + final InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl( pm, classData, stub ) ; // Create a composite handler that handles the DynamicStub interface // as well as the remote interfaces. final CompositeInvocationHandler handler = new CustomCompositeInvocationHandlerImpl( stub ) ; + + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { handler.addInvocationHandler( DynamicStub.class, dynamicStubHandler ) ; handler.addInvocationHandler( org.omg.CORBA.Object.class, dynamicStubHandler ) ; handler.addInvocationHandler( Object.class, dynamicStubHandler ) ; + return null; + } + }); + // If the method passed to invoke is not from DynamicStub or its superclasses, // it must be from an implemented interface, so we just handle diff --git a/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java b/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java index fb81ceee29c..91aacd5afae 100644 --- a/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java @@ -36,6 +36,7 @@ import java.lang.reflect.InvocationHandler ; import com.sun.corba.se.spi.logging.CORBALogDomains ; import com.sun.corba.se.impl.logging.ORBUtilSystemException ; +import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission; public class CompositeInvocationHandlerImpl implements CompositeInvocationHandler @@ -46,11 +47,13 @@ public class CompositeInvocationHandlerImpl implements public void addInvocationHandler( Class interf, InvocationHandler handler ) { + checkAccess(); classToInvocationHandler.put( interf, handler ) ; } public void setDefaultHandler( InvocationHandler handler ) { + checkAccess(); defaultHandler = handler ; } @@ -78,4 +81,12 @@ public class CompositeInvocationHandlerImpl implements return handler.invoke( proxy, method, args ) ; } + + private static final DynamicAccessPermission perm = new DynamicAccessPermission("access"); + private void checkAccess() { + final SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(perm); +} + } } From 99860de3cd08c11752b465c31a4257118d70ac28 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Wed, 24 Jul 2013 12:03:57 -0700 Subject: [PATCH 051/983] 8020293: JVM crash Reviewed-by: prr, jgodinez --- jdk/src/share/classes/sun/font/GlyphLayout.java | 7 ++++--- jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/sun/font/GlyphLayout.java b/jdk/src/share/classes/sun/font/GlyphLayout.java index d29ecf34cb2..f2fc484caa0 100644 --- a/jdk/src/share/classes/sun/font/GlyphLayout.java +++ b/jdk/src/share/classes/sun/font/GlyphLayout.java @@ -468,9 +468,10 @@ public final class GlyphLayout { _gvdata.grow(); } } - if (_gvdata._count < 0) { - break; - } + } + // Break out of the outer for loop if layout fails. + if (_gvdata._count < 0) { + break; } } diff --git a/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp index b32f2601b4d..858e3636038 100644 --- a/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp @@ -104,6 +104,10 @@ Java_sun_font_SunLayoutEngine_initGVIDs int putGV(JNIEnv* env, jint gmask, jint baseIndex, jobject gvdata, const LayoutEngine* engine, int glyphCount) { int count = env->GetIntField(gvdata, gvdCountFID); + if (count < 0) { + JNU_ThrowInternalError(env, "count negative"); + return 0; + } jarray glyphArray = (jarray)env->GetObjectField(gvdata, gvdGlyphsFID); if (IS_NULL(glyphArray)) { From dd0661e5adf498ddb6857b438c245341ae3b9e04 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Wed, 24 Jul 2013 15:18:33 -0700 Subject: [PATCH 052/983] 8016675: Make Javadoc pages more robust Reviewed-by: jlaskey, ksrini --- .../formats/html/markup/HtmlWriter.java | 49 ++++++++++- .../testWindowTitle/TestWindowTitle.java | 82 +++++++++++++++++++ .../sun/javadoc/testWindowTitle/p1/C1.java | 27 ++++++ .../sun/javadoc/testWindowTitle/p2/C2.java | 27 ++++++ 4 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java create mode 100644 langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java create mode 100644 langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java index 5369733893b..c58e9a66e57 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java @@ -290,7 +290,7 @@ public class HtmlWriter { script.addAttr(HtmlAttr.TYPE, "text/javascript"); String scriptCode = "" + DocletConstants.NL; RawHtml scriptContent = new RawHtml(scriptCode); @@ -299,6 +299,53 @@ public class HtmlWriter { return script; } + /** + * Returns a String with escaped special JavaScript characters. + * + * @param s String that needs to be escaped + * @return a valid escaped JavaScript string + */ + private static String escapeJavaScriptChars(String s) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + char ch = s.charAt(i); + switch (ch) { + case '\b': + sb.append("\\b"); + break; + case '\t': + sb.append("\\t"); + break; + case '\n': + sb.append("\\n"); + break; + case '\f': + sb.append("\\f"); + break; + case '\r': + sb.append("\\r"); + break; + case '"': + sb.append("\\\""); + break; + case '\'': + sb.append("\\\'"); + break; + case '\\': + sb.append("\\\\"); + break; + default: + if (ch < 32 || ch >= 127) { + sb.append(String.format("\\u%04X", (int)ch)); + } else { + sb.append(ch); + } + break; + } + } + return sb.toString(); + } + /** * Returns a content tree for the SCRIPT tag for the main page(index.html). * diff --git a/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java new file mode 100644 index 00000000000..ca4c96ae693 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8016675 + * @summary Test for window title. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestWindowTitle + * @run main TestWindowTitle + */ + +public class TestWindowTitle extends JavadocTester { + + private static final String BUG_ID = "8016675"; + private static final String WIN_TITLE = + "Testing \"Window 'Title'\" with a \\ backslash and a / " + + "forward slash and a \u00e8 unicode char also a tab and also a " + + "\t special character another \u0002 unicode)"; + private static final String[][] TEST = { + {BUG_ID + FS + "overview-summary.html", + "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " + + "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " + + "also a tab and also a \\t special character another \\u0002 unicode))\";" + }, + }; + private static final String[][] NEG_TEST = { + {BUG_ID + FS + "overview-summary.html", + "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " + + "with a \\ backslash and a / forward slash and a \u00E8 unicode char " + + "also a tab and also a \t special character another \u0002 unicode))\";" + }, + }; + private static final String[] ARGS = new String[]{ + "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2" + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestWindowTitle tester = new TestWindowTitle(); + run(tester, ARGS, TEST, NEG_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff --git a/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java b/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java new file mode 100644 index 00000000000..239d7a63de0 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p1; + +public class C1 { +} diff --git a/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java b/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java new file mode 100644 index 00000000000..7d075a6fd9f --- /dev/null +++ b/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p2; + +public class C2 { +} From 7abc885152c1d3036c9aaae323a2b7aff39f282b Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 29 Jul 2013 04:43:41 -0700 Subject: [PATCH 053/983] 8021577: JCK test api/javax_management/jmx_serial/modelmbean/ModelMBeanNotificationInfo/serial/index.html#Input has failed since jdk 7u45 b01 Reviewed-by: alanb, dfuchs, ahgross --- .../classes/javax/management/MBeanNotificationInfo.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java index dfa4ab1f8ff..e3b4aba1252 100644 --- a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java @@ -210,11 +210,6 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable ObjectInputStream.GetField gf = ois.readFields(); String[] t = (String[])gf.get("types", null); - if (t == null) { - throw new InvalidObjectException("Trying to deserialize an invalid " + - "instance of " + MBeanNotificationInfo.class + - "[types=null]"); - } - types = t.length == 0 ? t : t.clone(); + types = (t != null && t.length != 0) ? t.clone() : NO_TYPES; } } From 298bc0138712763e4d5c81ec4920abac454929d2 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 31 Jul 2013 00:37:01 -0700 Subject: [PATCH 054/983] 8014530: Better digital signature processing Reviewed-by: alanb, dfuchs, mullan, lancea --- .../apache/xalan/internal/XalanConstants.java | 121 ++++- .../internal/utils/XMLSecurityManager.java | 449 +++++++++++++++++ .../utils/XMLSecurityPropertyManager.java | 33 ++ .../xalan/internal/xsltc/compiler/Import.java | 2 +- .../internal/xsltc/compiler/Include.java | 2 +- .../xalan/internal/xsltc/compiler/Parser.java | 17 +- .../xalan/internal/xsltc/compiler/XSLTC.java | 11 +- .../xsltc/trax/TemplatesHandlerImpl.java | 4 +- .../xsltc/trax/TransformerFactoryImpl.java | 35 +- .../internal/xsltc/trax/TransformerImpl.java | 4 + .../xalan/internal/xsltc/trax/Util.java | 18 + .../internal/dom/DOMConfigurationImpl.java | 8 + .../xerces/internal/impl/Constants.java | 108 ++++- .../xerces/internal/impl/PropertyManager.java | 24 +- .../impl/XML11NSDocumentScannerImpl.java | 4 +- .../internal/impl/XMLDTDScannerImpl.java | 64 ++- .../impl/XMLDocumentFragmentScannerImpl.java | 61 ++- .../internal/impl/XMLEntityManager.java | 51 +- .../impl/XMLNSDocumentScannerImpl.java | 4 +- .../xerces/internal/impl/XMLScanner.java | 21 +- .../internal/impl/msg/XMLMessages.properties | 10 +- .../impl/xs/models/CMNodeFactory.java | 3 +- .../xs/traversers/XSAttributeChecker.java | 2 +- .../internal/jaxp/DocumentBuilderImpl.java | 29 +- .../xerces/internal/jaxp/SAXParserImpl.java | 94 ++-- .../jaxp/validation/StAXValidatorHelper.java | 14 + .../validation/StreamValidatorHelper.java | 2 + .../jaxp/validation/XMLSchemaFactory.java | 27 +- .../XMLSchemaValidatorComponentManager.java | 49 +- .../xerces/internal/parsers/SAXParser.java | 25 +- .../parsers/SecurityConfiguration.java | 5 +- .../internal/parsers/XML11Configuration.java | 18 +- .../internal/utils/XMLLimitAnalyzer.java | 236 +++++++++ .../internal/utils/XMLSecurityManager.java | 452 ++++++++++++++++-- .../utils/XMLSecurityPropertyManager.java | 35 ++ .../xml/internal/utils/XMLReaderManager.java | 26 +- 36 files changed, 1862 insertions(+), 206 deletions(-) create mode 100644 jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java create mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java index ce50626a612..f4a80afacfe 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java @@ -39,6 +39,116 @@ public final class XalanConstants { // // Constants // + //Xerces security manager + public static final String SECURITY_MANAGER = + "http://apache.org/xml/properties/security-manager"; + + // + // Implementation limits: API properties + // + /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ + public static final String ORACLE_JAXP_PROPERTY_PREFIX = + "http://www.oracle.com/xml/jaxp/properties/"; + /** + * JDK entity expansion limit; Note that the existing system property + * "entityExpansionLimit" with no prefix is still observed + */ + public static final String JDK_ENTITY_EXPANSION_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; + + /** + * JDK element attribute limit; Note that the existing system property + * "elementAttributeLimit" with no prefix is still observed + */ + public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; + + /** + * JDK maxOccur limit; Note that the existing system property + * "maxOccurLimit" with no prefix is still observed + */ + public static final String JDK_MAX_OCCUR_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit"; + + /** + * JDK total entity size limit + */ + public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit"; + + /** + * JDK maximum general entity size limit + */ + public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit"; + /** + * JDK maximum parameter entity size limit + */ + public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit"; + /** + * JDK maximum XML name limit + */ + public static final String JDK_XML_NAME_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit"; + /** + * JDK property indicating whether the parser shall print out entity + * count information + * Value: a string "yes" means print, "no" or any other string means not. + */ + public static final String JDK_ENTITY_COUNT_INFO = + ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo"; + + // + // Implementation limits: corresponding System Properties of the above + // API properties + // + /** + * JDK entity expansion limit; Note that the existing system property + * "entityExpansionLimit" with no prefix is still observed + */ + public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit"; + + /** + * JDK element attribute limit; Note that the existing system property + * "elementAttributeLimit" with no prefix is still observed + */ + public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit"; + + /** + * JDK maxOccur limit; Note that the existing system property + * "maxOccurLimit" with no prefix is still observed + */ + public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit"; + + /** + * JDK total entity size limit + */ + public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit"; + + /** + * JDK maximum general entity size limit + */ + public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit"; + /** + * JDK maximum parameter entity size limit + */ + public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit"; + /** + * JDK maximum XML name limit + */ + public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit"; + + //legacy System Properties + public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; + public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; + public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; + + /** + * A string "yes" that can be used for properties such as getEntityCountInfo + */ + public static final String JDK_YES = "yes"; + // Oracle Feature: /** *

    Use Service Mechanism

    @@ -51,21 +161,16 @@ public final class XalanConstants { *
  • * {@code false} instruct an object to skip service mechanism and * use the default implementation for that service. - *
  • - * - */ - + * + * + */ public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism"; - /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ - public static final String ORACLE_JAXP_PROPERTY_PREFIX = - "http://www.oracle.com/xml/jaxp/properties/"; //System Properties corresponding to ACCESS_EXTERNAL_* properties public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet"; public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; - //all access keyword public static final String ACCESS_EXTERNAL_ALL = "all"; diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java new file mode 100644 index 00000000000..99a8e2d5f69 --- /dev/null +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java @@ -0,0 +1,449 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package com.sun.org.apache.xalan.internal.utils; + +import com.sun.org.apache.xalan.internal.XalanConstants; + + +/** + * This class is not the same as that in Xerces. It is used to manage the + * state of corresponding Xerces properties and pass the values over to + * the Xerces Security Manager. + * + * @author Joe Wang Oracle Corp. + * + */ +public final class XMLSecurityManager { + + /** + * States of the settings of a property, in the order: default value, value + * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system + * properties, and jaxp api properties + */ + public static enum State { + //this order reflects the overriding order + + DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), + JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"), + APIPROPERTY("property"); + + final String literal; + State(String literal) { + this.literal = literal; + } + + String literal() { + return literal; + } + } + + /** + * Limits managed by the security manager + */ + public static enum Limit { + + ENTITY_EXPANSION_LIMIT(XalanConstants.JDK_ENTITY_EXPANSION_LIMIT, + XalanConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), + MAX_OCCUR_NODE_LIMIT(XalanConstants.JDK_MAX_OCCUR_LIMIT, + XalanConstants.SP_MAX_OCCUR_LIMIT, 0, 5000), + ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT, + XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), + TOTAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT, + XalanConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), + GENEAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_GENEAL_ENTITY_SIZE_LIMIT, + XalanConstants.SP_GENEAL_ENTITY_SIZE_LIMIT, 0, 0), + PARAMETER_ENTITY_SIZE_LIMIT(XalanConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, + XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000); + + final String apiProperty; + final String systemProperty; + final int defaultValue; + final int secureValue; + + Limit(String apiProperty, String systemProperty, int value, int secureValue) { + this.apiProperty = apiProperty; + this.systemProperty = systemProperty; + this.defaultValue = value; + this.secureValue = secureValue; + } + + public boolean equalsAPIPropertyName(String propertyName) { + return (propertyName == null) ? false : apiProperty.equals(propertyName); + } + + public boolean equalsSystemPropertyName(String propertyName) { + return (propertyName == null) ? false : systemProperty.equals(propertyName); + } + + public String apiProperty() { + return apiProperty; + } + + String systemProperty() { + return systemProperty; + } + + int defaultValue() { + return defaultValue; + } + + int secureValue() { + return secureValue; + } + } + + /** + * Map old property names with the new ones + */ + public static enum NameMap { + + ENTITY_EXPANSION_LIMIT(XalanConstants.SP_ENTITY_EXPANSION_LIMIT, + XalanConstants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(XalanConstants.SP_MAX_OCCUR_LIMIT, + XalanConstants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, + XalanConstants.ELEMENT_ATTRIBUTE_LIMIT); + final String newName; + final String oldName; + + NameMap(String newName, String oldName) { + this.newName = newName; + this.oldName = oldName; + } + + String getOldName(String newName) { + if (newName.equals(this.newName)) { + return oldName; + } + return null; + } + } + /** + * Values of the properties + */ + private final int[] values; + /** + * States of the settings for each property + */ + private State[] states; + /** + * States that determine if properties are set explicitly + */ + private boolean[] isSet; + + + /** + * Index of the special entityCountInfo property + */ + private int indexEntityCountInfo = 10000; + private String printEntityCountInfo = ""; + + /** + * Default constructor. Establishes default values for known security + * vulnerabilities. + */ + public XMLSecurityManager() { + this(false); + } + + /** + * Instantiate Security Manager in accordance with the status of + * secure processing + * @param secureProcessing + */ + public XMLSecurityManager(boolean secureProcessing) { + values = new int[Limit.values().length]; + states = new State[Limit.values().length]; + isSet = new boolean[Limit.values().length]; + for (Limit limit : Limit.values()) { + if (secureProcessing) { + values[limit.ordinal()] = limit.secureValue(); + states[limit.ordinal()] = State.FSP; + } else { + values[limit.ordinal()] = limit.defaultValue(); + states[limit.ordinal()] = State.DEFAULT; + } + } + //read system properties or jaxp.properties + readSystemProperties(); + } + + /** + * Setting FEATURE_SECURE_PROCESSING explicitly + */ + public void setSecureProcessing(boolean secure) { + for (Limit limit : Limit.values()) { + if (secure) { + setLimit(limit.ordinal(), State.FSP, limit.secureValue()); + } else { + setLimit(limit.ordinal(), State.FSP, limit.defaultValue()); + } + } + } + + /** + * Set limit by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security manager; false + * if otherwise. + */ + public boolean setLimit(String propertyName, State state, Object value) { + int index = getIndex(propertyName); + if (index > -1) { + setLimit(index, state, value); + return true; + } + return false; + } + + /** + * Set the value for a specific limit. + * + * @param limit the limit + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(Limit limit, State state, int value) { + setLimit(limit.ordinal(), state, value); + } + + /** + * Set the value of a property by its index + * + * @param index the index of the property + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(int index, State state, Object value) { + if (index == indexEntityCountInfo) { + //if it's explicitly set, it's treated as yes no matter the value + printEntityCountInfo = (String)value; + } else { + int temp = 0; + try { + temp = Integer.parseInt((String) value); + if (temp < 0) { + temp = 0; + } + } catch (NumberFormatException e) {} + setLimit(index, state, temp); } + } + + /** + * Set the value of a property by its index + * + * @param index the index of the property + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(int index, State state, int value) { + if (index == indexEntityCountInfo) { + //if it's explicitly set, it's treated as yes no matter the value + printEntityCountInfo = XalanConstants.JDK_YES; + } else { + //only update if it shall override + if (state.compareTo(states[index]) >= 0) { + values[index] = value; + states[index] = state; + isSet[index] = true; + } + } + } + + + /** + * Return the value of the specified property. + * + * @param propertyName the property name + * @return the value of the property as a string. If a property is managed + * by this manager, its value shall not be null. + */ + public String getLimitAsString(String propertyName) { + int index = getIndex(propertyName); + if (index > -1) { + return getLimitValueByIndex(index); + } + + return null; + } + + /** + * Return the value of a property by its ordinal + * + * @param limit the property + * @return value of a property + */ + public String getLimitValueAsString(Limit limit) { + return Integer.toString(values[limit.ordinal()]); + } + + /** + * Return the value of the specified property + * + * @param limit the property + * @return the value of the property + */ + public int getLimit(Limit limit) { + return values[limit.ordinal()]; + } + + /** + * Return the value of a property by its ordinal + * + * @param index the index of a property + * @return value of a property + */ + public int getLimitByIndex(int index) { + return values[index]; + } + /** + * Return the value of a property by its index + * + * @param index the index of a property + * @return limit of a property as a string + */ + public String getLimitValueByIndex(int index) { + if (index == indexEntityCountInfo) { + return printEntityCountInfo; + } + + return Integer.toString(values[index]); + } + /** + * Return the state of the limit property + * + * @param limit the limit + * @return the state of the limit property + */ + public State getState(Limit limit) { + return states[limit.ordinal()]; + } + + /** + * Return the state of the limit property + * + * @param limit the limit + * @return the state of the limit property + */ + public String getStateLiteral(Limit limit) { + return states[limit.ordinal()].literal(); + } + + /** + * Get the index by property name + * + * @param propertyName property name + * @return the index of the property if found; return -1 if not + */ + public int getIndex(String propertyName) { + for (Limit limit : Limit.values()) { + if (limit.equalsAPIPropertyName(propertyName)) { + //internally, ordinal is used as index + return limit.ordinal(); + } + } + //special property to return entity count info + if (propertyName.equals(XalanConstants.JDK_ENTITY_COUNT_INFO)) { + return indexEntityCountInfo; + } + return -1; + } + + /** + * Indicate if a property is set explicitly + * @param index + * @return + */ + public boolean isSet(int index) { + return isSet[index]; + } + + public boolean printEntityCountInfo() { + return printEntityCountInfo.equals(XalanConstants.JDK_YES); + } + /** + * Read from system properties, or those in jaxp.properties + */ + private void readSystemProperties() { + + for (Limit limit : Limit.values()) { + if (!getSystemProperty(limit, limit.systemProperty())) { + //if system property is not found, try the older form if any + for (NameMap nameMap : NameMap.values()) { + String oldName = nameMap.getOldName(limit.systemProperty()); + if (oldName != null) { + getSystemProperty(limit, oldName); + } + } + } + } + + } + + /** + * Read from system properties, or those in jaxp.properties + * + * @param property the type of the property + * @param sysPropertyName the name of system property + */ + private boolean getSystemProperty(Limit limit, String sysPropertyName) { + try { + String value = SecuritySupport.getSystemProperty(sysPropertyName); + if (value != null && !value.equals("")) { + values[limit.ordinal()] = Integer.parseInt(value); + states[limit.ordinal()] = State.SYSTEMPROPERTY; + return true; + } + + value = SecuritySupport.readJAXPProperty(sysPropertyName); + if (value != null && !value.equals("")) { + values[limit.ordinal()] = Integer.parseInt(value); + states[limit.ordinal()] = State.JAXPDOTPROPERTIES; + return true; + } + } catch (NumberFormatException e) { + //invalid setting + throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty()); + } + return false; + } +} diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java index 5f5501a3434..35dc9a5d04b 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java @@ -93,6 +93,23 @@ public final class XMLSecurityPropertyManager { readSystemProperties(); } + /** + * Set limit by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security property manager; + * false if otherwise. + */ + public boolean setValue(String propertyName, State state, Object value) { + int index = getIndex(propertyName); + if (index > -1) { + setValue(index, state, (String)value); + return true; + } + return false; + } + /** * Set the value for a specific property. * @@ -121,6 +138,22 @@ public final class XMLSecurityPropertyManager { states[index] = state; } } + + /** + * Return the value of the specified property + * + * @param propertyName the property name + * @return the value of the property as a string + */ + public String getValue(String propertyName) { + int index = getIndex(propertyName); + if (index > -1) { + return getValueByIndex(index); + } + + return null; + } + /** * Return the value of the specified property * diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java index fdfbe178d1d..e1971d35c06 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java @@ -86,7 +86,7 @@ final class Import extends TopLevelElement { if (input == null) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); String accessError = SecuritySupport.checkAccess(docToLoad, - xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), + (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), XalanConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java index 71c129f7cca..5bf12f8dc1b 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java @@ -87,7 +87,7 @@ final class Include extends TopLevelElement { if (input == null) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); String accessError = SecuritySupport.checkAccess(docToLoad, - xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), + (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), XalanConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java index 3c186a1172b..0903d9a9ef6 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java @@ -28,6 +28,7 @@ import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; @@ -487,6 +488,20 @@ public class Parser implements Constants, ContentHandler { } final XMLReader reader = parser.getXMLReader(); + try { + XMLSecurityManager securityManager = + (XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER); + for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { + reader.setProperty(limit.apiProperty(), securityManager.getLimitValueAsString(limit)); + } + if (securityManager.printEntityCountInfo()) { + parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + } + } catch (SAXException se) { + System.err.println("Warning: " + reader.getClass().getName() + ": " + + se.getMessage()); + } + return(parse(reader, input)); } catch (ParserConfigurationException e) { @@ -565,7 +580,7 @@ public class Parser implements Constants, ContentHandler { } path = SystemIDResolver.getAbsoluteURI(path); String accessError = SecuritySupport.checkAccess(path, - _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), + (String)_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), XalanConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR, diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java index 97fff3bf2e0..10823f14689 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java @@ -44,11 +44,11 @@ import javax.xml.XMLConstants; import com.sun.org.apache.bcel.internal.classfile.JavaClass; import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; import com.sun.org.apache.xml.internal.dtm.DTM; -import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; @@ -146,6 +146,7 @@ public final class XSLTC { */ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private XMLSecurityManager _xmlSecurityManager; /** * XSLTC compiler constructor @@ -184,12 +185,14 @@ public final class XSLTC { /** * Return allowed protocols for accessing external stylesheet. */ - public String getProperty(String name) { + public Object getProperty(String name) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) { return _accessExternalStylesheet; } else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { return _accessExternalDTD; + } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + return _xmlSecurityManager; } return null; } @@ -197,12 +200,14 @@ public final class XSLTC { /** * Set allowed protocols for accessing external stylesheet. */ - public void setProperty(String name, String value) { + public void setProperty(String name, Object value) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) { _accessExternalStylesheet = (String)value; } else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { _accessExternalDTD = (String)value; + } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + _xmlSecurityManager = (XMLSecurityManager)value; } } diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java index 879c1cb4de0..ff43ca9410f 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java @@ -29,7 +29,7 @@ import javax.xml.transform.Templates; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.TemplatesHandler; - +import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException; import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser; import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader; @@ -103,6 +103,8 @@ public class TemplatesHandlerImpl (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD)); + xsltc.setProperty(XalanConstants.SECURITY_MANAGER, + tfactory.getAttribute(XalanConstants.SECURITY_MANAGER)); if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING))) diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java index 874892942f9..9b6589d7aa8 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java @@ -27,6 +27,7 @@ import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State; @@ -218,13 +219,13 @@ public class TransformerFactoryImpl * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element. */ private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT; - /** * protocols allowed for external DTD references in source file and/or stylesheet. */ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; private XMLSecurityPropertyManager _xmlSecurityPropertyMgr; + private XMLSecurityManager _xmlSecurityManager; /** * javax.xml.transform.sax.TransformerFactory implementation. @@ -250,6 +251,9 @@ public class TransformerFactoryImpl Property.ACCESS_EXTERNAL_DTD); _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue( Property.ACCESS_EXTERNAL_STYLESHEET); + + //Parser's security manager + _xmlSecurityManager = new XMLSecurityManager(true); } /** @@ -311,11 +315,21 @@ public class TransformerFactoryImpl return Boolean.TRUE; else return Boolean.FALSE; + } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + return _xmlSecurityManager; } - int index = _xmlSecurityPropertyMgr.getIndex(name); - if (index > -1) { - return _xmlSecurityPropertyMgr.getValueByIndex(index); + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (_xmlSecurityManager != null) ? + _xmlSecurityManager.getLimitAsString(name) : null; + if (propertyValue != null) { + return propertyValue; + } else { + propertyValue = (_xmlSecurityPropertyMgr != null) ? + _xmlSecurityPropertyMgr.getValue(name) : null; + if (propertyValue != null) { + return propertyValue; + } } // Throw an exception for all other attributes @@ -419,10 +433,13 @@ public class TransformerFactoryImpl } } - int index = _xmlSecurityPropertyMgr.getIndex(name); - if (index > -1) { - _xmlSecurityPropertyMgr.setValue(index, - State.APIPROPERTY, (String)value); + if (_xmlSecurityManager != null && + _xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + return; + } + + if (_xmlSecurityPropertyMgr != null && + _xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { _accessExternalDTD = _xmlSecurityPropertyMgr.getValue( Property.ACCESS_EXTERNAL_DTD); _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue( @@ -473,6 +490,7 @@ public class TransformerFactoryImpl throw new TransformerConfigurationException(err.toString()); } _isNotSecureProcessing = !value; + _xmlSecurityManager.setSecureProcessing(value); // set external access restriction when FSP is explicitly set if (value && XalanConstants.IS_JDK8_OR_ABOVE) { @@ -849,6 +867,7 @@ public class TransformerFactoryImpl if (!_isNotSecureProcessing) xsltc.setSecureProcessing(true); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); + xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager); xsltc.init(); // Set a document loader (for xsl:include/import) if defined diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java index 7c33c91a8c8..6bf365fe2a7 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java @@ -25,6 +25,7 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -214,6 +215,7 @@ public final class TransformerImpl extends Transformer */ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private XMLSecurityManager _securityManager; /** * A hashtable to store parameters for the identity transform. These * are not needed during the transformation, but we must keep track of @@ -269,9 +271,11 @@ public final class TransformerImpl extends Transformer _useServicesMechanism = _tfactory.useServicesMechnism(); _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET); _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD); + _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER); _readerManager = XMLReaderManager.getInstance(_useServicesMechanism); _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing); + _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager); //_isIncremental = tfactory._incremental; } diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java index b287a351db4..4c6e02936c3 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java @@ -23,6 +23,7 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; +import com.sun.org.apache.xalan.internal.XalanConstants; import java.io.InputStream; import java.io.Reader; @@ -43,6 +44,7 @@ import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -151,6 +153,22 @@ public final class Util { + e.getMessage()); } + try { + XMLSecurityManager securityManager = + (XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER); + if (securityManager != null) { + for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { + reader.setProperty(limit.apiProperty(), + securityManager.getLimitValueAsString(limit)); + } + if (securityManager.printEntityCountInfo()) { + reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + } + } + } catch (SAXException se) { + System.err.println("Warning: " + reader.getClass().getName() + ": " + + se.getMessage()); + } xsltc.setXMLReader(reader); }catch (SAXNotRecognizedException snre ) { throw new TransformerConfigurationException diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java index 832724ac586..1e8dcd98817 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java @@ -33,6 +33,7 @@ import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; import com.sun.org.apache.xerces.internal.util.PropertyState; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.utils.ObjectFactory; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; @@ -59,6 +60,7 @@ import org.w3c.dom.DOMStringList; import org.w3c.dom.ls.LSResourceResolver; + /** * Xerces implementation of DOMConfiguration that maintains a table of recognized parameters. * @@ -156,6 +158,9 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings protected static final String SCHEMA_DV_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY; + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; + /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = Constants.XML_SECURITY_PROPERTY_MANAGER; @@ -279,6 +284,7 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings JAXP_SCHEMA_LANGUAGE, DTD_VALIDATOR_FACTORY_PROPERTY, SCHEMA_DV_FACTORY, + SECURITY_MANAGER, XML_SECURITY_PROPERTY_MANAGER }; addRecognizedProperties(recognizedProperties); @@ -313,6 +319,8 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings fValidationManager = createValidationManager(); setProperty(VALIDATION_MANAGER, fValidationManager); + setProperty(SECURITY_MANAGER, new XMLSecurityManager(true)); + setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java index bcc2a796b08..579622a7270 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java @@ -174,8 +174,6 @@ public final class Constants { /** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */ public static final String SCHEMA_LANGUAGE = "schemaLanguage"; - public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; - /** JAXP Standard property prefix ("http://javax.xml.XMLConstants/property/"). */ public static final String JAXPAPI_PROPERTY_PREFIX = "http://javax.xml.XMLConstants/property/"; @@ -208,6 +206,107 @@ public final class Constants { */ public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8); + // + // Implementation limits: corresponding System Properties of the above + // API properties + // + /** + * JDK entity expansion limit; Note that the existing system property + * "entityExpansionLimit" with no prefix is still observed + */ + public static final String JDK_ENTITY_EXPANSION_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; + + /** + * JDK element attribute limit; Note that the existing system property + * "elementAttributeLimit" with no prefix is still observed + */ + public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; + + /** + * JDK maxOccur limit; Note that the existing system property + * "maxOccurLimit" with no prefix is still observed + */ + public static final String JDK_MAX_OCCUR_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit"; + + /** + * JDK total entity size limit + */ + public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit"; + + /** + * JDK maximum general entity size limit + */ + public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit"; + /** + * JDK maximum parameter entity size limit + */ + public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit"; + /** + * JDK maximum XML name limit + */ + public static final String JDK_XML_NAME_LIMIT = + ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit"; + /** + * JDK property to allow printing out information from the limit analyzer + */ + public static final String JDK_ENTITY_COUNT_INFO = + ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo"; + + // + // Implementation limits: API properties + // + /** + * JDK entity expansion limit; Note that the existing system property + * "entityExpansionLimit" with no prefix is still observed + */ + public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit"; + + /** + * JDK element attribute limit; Note that the existing system property + * "elementAttributeLimit" with no prefix is still observed + */ + public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit"; + + /** + * JDK maxOccur limit; Note that the existing system property + * "maxOccurLimit" with no prefix is still observed + */ + public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit"; + + /** + * JDK total entity size limit + */ + public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit"; + + /** + * JDK maximum general entity size limit + */ + public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit"; + /** + * JDK maximum parameter entity size limit + */ + public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit"; + /** + * JDK maximum XML name limit + */ + public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit"; + + //legacy System Properties + public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; + public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; + public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; + + /** + * A string "yes" that can be used for properties such as getEntityCountInfo + */ + public static final String JDK_YES = "yes"; + // // DOM features // @@ -443,7 +542,7 @@ public final class Constants { public static final String LOCALE_PROPERTY = "locale"; /** property identifier: security manager. */ - protected static final String SECURITY_MANAGER = + public static final String SECURITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; @@ -511,9 +610,6 @@ public final class Constants { */ public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED"; - public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; - - public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; /** * {@link org.w3c.dom.TypeInfo} associated with current element/attribute diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java index 0f5119d1fb1..8fbf9162409 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java @@ -25,6 +25,7 @@ package com.sun.org.apache.xerces.internal.impl; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.xml.internal.stream.StaxEntityResolverWrapper; import java.util.HashMap; @@ -50,12 +51,16 @@ public class PropertyManager { private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning"; + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; + /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = Constants.XML_SECURITY_PROPERTY_MANAGER; HashMap supportedProps = new HashMap(); + private XMLSecurityManager fSecurityManager; private XMLSecurityPropertyManager fSecurityPropertyMgr; public static final int CONTEXT_READER = 1; @@ -82,6 +87,7 @@ public class PropertyManager { HashMap properties = propertyManager.getProperties(); supportedProps.putAll(properties); + fSecurityManager = (XMLSecurityManager)getProperty(SECURITY_MANAGER); fSecurityPropertyMgr = (XMLSecurityPropertyManager)getProperty(XML_SECURITY_PROPERTY_MANAGER); } @@ -124,6 +130,8 @@ public class PropertyManager { supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false)); supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false)); + fSecurityManager = new XMLSecurityManager(true); + supportedProps.put(SECURITY_MANAGER, fSecurityManager); fSecurityPropertyMgr = new XMLSecurityPropertyManager(); supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); } @@ -142,6 +150,7 @@ public class PropertyManager { */ public boolean containsProperty(String property){ return supportedProps.containsKey(property) || + (fSecurityManager != null && fSecurityManager.getIndex(property) > -1) || (fSecurityPropertyMgr!=null && fSecurityPropertyMgr.getIndex(property) > -1) ; } @@ -169,12 +178,15 @@ public class PropertyManager { supportedProps.put( Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY , new StaxEntityResolverWrapper((XMLResolver)value)) ; } - int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(property) : -1; - if (index > -1) { - fSecurityPropertyMgr.setValue(index, - XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); - } else { - supportedProps.put(property, value); + //check if the property is managed by security manager + if (fSecurityManager == null || + !fSecurityManager.setLimit(property, XMLSecurityManager.State.APIPROPERTY, value)) { + //check if the property is managed by security property manager + if (fSecurityPropertyMgr == null || + !fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { + //fall back to the existing property manager + supportedProps.put(property, value); + } } if(equivalentProperty != null){ diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java index dbfd46a5d5f..7a826dfcc97 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java @@ -108,6 +108,7 @@ import javax.xml.stream.events.XMLEvent; * @author Elena Litani, IBM * @author Michael Glavassevich, IBM * @author Sunitha Reddy, Sun Microsystems + * @version $Id: XML11NSDocumentScannerImpl.java,v 1.6 2010-11-01 04:39:40 joehw Exp $ */ public class XML11NSDocumentScannerImpl extends XML11DocumentScannerImpl { @@ -236,7 +237,8 @@ public class XML11NSDocumentScannerImpl extends XML11DocumentScannerImpl { // attributes scanAttribute(fAttributes); - if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){ + if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) && + fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", new Object[]{rawname, new Integer(fElementAttributeLimit) }, diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java index 6c5553c7979..18a9902d1b7 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java @@ -44,6 +44,8 @@ import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.xml.internal.stream.Entity; /** * This class is responsible for scanning the declarations found @@ -66,7 +68,7 @@ import com.sun.org.apache.xerces.internal.impl.Constants; * @author Glenn Marcy, IBM * @author Eric Ye, IBM * - * @version $Id: XMLDTDScannerImpl.java,v 1.7 2007/09/26 12:52:40 ndw Exp $ + * @version $Id: XMLDTDScannerImpl.java,v 1.8 2010-11-01 04:39:41 joehw Exp $ */ public class XMLDTDScannerImpl extends XMLScanner @@ -1545,7 +1547,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { // internal entity if (systemId == null) { - scanEntityValue(fLiteral, fLiteral2); + scanEntityValue(name, isPEDecl, fLiteral, fLiteral2); // since we need it's value anyway, let's snag it so it doesn't get corrupted // if a new load takes place before we store the entity values fStringBuffer.clear(); @@ -1610,7 +1612,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { * the use of scanCharReferenceValue), and fStringBuffer2, anything in them * at the time of calling is lost. */ - protected final void scanEntityValue(XMLString value, + protected final void scanEntityValue(String entityName, boolean isPEDecl, XMLString value, XMLString nonNormalizedValue) throws IOException, XNIException { int quote = fEntityScanner.scanChar(); @@ -1622,10 +1624,20 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { XMLString literal = fString; XMLString literal2 = fString; + int countChar = 0; + if (fLimitAnalyzer == null && fSecurityManager != null) { + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + fLimitAnalyzer.startEntity(entityName); + } + if (fEntityScanner.scanLiteral(quote, fString) != quote) { fStringBuffer.clear(); fStringBuffer2.clear(); do { + if (isPEDecl && fLimitAnalyzer != null) { + checkLimit("%" + entityName, fString.length + countChar); + } + countChar = 0; fStringBuffer.append(fString); fStringBuffer2.append(fString); if (fEntityScanner.skipChar('&')) { @@ -1685,6 +1697,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { } } else { + countChar++; int c = fEntityScanner.peekChar(); if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); @@ -1708,9 +1721,17 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { fStringBuffer2.append(fString); literal = fStringBuffer; literal2 = fStringBuffer2; + } else { + if (isPEDecl) { + checkLimit("%" + entityName, literal); + } } value.setValues(literal); nonNormalizedValue.setValues(literal2); + if (fLimitAnalyzer != null) { + fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName); + } + if (!fEntityScanner.skipChar(quote)) { reportFatalError("CloseQuoteMissingInDecl", null); } @@ -2126,6 +2147,43 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { //new SymbolTable()); } + /** + * Add the count of the content buffer and check if the accumulated + * value exceeds the limit + * @param entityName entity name + * @param buffer content buffer + */ + private void checkLimit(String entityName, XMLString buffer) { + checkLimit(entityName, buffer.length); + } + + /** + * Add the count and check limit + * @param entityName entity name + * @param len length of the buffer + */ + private void checkLimit(String entityName, int len) { + if (fLimitAnalyzer == null) { + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + } + fLimitAnalyzer.addValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName, len); + if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)) { + fSecurityManager.debugPrint(); + reportFatalError("MaxEntitySizeLimit", new Object[]{entityName, + fLimitAnalyzer.getValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT), + fSecurityManager.getLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT), + fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)}); + } + if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)) { + fSecurityManager.debugPrint(); + reportFatalError("TotalEntitySizeLimit", + new Object[]{fLimitAnalyzer.getTotalValue(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)}); + } + + } + public DTDGrammar getGrammar(){ return nvGrammarInfo; } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index e60c7781156..600527daa93 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -52,10 +52,12 @@ import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; import com.sun.org.apache.xerces.internal.util.NamespaceSupport; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.State; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; -import com.sun.xml.internal.stream.Entity; import javax.xml.XMLConstants; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.events.XMLEvent; @@ -213,11 +215,8 @@ public class XMLDocumentFragmentScannerImpl }; private static final char [] cdata = {'[','C','D','A','T','A','['}; - private static final char [] endTag = {'<','/'}; - - //this variable is also used by XMLDocumentScannerImpl in the same package static final char [] xmlDecl = {'<','?','x','m','l'}; - + private static final char [] endTag = {'<','/'}; // debugging /** Debug scanner state. */ @@ -316,6 +315,7 @@ public class XMLDocumentFragmentScannerImpl protected String fDeclaredEncoding = null; /** Xerces Feature: Disallow doctype declaration. */ protected boolean fDisallowDoctype = false; + /** * comma-delimited list of protocols that are allowed for the purpose * of accessing external dtd or entity references @@ -384,7 +384,6 @@ public class XMLDocumentFragmentScannerImpl protected boolean foundBuiltInRefs = false; - protected XMLSecurityManager fSecurityManager = null; //skip element algorithm static final short MAX_DEPTH_LIMIT = 5 ; @@ -572,10 +571,11 @@ public class XMLDocumentFragmentScannerImpl fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true); fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + fElementAttributeLimit = (fSecurityManager != null)? fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0; - fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false); Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null); @@ -600,9 +600,6 @@ public class XMLDocumentFragmentScannerImpl //xxx: external entities are supported in Xerces // it would be good to define feature for this case fSupportExternalEntities = true; - fSupportExternalEntities = true; - fSupportExternalEntities = true; - fSupportExternalEntities = true; fReplaceEntityReferences = true; fIsCoalesce = false; @@ -673,6 +670,9 @@ public class XMLDocumentFragmentScannerImpl XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); + + fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER); + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); } // reset(XMLComponentManager) /** @@ -958,7 +958,6 @@ public class XMLDocumentFragmentScannerImpl // scan decl super.scanXMLDeclOrTextDecl(scanningTextDecl, fStrings); - fMarkupDepth--; // pseudo-attribute values @@ -1325,7 +1324,8 @@ public class XMLDocumentFragmentScannerImpl fAddDefaultAttr = true; do { scanAttribute(fAttributes); - if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){ + if (fSecurityManager != null && !fSecurityManager.isNoLimit(fElementAttributeLimit) && + fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", new Object[]{rawname, new Integer(fAttributes.getLength()) }, @@ -2039,6 +2039,13 @@ public class XMLDocumentFragmentScannerImpl } // getDriverName():String + /** + * Check the protocol used in the systemId against allowed protocols + * + * @param systemId the Id of the URI + * @param allowedProtocols a list of allowed protocols separated by comma + * @return the name of the protocol if rejected, null otherwise + */ String checkAccess(String systemId, String allowedProtocols) throws IOException { String baseSystemId = fEntityScanner.getBaseSystemId(); String expandedSystemId = fEntityManager.expandSystemId(systemId, baseSystemId,fStrictURI); @@ -2836,6 +2843,8 @@ public class XMLDocumentFragmentScannerImpl if(DEBUG){ System.out.println("NOT USING THE BUFFER, STRING = " + fTempString.toString()); } + //check limit before returning event + checkLimit(fContentBuffer); if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){ if(DEBUG)System.out.println("Return SPACE EVENT"); return XMLEvent.SPACE; @@ -2934,6 +2943,8 @@ public class XMLDocumentFragmentScannerImpl fLastSectionWasCharacterData = true ; continue; }else{ + //check limit before returning event + checkLimit(fContentBuffer); if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){ if(DEBUG)System.out.println("Return SPACE EVENT"); return XMLEvent.SPACE; @@ -3144,6 +3155,30 @@ public class XMLDocumentFragmentScannerImpl } //while loop }//next + /** + * Add the count of the content buffer and check if the accumulated + * value exceeds the limit + * @param buffer content buffer + */ + protected void checkLimit(XMLStringBuffer buffer) { + if (fLimitAnalyzer.isTracking(fCurrentEntityName)) { + fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length); + if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) { + fSecurityManager.debugPrint(); + reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName, + fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)}); + } + if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) { + fSecurityManager.debugPrint(); + reportFatalError("TotalEntitySizeLimit", + new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT), + fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)}); + } + } + } // // Protected methods diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java index ac25ae0ccde..59f3aa00e2d 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java @@ -30,8 +30,9 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.util.URI; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; -import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; import com.sun.org.apache.xerces.internal.xni.XNIException; @@ -174,7 +175,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { /** access external dtd: file protocol */ static final String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT; - // recognized features and properties /** Recognized features. */ @@ -307,6 +307,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { /** used to restrict external access */ protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT; + // settings /** @@ -324,10 +325,13 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { */ protected int fBufferSize = DEFAULT_BUFFER_SIZE; - // stores defaults for entity expansion limit if it has - // been set on the configuration. + /** Security Manager */ protected XMLSecurityManager fSecurityManager = null; + protected XMLLimitAnalyzer fLimitAnalyzer = null; + + protected int entityExpansionIndex; + /** * True if the document entity is standalone. This should really * only be set by the document source (e.g. XMLDocumentScanner). @@ -352,10 +356,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { /** XML 1.1 entity scanner. */ protected XMLEntityScanner fXML11EntityScanner; - /** entity expansion limit (contains useful data if and only if - fSecurityManager is non-null) */ - protected int fEntityExpansionLimit = 0; - /** count of entities expanded: */ protected int fEntityExpansionCount = 0; @@ -833,6 +833,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { fCurrentEntity.setEncodingExternallySpecified(encodingExternallySpecified); fEntityScanner.setCurrentEntity(fCurrentEntity); fResourceIdentifier.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId); + if (fLimitAnalyzer != null) { + fLimitAnalyzer.startEntity(name); + } return encoding; } //setupCurrentEntity(String, XMLInputSource, boolean, boolean): String @@ -1294,10 +1297,13 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { //expansions exceeds the entity expansion limit, parser will throw fatal error. // Note that this represents the nesting level of open entities. fEntityExpansionCount++; - if( fSecurityManager != null && fEntityExpansionCount > fEntityExpansionLimit ){ - fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, - "EntityExpansionLimitExceeded", - new Object[]{new Integer(fEntityExpansionLimit) }, + if(fLimitAnalyzer != null) { + fLimitAnalyzer.addValue(entityExpansionIndex, name, 1); + } + if( fSecurityManager != null && fSecurityManager.isOverLimit(entityExpansionIndex)){ + fSecurityManager.debugPrint(); + fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"EntityExpansionLimitExceeded", + new Object[]{fSecurityManager.getLimitValueByIndex(entityExpansionIndex)}, XMLErrorReporter.SEVERITY_FATAL_ERROR ); // is there anything better to do than reset the counter? // at least one can envision debugging applications where this might @@ -1361,6 +1367,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { if(fCurrentEntity != null){ //close the reader try{ + if (fLimitAnalyzer != null) { + fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntity.name); + if (fCurrentEntity.name.equals("[xml]")) { + fSecurityManager.debugPrint(); + } + } fCurrentEntity.close(); }catch(IOException ex){ throw new XNIException(ex); @@ -1426,6 +1438,9 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); + fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER); + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + // initialize state //fStandalone = false; fEntities.clear(); @@ -1486,6 +1501,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null); fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null); fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT); // JAXP 1.5 feature XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null); @@ -1506,9 +1523,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { // a class acting as a component manager but not // implementing that interface for whatever reason. public void reset() { - fEntityExpansionLimit = (fSecurityManager != null)? - fSecurityManager.getLimit(XMLSecurityManager.Limit.ENTITY_EXPANSION_LIMIT):0; - // initialize state fStandalone = false; @@ -1645,9 +1659,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() && propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) { fSecurityManager = (XMLSecurityManager)value; - fEntityExpansionLimit = (fSecurityManager != null)? - fSecurityManager.getLimit(XMLSecurityManager.Limit.ENTITY_EXPANSION_LIMIT):0; - + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); } } @@ -1656,9 +1668,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { { XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)value; fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); + } } - } - /** * Returns a list of property identifiers that are recognized by * this component. This method may return null if no properties diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java index b0461eb9138..464511c368c 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java @@ -58,6 +58,7 @@ import javax.xml.stream.events.XMLEvent; * @author Neeraj Bajaj, Sun Microsystems * @author Venugopal Rao K, Sun Microsystems * @author Elena Litani, IBM + * @version $Id: XMLNSDocumentScannerImpl.java,v 1.11 2010-11-01 04:39:41 joehw Exp $ */ public class XMLNSDocumentScannerImpl extends XMLDocumentScannerImpl { @@ -251,7 +252,8 @@ public class XMLNSDocumentScannerImpl do { scanAttribute(fAttributes); - if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){ + if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) && + fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", new Object[]{rawname, new Integer(fAttributes.getLength()) }, diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java index 9fc489b3e02..70de7869e78 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java @@ -32,6 +32,8 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLAttributes; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; @@ -106,6 +108,9 @@ public abstract class XMLScanner protected static final String ENTITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY; + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; + // debugging /** Debug attribute normalization. */ @@ -159,6 +164,12 @@ public abstract class XMLScanner /** xxx this should be available from EntityManager Entity storage */ protected XMLEntityStorage fEntityStore = null ; + /** Security manager. */ + protected XMLSecurityManager fSecurityManager = null; + + /** Limit analyzer. */ + protected XMLLimitAnalyzer fLimitAnalyzer = null; + // protected data /** event type */ @@ -256,6 +267,7 @@ public abstract class XMLScanner fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE); fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER); fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER); + fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER); //this step is extra because we have separated the storage of entity fEntityStore = fEntityManager.getEntityStore() ; @@ -293,6 +305,10 @@ public abstract class XMLScanner fEntityManager = (XMLEntityManager)value; } } + + if (propertyId.equals(SECURITY_MANAGER)) { + fSecurityManager = (XMLSecurityManager)value; + } /*else if(propertyId.equals(Constants.STAX_PROPERTIES)){ fStaxProperties = (HashMap)value; //TODO::discuss with neeraj what are his thoughts on passing properties. @@ -352,6 +368,8 @@ public abstract class XMLScanner fEntityManager = (XMLEntityManager)propertyManager.getProperty(ENTITY_MANAGER); fEntityStore = fEntityManager.getEntityStore() ; fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner() ; + fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER); + //fEntityManager.reset(); // DTD preparsing defaults: fValidation = false; @@ -510,8 +528,9 @@ public abstract class XMLScanner sawSpace = fEntityScanner.skipSpaces(); } // restore original literal value - if(currLiteral) + if(currLiteral) { currEnt.literal = true; + } // REVISIT: should we remove this error reporting? if (scanningTextDecl && state != STATE_DONE) { reportFatalError("MorePseudoAttributes", null); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties index d0db58ba98d..200b904b105 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties @@ -293,8 +293,10 @@ InvalidCharInLiteral=InvalidCharInLiteral -#Application can set the limit of number of entities that should be expanded by the parser. -EntityExpansionLimitExceeded=The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the application. +# Implementation limits + EntityExpansionLimitExceeded=JAXP00010001: The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the JDK. + ElementAttributeLimit=JAXP00010002: Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the JDK. + MaxEntitySizeLimit=JAXP00010003: The length of entity \"{0}\" is \"{1}\" that exceeds the \"{2}\" limit set by \"{3}\". + TotalEntitySizeLimit=JAXP00010004: The accumulated size \"{0}\" of entities exceeded the \"{1}\" limit set by \"{2}\". + MaxXMLNameLimit=JAXP00010005: The name \"{0}\" exceeded the \"{1}\" limit set by \"{2}\". -# Application can set the limit of number of attributes of entity that should be expanded by the parser. -ElementAttributeLimit= Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the application. diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java index e3c24dc8938..6aa06b8828d 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java @@ -109,7 +109,8 @@ public class CMNodeFactory { } public void nodeCountCheck(){ - if( fSecurityManager != null && nodeCount++ > maxNodeLimit){ + if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) && + nodeCount++ > maxNodeLimit){ if(DEBUG){ System.out.println("nodeCount = " + nodeCount ) ; System.out.println("nodeLimit = " + maxNodeLimit ) ; diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java index 34eaa8457bc..f9eea6a4dc4 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java @@ -1196,7 +1196,7 @@ public class XSAttributeChecker { //Revisit :: IMO this is not right place to check // maxOccurNodeLimit. int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT); - if (max > maxOccurNodeLimit) { + if (max > maxOccurNodeLimit && !fSchemaHandler.fSecureProcessing.isNoLimit(maxOccurNodeLimit)) { reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element); // reset max values in case processing continues on error diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java index f19f81dbef8..e73c12d24da 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java @@ -46,7 +46,6 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; -import javax.xml.XMLConstants; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.xml.sax.EntityResolver; @@ -125,6 +124,7 @@ public class DocumentBuilderImpl extends DocumentBuilder /** Initial EntityResolver */ private final EntityResolver fInitEntityResolver; + private XMLSecurityManager fSecurityManager; private XMLSecurityPropertyManager fSecurityPropertyMgr; DocumentBuilderImpl(DocumentBuilderFactoryImpl dbf, Hashtable dbfAttrs, Hashtable features) @@ -173,10 +173,10 @@ public class DocumentBuilderImpl extends DocumentBuilder fSecurityPropertyMgr = new XMLSecurityPropertyManager(); domParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); - // If the secure processing feature is on set a security manager. - if (secureProcessing) { - domParser.setProperty(SECURITY_MANAGER, new XMLSecurityManager()); + fSecurityManager = new XMLSecurityManager(secureProcessing); + domParser.setProperty(SECURITY_MANAGER, fSecurityManager); + if (secureProcessing) { /** * If secure processing is explicitly set on the factory, the * access properties will be set unless the corresponding @@ -250,9 +250,9 @@ public class DocumentBuilderImpl extends DocumentBuilder String feature = (String) entry.getKey(); boolean value = ((Boolean) entry.getValue()).booleanValue(); domParser.setFeature(feature, value); - } } } + } /** * Set any DocumentBuilderFactory attributes of our underlying DOMParser @@ -303,14 +303,17 @@ public class DocumentBuilderImpl extends DocumentBuilder } } } else { - int index = fSecurityPropertyMgr.getIndex(name); - if (index > -1) { - fSecurityPropertyMgr.setValue(index, - XMLSecurityPropertyManager.State.APIPROPERTY, (String)val); - } else { - // Let Xerces code handle the property - domParser.setProperty(name, val); - } + //check if the property is managed by security manager + if (fSecurityManager == null || + !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, val)) { + //check if the property is managed by security property manager + if (fSecurityPropertyMgr == null || + !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) { + //fall back to the existing property manager + domParser.setProperty(name, val); + } + } + } } } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java index a60d1e5085d..d95b1ca8851 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java @@ -112,7 +112,8 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser /** Initial EntityResolver */ private final EntityResolver fInitEntityResolver; - private XMLSecurityPropertyManager fSecurityPropertyMgr; + private final XMLSecurityManager fSecurityManager; + private final XMLSecurityPropertyManager fSecurityPropertyMgr; /** * Create a SAX parser with the associated features @@ -130,8 +131,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing) throws SAXException { + fSecurityManager = new XMLSecurityManager(secureProcessing); + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); // Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader - xmlReader = new JAXPSAXParser(this); + xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr, fSecurityManager); // JAXP "namespaceAware" == SAX Namespaces feature // Note: there is a compatibility problem here with default values: @@ -150,12 +153,11 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser xmlReader.setFeature0(XINCLUDE_FEATURE, true); } - fSecurityPropertyMgr = new XMLSecurityPropertyManager(); xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); - // If the secure processing feature is on set a security manager. + xmlReader.setProperty0(SECURITY_MANAGER, fSecurityManager); + if (secureProcessing) { - xmlReader.setProperty0(SECURITY_MANAGER, new XMLSecurityManager()); /** * By default, secure processing is set, no external access is allowed. * However, we need to check if it is actively set on the factory since we @@ -163,6 +165,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser * the default value */ if (features != null) { + Object temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING); if (temp != null) { boolean value = ((Boolean) temp).booleanValue(); @@ -397,14 +400,43 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser private final HashMap fInitFeatures = new HashMap(); private final HashMap fInitProperties = new HashMap(); private final SAXParserImpl fSAXParser; + private XMLSecurityManager fSecurityManager; + private XMLSecurityPropertyManager fSecurityPropertyMgr; public JAXPSAXParser() { - this(null); + this(null, null, null); } - JAXPSAXParser(SAXParserImpl saxParser) { + JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager securityPropertyMgr, + XMLSecurityManager securityManager) { super(); fSAXParser = saxParser; + fSecurityManager = securityManager; + fSecurityPropertyMgr = securityPropertyMgr; + /** + * This class may be used directly. So initialize the security manager if + * it is null. + */ + if (fSecurityManager == null) { + fSecurityManager = new XMLSecurityManager(true); + try { + super.setProperty(SECURITY_MANAGER, fSecurityManager); + } catch (SAXException e) { + throw new UnsupportedOperationException( + SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), + "property-not-recognized", new Object [] {SECURITY_MANAGER}), e); + } + } + if (fSecurityPropertyMgr == null) { + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + try { + super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + } catch (SAXException e) { + throw new UnsupportedOperationException( + SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), + "property-not-recognized", new Object [] {SECURITY_MANAGER}), e); + } + } } /** @@ -420,7 +452,8 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { try { - setProperty(SECURITY_MANAGER, value ? new XMLSecurityManager() : null); + fSecurityManager.setSecureProcessing(value); + setProperty(SECURITY_MANAGER, fSecurityManager); } catch (SAXNotRecognizedException exc) { // If the property is not supported @@ -456,13 +489,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser throw new NullPointerException(); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { - try { - return (super.getProperty(SECURITY_MANAGER) != null); - } - // If the property is not supported the value must be false. - catch (SAXException exc) { - return false; - } + return fSecurityManager.isSecureProcessing(); } return super.getFeature(name); } @@ -541,17 +568,21 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { setSchemaValidatorProperty(name, value); } - /** Check to see if the property is managed by the property manager **/ - int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); - if (index > -1) { - fSAXParser.fSecurityPropertyMgr.setValue(index, - XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); - } else { - if (!fInitProperties.containsKey(name)) { - fInitProperties.put(name, super.getProperty(name)); + + //check if the property is managed by security manager + if (fSecurityManager == null || + !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + //check if the property is managed by security property manager + if (fSecurityPropertyMgr == null || + !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { + //fall back to the existing property manager + if (!fInitProperties.containsKey(name)) { + fInitProperties.put(name, super.getProperty(name)); + } + super.setProperty(name, value); } - super.setProperty(name, value); } + } public synchronized Object getProperty(String name) @@ -564,9 +595,18 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser // JAXP 1.2 support return fSAXParser.schemaLanguage; } - int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); - if (index > -1) { - return fSAXParser.fSecurityPropertyMgr.getValueByIndex(index); + + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (fSecurityManager != null) ? + fSecurityManager.getLimitAsString(name) : null; + if (propertyValue != null) { + return propertyValue; + } else { + propertyValue = (fSecurityPropertyMgr != null) ? + fSecurityPropertyMgr.getValue(name) : null; + if (propertyValue != null) { + return propertyValue; + } } return super.getProperty(name); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java index f398e037d18..5af27e26fc1 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java @@ -26,6 +26,7 @@ package com.sun.org.apache.xerces.internal.jaxp.validation; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import java.io.IOException; import javax.xml.transform.Result; @@ -73,6 +74,19 @@ public final class StAXValidatorHelper implements ValidatorHelper { SAXTransformerFactory tf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ? (SAXTransformerFactory)SAXTransformerFactory.newInstance() : (SAXTransformerFactory) TransformerFactory.newInstance(DEFAULT_TRANSFORMER_IMPL, StAXValidatorHelper.class.getClassLoader()); + XMLSecurityManager securityManager = (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER); + if (securityManager != null) { + for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { + if (securityManager.isSet(limit.ordinal())){ + tf.setAttribute(limit.apiProperty(), + securityManager.getLimitValueAsString(limit)); + } + } + if (securityManager.printEntityCountInfo()) { + tf.setAttribute(Constants.JDK_ENTITY_COUNT_INFO, "yes"); + } + } + identityTransformer1 = tf.newTransformer(); identityTransformer2 = tf.newTransformerHandler(); } catch (TransformerConfigurationException e) { diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java index bb1694c5160..d6c04fd984a 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java @@ -189,6 +189,8 @@ final class StreamValidatorHelper implements ValidatorHelper { config.setDTDContentModelHandler(null); config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER)); + config.setProperty(Constants.SECURITY_MANAGER, + fComponentManager.getProperty(Constants.SECURITY_MANAGER)); fConfiguration = new SoftReference(config); return config; } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java index 3a59da745ed..34eba4c4791 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java @@ -107,7 +107,7 @@ public final class XMLSchemaFactory extends SchemaFactory { /** The ErrorHandlerWrapper */ private ErrorHandlerWrapper fErrorHandlerWrapper; - /** The XMLSecurityManager. */ + /** The SecurityManager. */ private XMLSecurityManager fSecurityManager; /** The Security property manager. */ @@ -141,7 +141,7 @@ public final class XMLSchemaFactory extends SchemaFactory { fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper); // Enable secure processing feature by default - fSecurityManager = new XMLSecurityManager(); + fSecurityManager = new XMLSecurityManager(true); fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); fSecurityPropertyMgr = new XMLSecurityPropertyManager(); @@ -301,7 +301,7 @@ public final class XMLSchemaFactory extends SchemaFactory { "FeatureNameNull", null)); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { - return (fSecurityManager != null); + return (fSecurityManager != null && fSecurityManager.isSecureProcessing()); } try { return fXMLSchemaLoader.getFeature(name); @@ -365,17 +365,15 @@ public final class XMLSchemaFactory extends SchemaFactory { SAXMessageFormatter.formatMessage(null, "jaxp-secureprocessing-feature", null)); } - if (value) { - fSecurityManager = new XMLSecurityManager(); + fSecurityManager.setSecureProcessing(value); + if (value) { if (Constants.IS_JDK8_OR_ABOVE) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA, XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); } - } else { - fSecurityManager = null; } fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); @@ -420,12 +418,15 @@ public final class XMLSchemaFactory extends SchemaFactory { "property-not-supported", new Object [] {name})); } try { - int index = fSecurityPropertyMgr.getIndex(name); - if (index > -1) { - fSecurityPropertyMgr.setValue(index, - XMLSecurityPropertyManager.State.APIPROPERTY, (String)object); - } else { - fXMLSchemaLoader.setProperty(name, object); + //check if the property is managed by security manager + if (fSecurityManager == null || + !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, object)) { + //check if the property is managed by security property manager + if (fSecurityPropertyMgr == null || + !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, object)) { + //fall back to the existing property manager + fXMLSchemaLoader.setProperty(name, object); + } } } catch (XMLConfigurationException e) { diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java index 8b006fa7361..dcbbabd4d4a 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java @@ -181,7 +181,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin private final HashMap fInitProperties = new HashMap(); /** Stores the initial security manager. */ - private final XMLSecurityManager fInitSecurityManager; + private XMLSecurityManager fInitSecurityManager; /** Stores the initial security property manager. */ private final XMLSecurityPropertyManager fSecurityPropertyMgr; @@ -221,12 +221,6 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin fComponents.put(ENTITY_RESOLVER, null); fComponents.put(ERROR_HANDLER, null); - if (System.getSecurityManager() != null) { - _isSecureMode = true; - setProperty(SECURITY_MANAGER, new XMLSecurityManager()); - } else { - fComponents.put(SECURITY_MANAGER, null); - } fComponents.put(SYMBOL_TABLE, new SymbolTable()); // setup grammar pool @@ -241,15 +235,21 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer); addRecognizedParamsAndSetDefaults(fSchemaValidator, grammarContainer); - // if the secure processing feature is set to true, add a security manager to the configuration - Boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING); - if (Boolean.TRUE.equals(secureProcessing)) { - fInitSecurityManager = new XMLSecurityManager(); + boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING); + if (System.getSecurityManager() != null) { + _isSecureMode = true; + secureProcessing = true; } - else { - fInitSecurityManager = null; + + fInitSecurityManager = (XMLSecurityManager) + grammarContainer.getProperty(SECURITY_MANAGER); + if (fInitSecurityManager != null ) { + fInitSecurityManager.setSecureProcessing(secureProcessing); + } else { + fInitSecurityManager = new XMLSecurityManager(secureProcessing); } - fComponents.put(SECURITY_MANAGER, fInitSecurityManager); + + setProperty(SECURITY_MANAGER, fInitSecurityManager); //pass on properties set on SchemaFactory fSecurityPropertyMgr = (XMLSecurityPropertyManager) @@ -281,7 +281,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin return FeatureState.is(fUseGrammarPoolOnly); } else if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) { - return FeatureState.is(getProperty(SECURITY_MANAGER) != null); + return FeatureState.is(fInitSecurityManager.isSecureProcessing()); } else if (SCHEMA_ELEMENT_DEFAULT.equals(featureId)) { return FeatureState.is(true); //pre-condition: VALIDATION and SCHEMA_VALIDATION are always true @@ -311,7 +311,9 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin if (_isSecureMode && !value) { throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING); } - setProperty(SECURITY_MANAGER, value ? new XMLSecurityManager() : null); + + fInitSecurityManager.setSecureProcessing(value); + setProperty(SECURITY_MANAGER, fInitSecurityManager); if (value && Constants.IS_JDK8_OR_ABOVE) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, @@ -390,10 +392,19 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin fComponents.put(propertyId, value); return; } - if (!fInitProperties.containsKey(propertyId)) { - fInitProperties.put(propertyId, super.getProperty(propertyId)); + //check if the property is managed by security manager + if (fInitSecurityManager == null || + !fInitSecurityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) { + //check if the property is managed by security property manager + if (fSecurityPropertyMgr == null || + !fSecurityPropertyMgr.setValue(propertyId, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { + //fall back to the existing property manager + if (!fInitProperties.containsKey(propertyId)) { + fInitProperties.put(propertyId, super.getProperty(propertyId)); + } + super.setProperty(propertyId, value); + } } - super.setProperty(propertyId, value); } /** diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java index cf9e9a79f92..8432b54541e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java @@ -22,6 +22,7 @@ package com.sun.org.apache.xerces.internal.parsers; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.SymbolTable; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; @@ -76,6 +77,8 @@ public class SAXParser XMLGRAMMAR_POOL, }; + XMLSecurityManager securityManager; + XMLSecurityPropertyManager securityPropertyManager; // // Constructors // @@ -129,18 +132,30 @@ public class SAXParser */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { - XMLSecurityPropertyManager spm = new XMLSecurityPropertyManager(); - int index = spm.getIndex(name); + if (securityPropertyManager == null) { + securityPropertyManager = new XMLSecurityPropertyManager(); + } + int index = securityPropertyManager.getIndex(name); if (index > -1) { /** * this is a direct call to this parser, not a subclass since * internally the support of this property is done through * XMLSecurityPropertyManager */ - spm.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); - super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, spm); + securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); + super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } else { - super.setProperty(name, value); + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + } + + //check if the property is managed by security manager + if (securityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + super.setProperty(Constants.SECURITY_MANAGER, securityManager); + } else { + super.setProperty(name, value); + } + } } } // class SAXParser diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java index 53d4ab4a0ea..65c85d164ca 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java @@ -44,6 +44,7 @@ import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; * * @author Neil Graham, IBM * + * @version $Id: SecurityConfiguration.java,v 1.6 2010-11-01 04:40:09 joehw Exp $ */ public class SecurityConfiguration extends XIncludeAwareParserConfiguration { @@ -106,8 +107,8 @@ public class SecurityConfiguration extends XIncludeAwareParserConfiguration XMLComponentManager parentSettings) { super(symbolTable, grammarPool, parentSettings); - // create the XMLSecurityManager property: - setProperty(SECURITY_MANAGER_PROPERTY, new XMLSecurityManager()); + // create the SecurityManager property: + setProperty(SECURITY_MANAGER_PROPERTY, new XMLSecurityManager(true)); } // (SymbolTable,XMLGrammarPool) } // class SecurityConfiguration diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java index 62dec4a54e7..3f22807e37e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java @@ -20,6 +20,12 @@ package com.sun.org.apache.xerces.internal.parsers; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; +import javax.xml.XMLConstants; + import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl; import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl; @@ -46,6 +52,7 @@ import com.sun.org.apache.xerces.internal.util.FeatureState; import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; import com.sun.org.apache.xerces.internal.util.PropertyState; import com.sun.org.apache.xerces.internal.util.SymbolTable; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; @@ -63,11 +70,6 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Locale; -import javax.xml.XMLConstants; /** * This class is the configuration used to parse XML 1.0 and XML 1.1 documents. @@ -278,6 +280,8 @@ public class XML11Configuration extends ParserConfigurationSettings private static final String XML_SECURITY_PROPERTY_MANAGER = Constants.XML_SECURITY_PROPERTY_MANAGER; + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; // debugging @@ -483,7 +487,6 @@ public class XML11Configuration extends ParserConfigurationSettings PARSER_SETTINGS, XMLConstants.FEATURE_SECURE_PROCESSING }; - addRecognizedFeatures(recognizedFeatures); // set state for default features fFeatures.put(VALIDATION, Boolean.FALSE); @@ -531,6 +534,7 @@ public class XML11Configuration extends ParserConfigurationSettings SCHEMA_NONS_LOCATION, LOCALE, SCHEMA_DV_FACTORY, + SECURITY_MANAGER, XML_SECURITY_PROPERTY_MANAGER }; addRecognizedProperties(recognizedProperties); @@ -581,6 +585,8 @@ public class XML11Configuration extends ParserConfigurationSettings fProperties.put(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); + fProperties.put(SECURITY_MANAGER, new XMLSecurityManager(true)); + // add message formatters if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java new file mode 100644 index 00000000000..41724b6c50d --- /dev/null +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java @@ -0,0 +1,236 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package com.sun.org.apache.xerces.internal.utils; + +import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; +import java.util.Formatter; +import java.util.HashMap; +import java.util.Map; + +/** + * A helper for analyzing entity expansion limits + * + * @author Joe Wang Oracle Corp. + * + */ +public final class XMLLimitAnalyzer { + + /** + * Map old property names with the new ones + */ + public static enum NameMap { + ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT); + + final String newName; + final String oldName; + + NameMap(String newName, String oldName) { + this.newName = newName; + this.oldName = oldName; + } + + String getOldName(String newName) { + if (newName.equals(this.newName)) { + return oldName; + } + return null; + } + } + + private XMLSecurityManager securityManager; + /** + * Max value accumulated for each property + */ + private final int[] values; + /** + * Names of the entities corresponding to their max values + */ + private final String[] names; + /** + * Total value of accumulated entities + */ + private final int[] totalValue; + + /** + * Maintain values of the top 10 elements in the process of parsing + */ + private final Map[] caches; + + private String entityStart, entityEnd; + /** + * Default constructor. Establishes default values for known security + * vulnerabilities. + */ + public XMLLimitAnalyzer(XMLSecurityManager securityManager) { + this.securityManager = securityManager; + values = new int[Limit.values().length]; + totalValue = new int[Limit.values().length]; + names = new String[Limit.values().length]; + caches = new Map[Limit.values().length]; + } + + /** + * Add the value to the current max count for the specified property + * To find the max value of all entities, set no limit + * + * @param limit the type of the property + * @param entityName the name of the entity + * @param value the value of the entity + */ + public void addValue(Limit limit, String entityName, int value) { + addValue(limit.ordinal(), entityName, value); + } + + /** + * Add the value to the current count by the index of the property + * @param index the index of the property + * @param entityName the name of the entity + * @param value the value of the entity + */ + public void addValue(int index, String entityName, int value) { + if (index == Limit.ENTITY_EXPANSION_LIMIT.ordinal() || + index == Limit.MAX_OCCUR_NODE_LIMIT.ordinal() || + index == Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal()) { + totalValue[index] += value; + return; + } + + Map cache; + if (caches[index] == null) { + cache = new HashMap(10); + caches[index] = cache; + } else { + cache = caches[index]; + } + + int accumulatedValue = value; + if (cache.containsKey(entityName)) { + accumulatedValue += cache.get(entityName).intValue(); + cache.put(entityName, Integer.valueOf(accumulatedValue)); + } else { + cache.put(entityName, Integer.valueOf(value)); + } + + if (accumulatedValue > values[index]) { + values[index] = accumulatedValue; + names[index] = entityName; + } + + + if (index == Limit.GENEAL_ENTITY_SIZE_LIMIT.ordinal() || + index == Limit.PARAMETER_ENTITY_SIZE_LIMIT.ordinal()) { + totalValue[Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()] += value; + } + } + + /** + * Return the value of the current max count for the specified property + * + * @param limit the property + * @return the value of the property + */ + public int getValue(Limit limit) { + return values[limit.ordinal()]; + } + + public int getValue(int index) { + return values[index]; + } + /** + * Return the total value accumulated so far + * + * @param limit the property + * @return the accumulated value of the property + */ + public int getTotalValue(Limit limit) { + return totalValue[limit.ordinal()]; + } + + public int getTotalValue(int index) { + return totalValue[index]; + } + /** + * Return the current max value (count or length) by the index of a property + * @param index the index of a property + * @return count of a property + */ + public int getValueByIndex(int index) { + return values[index]; + } + + public void startEntity(String name) { + entityStart = name; + } + + public boolean isTracking(String name) { + return entityStart.equals(name); + } + /** + * Stop tracking the entity + * @param limit the limit property + * @param name the name of an entity + */ + public void endEntity(Limit limit, String name) { + entityStart = ""; + Map cache = caches[limit.ordinal()]; + if (cache != null) { + cache.remove(name); + } + } + + public void debugPrint() { + Formatter formatter = new Formatter(); + System.out.println(formatter.format("%30s %15s %15s %15s %30s", + "Property","Limit","Total size","Size","Entity Name")); + + for (Limit limit : Limit.values()) { + formatter = new Formatter(); + System.out.println(formatter.format("%30s %15d %15d %15d %30s", + limit.name(), + securityManager.getLimit(limit), + totalValue[limit.ordinal()], + values[limit.ordinal()], + names[limit.ordinal()])); + } + } +} diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java index f70aeb7cb21..1ddb651d6df 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java @@ -40,108 +40,482 @@ public final class XMLSecurityManager { */ public static enum State { //this order reflects the overriding order - DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY + + DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), + JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"), + APIPROPERTY("property"); + + final String literal; + State(String literal) { + this.literal = literal; + } + + String literal() { + return literal; + } } /** * Limits managed by the security manager */ public static enum Limit { - ENTITY_EXPANSION_LIMIT(64000), - MAX_OCCUR_NODE_LIMIT(5000), - ELEMENT_ATTRIBUTE_LIMIT(10000); + ENTITY_EXPANSION_LIMIT(Constants.JDK_ENTITY_EXPANSION_LIMIT, Constants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), + MAX_OCCUR_NODE_LIMIT(Constants.JDK_MAX_OCCUR_LIMIT, Constants.SP_MAX_OCCUR_LIMIT, 0, 5000), + ELEMENT_ATTRIBUTE_LIMIT(Constants.JDK_ELEMENT_ATTRIBUTE_LIMIT, Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), + TOTAL_ENTITY_SIZE_LIMIT(Constants.JDK_TOTAL_ENTITY_SIZE_LIMIT, Constants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), + GENEAL_ENTITY_SIZE_LIMIT(Constants.JDK_GENEAL_ENTITY_SIZE_LIMIT, Constants.SP_GENEAL_ENTITY_SIZE_LIMIT, 0, 0), + PARAMETER_ENTITY_SIZE_LIMIT(Constants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, Constants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000); + + final String apiProperty; + final String systemProperty; final int defaultValue; + final int secureValue; - Limit(int value) { + Limit(String apiProperty, String systemProperty, int value, int secureValue) { + this.apiProperty = apiProperty; + this.systemProperty = systemProperty; this.defaultValue = value; + this.secureValue = secureValue; + } + + public boolean equalsAPIPropertyName(String propertyName) { + return (propertyName == null) ? false : apiProperty.equals(propertyName); + } + + public boolean equalsSystemPropertyName(String propertyName) { + return (propertyName == null) ? false : systemProperty.equals(propertyName); + } + + public String apiProperty() { + return apiProperty; + } + + String systemProperty() { + return systemProperty; } int defaultValue() { return defaultValue; } + + int secureValue() { + return secureValue; + } } /** - * Values of the limits as defined in enum Limit + * Map old property names with the new ones */ - private final int[] limits; + public static enum NameMap { + + ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT); + final String newName; + final String oldName; + + NameMap(String newName, String oldName) { + this.newName = newName; + this.oldName = oldName; + } + + String getOldName(String newName) { + if (newName.equals(this.newName)) { + return oldName; + } + return null; + } + } + private static final int NO_LIMIT = 0; /** - * States of the settings for each limit in limits above + * Values of the properties */ - private State[] states = {State.DEFAULT, State.DEFAULT, State.DEFAULT, State.DEFAULT}; + private final int[] values; + /** + * States of the settings for each property + */ + private State[] states; + /** + * Flag indicating if secure processing is set + */ + boolean secureProcessing; + + /** + * States that determine if properties are set explicitly + */ + private boolean[] isSet; + + + private XMLLimitAnalyzer limitAnalyzer; + /** + * Index of the special entityCountInfo property + */ + private int indexEntityCountInfo = 10000; + private String printEntityCountInfo = ""; /** * Default constructor. Establishes default values for known security * vulnerabilities. */ public XMLSecurityManager() { - limits = new int[Limit.values().length]; + this(false); + } + + /** + * Instantiate Security Manager in accordance with the status of + * secure processing + * @param secureProcessing + */ + public XMLSecurityManager(boolean secureProcessing) { + limitAnalyzer = new XMLLimitAnalyzer(this); + values = new int[Limit.values().length]; + states = new State[Limit.values().length]; + isSet = new boolean[Limit.values().length]; + this.secureProcessing = secureProcessing; for (Limit limit : Limit.values()) { - limits[limit.ordinal()] = limit.defaultValue(); + if (secureProcessing) { + values[limit.ordinal()] = limit.secureValue; + states[limit.ordinal()] = State.FSP; + } else { + values[limit.ordinal()] = limit.defaultValue(); + states[limit.ordinal()] = State.DEFAULT; + } } //read system properties or jaxp.properties readSystemProperties(); } /** - * Sets the limit for a specific type of XML constructs. This can be either - * the size or the number of the constructs. - * - * @param type the type of limitation - * @param state the state of limitation - * @param limit the limit to the type + * Setting FEATURE_SECURE_PROCESSING explicitly */ - public void setLimit(Limit limit, State state, int value) { - //only update if it shall override - if (state.compareTo(states[limit.ordinal()]) >= 0) { - limits[limit.ordinal()] = value; - states[limit.ordinal()] = state; + public void setSecureProcessing(boolean secure) { + secureProcessing = secure; + for (Limit limit : Limit.values()) { + if (secure) { + setLimit(limit.ordinal(), State.FSP, limit.secureValue()); + } else { + setLimit(limit.ordinal(), State.FSP, limit.defaultValue()); + } } } /** - * Returns the limit set for the type specified + * Return the state of secure processing + * @return the state of secure processing + */ + public boolean isSecureProcessing() { + return secureProcessing; + } + + + /** + * Set limit by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security manager; false + * if otherwise. + */ + public boolean setLimit(String propertyName, State state, Object value) { + int index = getIndex(propertyName); + if (index > -1) { + setLimit(index, state, value); + return true; + } + return false; + } + + /** + * Set the value for a specific limit. * - * @param limit the type of limitation - * @return the limit to the type + * @param limit the limit + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(Limit limit, State state, int value) { + setLimit(limit.ordinal(), state, value); + } + + /** + * Set the value of a property by its index + * + * @param index the index of the property + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(int index, State state, Object value) { + if (index == indexEntityCountInfo) { + printEntityCountInfo = (String)value; + } else { + int temp = 0; + try { + temp = Integer.parseInt((String) value); + if (temp < 0) { + temp = 0; + } + } catch (NumberFormatException e) {} + setLimit(index, state, temp); + } + } + + /** + * Set the value of a property by its index + * + * @param index the index of the property + * @param state the state of the property + * @param value the value of the property + */ + public void setLimit(int index, State state, int value) { + if (index == indexEntityCountInfo) { + //if it's explicitly set, it's treated as yes no matter the value + printEntityCountInfo = Constants.JDK_YES; + } else { + //only update if it shall override + if (state.compareTo(states[index]) >= 0) { + values[index] = value; + states[index] = state; + isSet[index] = true; + } + } + } + + /** + * Return the value of the specified property + * + * @param propertyName the property name + * @return the value of the property as a string. If a property is managed + * by this manager, its value shall not be null. + */ + public String getLimitAsString(String propertyName) { + int index = getIndex(propertyName); + if (index > -1) { + return getLimitValueByIndex(index); + } + + return null; + } + /** + * Return the value of the specified property + * + * @param limit the property + * @return the value of the property */ public int getLimit(Limit limit) { - return limits[limit.ordinal()]; + return values[limit.ordinal()]; + } + + /** + * Return the value of a property by its ordinal + * + * @param limit the property + * @return value of a property + */ + public String getLimitValueAsString(Limit limit) { + return Integer.toString(values[limit.ordinal()]); + } + + /** + * Return the value of a property by its ordinal + * + * @param index the index of a property + * @return limit of a property as a string + */ + public String getLimitValueByIndex(int index) { + if (index == indexEntityCountInfo) { + return printEntityCountInfo; + } + + return Integer.toString(values[index]); + } + + /** + * Return the state of the limit property + * + * @param limit the limit + * @return the state of the limit property + */ + public State getState(Limit limit) { + return states[limit.ordinal()]; + } + + /** + * Return the state of the limit property + * + * @param limit the limit + * @return the state of the limit property + */ + public String getStateLiteral(Limit limit) { + return states[limit.ordinal()].literal(); + } + + /** + * Get the index by property name + * + * @param propertyName property name + * @return the index of the property if found; return -1 if not + */ + public int getIndex(String propertyName) { + for (Limit limit : Limit.values()) { + if (limit.equalsAPIPropertyName(propertyName)) { + //internally, ordinal is used as index + return limit.ordinal(); + } + } + //special property to return entity count info + if (propertyName.equals(Constants.JDK_ENTITY_COUNT_INFO)) { + return indexEntityCountInfo; + } + return -1; + } + + /** + * Check if there's no limit defined by the Security Manager + * @param limit + * @return + */ + public boolean isNoLimit(int limit) { + return limit==NO_LIMIT; + } + /** + * Check if the size (length or count) of the specified limit property is + * over the limit + * + * @param limit the type of the limit property + * @param entityName the name of the entity + * @param size the size (count or length) of the entity + * @return true if the size is over the limit, false otherwise + */ + public boolean isOverLimit(Limit limit, String entityName, int size) { + return isOverLimit(limit.ordinal(), entityName, size); + } + + /** + * Check if the value (length or count) of the specified limit property is + * over the limit + * + * @param index the index of the limit property + * @param entityName the name of the entity + * @param size the size (count or length) of the entity + * @return true if the size is over the limit, false otherwise + */ + public boolean isOverLimit(int index, String entityName, int size) { + if (values[index] == NO_LIMIT) { + return false; + } + if (size > values[index]) { + limitAnalyzer.addValue(index, entityName, size); + return true; + } + return false; + } + + /** + * Check against cumulated value + * + * @param limit the type of the limit property + * @param size the size (count or length) of the entity + * @return true if the size is over the limit, false otherwise + */ + public boolean isOverLimit(Limit limit) { + return isOverLimit(limit.ordinal()); + } + + public boolean isOverLimit(int index) { + if (values[index] == NO_LIMIT) { + return false; + } + + if (index==Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal() || + index==Limit.ENTITY_EXPANSION_LIMIT.ordinal() || + index==Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()) { + return (limitAnalyzer.getTotalValue(index) > values[index]); + } else { + return (limitAnalyzer.getValue(index) > values[index]); + } + } + + public void debugPrint() { + if (printEntityCountInfo.equals(Constants.JDK_YES)) { + limitAnalyzer.debugPrint(); + } + } + + /** + * Return the limit analyzer + * + * @return the limit analyzer + */ + public XMLLimitAnalyzer getLimitAnalyzer() { + return limitAnalyzer; + } + + /** + * Set limit analyzer + * + * @param analyzer a limit analyzer + */ + public void setLimitAnalyzer(XMLLimitAnalyzer analyzer) { + limitAnalyzer = analyzer; + } + + /** + * Indicate if a property is set explicitly + * @param index + * @return + */ + public boolean isSet(int index) { + return isSet[index]; + } + + public boolean printEntityCountInfo() { + return printEntityCountInfo.equals(Constants.JDK_YES); } /** * Read from system properties, or those in jaxp.properties */ private void readSystemProperties() { - getSystemProperty(Limit.ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT); - getSystemProperty(Limit.MAX_OCCUR_NODE_LIMIT, Constants.MAX_OCCUR_LIMIT); - getSystemProperty(Limit.ELEMENT_ATTRIBUTE_LIMIT, - Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT); + + for (Limit limit : Limit.values()) { + if (!getSystemProperty(limit, limit.systemProperty())) { + //if system property is not found, try the older form if any + for (NameMap nameMap : NameMap.values()) { + String oldName = nameMap.getOldName(limit.systemProperty()); + if (oldName != null) { + getSystemProperty(limit, oldName); + } + } + } + } + } /** * Read from system properties, or those in jaxp.properties * - * @param limit the type of the property - * @param property the property name + * @param property the type of the property + * @param sysPropertyName the name of system property */ - private void getSystemProperty(Limit limit, String property) { + private boolean getSystemProperty(Limit limit, String sysPropertyName) { try { - String value = SecuritySupport.getSystemProperty(property); + String value = SecuritySupport.getSystemProperty(sysPropertyName); if (value != null && !value.equals("")) { - limits[limit.ordinal()] = Integer.parseInt(value); + values[limit.ordinal()] = Integer.parseInt(value); states[limit.ordinal()] = State.SYSTEMPROPERTY; - return; + return true; } - value = SecuritySupport.readJAXPProperty(property); + value = SecuritySupport.readJAXPProperty(sysPropertyName); if (value != null && !value.equals("")) { - limits[limit.ordinal()] = Integer.parseInt(value); + values[limit.ordinal()] = Integer.parseInt(value); states[limit.ordinal()] = State.JAXPDOTPROPERTIES; + return true; } } catch (NumberFormatException e) { - //invalid setting ignored + //invalid setting + throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty()); } + return false; } } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java index c6bb0310702..4286f043e50 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java @@ -91,6 +91,24 @@ public final class XMLSecurityPropertyManager { readSystemProperties(); } + + /** + * Set limit by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security property manager; + * false if otherwise. + */ + public boolean setValue(String propertyName, State state, Object value) { + int index = getIndex(propertyName); + if (index > -1) { + setValue(index, state, (String)value); + return true; + } + return false; + } + /** * Set the value for a specific property. * @@ -119,6 +137,23 @@ public final class XMLSecurityPropertyManager { states[index] = state; } } + + + /** + * Return the value of the specified property + * + * @param propertyName the property name + * @return the value of the property as a string + */ + public String getValue(String propertyName) { + int index = getIndex(propertyName); + if (index > -1) { + return getValueByIndex(index); + } + + return null; + } + /** * Return the value of the specified property * diff --git a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java index 805586093ca..a9c9aab1d50 100644 --- a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java +++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java @@ -25,6 +25,7 @@ package com.sun.org.apache.xml.internal.utils; import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; +import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import java.util.HashMap; import javax.xml.XMLConstants; @@ -72,6 +73,8 @@ public class XMLReaderManager { */ private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private XMLSecurityManager _xmlSecurityManager; + /** * Hidden constructor */ @@ -173,6 +176,21 @@ public class XMLReaderManager { + se.getMessage()); } + try { + if (_xmlSecurityManager != null) { + for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { + reader.setProperty(limit.apiProperty(), + _xmlSecurityManager.getLimitValueAsString(limit)); + } + if (_xmlSecurityManager.printEntityCountInfo()) { + reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + } + } + } catch (SAXException se) { + System.err.println("Warning: " + reader.getClass().getName() + ": " + + se.getMessage()); + } + return reader; } @@ -215,9 +233,11 @@ public class XMLReaderManager { /** * Get property value */ - public String getProperty(String name) { + public Object getProperty(String name) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { return _accessExternalDTD; + } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + return _xmlSecurityManager; } return null; } @@ -225,9 +245,11 @@ public class XMLReaderManager { /** * Set property. */ - public void setProperty(String name, String value) { + public void setProperty(String name, Object value) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { _accessExternalDTD = (String)value; + } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + _xmlSecurityManager = (XMLSecurityManager)value; } } } From d590d5e7d896a1b5ddda76668d698dafc40554dd Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 31 Jul 2013 10:54:46 -0700 Subject: [PATCH 055/983] 8021366: java_util/Properties/PropertiesWithOtherEncodings fails during 7u45 nightly testing Reviewed-by: lancea, alanb, dfuchs, mullan --- jaxp/src/com/sun/xml/internal/stream/Entity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxp/src/com/sun/xml/internal/stream/Entity.java b/jaxp/src/com/sun/xml/internal/stream/Entity.java index 7bbdf692412..0ae8228a3be 100644 --- a/jaxp/src/com/sun/xml/internal/stream/Entity.java +++ b/jaxp/src/com/sun/xml/internal/stream/Entity.java @@ -248,7 +248,7 @@ public abstract class Entity { public int fBufferSize = DEFAULT_BUFFER_SIZE; /** Default buffer size before we've finished with the XMLDecl: */ - public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 64; + public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 28; /** Default internal entity buffer size (1024). */ public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 1024; From b520de4e1e7f245db43a627084be0ce7640c8c3b Mon Sep 17 00:00:00 2001 From: Miroslav Kos Date: Thu, 1 Aug 2013 16:09:17 -0400 Subject: [PATCH 056/983] 8017505: Better Client Service Reviewed-by: mullan, ahgross, mgrebac --- .../api/server/AbstractInstanceResolver.java | 4 +- .../ws/api/server/InstanceResolver.java | 4 +- .../internal/ws/api/server/MethodUtil.java | 94 +++++++++++++++++++ .../internal/ws/client/sei/MethodUtil.java | 94 +++++++++++++++++++ .../xml/internal/ws/client/sei/SEIStub.java | 23 ++++- .../ws/policy/privateutil/MethodUtil.java | 92 ++++++++++++++++++ .../ws/policy/privateutil/PolicyUtils.java | 8 +- 7 files changed, 309 insertions(+), 10 deletions(-) create mode 100644 jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/MethodUtil.java create mode 100644 jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java create mode 100644 jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java index e670ac452e6..560e98e9085 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ public abstract class AbstractInstanceResolver extends InstanceResolver { if (!method.isAccessible()) { method.setAccessible(true); } - method.invoke(instance,args); + MethodUtil.invoke(instance,method, args); } catch (IllegalAccessException e) { throw new ServerRtException("server.rt.err",e); } catch (InvocationTargetException e) { diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java index 625f59f47b0..7c11e6455f7 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,7 +232,7 @@ public abstract class InstanceResolver { public Object invoke(Packet p, Method m, Object... args) throws InvocationTargetException, IllegalAccessException { T t = resolve(p); try { - return m.invoke(t, args ); + return MethodUtil.invoke(t, m, args ); } finally { postInvoke(p,t); } diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/MethodUtil.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/MethodUtil.java new file mode 100644 index 00000000000..c8497055678 --- /dev/null +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/MethodUtil.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.xml.internal.ws.api.server; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks + * to java.lang,reflect.Method.invoke() + * + * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too! + */ +class MethodUtil { + + private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName()); + private static final Method INVOKE_METHOD; + + static { + Method method; + try { + Class clazz = Class.forName("sun.reflect.misc.MethodUtil"); + method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods."); + } + } catch (Throwable t) { + method = null; + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM"); + } + } + INVOKE_METHOD = method; + } + + static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException { + if (INVOKE_METHOD != null) { + // sun.reflect.misc.MethodUtil.invoke(method, owner, args) + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil"); + } + try { + return INVOKE_METHOD.invoke(null, method, target, args); + } catch (InvocationTargetException ite) { + // unwrap invocation exception added by reflection code ... + throw unwrapException(ite); + } + } else { + // other then Oracle JDK ... + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM"); + } + return method.invoke(target, args); + } + } + + private static InvocationTargetException unwrapException(InvocationTargetException ite) { + Throwable targetException = ite.getTargetException(); + if (targetException != null && targetException instanceof InvocationTargetException) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Unwrapping invocation target exception"); + } + return (InvocationTargetException) targetException; + } else { + return ite; + } + } + +} diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java new file mode 100644 index 00000000000..f0daea51faf --- /dev/null +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.xml.internal.ws.client.sei; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks + * to java.lang,reflect.Method.invoke() + *

    + * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too! + */ +class MethodUtil { + + private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName()); + private static final Method INVOKE_METHOD; + + static { + Method method; + try { + Class clazz = Class.forName("sun.reflect.misc.MethodUtil"); + method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods."); + } + } catch (Throwable t) { + method = null; + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM"); + } + } + INVOKE_METHOD = method; + } + + static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException { + if (INVOKE_METHOD != null) { + // sun.reflect.misc.MethodUtil.invoke(method, owner, args) + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil"); + } + try { + return INVOKE_METHOD.invoke(null, method, target, args); + } catch (InvocationTargetException ite) { + // unwrap invocation exception added by reflection code ... + throw unwrapException(ite); + } + } else { + // other then Oracle JDK ... + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM"); + } + return method.invoke(target, args); + } + } + + private static InvocationTargetException unwrapException(InvocationTargetException ite) { + Throwable targetException = ite.getTargetException(); + if (targetException != null && targetException instanceof InvocationTargetException) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Unwrapping invocation target exception"); + } + return (InvocationTargetException) targetException; + } else { + return ite; + } + } + +} diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java index 7a5f0e3a1a7..9ad1f6edfba 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java @@ -28,6 +28,7 @@ package com.sun.xml.internal.ws.client.sei; import com.sun.istack.internal.NotNull; import com.sun.istack.internal.Nullable; import com.sun.xml.internal.ws.api.SOAPVersion; +import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; import com.sun.xml.internal.ws.api.client.WSPortInfo; import com.sun.xml.internal.ws.api.databinding.Databinding; import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; @@ -36,12 +37,16 @@ import com.sun.xml.internal.ws.api.message.Headers; import com.sun.xml.internal.ws.api.message.Packet; import com.sun.xml.internal.ws.api.model.MEP; import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; -import com.sun.xml.internal.ws.api.pipe.Tube; import com.sun.xml.internal.ws.api.pipe.Fiber; +import com.sun.xml.internal.ws.api.pipe.Tube; import com.sun.xml.internal.ws.api.server.Container; import com.sun.xml.internal.ws.api.server.ContainerResolver; import com.sun.xml.internal.ws.binding.BindingImpl; -import com.sun.xml.internal.ws.client.*; +import com.sun.xml.internal.ws.client.AsyncResponseImpl; +import com.sun.xml.internal.ws.client.RequestContext; +import com.sun.xml.internal.ws.client.ResponseContextReceiver; +import com.sun.xml.internal.ws.client.Stub; +import com.sun.xml.internal.ws.client.WSServiceDelegate; import com.sun.xml.internal.ws.model.JavaMethodImpl; import com.sun.xml.internal.ws.model.SOAPSEIModel; import com.sun.xml.internal.ws.wsdl.OperationDispatcher; @@ -50,6 +55,8 @@ import javax.xml.namespace.QName; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Proxy; import java.util.HashMap; import java.util.Map; @@ -132,6 +139,7 @@ public final class SEIStub extends Stub implements InvocationHandler { private final Map methodHandlers = new HashMap(); public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + validateInputs(proxy, method); Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer()); try { MethodHandler handler = methodHandlers.get(method); @@ -155,6 +163,17 @@ public final class SEIStub extends Stub implements InvocationHandler { } } + private void validateInputs(Object proxy, Method method) { + if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { + throw new IllegalStateException("Passed object is not proxy!"); + } + Class declaringClass = method.getDeclaringClass(); + if (method == null || declaringClass == null + || Modifier.isStatic(method.getModifiers())) { + throw new IllegalStateException("Invoking static method is not allowed!"); + } + } + public final Packet doProcess(Packet request, RequestContext rc, ResponseContextReceiver receiver) { return super.process(request, rc, receiver); } diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java new file mode 100644 index 00000000000..ad2ad4a6ef5 --- /dev/null +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.xml.internal.ws.policy.privateutil; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks + * to java.lang,reflect.Method.invoke() + */ +class MethodUtil { + + private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName()); + private static final Method INVOKE_METHOD; + + static { + Method method; + try { + Class clazz = Class.forName("sun.reflect.misc.MethodUtil"); + method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods."); + } + } catch (Throwable t) { + method = null; + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM"); + } + } + INVOKE_METHOD = method; + } + + static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException { + if (INVOKE_METHOD != null) { + // sun.reflect.misc.MethodUtil.invoke(method, owner, args) + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil"); + } + try { + return INVOKE_METHOD.invoke(null, method, target, args); + } catch (InvocationTargetException ite) { + // unwrap invocation exception added by reflection code ... + throw unwrapException(ite); + } + } else { + // other then Oracle JDK ... + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM"); + } + return method.invoke(target, args); + } + } + + private static InvocationTargetException unwrapException(InvocationTargetException ite) { + Throwable targetException = ite.getTargetException(); + if (targetException != null && targetException instanceof InvocationTargetException) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Unwrapping invocation target exception"); + } + return (InvocationTargetException) targetException; + } else { + return ite; + } + } + +} diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java index d3a2752ad5e..ec537d88358 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, 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 @@ -282,13 +282,13 @@ public final class PolicyUtils { /** * Reflection utilities wrapper */ - public static class Reflection { + static class Reflection { private static final PolicyLogger LOGGER = PolicyLogger.getLogger(PolicyUtils.Reflection.class); /** * Reflectively invokes specified method on the specified target */ - public static T invoke(final Object target, final String methodName, + static T invoke(final Object target, final String methodName, final Class resultClass, final Object... parameters) throws RuntimePolicyUtilsException { Class[] parameterTypes; if (parameters != null && parameters.length > 0) { @@ -311,7 +311,7 @@ public final class PolicyUtils { final Object[] parameters, final Class[] parameterTypes) throws RuntimePolicyUtilsException { try { final Method method = target.getClass().getMethod(methodName, parameterTypes); - final Object result = method.invoke(target, parameters); + final Object result = MethodUtil.invoke(target, method,parameters); return resultClass.cast(result); } catch (IllegalArgumentException e) { From adf52d0164028f9a7ceedeb0afc633f4f0bcd0fb Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Thu, 1 Aug 2013 14:09:39 -0700 Subject: [PATCH 057/983] 8021286: Improve MacOS resourcing Reviewed-by: okutsu --- jdk/make/sun/awt/FILES_c_macosx.gmk | 28 ----- jdk/make/sun/awt/FILES_export_macosx.gmk | 29 ----- jdk/make/sun/awt/Makefile | 2 - jdk/makefiles/CompileNativeLibraries.gmk | 4 - .../com/apple/laf/AquaLookAndFeel.java | 4 +- .../apple/resources/MacOSXResourceBundle.java | 110 ------------------ .../apple/resources/MacOSXResourceBundle.m | 110 ------------------ 7 files changed, 1 insertion(+), 286 deletions(-) delete mode 100644 jdk/make/sun/awt/FILES_c_macosx.gmk delete mode 100644 jdk/make/sun/awt/FILES_export_macosx.gmk delete mode 100644 jdk/src/macosx/classes/com/apple/resources/MacOSXResourceBundle.java delete mode 100644 jdk/src/macosx/native/com/apple/resources/MacOSXResourceBundle.m diff --git a/jdk/make/sun/awt/FILES_c_macosx.gmk b/jdk/make/sun/awt/FILES_c_macosx.gmk deleted file mode 100644 index d6bef30bb2a..00000000000 --- a/jdk/make/sun/awt/FILES_c_macosx.gmk +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -FILES_AWT_objc = \ - $(TARGDIR)MacOSXResourceBundle.m - diff --git a/jdk/make/sun/awt/FILES_export_macosx.gmk b/jdk/make/sun/awt/FILES_export_macosx.gmk deleted file mode 100644 index c7f0e003cb9..00000000000 --- a/jdk/make/sun/awt/FILES_export_macosx.gmk +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# FILES_export definitions for Mac OS X - -FILES_export += \ - com/apple/resources/MacOSXResourceBundle.java diff --git a/jdk/make/sun/awt/Makefile b/jdk/make/sun/awt/Makefile index dc4c250cf74..c45ecb9fe45 100644 --- a/jdk/make/sun/awt/Makefile +++ b/jdk/make/sun/awt/Makefile @@ -145,8 +145,6 @@ ifeq ($(PLATFORM), macosx) # # Files # -include FILES_c_macosx.gmk -include FILES_export_macosx.gmk FILES_objc = $(FILES_AWT_objc) OTHER_LDLIBS = -lmlib_image $(JVMLIB) $(LIBM) \ diff --git a/jdk/makefiles/CompileNativeLibraries.gmk b/jdk/makefiles/CompileNativeLibraries.gmk index 02bf3be808c..fa416032473 100644 --- a/jdk/makefiles/CompileNativeLibraries.gmk +++ b/jdk/makefiles/CompileNativeLibraries.gmk @@ -558,11 +558,7 @@ endif ifeq ($(OPENJDK_TARGET_OS),macosx) LIBAWT_FILES += awt_LoadLibrary.c img_colors.c - LIBAWT_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/apple/resources - LIBAWT_FILES += awt_LoadLibrary.c MacOSXResourceBundle.m LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks - - LIBAWT_MacOSXResourceBundle.m_CFLAGS:=-O0 endif ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java index 457b82d36a3..046d693e329 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java @@ -37,8 +37,6 @@ import javax.swing.plaf.basic.BasicLookAndFeel; import sun.swing.*; import apple.laf.*; -import com.apple.resources.MacOSXResourceBundle; - public class AquaLookAndFeel extends BasicLookAndFeel { static final String sOldPropertyPrefix = "com.apple.macos."; // old prefix for things like 'useScreenMenuBar' static final String sPropertyPrefix = "apple.laf."; // new prefix for things like 'useScreenMenuBar' @@ -252,7 +250,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel { table.setDefaultLocale(Locale.getDefault()); table.addResourceBundle(PKG_PREFIX + "resources.aqua"); try { - final ResourceBundle aquaProperties = MacOSXResourceBundle.getMacResourceBundle(PKG_PREFIX + "resources.aqua"); + final ResourceBundle aquaProperties = ResourceBundle.getBundle(PKG_PREFIX + "resources.aqua"); final Enumeration propertyKeys = aquaProperties.getKeys(); while (propertyKeys.hasMoreElements()) { diff --git a/jdk/src/macosx/classes/com/apple/resources/MacOSXResourceBundle.java b/jdk/src/macosx/classes/com/apple/resources/MacOSXResourceBundle.java deleted file mode 100644 index 143584b0b87..00000000000 --- a/jdk/src/macosx/classes/com/apple/resources/MacOSXResourceBundle.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.apple.resources; - -import java.security.*; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.io.*; - -public class MacOSXResourceBundle extends PropertyResourceBundle { - MacOSXResourceBundle(InputStream stream) throws IOException { - super(stream); - } - - void setItsParent(ResourceBundle rb) { - setParent(rb); - } - - public static ResourceBundle getMacResourceBundle(String baseJavaBundle) throws Exception { - return getMacResourceBundle(baseJavaBundle, null); - } - - public static ResourceBundle getMacResourceBundle(String baseJavaBundle, String filename) throws Exception { - LoadNativeBundleAction lnba = new LoadNativeBundleAction(baseJavaBundle, filename); - return (ResourceBundle)java.security.AccessController.doPrivileged(lnba); - } -} - -class LoadNativeBundleAction implements PrivilegedExceptionAction { - String mBaseJavaBundle; - String mFilenameOverride; - - LoadNativeBundleAction(String baseJavaBundle, String filenameOverride) { - mBaseJavaBundle = baseJavaBundle; - mFilenameOverride = filenameOverride; - } - - public Object run() { - java.util.ResourceBundle returnValue = null; - MacOSXResourceBundle macOSrb = null; - - // Load the Mac OS X resources. - // Use a base filename if we were given one. Otherwise, we will look for the last piece of the bundle path - // with '.properties' appended. Either way, the native method will take care of the extension. - String filename = mFilenameOverride; - - if (filename == null) { - filename = mBaseJavaBundle.substring(mBaseJavaBundle.lastIndexOf('.') + 1); - } - - File propsFile = null; - String propertyFileName = getPathToBundleFile(filename); - InputStream stream = null; - - try { - propsFile = new File(propertyFileName); - stream = new FileInputStream(propsFile); - stream = new java.io.BufferedInputStream(stream); - macOSrb = new MacOSXResourceBundle(stream); - } catch (Exception e) { - //e.printStackTrace(); - //System.out.println("Failed to create resources from application bundle. Using Java-based resources."); - } finally { - try { - if (stream != null) stream.close(); - stream = null; - } catch (Exception e) { - e.printStackTrace(); - } - } - - returnValue = ResourceBundle.getBundle(mBaseJavaBundle); - - // If we have a platform-specific bundle, make it the parent of the generic bundle, so failures propagate up to the parent. - if (returnValue != null) { - if (macOSrb != null) { - macOSrb.setItsParent(returnValue); - returnValue = macOSrb; - } - } - - return returnValue; - } - - private static native String getPathToBundleFile(String filename); -} - diff --git a/jdk/src/macosx/native/com/apple/resources/MacOSXResourceBundle.m b/jdk/src/macosx/native/com/apple/resources/MacOSXResourceBundle.m deleted file mode 100644 index 0b98d2b0588..00000000000 --- a/jdk/src/macosx/native/com/apple/resources/MacOSXResourceBundle.m +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#import -#import -#import - -#ifndef MAXPATHLEN -#define MAXPATHLEN PATH_MAX -#endif - -static jboolean -GetPathFromCurrentBinary(char *buf, jint bufsize) -{ - Dl_info dlinfo; - dladdr((void *)GetPathFromCurrentBinary, &dlinfo); - if (realpath(dlinfo.dli_fname, buf) == NULL) { -// fprintf(stderr, "Error: realpath(`%s') failed.\n", dlinfo.dli_fname); - return JNI_FALSE; - } - - const char *libawt = "lib/libawt.dylib"; - int strLen, libawtLen; - - strLen = strlen(buf); - libawtLen = strlen(libawt); - - if (strLen < libawtLen || - strcmp(buf + strLen - libawtLen, libawt) != 0) { - return JNI_FALSE; - } - - buf[strLen - libawtLen] = '\0'; - - return JNI_TRUE; -} - -#define JAVA_DLL "libjava.dylib" - -static jboolean -GetJREPath(char *buf, jint bufsize) -{ - /* try to get the path from the current binary, if not, bail to the framework */ - if (GetPathFromCurrentBinary(buf, bufsize) == JNI_TRUE) { - /* does the rest of the JRE exist? */ - char libjava[MAXPATHLEN]; - snprintf(libjava, MAXPATHLEN, "%s/lib/" JAVA_DLL, buf); - if (access(libjava, F_OK) == 0) { - return JNI_TRUE; - } - } - - return JNI_FALSE; -} - -static NSString *getRunningJavaBundle() -{ - char path[MAXPATHLEN]; - GetJREPath(path, MAXPATHLEN); - return [[NSString alloc] initWithFormat:@"%@/bundle", [NSString stringWithUTF8String:path]]; -} - -/* - * Class: com_apple_resources_LoadNativeBundleAction - * Method: getPathToBundleFile - * Signature: (Ljava/lang/String)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_com_apple_resources_LoadNativeBundleAction_getPathToBundleFile - (JNIEnv *env, jclass klass, jstring filename) -{ - jstring returnVal = NULL; - if (filename == NULL) { - return NULL; - } - -JNF_COCOA_ENTER(env); - NSBundle *javaBundle = [NSBundle bundleWithPath:getRunningJavaBundle()]; - NSString *baseFilename = JNFJavaToNSString(env, filename); - NSString *propertyFilePath = [javaBundle pathForResource:baseFilename ofType:@"properties"]; - - if (propertyFilePath != nil) { - returnVal = JNFNSToJavaString(env, propertyFilePath); - } -JNF_COCOA_EXIT(env); - - return returnVal; -} From 10738dc29803a286a22c0973f85ffaac94ef6b5a Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sun, 4 Aug 2013 02:50:02 +0400 Subject: [PATCH 058/983] 8021282: Better recycling of object instances Reviewed-by: art --- .../classes/com/apple/laf/AquaUtils.java | 193 ++++++++++-------- 1 file changed, 104 insertions(+), 89 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java index 0592da714a2..a5f5501cb35 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -29,6 +29,7 @@ import java.awt.*; import java.awt.image.*; import java.lang.ref.SoftReference; import java.lang.reflect.Method; +import java.security.AccessController; import java.security.PrivilegedAction; import java.util.*; @@ -41,56 +42,68 @@ import sun.awt.AppContext; import sun.lwawt.macosx.CImage; import sun.lwawt.macosx.CImage.Creator; import sun.lwawt.macosx.CPlatformWindow; +import sun.misc.Launcher; +import sun.reflect.misc.ReflectUtil; +import sun.security.action.GetPropertyAction; import sun.swing.SwingUtilities2; import com.apple.laf.AquaImageFactory.SlicedImageControl; -public class AquaUtils { - final static String ANIMATIONS_SYSTEM_PROPERTY = "swing.enableAnimations"; +final class AquaUtils { - /* + private static final String ANIMATIONS_PROPERTY = "swing.enableAnimations"; + + /** + * Suppresses default constructor, ensuring non-instantiability. + */ + private AquaUtils() { + } + + /** * Convenience function for determining ComponentOrientation. Helps us * avoid having Munge directives throughout the code. */ - public static boolean isLeftToRight(final Component c) { + static boolean isLeftToRight(final Component c) { return c.getComponentOrientation().isLeftToRight(); } - public static void enforceComponentOrientation(Component c, ComponentOrientation orientation) { + static void enforceComponentOrientation(final Component c, final ComponentOrientation orientation) { c.setComponentOrientation(orientation); if (c instanceof Container) { - for (Component child : ((Container)c).getComponents()) { + for (final Component child : ((Container)c).getComponents()) { enforceComponentOrientation(child, orientation); } } } - private static CImage.Creator getCImageCreatorInternal() { - return java.security.AccessController.doPrivileged(new PrivilegedAction() { + private static Creator getCImageCreatorInternal() { + return AccessController.doPrivileged(new PrivilegedAction() { + @Override public Creator run() { try { final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); getCreatorMethod.setAccessible(true); - return (CImage.Creator)getCreatorMethod.invoke(null, new Object[] {}); - } catch (final Exception e) { + return (Creator)getCreatorMethod.invoke(null, new Object[] {}); + } catch (final Exception ignored) { return null; } } }); } - private static final RecyclableSingleton cImageCreator = new RecyclableSingleton() { + private static final RecyclableSingleton cImageCreator = new RecyclableSingleton() { @Override protected Creator getInstance() { return getCImageCreatorInternal(); } }; - static CImage.Creator getCImageCreator() { + static Creator getCImageCreator() { return cImageCreator.get(); } - protected static Image generateSelectedDarkImage(final Image image) { + static Image generateSelectedDarkImage(final Image image) { final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + @Override int getGreyFor(final int gray) { return gray * 75 / 100; } @@ -98,8 +111,9 @@ public class AquaUtils { return Toolkit.getDefaultToolkit().createImage(prod); } - protected static Image generateDisabledImage(final Image image) { + static Image generateDisabledImage(final Image image) { final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + @Override int getGreyFor(final int gray) { return 255 - ((255 - gray) * 65 / 100); } @@ -107,19 +121,20 @@ public class AquaUtils { return Toolkit.getDefaultToolkit().createImage(prod); } - protected static Image generateLightenedImage(final Image image, final int percent) { + static Image generateLightenedImage(final Image image, final int percent) { final GrayFilter filter = new GrayFilter(true, percent); final ImageProducer prod = new FilteredImageSource(image.getSource(), filter); return Toolkit.getDefaultToolkit().createImage(prod); } - static abstract class IconImageFilter extends RGBImageFilter { - public IconImageFilter() { + private abstract static class IconImageFilter extends RGBImageFilter { + IconImageFilter() { super(); canFilterIndexColorModel = true; } - public int filterRGB(final int x, final int y, final int rgb) { + @Override + public final int filterRGB(final int x, final int y, final int rgb) { final int red = (rgb >> 16) & 0xff; final int green = (rgb >> 8) & 0xff; final int blue = rgb & 0xff; @@ -135,14 +150,14 @@ public class AquaUtils { return result; } - abstract int getGreyFor(final int gray); + abstract int getGreyFor(int gray); } - public abstract static class RecyclableObject { - protected SoftReference objectRef = null; + abstract static class RecyclableObject { + private SoftReference objectRef; - public T get() { - T referent = null; + T get() { + T referent; if (objectRef != null && (referent = objectRef.get()) != null) return referent; referent = create(); objectRef = new SoftReference(referent); @@ -152,8 +167,8 @@ public class AquaUtils { protected abstract T create(); } - public abstract static class RecyclableSingleton { - public T get() { + abstract static class RecyclableSingleton { + final T get() { final AppContext appContext = AppContext.getAppContext(); SoftReference ref = (SoftReference) appContext.get(this); if (ref != null) { @@ -166,38 +181,36 @@ public class AquaUtils { return object; } - public void reset() { - AppContext appContext = AppContext.getAppContext(); - appContext.remove(this); + void reset() { + AppContext.getAppContext().remove(this); } - protected abstract T getInstance(); + abstract T getInstance(); } - public static class RecyclableSingletonFromDefaultConstructor extends RecyclableSingleton { - protected final Class clazz; + static class RecyclableSingletonFromDefaultConstructor extends RecyclableSingleton { + private final Class clazz; - public RecyclableSingletonFromDefaultConstructor(final Class clazz) { + RecyclableSingletonFromDefaultConstructor(final Class clazz) { this.clazz = clazz; } - protected T getInstance() { + @Override + T getInstance() { try { + ReflectUtil.checkPackageAccess(clazz); return clazz.newInstance(); - } catch (final InstantiationException e) { - e.printStackTrace(); - } catch (final IllegalAccessException e) { - e.printStackTrace(); + } catch (InstantiationException | IllegalAccessException ignored) { } return null; } } - public abstract static class LazyKeyedSingleton { - protected Map refs; + abstract static class LazyKeyedSingleton { + private Map refs; - public V get(final K key) { - if (refs == null) refs = new HashMap(); + V get(final K key) { + if (refs == null) refs = new HashMap<>(); final V cachedValue = refs.get(key); if (cachedValue != null) return cachedValue; @@ -207,44 +220,45 @@ public class AquaUtils { return value; } - protected abstract V getInstance(final K key); + protected abstract V getInstance(K key); } - static final RecyclableSingleton enableAnimations = new RecyclableSingleton() { + private static final RecyclableSingleton enableAnimations = new RecyclableSingleton() { @Override protected Boolean getInstance() { - final String sizeProperty = (String)java.security.AccessController.doPrivileged((PrivilegedAction)new sun.security.action.GetPropertyAction(ANIMATIONS_SYSTEM_PROPERTY)); - return new Boolean(!"false".equals(sizeProperty)); // should be true by default + final String sizeProperty = (String) AccessController.doPrivileged((PrivilegedAction)new GetPropertyAction( + ANIMATIONS_PROPERTY)); + return !"false".equals(sizeProperty); // should be true by default } }; - static boolean animationsEnabled() { + private static boolean animationsEnabled() { return enableAnimations.get(); } - static final int MENU_BLINK_DELAY = 50; // 50ms == 3/60 sec, according to the spec - protected static void blinkMenu(final Selectable selectable) { + private static final int MENU_BLINK_DELAY = 50; // 50ms == 3/60 sec, according to the spec + static void blinkMenu(final Selectable selectable) { if (!animationsEnabled()) return; try { selectable.paintSelected(false); Thread.sleep(MENU_BLINK_DELAY); selectable.paintSelected(true); Thread.sleep(MENU_BLINK_DELAY); - } catch (final InterruptedException e) { } + } catch (final InterruptedException ignored) { } } interface Selectable { - void paintSelected(final boolean selected); + void paintSelected(boolean selected); } interface JComponentPainter { - public void paint(JComponent c, Graphics g, int x, int y, int w, int h); + void paint(JComponent c, Graphics g, int x, int y, int w, int h); } interface Painter { - public void paint(final Graphics g, int x, int y, int w, int h); + void paint(Graphics g, int x, int y, int w, int h); } - public static void paintDropShadowText(final Graphics g, final JComponent c, final Font font, final FontMetrics metrics, final int x, final int y, final int offsetX, final int offsetY, final Color textColor, final Color shadowColor, final String text) { + static void paintDropShadowText(final Graphics g, final JComponent c, final Font font, final FontMetrics metrics, final int x, final int y, final int offsetX, final int offsetY, final Color textColor, final Color shadowColor, final String text) { g.setFont(font); g.setColor(shadowColor); SwingUtilities2.drawString(c, g, text, x + offsetX, y + offsetY + metrics.getAscent()); @@ -252,22 +266,22 @@ public class AquaUtils { SwingUtilities2.drawString(c, g, text, x, y + metrics.getAscent()); } - public static class ShadowBorder implements Border { - final Painter prePainter; - final Painter postPainter; + static class ShadowBorder implements Border { + private final Painter prePainter; + private final Painter postPainter; - final int offsetX; - final int offsetY; - final float distance; - final int blur; - final Insets insets; - final ConvolveOp blurOp; + private final int offsetX; + private final int offsetY; + private final float distance; + private final int blur; + private final Insets insets; + private final ConvolveOp blurOp; - public ShadowBorder(final Painter prePainter, final Painter postPainter, final int offsetX, final int offsetY, final float distance, final float intensity, final int blur) { + ShadowBorder(final Painter prePainter, final Painter postPainter, final int offsetX, final int offsetY, final float distance, final float intensity, final int blur) { this.prePainter = prePainter; this.postPainter = postPainter; this.offsetX = offsetX; this.offsetY = offsetY; this.distance = distance; this.blur = blur; final int halfBlur = blur / 2; - this.insets = new Insets(halfBlur - offsetY, halfBlur - offsetX, halfBlur + offsetY, halfBlur + offsetX); + insets = new Insets(halfBlur - offsetY, halfBlur - offsetX, halfBlur + offsetY, halfBlur + offsetX); final float blurry = intensity / (blur * blur); final float[] blurKernel = new float[blur * blur]; @@ -275,14 +289,17 @@ public class AquaUtils { blurOp = new ConvolveOp(new Kernel(blur, blur, blurKernel)); } - public boolean isBorderOpaque() { + @Override + public final boolean isBorderOpaque() { return false; } - public Insets getBorderInsets(final Component c) { + @Override + public final Insets getBorderInsets(final Component c) { return insets; } + @Override public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { final BufferedImage img = new BufferedImage(width + blur * 2, height + blur * 2, BufferedImage.TYPE_INT_ARGB_PRE); paintToImage(img, x, y, width, height); @@ -290,7 +307,7 @@ public class AquaUtils { g.drawImage(img, -blur, -blur, null); } - protected void paintToImage(final BufferedImage img, final int x, final int y, final int width, final int height) { + private void paintToImage(final BufferedImage img, final int x, final int y, final int width, final int height) { // clear the prior image Graphics2D imgG = (Graphics2D)img.getGraphics(); imgG.setComposite(AlphaComposite.Clear); @@ -319,10 +336,10 @@ public class AquaUtils { } } - public static class SlicedShadowBorder extends ShadowBorder { - final SlicedImageControl slices; + static class SlicedShadowBorder extends ShadowBorder { + private final SlicedImageControl slices; - public SlicedShadowBorder(final Painter prePainter, final Painter postPainter, final int offsetX, final int offsetY, final float distance, final float intensity, final int blur, final int templateWidth, final int templateHeight, final int leftCut, final int topCut, final int rightCut, final int bottomCut) { + SlicedShadowBorder(final Painter prePainter, final Painter postPainter, final int offsetX, final int offsetY, final float distance, final float intensity, final int blur, final int templateWidth, final int templateHeight, final int leftCut, final int topCut, final int rightCut, final int bottomCut) { super(prePainter, postPainter, offsetX, offsetY, distance, intensity, blur); final BufferedImage i = new BufferedImage(templateWidth, templateHeight, BufferedImage.TYPE_INT_ARGB_PRE); @@ -331,15 +348,12 @@ public class AquaUtils { slices = new SlicedImageControl(i, leftCut, topCut, rightCut, bottomCut, false); } + @Override public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { slices.paint(g, x, y, width, height); } } - public interface NineSliceMetricsProvider { - - } - // static void debugFrame(String name, Image image) { // JFrame f = new JFrame(name); // f.setContentPane(new JLabel(new ImageIcon(image))); @@ -350,28 +364,30 @@ public class AquaUtils { // special casing naughty applications, like InstallAnywhere // REGR: JButton: Myst IV: the buttons of 1.0.3 updater have redraw issue static boolean shouldUseOpaqueButtons() { - final ClassLoader launcherClassLoader = sun.misc.Launcher.getLauncher().getClassLoader(); + final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader(); if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true; return false; } - static boolean classExists(final ClassLoader classLoader, final String clazzName) { + private static boolean classExists(final ClassLoader classLoader, final String clazzName) { try { return Class.forName(clazzName, false, classLoader) != null; - } catch (final Throwable e) { } + } catch (final Throwable ignored) { } return false; } - private static RecyclableSingleton getJComponentGetFlagMethod = new RecyclableSingleton() { + private static final RecyclableSingleton getJComponentGetFlagMethod = new RecyclableSingleton() { + @Override protected Method getInstance() { - return java.security.AccessController.doPrivileged( + return AccessController.doPrivileged( new PrivilegedAction() { + @Override public Method run() { try { final Method method = JComponent.class.getDeclaredMethod("getFlag", new Class[] { int.class }); method.setAccessible(true); return method; - } catch (final Throwable e) { + } catch (final Throwable ignored) { return null; } } @@ -380,18 +396,18 @@ public class AquaUtils { } }; - private static final Integer OPAQUE_SET_FLAG = new Integer(24); // private int JComponent.OPAQUE_SET - protected static boolean hasOpaqueBeenExplicitlySet(final JComponent c) { + private static final Integer OPAQUE_SET_FLAG = 24; // private int JComponent.OPAQUE_SET + static boolean hasOpaqueBeenExplicitlySet(final JComponent c) { final Method method = getJComponentGetFlagMethod.get(); if (method == null) return false; try { return Boolean.TRUE.equals(method.invoke(c, OPAQUE_SET_FLAG)); - } catch (final Throwable e) { + } catch (final Throwable ignored) { return false; } } - protected static boolean isWindowTextured(final Component c) { + private static boolean isWindowTextured(final Component c) { if (!(c instanceof JComponent)) { return false; } @@ -412,13 +428,12 @@ public class AquaUtils { return new Color(color.getRed(), color.getGreen(), color.getBlue(), 0); } - protected static void fillRect(final Graphics g, final Component c) { + static void fillRect(final Graphics g, final Component c) { fillRect(g, c, c.getBackground(), 0, 0, c.getWidth(), c.getHeight()); } - protected static void fillRect(final Graphics g, final Component c, - final Color color, final int x, final int y, - final int w, final int h) { + static void fillRect(final Graphics g, final Component c, final Color color, + final int x, final int y, final int w, final int h) { if (!(g instanceof Graphics2D)) { return; } From a3b45465c6003b542aafe8969f5a5f13d3b2ca48 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 6 Aug 2013 10:33:42 +0200 Subject: [PATCH 059/983] 8019292: Better Attribute Value Exceptions Reviewed-by: dfuchs, dholmes, ahgross --- .../BadAttributeValueExpException.java | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/management/BadAttributeValueExpException.java b/jdk/src/share/classes/javax/management/BadAttributeValueExpException.java index 9ed27e91fa3..2eda233d24a 100644 --- a/jdk/src/share/classes/javax/management/BadAttributeValueExpException.java +++ b/jdk/src/share/classes/javax/management/BadAttributeValueExpException.java @@ -25,6 +25,9 @@ package javax.management; +import java.io.IOException; +import java.io.ObjectInputStream; + /** * Thrown when an invalid MBean attribute is passed to a query @@ -41,17 +44,19 @@ public class BadAttributeValueExpException extends Exception { private static final long serialVersionUID = -3105272988410493376L; /** - * @serial The attribute value that originated this exception + * @serial A string representation of the attribute that originated this exception. + * for example, the string value can be the return of {@code attribute.toString()} */ private Object val; /** - * Constructs an BadAttributeValueExpException with the specified Object. + * Constructs a BadAttributeValueExpException using the specified Object to + * create the toString() value. * * @param val the inappropriate value. */ public BadAttributeValueExpException (Object val) { - this.val = val; + this.val = val == null ? null : val.toString(); } @@ -62,4 +67,25 @@ public class BadAttributeValueExpException extends Exception { return "BadAttributeValueException: " + val; } + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gf = ois.readFields(); + Object valObj = gf.get("val", null); + + if (valObj == null) { + val = null; + } else if (valObj instanceof String) { + val= valObj; + } else if (System.getSecurityManager() == null + || valObj instanceof Long + || valObj instanceof Integer + || valObj instanceof Float + || valObj instanceof Double + || valObj instanceof Byte + || valObj instanceof Short + || valObj instanceof Boolean) { + val = valObj.toString(); + } else { // the serialized object is from a version without JDK-8019292 fix + val = System.identityHashCode(valObj) + "@" + valObj.getClass().getName(); + } + } } From 68d1aae1be91153f3df0736e8a96ed99d36945a6 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 7 Aug 2013 14:37:22 +0400 Subject: [PATCH 060/983] 8021969: The index_AccessAllowed jnlp can not load successfully with exception thrown in the log Reviewed-by: art, skoivu --- jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java index 3c1691545f4..400553dd854 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java +++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java @@ -145,11 +145,7 @@ public class DataFlavor implements Externalizable, Cloneable { } catch (SecurityException exception) { // ignore secured class loaders } - if (fallback != null) { - return Class.forName(className, true, fallback); - } else { - throw new ClassNotFoundException(className); - } + return Class.forName(className, true, fallback); } /* From 046a6fa8e2263dc23bc39d97294922c71cf893b7 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Thu, 8 Aug 2013 19:16:27 +0200 Subject: [PATCH 061/983] 8021360: object not exported" on start of JMXConnectorServer for RMI-IIOP protocol with security manager Reviewed-by: alanb, ahgross, smarks, coffeys --- .../remote/protocol/iiop/IIOPProxyImpl.java | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java b/jdk/src/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java index d4171b24282..b0fe91bf728 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009,2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,13 +36,34 @@ import java.rmi.RemoteException; import java.rmi.NoSuchObjectException; import com.sun.jmx.remote.internal.IIOPProxy; +import java.io.SerializablePermission; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.Permissions; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.security.ProtectionDomain; /** - * An implementatin of IIOPProxy that simply delegates to the appropriate + * An implementation of IIOPProxy that simply delegates to the appropriate * RMI-IIOP and CORBA APIs. */ public class IIOPProxyImpl implements IIOPProxy { + // special ACC used to initialize the IIOP stub + // the only allowed privilege is SerializablePermission("enableSubclassImplementation") + private static final AccessControlContext STUB_ACC; + + static { + Permissions p = new Permissions(); + p.add(new SerializablePermission("enableSubclassImplementation")); + STUB_ACC = new AccessControlContext( + new ProtectionDomain[]{ + new ProtectionDomain(null, p) + } + ); + } + public IIOPProxyImpl() { } @Override @@ -113,7 +134,24 @@ public class IIOPProxyImpl implements IIOPProxy { } @Override - public Remote toStub(Remote obj) throws NoSuchObjectException { - return PortableRemoteObject.toStub(obj); + public Remote toStub(final Remote obj) throws NoSuchObjectException { + if (System.getSecurityManager() == null) { + return PortableRemoteObject.toStub(obj); + } else { + try { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { + + @Override + public Remote run() throws Exception { + return PortableRemoteObject.toStub(obj); + } + }, STUB_ACC); + } catch (PrivilegedActionException e) { + if (e.getException() instanceof NoSuchObjectException) { + throw (NoSuchObjectException)e.getException(); + } + throw new RuntimeException("Unexpected exception type", e.getException()); + } + } } } From b2e34525abe6f046e30087a74b9c66200784a524 Mon Sep 17 00:00:00 2001 From: Sergey Gabdurakhmanov Date: Fri, 9 Aug 2013 11:03:33 +0400 Subject: [PATCH 062/983] 8020789: Disable exporting of gc.heap_dump diagnostic command Reviewed-by: fparain, ahgross --- hotspot/src/share/vm/services/diagnosticCommand.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp index 79c922a8586..162010e425e 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp @@ -48,7 +48,7 @@ void DCmdRegistrant::register_dcmds(){ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); #if INCLUDE_SERVICES // Heap dumping/inspection supported - DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); #endif // INCLUDE_SERVICES From ac42104fef46f3d20133383985fea56247768156 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 12 Aug 2013 19:57:21 +0400 Subject: [PATCH 063/983] 8021275: Better screening for ScreenMenu Reviewed-by: art --- .../classes/com/apple/laf/ScreenMenu.java | 144 +++++++++--------- 1 file changed, 75 insertions(+), 69 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java index 5f78ff6e061..87393408487 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java @@ -36,7 +36,10 @@ import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; import sun.lwawt.macosx.*; -class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler { +final class ScreenMenu extends Menu + implements ContainerListener, ComponentListener, + ScreenMenuPropertyHandler { + static { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { @@ -48,20 +51,22 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S } // screen menu stuff - public static native long addMenuListeners(ScreenMenu listener, long nativeMenu); - public static native void removeMenuListeners(long modelPtr); + private static native long addMenuListeners(ScreenMenu listener, long nativeMenu); + private static native void removeMenuListeners(long modelPtr); - long fModelPtr = 0; + private transient long fModelPtr; - Hashtable fItems; - JMenu fInvoker; + private final Hashtable fItems; + private final JMenu fInvoker; - Component fLastMouseEventTarget; - Rectangle fLastTargetRect; + private Component fLastMouseEventTarget; + private Rectangle fLastTargetRect; private volatile Rectangle[] fItemBounds; + private ScreenMenuPropertyListener fPropertyListener; + // Array of child hashes used to see if we need to recreate the Menu. - int childHashArray[]; + private int childHashArray[]; ScreenMenu(final JMenu invoker) { super(invoker.getText()); @@ -74,25 +79,12 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S updateItems(); } - // I'm always 'visible', but never on screen - static class ScreenMenuComponent extends Container { - public boolean isVisible() { return true; } - public boolean isShowing() { return true; } - public void setVisible(final boolean b) {} - public void show() {} - } - - ScreenMenuComponent makeScreenMenuComponent() { - return new ScreenMenuComponent(); - } - - /** * Determine if we need to tear down the Menu and re-create it, since the contents may have changed in the Menu opened listener and * we do not get notified of it, because EDT is busy in our code. We only need to update if the menu contents have changed in some * way, such as the number of menu items, the text of the menuitems, icon, shortcut etc. */ - static boolean needsUpdate(final Component items[], final int childHashArray[]) { + private static boolean needsUpdate(final Component items[], final int childHashArray[]) { if (items == null || childHashArray == null) { return true; } @@ -112,7 +104,7 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S * Used to recreate the AWT based Menu structure that implements the Screen Menu. * Also computes hashcode and stores them so that we can compare them later in needsUpdate. */ - void updateItems() { + private void updateItems() { final int count = fInvoker.getMenuComponentCount(); final Component[] items = fInvoker.getMenuComponents(); if (needsUpdate(items, childHashArray)) { @@ -163,16 +155,14 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S LWCToolkit.invokeAndWait(new Runnable() { public void run() { invoker.setSelected(false); - - // Null out the tracking rectangles and the array. + // Null out the tracking rectangles and the array. if (fItemBounds != null) { - for (int i = 0; i < fItemBounds.length; i++) { - fItemBounds[i] = null; - } + for (int i = 0; i < fItemBounds.length; i++) { + fItemBounds[i] = null; + } } - - fItemBounds = null; - } + fItemBounds = null; + } }, invoker); } catch (final Exception e) { e.printStackTrace(); @@ -237,49 +227,56 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S }); } - ScreenMenuPropertyListener fPropertyListener; + @Override public void addNotify() { - super.addNotify(); - if (fModelPtr == 0) { - fInvoker.addContainerListener(this); - fInvoker.addComponentListener(this); - fPropertyListener = new ScreenMenuPropertyListener(this); - fInvoker.addPropertyChangeListener(fPropertyListener); + synchronized (getTreeLock()) { + super.addNotify(); + if (fModelPtr == 0) { + fInvoker.addContainerListener(this); + fInvoker.addComponentListener(this); + fPropertyListener = new ScreenMenuPropertyListener(this); + fInvoker.addPropertyChangeListener(fPropertyListener); - final Icon icon = fInvoker.getIcon(); - if (icon != null) { - this.setIcon(icon); - } + final Icon icon = fInvoker.getIcon(); + if (icon != null) { + setIcon(icon); + } - final String tooltipText = fInvoker.getToolTipText(); - if (tooltipText != null) { - this.setToolTipText(tooltipText); - } - final MenuComponentPeer peer = getPeer(); - if (peer instanceof CMenu) { - final CMenu menu = (CMenu)peer; - final long nativeMenu = menu.getNativeMenu(); - fModelPtr = addMenuListeners(this, nativeMenu); + final String tooltipText = fInvoker.getToolTipText(); + if (tooltipText != null) { + setToolTipText(tooltipText); + } + final MenuComponentPeer peer = getPeer(); + if (peer instanceof CMenu) { + final CMenu menu = (CMenu) peer; + final long nativeMenu = menu.getNativeMenu(); + fModelPtr = addMenuListeners(this, nativeMenu); + } } } } + @Override public void removeNotify() { - // Call super so that the NSMenu has been removed, before we release the delegate in removeMenuListeners - super.removeNotify(); - fItems.clear(); - if (fModelPtr != 0) { - removeMenuListeners(fModelPtr); - fModelPtr = 0; - fInvoker.removeContainerListener(this); - fInvoker.removeComponentListener(this); - fInvoker.removePropertyChangeListener(fPropertyListener); + synchronized (getTreeLock()) { + // Call super so that the NSMenu has been removed, before we release + // the delegate in removeMenuListeners + super.removeNotify(); + fItems.clear(); + if (fModelPtr != 0) { + removeMenuListeners(fModelPtr); + fModelPtr = 0; + fInvoker.removeContainerListener(this); + fInvoker.removeComponentListener(this); + fInvoker.removePropertyChangeListener(fPropertyListener); + } } } /** * Invoked when a component has been added to the container. */ + @Override public void componentAdded(final ContainerEvent e) { addItem(e.getChild()); } @@ -287,23 +284,26 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S /** * Invoked when a component has been removed from the container. */ + @Override public void componentRemoved(final ContainerEvent e) { final Component child = e.getChild(); final MenuItem sm = fItems.get(child); if (sm == null) return; - remove(sm); - fItems.remove(sm); - } + remove(sm); + fItems.remove(sm); + } /** * Invoked when the component's size changes. */ + @Override public void componentResized(final ComponentEvent e) {} /** * Invoked when the component's position changes. */ + @Override public void componentMoved(final ComponentEvent e) {} /** @@ -311,6 +311,7 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S * See componentHidden - we should still have a MenuItem * it just isn't inserted */ + @Override public void componentShown(final ComponentEvent e) { setVisible(true); } @@ -321,11 +322,12 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S * so we remove the ScreenMenuItem from the ScreenMenu * but leave it in fItems */ + @Override public void componentHidden(final ComponentEvent e) { setVisible(false); } - public void setVisible(final boolean b) { + private void setVisible(final boolean b) { // Tell our parent to add/remove us final MenuContainer parent = getParent(); @@ -333,20 +335,24 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S if (parent instanceof ScreenMenu) { final ScreenMenu sm = (ScreenMenu)parent; sm.setChildVisible(fInvoker, b); - } + } } } + @Override public void setChildVisible(final JMenuItem child, final boolean b) { fItems.remove(child); updateItems(); } + @Override public void setAccelerator(final KeyStroke ks) {} // only check and radio items can be indeterminate + @Override public void setIndeterminate(boolean indeterminate) { } + @Override public void setToolTipText(final String text) { final MenuComponentPeer peer = getPeer(); if (!(peer instanceof CMenuItem)) return; @@ -355,6 +361,7 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S cmi.setToolTipText(text); } + @Override public void setIcon(final Icon i) { final MenuComponentPeer peer = getPeer(); if (!(peer instanceof CMenuItem)) return; @@ -374,9 +381,8 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S /** * Gets a hashCode for a JMenu or JMenuItem or subclass so that we can compare for * changes in the Menu. - * */ - static int getHashCode(final Component m) { + private static int getHashCode(final Component m) { int hashCode = m.hashCode(); if (m instanceof JMenuItem) { @@ -408,7 +414,7 @@ class ScreenMenu extends Menu implements ContainerListener, ComponentListener, S return hashCode; } - void addItem(final Component m) { + private void addItem(final Component m) { if (!m.isVisible()) return; MenuItem sm = fItems.get(m); From 53b5f75095fbfdc11d0816de508bdde491844095 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Mon, 12 Aug 2013 13:47:21 -0700 Subject: [PATCH 064/983] 8022066: Evaluation of method reference to signature polymorphic method crashes VM Reviewed-by: jrose --- .../java/lang/invoke/MethodHandles.java | 4 + .../lang/invoke/MethodHandleConstants.java | 188 ++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 jdk/test/java/lang/invoke/MethodHandleConstants.java diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java index 8a435d06fca..2ee21d667c0 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java @@ -1289,6 +1289,10 @@ return mh1; : resolveOrFail(refKind, defc, name, (Class) type); return getDirectField(refKind, defc, field); } else if (MethodHandleNatives.refKindIsMethod(refKind)) { + if (defc == MethodHandle.class && refKind == REF_invokeVirtual) { + MethodHandle mh = findVirtualForMH(name, (MethodType) type); + if (mh != null) return mh; + } MemberName method = (resolved != null) ? resolved : resolveOrFail(refKind, defc, name, (MethodType) type); return getDirectMethod(refKind, defc, method, lookupClass); diff --git a/jdk/test/java/lang/invoke/MethodHandleConstants.java b/jdk/test/java/lang/invoke/MethodHandleConstants.java new file mode 100644 index 00000000000..57e041ba7bb --- /dev/null +++ b/jdk/test/java/lang/invoke/MethodHandleConstants.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 8022066 + * @summary smoke test for method handle constants + * @build indify.Indify + * @compile MethodHandleConstants.java + * @run main/othervm + * indify.Indify + * --verify-specifier-count=0 + * --expand-properties --classpath ${test.classes} + * --java test.java.lang.invoke.MethodHandleConstants --check-output + * @run main/othervm + * indify.Indify + * --expand-properties --classpath ${test.classes} + * --java test.java.lang.invoke.MethodHandleConstants --security-manager + */ + +package test.java.lang.invoke; + +import java.util.*; +import java.io.*; +import java.lang.invoke.*; +import java.security.*; + +import static java.lang.invoke.MethodHandles.*; +import static java.lang.invoke.MethodType.*; + +public class MethodHandleConstants { + public static void main(String... av) throws Throwable { + if (av.length > 0 && av[0].equals("--check-output")) openBuf(); + if (av.length > 0 && av[0].equals("--security-manager")) setSM(); + System.out.println("Obtaining method handle constants:"); + testCase(MH_String_replace_C2(), String.class, "replace", String.class, String.class, char.class, char.class); + testCase(MH_MethodHandle_invokeExact_SC2(), MethodHandle.class, "invokeExact", String.class, MethodHandle.class, String.class, char.class, char.class); + testCase(MH_MethodHandle_invoke_SC2(), MethodHandle.class, "invoke", String.class, MethodHandle.class, String.class, char.class, char.class); + testCase(MH_Class_forName_S(), Class.class, "forName", Class.class, String.class); + testCase(MH_Class_forName_SbCL(), Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class); + System.out.println("Done."); + closeBuf(); + } + + private static void testCase(MethodHandle mh, Class defc, String name, Class rtype, Class... ptypes) throws Throwable { + System.out.println(mh); + // we include defc, because we assume it is a non-static MH: + MethodType mt = methodType(rtype, ptypes); + assertEquals(mh.type(), mt); + // FIXME: Use revealDirect to find out more + } + private static void assertEquals(Object exp, Object act) { + if (exp == act || (exp != null && exp.equals(act))) return; + throw new AssertionError("not equal: "+exp+", "+act); + } + + private static void setSM() { + Policy.setPolicy(new TestPolicy()); + System.setSecurityManager(new SecurityManager()); + } + + private static PrintStream oldOut; + private static ByteArrayOutputStream buf; + private static void openBuf() { + oldOut = System.out; + buf = new ByteArrayOutputStream(); + System.setOut(new PrintStream(buf)); + } + private static void closeBuf() { + if (buf == null) return; + System.out.flush(); + System.setOut(oldOut); + String[] haveLines = new String(buf.toByteArray()).split("[\n\r]+"); + for (String line : haveLines) System.out.println(line); + Iterator iter = Arrays.asList(haveLines).iterator(); + for (String want : EXPECT_OUTPUT) { + String have = iter.hasNext() ? iter.next() : "[EOF]"; + if (want.equals(have)) continue; + System.err.println("want line: "+want); + System.err.println("have line: "+have); + throw new AssertionError("unexpected output: "+have); + } + if (iter.hasNext()) + throw new AssertionError("unexpected output: "+iter.next()); + } + private static final String[] EXPECT_OUTPUT = { + "Obtaining method handle constants:", + "MethodHandle(String,char,char)String", + "MethodHandle(MethodHandle,String,char,char)String", + "MethodHandle(MethodHandle,String,char,char)String", + "MethodHandle(String)Class", + "MethodHandle(String,boolean,ClassLoader)Class", + "Done." + }; + + // String.replace(String, char, char) + private static MethodType MT_String_replace_C2() { + shouldNotCallThis(); + return methodType(String.class, char.class, char.class); + } + private static MethodHandle MH_String_replace_C2() throws ReflectiveOperationException { + shouldNotCallThis(); + return lookup().findVirtual(String.class, "replace", MT_String_replace_C2()); + } + + // MethodHandle.invokeExact(...) + private static MethodType MT_MethodHandle_invokeExact_SC2() { + shouldNotCallThis(); + return methodType(String.class, String.class, char.class, char.class); + } + private static MethodHandle MH_MethodHandle_invokeExact_SC2() throws ReflectiveOperationException { + shouldNotCallThis(); + return lookup().findVirtual(MethodHandle.class, "invokeExact", MT_MethodHandle_invokeExact_SC2()); + } + + // MethodHandle.invoke(...) + private static MethodType MT_MethodHandle_invoke_SC2() { + shouldNotCallThis(); + return methodType(String.class, String.class, char.class, char.class); + } + private static MethodHandle MH_MethodHandle_invoke_SC2() throws ReflectiveOperationException { + shouldNotCallThis(); + return lookup().findVirtual(MethodHandle.class, "invoke", MT_MethodHandle_invoke_SC2()); + } + + // Class.forName(String) + private static MethodType MT_Class_forName_S() { + shouldNotCallThis(); + return methodType(Class.class, String.class); + } + private static MethodHandle MH_Class_forName_S() throws ReflectiveOperationException { + shouldNotCallThis(); + return lookup().findStatic(Class.class, "forName", MT_Class_forName_S()); + } + + // Class.forName(String, boolean, ClassLoader) + private static MethodType MT_Class_forName_SbCL() { + shouldNotCallThis(); + return methodType(Class.class, String.class, boolean.class, ClassLoader.class); + } + private static MethodHandle MH_Class_forName_SbCL() throws ReflectiveOperationException { + shouldNotCallThis(); + return lookup().findStatic(Class.class, "forName", MT_Class_forName_SbCL()); + } + + private static void shouldNotCallThis() { + // if this gets called, the transformation has not taken place + if (System.getProperty("MethodHandleConstants.allow-untransformed") != null) return; + throw new AssertionError("this code should be statically transformed away by Indify"); + } + + static class TestPolicy extends Policy { + final PermissionCollection permissions = new Permissions(); + TestPolicy() { + permissions.add(new java.io.FilePermission("<>", "read")); + } + public PermissionCollection getPermissions(ProtectionDomain domain) { + return permissions; + } + + public PermissionCollection getPermissions(CodeSource codesource) { + return permissions; + } + + public boolean implies(ProtectionDomain domain, Permission perm) { + return permissions.implies(perm); + } + } +} From 73aa07b6c5c56bc747c0ff14ac13ff3fdea70b39 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Wed, 14 Aug 2013 10:17:57 -0700 Subject: [PATCH 065/983] 8021355: REGRESSION: Five closed/java/awt/SplashScreen tests fail since 7u45 b01 on Linux, Solaris Reviewed-by: dholmes, anthony, ahgross, erikj --- jdk/src/solaris/bin/java_md_solinux.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/jdk/src/solaris/bin/java_md_solinux.c b/jdk/src/solaris/bin/java_md_solinux.c index b0028bde78d..05a5b3e34d8 100644 --- a/jdk/src/solaris/bin/java_md_solinux.c +++ b/jdk/src/solaris/bin/java_md_solinux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -958,9 +958,27 @@ static void* hSplashLib = NULL; void* SplashProcAddress(const char* name) { if (!hSplashLib) { - const char * splashLibPath; - splashLibPath = SPLASHSCREEN_SO; - hSplashLib = dlopen(splashLibPath, RTLD_LAZY | RTLD_GLOBAL); + int ret; + char jrePath[MAXPATHLEN]; + char splashPath[MAXPATHLEN]; + + if (!GetJREPath(jrePath, sizeof(jrePath), GetArch(), JNI_FALSE)) { + JLI_ReportErrorMessage(JRE_ERROR1); + return NULL; + } + ret = JLI_Snprintf(splashPath, sizeof(splashPath), "%s/lib/%s/%s", + jrePath, GetArch(), SPLASHSCREEN_SO); + + if (ret >= (int) sizeof(splashPath)) { + JLI_ReportErrorMessage(JRE_ERROR11); + return NULL; + } + if (ret < 0) { + JLI_ReportErrorMessage(JRE_ERROR13); + return NULL; + } + hSplashLib = dlopen(splashPath, RTLD_LAZY | RTLD_GLOBAL); + JLI_TraceLauncher("Info: loaded %s\n", splashPath); } if (hSplashLib) { void* sym = dlsym(hSplashLib, name); From 9b8991f944b3a1e10a073ab4b26ef3dd32511191 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 14 Aug 2013 15:25:16 +0800 Subject: [PATCH 066/983] 8022931: Enhance Kerberos exceptions Reviewed-by: xuelei, ahgross --- .../javax/security/auth/kerberos/KeyTab.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java index 631b7d02275..db815395e3a 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java @@ -26,6 +26,7 @@ package javax.security.auth.kerberos; import java.io.File; +import java.security.AccessControlException; import java.util.Objects; import sun.security.krb5.EncryptionKey; import sun.security.krb5.KerberosSecrets; @@ -214,9 +215,22 @@ public final class KeyTab { return new KeyTab(princ, null, true); } - //Takes a snapshot of the keytab content + // Takes a snapshot of the keytab content. This method is called by + // JavaxSecurityAuthKerberosAccessImpl so no more private sun.security.krb5.internal.ktab.KeyTab takeSnapshot() { - return sun.security.krb5.internal.ktab.KeyTab.getInstance(file); + try { + return sun.security.krb5.internal.ktab.KeyTab.getInstance(file); + } catch (AccessControlException ace) { + if (file != null) { + // It's OK to show the name if caller specified it + throw ace; + } else { + AccessControlException ace2 = new AccessControlException( + "Access to default keytab denied (modified exception)"); + ace2.setStackTrace(ace.getStackTrace()); + throw ace2; + } + } } /** From 73ddb82395f11287b3e46abef29c720d1c98b958 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 19 Aug 2013 12:30:48 +0200 Subject: [PATCH 067/983] 8022719: tools/launcher/RunpathTest.java fails after 8012146 Reviewed-by: chegar --- jdk/test/tools/launcher/RunpathTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jdk/test/tools/launcher/RunpathTest.java b/jdk/test/tools/launcher/RunpathTest.java index 631be16d975..675d7630dbe 100644 --- a/jdk/test/tools/launcher/RunpathTest.java +++ b/jdk/test/tools/launcher/RunpathTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7190813 + * @bug 7190813, 8022719 * @summary Check for extended RPATHs on *nixes * @compile -XDignore.symbol.file RunpathTest.java * @run main RunpathTest @@ -65,12 +65,10 @@ public class RunpathTest extends TestHelper { void testRpath() { if (isDualMode && is64Bit) { - String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch() - + ":\\$ORIGIN/../../jre/lib/" + getJreArch() + ".*"; + String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch() + ".*"; elfCheck(java64Cmd, expectedRpath); } else { - String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch() - + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*"; + String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch() + ".*"; elfCheck(javaCmd, expectedRpath); } } From c130ed36602208230609811e52c78c5fe58a784c Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 19 Aug 2013 14:48:08 +0200 Subject: [PATCH 068/983] 8023231: Remove comma from jtreg bug line Reviewed-by: alanb, chegar --- jdk/test/tools/launcher/RunpathTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/tools/launcher/RunpathTest.java b/jdk/test/tools/launcher/RunpathTest.java index 675d7630dbe..79b8b0ecca7 100644 --- a/jdk/test/tools/launcher/RunpathTest.java +++ b/jdk/test/tools/launcher/RunpathTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7190813, 8022719 + * @bug 7190813 8022719 * @summary Check for extended RPATHs on *nixes * @compile -XDignore.symbol.file RunpathTest.java * @run main RunpathTest From 49058214db19c8fa61461a60b97b77e3d2ab3fbe Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Mon, 19 Aug 2013 15:22:59 +0100 Subject: [PATCH 069/983] 8022940: Enhance CORBA translations Reviewed-by: coffeys, alanb, skoivu --- .../rmi/IDLNameTranslatorImpl.java | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java index dfe6581cc11..86a47992a72 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java @@ -905,28 +905,4 @@ public class IDLNameTranslatorImpl implements IDLNameTranslator { return contents.toString(); } - - public static void main(String[] args) { - - Class remoteInterface = java.rmi.Remote.class; - - if( args.length > 0 ) { - String className = args[0]; - try { - remoteInterface = Class.forName(className); - } catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } - - System.out.println("Building name translation for " + remoteInterface); - try { - IDLNameTranslator nameTranslator = - IDLNameTranslatorImpl.get(remoteInterface); - System.out.println(nameTranslator); - } catch(IllegalStateException ise) { - ise.printStackTrace(); - } - } } From 1b5eaa621e907e871ba0637cb7510ae7795f94de Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 19 Aug 2013 17:47:21 +0200 Subject: [PATCH 070/983] 8015614: Update build settings Reviewed-by: tbell, dholmes, ahgross --- hotspot/make/windows/makefiles/compile.make | 9 +++++++-- hotspot/make/windows/makefiles/sa.make | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hotspot/make/windows/makefiles/compile.make b/hotspot/make/windows/makefiles/compile.make index 6f8dcce3406..93454d75399 100644 --- a/hotspot/make/windows/makefiles/compile.make +++ b/hotspot/make/windows/makefiles/compile.make @@ -180,6 +180,7 @@ DEBUG_OPT_OPTION = /Od PRODUCT_OPT_OPTION = /O2 /Oy- FASTDEBUG_OPT_OPTION = /O2 /Oy- DEBUG_OPT_OPTION = /Od +SAFESEH_FLAG = /SAFESEH !endif !if "$(COMPILER_NAME)" == "VS2005" @@ -198,6 +199,7 @@ LD_FLAGS = /manifest $(LD_FLAGS) $(BUFFEROVERFLOWLIB) !if "x$(MT)" == "x" MT=mt.exe !endif +SAFESEH_FLAG = /SAFESEH !endif !if "$(COMPILER_NAME)" == "VS2008" @@ -211,6 +213,7 @@ LD_FLAGS = /manifest $(LD_FLAGS) !if "x$(MT)" == "x" MT=mt.exe !endif +SAFESEH_FLAG = /SAFESEH !endif !if "$(COMPILER_NAME)" == "VS2010" @@ -240,9 +243,11 @@ LD_FLAGS = /manifest $(LD_FLAGS) !if "x$(MT)" == "x" MT=mt.exe !endif -!if "$(BUILDARCH)" == "i486" -LD_FLAGS = /SAFESEH $(LD_FLAGS) +SAFESEH_FLAG = /SAFESEH !endif + +!if "$(BUILDARCH)" == "i486" +LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS) !endif # If NO_OPTIMIZATIONS is defined in the environment, turn everything off diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make index 9363f0e5e6f..356c4fd6b50 100644 --- a/hotspot/make/windows/makefiles/sa.make +++ b/hotspot/make/windows/makefiles/sa.make @@ -107,6 +107,9 @@ SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE) !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_LFLAGS = $(SA_LFLAGS) -map -debug !endif +!if "$(BUILDARCH)" == "i486" +SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS) +!endif # Note that we do not keep sawindbj.obj around as it would then # get included in the dumpbin command in build_vm_def.sh From b3505de64053a05578292514fec3477980b90e8a Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Tue, 20 Aug 2013 09:02:25 -0700 Subject: [PATCH 071/983] 8022682: Supporting XOM Reviewed-by: alanb, chegar, lancea --- .../xerces/internal/impl/PropertyManager.java | 19 ++ .../jaxp/validation/XMLSchemaFactory.java | 10 +- .../xerces/internal/parsers/DOMParser.java | 48 ++++ .../internal/parsers/DTDConfiguration.java | 11 +- .../parsers/NonValidatingConfiguration.java | 11 +- .../xerces/internal/parsers/SAXParser.java | 40 +++- .../internal/parsers/XML11Configuration.java | 4 - .../xerces/internal/parsers/XMLParser.java | 18 ++ .../xerces/internal/util/SecurityManager.java | 215 ++++++++++++++++++ .../internal/utils/XMLLimitAnalyzer.java | 3 + .../internal/utils/XMLSecurityManager.java | 34 +++ 11 files changed, 395 insertions(+), 18 deletions(-) create mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java index 8fbf9162409..2c8f3aff2c2 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java @@ -178,6 +178,25 @@ public class PropertyManager { supportedProps.put( Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY , new StaxEntityResolverWrapper((XMLResolver)value)) ; } + /** + * It's possible for users to set a security manager through the interface. + * If it's the old SecurityManager, convert it to the new XMLSecurityManager + */ + if (property.equals(Constants.SECURITY_MANAGER)) { + fSecurityManager = XMLSecurityManager.convert(value, fSecurityManager); + supportedProps.put(Constants.SECURITY_MANAGER, fSecurityManager); + return; + } + if (property.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (value == null) { + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + } else { + fSecurityPropertyMgr = (XMLSecurityPropertyManager)value; + } + supportedProps.put(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + return; + } + //check if the property is managed by security manager if (fSecurityManager == null || !fSecurityManager.setLimit(property, XMLSecurityManager.State.APIPROPERTY, value)) { diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java index 34eba4c4791..f2dadd0fc4a 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java @@ -408,9 +408,17 @@ public final class XMLSchemaFactory extends SchemaFactory { "ProperyNameNull", null)); } if (name.equals(SECURITY_MANAGER)) { - fSecurityManager = (XMLSecurityManager) object; + fSecurityManager = XMLSecurityManager.convert(object, fSecurityManager); fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); return; + } else if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (object == null) { + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + } else { + fSecurityPropertyMgr = (XMLSecurityPropertyManager)object; + } + fXMLSchemaLoader.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + return; } else if (name.equals(XMLGRAMMAR_POOL)) { throw new SAXNotSupportedException( diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java index f681fadbd33..f2020efda4b 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java @@ -29,6 +29,7 @@ import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.util.SymbolTable; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; @@ -531,7 +532,54 @@ public class DOMParser */ public void setProperty(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { + /** + * It's possible for users to set a security manager through the interface. + * If it's the old SecurityManager, convert it to the new XMLSecurityManager + */ + if (propertyId.equals(Constants.SECURITY_MANAGER)) { + securityManager = XMLSecurityManager.convert(value, securityManager); + setProperty0(Constants.SECURITY_MANAGER, securityManager); + return; + } + if (propertyId.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (value == null) { + securityPropertyManager = new XMLSecurityPropertyManager(); + } else { + securityPropertyManager = (XMLSecurityPropertyManager)value; + } + setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + return; + } + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + setProperty0(Constants.SECURITY_MANAGER, securityManager); + } + + if (securityPropertyManager == null) { + securityPropertyManager = new XMLSecurityPropertyManager(); + setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + } + int index = securityPropertyManager.getIndex(propertyId); + + if (index > -1) { + /** + * this is a direct call to this parser, not a subclass since + * internally the support of this property is done through + * XMLSecurityPropertyManager + */ + securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); + } else { + //check if the property is managed by security manager + if (!securityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) { + //fall back to the default configuration to handle the property + setProperty0(propertyId, value); + } + } + } + + public void setProperty0(String propertyId, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException { try { fConfiguration.setProperty(propertyId, value); } diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java index 0cdfd654b78..838dd9f5ec4 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java @@ -184,6 +184,13 @@ public class DTDConfiguration protected static final String LOCALE = Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY; + /** Property identifier: Security property manager. */ + protected static final String XML_SECURITY_PROPERTY_MANAGER = + Constants.XML_SECURITY_PROPERTY_MANAGER; + + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; + // debugging /** Set to true and recompile to print exception stack trace. */ @@ -328,7 +335,9 @@ public class DTDConfiguration VALIDATION_MANAGER, JAXP_SCHEMA_SOURCE, JAXP_SCHEMA_LANGUAGE, - LOCALE + LOCALE, + SECURITY_MANAGER, + XML_SECURITY_PROPERTY_MANAGER }; addRecognizedProperties(recognizedProperties); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java index 55339157c90..fb81834fce9 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java @@ -157,6 +157,13 @@ public class NonValidatingConfiguration protected static final String LOCALE = Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY; + /** Property identifier: Security property manager. */ + protected static final String XML_SECURITY_PROPERTY_MANAGER = + Constants.XML_SECURITY_PROPERTY_MANAGER; + + /** Property identifier: Security manager. */ + private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; + // debugging /** Set to true and recompile to print exception stack trace. */ @@ -310,7 +317,9 @@ public class NonValidatingConfiguration XMLGRAMMAR_POOL, DATATYPE_VALIDATOR_FACTORY, VALIDATION_MANAGER, - LOCALE + LOCALE, + SECURITY_MANAGER, + XML_SECURITY_PROPERTY_MANAGER }; addRecognizedProperties(recognizedProperties); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java index 8432b54541e..48b8a1ed538 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java @@ -77,8 +77,7 @@ public class SAXParser XMLGRAMMAR_POOL, }; - XMLSecurityManager securityManager; - XMLSecurityPropertyManager securityPropertyManager; + // // Constructors // @@ -132,9 +131,35 @@ public class SAXParser */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { + /** + * It's possible for users to set a security manager through the interface. + * If it's the old SecurityManager, convert it to the new XMLSecurityManager + */ + if (name.equals(Constants.SECURITY_MANAGER)) { + securityManager = XMLSecurityManager.convert(value, securityManager); + super.setProperty(Constants.SECURITY_MANAGER, securityManager); + return; + } + if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (value == null) { + securityPropertyManager = new XMLSecurityPropertyManager(); + } else { + securityPropertyManager = (XMLSecurityPropertyManager)value; + } + super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + return; + } + + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + super.setProperty(Constants.SECURITY_MANAGER, securityManager); + } + if (securityPropertyManager == null) { securityPropertyManager = new XMLSecurityPropertyManager(); + super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } + int index = securityPropertyManager.getIndex(name); if (index > -1) { /** @@ -143,19 +168,12 @@ public class SAXParser * XMLSecurityPropertyManager */ securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); - super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } else { - if (securityManager == null) { - securityManager = new XMLSecurityManager(true); - } - //check if the property is managed by security manager - if (securityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { - super.setProperty(Constants.SECURITY_MANAGER, securityManager); - } else { + if (!securityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + //fall back to the default configuration to handle the property super.setProperty(name, value); } - } } } // class SAXParser diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java index 3f22807e37e..bbcbceed10e 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java @@ -583,10 +583,6 @@ public class XML11Configuration extends ParserConfigurationSettings fVersionDetector = new XMLVersionDetector(); - fProperties.put(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); - - fProperties.put(SECURITY_MANAGER, new XMLSecurityManager(true)); - // add message formatters if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java index 210b7ce9cc6..970cc51cd26 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java @@ -23,6 +23,8 @@ package com.sun.org.apache.xerces.internal.parsers; import java.io.IOException; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; @@ -78,6 +80,13 @@ public abstract class XMLParser { /** The parser configuration. */ protected XMLParserConfiguration fConfiguration; + /** The XML Security Manager. */ + XMLSecurityManager securityManager; + + /** The XML Security Property Manager. */ + XMLSecurityPropertyManager securityPropertyManager; + + // // Constructors // @@ -118,6 +127,15 @@ public abstract class XMLParser { */ public void parse(XMLInputSource inputSource) throws XNIException, IOException { + // null indicates that the parser is called directly, initialize them + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + fConfiguration.setProperty(Constants.SECURITY_MANAGER, securityManager); + } + if (securityPropertyManager == null) { + securityPropertyManager = new XMLSecurityPropertyManager(); + fConfiguration.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + } reset(); fConfiguration.parse(inputSource); diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java new file mode 100644 index 00000000000..d916f5bc516 --- /dev/null +++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java @@ -0,0 +1,215 @@ +/* + * reserved comment block + * DO NOT REMOVE OR ALTER! + */ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 2003 The Apache Software Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.apache.org. For more + * information on the Apache Software Foundation, please see + * . + */ + +package com.sun.org.apache.xerces.internal.util; +import com.sun.org.apache.xerces.internal.impl.Constants; +/** + * This class is a container for parser settings that relate to + * security, or more specifically, it is intended to be used to prevent denial-of-service + * attacks from being launched against a system running Xerces. + * Any component that is aware of a denial-of-service attack that can arise + * from its processing of a certain kind of document may query its Component Manager + * for the property (http://apache.org/xml/properties/security-manager) + * whose value will be an instance of this class. + * If no value has been set for the property, the component should proceed in the "usual" (spec-compliant) + * manner. If a value has been set, then it must be the case that the component in + * question needs to know what method of this class to query. This class + * will provide defaults for all known security issues, but will also provide + * setters so that those values can be tailored by applications that care. + * + * @author Neil Graham, IBM + * + */ +public final class SecurityManager { + + // + // Constants + // + + // default value for entity expansion limit + private final static int DEFAULT_ENTITY_EXPANSION_LIMIT = 64000; + + /** Default value of number of nodes created. **/ + private final static int DEFAULT_MAX_OCCUR_NODE_LIMIT = 5000; + + // + // Data + // + + private final static int DEFAULT_ELEMENT_ATTRIBUTE_LIMIT = 10000; + + /** Entity expansion limit. **/ + private int entityExpansionLimit; + + /** W3C XML Schema maxOccurs limit. **/ + private int maxOccurLimit; + + private int fElementAttributeLimit; + // default constructor. Establishes default values for + // all known security holes. + /** + * Default constructor. Establishes default values + * for known security vulnerabilities. + */ + public SecurityManager() { + entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT ; + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + //We are reading system properties only once , + //at the time of creation of this object , + readSystemProperties(); + } + + /** + *

    Sets the number of entity expansions that the + * parser should permit in a document.

    + * + * @param limit the number of entity expansions + * permitted in a document + */ + public void setEntityExpansionLimit(int limit) { + entityExpansionLimit = limit; + } + + /** + *

    Returns the number of entity expansions + * that the parser permits in a document.

    + * + * @return the number of entity expansions + * permitted in a document + */ + public int getEntityExpansionLimit() { + return entityExpansionLimit; + } + + /** + *

    Sets the limit of the number of content model nodes + * that may be created when building a grammar for a W3C + * XML Schema that contains maxOccurs attributes with values + * other than "unbounded".

    + * + * @param limit the maximum value for maxOccurs other + * than "unbounded" + */ + public void setMaxOccurNodeLimit(int limit){ + maxOccurLimit = limit; + } + + /** + *

    Returns the limit of the number of content model nodes + * that may be created when building a grammar for a W3C + * XML Schema that contains maxOccurs attributes with values + * other than "unbounded".

    + * + * @return the maximum value for maxOccurs other + * than "unbounded" + */ + public int getMaxOccurNodeLimit(){ + return maxOccurLimit; + } + + public int getElementAttrLimit(){ + return fElementAttributeLimit; + } + + public void setElementAttrLimit(int limit){ + fElementAttributeLimit = limit; + } + + private void readSystemProperties(){ + + try { + String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT); + if(value != null && !value.equals("")){ + entityExpansionLimit = Integer.parseInt(value); + if (entityExpansionLimit < 0) + entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; + } + else + entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; + }catch(Exception ex){} + + try { + String value = System.getProperty(Constants.MAX_OCCUR_LIMIT); + if(value != null && !value.equals("")){ + maxOccurLimit = Integer.parseInt(value); + if (maxOccurLimit < 0) + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; + } + else + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; + }catch(Exception ex){} + + try { + String value = System.getProperty(Constants.ELEMENT_ATTRIBUTE_LIMIT); + if(value != null && !value.equals("")){ + fElementAttributeLimit = Integer.parseInt(value); + if ( fElementAttributeLimit < 0) + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + } + else + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + + }catch(Exception ex){} + + } + +} // class SecurityManager diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java index 41724b6c50d..82667edeed0 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java @@ -203,6 +203,9 @@ public final class XMLLimitAnalyzer { } public boolean isTracking(String name) { + if (entityStart == null) { + return false; + } return entityStart.equals(name); } /** diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java index 1ddb651d6df..a28e80dc81a 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java @@ -26,6 +26,7 @@ package com.sun.org.apache.xerces.internal.utils; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.util.SecurityManager; /** * This class manages standard and implementation-specific limitations. @@ -518,4 +519,37 @@ public final class XMLSecurityManager { } return false; } + + + /** + * Convert a value set through setProperty to XMLSecurityManager. + * If the value is an instance of XMLSecurityManager, use it to override the default; + * If the value is an old SecurityManager, convert to the new XMLSecurityManager. + * + * @param value user specified security manager + * @param securityManager an instance of XMLSecurityManager + * @return an instance of the new security manager XMLSecurityManager + */ + static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) { + if (value == null) { + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + } + return securityManager; + } + if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) { + return (XMLSecurityManager)value; + } else { + if (securityManager == null) { + securityManager = new XMLSecurityManager(true); + } + if (SecurityManager.class.isAssignableFrom(value.getClass())) { + SecurityManager origSM = (SecurityManager)value; + securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit()); + securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit()); + securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit()); + } + return securityManager; + } + } } From eaece57c8db014d1daace8ad1163a5d46e756e8a Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 22 Aug 2013 17:17:25 +0400 Subject: [PATCH 072/983] 8023536: Some regression tests have a wrong header Reviewed-by: alexsch --- jdk/test/java/beans/Performance/Test7122740.java | 2 +- jdk/test/java/beans/Performance/Test7184799.java | 2 +- jdk/test/javax/swing/JTree/8013571/Test8013571.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/beans/Performance/Test7122740.java b/jdk/test/java/beans/Performance/Test7122740.java index 4924c6e8f77..eb0cf3fc974 100644 --- a/jdk/test/java/beans/Performance/Test7122740.java +++ b/jdk/test/java/beans/Performance/Test7122740.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7122740 + * @bug 7187618 7122740 * @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance * @author Sergey Malenkov * @run main/manual Test7122740 diff --git a/jdk/test/java/beans/Performance/Test7184799.java b/jdk/test/java/beans/Performance/Test7184799.java index 563328abc7f..255638e8105 100644 --- a/jdk/test/java/beans/Performance/Test7184799.java +++ b/jdk/test/java/beans/Performance/Test7184799.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7184799 + * @bug 7187618 7184799 * @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance * @author Sergey Malenkov * @run main/manual Test7184799 diff --git a/jdk/test/javax/swing/JTree/8013571/Test8013571.java b/jdk/test/javax/swing/JTree/8013571/Test8013571.java index 15ad391dcf2..7ad92cdb3e3 100644 --- a/jdk/test/javax/swing/JTree/8013571/Test8013571.java +++ b/jdk/test/javax/swing/JTree/8013571/Test8013571.java @@ -27,8 +27,8 @@ import javax.swing.tree.DefaultTreeModel; /* * @test - * @bug 8016545 - * @summary Tests beans with public fields + * @bug 8013571 + * @summary Tests null as a root of TreeModelEvent * @author Sergey Malenkov */ From a4b39faa4fd60cc8171d7c81fd209b4e51590b53 Mon Sep 17 00:00:00 2001 From: Paul Rank Date: Thu, 22 Aug 2013 10:01:47 -0700 Subject: [PATCH 073/983] 8024896: Refactor java.time serialization tests into separate subpackage Move serialization tests to .serial subpackage Reviewed-by: sherman --- .../java/time/tck/java/time/TCKDuration.java | 20 -- .../java/time/tck/java/time/TCKInstant.java | 18 -- .../java/time/tck/java/time/TCKLocalDate.java | 22 -- .../time/tck/java/time/TCKLocalDateTime.java | 25 -- .../java/time/tck/java/time/TCKLocalTime.java | 57 ---- .../java/time/tck/java/time/TCKMonthDay.java | 18 -- .../time/tck/java/time/TCKOffsetDateTime.java | 37 --- .../time/tck/java/time/TCKOffsetTime.java | 34 --- .../java/time/tck/java/time/TCKPeriod.java | 8 - jdk/test/java/time/tck/java/time/TCKYear.java | 19 -- .../java/time/tck/java/time/TCKYearMonth.java | 18 -- .../java/time/tck/java/time/TCKZoneId.java | 104 ------- .../time/tck/java/time/TCKZoneOffset.java | 40 --- .../time/tck/java/time/TCKZonedDateTime.java | 48 ---- .../java/time/chrono/TCKChronoLocalDate.java | 17 -- .../time/chrono/TCKChronoLocalDateTime.java | 17 -- .../chrono/serial/TCKChronoLocalDate.java | 111 ++++++++ .../chrono/serial/TCKChronoLocalDateTime.java | 110 ++++++++ .../TCKChronologySerialization.java | 8 +- .../tck/java/time/serial/TCKDuration.java | 95 +++++++ .../time/tck/java/time/serial/TCKInstant.java | 95 +++++++ .../tck/java/time/serial/TCKLocalDate.java | 107 +++++++ .../java/time/serial/TCKLocalDateTime.java | 104 +++++++ .../tck/java/time/serial/TCKLocalTime.java | 145 ++++++++++ .../tck/java/time/serial/TCKMonthDay.java | 107 +++++++ .../java/time/serial/TCKOffsetDateTime.java | 127 +++++++++ .../tck/java/time/serial/TCKOffsetTime.java | 122 ++++++++ .../time/tck/java/time/serial/TCKPeriod.java | 82 ++++++ .../time/tck/java/time/serial/TCKYear.java | 94 +++++++ .../tck/java/time/serial/TCKYearMonth.java | 106 +++++++ .../time/tck/java/time/serial/TCKZoneId.java | 263 ++++++++++++++++++ .../tck/java/time/serial/TCKZoneOffset.java | 118 ++++++++ .../java/time/serial/TCKZonedDateTime.java | 143 ++++++++++ .../tck/java/time/temporal/TCKWeekFields.java | 6 - .../time/temporal/serial/TCKWeekFields.java | 94 +++++++ .../tck/java/time/zone/TCKFixedZoneRules.java | 18 -- .../time/zone/TCKZoneOffsetTransition.java | 14 - .../zone/TCKZoneOffsetTransitionRule.java | 25 -- .../time/tck/java/time/zone/TCKZoneRules.java | 21 -- .../time/zone/serial/TCKFixedZoneRules.java | 117 ++++++++ .../zone/serial/TCKZoneOffsetTransition.java | 91 ++++++ .../serial/TCKZoneOffsetTransitionRule.java | 114 ++++++++ .../java/time/zone/serial/TCKZoneRules.java | 122 ++++++++ 43 files changed, 2471 insertions(+), 590 deletions(-) create mode 100644 jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java create mode 100644 jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java rename jdk/test/java/time/tck/java/time/chrono/{ => serial}/TCKChronologySerialization.java (96%) create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKDuration.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKInstant.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKPeriod.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKYear.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKZoneId.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java create mode 100644 jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java create mode 100644 jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java create mode 100644 jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java create mode 100644 jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java create mode 100644 jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java diff --git a/jdk/test/java/time/tck/java/time/TCKDuration.java b/jdk/test/java/time/tck/java/time/TCKDuration.java index bae2cf69805..c3bb0c9c906 100644 --- a/jdk/test/java/time/tck/java/time/TCKDuration.java +++ b/jdk/test/java/time/tck/java/time/TCKDuration.java @@ -103,26 +103,6 @@ public class TCKDuration extends AbstractTCKTest { private static final long CYCLE_SECS = 146097L * 86400L; - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(Duration.ofHours(5)); - assertSerializable(Duration.ofHours(0)); - assertSerializable(Duration.ofHours(-5)); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(1); - dos.writeLong(654321); - dos.writeInt(123456789); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes); - } - //----------------------------------------------------------------------- // constants //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKInstant.java b/jdk/test/java/time/tck/java/time/TCKInstant.java index 05d7b83fcf1..bb3a765de42 100644 --- a/jdk/test/java/time/tck/java/time/TCKInstant.java +++ b/jdk/test/java/time/tck/java/time/TCKInstant.java @@ -154,24 +154,6 @@ public class TCKInstant extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(Instant.ofEpochMilli(134l)); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(2); - dos.writeLong(654321); - dos.writeInt(123456789); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes); - } - //----------------------------------------------------------------------- private void check(Instant instant, long epochSecs, int nos) { assertEquals(instant.getEpochSecond(), epochSecs); diff --git a/jdk/test/java/time/tck/java/time/TCKLocalDate.java b/jdk/test/java/time/tck/java/time/TCKLocalDate.java index 597dd4f6574..3d4cbbbc884 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalDate.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalDate.java @@ -196,28 +196,6 @@ public class TCKLocalDate extends AbstractDateTimeTest { return list; } - - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(TEST_2007_07_15); - assertSerializable(LocalDate.MIN); - assertSerializable(LocalDate.MAX); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(3); - dos.writeInt(2012); - dos.writeByte(9); - dos.writeByte(16); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes); - } - //----------------------------------------------------------------------- private void check(LocalDate test, int y, int m, int d) { assertEquals(test.getYear(), y); diff --git a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java index f55bdb4a961..040704cd9bc 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java @@ -241,31 +241,6 @@ public class TCKLocalDateTime extends AbstractDateTimeTest { return LocalDateTime.of(year, month, day, 0, 0); } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(TEST_2007_07_15_12_30_40_987654321); - assertSerializable(LocalDateTime.MIN); - assertSerializable(LocalDateTime.MAX); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(5); - dos.writeInt(2012); - dos.writeByte(9); - dos.writeByte(16); - dos.writeByte(22); - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(459_000_000); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes); - } - //----------------------------------------------------------------------- // constants //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKLocalTime.java b/jdk/test/java/time/tck/java/time/TCKLocalTime.java index dbba80d1cec..2291b5ca16b 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalTime.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalTime.java @@ -191,64 +191,7 @@ public class TCKLocalTime extends AbstractDateTimeTest { } //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(TEST_12_30_40_987654321); - assertSerializable(LocalTime.MIN); - assertSerializable(LocalTime.MAX); - } - @Test - public void test_serialization_format_h() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(4); - dos.writeByte(-1 - 22); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalTime.of(22, 0), bytes); - } - - @Test - public void test_serialization_format_hm() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(4); - dos.writeByte(22); - dos.writeByte(-1 - 17); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalTime.of(22, 17), bytes); - } - - @Test - public void test_serialization_format_hms() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(4); - dos.writeByte(22); - dos.writeByte(17); - dos.writeByte(-1 - 59); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalTime.of(22, 17, 59), bytes); - } - - @Test - public void test_serialization_format_hmsn() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(4); - dos.writeByte(22); - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(459_000_000); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes); - } - - //----------------------------------------------------------------------- private void check(LocalTime test, int h, int m, int s, int n) { assertEquals(test.getHour(), h); assertEquals(test.getMinute(), m); diff --git a/jdk/test/java/time/tck/java/time/TCKMonthDay.java b/jdk/test/java/time/tck/java/time/TCKMonthDay.java index f2a2b93f473..e9b1730cb71 100644 --- a/jdk/test/java/time/tck/java/time/TCKMonthDay.java +++ b/jdk/test/java/time/tck/java/time/TCKMonthDay.java @@ -136,24 +136,6 @@ public class TCKMonthDay extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws ClassNotFoundException, IOException { - assertSerializable(TEST_07_15); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(13); // java.time.temporal.Ser.MONTH_DAY_TYPE - dos.writeByte(9); - dos.writeByte(16); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(MonthDay.of(9, 16), bytes); - } - //----------------------------------------------------------------------- void check(MonthDay test, int m, int d) { assertEquals(test.getMonth().getValue(), m); diff --git a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java index 7cfc2a61dec..0cf024fdde1 100644 --- a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java @@ -209,43 +209,6 @@ public class TCKOffsetDateTime extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(TEST_2008_6_30_11_30_59_000000500); - assertSerializable(OffsetDateTime.MIN); - assertSerializable(OffsetDateTime.MAX); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(10); // java.time.Ser.OFFSET_DATE_TIME_TYPE - } - byte[] bytes = baos.toByteArray(); - ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) { - dos.writeByte(5); - dos.writeInt(2012); - dos.writeByte(9); - dos.writeByte(16); - dos.writeByte(22); - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(464_000_000); - } - byte[] bytesDateTime = baosDateTime.toByteArray(); - ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { - dos.writeByte(8); - dos.writeByte(4); // quarter hours stored: 3600 / 900 - } - byte[] bytesOffset = baosOffset.toByteArray(); - LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000); - assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset); - } - //----------------------------------------------------------------------- // constants //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java index b3d7e5b26a9..ee5b2d3f69f 100644 --- a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java +++ b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java @@ -183,40 +183,6 @@ public class TCKOffsetTime extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(TEST_11_30_59_500_PONE); - assertSerializable(OffsetTime.MIN); - assertSerializable(OffsetTime.MAX); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(9); // java.time.Ser.OFFSET_TIME_TYPE - } - byte[] bytes = baos.toByteArray(); - ByteArrayOutputStream baosTime = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosTime) ) { - dos.writeByte(4); - dos.writeByte(22); - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(464_000_000); - } - byte[] bytesTime = baosTime.toByteArray(); - ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { - dos.writeByte(8); - dos.writeByte(4); // quarter hours stored: 3600 / 900 - } - byte[] bytesOffset = baosOffset.toByteArray(); - assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes, - bytesTime, bytesOffset); - } - //----------------------------------------------------------------------- // constants //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKPeriod.java b/jdk/test/java/time/tck/java/time/TCKPeriod.java index 7a06b95e6ef..3a1fe42ec45 100644 --- a/jdk/test/java/time/tck/java/time/TCKPeriod.java +++ b/jdk/test/java/time/tck/java/time/TCKPeriod.java @@ -86,14 +86,6 @@ import org.testng.annotations.Test; @Test public class TCKPeriod extends AbstractTCKTest { - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(Period.ZERO); - assertSerializable(Period.ofDays(1)); - assertSerializable(Period.of(1, 2, 3)); - } - //----------------------------------------------------------------------- // ofYears(int) //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKYear.java b/jdk/test/java/time/tck/java/time/TCKYear.java index 53f0db0b56e..c0a35967a7b 100644 --- a/jdk/test/java/time/tck/java/time/TCKYear.java +++ b/jdk/test/java/time/tck/java/time/TCKYear.java @@ -151,25 +151,6 @@ public class TCKYear extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(Year.of(2)); - assertSerializable(Year.of(0)); - assertSerializable(Year.of(-2)); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(11); // java.time.temporal.Ser.YEAR_TYPE - dos.writeInt(2012); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(Year.of(2012), bytes); - } - //----------------------------------------------------------------------- // now() //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKYearMonth.java b/jdk/test/java/time/tck/java/time/TCKYearMonth.java index 66f691b0746..e1f1a466574 100644 --- a/jdk/test/java/time/tck/java/time/TCKYearMonth.java +++ b/jdk/test/java/time/tck/java/time/TCKYearMonth.java @@ -156,24 +156,6 @@ public class TCKYearMonth extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws IOException, ClassNotFoundException { - assertSerializable(TEST_2008_06); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(12); // java.time.temporal.Ser.YEAR_MONTH_TYPE - dos.writeInt(2012); - dos.writeByte(9); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(YearMonth.of(2012, 9), bytes); - } - //----------------------------------------------------------------------- void check(YearMonth test, int y, int m) { assertEquals(test.getYear(), y); diff --git a/jdk/test/java/time/tck/java/time/TCKZoneId.java b/jdk/test/java/time/tck/java/time/TCKZoneId.java index c63b393d29d..0d47403db4e 100644 --- a/jdk/test/java/time/tck/java/time/TCKZoneId.java +++ b/jdk/test/java/time/tck/java/time/TCKZoneId.java @@ -92,110 +92,6 @@ import org.testng.annotations.Test; @Test public class TCKZoneId extends AbstractTCKTest { - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(ZoneId.of("Europe/London")); - assertSerializable(ZoneId.of("America/Chicago")); - } - - @Test - public void test_serialization_format() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(7); - dos.writeUTF("Europe/London"); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(ZoneId.of("Europe/London"), bytes); - } - - @Test - public void test_deserialization_lenient_characters() throws Exception { - // an ID can be loaded without validation during deserialization - String id = "QWERTYUIOPASDFGHJKLZXCVBNM~/._+-"; - ZoneId deser = deserialize(id); - // getId, equals, hashCode, toString and normalized are OK - assertEquals(deser.getId(), id); - assertEquals(deser.toString(), id); - assertEquals(deser, deser); - assertEquals(deser.hashCode(), deser.hashCode()); - assertEquals(deser.normalized(), deser); - // getting the rules is not - try { - deser.getRules(); - fail(); - } catch (ZoneRulesException ex) { - // expected - } - } - - @Test(expectedExceptions=DateTimeException.class) - public void test_deserialization_lenient_badCharacters() throws Exception { - // an ID can be loaded without validation during deserialization - // but there is a check to ensure the ID format is valid - deserialize("|!?"); - } - - @Test(dataProvider="offsetBasedValid") - public void test_deserialization_lenient_offsetNotAllowed_noPrefix(String input, String resolvedId) throws Exception { - ZoneId deserialized = deserialize(input); - assertEquals(deserialized, ZoneId.of(input)); - assertEquals(deserialized, ZoneId.of(resolvedId)); - } - - @Test(dataProvider="offsetBasedValidPrefix") - public void test_deserialization_lenient_offsetNotAllowed_prefixUTC(String input, String resolvedId, String offsetId) throws Exception { - ZoneId deserialized = deserialize("UTC" + input); - assertEquals(deserialized, ZoneId.of("UTC" + input)); - assertEquals(deserialized, ZoneId.of("UTC" + resolvedId)); - } - - @Test(dataProvider="offsetBasedValidPrefix") - public void test_deserialization_lenient_offsetNotAllowed_prefixGMT(String input, String resolvedId, String offsetId) throws Exception { - ZoneId deserialized = deserialize("GMT" + input); - assertEquals(deserialized, ZoneId.of("GMT" + input)); - assertEquals(deserialized, ZoneId.of("GMT" + resolvedId)); - } - - @Test(dataProvider="offsetBasedValidPrefix") - public void test_deserialization_lenient_offsetNotAllowed_prefixUT(String input, String resolvedId, String offsetId) throws Exception { - ZoneId deserialized = deserialize("UT" + input); - assertEquals(deserialized, ZoneId.of("UT" + input)); - assertEquals(deserialized, ZoneId.of("UT" + resolvedId)); - } - - private ZoneId deserialize(String id) throws Exception { - String serClass = ZoneId.class.getPackage().getName() + ".Ser"; - Class serCls = Class.forName(serClass); - Field field = serCls.getDeclaredField("serialVersionUID"); - field.setAccessible(true); - long serVer = (Long) field.get(null); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos)) { - dos.writeShort(ObjectStreamConstants.STREAM_MAGIC); - dos.writeShort(ObjectStreamConstants.STREAM_VERSION); - dos.writeByte(ObjectStreamConstants.TC_OBJECT); - dos.writeByte(ObjectStreamConstants.TC_CLASSDESC); - dos.writeUTF(serClass); - dos.writeLong(serVer); - dos.writeByte(ObjectStreamConstants.SC_EXTERNALIZABLE | ObjectStreamConstants.SC_BLOCK_DATA); - dos.writeShort(0); // number of fields - dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); // end of classdesc - dos.writeByte(ObjectStreamConstants.TC_NULL); // no superclasses - dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA); - dos.writeByte(1 + 2 + id.length()); // length of data (1 byte + 2 bytes UTF length + 32 bytes UTF) - dos.writeByte(7); // ZoneId - dos.writeUTF(id); - dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); // end of blockdata - } - ZoneId deser = null; - try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) { - deser = (ZoneId) ois.readObject(); - } - return deser; - } - //----------------------------------------------------------------------- // OLD_SHORT_IDS //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKZoneOffset.java b/jdk/test/java/time/tck/java/time/TCKZoneOffset.java index 94f2eb52e64..cf9098a188b 100644 --- a/jdk/test/java/time/tck/java/time/TCKZoneOffset.java +++ b/jdk/test/java/time/tck/java/time/TCKZoneOffset.java @@ -120,46 +120,6 @@ public class TCKZoneOffset extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws Exception { - assertSerializable(ZoneOffset.of("+01:30")); - } - - @Test - public void test_serialization_format_quarterPositive() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(8); - dos.writeByte(6); // stored as quarter hours - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes); - } - - @Test - public void test_serialization_format_quarterNegative() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(8); - dos.writeByte(-10); // stored as quarter hours - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes); - } - - @Test - public void test_serialization_format_full() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(8); - dos.writeByte(127); - dos.writeInt(53265); - } - byte[] bytes = baos.toByteArray(); - assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes); - } - //----------------------------------------------------------------------- // constants //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java index d1db67fca90..1f5bee32283 100644 --- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java @@ -222,54 +222,6 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { return list; } - //----------------------------------------------------------------------- - @Test - public void test_serialization() throws ClassNotFoundException, IOException { - assertSerializable(TEST_DATE_TIME); - } - - @Test - public void test_serialization_format_zoneId() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(6); - dos.writeInt(2012); // date - dos.writeByte(9); - dos.writeByte(16); - dos.writeByte(22); // time - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(470_000_000); - dos.writeByte(4); // offset - dos.writeByte(7); // zoneId - dos.writeUTF("Europe/London"); - } - byte[] bytes = baos.toByteArray(); - ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneId.of("Europe/London")); - assertSerializedBySer(zdt, bytes); - } - - @Test - public void test_serialization_format_zoneOffset() throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baos) ) { - dos.writeByte(6); - dos.writeInt(2012); // date - dos.writeByte(9); - dos.writeByte(16); - dos.writeByte(22); // time - dos.writeByte(17); - dos.writeByte(59); - dos.writeInt(470_000_000); - dos.writeByte(4); // offset - dos.writeByte(8); // zoneId - dos.writeByte(4); - } - byte[] bytes = baos.toByteArray(); - ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneOffset.ofHours(1)); - assertSerializedBySer(zdt, bytes); - } - //----------------------------------------------------------------------- // now() //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java index 92f083ef6f4..32001354ff2 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java @@ -306,23 +306,6 @@ public class TCKChronoLocalDate { } } - //----------------------------------------------------------------------- - // Test Serialization of Calendars - //----------------------------------------------------------------------- - @Test( dataProvider="calendars") - public void test_ChronoSerialization(Chronology chrono) throws Exception { - LocalDate ref = LocalDate.of(2013, 1, 5); - ChronoLocalDate orginal = chrono.date(ref); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - @SuppressWarnings("unchecked") - ChronoLocalDate ser = (ChronoLocalDate) in.readObject(); - assertEquals(ser, orginal, "deserialized date is wrong"); - } //----------------------------------------------------------------------- @Test(dataProvider="calendars") diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java index 129a1903998..7ca03e2e3fb 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java @@ -317,23 +317,6 @@ public class TCKChronoLocalDateTime { } } - //----------------------------------------------------------------------- - // Test Serialization of ISO via chrono API - //----------------------------------------------------------------------- - @Test( dataProvider="calendars") - public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception { - LocalDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3); - ChronoLocalDateTime orginal = chrono.date(ref).atTime(ref.toLocalTime()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - ChronoLocalDateTime ser = (ChronoLocalDateTime) in.readObject(); - assertEquals(ser, orginal, "deserialized date is wrong"); - } - //----------------------------------------------------------------------- @Test(dataProvider="calendars") public void test_from_TemporalAccessor(Chronology chrono) { diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java new file mode 100644 index 00000000000..4bec5cdc952 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono.serial; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.LocalDate; +import java.time.chrono.*; + +import static org.testng.Assert.assertEquals; + +/** + * Test assertions that must be true for all built-in chronologies. + */ +@Test +public class TCKChronoLocalDate { + + //----------------------------------------------------------------------- + // regular data factory for names and descriptions of available calendars + //----------------------------------------------------------------------- + @DataProvider(name = "calendars") + Chronology[][] data_of_calendars() { + return new Chronology[][]{ + {HijrahChronology.INSTANCE}, + {IsoChronology.INSTANCE}, + {JapaneseChronology.INSTANCE}, + {MinguoChronology.INSTANCE}, + {ThaiBuddhistChronology.INSTANCE}}; + } + + + //----------------------------------------------------------------------- + // Test Serialization of Calendars + //----------------------------------------------------------------------- + @Test( dataProvider="calendars") + public void test_ChronoSerialization(Chronology chrono) throws Exception { + LocalDate ref = LocalDate.of(2013, 1, 5); + ChronoLocalDate orginal = chrono.date(ref); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(orginal); + out.close(); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + ObjectInputStream in = new ObjectInputStream(bais); + @SuppressWarnings("unchecked") + ChronoLocalDate ser = (ChronoLocalDate) in.readObject(); + assertEquals(ser, orginal, "deserialized date is wrong"); + } + + //----------------------------------------------------------------------- + +} diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java new file mode 100644 index 00000000000..1ab1cda92c5 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono.serial; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.chrono.*; + +import static org.testng.Assert.assertEquals; + +/** + * Test assertions that must be true for all built-in chronologies. + */ +@Test +public class TCKChronoLocalDateTime { + + //----------------------------------------------------------------------- + // regular data factory for available calendars + //----------------------------------------------------------------------- + @DataProvider(name = "calendars") + Chronology[][] data_of_calendars() { + return new Chronology[][]{ + {HijrahChronology.INSTANCE}, + {IsoChronology.INSTANCE}, + {JapaneseChronology.INSTANCE}, + {MinguoChronology.INSTANCE}, + {ThaiBuddhistChronology.INSTANCE}}; + } + + //----------------------------------------------------------------------- + // Test Serialization ZonedDateTime for each Chronology + //----------------------------------------------------------------------- + @Test( dataProvider="calendars") + public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception { + LocalDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3); + ChronoLocalDateTime orginal = chrono.date(ref).atTime(ref.toLocalTime()); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(orginal); + out.close(); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + ObjectInputStream in = new ObjectInputStream(bais); + ChronoLocalDateTime ser = (ChronoLocalDateTime) in.readObject(); + assertEquals(ser, orginal, "deserialized date is wrong"); + } + + //----------------------------------------------------------------------- + +} diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronologySerialization.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java similarity index 96% rename from jdk/test/java/time/tck/java/time/chrono/TCKChronologySerialization.java rename to jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java index 35620ad755e..aed919adafa 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronologySerialization.java +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java @@ -54,7 +54,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package tck.java.time.chrono; +package tck.java.time.chrono.serial; import static org.testng.Assert.assertEquals; @@ -73,6 +73,7 @@ import java.time.chrono.ThaiBuddhistChronology; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +@Test public class TCKChronologySerialization { //----------------------------------------------------------------------- @@ -93,13 +94,12 @@ public class TCKChronologySerialization { //----------------------------------------------------------------------- @Test(dataProvider="calendars") public void test_ChronoSerialization(Chronology chrono) throws Exception { + System.out.printf(" ChronoSerialization: %s%n", chrono); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(chrono); out.close(); - - byte[] bytes = baos.toByteArray(); - ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream in = new ObjectInputStream(bais); @SuppressWarnings("unchecked") diff --git a/jdk/test/java/time/tck/java/time/serial/TCKDuration.java b/jdk/test/java/time/tck/java/time/serial/TCKDuration.java new file mode 100644 index 00000000000..e4a9a3f9a18 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKDuration.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.Duration; + +/** + * Test Duration. + */ +@Test +public class TCKDuration extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(Duration.ofHours(5)); + assertSerializable(Duration.ofHours(0)); + assertSerializable(Duration.ofHours(-5)); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(1); + dos.writeLong(654321); + dos.writeInt(123456789); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes); + } + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKInstant.java b/jdk/test/java/time/tck/java/time/serial/TCKInstant.java new file mode 100644 index 00000000000..783ad586375 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKInstant.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.Instant; + +/** + * Test Instant. + */ +@Test +public class TCKInstant extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(Instant.ofEpochMilli(134l)); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(2); + dos.writeLong(654321); + dos.writeInt(123456789); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java new file mode 100644 index 00000000000..aeaa96d372d --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.LocalDate; + +/** + * Test LocalDate. + */ +@Test +public class TCKLocalDate extends AbstractTCKTest { + + private LocalDate TEST_2007_07_15; + + @BeforeMethod + public void setUp() { + TEST_2007_07_15 = LocalDate.of(2007, 7, 15); + } + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(TEST_2007_07_15); + assertSerializable(LocalDate.MIN); + assertSerializable(LocalDate.MAX); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(3); + dos.writeInt(2012); + dos.writeByte(9); + dos.writeByte(16); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes); + } + + //----------------------------------------------------------------------- + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java new file mode 100644 index 00000000000..a2ae9d2357c --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.LocalDateTime; + +/** + * Test LocalDateTime. + */ +@Test +public class TCKLocalDateTime extends AbstractTCKTest { + + private LocalDateTime TEST_2007_07_15_12_30_40_987654321 = LocalDateTime.of(2007, 7, 15, 12, 30, 40, 987654321); + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(TEST_2007_07_15_12_30_40_987654321); + assertSerializable(LocalDateTime.MIN); + assertSerializable(LocalDateTime.MAX); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(5); + dos.writeInt(2012); + dos.writeByte(9); + dos.writeByte(16); + dos.writeByte(22); + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(459_000_000); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes); + } + + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java new file mode 100644 index 00000000000..06f2ce4c898 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.LocalTime; + +/** + * Test LocalTime. + */ +@Test +public class TCKLocalTime extends AbstractTCKTest { + + + private LocalTime TEST_12_30_40_987654321; + + + @BeforeMethod + public void setUp() { + TEST_12_30_40_987654321 = LocalTime.of(12, 30, 40, 987654321); + } + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(TEST_12_30_40_987654321); + assertSerializable(LocalTime.MIN); + assertSerializable(LocalTime.MAX); + } + + @Test + public void test_serialization_format_h() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(4); + dos.writeByte(-1 - 22); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalTime.of(22, 0), bytes); + } + + @Test + public void test_serialization_format_hm() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(4); + dos.writeByte(22); + dos.writeByte(-1 - 17); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalTime.of(22, 17), bytes); + } + + @Test + public void test_serialization_format_hms() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(4); + dos.writeByte(22); + dos.writeByte(17); + dos.writeByte(-1 - 59); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalTime.of(22, 17, 59), bytes); + } + + @Test + public void test_serialization_format_hmsn() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(4); + dos.writeByte(22); + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(459_000_000); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java b/jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java new file mode 100644 index 00000000000..cd441663099 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.time.MonthDay; + +/** + * Test MonthDay. + */ +@Test +public class TCKMonthDay extends AbstractTCKTest { + + private MonthDay TEST_07_15; + + @BeforeMethod + public void setUp() { + TEST_07_15 = MonthDay.of(7, 15); + } + + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws ClassNotFoundException, IOException { + assertSerializable(TEST_07_15); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(13); // java.time.temporal.Ser.MONTH_DAY_TYPE + dos.writeByte(9); + dos.writeByte(16); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(MonthDay.of(9, 16), bytes); + } + + //----------------------------------------------------------------------- + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java new file mode 100644 index 00000000000..8a1406b8727 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Test OffsetDateTime. + */ +@Test +public class TCKOffsetDateTime extends AbstractTCKTest { + + private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); + private OffsetDateTime TEST_2008_6_30_11_30_59_000000500; + + @BeforeMethod + public void setUp() { + TEST_2008_6_30_11_30_59_000000500 = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 500, OFFSET_PONE); + } + + //----------------------------------------------------------------------- + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(TEST_2008_6_30_11_30_59_000000500); + assertSerializable(OffsetDateTime.MIN); + assertSerializable(OffsetDateTime.MAX); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(10); // java.time.Ser.OFFSET_DATE_TIME_TYPE + } + byte[] bytes = baos.toByteArray(); + ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) { + dos.writeByte(5); + dos.writeInt(2012); + dos.writeByte(9); + dos.writeByte(16); + dos.writeByte(22); + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(464_000_000); + } + byte[] bytesDateTime = baosDateTime.toByteArray(); + ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { + dos.writeByte(8); + dos.writeByte(4); // quarter hours stored: 3600 / 900 + } + byte[] bytesOffset = baosOffset.toByteArray(); + LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000); + assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java new file mode 100644 index 00000000000..6bdddba2fb3 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.OffsetTime; +import java.time.ZoneOffset; + +/** + * Test OffsetTime. + */ +@Test +public class TCKOffsetTime extends AbstractTCKTest { + + private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); + private OffsetTime TEST_11_30_59_500_PONE; + + @BeforeMethod + public void setUp() { + TEST_11_30_59_500_PONE = OffsetTime.of(11, 30, 59, 500, OFFSET_PONE); + } + + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(TEST_11_30_59_500_PONE); + assertSerializable(OffsetTime.MIN); + assertSerializable(OffsetTime.MAX); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(9); // java.time.Ser.OFFSET_TIME_TYPE + } + byte[] bytes = baos.toByteArray(); + ByteArrayOutputStream baosTime = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baosTime) ) { + dos.writeByte(4); + dos.writeByte(22); + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(464_000_000); + } + byte[] bytesTime = baosTime.toByteArray(); + ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { + dos.writeByte(8); + dos.writeByte(4); // quarter hours stored: 3600 / 900 + } + byte[] bytesOffset = baosOffset.toByteArray(); + assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes, + bytesTime, bytesOffset); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKPeriod.java b/jdk/test/java/time/tck/java/time/serial/TCKPeriod.java new file mode 100644 index 00000000000..2f94df132f0 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKPeriod.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.time.Period; + +/** + * Test Period. + */ +@Test +public class TCKPeriod extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(Period.ZERO); + assertSerializable(Period.ofDays(1)); + assertSerializable(Period.of(1, 2, 3)); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKYear.java b/jdk/test/java/time/tck/java/time/serial/TCKYear.java new file mode 100644 index 00000000000..954dacf0c99 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKYear.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.Year; + +/** + * Test Year. + */ +@Test +public class TCKYear extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(Year.of(2)); + assertSerializable(Year.of(0)); + assertSerializable(Year.of(-2)); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(11); // java.time.temporal.Ser.YEAR_TYPE + dos.writeInt(2012); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(Year.of(2012), bytes); + } + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java b/jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java new file mode 100644 index 00000000000..675767d976c --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.time.YearMonth; + +/** + * Test YearMonth. + */ +@Test +public class TCKYearMonth extends AbstractTCKTest { + + private YearMonth TEST_2008_06; + + @BeforeMethod + public void setUp() { + TEST_2008_06 = YearMonth.of(2008, 6); + } + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws IOException, ClassNotFoundException { + assertSerializable(TEST_2008_06); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(12); // java.time.temporal.Ser.YEAR_MONTH_TYPE + dos.writeInt(2012); + dos.writeByte(9); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(YearMonth.of(2012, 9), bytes); + } + + //----------------------------------------------------------------------- + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZoneId.java b/jdk/test/java/time/tck/java/time/serial/TCKZoneId.java new file mode 100644 index 00000000000..26923f12a80 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneId.java @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.*; +import java.lang.reflect.Field; +import java.time.DateTimeException; +import java.time.ZoneId; +import java.time.zone.ZoneRulesException; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +/** + * Test ZoneId. + */ +@Test +public class TCKZoneId extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(ZoneId.of("Europe/London")); + assertSerializable(ZoneId.of("America/Chicago")); + } + + @Test + public void test_serialization_format() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(7); + dos.writeUTF("Europe/London"); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(ZoneId.of("Europe/London"), bytes); + } + + @Test + public void test_deserialization_lenient_characters() throws Exception { + // an ID can be loaded without validation during deserialization + String id = "QWERTYUIOPASDFGHJKLZXCVBNM~/._+-"; + ZoneId deser = deserialize(id); + // getId, equals, hashCode, toString and normalized are OK + assertEquals(deser.getId(), id); + assertEquals(deser.toString(), id); + assertEquals(deser, deser); + assertEquals(deser.hashCode(), deser.hashCode()); + assertEquals(deser.normalized(), deser); + // getting the rules is not + try { + deser.getRules(); + fail(); + } catch (ZoneRulesException ex) { + // expected + } + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_deserialization_lenient_badCharacters() throws Exception { + // an ID can be loaded without validation during deserialization + // but there is a check to ensure the ID format is valid + deserialize("|!?"); + } + + @Test(dataProvider="offsetBasedValid") + public void test_deserialization_lenient_offsetNotAllowed_noPrefix(String input, String resolvedId) throws Exception { + ZoneId deserialized = deserialize(input); + assertEquals(deserialized, ZoneId.of(input)); + assertEquals(deserialized, ZoneId.of(resolvedId)); + } + + @Test(dataProvider="offsetBasedValidPrefix") + public void test_deserialization_lenient_offsetNotAllowed_prefixUTC(String input, String resolvedId, String offsetId) throws Exception { + ZoneId deserialized = deserialize("UTC" + input); + assertEquals(deserialized, ZoneId.of("UTC" + input)); + assertEquals(deserialized, ZoneId.of("UTC" + resolvedId)); + } + + @Test(dataProvider="offsetBasedValidPrefix") + public void test_deserialization_lenient_offsetNotAllowed_prefixGMT(String input, String resolvedId, String offsetId) throws Exception { + ZoneId deserialized = deserialize("GMT" + input); + assertEquals(deserialized, ZoneId.of("GMT" + input)); + assertEquals(deserialized, ZoneId.of("GMT" + resolvedId)); + } + + @Test(dataProvider="offsetBasedValidPrefix") + public void test_deserialization_lenient_offsetNotAllowed_prefixUT(String input, String resolvedId, String offsetId) throws Exception { + ZoneId deserialized = deserialize("UT" + input); + assertEquals(deserialized, ZoneId.of("UT" + input)); + assertEquals(deserialized, ZoneId.of("UT" + resolvedId)); + } + + private ZoneId deserialize(String id) throws Exception { + String serClass = ZoneId.class.getPackage().getName() + ".Ser"; + Class serCls = Class.forName(serClass); + Field field = serCls.getDeclaredField("serialVersionUID"); + field.setAccessible(true); + long serVer = (Long) field.get(null); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos)) { + dos.writeShort(ObjectStreamConstants.STREAM_MAGIC); + dos.writeShort(ObjectStreamConstants.STREAM_VERSION); + dos.writeByte(ObjectStreamConstants.TC_OBJECT); + dos.writeByte(ObjectStreamConstants.TC_CLASSDESC); + dos.writeUTF(serClass); + dos.writeLong(serVer); + dos.writeByte(ObjectStreamConstants.SC_EXTERNALIZABLE | ObjectStreamConstants.SC_BLOCK_DATA); + dos.writeShort(0); // number of fields + dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); // end of classdesc + dos.writeByte(ObjectStreamConstants.TC_NULL); // no superclasses + dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA); + dos.writeByte(1 + 2 + id.length()); // length of data (1 byte + 2 bytes UTF length + 32 bytes UTF) + dos.writeByte(7); // ZoneId + dos.writeUTF(id); + dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); // end of blockdata + } + ZoneId deser = null; + try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) { + deser = (ZoneId) ois.readObject(); + } + return deser; + } + + //----------------------------------------------------------------------- + // regular factory and .normalized() + //----------------------------------------------------------------------- + @DataProvider(name="offsetBasedValid") + Object[][] data_offsetBasedValid() { + return new Object[][] { + {"Z", "Z"}, + {"+0", "Z"}, + {"-0", "Z"}, + {"+00", "Z"}, + {"+0000", "Z"}, + {"+00:00", "Z"}, + {"+000000", "Z"}, + {"+00:00:00", "Z"}, + {"-00", "Z"}, + {"-0000", "Z"}, + {"-00:00", "Z"}, + {"-000000", "Z"}, + {"-00:00:00", "Z"}, + {"+5", "+05:00"}, + {"+01", "+01:00"}, + {"+0100", "+01:00"}, + {"+01:00", "+01:00"}, + {"+010000", "+01:00"}, + {"+01:00:00", "+01:00"}, + {"+12", "+12:00"}, + {"+1234", "+12:34"}, + {"+12:34", "+12:34"}, + {"+123456", "+12:34:56"}, + {"+12:34:56", "+12:34:56"}, + {"-02", "-02:00"}, + {"-5", "-05:00"}, + {"-0200", "-02:00"}, + {"-02:00", "-02:00"}, + {"-020000", "-02:00"}, + {"-02:00:00", "-02:00"}, + }; + } + + //----------------------------------------------------------------------- + @DataProvider(name="offsetBasedValidPrefix") + Object[][] data_offsetBasedValidPrefix() { + return new Object[][] { + {"", "", "Z"}, + {"+0", "", "Z"}, + {"-0", "", "Z"}, + {"+00", "", "Z"}, + {"+0000", "", "Z"}, + {"+00:00", "", "Z"}, + {"+000000", "", "Z"}, + {"+00:00:00", "", "Z"}, + {"-00", "", "Z"}, + {"-0000", "", "Z"}, + {"-00:00", "", "Z"}, + {"-000000", "", "Z"}, + {"-00:00:00", "", "Z"}, + {"+5", "+05:00", "+05:00"}, + {"+01", "+01:00", "+01:00"}, + {"+0100", "+01:00", "+01:00"}, + {"+01:00", "+01:00", "+01:00"}, + {"+010000", "+01:00", "+01:00"}, + {"+01:00:00", "+01:00", "+01:00"}, + {"+12", "+12:00", "+12:00"}, + {"+1234", "+12:34", "+12:34"}, + {"+12:34", "+12:34", "+12:34"}, + {"+123456", "+12:34:56", "+12:34:56"}, + {"+12:34:56", "+12:34:56", "+12:34:56"}, + {"-02", "-02:00", "-02:00"}, + {"-5", "-05:00", "-05:00"}, + {"-0200", "-02:00", "-02:00"}, + {"-02:00", "-02:00", "-02:00"}, + {"-020000", "-02:00", "-02:00"}, + {"-02:00:00", "-02:00", "-02:00"}, + }; + } + + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java new file mode 100644 index 00000000000..61196e909a1 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.time.ZoneOffset; + +/** + * Test ZoneOffset. + */ +@Test +public class TCKZoneOffset extends AbstractTCKTest { + + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws Exception { + assertSerializable(ZoneOffset.of("+01:30")); + } + + @Test + public void test_serialization_format_quarterPositive() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(8); + dos.writeByte(6); // stored as quarter hours + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes); + } + + @Test + public void test_serialization_format_quarterNegative() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(8); + dos.writeByte(-10); // stored as quarter hours + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes); + } + + @Test + public void test_serialization_format_full() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(8); + dos.writeByte(127); + dos.writeInt(53265); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java new file mode 100644 index 00000000000..a44946b7450 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; + +/** + * Test ZonedDateTime. + */ +@Test +public class TCKZonedDateTime extends AbstractTCKTest { + + private static final ZoneOffset OFFSET_0100 = ZoneOffset.ofHours(1); + private static final ZoneId ZONE_0100 = OFFSET_0100; + private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris"); + private LocalDateTime TEST_LOCAL_2008_06_30_11_30_59_500; + private ZonedDateTime TEST_DATE_TIME; + + + @BeforeMethod + public void setUp() { + TEST_LOCAL_2008_06_30_11_30_59_500 = LocalDateTime.of(2008, 6, 30, 11, 30, 59, 500); + TEST_DATE_TIME = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100); + } + + + //----------------------------------------------------------------------- + @Test + public void test_serialization() throws ClassNotFoundException, IOException { + assertSerializable(TEST_DATE_TIME); + } + + @Test + public void test_serialization_format_zoneId() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(6); + dos.writeInt(2012); // date + dos.writeByte(9); + dos.writeByte(16); + dos.writeByte(22); // time + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(470_000_000); + dos.writeByte(4); // offset + dos.writeByte(7); // zoneId + dos.writeUTF("Europe/London"); + } + byte[] bytes = baos.toByteArray(); + ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneId.of("Europe/London")); + assertSerializedBySer(zdt, bytes); + } + + @Test + public void test_serialization_format_zoneOffset() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(6); + dos.writeInt(2012); // date + dos.writeByte(9); + dos.writeByte(16); + dos.writeByte(22); // time + dos.writeByte(17); + dos.writeByte(59); + dos.writeInt(470_000_000); + dos.writeByte(4); // offset + dos.writeByte(8); // zoneId + dos.writeByte(4); + } + byte[] bytes = baos.toByteArray(); + ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneOffset.ofHours(1)); + assertSerializedBySer(zdt, bytes); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java b/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java index 4367ee92511..f2e94884371 100644 --- a/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java +++ b/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java @@ -713,12 +713,6 @@ public class TCKWeekFields extends AbstractTCKTest { } } - //----------------------------------------------------------------------- - @Test(dataProvider="weekFields") - public void test_serializable_singleton(DayOfWeek firstDayOfWeek, int minDays) throws IOException, ClassNotFoundException { - WeekFields weekDef = WeekFields.of(firstDayOfWeek, minDays); - assertSerializableSame(weekDef); // spec state singleton - } //----------------------------------------------------------------------- @DataProvider(name="weekFields") diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java new file mode 100644 index 00000000000..749515e7c9d --- /dev/null +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.temporal.serial; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.io.IOException; +import java.time.DayOfWeek; +import java.time.temporal.WeekFields; + +/** + * Test WeekFields. + */ +@Test +public class TCKWeekFields extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test(dataProvider="weekFields") + public void test_serializable_singleton(DayOfWeek firstDayOfWeek, int minDays) throws IOException, ClassNotFoundException { + WeekFields weekDef = WeekFields.of(firstDayOfWeek, minDays); + assertSerializableSame(weekDef); // spec state singleton + } + + //----------------------------------------------------------------------- + @DataProvider(name="weekFields") + Object[][] data_weekFields() { + Object[][] objects = new Object[49][]; + int i = 0; + for (DayOfWeek firstDayOfWeek : DayOfWeek.values()) { + for (int minDays = 1; minDays <= 7; minDays++) { + objects[i++] = new Object[] {firstDayOfWeek, minDays}; + } + } + return objects; + } + + +} diff --git a/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java b/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java index 418d1ad9ec2..08df5433349 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java @@ -107,25 +107,7 @@ public class TCKFixedZoneRules { //----------------------------------------------------------------------- // Basics //----------------------------------------------------------------------- - @Test(dataProvider="rules") - public void test_serialization(ZoneRules test, ZoneOffset expectedOffset) throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(test); - baos.close(); - byte[] bytes = baos.toByteArray(); - ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - ObjectInputStream in = new ObjectInputStream(bais); - ZoneRules result = (ZoneRules) in.readObject(); - - assertEquals(result, test); - assertEquals(result.getClass(), test.getClass()); - } - - //----------------------------------------------------------------------- - // basics - //----------------------------------------------------------------------- @Test(dataProvider="rules") public void test_getOffset_Instant(ZoneRules test, ZoneOffset expectedOffset) { assertEquals(test.getOffset(INSTANT), expectedOffset); diff --git a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java index c5da309d872..891deb76733 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java @@ -146,20 +146,6 @@ public class TCKZoneOffsetTransition extends AbstractTCKTest { assertSerializable(test); } - //----------------------------------------------------------------------- - @Test - public void test_serialization_unusual1() throws Exception { - LocalDateTime ldt = LocalDateTime.of(Year.MAX_VALUE, 12, 31, 1, 31, 53); - ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("-10:02:34")); - assertSerializable(test); - } - - @Test - public void test_serialization_unusual2() throws Exception { - LocalDateTime ldt = LocalDateTime.of(Year.MIN_VALUE, 1, 1, 12, 1, 3); - ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("+10:02:34")); - assertSerializable(test); - } //----------------------------------------------------------------------- // isValidOffset() diff --git a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java index fedded75337..9ad26627edd 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java @@ -210,31 +210,6 @@ public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { assertSerializable(test); } - @Test - public void test_serialization_unusualOffsets() throws Exception { - ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( - Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD, - ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50), - ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34), - ZoneOffset.ofHours(-18)); - assertSerializable(test); - } - - @Test - public void test_serialization_endOfDay() throws Exception { - ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( - Month.MARCH, 20, DayOfWeek.FRIDAY, LocalTime.MIDNIGHT, true, TimeDefinition.UTC, - OFFSET_0200, OFFSET_0200, OFFSET_0300); - assertSerializable(test); - } - - @Test - public void test_serialization_unusualTime() throws Exception { - ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( - Month.MARCH, 20, DayOfWeek.WEDNESDAY, LocalTime.of(13, 34, 56), false, TimeDefinition.STANDARD, - OFFSET_0200, OFFSET_0200, OFFSET_0300); - assertSerializable(test); - } //----------------------------------------------------------------------- // createTransition() diff --git a/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java b/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java index af07063ebe7..19f8239c230 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java @@ -103,28 +103,7 @@ public class TCKZoneRules { private static final int OVERLAP = 2; private static final int GAP = 0; - //----------------------------------------------------------------------- - // Basics - //----------------------------------------------------------------------- - public void test_serialization_loaded() throws Exception { - assertSerialization(europeLondon()); - assertSerialization(europeParis()); - assertSerialization(americaNewYork()); - } - private void assertSerialization(ZoneRules test) throws Exception { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(test); - baos.close(); - byte[] bytes = baos.toByteArray(); - - ByteArrayInputStream bais = new ByteArrayInputStream(bytes); - ObjectInputStream in = new ObjectInputStream(bais); - ZoneRules result = (ZoneRules) in.readObject(); - - assertEquals(result, test); - } //----------------------------------------------------------------------- // Europe/London diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java new file mode 100644 index 00000000000..b5d88d4f983 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.zone.serial; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.ZoneOffset; +import java.time.zone.ZoneRules; + +import static org.testng.Assert.assertEquals; + +/** + * Test ZoneRules for fixed offset time-zones. + */ +@Test +public class TCKFixedZoneRules { + + private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); + private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2); + private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18); + + private ZoneRules make(ZoneOffset offset) { + return offset.getRules(); + } + + @DataProvider(name="rules") + Object[][] data_rules() { + return new Object[][] { + {make(OFFSET_PONE), OFFSET_PONE}, + {make(OFFSET_PTWO), OFFSET_PTWO}, + {make(OFFSET_M18), OFFSET_M18}, + }; + } + + //----------------------------------------------------------------------- + // Basics + //----------------------------------------------------------------------- + @Test(dataProvider="rules") + public void test_serialization(ZoneRules test, ZoneOffset expectedOffset) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(test); + baos.close(); + byte[] bytes = baos.toByteArray(); + + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ObjectInputStream in = new ObjectInputStream(bais); + ZoneRules result = (ZoneRules) in.readObject(); + + assertEquals(result, test); + assertEquals(result.getClass(), test.getClass()); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java new file mode 100644 index 00000000000..a57d31eaf71 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.zone.serial; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +import java.time.LocalDateTime; +import java.time.Year; +import java.time.ZoneOffset; +import java.time.zone.ZoneOffsetTransition; + +/** + * Test ZoneOffsetTransition. + */ +@Test +public class TCKZoneOffsetTransition extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_serialization_unusual1() throws Exception { + LocalDateTime ldt = LocalDateTime.of(Year.MAX_VALUE, 12, 31, 1, 31, 53); + ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("-10:02:34")); + assertSerializable(test); + } + + @Test + public void test_serialization_unusual2() throws Exception { + LocalDateTime ldt = LocalDateTime.of(Year.MIN_VALUE, 1, 1, 12, 1, 3); + ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("+10:02:34")); + assertSerializable(test); + } + +} diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java new file mode 100644 index 00000000000..1ccae56c8d9 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.zone.serial; + +import static org.testng.Assert.assertEquals; + +import java.time.DayOfWeek; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.Month; +import java.time.ZoneOffset; +import java.time.zone.ZoneOffsetTransitionRule; +import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +/** + * Test ZoneOffsetTransitionRule. + */ +@Test +public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { + + private static final LocalTime TIME_0100 = LocalTime.of(1, 0); + private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2); + private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3); + + + + @Test + public void test_serialization_unusualOffsets() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD, + ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50), + ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34), + ZoneOffset.ofHours(-18)); + assertSerializable(test); + } + + @Test + public void test_serialization_endOfDay() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, 20, DayOfWeek.FRIDAY, LocalTime.MIDNIGHT, true, TimeDefinition.UTC, + OFFSET_0200, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } + + @Test + public void test_serialization_unusualTime() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, 20, DayOfWeek.WEDNESDAY, LocalTime.of(13, 34, 56), false, TimeDefinition.STANDARD, + OFFSET_0200, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } + + +} diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java new file mode 100644 index 00000000000..6f83223f07c --- /dev/null +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.zone.serial; + +import org.testng.annotations.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.ZoneId; +import java.time.zone.ZoneRules; + +import static org.testng.Assert.assertEquals; + +/** + * Test ZoneRules. + */ +@Test +public class TCKZoneRules { + + public void test_serialization_loaded() throws Exception { + assertSerialization(europeLondon()); + assertSerialization(europeParis()); + assertSerialization(americaNewYork()); + } + + private void assertSerialization(ZoneRules test) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(test); + baos.close(); + byte[] bytes = baos.toByteArray(); + + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + ObjectInputStream in = new ObjectInputStream(bais); + ZoneRules result = (ZoneRules) in.readObject(); + + assertEquals(result, test); + } + + //----------------------------------------------------------------------- + // Europe/London + //----------------------------------------------------------------------- + private ZoneRules europeLondon() { + return ZoneId.of("Europe/London").getRules(); + } + + + //----------------------------------------------------------------------- + // Europe/Paris + //----------------------------------------------------------------------- + private ZoneRules europeParis() { + return ZoneId.of("Europe/Paris").getRules(); + } + + //----------------------------------------------------------------------- + // America/New_York + //----------------------------------------------------------------------- + private ZoneRules americaNewYork() { + return ZoneId.of("America/New_York").getRules(); + } + + +} From df7849845e87da6200a8ee68eb33f8fd588c8070 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 22 Aug 2013 21:05:11 +0400 Subject: [PATCH 074/983] 7057769: JScrollBar spec should specify that unit increment & decrement functionality may not be present Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/JScrollBar.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jdk/src/share/classes/javax/swing/JScrollBar.java b/jdk/src/share/classes/javax/swing/JScrollBar.java index 6abda2eaa79..8cbbbc8551b 100644 --- a/jdk/src/share/classes/javax/swing/JScrollBar.java +++ b/jdk/src/share/classes/javax/swing/JScrollBar.java @@ -344,6 +344,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * that override this method and delegate to the viewports * Scrollable view, if it has one. The Scrollable interface * provides a more specialized version of this method. + *

    + * Some look and feels implement custom scrolling behavior + * and ignore this property. * * @param direction is -1 or 1 for up/down respectively * @return the value of the unitIncrement property @@ -361,6 +364,10 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible *

    * Note, that if the argument is equal to the value of Integer.MIN_VALUE, * the most look and feels will not provide the scrolling to the right/down. + *

    + * Some look and feels implement custom scrolling behavior + * and ignore this property. + * * @see #getUnitIncrement * @beaninfo * preferred: true @@ -387,6 +394,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * that override this method and delegate to the viewports * Scrollable view, if it has one. The Scrollable interface * provides a more specialized version of this method. + *

    + * Some look and feels implement custom scrolling behavior + * and ignore this property. * * @param direction is -1 or 1 for up/down respectively * @return the value of the blockIncrement property @@ -404,6 +414,10 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible *

    * Note, that if the argument is equal to the value of Integer.MIN_VALUE, * the most look and feels will not provide the scrolling to the right/down. + *

    + * Some look and feels implement custom scrolling behavior + * and ignore this property. + * * @see #getBlockIncrement() * @beaninfo * preferred: true From a7e60f4913a41f21d43e13cd0301994cb9f9c935 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Fri, 23 Aug 2013 19:29:39 +0400 Subject: [PATCH 075/983] 7080613: java.beans.DefaultPersistenceDelegate.instantiate(..) doesn't throw NPE Reviewed-by: alexsch --- jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java | 1 + jdk/src/share/classes/java/beans/PersistenceDelegate.java | 1 + 2 files changed, 2 insertions(+) diff --git a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java index de6a1b75178..0d056c2e8e5 100644 --- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java @@ -149,6 +149,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * @return An expression whose value is oldInstance. * * @throws NullPointerException if {@code out} is {@code null} + * and this value is used in the method * * @see #DefaultPersistenceDelegate(String[]) */ diff --git a/jdk/src/share/classes/java/beans/PersistenceDelegate.java b/jdk/src/share/classes/java/beans/PersistenceDelegate.java index bbdcdbf060c..4124d2ff935 100644 --- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java @@ -162,6 +162,7 @@ public abstract class PersistenceDelegate { * @return An expression whose value is oldInstance. * * @throws NullPointerException if {@code out} is {@code null} + * and this value is used in the method */ protected abstract Expression instantiate(Object oldInstance, Encoder out); From e412d7e8d119d5d23af15efecac7945f528a993f Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Sat, 24 Aug 2013 00:14:46 -0700 Subject: [PATCH 076/983] 8023683: Enhance class file parsing Use the value returned by REALLOC_RESOURCE_ARRAY() Reviewed-by: coleenp, ahgross --- hotspot/src/share/vm/classfile/classFileParser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index e7b9c90363b..9ef6af65475 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -2178,8 +2178,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface, } if (lvt_cnt == max_lvt_cnt) { max_lvt_cnt <<= 1; - REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt); - REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt); + localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt); + localvariable_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt); } localvariable_table_start[lvt_cnt] = parse_localvariable_table(code_length, @@ -2207,8 +2207,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface, // Parse local variable type table if (lvtt_cnt == max_lvtt_cnt) { max_lvtt_cnt <<= 1; - REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt); - REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt); + localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt); + localvariable_type_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt); } localvariable_type_table_start[lvtt_cnt] = parse_localvariable_table(code_length, From 670c3329966260d1c67d3968f4b0a06bc3b33929 Mon Sep 17 00:00:00 2001 From: Dmitry Markov Date: Mon, 26 Aug 2013 17:21:48 +0400 Subject: [PATCH 077/983] 8023474: First mousepress doesn't start editing in JTree Reviewed-by: alexp, anthony --- jdk/src/share/classes/java/awt/Component.java | 11 ++ .../javax/swing/plaf/basic/BasicTreeUI.java | 9 +- .../share/classes/sun/awt/AWTAccessor.java | 7 +- .../basic/BasicTreeUI/8023474/bug8023474.java | 174 ++++++++++++++++++ 4 files changed, 194 insertions(+), 7 deletions(-) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index c3307538f27..23a16f7db3b 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -972,6 +972,10 @@ public abstract class Component implements ImageObserver, MenuContainer, public AccessControlContext getAccessControlContext(Component comp) { return comp.getAccessControlContext(); } + + public void revalidateSynchronously(Component comp) { + comp.revalidateSynchronously(); + } }); } @@ -2977,6 +2981,13 @@ public abstract class Component implements ImageObserver, MenuContainer, * @since 1.7 */ public void revalidate() { + revalidateSynchronously(); + } + + /** + * Revalidates the component synchronously. + */ + final void revalidateSynchronously() { synchronized (getTreeLock()) { invalidate(); 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 0e7cd1768e7..b91deec481d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.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 @@ -42,6 +42,7 @@ import javax.swing.plaf.TreeUI; import javax.swing.tree.*; import javax.swing.text.Position; import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag; +import sun.awt.AWTAccessor; import sun.swing.SwingUtilities2; import sun.swing.DefaultLookup; @@ -2165,11 +2166,7 @@ public class BasicTreeUI extends TreeUI nodeBounds.width, nodeBounds.height); editingPath = path; - if (editingComponent instanceof JComponent) { - ((JComponent)editingComponent).revalidate(); - } else { - editingComponent.validate(); - } + AWTAccessor.getComponentAccessor().revalidateSynchronously(editingComponent); editingComponent.repaint(); if(cellEditor.shouldSelectCell(event)) { stopEditingInCompleteEditing = false; diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index 781750b0f1c..2b7f73ccd31 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -236,6 +236,11 @@ public final class AWTAccessor { */ AccessControlContext getAccessControlContext(Component comp); + /** + * Revalidates the component synchronously. + */ + void revalidateSynchronously(Component comp); + } /* diff --git a/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java new file mode 100644 index 00000000000..6802db66945 --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java @@ -0,0 +1,174 @@ +/* + * 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 8023474 + * @summary Tests that the first mouse press starts editing in JTree + * @author Dmitry Markov + * @run main bug8023474 + */ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.event.CellEditorListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeCellEditor; +import javax.swing.tree.TreeCellRenderer; +import java.awt.*; +import java.awt.event.InputEvent; +import java.util.EventObject; + +public class bug8023474 { + private static JTree tree; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + Point point = getRowPointToClick(1); + robot.mouseMove(point.x, point.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + Boolean result = (Boolean)tree.getCellEditor().getCellEditorValue(); + if (!result) { + throw new RuntimeException("Test Failed!"); + } + } + + private static void createAndShowGUI() { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception e) { + throw new RuntimeException(e); + } + + DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + DefaultMutableTreeNode item = new DefaultMutableTreeNode("item"); + DefaultMutableTreeNode subItem = new DefaultMutableTreeNode("subItem"); + + root.add(item); + item.add(subItem); + + DefaultTreeModel model = new DefaultTreeModel(root); + tree = new JTree(model); + + tree.setCellEditor(new Editor()); + tree.setEditable(true); + tree.setRowHeight(30); + tree.setCellRenderer(new CheckboxCellRenderer()); + + JFrame frame = new JFrame("bug8023474"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.add(new JScrollPane(tree)); + frame.setSize(400, 300); + frame.setVisible(true); + } + + private static Point getRowPointToClick(final int row) throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Rectangle rect = tree.getRowBounds(row); + Point point = new Point(rect.x + 10, rect.y + rect.height / 2); + SwingUtilities.convertPointToScreen(point, tree); + result[0] = point; + } + }); + return result[0]; + } + + private static class Editor extends JPanel implements TreeCellEditor { + private JCheckBox checkbox; + + public Editor() { + setOpaque(false); + checkbox = new JCheckBox(); + add(checkbox); + } + + public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, + boolean expanded, boolean leaf, int row) { + checkbox.setText(value.toString()); + checkbox.setSelected(false); + return this; + } + + public Object getCellEditorValue() { + return checkbox.isSelected(); + } + + public boolean isCellEditable(EventObject anEvent) { + return true; + } + + public boolean shouldSelectCell(EventObject anEvent) { + return true; + } + + public boolean stopCellEditing() { + return true; + } + + public void cancelCellEditing() { + } + + public void addCellEditorListener(CellEditorListener l) { + } + + public void removeCellEditorListener(CellEditorListener l) { + } + } + + private static class CheckboxCellRenderer extends JPanel implements TreeCellRenderer { + private JCheckBox checkbox; + + public CheckboxCellRenderer() { + setOpaque(false); + checkbox = new JCheckBox(); + add(checkbox); + } + + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + checkbox.setText(value.toString()); + checkbox.setSelected(false); + return this; + } + } +} From 6018c4e07f0fb0a1ec8ff6a8c878aabcff9a2779 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 27 Aug 2013 12:53:46 +0400 Subject: [PATCH 078/983] 7195179: ClassCastException for null values in JComboBox Reviewed-by: alexsch --- .../swing/plaf/basic/BasicComboBoxUI.java | 12 +-- .../swing/JComboBox/7195179/Test7195179.java | 84 +++++++++++++++++++ 2 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 jdk/test/javax/swing/JComboBox/7195179/Test7195179.java diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index 331c5674ad3..eec48001160 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -971,14 +971,16 @@ public class BasicComboBoxUI extends ComboBoxUI { // cells, if not, this needs to loop through all. value = comboBox.getModel().getElementAt(0); } - if (value == null) { - value = " "; - } else if (value instanceof String && "".equals(value)) { - value = " "; - } Component component = renderer. getListCellRendererComponent(listBox, value, -1, false, false); + if (component instanceof JLabel) { + JLabel label = (JLabel) component; + String text = label.getText(); + if ((text == null) || text.isEmpty()) { + label.setText(" "); + } + } if (component instanceof JComponent) { component.setFont(comboBox.getFont()); } diff --git a/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java new file mode 100644 index 00000000000..f22084a87bc --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import javax.swing.GroupLayout; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import javax.swing.plaf.basic.BasicComboBoxRenderer; + +import static javax.swing.SwingUtilities.invokeAndWait; + +/* + * @test + * @bug 7195179 + * @summary Tests that combobox works with generified renderers + * @author Sergey Malenkov + */ + +public class Test7195179 { + public static void main(String[] args) throws Exception { + invokeAndWait(new Runnable() { + @Override + public void run() { + Integer[] items = {null, 1, 2, 3}; + JComboBox combo = new JComboBox<>(items); + JLabel label = new JLabel("choose:"); + JPanel panel = new JPanel(); + GroupLayout layout = new GroupLayout(panel); + panel.setLayout(layout); + label.setLabelFor(combo); + combo.setSelectedIndex(0); + combo.setRenderer(new ListCellRenderer() { + private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer(); + + @Override + public Component getListCellRendererComponent(JList list, Integer value, int index, boolean isSelected, boolean cellHasFocus) { + return this.renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } + }); + layout.setAutoCreateContainerGaps(true); + layout.setAutoCreateGaps(true); + layout.setHorizontalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup().addComponent(label)) + .addGroup(layout.createParallelGroup().addComponent(combo))); + layout.setVerticalGroup(layout + .createSequentialGroup() + .addGroup(layout + .createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(label) + .addComponent(combo))); + + JFrame frame = new JFrame(getClass().getSimpleName()); + frame.add(panel); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + }); + } +} From 6dd078f94a61459f72cf552e10149fffbfb16f69 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 27 Aug 2013 13:13:32 +0400 Subject: [PATCH 079/983] 8021379: JFileChooser Create New Folder button enabled in write proteced directory Reviewed-by: alexsch --- jdk/src/share/classes/sun/swing/FilePane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/sun/swing/FilePane.java b/jdk/src/share/classes/sun/swing/FilePane.java index 8dbaab55c3e..44aedab3d28 100644 --- a/jdk/src/share/classes/sun/swing/FilePane.java +++ b/jdk/src/share/classes/sun/swing/FilePane.java @@ -1980,18 +1980,18 @@ public class FilePane extends JPanel implements PropertyChangeListener { } if (f instanceof ShellFolder) { - return ((ShellFolder) f).isFileSystem(); + return f.canWrite(); } else { if (usesShellFolder(getFileChooser())) { try { - return ShellFolder.getShellFolder(f).isFileSystem(); + return ShellFolder.getShellFolder(f).canWrite(); } catch (FileNotFoundException ex) { // File doesn't exist return false; } } else { // Ordinary file - return true; + return f.canWrite(); } } } From e304fd35a02ddabc68318191f73071f63da8ef20 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 27 Aug 2013 13:37:38 +0400 Subject: [PATCH 080/983] 8022398: javax/swing/JFileChooser/8013442/Test8013442.java fails Reviewed-by: alexsch --- .../com/apple/laf/AquaFileChooserUI.java | 62 +---------- .../java/swing/plaf/gtk/GTKFileChooserUI.java | 69 +----------- .../swing/plaf/motif/MotifFileChooserUI.java | 68 +----------- .../plaf/windows/WindowsFileChooserUI.java | 67 +---------- .../swing/plaf/metal/MetalFileChooserUI.java | 66 +---------- .../swing/AbstractFilterComboBoxModel.java | 104 ++++++++++++++++++ .../plaf/synth/SynthFileChooserUIImpl.java | 67 +---------- 7 files changed, 125 insertions(+), 378 deletions(-) create mode 100644 jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java index b7598f99d6d..be4b5b72a32 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java @@ -42,6 +42,7 @@ import javax.swing.filechooser.*; import javax.swing.plaf.*; import javax.swing.table.*; +import sun.swing.AbstractFilterComboBoxModel; import sun.swing.SwingUtilities2; public class AquaFileChooserUI extends FileChooserUI { @@ -1266,64 +1267,9 @@ public class AquaFileChooserUI extends FileChooserUI { /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends DefaultListModel implements ComboBoxModel, PropertyChangeListener { - int selectedIndex = -1; - - protected FilterComboBoxModel() { - super(); - final FileFilter filters[] = getFileChooser().getChoosableFileFilters(); - for (int i = 0; i < filters.length; i++) { - this.add(i, filters[i]); - } - } - - public void propertyChange(final PropertyChangeEvent e) { - final String prop = e.getPropertyName(); - if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { - this.clear(); - final FileFilter filters[] = (FileFilter[])e.getNewValue(); - - for (int i = 0; i < filters.length; i++) { - this.add(i, filters[i]); - } - - fireContentsChanged(this, -1, -1); - } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { - final FileFilter currentFilter = (FileFilter)e.getNewValue(); - FileFilter filters[] = getFileChooser().getChoosableFileFilters(); - - boolean found = false; - if (currentFilter != null) { - for (final FileFilter element : filters) { - if (element == currentFilter) { - found = true; - } - } - if (found == false) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - - filters = getFileChooser().getChoosableFileFilters(); - setSelectedItem(e.getNewValue()); - } - } - - public void setSelectedItem(final Object filter) { - if (filter != null) { - selectedIndex = this.indexOf(filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - final Object returnValue = null; - - if (this.size() > 0) { - if ((selectedIndex != -1) && (selectedIndex < size())) { return this.get(selectedIndex); } - } - - return returnValue; + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return AquaFileChooserUI.this.getFileChooser(); } } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index 0cff673711c..df2b7f7cc23 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -41,6 +41,7 @@ import javax.swing.plaf.basic.BasicDirectoryModel; import javax.swing.table.*; import javax.accessibility.*; +import sun.swing.AbstractFilterComboBoxModel; import sun.swing.SwingUtilities2; import sun.swing.plaf.synth.*; @@ -1328,71 +1329,9 @@ class GTKFileChooserUI extends SynthFileChooserUI { /** * Data model for filter combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel - implements ComboBoxModel, PropertyChangeListener { - protected FileFilter[] filters; - - protected FilterComboBoxModel() { - super(); - filters = getFileChooser().getChoosableFileFilters(); - } - - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { - filters = (FileFilter[]) e.getNewValue(); - fireContentsChanged(this, -1, -1); - } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { - fireContentsChanged(this, -1, -1); - } - } - - public void setSelectedItem(Object filter) { - if (filter != null) { - getFileChooser().setFileFilter((FileFilter) filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - // Ensure that the current filter is in the list. - // NOTE: we shouldnt' have to do this, since JFileChooser adds - // the filter to the choosable filters list when the filter - // is set. Lets be paranoid just in case someone overrides - // setFileFilter in JFileChooser. - FileFilter currentFilter = getFileChooser().getFileFilter(); - boolean found = false; - if (currentFilter != null) { - for (FileFilter filter : filters) { - if (filter == currentFilter) { - found = true; - } - } - if (found == false) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - return getFileChooser().getFileFilter(); - } - - public int getSize() { - if (filters != null) { - return filters.length; - } else { - return 0; - } - } - - public Object getElementAt(int index) { - if (index > getSize() - 1) { - // This shouldn't happen. Try to recover gracefully. - return getFileChooser().getFileFilter(); - } - if (filters != null) { - return filters[index]; - } else { - return null; - } + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return GTKFileChooserUI.this.getFileChooser(); } } } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java index 048e76647c4..b821a56abc1 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java @@ -38,6 +38,7 @@ import java.io.File; import java.io.IOException; import java.util.*; import sun.awt.shell.ShellFolder; +import sun.swing.AbstractFilterComboBoxModel; import sun.swing.SwingUtilities2; /** @@ -777,70 +778,9 @@ public class MotifFileChooserUI extends BasicFileChooserUI { /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, - PropertyChangeListener { - protected FileFilter[] filters; - protected FilterComboBoxModel() { - super(); - filters = getFileChooser().getChoosableFileFilters(); - } - - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) { - filters = (FileFilter[]) e.getNewValue(); - fireContentsChanged(this, -1, -1); - } else if (prop.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { - fireContentsChanged(this, -1, -1); - } - } - - public void setSelectedItem(Object filter) { - if(filter != null) { - getFileChooser().setFileFilter((FileFilter) filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - // Ensure that the current filter is in the list. - // NOTE: we shouldnt' have to do this, since JFileChooser adds - // the filter to the choosable filters list when the filter - // is set. Lets be paranoid just in case someone overrides - // setFileFilter in JFileChooser. - FileFilter currentFilter = getFileChooser().getFileFilter(); - boolean found = false; - if(currentFilter != null) { - for (FileFilter filter : filters) { - if (filter == currentFilter) { - found = true; - } - } - if (!found) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - return getFileChooser().getFileFilter(); - } - - public int getSize() { - if(filters != null) { - return filters.length; - } else { - return 0; - } - } - - public FileFilter getElementAt(int index) { - if(index > getSize() - 1) { - // This shouldn't happen. Try to recover gracefully. - return getFileChooser().getFileFilter(); - } - if(filters != null) { - return filters[index]; - } else { - return null; - } + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return MotifFileChooserUI.this.getFileChooser(); } } diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java index 2e1168199c9..8d40da00013 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java @@ -1193,70 +1193,9 @@ public class WindowsFileChooserUI extends BasicFileChooserUI { /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, - PropertyChangeListener { - protected FileFilter[] filters; - protected FilterComboBoxModel() { - super(); - filters = getFileChooser().getChoosableFileFilters(); - } - - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { - filters = (FileFilter[]) e.getNewValue(); - fireContentsChanged(this, -1, -1); - } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { - fireContentsChanged(this, -1, -1); - } - } - - public void setSelectedItem(Object filter) { - if(filter != null) { - getFileChooser().setFileFilter((FileFilter) filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - // Ensure that the current filter is in the list. - // NOTE: we shouldnt' have to do this, since JFileChooser adds - // the filter to the choosable filters list when the filter - // is set. Lets be paranoid just in case someone overrides - // setFileFilter in JFileChooser. - FileFilter currentFilter = getFileChooser().getFileFilter(); - boolean found = false; - if(currentFilter != null) { - for (FileFilter filter : filters) { - if (filter == currentFilter) { - found = true; - } - } - if(found == false) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - return getFileChooser().getFileFilter(); - } - - public int getSize() { - if(filters != null) { - return filters.length; - } else { - return 0; - } - } - - public FileFilter getElementAt(int index) { - if(index > getSize() - 1) { - // This shouldn't happen. Try to recover gracefully. - return getFileChooser().getFileFilter(); - } - if(filters != null) { - return filters[index]; - } else { - return null; - } + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return WindowsFileChooserUI.this.getFileChooser(); } } diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java index 27c519502cf..07a57f00369 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java @@ -1067,69 +1067,9 @@ public class MetalFileChooserUI extends BasicFileChooserUI { /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { - protected FileFilter[] filters; - protected FilterComboBoxModel() { - super(); - filters = getFileChooser().getChoosableFileFilters(); - } - - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { - filters = (FileFilter[]) e.getNewValue(); - fireContentsChanged(this, -1, -1); - } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { - fireContentsChanged(this, -1, -1); - } - } - - public void setSelectedItem(Object filter) { - if(filter != null) { - getFileChooser().setFileFilter((FileFilter) filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - // Ensure that the current filter is in the list. - // NOTE: we shouldnt' have to do this, since JFileChooser adds - // the filter to the choosable filters list when the filter - // is set. Lets be paranoid just in case someone overrides - // setFileFilter in JFileChooser. - FileFilter currentFilter = getFileChooser().getFileFilter(); - boolean found = false; - if(currentFilter != null) { - for (FileFilter filter : filters) { - if (filter == currentFilter) { - found = true; - } - } - if(found == false) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - return getFileChooser().getFileFilter(); - } - - public int getSize() { - if(filters != null) { - return filters.length; - } else { - return 0; - } - } - - public Object getElementAt(int index) { - if(index > getSize() - 1) { - // This shouldn't happen. Try to recover gracefully. - return getFileChooser().getFileFilter(); - } - if(filters != null) { - return filters[index]; - } else { - return null; - } + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return MetalFileChooserUI.this.getFileChooser(); } } diff --git a/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java b/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java new file mode 100644 index 00000000000..355d3ca89db --- /dev/null +++ b/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.swing; + +import javax.swing.AbstractListModel; +import javax.swing.ComboBoxModel; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +/** + * Data model for a type-face selection combo-box. + */ +public abstract class AbstractFilterComboBoxModel + extends AbstractListModel + implements ComboBoxModel, PropertyChangeListener { + + protected FileFilter[] filters; + + protected AbstractFilterComboBoxModel() { + this.filters = getFileChooser().getChoosableFileFilters(); + } + + protected abstract JFileChooser getFileChooser(); + + @Override + public void propertyChange(PropertyChangeEvent event) { + String property = event.getPropertyName(); + if (property == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { + this.filters = (FileFilter[]) event.getNewValue(); + fireContentsChanged(this, -1, -1); + } else if (property == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { + fireContentsChanged(this, -1, -1); + } + } + + @Override + public void setSelectedItem(Object filter) { + if (filter != null) { + getFileChooser().setFileFilter((FileFilter) filter); + fireContentsChanged(this, -1, -1); + } + } + + @Override + public Object getSelectedItem() { + // Ensure that the current filter is in the list. + // NOTE: we should not have to do this, since JFileChooser adds + // the filter to the choosable filters list when the filter + // is set. Lets be paranoid just in case someone overrides + // setFileFilter in JFileChooser. + FileFilter currentFilter = getFileChooser().getFileFilter(); + if (currentFilter != null) { + for (FileFilter filter : this.filters) { + if (filter == currentFilter) { + return currentFilter; + } + } + getFileChooser().addChoosableFileFilter(currentFilter); + } + return currentFilter; + } + + @Override + public int getSize() { + return (this.filters != null) + ? filters.length + : 0; + } + + @Override + public FileFilter getElementAt(int index) { + if (index >= getSize()) { + // This shouldn't happen. Try to recover gracefully. + return getFileChooser().getFileFilter(); + } + return (this.filters != null) + ? filters[index] + : null; + } +} diff --git a/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java b/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java index d8e023647b2..bd7c9b4371e 100644 --- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java +++ b/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java @@ -923,70 +923,9 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI { /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, - PropertyChangeListener { - protected FileFilter[] filters; - protected FilterComboBoxModel() { - super(); - filters = getFileChooser().getChoosableFileFilters(); - } - - public void propertyChange(PropertyChangeEvent e) { - String prop = e.getPropertyName(); - if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { - filters = (FileFilter[]) e.getNewValue(); - fireContentsChanged(this, -1, -1); - } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) { - fireContentsChanged(this, -1, -1); - } - } - - public void setSelectedItem(Object filter) { - if(filter != null) { - getFileChooser().setFileFilter((FileFilter) filter); - fireContentsChanged(this, -1, -1); - } - } - - public Object getSelectedItem() { - // Ensure that the current filter is in the list. - // NOTE: we shouldnt' have to do this, since JFileChooser adds - // the filter to the choosable filters list when the filter - // is set. Lets be paranoid just in case someone overrides - // setFileFilter in JFileChooser. - FileFilter currentFilter = getFileChooser().getFileFilter(); - boolean found = false; - if(currentFilter != null) { - for (FileFilter filter : filters) { - if (filter == currentFilter) { - found = true; - } - } - if(found == false) { - getFileChooser().addChoosableFileFilter(currentFilter); - } - } - return getFileChooser().getFileFilter(); - } - - public int getSize() { - if(filters != null) { - return filters.length; - } else { - return 0; - } - } - - public FileFilter getElementAt(int index) { - if(index > getSize() - 1) { - // This shouldn't happen. Try to recover gracefully. - return getFileChooser().getFileFilter(); - } - if(filters != null) { - return filters[index]; - } else { - return null; - } + protected class FilterComboBoxModel extends AbstractFilterComboBoxModel { + protected JFileChooser getFileChooser() { + return SynthFileChooserUIImpl.this.getFileChooser(); } } From 25d12a300b5b498cfb9f7b388ac668caa1634dfa Mon Sep 17 00:00:00 2001 From: Pete Brunet Date: Wed, 28 Aug 2013 17:25:35 +0400 Subject: [PATCH 081/983] 8011955: Lunar screen reader crashes intermittently in WindowsAccessBridge-32.DLL 6995891: JAWS will occasionally stop speaking focused objects as user TABs -> problem with message queue 8014738: Combobox menu items are not announced with JAWS 8011938: Java Ferret example corrupts JCombobox of the running application 8012011: JAB 2.0.2 incompletely shows kbd accelerator in menus 8022966: Java Access Bridge no longer usable with screen magnifiers Reviewed-by: raginip, tbell, erikj, art --- jdk/make/bridge/AccessBridgeJava/Makefile | 6 ++--- jdk/makefiles/CompileJavaClasses.gmk | 1 + jdk/makefiles/GensrcMisc.gmk | 28 ++++++++++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/jdk/make/bridge/AccessBridgeJava/Makefile b/jdk/make/bridge/AccessBridgeJava/Makefile index c5bebd02cea..e143f987e0a 100644 --- a/jdk/make/bridge/AccessBridgeJava/Makefile +++ b/jdk/make/bridge/AccessBridgeJava/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# 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 @@ -51,7 +51,7 @@ endif # # Java files to compile. # -FILES_java = com/sun/java/accessibility/AccessBridge.java +FILES_java = com/sun/java/accessibility/AccessBridgeLoader.java com/sun/java/accessibility/AccessBridge.java # # Location for the newly built classfiles. @@ -68,7 +68,7 @@ FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class) build: prebuild prebuild: - $(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridge.java \ + $(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridgeLoader.java \ $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility all : build $(JARFILE) diff --git a/jdk/makefiles/CompileJavaClasses.gmk b/jdk/makefiles/CompileJavaClasses.gmk index 0b3e70dd914..a015846e39f 100644 --- a/jdk/makefiles/CompileJavaClasses.gmk +++ b/jdk/makefiles/CompileJavaClasses.gmk @@ -62,6 +62,7 @@ ifndef OPENJDK # AccessBridge is compiled separately below. EXFILES += AccessBridge.java \ + AccessBridgeLoader.java \ com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java # This seems to never be built EXCLUDES += com/sun/java/accessibility/extensions diff --git a/jdk/makefiles/GensrcMisc.gmk b/jdk/makefiles/GensrcMisc.gmk index 812b2cee6c7..c879de348cb 100644 --- a/jdk/makefiles/GensrcMisc.gmk +++ b/jdk/makefiles/GensrcMisc.gmk @@ -200,26 +200,38 @@ ifeq ($(OPENJDK_TARGET_OS), windows) AB_SRC_DIR := $(JDK_TOPDIR)/src/closed/windows/classes/com/sun/java/accessibility ifeq ($(OPENJDK_TARGET_CPU_BITS), 32) + $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java: \ + $(AB_SRC_DIR)/32bit/AccessBridgeLoader.java + $(install-file) + $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java: \ - $(AB_SRC_DIR)/32bit/AccessBridge.java + $(AB_SRC_DIR)/AccessBridge.java + $(install-file) + + $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java: \ + $(AB_SRC_DIR)/legacy/AccessBridgeLoader.java $(install-file) $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java: \ - $(AB_SRC_DIR)/legacy/AccessBridge.java + $(AB_SRC_DIR)/AccessBridge.java $(install-file) - GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \ - $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java + GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java \ + $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java \ + $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \ + $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java else - $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java: \ - $(AB_SRC_DIR)/64bit/AccessBridge.java + $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java: \ + $(AB_SRC_DIR)/64bit/AccessBridgeLoader.java $(install-file) - GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java + GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java \ + $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java endif + endif endif -########################################################################################## \ No newline at end of file +########################################################################################## From 0628977a7ad4ef0144b3d1fe548b9b0b357fa87f Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 28 Aug 2013 17:32:25 +0400 Subject: [PATCH 082/983] 6968363: ClassCastException while entering HINDI characters with CustomDocument Reviewed-by: alexsch --- .../javax/swing/text/AbstractDocument.java | 22 +- .../javax/swing/text/DefaultCaret.java | 9 +- .../javax/swing/text/GlyphPainter2.java | 8 +- .../javax/swing/text/ParagraphView.java | 13 +- .../AbstractDocument/6968363/Test6968363.java | 241 ++++++++++++++++++ 5 files changed, 262 insertions(+), 31 deletions(-) create mode 100644 jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java diff --git a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java index bf40cad6859..d9eefe375c5 100644 --- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java +++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java @@ -934,16 +934,18 @@ public abstract class AbstractDocument implements Document, Serializable { * Returns true if the text in the range p0 to * p1 is left to right. */ - boolean isLeftToRight(int p0, int p1) { - if(!getProperty(I18NProperty).equals(Boolean.TRUE)) { - return true; - } - Element bidiRoot = getBidiRootElement(); - int index = bidiRoot.getElementIndex(p0); - Element bidiElem = bidiRoot.getElement(index); - if(bidiElem.getEndOffset() >= p1) { - AttributeSet bidiAttrs = bidiElem.getAttributes(); - return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0); + static boolean isLeftToRight(Document doc, int p0, int p1) { + if (Boolean.TRUE.equals(doc.getProperty(I18NProperty))) { + if (doc instanceof AbstractDocument) { + AbstractDocument adoc = (AbstractDocument) doc; + Element bidiRoot = adoc.getBidiRootElement(); + int index = bidiRoot.getElementIndex(p0); + Element bidiElem = bidiRoot.getElement(index); + if (bidiElem.getEndOffset() >= p1) { + AttributeSet bidiAttrs = bidiElem.getAttributes(); + return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0); + } + } } return true; } diff --git a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java index 40a4af016ec..7a1a3ab4c53 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java @@ -1211,12 +1211,9 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou boolean isPositionLTR(int position, Position.Bias bias) { Document doc = component.getDocument(); - if(doc instanceof AbstractDocument ) { - if(bias == Position.Bias.Backward && --position < 0) - position = 0; - return ((AbstractDocument)doc).isLeftToRight(position, position); - } - return true; + if(bias == Position.Bias.Backward && --position < 0) + position = 0; + return AbstractDocument.isLeftToRight(doc, position, position); } Position.Bias guessBiasForOffset(int offset, Position.Bias lastBias, diff --git a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java index 8b27ec93e4d..dca62085a5b 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java @@ -239,10 +239,10 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { Position.Bias[] biasRet) throws BadLocationException { + Document doc = v.getDocument(); int startOffset = v.getStartOffset(); int endOffset = v.getEndOffset(); Segment text; - AbstractDocument doc; boolean viewIsLeftToRight; TextHitInfo currentHit, nextHit; @@ -252,8 +252,7 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { case View.SOUTH: break; case View.EAST: - doc = (AbstractDocument)v.getDocument(); - viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset); + viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset); if(startOffset == doc.getLength()) { if(pos == -1) { @@ -313,8 +312,7 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { } return pos; case View.WEST: - doc = (AbstractDocument)v.getDocument(); - viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset); + viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset); if(startOffset == doc.getLength()) { if(pos == -1) { diff --git a/jdk/src/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/ParagraphView.java index b88dd8731bb..396e153e520 100644 --- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java +++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java @@ -267,8 +267,6 @@ public class ParagraphView extends FlowView implements TabExpander { throws BadLocationException { JTextComponent text = (JTextComponent)getContainer(); Document doc = getDocument(); - AbstractDocument aDoc = (doc instanceof AbstractDocument) ? - (AbstractDocument)doc : null; View row = getView(rowIndex); int lastPos = -1; // This could be made better to check backward positions too. @@ -276,8 +274,7 @@ public class ParagraphView extends FlowView implements TabExpander { for(int vc = 0, numViews = row.getViewCount(); vc < numViews; vc++) { View v = row.getView(vc); int start = v.getStartOffset(); - boolean ltr = (aDoc != null) ? aDoc.isLeftToRight - (start, start + 1) : true; + boolean ltr = AbstractDocument.isLeftToRight(doc, start, start + 1); if(ltr) { lastPos = start; for(int end = v.getEndOffset(); lastPos < end; lastPos++) { @@ -338,12 +335,8 @@ public class ParagraphView extends FlowView implements TabExpander { protected boolean flipEastAndWestAtEnds(int position, Position.Bias bias) { Document doc = getDocument(); - if(doc instanceof AbstractDocument && - !((AbstractDocument)doc).isLeftToRight(getStartOffset(), - getStartOffset() + 1)) { - return true; - } - return false; + position = getStartOffset(); + return !AbstractDocument.isLeftToRight(doc, position, position + 1); } // --- FlowView methods --------------------------------------------- diff --git a/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java new file mode 100644 index 00000000000..624a2522356 --- /dev/null +++ b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java @@ -0,0 +1,241 @@ +/* + * 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 sun.awt.SunToolkit; + +import java.awt.Robot; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.event.DocumentListener; +import javax.swing.event.UndoableEditListener; +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.Element; +import javax.swing.text.PlainDocument; +import javax.swing.text.Position; +import javax.swing.text.Segment; + +import static java.awt.BorderLayout.NORTH; +import static java.awt.BorderLayout.SOUTH; +import static java.awt.Toolkit.getDefaultToolkit; +import static java.awt.event.KeyEvent.VK_LEFT; +import static javax.swing.SwingUtilities.invokeAndWait; + +/* + * @test + * @bug 6968363 + * @summary Ensures that a custom document may not extend AbstractDocument + * @author Sergey Malenkov + */ +public class Test6968363 implements Runnable, Thread.UncaughtExceptionHandler { + private JFrame frame; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) getDefaultToolkit(); + Runnable task = new Test6968363(); + invokeAndWait(task); + toolkit.realSync(100); + new Robot().keyPress(VK_LEFT); + toolkit.realSync(100); + invokeAndWait(task); + } + + @Override + public void uncaughtException(Thread thread, Throwable throwable) { + throwable.printStackTrace(); + System.exit(1); + } + + @Override + public void run() { + if (this.frame == null) { + Thread.setDefaultUncaughtExceptionHandler(this); + this.frame = new JFrame(getClass().getSimpleName()); + this.frame.add(NORTH, new JLabel("Copy Paste a HINDI text into the field below")); + this.frame.add(SOUTH, new JTextField(new MyDocument(), "\u0938", 10)); + this.frame.pack(); + this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + this.frame.setLocationRelativeTo(null); + this.frame.setVisible(true); + } else { + this.frame.dispose(); + this.frame = null; + } + } + + private static class MyDocument implements Document { + private final Document document = new PlainDocument(); + + @Override + public int getLength() { + return this.document.getLength(); + } + + @Override + public void addDocumentListener(DocumentListener listener) { + this.document.addDocumentListener(listener); + } + + @Override + public void removeDocumentListener(DocumentListener listener) { + this.document.removeDocumentListener(listener); + } + + @Override + public void addUndoableEditListener(UndoableEditListener listener) { + this.document.addUndoableEditListener(listener); + } + + @Override + public void removeUndoableEditListener(UndoableEditListener listener) { + this.document.removeUndoableEditListener(listener); + } + + @Override + public Object getProperty(Object key) { + return this.document.getProperty(key); + } + + @Override + public void putProperty(Object key, Object value) { + this.document.putProperty(key, value); + } + + @Override + public void remove(int offset, int length) throws BadLocationException { + this.document.remove(offset, length); + } + + @Override + public void insertString(int offset, String string, AttributeSet set) throws BadLocationException { + for (int i = 0; i < string.length(); i++) { + System.out.println("i: " + i + "; ch: " + Integer.toHexString(string.charAt(i))); + } + this.document.insertString(offset, string, set); + } + + @Override + public String getText(int offset, int length) throws BadLocationException { + return this.document.getText(offset, length); + } + + @Override + public void getText(int offset, int length, Segment segment) throws BadLocationException { + this.document.getText(offset, length, segment); + } + + @Override + public Position getStartPosition() { + return this.document.getStartPosition(); + } + + @Override + public Position getEndPosition() { + return this.document.getEndPosition(); + } + + @Override + public Position createPosition(int offset) throws BadLocationException { + return this.document.createPosition(offset); + } + + @Override + public Element[] getRootElements() { + Element[] elements = this.document.getRootElements(); + Element[] wrappers = new Element[elements.length]; + for (int i = 0; i < elements.length; i++) { + wrappers[i] = new MyElement(elements[i]); + } + return wrappers; + } + + @Override + public Element getDefaultRootElement() { + return new MyElement(this.document.getDefaultRootElement()); + } + + @Override + public void render(Runnable task) { + this.document.render(task); + } + + private class MyElement implements Element { + private final Element element; + + private MyElement(Element element) { + this.element = element; + } + + @Override + public Document getDocument() { + return MyDocument.this; + } + + @Override + public Element getParentElement() { + return new MyElement(this.element.getParentElement()); + } + + @Override + public String getName() { + return this.element.getName(); + } + + @Override + public AttributeSet getAttributes() { + return this.element.getAttributes(); + } + + @Override + public int getStartOffset() { + return this.element.getStartOffset(); + } + + @Override + public int getEndOffset() { + return this.element.getEndOffset(); + } + + @Override + public int getElementIndex(int offset) { + return this.element.getElementIndex(offset); + } + + @Override + public int getElementCount() { + return this.element.getElementCount(); + } + + @Override + public Element getElement(int index) { + return new MyElement(this.element.getElement(index)); + } + + @Override + public boolean isLeaf() { + return this.element.isLeaf(); + } + } + } +} From 81cd0a873837c1a1c5899ed5727347cdf05d6b7d Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Wed, 18 Sep 2013 08:51:23 +0200 Subject: [PATCH 083/983] 8023954: MBean*Info.equals: throw NPE Reviewed-by: dfuchs, dholmes --- .../javax/management/MBeanAttributeInfo.java | 8 +- .../management/MBeanConstructorInfo.java | 6 +- .../javax/management/MBeanFeatureInfo.java | 7 +- .../management/MBeanNotificationInfo.java | 7 +- .../javax/management/MBeanOperationInfo.java | 8 +- .../javax/management/MBeanParameterInfo.java | 9 +- .../MBeanInfo/MBeanInfoEqualsNPETest.java | 216 ++++++++++++++++++ 7 files changed, 240 insertions(+), 21 deletions(-) create mode 100644 jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java diff --git a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java index a70fb3a3571..7a3adaa5ad8 100644 --- a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java @@ -286,10 +286,10 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { if (!(o instanceof MBeanAttributeInfo)) return false; MBeanAttributeInfo p = (MBeanAttributeInfo) o; - return (p.getName().equals(getName()) && - p.getType().equals(getType()) && - p.getDescription().equals(getDescription()) && - p.getDescriptor().equals(getDescriptor()) && + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getType(), getType()) && + Objects.equals(p.getDescription(), getDescription()) && + Objects.equals(p.getDescriptor(), getDescriptor()) && p.isReadable() == isReadable() && p.isWritable() == isWritable() && p.isIs() == isIs()); diff --git a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java index ad2176367d2..d02ffce3a8d 100644 --- a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java @@ -191,10 +191,10 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable if (!(o instanceof MBeanConstructorInfo)) return false; MBeanConstructorInfo p = (MBeanConstructorInfo) o; - return (p.getName().equals(getName()) && - p.getDescription().equals(getDescription()) && + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getDescription(), getDescription()) && Arrays.equals(p.fastGetSignature(), fastGetSignature()) && - p.getDescriptor().equals(getDescriptor())); + Objects.equals(p.getDescriptor(), getDescriptor())); } /* Unlike attributes and operations, it's quite likely we'll have diff --git a/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java b/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java index a2349a8c69f..ec8e8b622b8 100644 --- a/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanFeatureInfo.java @@ -30,6 +30,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.io.StreamCorruptedException; +import java.util.Objects; /** *

    Provides general information for an MBean descriptor object. @@ -147,9 +148,9 @@ public class MBeanFeatureInfo implements Serializable, DescriptorRead { if (!(o instanceof MBeanFeatureInfo)) return false; MBeanFeatureInfo p = (MBeanFeatureInfo) o; - return (p.getName().equals(getName()) && - p.getDescription().equals(getDescription()) && - p.getDescriptor().equals(getDescriptor())); + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getDescription(), getDescription()) && + Objects.equals(p.getDescriptor(), getDescriptor())); } public int hashCode() { diff --git a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java index b4bbbe80292..ad1c74f83d5 100644 --- a/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanNotificationInfo.java @@ -26,6 +26,7 @@ package javax.management; import java.util.Arrays; +import java.util.Objects; /** *

    The MBeanNotificationInfo class is used to describe the @@ -191,9 +192,9 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable if (!(o instanceof MBeanNotificationInfo)) return false; MBeanNotificationInfo p = (MBeanNotificationInfo) o; - return (p.getName().equals(getName()) && - p.getDescription().equals(getDescription()) && - p.getDescriptor().equals(getDescriptor()) && + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getDescription(), getDescription()) && + Objects.equals(p.getDescriptor(), getDescriptor()) && Arrays.equals(p.fastGetNotifTypes(), fastGetNotifTypes())); } diff --git a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java index 8effa04f8d8..1be6d8f563a 100644 --- a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java @@ -294,12 +294,12 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable { if (!(o instanceof MBeanOperationInfo)) return false; MBeanOperationInfo p = (MBeanOperationInfo) o; - return (p.getName().equals(getName()) && - p.getReturnType().equals(getReturnType()) && - p.getDescription().equals(getDescription()) && + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getReturnType(), getReturnType()) && + Objects.equals(p.getDescription(), getDescription()) && p.getImpact() == getImpact() && Arrays.equals(p.fastGetSignature(), fastGetSignature()) && - p.getDescriptor().equals(getDescriptor())); + Objects.equals(p.getDescriptor(), getDescriptor())); } /* We do not include everything in the hashcode. We assume that diff --git a/jdk/src/share/classes/javax/management/MBeanParameterInfo.java b/jdk/src/share/classes/javax/management/MBeanParameterInfo.java index df3d59087df..81f2eff840d 100644 --- a/jdk/src/share/classes/javax/management/MBeanParameterInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanParameterInfo.java @@ -27,6 +27,7 @@ package javax.management; import java.util.Objects; + /** * Describes an argument of an operation exposed by an MBean. * Instances of this class are immutable. Subclasses may be mutable @@ -137,10 +138,10 @@ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable { if (!(o instanceof MBeanParameterInfo)) return false; MBeanParameterInfo p = (MBeanParameterInfo) o; - return (p.getName().equals(getName()) && - p.getType().equals(getType()) && - p.getDescription().equals(getDescription()) && - p.getDescriptor().equals(getDescriptor())); + return (Objects.equals(p.getName(), getName()) && + Objects.equals(p.getType(), getType()) && + Objects.equals(p.getDescription(), getDescription()) && + Objects.equals(p.getDescriptor(), getDescriptor())); } public int hashCode() { diff --git a/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java b/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java new file mode 100644 index 00000000000..440878c37f3 --- /dev/null +++ b/jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java @@ -0,0 +1,216 @@ +/* + * 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 javax.management.MBeanAttributeInfo; +import javax.management.MBeanConstructorInfo; +import javax.management.MBeanFeatureInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.modelmbean.DescriptorSupport; +import javax.management.openmbean.SimpleType; + +/* + * @test + * @bug 8023954 + * @summary Test that MBean*Info.equals do not throw NPE + * @author Shanliang JIANG + * @run clean MBeanInfoEqualsNPETest + * @run build MBeanInfoEqualsNPETest + * @run main MBeanInfoEqualsNPETest + */ +public class MBeanInfoEqualsNPETest { + private static int failed = 0; + + public static void main(String[] args) throws Exception { + System.out.println("---MBeanInfoEqualsNPETest-main ..."); + + // ---- + System.out.println("\n---Testing on MBeanAttributeInfo..."); + MBeanAttributeInfo mbeanAttributeInfo0 = new MBeanAttributeInfo( + "name", SimpleType.INTEGER.getClassName(), "description", true, true, false); + MBeanAttributeInfo mbeanAttributeInfo = new MBeanAttributeInfo( + null, SimpleType.INTEGER.getClassName(), "description", true, true, false); + test(mbeanAttributeInfo0, mbeanAttributeInfo, "class name"); + + mbeanAttributeInfo = new MBeanAttributeInfo( + "name", null, "description", true, true, false); + test(mbeanAttributeInfo0, mbeanAttributeInfo, "type"); + + mbeanAttributeInfo = new MBeanAttributeInfo( + "name", SimpleType.INTEGER.getClassName(), null, true, true, false); + test(mbeanAttributeInfo0, mbeanAttributeInfo, "description"); + + // ---- + System.out.println("\n---Testing on MBeanConstructorInfo..."); + MBeanConstructorInfo mbeanConstructorInfo0 = new MBeanConstructorInfo( + "", "", new MBeanParameterInfo[]{}, new DescriptorSupport()); + MBeanConstructorInfo mbeanConstructorInfo = new MBeanConstructorInfo( + null, "", new MBeanParameterInfo[]{}, new DescriptorSupport()); + test(mbeanConstructorInfo0, mbeanConstructorInfo, "name"); + + mbeanConstructorInfo = new MBeanConstructorInfo( + "", null, new MBeanParameterInfo[]{}, new DescriptorSupport()); + test(mbeanConstructorInfo0, mbeanConstructorInfo, "description"); + + mbeanConstructorInfo = new MBeanConstructorInfo( + "", "", null, new DescriptorSupport()); + test(mbeanConstructorInfo0, mbeanConstructorInfo, "MBeanParameterInfo"); + + mbeanConstructorInfo = new MBeanConstructorInfo( + "", "", new MBeanParameterInfo[]{}, null); + test(mbeanConstructorInfo0, mbeanConstructorInfo, "descriptor"); + + // ---- + System.out.println("\n---Testing on MBeanOperationInfo..."); + MBeanOperationInfo mbeanOperationInfo0 = new MBeanOperationInfo( + "name", "description", new MBeanParameterInfo[]{}, "type", + MBeanOperationInfo.UNKNOWN, new DescriptorSupport()); + + MBeanOperationInfo mbeanOperationInfo = new MBeanOperationInfo( + null, "description", new MBeanParameterInfo[]{}, "type", + MBeanOperationInfo.UNKNOWN, new DescriptorSupport()); + test(mbeanOperationInfo0, mbeanOperationInfo, "name"); + + mbeanOperationInfo = new MBeanOperationInfo( + "name", null, new MBeanParameterInfo[]{}, "type", + MBeanOperationInfo.UNKNOWN, new DescriptorSupport()); + test(mbeanOperationInfo0, mbeanOperationInfo, "description"); + + mbeanOperationInfo = new MBeanOperationInfo( + "name", "description", null, "type", 1, new DescriptorSupport()); + test(mbeanOperationInfo0, mbeanOperationInfo, "MBeanParameterInfo"); + + mbeanOperationInfo = new MBeanOperationInfo( + "name", "description", new MBeanParameterInfo[]{}, null, + MBeanOperationInfo.UNKNOWN, new DescriptorSupport()); + test(mbeanOperationInfo0, mbeanOperationInfo, "type"); + + mbeanOperationInfo = new MBeanOperationInfo( + "name", "description", new MBeanParameterInfo[]{}, null, + MBeanOperationInfo.UNKNOWN, null); + test(mbeanOperationInfo0, mbeanOperationInfo, "Descriptor"); + + // ---- + System.out.println("\n---Testing on MBeanParameterInfo..."); + MBeanParameterInfo mbeanParameterInfo0 = new MBeanParameterInfo( + "name", "type", "description", new DescriptorSupport()); + MBeanParameterInfo mbeanParameterInfo = new MBeanParameterInfo( + null, "type", "description", new DescriptorSupport()); + test(mbeanParameterInfo0, mbeanParameterInfo, "name"); + + mbeanParameterInfo = new MBeanParameterInfo( + "name", null, "description", new DescriptorSupport()); + test(mbeanParameterInfo0, mbeanParameterInfo, "type"); + + mbeanParameterInfo = new MBeanParameterInfo( + "name", "type", null, new DescriptorSupport()); + test(mbeanParameterInfo0, mbeanParameterInfo, "description"); + + mbeanParameterInfo = new MBeanParameterInfo( + "name", "type", "description", null); + test(mbeanParameterInfo0, mbeanParameterInfo, "Descriptor"); + + // ---- + System.out.println("\n---Testing on MBeanFeatureInfo ..."); + MBeanFeatureInfo mbeanFeatureInfo0 = new MBeanFeatureInfo( + "name", "description", new DescriptorSupport()); + MBeanFeatureInfo mbeanFeatureInfo = new MBeanFeatureInfo( + null, "description", new DescriptorSupport()); + test(mbeanFeatureInfo0, mbeanFeatureInfo, "name"); + + mbeanFeatureInfo = new MBeanFeatureInfo( + "name", null, new DescriptorSupport()); + test(mbeanParameterInfo0, mbeanParameterInfo, "description"); + + mbeanFeatureInfo = new MBeanFeatureInfo( + "name", "description", null); + test(mbeanParameterInfo0, mbeanParameterInfo, "Descriptor"); + + // ---- + System.out.println("\n---Testing on MBeanInfo..."); + String className = "toto"; + String description = "titi"; + MBeanAttributeInfo[] attrInfos = new MBeanAttributeInfo[]{}; + MBeanConstructorInfo[] constrInfos = new MBeanConstructorInfo[]{}; + MBeanOperationInfo[] operaInfos = new MBeanOperationInfo[]{}; + MBeanNotificationInfo[] notifInfos = new MBeanNotificationInfo[]{}; + + MBeanInfo minfo0 = new MBeanInfo("toto", description, attrInfos, constrInfos, operaInfos, notifInfos); + MBeanInfo minfo = new MBeanInfo(null, description, attrInfos, constrInfos, operaInfos, notifInfos); + test(minfo0, minfo, "class name"); + + minfo = new MBeanInfo(className, null, attrInfos, constrInfos, operaInfos, notifInfos); + test(minfo0, minfo, "description"); + + minfo = new MBeanInfo(className, description, null, constrInfos, operaInfos, notifInfos); + test(minfo0, minfo, "attrInfos"); + + minfo = new MBeanInfo(className, description, attrInfos, null, operaInfos, notifInfos); + test(minfo0, minfo, "constrInfos"); + + minfo = new MBeanInfo(className, description, attrInfos, constrInfos, null, notifInfos); + test(minfo0, minfo, "operaInfos"); + + minfo = new MBeanInfo(className, description, attrInfos, constrInfos, operaInfos, null); + test(minfo0, minfo, "notifInfos"); + + if (failed > 0) { + throw new RuntimeException("Test failed: "+failed); + } else { + System.out.println("---Test: PASSED"); + } + } + + private static void test(Object obj1, Object obj2, String param) { + try { + obj1.equals(obj2); + System.out.println("OK-1: "+obj1.getClass().getSimpleName()+".equals worked with a null paramer: "+param); + } catch (NullPointerException npe) { + System.out.println("--->KO-1!!! "+obj1.getClass().getSimpleName()+".equals got NPE with a null paramer: "+param); + npe.printStackTrace(); + failed++; + } + + try { + obj2.equals(obj1); + System.out.println("OK-2: "+obj2.getClass().getSimpleName()+".equals worked with a null paramer: "+param); + } catch (NullPointerException npe) { + System.out.println("--->KO-2!!! "+obj2.getClass().getSimpleName()+".equals got NPE with a null paramer: "+param); + npe.printStackTrace(); + failed++; + } + + try { + obj1.equals(null); + obj2.equals(null); + + System.out.println("OK-3: "+obj1.getClass().getSimpleName()+".equals worked with a null field."); + } catch (NullPointerException npe) { + System.out.println("--->KO-3!!! "+obj1.getClass().getSimpleName()+".equals got NPE with a null field."); + npe.printStackTrace(); + failed++; + } + } +} From 5ae304e238a2e80ff895f8118edd4e6e9394a612 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 18 Sep 2013 18:22:49 +0800 Subject: [PATCH 084/983] 8012615: Realm.getRealmsList returns realms list in wrong Reviewed-by: valeriep, xuelei --- .../classes/sun/security/krb5/Config.java | 34 +- .../classes/sun/security/krb5/Realm.java | 525 +++++------------- .../krb5/internal/CredentialsUtil.java | 20 +- jdk/test/sun/security/krb5/ParseCAPaths.java | 85 ++- jdk/test/sun/security/krb5/krb5-capaths.conf | 81 +-- 5 files changed, 264 insertions(+), 481 deletions(-) diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java index 5771886023c..c2640adbcda 100644 --- a/jdk/src/share/classes/sun/security/krb5/Config.java +++ b/jdk/src/share/classes/sun/security/krb5/Config.java @@ -225,19 +225,19 @@ public class Config { * and has no sub-key at all (given "forwardable" is defined, otherwise, * this method has no knowledge if it's a value name or a section name), */ - @SuppressWarnings("unchecked") public String get(String... keys) { - Vector v = get0(keys); + Vector v = getString0(keys); if (v == null) return null; return v.lastElement(); } /** * Gets all values for the specified keys. - * @see #get(java.lang.String[]) + * @throws IllegalArgumentException if any of the keys is illegal + * (See {@link #get}) */ public String getAll(String... keys) { - Vector v = get0(keys); + Vector v = getString0(keys); if (v == null) return null; StringBuilder sb = new StringBuilder(); boolean first = true; @@ -252,17 +252,37 @@ public class Config { return sb.toString(); } - // Internal method. Returns the vector of strings for keys. + /** + * Returns true if keys exists, can be either final string(s) or sub-stanza + * @throws IllegalArgumentException if any of the keys is illegal + * (See {@link #get}) + */ + public boolean exists(String... keys) { + return get0(keys) != null; + } + + // Returns final string value(s) for given keys. + @SuppressWarnings("unchecked") + private Vector getString0(String... keys) { + try { + return (Vector)get0(keys); + } catch (ClassCastException cce) { + throw new IllegalArgumentException(cce); + } + } + + // Internal method. Returns the value for keys, which can be a sub-stanza + // or final string value(s). // The only method (except for toString) that reads stanzaTable directly. @SuppressWarnings("unchecked") - private Vector get0(String... keys) { + private Object get0(String... keys) { Object current = stanzaTable; try { for (String key: keys) { current = ((Hashtable)current).get(key); if (current == null) return null; } - return (Vector)current; + return current; } catch (ClassCastException cce) { throw new IllegalArgumentException(cce); } diff --git a/jdk/src/share/classes/sun/security/krb5/Realm.java b/jdk/src/share/classes/sun/security/krb5/Realm.java index bc7705c4f0e..27bedc3ecf8 100644 --- a/jdk/src/share/classes/sun/security/krb5/Realm.java +++ b/jdk/src/share/classes/sun/security/krb5/Realm.java @@ -34,10 +34,8 @@ package sun.security.krb5; import sun.security.krb5.internal.Krb5; import sun.security.util.*; import java.io.IOException; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.Stack; -import java.util.EmptyStackException; +import java.util.*; + import sun.security.krb5.internal.util.KerberosString; /** @@ -50,7 +48,6 @@ import sun.security.krb5.internal.util.KerberosString; */ public class Realm implements Cloneable { private final String realm; // not null nor empty - private static boolean DEBUG = Krb5.DEBUG; public Realm(String name) throws RealmException { realm = parseRealm(name); @@ -233,90 +230,53 @@ public class Realm implements Cloneable { } } - /* - * First leg of realms parsing. Used by getRealmsList. - */ - private static String[] doInitialParse(String cRealm, String sRealm) - throws KrbException { - if (cRealm == null || sRealm == null){ - throw new KrbException(Krb5.API_INVALID_ARG); - } - if (DEBUG) { - System.out.println(">>> Realm doInitialParse: cRealm=[" - + cRealm + "], sRealm=[" +sRealm + "]"); - } - if (cRealm.equals(sRealm)) { - String[] retList = null; - retList = new String[1]; - retList[0] = new String(cRealm); - - if (DEBUG) { - System.out.println(">>> Realm doInitialParse: " - + retList[0]); - } - return retList; - } - return null; - } - /** * Returns an array of realms that may be traversed to obtain * a TGT from the initiating realm cRealm to the target realm * sRealm. *
    - * There may be an arbitrary number of intermediate realms - * between cRealm and sRealm. The realms may be organized - * organized hierarchically, or the paths between them may be - * specified in the [capaths] stanza of the caller's - * Kerberos configuration file. The configuration file is consulted - * first. Then a hirarchical organization is assumed if no realms - * are found in the configuration file. + * This method would read [capaths] to create a path, or generate a + * hierarchical path if [capaths] does not contain a sub-stanza for cRealm + * or the sub-stanza does not contain a tag for sRealm. *
    - * The returned list, if not null, contains cRealm as the first - * entry. sRealm is not included unless it is mistakenly listed - * in the configuration file as an intermediary realm. + * The returned list would never be null, and it always contains + * cRealm as the head entry. sRealm is not included as the tail. * - * @param cRealm the initiating realm - * @param sRealm the target realm - * @returns array of realms - * @thows KrbException + * @param cRealm the initiating realm, not null + * @param sRealm the target realm, not null, not equals to cRealm + * @returns array of realms including at least cRealm as the first + * element */ - public static String[] getRealmsList(String cRealm, String sRealm) - throws KrbException { - String[] retList = doInitialParse(cRealm, sRealm); - if (retList != null && retList.length != 0) { - return retList; - } - /* - * Try [capaths]. - */ - retList = parseCapaths(cRealm, sRealm); - if (retList != null && retList.length != 0) { - return retList; - } - /* - * Now assume the realms are organized hierarchically. - */ - retList = parseHierarchy(cRealm, sRealm); - return retList; + public static String[] getRealmsList(String cRealm, String sRealm) { + try { + // Try [capaths] + return parseCapaths(cRealm, sRealm); + } catch (KrbException ke) { + // Now assume the realms are organized hierarchically. + return parseHierarchy(cRealm, sRealm); } + } /** - * Parses the [capaths] stanza of the configuration file - * for a list of realms to traverse - * to obtain credentials from the initiating realm cRealm to - * the target realm sRealm. - * @param cRealm the initiating realm - * @param sRealm the target realm - * @returns array of realms - * @ throws KrbException - */ - - /* - * parseCapaths works for a capaths organized such that - * for a given client realm C there is a tag C that - * contains subtags Ci ... Cn that completely define intermediate - * realms from C to target T. For example: + * Parses the [capaths] stanza of the configuration file for a + * list of realms to traverse to obtain credentials from the + * initiating realm cRealm to the target realm sRealm. + * + * For a given client realm C there is a tag C in [capaths] whose + * subtag S has a value which is a (possibly partial) path from C + * to S. When the path is partial, it contains only the tail of the + * full path. Values of other subtags will be used to build the full + * path. The value "." means a direct path from C to S. If realm S + * does not appear as a subtag, there is no path defined here. + * + * The implementation ignores all values which equals to C or S, or + * a "." in multiple values, or any duplicated realm names. + * + * When a path value has more than two realms, they can be specified + * with multiple key-value pairs each having a single value, but the + * order must not change. + * + * For example: * * [capaths] * TIVOLI.COM = { @@ -325,357 +285,130 @@ public class Realm implements Cloneable { * LDAPCENTRAL.NET = . * } * - * The tag TIVOLI.COM contains subtags IBM.COM, IBM_LDAPCENTRAL.COM - * and LDAPCENTRAL.NET that completely define the path from TIVOLI.COM - * to IBM.COM (TIVOLI.COM->LADAPCENTRAL.NET->IBM_LDAPCENTRAL.COM->IBM - * or TIVOLI.COM->MOONLITE.ORG->IBM.COM). + * TIVOLI.COM has a direct path to LDAPCENTRAL.NET, which has a direct + * path to IBM_LDAPCENTRAL.COM. It also has a partial path to IBM.COM + * being "IBM_LDAPCENTRAL.COM MOONLITE.ORG". Merging these info together, + * a full path from TIVOLI.COM to IBM.COM will be * - * A direct path is assumed for an intermediary whose entry is not - * "closed" by a "." In the above example, TIVOLI.COM is assumed - * to have a direct path to MOONLITE.ORG and MOONLITE.COM - * in turn to IBM.COM. + * TIVOLI.COM -> LDAPCENTRAL.NET -> IBM_LDAPCENTRAL.COM + * -> IBM_LDAPCENTRAL.COM -> MOONLITE.ORG + * + * Please note the sRealm IBM.COM does not appear in the path. + * + * @param cRealm the initiating realm + * @param sRealm the target realm, not the same as cRealm + * @returns array of realms including at least cRealm as the first + * element + * @throws KrbException if the config does not contain a sub-stanza + * for cRealm in [capaths] or the sub-stanza does not contain + * sRealm as a tag */ + private static String[] parseCapaths(String cRealm, String sRealm) + throws KrbException { - private static String[] parseCapaths(String cRealm, String sRealm) throws KrbException { - String[] retList = null; + // This line could throw a KrbException + Config cfg = Config.getInstance(); - Config cfg = null; - try { - cfg = Config.getInstance(); - } catch (Exception exc) { - if (DEBUG) { - System.out.println ("Configuration information can not be " + - "obtained " + exc.getMessage()); - } - return null; + if (!cfg.exists("capaths", cRealm, sRealm)) { + throw new KrbException("No conf"); } - String intermediaries = cfg.getAll("capaths", cRealm, sRealm); + LinkedList path = new LinkedList<>(); - if (intermediaries == null) { - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: no cfg entry"); - } - return null; - } - - String tempTarget = null, tempRealm = null; - Stack iStack = new Stack<>(); - - /* - * The half-established reversed-path, starting from the final target - * (sRealm), each item can be connected to by the next one. - * Might contains wrong item, if found, a bad track is performed - */ - Vector tempList = new Vector<>(8, 8); - tempList.add(sRealm); - - int count = 0; // For debug only - tempTarget = sRealm; - - out: do { - if (DEBUG) { - count++; - System.out.println(">>> Realm parseCapaths: loop " + - count + ": target=" + tempTarget); - } - - if (intermediaries != null && - !intermediaries.equals(".") && - !intermediaries.equals(cRealm)) { - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: loop " + - count + ": intermediaries=[" + - intermediaries + "]"); - } - - /* - * We have one or more space-separated intermediary realms. - * Stack them. A null is always added between intermedies of - * different targets. When this null is popped, it means none - * of the intermedies for this target is useful (because of - * infinite loop), the target is then removed from the partial - * tempList, and the next possible intermediary is tried. - */ - iStack.push(null); - String[] ints = intermediaries.split("\\s+"); - for (int i = ints.length-1; i>=0; i--) - { - tempRealm = ints[i]; - if (tempRealm.equals(PrincipalName.REALM_COMPONENT_SEPARATOR_STR)) { - break out; - } - if (!tempList.contains(tempRealm)) { - iStack.push(tempRealm); - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: loop " + - count + - ": pushed realm on to stack: " + - tempRealm); - } - } else if (DEBUG) { - System.out.println(">>> Realm parseCapaths: loop " + - count + - ": ignoring realm: [" + - tempRealm + "]"); - } - } - } else { - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: loop " + - count + - ": no intermediaries"); - } + String head = sRealm; + while (true) { + String value = cfg.getAll("capaths", cRealm, head); + if (value == null) { break; } - - /* - * Get next intermediary realm from the stack - */ - - try { - while ((tempTarget = iStack.pop()) == null) { - tempList.removeElementAt(tempList.size()-1); - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: backtrack, remove tail"); - } + String[] more = value.split("\\s+"); + boolean changed = false; + for (int i=more.length-1; i>=0; i--) { + if (path.contains(more[i]) + || more[i].equals(".") + || more[i].equals(cRealm) + || more[i].equals(sRealm) + || more[i].equals(head)) { + // Ignore invalid values + continue; } - } catch (EmptyStackException exc) { - tempTarget = null; + changed = true; + path.addFirst(more[i]); } - - if (tempTarget == null) { - /* - * No more intermediaries. We're done. - */ - break; - } - - tempList.add(tempTarget); - - if (DEBUG) { - System.out.println(">>> Realm parseCapaths: loop " + count + - ": added intermediary to list: " + - tempTarget); - } - - intermediaries = cfg.getAll("capaths", cRealm, tempTarget); - - } while (true); - - if (tempList.isEmpty()) { - return null; + if (!changed) break; + head = path.getFirst(); } - - // From (SREALM, T1, T2) to (CREALM, T2, T1) - retList = new String[tempList.size()]; - retList[0] = cRealm; - for (int i=1; i>> Realm parseCapaths [" + i + - "]=" + retList[i]); - } - } - - return retList; - } + path.addFirst(cRealm); + return path.toArray(new String[path.size()]); + } /** * Build a list of realm that can be traversed * to obtain credentials from the initiating realm cRealm * for a service in the target realm sRealm. * @param cRealm the initiating realm - * @param sRealm the target realm - * @returns array of realms - * @throws KrbException + * @param sRealm the target realm, not the same as cRealm + * @returns array of realms including cRealm as the first element */ - private static String[] parseHierarchy(String cRealm, String sRealm) - throws KrbException - { - String[] retList = null; + private static String[] parseHierarchy(String cRealm, String sRealm) { - // Parse the components and determine common part, if any. + String[] cComponents = cRealm.split("\\."); + String[] sComponents = sRealm.split("\\."); - String[] cComponents = null; - String[] sComponents = null; + int cPos = cComponents.length; + int sPos = sComponents.length; - StringTokenizer strTok = - new StringTokenizer(cRealm, - PrincipalName.REALM_COMPONENT_SEPARATOR_STR); - - // Parse cRealm - - int cCount = strTok.countTokens(); - cComponents = new String[cCount]; - - for (cCount = 0; strTok.hasMoreTokens(); cCount++) { - cComponents[cCount] = strTok.nextToken(); + boolean hasCommon = false; + for (sPos--, cPos--; sPos >=0 && cPos >= 0 && + sComponents[sPos].equals(cComponents[cPos]); + sPos--, cPos--) { + hasCommon = true; } - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy: cRealm has " + - cCount + " components:"); - int j = 0; - while (j < cCount) { - System.out.println(">>> Realm parseHierarchy: " + - "cComponents["+j+"]=" + cComponents[j++]); - } + // For those with common components: + // length pos + // SITES1.SALES.EXAMPLE.COM 4 1 + // EVERYWHERE.EXAMPLE.COM 3 0 + + // For those without common components: + // length pos + // DEVEL.EXAMPLE.COM 3 2 + // PROD.EXAMPLE.ORG 3 2 + + LinkedList path = new LinkedList<>(); + + // Un-common ones for client side + for (int i=0; i<=cPos; i++) { + path.addLast(subStringFrom(cComponents, i)); } - // Parse sRealm - - strTok = new StringTokenizer(sRealm, - PrincipalName.REALM_COMPONENT_SEPARATOR_STR); - - int sCount = strTok.countTokens(); - sComponents = new String[sCount]; - - for (sCount = 0; strTok.hasMoreTokens(); sCount++) { - sComponents[sCount] = strTok.nextToken(); + // Common one + if (hasCommon) { + path.addLast(subStringFrom(cComponents, cPos+1)); } - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy: sRealm has " + - sCount + " components:"); - int j = 0; - while (j < sCount) { - System.out.println(">>> Realm parseHierarchy: sComponents["+j+ - "]=" + sComponents[j++]); - } + // Un-common ones for server side + for (int i=sPos; i>=0; i--) { + path.addLast(subStringFrom(sComponents, i)); } - // Determine common components, if any. + // Remove sRealm from path. Note that it might be added at last loop + // or as a common component, if sRealm is a parent of cRealm + path.removeLast(); - int commonComponents = 0; - - //while (sCount > 0 && cCount > 0 && - // sComponents[--sCount].equals(cComponents[--cCount])) - - for (sCount--, cCount--; sCount >=0 && cCount >= 0 && - sComponents[sCount].equals(cComponents[cCount]); - sCount--, cCount--) { - commonComponents++; - } - - int cCommonStart = -1; - int sCommonStart = -1; - - int links = 0; - - if (commonComponents > 0) { - sCommonStart = sCount+1; - cCommonStart = cCount+1; - - // components from common to ancestors - links += sCommonStart; - links += cCommonStart; - } else { - links++; - } - - if (DEBUG) { - if (commonComponents > 0) { - System.out.println(">>> Realm parseHierarchy: " + - commonComponents + " common component" + - (commonComponents > 1 ? "s" : " ")); - - System.out.println(">>> Realm parseHierarchy: common part " - + - "in cRealm (starts at index " + - cCommonStart + ")"); - System.out.println(">>> Realm parseHierarchy: common part in sRealm (starts at index " + - sCommonStart + ")"); - - - String commonPart = substring(cRealm, cCommonStart); - System.out.println(">>> Realm parseHierarchy: common part in cRealm=" + - commonPart); - - commonPart = substring(sRealm, sCommonStart); - System.out.println(">>> Realm parseHierarchy: common part in sRealm=" + - commonPart); - - } else - System.out.println(">>> Realm parseHierarchy: no common part"); - } - - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy: total links=" + links); - } - - retList = new String[links]; - - retList[0] = new String(cRealm); - - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy A: retList[0]=" + - retList[0]); - } - - // For an initiator realm A.B.C.D.COM, - // build a list krbtgt/B.C.D.COM@A.B.C.D.COM up to the common part, - // ie the issuer realm is the immediate descendant - // of the target realm. - - String cTemp = null, sTemp = null; - int i; - for (i = 1, cCount = 0; i < links && cCount < cCommonStart; cCount++) { - sTemp = substring(cRealm, cCount+1); - //cTemp = substring(cRealm, cCount); - retList[i++] = new String(sTemp); - - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy B: retList[" + - (i-1) +"]="+retList[i-1]); - } - } - - - for (sCount = sCommonStart; i < links && sCount - 1 > 0; sCount--) { - sTemp = substring(sRealm, sCount-1); - //cTemp = substring(sRealm, sCount); - retList[i++] = new String(sTemp); - if (DEBUG) { - System.out.println(">>> Realm parseHierarchy D: retList[" + - (i-1) +"]="+retList[i-1]); - } - } - - return retList; + return path.toArray(new String[path.size()]); } - private static String substring(String realm, int componentIndex) - { - int i = 0 , j = 0, len = realm.length(); - - while(i < len && j != componentIndex) { - if (realm.charAt(i++) != PrincipalName.REALM_COMPONENT_SEPARATOR) - continue; - j++; + /** + * Creates a realm name using components from the given postion. + * For example, subStringFrom({"A", "B", "C"}, 1) is "B.C". + */ + private static String subStringFrom(String[] components, int from) { + StringBuilder sb = new StringBuilder(); + for (int i=from; i>> Credentials acquireServiceCreds: no realms list"); - } - return null; - } - int i = 0, k = 0; Credentials cTgt = null, newTgt = null, theTgt = null; PrincipalName tempService = null; @@ -206,16 +198,14 @@ public class CredentialsUtil { if (newTgt == null) { if (DEBUG) { System.out.println(">>> Credentials acquireServiceCreds: " - + "no tgt; searching backwards"); + + "no tgt; searching thru capath"); } /* - * No tgt found. Try to get one for a - * realm as close to the target as possible. - * That means traversing the realms list backwards. + * No tgt found. Let's go thru the realms list one by one. */ - for (newTgt = null, k = realms.length - 1; - newTgt == null && k > i; k--) { + for (newTgt = null, k = i+1; + newTgt == null && k < realms.length; k++) { tempService = PrincipalName.tgsService(realms[k], realms[i]); if (DEBUG) { System.out.println( diff --git a/jdk/test/sun/security/krb5/ParseCAPaths.java b/jdk/test/sun/security/krb5/ParseCAPaths.java index f8c30bd7b7d..18b43470842 100644 --- a/jdk/test/sun/security/krb5/ParseCAPaths.java +++ b/jdk/test/sun/security/krb5/ParseCAPaths.java @@ -22,7 +22,7 @@ */ /* * @test - * @bug 6789935 + * @bug 6789935 8012615 * @run main/othervm ParseCAPaths * @summary cross-realm capath search error */ @@ -35,37 +35,75 @@ public class ParseCAPaths { public static void main(String[] args) throws Exception { System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") +"/krb5-capaths.conf"); - //System.setProperty("sun.security.krb5.debug", "true"); - // Standard example + // MIT check("ANL.GOV", "TEST.ANL.GOV", "ANL.GOV"); check("ANL.GOV", "ES.NET", "ANL.GOV"); check("ANL.GOV", "PNL.GOV", "ANL.GOV", "ES.NET"); check("ANL.GOV", "NERSC.GOV", "ANL.GOV", "ES.NET"); + check("NERSC.GOV", "TEST.ANL.GOV", "NERSC.GOV", "ES.NET", "ANL.GOV"); + + // RedHat + // 3.6.2.1. Configuring a Shared Hierarchy of Names + check("AA.EXAMPLE.COM", "BB.EXAMPLE.COM", + "AA.EXAMPLE.COM", "EXAMPLE.COM"); + check("SITE1.SALES.EXAMPLE.COM", "EVERYWHERE.EXAMPLE.COM", + "SITE1.SALES.EXAMPLE.COM", "SALES.EXAMPLE.COM", + "EXAMPLE.COM"); + check("DEVEL.EXAMPLE.COM", "PROD.EXAMPLE.ORG", + "DEVEL.EXAMPLE.COM", "EXAMPLE.COM", "COM", + "ORG", "EXAMPLE.ORG"); + // 3.6.2.2. Configuring Paths in krb5.conf + check("A.EXAMPLE.COM", "B.EXAMPLE.COM", "A.EXAMPLE.COM"); + check("A.EXAMPLE.COM", "C.EXAMPLE.COM", + "A.EXAMPLE.COM", "B.EXAMPLE.COM"); + check("A.EXAMPLE.COM", "D.EXAMPLE.COM", + "A.EXAMPLE.COM", "B.EXAMPLE.COM", "C.EXAMPLE.COM"); + + // The original JDK example + check("TIVOLI.COM", "IBM.COM", "TIVOLI.COM", "LDAPCENTRAL.NET", + "IBM_LDAPCENTRAL.COM", "MOONLITE.ORG"); + // Hierachical - check("N1.N.COM", "N2.N.COM", "N1.N.COM", "N.COM"); // 2 common - check("N1.N.COM", "N2.N3.COM", "N1.N.COM", "N.COM", // 1 common + check("N1.N.COM", "N2.N.COM", "N1.N.COM", "N.COM"); + check("N1.N.COM", "N2.N3.COM", "N1.N.COM", "N.COM", "COM", "N3.COM"); - check("N1.COM", "N2.COM", "N1.COM", "COM"); // 1 common - check("N1", "N2", "N1"); // 0 common - // Extra garbages - check("A1.COM", "A4.COM", "A1.COM", "A2.COM"); + check("N1.COM", "N2.COM", "N1.COM", "COM"); + check("N1", "N2", "N1"); + check("N1.COM", "N2.ORG", "N1.COM", "COM", "ORG"); + check("N1.N.COM", "N.COM", "N1.N.COM"); + check("X.N1.N.COM", "N.COM", "X.N1.N.COM", "N1.N.COM"); + check("N.COM", "N1.N.COM", "N.COM"); + check("N.COM", "X.N1.N.COM", "N.COM", "N1.N.COM"); + check("A.B.C", "D.E.F", "A.B.C", "B.C", "C", "F", "E.F"); + + // Full path + check("A1.COM", "A2.COM", "A1.COM"); + check("A1.COM", "A3.COM", "A1.COM", "A2.COM"); + check("A1.COM", "A4.COM", "A1.COM", "A2.COM", "A3.COM"); + + // Shortest path + check("B1.COM", "B2.COM", "B1.COM"); check("B1.COM", "B3.COM", "B1.COM", "B2.COM"); + check("B1.COM", "B4.COM", "B1.COM", "B2.COM", "B3.COM"); + // Missing is "." + check("C1.COM", "C2.COM", "C1.COM", "COM"); check("C1.COM", "C3.COM", "C1.COM", "C2.COM"); - // Multiple path - check("D1.COM", "D4.COM", "D1.COM", "D2.COM"); - check("E1.COM", "E4.COM", "E1.COM", "E2.COM"); - check("F1.COM", "F4.COM", "F1.COM", "F9.COM"); - // Infinite loop - check("G1.COM", "G3.COM", "G1.COM", "COM"); - check("H1.COM", "H3.COM", "H1.COM"); + + // cRealm = . + check("D1.COM", "D2.COM", "D1.COM"); + + // Bad cases + check("E1.COM", "E2.COM", "E1.COM"); + check("E1.COM", "E3.COM", "E1.COM", "E4.COM"); + check("G1.COM", "G3.COM", "G1.COM", "G2.COM"); check("I1.COM", "I4.COM", "I1.COM", "I5.COM"); - // J2=J1 is the same as J2=. - check("J1.COM", "J2.COM", "J1.COM"); + // 7019384 check("A9.PRAGUE.XXX.CZ", "SERVIS.XXX.CZ", "A9.PRAGUE.XXX.CZ", "PRAGUE.XXX.CZ", "ROOT.XXX.CZ"); + if (failed != null) { throw failed; } @@ -75,6 +113,7 @@ public class ParseCAPaths { try { check2(from, to, paths); } catch (Exception e) { + System.out.println(" " + e.getMessage()); failed = e; } } @@ -84,18 +123,14 @@ public class ParseCAPaths { System.out.println(from + " -> " + to); System.out.println(" expected: " + Arrays.toString(paths)); String[] result = Realm.getRealmsList(from, to); - System.out.println(" result: " + Arrays.toString(result)); - if (result == null) { - if (paths.length == 0) { - // OK - } else { - throw new Exception("Shouldn't have a valid path."); - } + if (result == null || result.length == 0) { + throw new Exception("There is always a valid path."); } else if(result.length != paths.length) { throw new Exception("Length of path not correct"); } else { for (int i=0; i Date: Wed, 18 Sep 2013 14:10:24 +0100 Subject: [PATCH 085/983] 8024883: (se) SelectableChannel.register throws NPE if fd >= 64k (lnx) Co-authored-by: Norman Maurer Reviewed-by: alanb, coffeys --- .../sun/nio/ch/DevPollArrayWrapper.java | 7 +++++-- .../classes/sun/nio/ch/EPollArrayWrapper.java | 18 +++++++++++++++--- .../classes/sun/nio/ch/EventPortWrapper.java | 12 +++++++++--- .../nio/channels/Selector/LotsOfChannels.java | 5 +++-- .../nio/channels/Selector/SelectorLimit.java | 3 ++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/jdk/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java b/jdk/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java index df30e2924f2..6eeee2a7532 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java +++ b/jdk/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java @@ -26,9 +26,11 @@ package sun.nio.ch; import java.io.IOException; +import java.security.AccessController; import java.util.BitSet; import java.util.Map; import java.util.HashMap; +import sun.security.action.GetIntegerAction; /** @@ -78,10 +80,11 @@ class DevPollArrayWrapper { static final int NUM_POLLFDS = Math.min(OPEN_MAX-1, 8192); // Initial size of arrays for fd registration changes - private final int INITIAL_PENDING_UPDATE_SIZE = 64; + private static final int INITIAL_PENDING_UPDATE_SIZE = 64; // maximum size of updatesLow - private final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024); + private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged( + new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024))); // The pollfd array for results from devpoll driver private final AllocatedNativeObject pollArray; diff --git a/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java b/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java index a73d3c2dff1..f64feb24c75 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java +++ b/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java @@ -26,9 +26,11 @@ package sun.nio.ch; import java.io.IOException; +import java.security.AccessController; import java.util.BitSet; import java.util.HashMap; import java.util.Map; +import sun.security.action.GetIntegerAction; /** * Manipulates a native array of epoll_event structs on Linux: @@ -78,8 +80,8 @@ class EPollArrayWrapper { private static final int INITIAL_PENDING_UPDATE_SIZE = 64; // maximum size of updatesLow - private static final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024); - + private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged( + new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024))); // The fd of the epoll driver private final int epfd; @@ -163,6 +165,16 @@ class EPollArrayWrapper { return pollArray.getInt(offset); } + /** + * Returns {@code true} if updates for the given key (file + * descriptor) are killed. + */ + private boolean isEventsHighKilled(Integer key) { + assert key >= MAX_UPDATE_ARRAY_SIZE; + Byte value = eventsHigh.get(key); + return (value != null && value == KILLED); + } + /** * Sets the pending update events for the given file descriptor. This * method has no effect if the update events is already set to KILLED, @@ -175,7 +187,7 @@ class EPollArrayWrapper { } } else { Integer key = Integer.valueOf(fd); - if ((eventsHigh.get(key) != KILLED) || force) { + if (!isEventsHighKilled(key) || force) { eventsHigh.put(key, Byte.valueOf(events)); } } diff --git a/jdk/src/solaris/classes/sun/nio/ch/EventPortWrapper.java b/jdk/src/solaris/classes/sun/nio/ch/EventPortWrapper.java index bec37360642..d9383eb7ed0 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/EventPortWrapper.java +++ b/jdk/src/solaris/classes/sun/nio/ch/EventPortWrapper.java @@ -25,9 +25,14 @@ package sun.nio.ch; -import sun.misc.Unsafe; import java.io.IOException; -import java.util.*; +import java.security.AccessController; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Map; + +import sun.misc.Unsafe; +import sun.security.action.GetIntegerAction; import static sun.nio.ch.SolarisEventPort.*; /** @@ -49,7 +54,8 @@ class EventPortWrapper { private final int INITIAL_PENDING_UPDATE_SIZE = 256; // maximum size of updateArray - private final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024); + private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged( + new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024))); // special update status to indicate that it should be ignored private static final byte IGNORE = -1; diff --git a/jdk/test/java/nio/channels/Selector/LotsOfChannels.java b/jdk/test/java/nio/channels/Selector/LotsOfChannels.java index d88655d807f..2db6366a7fd 100644 --- a/jdk/test/java/nio/channels/Selector/LotsOfChannels.java +++ b/jdk/test/java/nio/channels/Selector/LotsOfChannels.java @@ -22,9 +22,10 @@ */ /* @test - * @bug 4503092 + * @bug 4503092 8024883 * @summary Tests that Windows Selector can use more than 63 channels - * @run main/timeout=300 LotsOfChannels + * @run main LotsOfChannels + * @run main/othervm -Dsun.nio.ch.maxUpdateArraySize=64 LotsOfChannels * @author kladko */ diff --git a/jdk/test/java/nio/channels/Selector/SelectorLimit.java b/jdk/test/java/nio/channels/Selector/SelectorLimit.java index 27589e24665..69963db8e04 100644 --- a/jdk/test/java/nio/channels/Selector/SelectorLimit.java +++ b/jdk/test/java/nio/channels/Selector/SelectorLimit.java @@ -22,12 +22,13 @@ */ /* @test - * @bug 4777504 + * @bug 4777504 8024883 * @summary Ensure that a Selector can return at least 100 selected keys * @author Mark Reinhold * @library .. * @build SelectorLimit * @run main/othervm SelectorLimit + * @run main/othervm -Dsun.nio.ch.maxUpdateArraySize=128 SelectorLimit */ import java.io.*; From ac8db73a7c956bdcc3749a0262a2af5ffbe60d3a Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 18 Sep 2013 21:37:45 +0800 Subject: [PATCH 086/983] 8011402: Move blacklisting certificate logic from hard code to data Reviewed-by: erikj, mullan --- jdk/make/java/security/Makefile | 25 +- jdk/makefiles/CopyFiles.gmk | 19 + .../java/security/cert/Certificate.java | 19 +- .../security/util/UntrustedCertificates.java | 907 ++---------------- .../sun/security/x509/X509CertImpl.java | 42 + .../security/BlacklistedCertsConverter.java | 89 ++ jdk/src/share/lib/security/blacklisted.certs | 19 + .../share/lib/security/blacklisted.certs.pem | 721 ++++++++++++++ .../lib/security/CheckBlacklistedCerts.java | 131 +++ 9 files changed, 1118 insertions(+), 854 deletions(-) create mode 100644 jdk/src/share/lib/security/BlacklistedCertsConverter.java create mode 100644 jdk/src/share/lib/security/blacklisted.certs create mode 100644 jdk/src/share/lib/security/blacklisted.certs.pem create mode 100644 jdk/test/lib/security/CheckBlacklistedCerts.java diff --git a/jdk/make/java/security/Makefile b/jdk/make/java/security/Makefile index bbb0ca4f757..05b6b8a5664 100644 --- a/jdk/make/java/security/Makefile +++ b/jdk/make/java/security/Makefile @@ -70,9 +70,13 @@ POLICY_BUILD = $(LIBDIR)/security/java.policy CACERTS_SRC = $(CACERTS_FILE) CACERTS_BUILD = $(LIBDIR)/security/cacerts +BLACKLISTED_CERTS_SRC = $(TOPDIR)/src/share/lib/security/blacklisted.certs +BLACKLISTED_CERTS_BUILD = $(LIBDIR)/security/blacklisted.certs + ifndef OPENJDK BLACKLIST_SRC = $(CLOSED_SHARE_SRC)/lib/security/blacklist BLACKLIST_BUILD = $(LIBDIR)/security/blacklist + BLACKLISTED_CERTS_SRC += $(wildcard $(CLOSED_SHARE_SRC)/lib/security/blacklisted.certs) TRUSTEDLIBS_SRC = $(CLOSED_SHARE_SRC)/lib/security/trusted.libraries TRUSTEDLIBS_BUILD = $(LIBDIR)/security/trusted.libraries endif @@ -85,9 +89,9 @@ FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class) include $(BUILDDIR)/common/Rules.gmk ifdef OPENJDK -build: properties policy cacerts +build: properties policy cacerts blacklisted-certs else -build: properties policy cacerts blacklist trustedlibs +build: properties policy cacerts blacklist blacklisted-certs trustedlibs endif install: all @@ -100,6 +104,8 @@ cacerts: classes $(CACERTS_BUILD) blacklist: classes $(BLACKLIST_BUILD) +blacklisted-certs: classes $(BLACKLISTED_CERTS_BUILD) + trustedlibs: classes $(TRUSTEDLIBS_BUILD) $(PROPS_BUILD): $(PROPS_SRC) @@ -114,12 +120,25 @@ $(CACERTS_BUILD): $(CACERTS_SRC) $(BLACKLIST_BUILD): $(BLACKLIST_SRC) $(install-file) +$(BLACKLISTED_CERTS_BUILD): $(BLACKLISTED_CERTS_SRC) + $(MKDIR) -p $(@D) + $(CAT) $^ | $(SED) '/^$$/d' | $(SORT) | $(UNIQ) > $@.tmp + $(GREP) -i Algorithm $@.tmp > $@ + if [ `$(SED) -n -e "$$=" $@` != 1 ]; then \ + $(ECHO) "Different algorithms defined in $^"; \ + $(RM) $@ $@.tmp; \ + false; \ + fi + $(GREP) -iv Algorithm $@.tmp >> $@ + $(RM) $@.tmp + $(TRUSTEDLIBS_BUILD): $(TRUSTEDLIBS_SRC) $(install-file) clean clobber:: .delete.classlist $(RM) -r $(CLASSBINDIR)/java/security - $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD) $(TRUSTEDLIBS_BUILD) + $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD) \ + $(BLACKLISTED_CERTS_BUILD) $(TRUSTEDLIBS_BUILD) # Additional Rule for building sun.security.util $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java diff --git a/jdk/makefiles/CopyFiles.gmk b/jdk/makefiles/CopyFiles.gmk index 2b3cbf2e200..abdf3546a18 100644 --- a/jdk/makefiles/CopyFiles.gmk +++ b/jdk/makefiles/CopyFiles.gmk @@ -382,11 +382,16 @@ COPY_FILES += $(CACERTS_DST) ########################################################################################## +BLACKLISTED_CERTS_SRC := $(JDK_TOPDIR)/src/share/lib/security/blacklisted.certs +BLACKLISTED_CERTS_DST := $(JDK_OUTPUTDIR)/lib/security/blacklisted.certs + ifndef OPENJDK BLACKLIST_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/blacklist BLACKLIST_DST := $(JDK_OUTPUTDIR)/lib/security/blacklist +BLACKLISTED_CERTS_SRC += $(wildcard $(JDK_TOPDIR)/src/closed/share/lib/security/blacklisted.certs) + TRUSTEDLIBS_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/trusted.libraries TRUSTEDLIBS_DST := $(JDK_OUTPUTDIR)/lib/security/trusted.libraries @@ -402,6 +407,20 @@ COPY_FILES += $(TRUSTEDLIBS_DST) endif +$(BLACKLISTED_CERTS_DST): $(BLACKLISTED_CERTS_SRC) + $(MKDIR) -p $(@D) + $(CAT) $^ | $(SED) '/^$$/d' | $(SORT) | $(UNIQ) > $@.tmp + $(GREP) -i Algorithm $@.tmp > $@ + if [ `$(SED) -n -e "$$=" $@` != 1 ]; then \ + $(ECHO) "Different algorithms defined in $^"; \ + $(RM) $@ $@.tmp; \ + false; \ + fi + $(GREP) -iv Algorithm $@.tmp >> $@ + $(RM) $@.tmp + +COPY_FILES += $(BLACKLISTED_CERTS_DST) + ########################################################################################## ifndef OPENJDK diff --git a/jdk/src/share/classes/java/security/cert/Certificate.java b/jdk/src/share/classes/java/security/cert/Certificate.java index 638a02e6f80..10544983d2c 100644 --- a/jdk/src/share/classes/java/security/cert/Certificate.java +++ b/jdk/src/share/classes/java/security/cert/Certificate.java @@ -66,6 +66,9 @@ public abstract class Certificate implements java.io.Serializable { // the certificate type private final String type; + /** Cache the hash code for the certiticate */ + private int hash = -1; // Default to -1 + /** * Creates a certificate of the specified type. * @@ -123,16 +126,16 @@ public abstract class Certificate implements java.io.Serializable { * @return the hashcode value. */ public int hashCode() { - int retval = 0; - try { - byte[] certData = X509CertImpl.getEncodedInternal(this); - for (int i = 1; i < certData.length; i++) { - retval += certData[i] * i; + int h = hash; + if (h == -1) { + try { + h = Arrays.hashCode(X509CertImpl.getEncodedInternal(this)); + } catch (CertificateException e) { + h = 0; } - return retval; - } catch (CertificateException e) { - return retval; + hash = h; } + return h; } /** diff --git a/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java b/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java index 73495df5bcc..e14229b3c9d 100644 --- a/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java +++ b/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java @@ -24,13 +24,15 @@ */ package sun.security.util; -import java.io.IOException; -import java.io.ByteArrayInputStream; +import java.io.*; +import java.security.AccessController; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PrivilegedAction; import java.security.cert.X509Certificate; -import java.security.cert.CertificateFactory; import java.security.cert.CertificateException; -import java.util.Set; -import java.util.HashSet; +import java.util.*; +import sun.security.x509.X509CertImpl; /** * A utility class to check if a certificate is untrusted. This is an internal @@ -42,8 +44,50 @@ import java.util.HashSet; */ public final class UntrustedCertificates { - private final static Set untrustedCerts = new HashSet<>(); + private static final Debug debug = Debug.getInstance("certpath"); + private static final String ALGORITHM_KEY = "Algorithm"; + private static final Properties props = new Properties(); + private static final String algorithm; + + static { + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + File f = new File(System.getProperty("java.home"), + "lib/security/blacklisted.certs"); + try (FileInputStream fin = new FileInputStream(f)) { + props.load(fin); + // It's said that the fingerprint could contain colons + for (Map.Entry e: props.entrySet()) { + e.setValue(stripColons(e.getValue())); + } + } catch (IOException fnfe) { + if (debug != null) { + debug.println("Error parsing blacklisted.certs"); + } + } + return null; + } + }); + algorithm = props.getProperty(ALGORITHM_KEY); + } + + private static String stripColons(Object input) { + String s = (String)input; + char[] letters = s.toCharArray(); + int pos = 0; + for (int i = 0; i < letters.length; i++) { + if (letters[i] != ':') { + if (i != pos) { + letters[pos] = letters[i]; + } + pos++; + } + } + if (pos == letters.length) return s; + else return new String(letters, 0, pos); + } /** * Checks if a certificate is untrusted. * @@ -51,844 +95,21 @@ public final class UntrustedCertificates { * @return true if the certificate is untrusted. */ public static boolean isUntrusted(X509Certificate cert) { - return untrustedCerts.contains(cert); - } - - private static void add(String alias, String pemCert) { - // generate certificate from PEM certificate - try (ByteArrayInputStream is = - new ByteArrayInputStream(pemCert.getBytes())) { - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - X509Certificate cert = (X509Certificate)cf.generateCertificate(is); - - if (!untrustedCerts.add(cert)) { - throw new RuntimeException("Duplicate untrusted certificate: " + - cert.getSubjectX500Principal()); - } - } catch (CertificateException | IOException e) { - throw new RuntimeException( - "Incorrect untrusted certificate: " + alias, e); + if (algorithm == null) { + return false; } + String key; + if (cert instanceof X509CertImpl) { + key = ((X509CertImpl)cert).getFingerprint(algorithm); + } else { + try { + key = new X509CertImpl(cert.getEncoded()).getFingerprint(algorithm); + } catch (CertificateException cee) { + return false; + } + } + return props.containsKey(key); } - static { - // ----------------------------------------------------------------- - // Compromised CAs of Digicert Malaysia - // - // Reported by Digicert in its announcement on November 05, 2011. - // - - // Digicert Malaysia intermediate, cross-signed by CyberTrust - // - // Subject: CN=Digisign Server ID (Enrich), - // OU=457608-K, - // O=Digicert Sdn. Bhd., - // C=MY - // Issuer: CN=GTE CyberTrust Global Root, - // OU=GTE CyberTrust Solutions, Inc., - // O=GTE Corporation, - // C=US - // Serial: 120001705 (07:27:14:a9) - add("digicert-server-cross-to-cybertrust-4C0E636A", - "-----BEGIN CERTIFICATE-----\n" + - "MIIDyzCCAzSgAwIBAgIEBycUqTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV\n" + - "UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" + - "cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" + - "b2JhbCBSb290MB4XDTA3MDcxNzE1MTc0OFoXDTEyMDcxNzE1MTY1NFowYzELMAkG\n" + - "A1UEBhMCTVkxGzAZBgNVBAoTEkRpZ2ljZXJ0IFNkbi4gQmhkLjERMA8GA1UECxMI\n" + - "NDU3NjA4LUsxJDAiBgNVBAMTG0RpZ2lzaWduIFNlcnZlciBJRCAoRW5yaWNoKTCB\n" + - "nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArahkS02Hx4RZufuQRqCmicDx/tXa\n" + - "VII3DZkrRSYK6Fawf8qo9I5HhAGCKeOzarWR8/uVhbxyqGToCkCcxfRxrnt7agfq\n" + - "kBRPjYmvlKuyBtQCanuYH1m5Os1U+iDfsioK6bjdaZDAKdNO0JftZszFGUkGf/pe\n" + - "LHx7hRsyQt97lSUCAwEAAaOCAXgwggF0MBIGA1UdEwEB/wQIMAYBAf8CAQAwXAYD\n" + - "VR0gBFUwUzBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcCARYtaHR0cDovL2N5YmVy\n" + - "dHJ1c3Qub21uaXJvb3QuY29tL3JlcG9zaXRvcnkuY2ZtMAcGBWCDSgEBMA4GA1Ud\n" + - "DwEB/wQEAwIB5jCBiQYDVR0jBIGBMH+heaR3MHUxCzAJBgNVBAYTAlVTMRgwFgYD\n" + - "VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv\n" + - "bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv\n" + - "b3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93d3cucHVibGljLXRydXN0\n" + - "LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYDVR0OBBYEFMYWk04WF+wW\n" + - "royUdvOGbcV0boR3MA0GCSqGSIb3DQEBBQUAA4GBAHYAe6Z4K2Ydjl42xqSOBfIj\n" + - "knyTZ9P0wAp9iy3Z6tVvGvPhSilaIoRNUC9LDPL/hcJ7VdREgr5trGeOvLQfkpxR\n" + - "gBoU9m6rYYgLrRx/90tQUdZlG6ZHcRVesHHzNRTyN71jyNXwk1o0X9g96F33xR7A\n" + - "5c8fhiSpPAdmzcHSNmNZ\n" + - "-----END CERTIFICATE-----"); - - // Digicert Malaysia intermediate, cross-signed by Entrust - // - // Subject: CN=Digisign Server ID - (Enrich), - // OU=457608-K, - // O=Digicert Sdn. Bhd., - // C=MY - // Issuer: CN=Entrust.net Certification Authority (2048) - // OU=(c) 1999 Entrust.net Limited, - // OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), - // O=Entrust.net - // Serial: 1184644297 (4c:0e:63:6a) - add("digicert-server-cross-to-entrust-ca-4C0E636A", - "-----BEGIN CERTIFICATE-----\n" + - "MIIEzjCCA7agAwIBAgIETA5jajANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML\n" + - "RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp\n" + - "bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5\n" + - "IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp\n" + - "ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw0xMDA3MTYxNzIzMzdaFw0xNTA3\n" + - "MTYxNzUzMzdaMGUxCzAJBgNVBAYTAk1ZMRswGQYDVQQKExJEaWdpY2VydCBTZG4u\n" + - "IEJoZC4xETAPBgNVBAsTCDQ1NzYwOC1LMSYwJAYDVQQDEx1EaWdpc2lnbiBTZXJ2\n" + - "ZXIgSUQgLSAoRW5yaWNoKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n" + - "AMWJ5PQNBkCSWccaszXRDkwqM/n4r8qef+65p21g9FTob9Wb8xtjMQRoctE0Foy0\n" + - "FyyX3nPF2JAVoBor9cuzSIZE8B2ITM5BQhrv9Qze/kDaOSD3BlU6ap1GwdJvpbLI\n" + - "Vz4po5zg6YV3ZuiYpyR+vsBZIOVEb7ZX2L7OwmV3WMZhQdF0BMh/SULFcqlyFu6M\n" + - "3RJdtErU0a9Qt9iqdXZorT5dqjBtYairEFs+E78z4K9EnTgiW+9ML6ZxJhUmyiiM\n" + - "2fqOjqmiFDXimySItPR/hZ2DTwehthSQNsQ0HI0mYW0Tb3i+6I8nx0uElqOGaAwj\n" + - "vgvsjJQAqQSKE5D334VsDLECAwEAAaOCATQwggEwMA4GA1UdDwEB/wQEAwIBBjAS\n" + - "BgNVHRMBAf8ECDAGAQH/AgEAMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggrBgEFBQcD\n" + - "AgYIKwYBBQUHAwQwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8v\n" + - "b2NzcC5lbnRydXN0Lm5ldDBEBgNVHSAEPTA7MDkGBWCDSgEBMDAwLgYIKwYBBQUH\n" + - "AgEWImh0dHA6Ly93d3cuZGlnaWNlcnQuY29tLm15L2Nwcy5odG0wMgYDVR0fBCsw\n" + - "KTAnoCWgI4YhaHR0cDovL2NybC5lbnRydXN0Lm5ldC8yMDQ4Y2EuY3JsMBEGA1Ud\n" + - "DgQKBAhMTswlKAMpgTAfBgNVHSMEGDAWgBRV5IHREYC+2Im5CKMx+aEkCRa5cDAN\n" + - "BgkqhkiG9w0BAQUFAAOCAQEAl0zvSjpJrHL8MCBrtClbp8WVBJD5MtXChWreA6E3\n" + - "+YkAsFqsVX7bQzX/yQH4Ub7MJsrIaqTEVD4mHucMo82XZ5TdpkLrXM2POXlrM3kh\n" + - "Bnn6gkQVmczBtznTRmJ8snDrb84gqj4Zt+l0gpy0pUtNYQA35IfS8hQ6ZHy4qXth\n" + - "4JMi59WfPkfmNnagU9gAAzoPtTP+lsrT0oI6Lt3XSOHkp2nMHOmZSufKcEXXCwcO\n" + - "mnUb0C+Sb/akB8O9HEumhLZ9qJqp0qcp8QtXaR6XVybsK0Os1EWDBQDp4/BGQAf6\n" + - "6rFRc5Mcpd1TETfIKqcVJx20qsx/qjEw/LhFn0gJ7RDixQ==\n" + - "-----END CERTIFICATE-----"); - - - // ----------------------------------------------------------------- - // - // No longer used certificates - // - - // Subject: CN=Java Media APIs, - // OU=Java Signed Extensions, - // OU=Corporate Object Signing, - // O=Sun Microsystems Inc - // Issuer: CN=Object Signing CA, - // OU=Class 2 OnSite Subscriber CA, - // OU=VeriSign Trust Network, - // O=Sun Microsystems Inc - // Serial: 6a:8b:99:91:37:59:4f:89:53:e2:97:18:9f:19:1e:4e - add("java-media-pretrusted-9F191E4E", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFdzCCBF+gAwIBAgIQaouZkTdZT4lT4pcYnxkeTjANBgkqhkiG9w0BAQUFADCB\n" + - "gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT\n" + - "aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj\n" + - "cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDUxMjAw\n" + - "MDAwMFoXDTEyMDUxMTIzNTk1OVowfTEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt\n" + - "cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE\n" + - "CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEYMBYGA1UEAxQPSmF2YSBNZWRpYSBB\n" + - "UElzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5blzoKTVE8y4Hpz\n" + - "q6E15RZz1bF5HnYEyYqgHkZXnAKedmYCoMzm1XK8s+gQWShLEvGEAvs5yqarx9gE\n" + - "nnC21N28aEZgIJMa2/arKxCUkS4pxdGPYGexL9UzSRkUpoBShCZKEGdmX7gfJE2K\n" + - "/sd9MFvGV5/yZtWXrADzvm0Kd/9mg1KRv1gfrZIq0TJbupoXPYYqb73AkI9eT2ZD\n" + - "q9MdwD4E5+oojsDFXt8GU/D00fUhtXpYwuplU7D667WHYdJhIah0ST6JywyqcLXG\n" + - "XSuFTXOgITT2idSHluZVmx3dqJ72u9kPkO4JdJTMDfaK8zgNLaRkiU8Qcj+qhLYH\n" + - "ytaqcwIDAQABo4IB6jCCAeYwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCB4AwfwYD\n" + - "VR0fBHgwdjB0oHKgcIZuaHR0cDovL29uc2l0ZWNybC52ZXJpc2lnbi5jb20vU3Vu\n" + - "TWljcm9zeXN0ZW1zSW5jQ29ycG9yYXRlT2JqZWN0U2lnbmluZ0phdmFTaWduZWRF\n" + - "eHRlbnNpb25zQ2xhc3NCL0xhdGVzdENSTC5jcmwwHwYDVR0jBBgwFoAUs0crgn5T\n" + - "tHPKuLsZt76BTQeVx+0wHQYDVR0OBBYEFKS32mVx0gNWTeS4ProHEaeSpvvIMDsG\n" + - "CCsGAQUFBwEBBC8wLTArBggrBgEFBQcwAYYfaHR0cDovL29uc2l0ZS1vY3NwLnZl\n" + - "cmlzaWduLmNvbTCBtQYDVR0gBIGtMIGqMDkGC2CGSAGG+EUBBxcCMCowKAYIKwYB\n" + - "BQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwbQYLYIZIAYb3AIN9\n" + - "nD8wXjAnBggrBgEFBQcCARYbaHR0cHM6Ly93d3cuc3VuLmNvbS9wa2kvY3BzMDMG\n" + - "CCsGAQUFBwICMCcaJVZhbGlkYXRlZCBGb3IgU3VuIEJ1c2luZXNzIE9wZXJhdGlv\n" + - "bnMwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcNAQEFBQADggEBAAe6BO4W\n" + - "3TSNWfezyelJs6kE3HfulT6Bdyz4UUoh9ykXcV8nRwT+kh25I5MdyG2GfkJoADPR\n" + - "VhC5DYo13UFpIsTNVjq+hGYe2hML93bN7ad9SxCCyjHUo3yMz2qgBbHZI3VA9ZHA\n" + - "aWM4Tx0saMwbcnVvlbuGh+PXvStfypJqYT6lzcdFfjNVX4FI/QQNGhBswMY51tC8\n" + - "GTBCL2qhJon0gSCU4zaawDOf7+XxJWirLamYL1Aal1/h2z2sFrvA/1ftxtU3kZ6I\n" + - "7De8DyoHeZg7pYGdrj7g+lPhCga/WvEhN152I+aP08YbFcJHYmK05ngl/Ye4c6Bd\n" + - "cdrdfbw6QzEUIYY=\n" + - "-----END CERTIFICATE-----"); - - // Subject: CN=JavaFX 1.0 Runtime, - // OU=Java Signed Extensions, - // OU=Corporate Object Signing, - // O=Sun Microsystems Inc - // Issuer: CN=Object Signing CA, - // OU=Class 2 OnSite Subscriber CA, - // OU=VeriSign Trust Network, - // O=Sun Microsystems Inc - // Serial: 55:c0:e6:44:59:59:79:9e:d9:26:f1:b0:4a:1e:f0:27 - add("java-fx10-pretrusted-4A1EF027", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFezCCBGOgAwIBAgIQVcDmRFlZeZ7ZJvGwSh7wJzANBgkqhkiG9w0BAQUFADCB\n" + - "gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT\n" + - "aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj\n" + - "cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA4MTAwOTAw\n" + - "MDAwMFoXDTExMTAwOTIzNTk1OVowgYAxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl\n" + - "bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxHzAdBgNV\n" + - "BAsUFkphdmEgU2lnbmVkIEV4dGVuc2lvbnMxGzAZBgNVBAMUEkphdmFGWCAxLjAg\n" + - "UnVudGltZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM+WDc6+bu+4\n" + - "tmAcS/lBtUc02WOt9QZpVsXg9cG2pu/8bUtmDELa8iiYBVFpIs8DU58HLrGQtCUY\n" + - "SIAGOVPsOJoN29UKCDWfY9j5JeVhfhMGqk9DwrWhzgsjy4cpZ1pIp+k/fJ8zT8Ul\n" + - "aYLpow1vg3UNddsmwz02tN7cOrMw9WYIG4CRYnY1OrtJSfe2pYzheC4zyvR+aiVl\n" + - "nang2OtqikSQsNFOFHsLOJFxngy9LrO8evDSu25VTKI6zlWU6/bMeqtztJPN0VOn\n" + - "NyUrJZvkxZ207Jg0T693BGSxNC1n+ihztXogql8950M/pEuUbDjylv5FFvlp6DSB\n" + - "dDT2MkutmyMCAwEAAaOCAeowggHmMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeA\n" + - "MH8GA1UdHwR4MHYwdKByoHCGbmh0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29t\n" + - "L1N1bk1pY3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdKYXZhU2ln\n" + - "bmVkRXh0ZW5zaW9uc0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaAFLNH\n" + - "K4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBTjgufVi3XJ3gx1ewsA6Rr7BR4Z\n" + - "zjA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUtb2Nz\n" + - "cC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAqMCgG\n" + - "CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CGSAGG\n" + - "9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtpL2Nw\n" + - "czAzBggrBgEFBQcCAjAnGiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBPcGVy\n" + - "YXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IBAQAB\n" + - "YVJTTVe7rzyTO4jc3zajErOT/COkdQTfNo0eIX1QbNynFieJvwY/jRzUZwjktIFR\n" + - "2p4JtbpHGAtKtjOAOTieQ8xdDOoC1djzpE7/AbMvuvlTavtUKT+F7tPdhfXgWXJV\n" + - "6Wbt8jryKyk3zZGiEhauIwZUkfjRkEtffEmZWLUd8c8rURJjfC/XHH2oyurscoxc\n" + - "CjX29c9ynxSiS/VvQp1an0HvErGh69N48wj7cj8mtZ1yHzd2XCzSSR1OfTPfk0Pt\n" + - "yg51p7yJaFiH21PTZegEL6zyVNOYBTKwwIi2OzpwYalD3uvK6e3OKDrfFCOxu17u\n" + - "4PveESbrdyrmvLe7IVez\n" + - "-----END CERTIFICATE-----"); - - // Subject: CN=JavaFX Runtime, - // OU=Java Signed Extensions, - // OU=Corporate Object Signing, - // O=Sun Microsystems Inc - // Issuer: CN=Object Signing CA, - // OU=Class 2 OnSite Subscriber CA, - // OU=VeriSign Trust Network, - // O=Sun Microsystems Inc - // Serial: 47:f4:55:f1:da:4a:5e:f9:e3:f7:a8:03:62:17:c0:ff - add("javafx-runtime-pretrusted-6217C0FF", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFdjCCBF6gAwIBAgIQR/RV8dpKXvnj96gDYhfA/zANBgkqhkiG9w0BAQUFADCB\n" + - "gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT\n" + - "aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj\n" + - "cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDEyOTAw\n" + - "MDAwMFoXDTEyMDEyOTIzNTk1OVowfDEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt\n" + - "cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE\n" + - "CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEXMBUGA1UEAxQOSmF2YUZYIFJ1bnRp\n" + - "bWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCIzd0fAk8mI9ONc6RJ\n" + - "aGieioK2FLdXEwj8zL3vdGDVmBwyR1zwYkaOIFFgF9IW/8qc4iAYA5sGUY+0g8q3\n" + - "5DuYAxfTzBB5KdaYvbuq6GGnoHIWmTirXY+1friFp8lyXSvtuEaGB1VHaBoZchEg\n" + - "k+UgeVDA43dHwcT1Ov3DePczJRUes8T/QHzLX+BxUDG43vjyncCEO/AjqLZxXEz2\n" + - "xrNbKLcH3lGMJK7hdbfssUfF5BjC38Hn71HauYlA43b2no+2y0Sjulwzez2YPbDC\n" + - "0GLR3TnKtA8dqOrnl5t3DniDbfOBNtBE3VOydJO0XW57Ng1HRXD023nm9ECPY2xp\n" + - "0N/pAgMBAAGjggHqMIIB5jAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDB/BgNV\n" + - "HR8EeDB2MHSgcqBwhm5odHRwOi8vb25zaXRlY3JsLnZlcmlzaWduLmNvbS9TdW5N\n" + - "aWNyb3N5c3RlbXNJbmNDb3Jwb3JhdGVPYmplY3RTaWduaW5nSmF2YVNpZ25lZEV4\n" + - "dGVuc2lvbnNDbGFzc0IvTGF0ZXN0Q1JMLmNybDAfBgNVHSMEGDAWgBSzRyuCflO0\n" + - "c8q4uxm3voFNB5XH7TAdBgNVHQ4EFgQUvOdd0cKPj+Yik/iOBwTdphh5A+gwOwYI\n" + - "KwYBBQUHAQEELzAtMCsGCCsGAQUFBzABhh9odHRwOi8vb25zaXRlLW9jc3AudmVy\n" + - "aXNpZ24uY29tMIG1BgNVHSAEga0wgaowOQYLYIZIAYb4RQEHFwIwKjAoBggrBgEF\n" + - "BQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYTBtBgtghkgBhvcAg32c\n" + - "PzBeMCcGCCsGAQUFBwIBFhtodHRwczovL3d3dy5zdW4uY29tL3BraS9jcHMwMwYI\n" + - "KwYBBQUHAgIwJxolVmFsaWRhdGVkIEZvciBTdW4gQnVzaW5lc3MgT3BlcmF0aW9u\n" + - "czATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQUFAAOCAQEAbGcf2NjL\n" + - "AI93HG6ny2BbepaZA1a8xa/R6uUc7xV+Qw6MgLwFD4Q4i6LWUztQDvg9l68MM2/i\n" + - "Y9LEi1KM4lcNbK5+D+t9x98wXBiuojXhVdp5ZmC03EyEBbriopdBsmXVLDSu/Y3+\n" + - "zowOO5xwpMK3dbgsSDs2Vt0UosD3FTcRaD3GNfOhXMp+o1grHNiXF9YgkmdQbPPZ\n" + - "DQ2KBhFPCRJXBGvyKOqno/DTg0sQ3crGH/C4/4t7mnQXWldZotmJUZ0ONc9oD+Q1\n" + - "JAaguUKqIwn9yZ093ie+JWHbYNid9IIIPXYgtRxmf9a376WBhqhu56uJftBJ7x9g\n" + - "eQ7Lot6CSWCiFw==\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised Solaris INTERNAL DEVELOPMENT USE ONLY certificate - // - - // Subject: CN=Solaris INTERNAL DEVELOPMENT USE ONLY, - // OU=Solaris Cryptographic Framework, - // OU=Corporate Object Signing, - // O=Sun Microsystems Inc - // Issuer: CN=Object Signing CA, - // OU=Class 2 OnSite Subscriber CA, - // OU=VeriSign Trust Network, - // O=Sun Microsystems Inc - // Serial: 77:29:77:52:6a:19:7b:9a:a6:a2:c7:99:a0:e1:cd:8c - add("solaris-internal-dev-A0E1CD8C", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFHjCCBAagAwIBAgIQdyl3UmoZe5qmoseZoOHNjDANBgkqhkiG9w0BAQUFADCB\n" + - "gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT\n" + - "aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj\n" + - "cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA3MDEwNDAw\n" + - "MDAwMFoXDTEwMDEwMzIzNTk1OVowgZwxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl\n" + - "bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxKDAmBgNV\n" + - "BAsUH1NvbGFyaXMgQ3J5cHRvZ3JhcGhpYyBGcmFtZXdvcmsxLjAsBgNVBAMUJVNv\n" + - "bGFyaXMgSU5URVJOQUwgREVWRUxPUE1FTlQgVVNFIE9OTFkwgZ8wDQYJKoZIhvcN\n" + - "AQEBBQADgY0AMIGJAoGBALbNU4hf3mD5ArDI9pjgioAyvV3bjMPRQdCZniIeGJBp\n" + - "odFlSEH+Mh64W1DsY8coeZ7FvvGJkx9IpTMJW9k8w1oJK9UNqHyAQfaYjQyXi3xQ\n" + - "LJp62EvYdGfDlwOZejEcR/MbzZG+GOPMMvQj5+xyFDvLXNGfQNTnxw2qnBgCJXjj\n" + - "AgMBAAGjggH1MIIB8TAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDCBiQYDVR0f\n" + - "BIGBMH8wfaB7oHmGd2h0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29tL1N1bk1p\n" + - "Y3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdTb2xhcmlzQ3J5cHRv\n" + - "Z3JhcGhpY0ZyYW1ld29ya0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaA\n" + - "FLNHK4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBRpfiGYkehTnsIzuN2H6AFb\n" + - "VCZG8jA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUt\n" + - "b2NzcC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAq\n" + - "MCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CG\n" + - "SAGG9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtp\n" + - "L2NwczAzBggrBgEFBQcCAjAnFiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBP\n" + - "cGVyYXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IB\n" + - "AQCG5soy3LFHTFbA8/5SzDRhQoJkHUnOP0t3b6nvX6vZYRp649fje7TQOPRm1pFd\n" + - "CZ17J+tggdZwgzTqY4aYpJ00jZaK6pV37q/vgFC/ia6jDs8Q+ly9cEcadBZ5loYg\n" + - "cmxp9p57W2MNWx8VA8oFdNtKfF0jUNXbLNtvwGHmgR6YcwLrGN1b6/9Lt9bO3ODl\n" + - "FO+ZDwkfQz5ClUVrTx2dGBvKRYFqSG5S8JAfsgYhPvcacUQkA7ExyKvfRXLWVrce\n" + - "ZiPpcElbx+819H2sAPvVvparVeAruZGMAtejHZp9NFoowKen5drJp9VxePS4eM49\n" + - "3DepB6lKRrNRw66LNQol4ZBz\n" + - "-----END CERTIFICATE-----"); - - - // ----------------------------------------------------------------- - // Compromised CAs of DigiNotar - // - // Reported by Fox-IT in its interim report on September 5, 2011, - // "DigiNotar Certificate Authority breach 'Operation Black Tulip'". - // - - // - // Compromised DigiNotar Cyber CA - // - - // DigiNotar intermediate, cross-signed by CyberTrust - // - // Subject: EMAILADDRESS=info@diginotar.nl, CN=DigiNotar Cyber CA, - // O=DigiNotar, C=NL - // Issuer: CN=GTE CyberTrust Global Root, - // OU=GTE CyberTrust Solutions, Inc., - // O=GTE Corporation, - // C=US - // Serial: 120000525 (07:27:10:0D) - add("info-at-diginotar-cyber-ca-cross-to-gte-cybertrust-0727100D", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFWjCCBMOgAwIBAgIEBycQDTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV\n" + - "UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" + - "cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" + - "b2JhbCBSb290MB4XDTA2MTAwNDEwNTQxMVoXDTExMTAwNDEwNTMxMVowYDELMAkG\n" + - "A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy\n" + - "IEN5YmVyIENBMSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIw\n" + - "DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANLOFQotqF6EZ639vu9Gx8i5z3P8\n" + - "9DS5+SxD52ATPXrjss87Z2yQrcC5P4RS8DVC3HTcKDu9UrSnrHJFF8bwieu0qiXy\n" + - "XUte0dmHutZ9fPXOMp8QM8WxSrtekTHC0OlBwpFkfglBO9uLCDdqqspS3rU5HsCI\n" + - "A6U/i5kTYUO1m4Kz7iBvz6FEouova0CfjytXraFTwoUiaZ2gP1HfC0GRDaXhqKpc\n" + - "SQhdvd5wQbEPyWNr0380dAIvNFp4dRxoeoFnivPaQPBgY/SSINcDpj2jHmfEhBtB\n" + - "pcmM5r3qSLYFFgizNxJa92E89zhvLpfgb1Y4VNMota0Ubi5LZLUnZbd1JQm2Bz2V\n" + - "VgIKgmCyc0XgMyZRdJq51FAc9k1bW1JSE1qmf6cO4ehBVGeYjIfVydNsy9NUkgYJ\n" + - "NEH3gW8/nsl8dVWw58Gzd+jDxAA1lUBwEEoF3iW7n1mlZLxHYL9g43aLE1Xd4XR6\n" + - "uc8kpmp/3mQiRFhogmoQ+T3lPhu5vfwi9GAEibtVbShV+t6OjRshFNc3izR7Tfay\n" + - "shDPM7F9HGKZSMsrbHaWVb8ZDR0fu2WqG46ZtcYokOWCLXhQIJr9eS8kf/CJKWn0\n" + - "fc1zvrPtTsHR7VJej/e4142HrbLZG1ES/1az4a80fVykeIgQnp0DxqWqoiRR90kU\n" + - "xbHuWUOV36toKDA/AgMBAAGjggGGMIIBgjASBgNVHRMBAf8ECDAGAQH/AgEBMFMG\n" + - "A1UdIARMMEowSAYJKwYBBAGxPgEAMDswOQYIKwYBBQUHAgEWLWh0dHA6Ly93d3cu\n" + - "cHVibGljLXRydXN0LmNvbS9DUFMvT21uaVJvb3QuaHRtbDAOBgNVHQ8BAf8EBAMC\n" + - "AQYwgaAGA1UdIwSBmDCBlYAUpgwdn2H/Bxe1vzhG20Mw1Y6wUgaheaR3MHUxCzAJ\n" + - "BgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdU\n" + - "RSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVy\n" + - "VHJ1c3QgR2xvYmFsIFJvb3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93\n" + - "d3cucHVibGljLXRydXN0LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYD\n" + - "VR0OBBYEFKv5aN/PSjfXe0WMX3LeQETDZbvCMA0GCSqGSIb3DQEBBQUAA4GBAI9o\n" + - "a6VbB7pEZg4cqFwwezPkCiYE/O+eGjjWLqEf0JlHwnVkJP2eOyh2uSYoYZEMbSz4\n" + - "BJ98UAHV42mv7xXSRZskCSpmBU8lgcpdvqrBWSeuM46C9990sFWzjvjnN8huqlZE\n" + - "9r1TgSOWPbT6MopTZkQloiXGpjwljPDgKAYityZB\n" + - "-----END CERTIFICATE-----"); - - // DigiNotar intermediate, cross-signed by CyberTrust - // - // Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL - // Issuer: CN=GTE CyberTrust Global Root, - // OU=GTE CyberTrust Solutions, Inc., - // O=GTE Corporation, - // C=US - // Serial: 120000505 (07:27:0F:F9) - add("diginotar-cyber-ca-cross-to-gte-cybertrust-07270FF9", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFODCCBKGgAwIBAgIEBycP+TANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV\n" + - "UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" + - "cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" + - "b2JhbCBSb290MB4XDTA2MDkyMDA5NDUzMloXDTEzMDkyMDA5NDQwNlowPjELMAkG\n" + - "A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy\n" + - "IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o\n" + - "XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S\n" + - "tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7\n" + - "24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp\n" + - "naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj\n" + - "9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu\n" + - "LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU\n" + - "Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk\n" + - "vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6\n" + - "3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt\n" + - "eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4\n" + - "iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB\n" + - "/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC\n" + - "ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s\n" + - "MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV\n" + - "jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv\n" + - "bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD\n" + - "VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6\n" + - "oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw\n" + - "MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI\n" + - "hvcNAQEFBQADgYEACcpiD427SuDUejUrBi3RKGG2rAH7g0m8rtQvLYauGYOl1h0T\n" + - "4he+/jJ06XoUOMqUXvcpAWlxG5Ea/aO7qh3Ke+IW/aGjDvMMX7LhIDGUK16Sdu36\n" + - "6bUjpr8KOwOpb1JgVM1f6bcvfKIn/UGDdbYN+3gm87FF6TKVKho1IZXFonU=\n" + - "-----END CERTIFICATE-----"); - - // DigiNotar intermediate, cross-signed by CyberTrust - // - // Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL - // Issuer: CN=GTE CyberTrust Global Root, - // OU=GTE CyberTrust Solutions, Inc., - // O=GTE Corporation, - // C=US - // Serial: 120000515 (07:27:10:03) - add("diginotar-cyber-ca-cross-to-gte-cybertrust-07271003", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFODCCBKGgAwIBAgIEBycQAzANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV\n" + - "UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" + - "cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" + - "b2JhbCBSb290MB4XDTA2MDkyNzEwNTMzMloXDTExMDkyNzEwNTIzMFowPjELMAkG\n" + - "A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy\n" + - "IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o\n" + - "XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S\n" + - "tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7\n" + - "24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp\n" + - "naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj\n" + - "9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu\n" + - "LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU\n" + - "Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk\n" + - "vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6\n" + - "3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt\n" + - "eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4\n" + - "iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB\n" + - "/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC\n" + - "ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s\n" + - "MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV\n" + - "jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv\n" + - "bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD\n" + - "VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6\n" + - "oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw\n" + - "MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI\n" + - "hvcNAQEFBQADgYEAWcyGZhizJlRP1jjNupZey+yZG6oMDW4Z11boriMHbYPCndBE\n" + - "bVh07zmPbZsihOw9w/vm5KbVX5CgxUv4Rhzh/20Faixf3P3bpWg0qgzHVVusNVR/\n" + - "P50aKkpdK3hp+QLl56e+lWOddSAINIpmcuyDI1hyuzB+GJEASm9tNU/6rs8=\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised DigiNotar Root CA - // - - // DigiNotar intermediate, cross-signed by Entrust - // - // Subject: EMAILADDRESS=info@diginotar.nl, - // CN=DigiNotar Root CA, - // O=DigiNotar, C=NL - // Issuer: CN=Entrust.net Secure Server Certification Authority - // OU=(c) 1999 Entrust.net Limited, - // OU=www.entrust.net/CPS incorp. by ref. (limits liab.), - // O=Entrust.net, - // C=US, - // Serial: 1184644297 (46:9C:3C:C9) - add("info-at-diginotar-root-ca-cross-to-entrust-secure-server-469C3CC9", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBLGgAwIBAgIERpw8yTANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA0\n" + - "MjYwNTAwMDBaFw0xMzA4MTQyMDEyMzZaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n" + - "hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + - "ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n" + - "OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx\n" + - "hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7\n" + - "gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D\n" + - "IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T\n" + - "BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs\n" + - "Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8\n" + - "5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf\n" + - "DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX\n" + - "9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e\n" + - "7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj\n" + - "ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB\n" + - "BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF\n" + - "BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD\n" + - "VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy\n" + - "bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G\n" + - "A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n" + - "BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAI979rBep8tu3TeLunapgsZ0jtXp\n" + - "GDFjKWSk87dj1jCyYi+q/GyDyZ6ZQZNRP0sF+6twscq05lClWNy3TROMp7QeuoLO\n" + - "G7Utw3OJaswUtp4YglANMRTHEe3g9ltifUXRH5tSuy7u6yi4LD4WTm5ULP6r/g6l\n" + - "0CnjXYb0+b1Fmz6U\n" + - "-----END CERTIFICATE-----"); - - // DigiNotar intermediate, cross-signed by Entrust - // - // Subject: EMAILADDRESS=info@diginotar.nl, - // CN=DigiNotar Root CA, - // O=DigiNotar, C=NL - // Issuer: CN=Entrust.net Secure Server Certification Authority - // OU=(c) 1999 Entrust.net Limited, - // OU=www.entrust.net/CPS incorp. by ref. (limits liab.), - // O=Entrust.net, - // C=US, - // Serial: 1184640175 (46:9C:2C:AF) - add("info-at-diginotar-root-ca-cross-to-entrust-secure-server-469C2CAF", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n" + - "MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n" + - "hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + - "ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n" + - "OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx\n" + - "hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7\n" + - "gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D\n" + - "IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T\n" + - "BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs\n" + - "Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8\n" + - "5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf\n" + - "DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX\n" + - "9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e\n" + - "7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj\n" + - "ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB\n" + - "BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF\n" + - "BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD\n" + - "VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy\n" + - "bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G\n" + - "A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n" + - "BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n" + - "xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n" + - "ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n" + - "ZFdYf+hthc3m6IcJ\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised DigiNotar PKIoverheid CA Organisatie - G2 - // - - // DigiNotar intermediate, cross-signed by the Dutch government - // - // Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2, - // O=DigiNotar B.V., - // C=NL - // Issuer: CN=Staat der Nederlanden Organisatie CA - G2, - // O=Staat der Nederlanden, - // C=NL - // Serial: 20001983 (01:31:34:bf) - add("diginotar-pkioverheid-organisatie-cross-to-nederlanden-013134BF", - "-----BEGIN CERTIFICATE-----\n" + - "MIIGnDCCBISgAwIBAgIEATE0vzANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJO\n" + - "TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTIwMAYDVQQDDClTdGFh\n" + - "dCBkZXIgTmVkZXJsYW5kZW4gT3JnYW5pc2F0aWUgQ0EgLSBHMjAeFw0xMDA1MTIw\n" + - "ODUxMzhaFw0yMDAzMjMwOTUwMDRaMFoxCzAJBgNVBAYTAk5MMRcwFQYDVQQKDA5E\n" + - "aWdpTm90YXIgQi5WLjEyMDAGA1UEAwwpRGlnaU5vdGFyIFBLSW92ZXJoZWlkIENB\n" + - "IE9yZ2FuaXNhdGllIC0gRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" + - "AQCxExkPJ+Zs1FWGS9DsiYpFkXisR71HK+T8RetPtCZzWzfTw3/2497Xo/gtaMUI\n" + - "PkuU1uSHJTZrhLUYdPMoWHMvm2rPvAQe9t7dr/xLqvXbZmIlASWC3vKXWhBu3V2p\n" + - "IrEEqSNzOvhxrR3PhETrR9Gvbch8KKvH8jd6dF9fxQIUiqNa4xtsAeNdjtlo1vQJ\n" + - "GzLckbUs9SDrjANtJkm4k8SFXdjSm69WaswFM8ygQp40VUSca6DUEtArVM23iQ3l\n" + - "9uvo+4UBM096a/GdcjOWDveyhKWlJ8Qn8VFzKXe6Z27+TNy04qGhgS85SY1DOBPO\n" + - "0KVcwoc6AGdlQiPxNlkKHaNRyLyjlCox3+M88p0aPASw77EKMBNzttfzo0wBdRSF\n" + - "eMDXijlYhVD6LubFvs+LP6+PNtQlCS3SD6xyk/K/i9RQs/kVUJuZ9RTZ+4uRozIm\n" + - "JqD43ztggYaDeVsr6xM9KTrBbd29no6H1kquNJcF7hSm9tw4fkrpJFQHPZdoN0Zr\n" + - "DceoIa8TVOQJavFNRgrJXfubT73e+7dUy7g4nKc5+2otwHuNq6WnV+xKkoozxeEg\n" + - "XHPYkJIrgNUPhhhpfDlPhIa890xb89W0yqDC8DciynlSH1PmqvOQsDvd8ij9rOvF\n" + - "BiSgydQvD1j9tZ7sD8+yWdCiBHo4aq5y+73wJWKUCacFCwIDAQABo4IBYTCCAV0w\n" + - "SAYDVR0gBEEwPzA9BgRVHSAAMDUwMwYIKwYBBQUHAgEWJ2h0dHA6Ly93d3cuZGln\n" + - "aW5vdGFyLm5sL2Nwcy9wa2lvdmVyaGVpZDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud\n" + - "DwEB/wQEAwIBBjCBhQYDVR0jBH4wfIAUORCLSZJc22ESIM1JnRqO2pxnQLmhXqRc\n" + - "MFoxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4x\n" + - "KzApBgNVBAMMIlN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENBIC0gRzKCBACY\n" + - "lvQwSQYDVR0fBEIwQDA+oDygOoY4aHR0cDovL2NybC5wa2lvdmVyaGVpZC5ubC9E\n" + - "b21PcmdhbmlzYXRpZUxhdGVzdENSTC1HMi5jcmwwHQYDVR0OBBYEFLxdlDvZq3sD\n" + - "JXNhwtst7vyrj2WhMA0GCSqGSIb3DQEBCwUAA4ICAQCP/C1Mt9kt1R+978v0t2gX\n" + - "dZ1O1ffdnPEqJu2forYcA9VTs+wIzzTi48P0tRYvyMO+19NzqwA2+RpKftZj6V5G\n" + - "uqW2jhW3oyrYQx3vXcgfgYWzi/f/PPTZ9EYIP5y8HaDZqEzNJVJOCrEg9x/pQ9lU\n" + - "RoETmsBedGwqmDLq/He7DaWiMZgifnx859qkrey3LhoZcfhIUNpDjyyE3cFAJ+O1\n" + - "8BVOltT4XOOGKUYr1zsH6zh/yIZXl9PvKjPEF1DVZGlrK2tFXl0vF8paTs/D1zk8\n" + - "9TufRrmb5w5Jl53W1eMbD+qPAU6aE5RZCgIHSEsaYKt/T+0L2FUNaG9VnGllFULs\n" + - "wNzdbKzDFs4LHVabpMTE0i7gD+JEJytQaaTcYuiKISlCbMwAOpZ2m+9AwKRed4Qy\n" + - "bCYqOWauXeO5ubIsaB8empADOfCqs6TMSYsYNOk3yXspx4R8b0QVL+xhWQTJRcui\n" + - "1lKifH8pktZKxYtCqNT+6tjHhyMY5J16fXNAUpigrm7jBT8FD+Clxm1N7YM3iJzH\n" + - "89xCmmq21yFJNnfy7xhPxXDZnunetyuL9Lx+KN8NQMmFXK6dxTH/0FwOtah+8Okv\n" + - "uq+IruW10Vilr5xxpykBkINpN4IFuvwJwQhujHg7wzMCgD9EhQgd31VWCK0shS1d\n" + - "sQPhrqp0xaTzTro3mHuCuQ==\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised DigiNotar PKIoverheid CA Overheid en Bedrijven - // - - // DigiNotar intermediate, cross-signed by the Dutch government - // - // Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven, - // O=DigiNotar B.V., - // C=NL - // Issuer: CN=Staat der Nederlanden Overheid CA - // O=Staat der Nederlanden, - // C=NL - // Serial: 20015536 (01:31:69:b0) - add("diginotar-pkioverheid-overheid-enb-cross-to-nederlanden-013169B0", - "-----BEGIN CERTIFICATE-----\n" + - "MIIEiDCCA3CgAwIBAgIEATFpsDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO\n" + - "TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh\n" + - "dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDcwNzA1MDg0MjA3WhcN\n" + - "MTUwNzI3MDgzOTQ2WjBfMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy\n" + - "IEIuVi4xNzA1BgNVBAMTLkRpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp\n" + - "ZCBlbiBCZWRyaWp2ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc\n" + - "vdKnTmoKuzuiheF/AK2+tDBomAfNoHrElM9x+Yo35FPrV3bMi+Zs/u6HVcg+uwQ5\n" + - "AKeAeKxbT370vbhUuHE7BzFJOZNUfCA7eSuPu2GQfbGs5h+QLp1FAalkLU3DL7nn\n" + - "UNVOKlyrdnY3Rtd57EKZ96LspIlw3Dgrh6aqJOadkiQbvvb91C8ZF3rmMgeUVAVT\n" + - "Q+lsvK9Hy7zL/b07RBKB8WtLu+20z6slTxjSzAL8o0+1QjPLWc0J3NNQ/aB2jKx+\n" + - "ZopC9q0ckvO2+xRG603XLzDgbe5bNr5EdLcgBVeFTegAGaL2DOauocBC36esgl3H\n" + - "aLcY5olLmmv6znn58yynAgMBAAGjggFQMIIBTDBIBgNVHSAEQTA/MD0GBFUdIAAw\n" + - "NTAzBggrBgEFBQcCARYnaHR0cDovL3d3dy5kaWdpbm90YXIubmwvY3BzL3BraW92\n" + - "ZXJoZWlkMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMIGABgNVHSME\n" + - "eTB3gBQLhtYPd6NosftkCcOIblwEHFfpPaFZpFcwVTELMAkGA1UEBhMCTkwxHjAc\n" + - "BgNVBAoTFVN0YWF0IGRlciBOZWRlcmxhbmRlbjEmMCQGA1UEAxMdU3RhYXQgZGVy\n" + - "IE5lZGVybGFuZGVuIFJvb3QgQ0GCBACYmnkwPQYDVR0fBDYwNDAyoDCgLoYsaHR0\n" + - "cDovL2NybC5wa2lvdmVyaGVpZC5ubC9Eb21PdkxhdGVzdENSTC5jcmwwHQYDVR0O\n" + - "BBYEFEwIyY128ZjHPt881y91DbF2eZfMMA0GCSqGSIb3DQEBBQUAA4IBAQAMlIca\n" + - "v03jheLu19hjeQ5Q38aEW9K72fUxCho1l3TfFPoqDz7toOMI9tVOW6+mriXiRWsi\n" + - "D7dUKH6S3o0UbNEc5W50BJy37zRERd/Jgx0ZH8Apad+J1T/CsFNt5U4X5HNhIxMm\n" + - "cUP9TFnLw98iqiEr2b+VERqKpOKrp11Lbyn1UtHk0hWxi/7wA8+nfemZhzizDXMU\n" + - "5HIs4c71rQZIZPrTKbmi2Lv01QulQERDjqC/zlqlUkxk0xcxYczopIro5Ij76eUv\n" + - "BjMzm5RmZrGrUDqhCYF0U1onuabSJc/Tw6f/ltAv6uAejVLpGBwgCkegllYOQJBR\n" + - "RKwa/fHuhR/3Qlpl\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised DigiNotar PKIoverheid CA Overheid - // - - // DigiNotar intermediate, cross-signed by the Dutch government - // - // Subject: CN=DigiNotar PKIoverheid CA Overheid - // O=DigiNotar B.V., - // C=NL - // Issuer: CN=Staat der Nederlanden Overheid CA - // O=Staat der Nederlanden, - // C=NL - // Serial: 20006006 (01:31:44:76) - add("diginotar-pkioverheid-overheid-cross-to-nederlanden-01314476", - "-----BEGIN CERTIFICATE-----\n" + - "MIIEezCCA2OgAwIBAgIEATFEdjANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO\n" + - "TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh\n" + - "dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDQwNjI0MDgxOTMyWhcN\n" + - "MTAwNjIzMDgxNzM2WjBSMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy\n" + - "IEIuVi4xKjAoBgNVBAMTIURpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp\n" + - "ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANSlrubta5tlOjVCi/gb\n" + - "yLCvRqfBjxG8H594VcKHu0WAYc99SPZF9cycj5mw2GyfQvy/WIrGrL4iyNq1gSqR\n" + - "0QA/mTXKZIaPqzpDhdm+VvrKkmjrbZfaQxgMSs3ChtBsjcP9Lc0X1zXZ4Q8nBe3k\n" + - "BTp+zehINfmbjoEgXLxsMR5RQ6GxzKjuC04PQpbJQgTIakglKaqYcDDZbEscWgPV\n" + - "Hgj/2aoHlj6leW/ThHZ+O41jUguEmBLZA3mu3HrCfrHntb5dPt0ihzSx7GtD/SaX\n" + - "5HBLxnP189YuqMk5iRA95CtiSdKauvon/xRKRLNgG6XAz0ctSoY7xLDdiBVU5kJd\n" + - "FScCAwEAAaOCAVAwggFMMEgGA1UdIARBMD8wPQYEVR0gADA1MDMGCCsGAQUFBwIB\n" + - "FidodHRwOi8vd3d3LmRpZ2lub3Rhci5ubC9jcHMvcGtpb3ZlcmhlaWQwDwYDVR0T\n" + - "AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgYAGA1UdIwR5MHeAFAuG1g93o2ix\n" + - "+2QJw4huXAQcV+k9oVmkVzBVMQswCQYDVQQGEwJOTDEeMBwGA1UEChMVU3RhYXQg\n" + - "ZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g\n" + - "Um9vdCBDQYIEAJiaeTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnBraW92\n" + - "ZXJoZWlkLm5sL0RvbU92TGF0ZXN0Q1JMLmNybDAdBgNVHQ4EFgQUvRaYQh2+kdE9\n" + - "wpcl4CjXWOC1f+IwDQYJKoZIhvcNAQEFBQADggEBAGhQsCWLiaN2EOhPAW+JQP6o\n" + - "XBOrLv5w6joahzBFVn1BiefzmlMKjibqKYxURRvMAsMkh82/MfL8V0w6ugxl81lu\n" + - "i42dcxl9cKSVXKMw4bbBzJ2VQI5HTIABwefeNuy/eX6idVwYdt3ajAH7fUA8Q9Cq\n" + - "vr6H8B+8mwoEqTVTEVlCSsC/EXsokYEUr06PPzRudKjDmijgj7zFaIioZNc8hk7g\n" + - "ufEgrs/tmcNGylrwRHgCXjCRBt2NHlZ08l7A1AGU8HcHlSbG9Un/2q9kVHUkps0D\n" + - "gtUaEK+x6jpAu/R8Ojezu/+ZEcwwjI/KOhG+84+ejFmtyEkrUdsAdEdLf/2dKsw=\n" + - "-----END CERTIFICATE-----"); - - // - // Compromised DigiNotar Services 1024 CA - // - - // DigiNotar intermediate, cross-signed by the Entrust - // - // Subject: EMAILADDRESS=info@diginotar.nl, - // CN=DigiNotar Services 1024 CA - // O=DigiNotar, C=NL - // Issuer: CN=Entrust.net Secure Server Certification Authority, - // OU=(c) 1999 Entrust.net Limited, - // OU=www.entrust.net/CPS incorp. by ref. (limits liab.), - // O=Entrust.net, - // C=US - // Serial: 1184640176 (46:9c:2c:b0) - add("diginotar-services-1024-ca-cross-to-entrust-469C2CB0", - "-----BEGIN CERTIFICATE-----\n" + - "MIIDzTCCAzagAwIBAgIERpwssDANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n" + - "MjYxNTU5MDBaFw0xMzA4MjYxNjI5MDBaMGgxCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxIzAhBgNVBAMTGkRpZ2lOb3RhciBTZXJ2aWNlcyAxMDI0IENB\n" + - "MSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCBnzANBgkqhkiG9w0B\n" + - "AQEFAAOBjQAwgYkCgYEA2ptNXTz50eKLxsYIIMXZHkjsZlhneWIrQWP0iY1o2q+4\n" + - "lDaLGSSkoJPSmQ+yrS01Tc0vauH5mxkrvAQafi09UmTN8T5nD4ku6PJPrqYIoYX+\n" + - "oakJ5sarPkP8r3oDkdqmOaZh7phPGKjTs69mgumfvN1y+QYEvRLZGCTnq5NTi1kC\n" + - "AwEAAaOCASYwggEiMBIGA1UdEwEB/wQIMAYBAf8CAQAwJwYDVR0lBCAwHgYIKwYB\n" + - "BQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDBDARBgNVHSAECjAIMAYGBFUdIAAwMwYI\n" + - "KwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5lbnRydXN0Lm5l\n" + - "dDAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmVudHJ1c3QubmV0L3NlcnZl\n" + - "cjEuY3JsMB0GA1UdDgQWBBT+3JRJDG/vXH/G8RKZTxZJrfuCZTALBgNVHQ8EBAMC\n" + - "AQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0BowGQYJKoZIhvZ9B0EA\n" + - "BAwwChsEVjcuMQMCAIEwDQYJKoZIhvcNAQEFBQADgYEAY3RqN6k/lpxmyFisCcnv\n" + - "9WWUf6MCxDgxvV0jh+zUVrLJsm7kBQb87PX6iHBZ1O7m3bV6oKNgLwIMq94SXa/w\n" + - "NUuqikeRGvWFLELHHe+VQ7NeuJWTpdrFKKqtci0xrZlrbP+MISevrZqRK8fdWMNu\n" + - "B8WfedLHjFW/TMcnXlEWKz4=\n" + - "-----END CERTIFICATE-----"); - - // - // Revoked DigiCert code signing certificates used to sign malware - // - - // Subject: CN=Buster Paper Comercial Ltda, - // O=Buster Paper Comercial Ltda, - // L=S?o Jos? Dos Campos, - // ST=S?o Paulo, - // C=BR - // Issuer: CN=DigiCert Assured ID Code Signing CA-1, - // OU=www.digicert.com, - // O=DigiCert Inc, - // C=US - // Serial: 07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12 - add("buster-paper-comercial-ltda-72A67312", - "-----BEGIN CERTIFICATE-----\n" + - "MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv\n" + - "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" + - "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" + - "ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow\n" + - "gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT\n" + - "w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l\n" + - "cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh\n" + - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL\n" + - "HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn\n" + - "2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4\n" + - "tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi\n" + - "mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf\n" + - "Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx\n" + - "BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw\n" + - "HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT\n" + - "BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js\n" + - "My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6\n" + - "Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud\n" + - "IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov\n" + - "L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG\n" + - "AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD\n" + - "AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh\n" + - "AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy\n" + - "AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn\n" + - "ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs\n" + - "AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp\n" + - "AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl\n" + - "AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho\n" + - "dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl\n" + - "cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et\n" + - "MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI\n" + - "hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft\n" + - "jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e\n" + - "gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44\n" + - "/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc\n" + - "BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj\n" + - "XMuKLxbh7g==\n" + - "-----END CERTIFICATE-----"); - - // Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, - // O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, - // L=S?o Paulo, - // ST=S?o Paulo, - // C=BR - // Issuer: CN=DigiCert Assured ID Code Signing CA-1, - // OU=www.digicert.com, - // O=DigiCert Inc, - // C=US - // Serial: 0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f - add("buster-assistencia-tecnica-electronica-ltda-3FD74D2F", - "-----BEGIN CERTIFICATE-----\n" + - "MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv\n" + - "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" + - "d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv\n" + - "ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow\n" + - "gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT\n" + - "w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF\n" + - "TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB\n" + - "IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA\n" + - "A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR\n" + - "4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V\n" + - "JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW\n" + - "kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb\n" + - "0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj\n" + - "NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV\n" + - "HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30\n" + - "o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD\n" + - "MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1\n" + - "cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t\n" + - "L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB\n" + - "hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z\n" + - "c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A\n" + - "eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA\n" + - "ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA\n" + - "IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA\n" + - "YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA\n" + - "cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA\n" + - "aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA\n" + - "ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC\n" + - "BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0\n" + - "LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp\n" + - "Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA\n" + - "MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ\n" + - "A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE\n" + - "Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA\n" + - "XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9\n" + - "UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL\n" + - "zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc\n" + - "-----END CERTIFICATE-----"); - - // - // Revoked code signing certificate w/ a stolen key issued by GoDaddy - // used to sign malware - // - - // Subject: CN=CLEARESULT CONSULTING INC., OU=Corporate IT, - // O=CLEARESULT CONSULTING INC., L=Austin, ST=TX, C=US - // Issuer: SERIALNUMBER=07969287, - // CN=Go Daddy Secure Certification Authority, - // OU=http://certificates.godaddy.com/repository, - // O="GoDaddy.com, Inc.", - // L=Scottsdale, - // ST=Arizona, - // C=US - // Serial: 2b:73:43:2a:a8:4f:44 - add("clearesult-consulting-inc-2AA84F44", - "-----BEGIN CERTIFICATE-----\n" + - "MIIFYjCCBEqgAwIBAgIHK3NDKqhPRDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE\n" + - "BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY\n" + - "BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm\n" + - "aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5\n" + - "IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky\n" + - "ODcwHhcNMTIwMjE1MjEwOTA2WhcNMTQwMjE1MjEwOTA2WjCBjDELMAkGA1UEBgwC\n" + - "VVMxCzAJBgNVBAgMAlRYMQ8wDQYDVQQHDAZBdXN0aW4xIzAhBgNVBAoMGkNMRUFS\n" + - "RVNVTFQgQ09OU1VMVElORyBJTkMuMRUwEwYDVQQLDAxDb3Jwb3JhdGUgSVQxIzAh\n" + - "BgNVBAMMGkNMRUFSRVNVTFQgQ09OU1VMVElORyBJTkMuMIIBIjANBgkqhkiG9w0B\n" + - "AQEFAAOCAQ8AMIIBCgKCAQEAtIOjCKeAicull+7ZIzt0/4ya3IeXUFlfypqKMLkU\n" + - "IbKjn0P5uMj6VE3rlbZr44RCegxvdnR6umBh1c0ZXoN3o+yc0JKcKcLiApmJJ277\n" + - "p7IbLwYDhBXRQNoIJm187IOMRPIxsKN4hL91txn9jGBmW+9zKlJlNhR5R7vjwU2E\n" + - "jrH/6oqsc9EM2yYpfjlNv6+3jSwAYZCkSWr+27PQOV+YHKmIxtJjX0upFz5FdIrV\n" + - "9CCX+L2Kji1THOkSgG4QTbYxmEcHqGViWz8hXLeNXjcbEsPuIiAu3hknxRHfUTE/\n" + - "U0Lh0Ug1e3LrJu+WnxM2SmUY4krsZ22c0yWUW9hzWITIjQIDAQABo4IBhzCCAYMw\n" + - "DwYDVR0TAQH/BAUwAwEBADATBgNVHSUEDDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8E\n" + - "BAMCB4AwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5LmNvbS9n\n" + - "ZHM1LTE2LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcCMDkwNwYIKwYBBQUH\n" + - "AgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8w\n" + - "gYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZ29kYWRk\n" + - "eS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdvZGFkZHku\n" + - "Y29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSMEGDAWgBT9\n" + - "rGEyk2xF1uLuhV+auud2mWjM5zAdBgNVHQ4EFgQUDtdeKqeN2QkcbEp1HovFieNB\n" + - "XiowDQYJKoZIhvcNAQEFBQADggEBAD74Agw5tvi2aBl4/f/s7/VE/BClzDsKMb9K\n" + - "v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC\n" + - "2i/EmfjLgmCfezNFtLq8xcPxF3zIRc44vPrK0z4YZsaHdH+yTEJ51p5EMdTqaLaP\n" + - "4n5m8LX3RfqlQB9dYFe6dUoYZjKm9d/pIRww3VqfOzjl42Edi1w6dWmBVMx1NZuR\n" + - "DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI\n" + - "LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=\n" + - "-----END CERTIFICATE-----"); - } + private UntrustedCertificates() {} } diff --git a/jdk/src/share/classes/sun/security/x509/X509CertImpl.java b/jdk/src/share/classes/sun/security/x509/X509CertImpl.java index bd59b62811a..b96674e2e1d 100644 --- a/jdk/src/share/classes/sun/security/x509/X509CertImpl.java +++ b/jdk/src/share/classes/sun/security/x509/X509CertImpl.java @@ -37,6 +37,7 @@ import java.security.*; import java.security.cert.*; import java.security.cert.Certificate; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import javax.security.auth.x500.X500Principal; @@ -1913,4 +1914,45 @@ public class X509CertImpl extends X509Certificate implements DerEncoder { } return false; } + + private ConcurrentHashMap fingerprints = + new ConcurrentHashMap<>(2); + + public String getFingerprint(String algorithm) { + return fingerprints.computeIfAbsent(algorithm, + x -> getCertificateFingerPrint(x)); + } + + /** + * Gets the requested finger print of the certificate. The result + * only contains 0-9 and A-F. No small case, no colon. + */ + private String getCertificateFingerPrint(String mdAlg) { + String fingerPrint = ""; + try { + byte[] encCertInfo = getEncoded(); + MessageDigest md = MessageDigest.getInstance(mdAlg); + byte[] digest = md.digest(encCertInfo); + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < digest.length; i++) { + byte2hex(digest[i], buf); + } + fingerPrint = buf.toString(); + } catch (NoSuchAlgorithmException | CertificateEncodingException e) { + // ignored + } + return fingerPrint; + } + + /** + * Converts a byte to hex digit and writes to the supplied buffer + */ + private static void byte2hex(byte b, StringBuffer buf) { + char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + int high = ((b & 0xf0) >> 4); + int low = (b & 0x0f); + buf.append(hexChars[high]); + buf.append(hexChars[low]); + } } diff --git a/jdk/src/share/lib/security/BlacklistedCertsConverter.java b/jdk/src/share/lib/security/BlacklistedCertsConverter.java new file mode 100644 index 00000000000..65a88f00a2e --- /dev/null +++ b/jdk/src/share/lib/security/BlacklistedCertsConverter.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.Certificate; +import java.security.cert.CertificateEncodingException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collection; + +/** + * This is the tool to convert blacklisted.certs.pem to blacklisted.certs. + * Every time a new blacklisted certs is added, please append the PEM format + * to the end of blacklisted.certs.pem (with proper comments) and then use + * this tool to generate an updated blacklisted.certs. Make sure to include + * changes to both in a changeset. + */ +public class BlacklistedCertsConverter { + public static void main(String[] args) throws Exception { + if (args.length == 0) { + System.out.println("Usage: java BlacklistedCertsConverter SHA-256" + + " < blacklisted.certs.pem > blacklisted.certs"); + System.exit(1); + } + String mdAlg = args[0]; + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + Collection certs + = cf.generateCertificates(System.in); + System.out.println("Algorithm=" + mdAlg); + for (Certificate cert: certs) { + System.out.println( + getCertificateFingerPrint(mdAlg, (X509Certificate)cert)); + } + } + + /** + * Converts a byte to hex digit and writes to the supplied buffer + */ + private static void byte2hex(byte b, StringBuffer buf) { + char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + int high = ((b & 0xf0) >> 4); + int low = (b & 0x0f); + buf.append(hexChars[high]); + buf.append(hexChars[low]); + } + + /** + * Gets the requested finger print of the certificate. + */ + private static String getCertificateFingerPrint(String mdAlg, + X509Certificate cert) { + String fingerPrint = ""; + try { + byte[] encCertInfo = cert.getEncoded(); + MessageDigest md = MessageDigest.getInstance(mdAlg); + byte[] digest = md.digest(encCertInfo); + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < digest.length; i++) { + byte2hex(digest[i], buf); + } + fingerPrint = buf.toString(); + } catch (NoSuchAlgorithmException | CertificateEncodingException e) { + // ignored + } + return fingerPrint; + } +} diff --git a/jdk/src/share/lib/security/blacklisted.certs b/jdk/src/share/lib/security/blacklisted.certs new file mode 100644 index 00000000000..cb1e4d59e38 --- /dev/null +++ b/jdk/src/share/lib/security/blacklisted.certs @@ -0,0 +1,19 @@ +Algorithm=SHA-256 +76A45A496031E4DD2D7ED23E8F6FF97DBDEA980BAAC8B0BA94D7EDB551348645 +4CBBF8256BC9888A8007B2F386940A2E394378B0D903CBB3863C5A6394B889CE +D24566BF315F4E597D6E381C87119FB4198F5E9E2607F5F4AB362EF7E2E7672F +14E6D2764A4B06701C6CBC376A253775F79C782FBCB6C0EE6F99DE4BA1024ADD +D3A936E1A7775A45217C8296A1F22AC5631DCDEC45594099E78EEEBBEDCBA967 +5E83124D68D24E8E177E306DF643D5EA99C5A94D6FC34B072F7544A1CABB7C7B +9ED8F9B0E8E42A1656B8E1DD18F42BA42DC06FE52686173BA2FC70E756F207DC +FDEDB5BDFCB67411513A61AEE5CB5B5D7C52AF06028EFC996CC1B05B1D6CEA2B +A686FEE577C88AB664D0787ECDFFF035F4806F3DE418DC9E4D516324FFF02083 +4FEE0163686ECBD65DB968E7494F55D84B25486D438E9DE558D629D28CD4D176 +8A1BD21661C60015065212CC98B1ABB50DFD14C872A208E66BAE890F25C448AF +B8686723E415534BC0DBD16326F9486F85B0B0799BF6639334E61DAAE67F36CD +3946901F46B0071E90D78279E82FABABCA177231A704BE72C5B0E8918566EA66 +31C8FD37DB9B56E708B03D1F01848B068C6DA66F36FB5D82C008C6040FA3E133 +450F1B421BB05C8609854884559C323319619E8B06B001EA2DCBB74A23AA3BE2 +FC02FD48DB92D4DCE6F11679D38354CF750CFC7F584A520EB90BDE80E241F2BD +DF21016B00FC54F9FE3BC8B039911BB216E9162FAD2FD14D990AB96E951B49BE +F5B6F88F75D391A4B1EB336F9E201239FB6B1377DB8CFA7B84736216E5AFFFD7 diff --git a/jdk/src/share/lib/security/blacklisted.certs.pem b/jdk/src/share/lib/security/blacklisted.certs.pem new file mode 100644 index 00000000000..f44a6985352 --- /dev/null +++ b/jdk/src/share/lib/security/blacklisted.certs.pem @@ -0,0 +1,721 @@ +// Subject: CN=Digisign Server ID (Enrich), +// OU=457608-K, +// O=Digicert Sdn. Bhd., +// C=MY +// Issuer: CN=GTE CyberTrust Global Root, +// OU=GTE CyberTrust Solutions, Inc., +// O=GTE Corporation, +// C=US +// Serial: 120001705 (07:27:14:a9) +-----BEGIN CERTIFICATE----- +MIIDyzCCAzSgAwIBAgIEBycUqTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MB4XDTA3MDcxNzE1MTc0OFoXDTEyMDcxNzE1MTY1NFowYzELMAkG +A1UEBhMCTVkxGzAZBgNVBAoTEkRpZ2ljZXJ0IFNkbi4gQmhkLjERMA8GA1UECxMI +NDU3NjA4LUsxJDAiBgNVBAMTG0RpZ2lzaWduIFNlcnZlciBJRCAoRW5yaWNoKTCB +nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArahkS02Hx4RZufuQRqCmicDx/tXa +VII3DZkrRSYK6Fawf8qo9I5HhAGCKeOzarWR8/uVhbxyqGToCkCcxfRxrnt7agfq +kBRPjYmvlKuyBtQCanuYH1m5Os1U+iDfsioK6bjdaZDAKdNO0JftZszFGUkGf/pe +LHx7hRsyQt97lSUCAwEAAaOCAXgwggF0MBIGA1UdEwEB/wQIMAYBAf8CAQAwXAYD +VR0gBFUwUzBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcCARYtaHR0cDovL2N5YmVy +dHJ1c3Qub21uaXJvb3QuY29tL3JlcG9zaXRvcnkuY2ZtMAcGBWCDSgEBMA4GA1Ud +DwEB/wQEAwIB5jCBiQYDVR0jBIGBMH+heaR3MHUxCzAJBgNVBAYTAlVTMRgwFgYD +VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv +bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv +b3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93d3cucHVibGljLXRydXN0 +LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYDVR0OBBYEFMYWk04WF+wW +royUdvOGbcV0boR3MA0GCSqGSIb3DQEBBQUAA4GBAHYAe6Z4K2Ydjl42xqSOBfIj +knyTZ9P0wAp9iy3Z6tVvGvPhSilaIoRNUC9LDPL/hcJ7VdREgr5trGeOvLQfkpxR +gBoU9m6rYYgLrRx/90tQUdZlG6ZHcRVesHHzNRTyN71jyNXwk1o0X9g96F33xR7A +5c8fhiSpPAdmzcHSNmNZ +-----END CERTIFICATE----- + +// Subject: CN=Digisign Server ID - (Enrich), +// OU=457608-K, +// O=Digicert Sdn. Bhd., +// C=MY +// Issuer: CN=Entrust.net Certification Authority (2048) +// OU=(c) 1999 Entrust.net Limited, +// OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), +// O=Entrust.net +// Serial: 1184644297 (4c:0e:63:6a) +-----BEGIN CERTIFICATE----- +MIIEzjCCA7agAwIBAgIETA5jajANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw0xMDA3MTYxNzIzMzdaFw0xNTA3 +MTYxNzUzMzdaMGUxCzAJBgNVBAYTAk1ZMRswGQYDVQQKExJEaWdpY2VydCBTZG4u +IEJoZC4xETAPBgNVBAsTCDQ1NzYwOC1LMSYwJAYDVQQDEx1EaWdpc2lnbiBTZXJ2 +ZXIgSUQgLSAoRW5yaWNoKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AMWJ5PQNBkCSWccaszXRDkwqM/n4r8qef+65p21g9FTob9Wb8xtjMQRoctE0Foy0 +FyyX3nPF2JAVoBor9cuzSIZE8B2ITM5BQhrv9Qze/kDaOSD3BlU6ap1GwdJvpbLI +Vz4po5zg6YV3ZuiYpyR+vsBZIOVEb7ZX2L7OwmV3WMZhQdF0BMh/SULFcqlyFu6M +3RJdtErU0a9Qt9iqdXZorT5dqjBtYairEFs+E78z4K9EnTgiW+9ML6ZxJhUmyiiM +2fqOjqmiFDXimySItPR/hZ2DTwehthSQNsQ0HI0mYW0Tb3i+6I8nx0uElqOGaAwj +vgvsjJQAqQSKE5D334VsDLECAwEAAaOCATQwggEwMA4GA1UdDwEB/wQEAwIBBjAS +BgNVHRMBAf8ECDAGAQH/AgEAMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggrBgEFBQcD +AgYIKwYBBQUHAwQwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8v +b2NzcC5lbnRydXN0Lm5ldDBEBgNVHSAEPTA7MDkGBWCDSgEBMDAwLgYIKwYBBQUH +AgEWImh0dHA6Ly93d3cuZGlnaWNlcnQuY29tLm15L2Nwcy5odG0wMgYDVR0fBCsw +KTAnoCWgI4YhaHR0cDovL2NybC5lbnRydXN0Lm5ldC8yMDQ4Y2EuY3JsMBEGA1Ud +DgQKBAhMTswlKAMpgTAfBgNVHSMEGDAWgBRV5IHREYC+2Im5CKMx+aEkCRa5cDAN +BgkqhkiG9w0BAQUFAAOCAQEAl0zvSjpJrHL8MCBrtClbp8WVBJD5MtXChWreA6E3 ++YkAsFqsVX7bQzX/yQH4Ub7MJsrIaqTEVD4mHucMo82XZ5TdpkLrXM2POXlrM3kh +Bnn6gkQVmczBtznTRmJ8snDrb84gqj4Zt+l0gpy0pUtNYQA35IfS8hQ6ZHy4qXth +4JMi59WfPkfmNnagU9gAAzoPtTP+lsrT0oI6Lt3XSOHkp2nMHOmZSufKcEXXCwcO +mnUb0C+Sb/akB8O9HEumhLZ9qJqp0qcp8QtXaR6XVybsK0Os1EWDBQDp4/BGQAf6 +6rFRc5Mcpd1TETfIKqcVJx20qsx/qjEw/LhFn0gJ7RDixQ== +-----END CERTIFICATE----- + +// Subject: CN=Java Media APIs, +// OU=Java Signed Extensions, +// OU=Corporate Object Signing, +// O=Sun Microsystems Inc +// Issuer: CN=Object Signing CA, +// OU=Class 2 OnSite Subscriber CA, +// OU=VeriSign Trust Network, +// O=Sun Microsystems Inc +// Serial: 6a:8b:99:91:37:59:4f:89:53:e2:97:18:9f:19:1e:4e +-----BEGIN CERTIFICATE----- +MIIFdzCCBF+gAwIBAgIQaouZkTdZT4lT4pcYnxkeTjANBgkqhkiG9w0BAQUFADCB +gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj +cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDUxMjAw +MDAwMFoXDTEyMDUxMTIzNTk1OVowfTEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt +cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE +CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEYMBYGA1UEAxQPSmF2YSBNZWRpYSBB +UElzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5blzoKTVE8y4Hpz +q6E15RZz1bF5HnYEyYqgHkZXnAKedmYCoMzm1XK8s+gQWShLEvGEAvs5yqarx9gE +nnC21N28aEZgIJMa2/arKxCUkS4pxdGPYGexL9UzSRkUpoBShCZKEGdmX7gfJE2K +/sd9MFvGV5/yZtWXrADzvm0Kd/9mg1KRv1gfrZIq0TJbupoXPYYqb73AkI9eT2ZD +q9MdwD4E5+oojsDFXt8GU/D00fUhtXpYwuplU7D667WHYdJhIah0ST6JywyqcLXG +XSuFTXOgITT2idSHluZVmx3dqJ72u9kPkO4JdJTMDfaK8zgNLaRkiU8Qcj+qhLYH +ytaqcwIDAQABo4IB6jCCAeYwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCB4AwfwYD +VR0fBHgwdjB0oHKgcIZuaHR0cDovL29uc2l0ZWNybC52ZXJpc2lnbi5jb20vU3Vu +TWljcm9zeXN0ZW1zSW5jQ29ycG9yYXRlT2JqZWN0U2lnbmluZ0phdmFTaWduZWRF +eHRlbnNpb25zQ2xhc3NCL0xhdGVzdENSTC5jcmwwHwYDVR0jBBgwFoAUs0crgn5T +tHPKuLsZt76BTQeVx+0wHQYDVR0OBBYEFKS32mVx0gNWTeS4ProHEaeSpvvIMDsG +CCsGAQUFBwEBBC8wLTArBggrBgEFBQcwAYYfaHR0cDovL29uc2l0ZS1vY3NwLnZl +cmlzaWduLmNvbTCBtQYDVR0gBIGtMIGqMDkGC2CGSAGG+EUBBxcCMCowKAYIKwYB +BQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwbQYLYIZIAYb3AIN9 +nD8wXjAnBggrBgEFBQcCARYbaHR0cHM6Ly93d3cuc3VuLmNvbS9wa2kvY3BzMDMG +CCsGAQUFBwICMCcaJVZhbGlkYXRlZCBGb3IgU3VuIEJ1c2luZXNzIE9wZXJhdGlv +bnMwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcNAQEFBQADggEBAAe6BO4W +3TSNWfezyelJs6kE3HfulT6Bdyz4UUoh9ykXcV8nRwT+kh25I5MdyG2GfkJoADPR +VhC5DYo13UFpIsTNVjq+hGYe2hML93bN7ad9SxCCyjHUo3yMz2qgBbHZI3VA9ZHA +aWM4Tx0saMwbcnVvlbuGh+PXvStfypJqYT6lzcdFfjNVX4FI/QQNGhBswMY51tC8 +GTBCL2qhJon0gSCU4zaawDOf7+XxJWirLamYL1Aal1/h2z2sFrvA/1ftxtU3kZ6I +7De8DyoHeZg7pYGdrj7g+lPhCga/WvEhN152I+aP08YbFcJHYmK05ngl/Ye4c6Bd +cdrdfbw6QzEUIYY= +-----END CERTIFICATE----- + +// Subject: CN=JavaFX 1.0 Runtime, +// OU=Java Signed Extensions, +// OU=Corporate Object Signing, +// O=Sun Microsystems Inc +// Issuer: CN=Object Signing CA, +// OU=Class 2 OnSite Subscriber CA, +// OU=VeriSign Trust Network, +// O=Sun Microsystems Inc +// Serial: 55:c0:e6:44:59:59:79:9e:d9:26:f1:b0:4a:1e:f0:27 +-----BEGIN CERTIFICATE----- +MIIFezCCBGOgAwIBAgIQVcDmRFlZeZ7ZJvGwSh7wJzANBgkqhkiG9w0BAQUFADCB +gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj +cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA4MTAwOTAw +MDAwMFoXDTExMTAwOTIzNTk1OVowgYAxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl +bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxHzAdBgNV +BAsUFkphdmEgU2lnbmVkIEV4dGVuc2lvbnMxGzAZBgNVBAMUEkphdmFGWCAxLjAg +UnVudGltZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM+WDc6+bu+4 +tmAcS/lBtUc02WOt9QZpVsXg9cG2pu/8bUtmDELa8iiYBVFpIs8DU58HLrGQtCUY +SIAGOVPsOJoN29UKCDWfY9j5JeVhfhMGqk9DwrWhzgsjy4cpZ1pIp+k/fJ8zT8Ul +aYLpow1vg3UNddsmwz02tN7cOrMw9WYIG4CRYnY1OrtJSfe2pYzheC4zyvR+aiVl +nang2OtqikSQsNFOFHsLOJFxngy9LrO8evDSu25VTKI6zlWU6/bMeqtztJPN0VOn +NyUrJZvkxZ207Jg0T693BGSxNC1n+ihztXogql8950M/pEuUbDjylv5FFvlp6DSB +dDT2MkutmyMCAwEAAaOCAeowggHmMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeA +MH8GA1UdHwR4MHYwdKByoHCGbmh0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29t +L1N1bk1pY3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdKYXZhU2ln +bmVkRXh0ZW5zaW9uc0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaAFLNH +K4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBTjgufVi3XJ3gx1ewsA6Rr7BR4Z +zjA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUtb2Nz +cC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAqMCgG +CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CGSAGG +9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtpL2Nw +czAzBggrBgEFBQcCAjAnGiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBPcGVy +YXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IBAQAB +YVJTTVe7rzyTO4jc3zajErOT/COkdQTfNo0eIX1QbNynFieJvwY/jRzUZwjktIFR +2p4JtbpHGAtKtjOAOTieQ8xdDOoC1djzpE7/AbMvuvlTavtUKT+F7tPdhfXgWXJV +6Wbt8jryKyk3zZGiEhauIwZUkfjRkEtffEmZWLUd8c8rURJjfC/XHH2oyurscoxc +CjX29c9ynxSiS/VvQp1an0HvErGh69N48wj7cj8mtZ1yHzd2XCzSSR1OfTPfk0Pt +yg51p7yJaFiH21PTZegEL6zyVNOYBTKwwIi2OzpwYalD3uvK6e3OKDrfFCOxu17u +4PveESbrdyrmvLe7IVez +-----END CERTIFICATE----- + +// Subject: CN=JavaFX Runtime, +// OU=Java Signed Extensions, +// OU=Corporate Object Signing, +// O=Sun Microsystems Inc +// Issuer: CN=Object Signing CA, +// OU=Class 2 OnSite Subscriber CA, +// OU=VeriSign Trust Network, +// O=Sun Microsystems Inc +// Serial: 47:f4:55:f1:da:4a:5e:f9:e3:f7:a8:03:62:17:c0:ff +-----BEGIN CERTIFICATE----- +MIIFdjCCBF6gAwIBAgIQR/RV8dpKXvnj96gDYhfA/zANBgkqhkiG9w0BAQUFADCB +gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj +cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDEyOTAw +MDAwMFoXDTEyMDEyOTIzNTk1OVowfDEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt +cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE +CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEXMBUGA1UEAxQOSmF2YUZYIFJ1bnRp +bWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCIzd0fAk8mI9ONc6RJ +aGieioK2FLdXEwj8zL3vdGDVmBwyR1zwYkaOIFFgF9IW/8qc4iAYA5sGUY+0g8q3 +5DuYAxfTzBB5KdaYvbuq6GGnoHIWmTirXY+1friFp8lyXSvtuEaGB1VHaBoZchEg +k+UgeVDA43dHwcT1Ov3DePczJRUes8T/QHzLX+BxUDG43vjyncCEO/AjqLZxXEz2 +xrNbKLcH3lGMJK7hdbfssUfF5BjC38Hn71HauYlA43b2no+2y0Sjulwzez2YPbDC +0GLR3TnKtA8dqOrnl5t3DniDbfOBNtBE3VOydJO0XW57Ng1HRXD023nm9ECPY2xp +0N/pAgMBAAGjggHqMIIB5jAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDB/BgNV +HR8EeDB2MHSgcqBwhm5odHRwOi8vb25zaXRlY3JsLnZlcmlzaWduLmNvbS9TdW5N +aWNyb3N5c3RlbXNJbmNDb3Jwb3JhdGVPYmplY3RTaWduaW5nSmF2YVNpZ25lZEV4 +dGVuc2lvbnNDbGFzc0IvTGF0ZXN0Q1JMLmNybDAfBgNVHSMEGDAWgBSzRyuCflO0 +c8q4uxm3voFNB5XH7TAdBgNVHQ4EFgQUvOdd0cKPj+Yik/iOBwTdphh5A+gwOwYI +KwYBBQUHAQEELzAtMCsGCCsGAQUFBzABhh9odHRwOi8vb25zaXRlLW9jc3AudmVy +aXNpZ24uY29tMIG1BgNVHSAEga0wgaowOQYLYIZIAYb4RQEHFwIwKjAoBggrBgEF +BQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYTBtBgtghkgBhvcAg32c +PzBeMCcGCCsGAQUFBwIBFhtodHRwczovL3d3dy5zdW4uY29tL3BraS9jcHMwMwYI +KwYBBQUHAgIwJxolVmFsaWRhdGVkIEZvciBTdW4gQnVzaW5lc3MgT3BlcmF0aW9u +czATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQUFAAOCAQEAbGcf2NjL +AI93HG6ny2BbepaZA1a8xa/R6uUc7xV+Qw6MgLwFD4Q4i6LWUztQDvg9l68MM2/i +Y9LEi1KM4lcNbK5+D+t9x98wXBiuojXhVdp5ZmC03EyEBbriopdBsmXVLDSu/Y3+ +zowOO5xwpMK3dbgsSDs2Vt0UosD3FTcRaD3GNfOhXMp+o1grHNiXF9YgkmdQbPPZ +DQ2KBhFPCRJXBGvyKOqno/DTg0sQ3crGH/C4/4t7mnQXWldZotmJUZ0ONc9oD+Q1 +JAaguUKqIwn9yZ093ie+JWHbYNid9IIIPXYgtRxmf9a376WBhqhu56uJftBJ7x9g +eQ7Lot6CSWCiFw== +-----END CERTIFICATE----- + +// Subject: CN=Solaris INTERNAL DEVELOPMENT USE ONLY, +// OU=Solaris Cryptographic Framework, +// OU=Corporate Object Signing, +// O=Sun Microsystems Inc +// Issuer: CN=Object Signing CA, +// OU=Class 2 OnSite Subscriber CA, +// OU=VeriSign Trust Network, +// O=Sun Microsystems Inc +// Serial: 77:29:77:52:6a:19:7b:9a:a6:a2:c7:99:a0:e1:cd:8c +-----BEGIN CERTIFICATE----- +MIIFHjCCBAagAwIBAgIQdyl3UmoZe5qmoseZoOHNjDANBgkqhkiG9w0BAQUFADCB +gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj +cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA3MDEwNDAw +MDAwMFoXDTEwMDEwMzIzNTk1OVowgZwxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl +bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxKDAmBgNV +BAsUH1NvbGFyaXMgQ3J5cHRvZ3JhcGhpYyBGcmFtZXdvcmsxLjAsBgNVBAMUJVNv +bGFyaXMgSU5URVJOQUwgREVWRUxPUE1FTlQgVVNFIE9OTFkwgZ8wDQYJKoZIhvcN +AQEBBQADgY0AMIGJAoGBALbNU4hf3mD5ArDI9pjgioAyvV3bjMPRQdCZniIeGJBp +odFlSEH+Mh64W1DsY8coeZ7FvvGJkx9IpTMJW9k8w1oJK9UNqHyAQfaYjQyXi3xQ +LJp62EvYdGfDlwOZejEcR/MbzZG+GOPMMvQj5+xyFDvLXNGfQNTnxw2qnBgCJXjj +AgMBAAGjggH1MIIB8TAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDCBiQYDVR0f +BIGBMH8wfaB7oHmGd2h0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29tL1N1bk1p +Y3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdTb2xhcmlzQ3J5cHRv +Z3JhcGhpY0ZyYW1ld29ya0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaA +FLNHK4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBRpfiGYkehTnsIzuN2H6AFb +VCZG8jA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUt +b2NzcC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAq +MCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CG +SAGG9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtp +L2NwczAzBggrBgEFBQcCAjAnFiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBP +cGVyYXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IB +AQCG5soy3LFHTFbA8/5SzDRhQoJkHUnOP0t3b6nvX6vZYRp649fje7TQOPRm1pFd +CZ17J+tggdZwgzTqY4aYpJ00jZaK6pV37q/vgFC/ia6jDs8Q+ly9cEcadBZ5loYg +cmxp9p57W2MNWx8VA8oFdNtKfF0jUNXbLNtvwGHmgR6YcwLrGN1b6/9Lt9bO3ODl +FO+ZDwkfQz5ClUVrTx2dGBvKRYFqSG5S8JAfsgYhPvcacUQkA7ExyKvfRXLWVrce +ZiPpcElbx+819H2sAPvVvparVeAruZGMAtejHZp9NFoowKen5drJp9VxePS4eM49 +3DepB6lKRrNRw66LNQol4ZBz +-----END CERTIFICATE----- + +// Subject: EMAILADDRESS=info@diginotar.nl, CN=DigiNotar Cyber CA, +// O=DigiNotar, C=NL +// Issuer: CN=GTE CyberTrust Global Root, +// OU=GTE CyberTrust Solutions, Inc., +// O=GTE Corporation, +// C=US +// Serial: 120000525 (07:27:10:0D) +-----BEGIN CERTIFICATE----- +MIIFWjCCBMOgAwIBAgIEBycQDTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MB4XDTA2MTAwNDEwNTQxMVoXDTExMTAwNDEwNTMxMVowYDELMAkG +A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy +IEN5YmVyIENBMSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANLOFQotqF6EZ639vu9Gx8i5z3P8 +9DS5+SxD52ATPXrjss87Z2yQrcC5P4RS8DVC3HTcKDu9UrSnrHJFF8bwieu0qiXy +XUte0dmHutZ9fPXOMp8QM8WxSrtekTHC0OlBwpFkfglBO9uLCDdqqspS3rU5HsCI +A6U/i5kTYUO1m4Kz7iBvz6FEouova0CfjytXraFTwoUiaZ2gP1HfC0GRDaXhqKpc +SQhdvd5wQbEPyWNr0380dAIvNFp4dRxoeoFnivPaQPBgY/SSINcDpj2jHmfEhBtB +pcmM5r3qSLYFFgizNxJa92E89zhvLpfgb1Y4VNMota0Ubi5LZLUnZbd1JQm2Bz2V +VgIKgmCyc0XgMyZRdJq51FAc9k1bW1JSE1qmf6cO4ehBVGeYjIfVydNsy9NUkgYJ +NEH3gW8/nsl8dVWw58Gzd+jDxAA1lUBwEEoF3iW7n1mlZLxHYL9g43aLE1Xd4XR6 +uc8kpmp/3mQiRFhogmoQ+T3lPhu5vfwi9GAEibtVbShV+t6OjRshFNc3izR7Tfay +shDPM7F9HGKZSMsrbHaWVb8ZDR0fu2WqG46ZtcYokOWCLXhQIJr9eS8kf/CJKWn0 +fc1zvrPtTsHR7VJej/e4142HrbLZG1ES/1az4a80fVykeIgQnp0DxqWqoiRR90kU +xbHuWUOV36toKDA/AgMBAAGjggGGMIIBgjASBgNVHRMBAf8ECDAGAQH/AgEBMFMG +A1UdIARMMEowSAYJKwYBBAGxPgEAMDswOQYIKwYBBQUHAgEWLWh0dHA6Ly93d3cu +cHVibGljLXRydXN0LmNvbS9DUFMvT21uaVJvb3QuaHRtbDAOBgNVHQ8BAf8EBAMC +AQYwgaAGA1UdIwSBmDCBlYAUpgwdn2H/Bxe1vzhG20Mw1Y6wUgaheaR3MHUxCzAJ +BgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdU +RSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVy +VHJ1c3QgR2xvYmFsIFJvb3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93 +d3cucHVibGljLXRydXN0LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYD +VR0OBBYEFKv5aN/PSjfXe0WMX3LeQETDZbvCMA0GCSqGSIb3DQEBBQUAA4GBAI9o +a6VbB7pEZg4cqFwwezPkCiYE/O+eGjjWLqEf0JlHwnVkJP2eOyh2uSYoYZEMbSz4 +BJ98UAHV42mv7xXSRZskCSpmBU8lgcpdvqrBWSeuM46C9990sFWzjvjnN8huqlZE +9r1TgSOWPbT6MopTZkQloiXGpjwljPDgKAYityZB +-----END CERTIFICATE----- + +// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL +// Issuer: CN=GTE CyberTrust Global Root, +// OU=GTE CyberTrust Solutions, Inc., +// O=GTE Corporation, +// C=US +// Serial: 120000505 (07:27:0F:F9) +-----BEGIN CERTIFICATE----- +MIIFODCCBKGgAwIBAgIEBycP+TANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MB4XDTA2MDkyMDA5NDUzMloXDTEzMDkyMDA5NDQwNlowPjELMAkG +A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy +IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o +XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S +tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7 +24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp +naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj +9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu +LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU +Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk +vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6 +3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt +eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4 +iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB +/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC +ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s +MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV +jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv +bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD +VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6 +oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw +MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI +hvcNAQEFBQADgYEACcpiD427SuDUejUrBi3RKGG2rAH7g0m8rtQvLYauGYOl1h0T +4he+/jJ06XoUOMqUXvcpAWlxG5Ea/aO7qh3Ke+IW/aGjDvMMX7LhIDGUK16Sdu36 +6bUjpr8KOwOpb1JgVM1f6bcvfKIn/UGDdbYN+3gm87FF6TKVKho1IZXFonU= +-----END CERTIFICATE----- + +// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL +// Issuer: CN=GTE CyberTrust Global Root, +// OU=GTE CyberTrust Solutions, Inc., +// O=GTE Corporation, +// C=US +// Serial: 120000515 (07:27:10:03) +-----BEGIN CERTIFICATE----- +MIIFODCCBKGgAwIBAgIEBycQAzANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MB4XDTA2MDkyNzEwNTMzMloXDTExMDkyNzEwNTIzMFowPjELMAkG +A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy +IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o +XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S +tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7 +24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp +naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj +9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu +LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU +Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk +vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6 +3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt +eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4 +iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB +/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC +ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s +MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV +jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv +bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD +VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6 +oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw +MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI +hvcNAQEFBQADgYEAWcyGZhizJlRP1jjNupZey+yZG6oMDW4Z11boriMHbYPCndBE +bVh07zmPbZsihOw9w/vm5KbVX5CgxUv4Rhzh/20Faixf3P3bpWg0qgzHVVusNVR/ +P50aKkpdK3hp+QLl56e+lWOddSAINIpmcuyDI1hyuzB+GJEASm9tNU/6rs8= +-----END CERTIFICATE----- + +// Subject: EMAILADDRESS=info@diginotar.nl, +// CN=DigiNotar Root CA, +// O=DigiNotar, C=NL +// Issuer: CN=Entrust.net Secure Server Certification Authority +// OU=(c) 1999 Entrust.net Limited, +// OU=www.entrust.net/CPS incorp. by ref. (limits liab.), +// O=Entrust.net, +// C=US, +// Serial: 1184644297 (46:9C:3C:C9) +-----BEGIN CERTIFICATE----- +MIIFSDCCBLGgAwIBAgIERpw8yTANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA0 +MjYwNTAwMDBaFw0xMzA4MTQyMDEyMzZaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK +EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI +hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt +OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx +hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7 +gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D +IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T +BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs +Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8 +5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf +DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX +9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e +7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj +ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB +BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF +BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD +VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy +bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G +A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob +BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAI979rBep8tu3TeLunapgsZ0jtXp +GDFjKWSk87dj1jCyYi+q/GyDyZ6ZQZNRP0sF+6twscq05lClWNy3TROMp7QeuoLO +G7Utw3OJaswUtp4YglANMRTHEe3g9ltifUXRH5tSuy7u6yi4LD4WTm5ULP6r/g6l +0CnjXYb0+b1Fmz6U +-----END CERTIFICATE----- + +// Subject: EMAILADDRESS=info@diginotar.nl, +// CN=DigiNotar Root CA, +// O=DigiNotar, C=NL +// Issuer: CN=Entrust.net Secure Server Certification Authority +// OU=(c) 1999 Entrust.net Limited, +// OU=www.entrust.net/CPS incorp. by ref. (limits liab.), +// O=Entrust.net, +// C=US, +// Serial: 1184640175 (46:9C:2C:AF) +-----BEGIN CERTIFICATE----- +MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3 +MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK +EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI +hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt +OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx +hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7 +gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D +IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T +BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs +Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8 +5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf +DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX +9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e +7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj +ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB +BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF +BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD +VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy +bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G +A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob +BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh +xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd +ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP +ZFdYf+hthc3m6IcJ +-----END CERTIFICATE----- + +// Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2, +// O=DigiNotar B.V., +// C=NL +// Issuer: CN=Staat der Nederlanden Organisatie CA - G2, +// O=Staat der Nederlanden, +// C=NL +// Serial: 20001983 (01:31:34:bf) +-----BEGIN CERTIFICATE----- +MIIGnDCCBISgAwIBAgIEATE0vzANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJO +TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTIwMAYDVQQDDClTdGFh +dCBkZXIgTmVkZXJsYW5kZW4gT3JnYW5pc2F0aWUgQ0EgLSBHMjAeFw0xMDA1MTIw +ODUxMzhaFw0yMDAzMjMwOTUwMDRaMFoxCzAJBgNVBAYTAk5MMRcwFQYDVQQKDA5E +aWdpTm90YXIgQi5WLjEyMDAGA1UEAwwpRGlnaU5vdGFyIFBLSW92ZXJoZWlkIENB +IE9yZ2FuaXNhdGllIC0gRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQCxExkPJ+Zs1FWGS9DsiYpFkXisR71HK+T8RetPtCZzWzfTw3/2497Xo/gtaMUI +PkuU1uSHJTZrhLUYdPMoWHMvm2rPvAQe9t7dr/xLqvXbZmIlASWC3vKXWhBu3V2p +IrEEqSNzOvhxrR3PhETrR9Gvbch8KKvH8jd6dF9fxQIUiqNa4xtsAeNdjtlo1vQJ +GzLckbUs9SDrjANtJkm4k8SFXdjSm69WaswFM8ygQp40VUSca6DUEtArVM23iQ3l +9uvo+4UBM096a/GdcjOWDveyhKWlJ8Qn8VFzKXe6Z27+TNy04qGhgS85SY1DOBPO +0KVcwoc6AGdlQiPxNlkKHaNRyLyjlCox3+M88p0aPASw77EKMBNzttfzo0wBdRSF +eMDXijlYhVD6LubFvs+LP6+PNtQlCS3SD6xyk/K/i9RQs/kVUJuZ9RTZ+4uRozIm +JqD43ztggYaDeVsr6xM9KTrBbd29no6H1kquNJcF7hSm9tw4fkrpJFQHPZdoN0Zr +DceoIa8TVOQJavFNRgrJXfubT73e+7dUy7g4nKc5+2otwHuNq6WnV+xKkoozxeEg +XHPYkJIrgNUPhhhpfDlPhIa890xb89W0yqDC8DciynlSH1PmqvOQsDvd8ij9rOvF +BiSgydQvD1j9tZ7sD8+yWdCiBHo4aq5y+73wJWKUCacFCwIDAQABo4IBYTCCAV0w +SAYDVR0gBEEwPzA9BgRVHSAAMDUwMwYIKwYBBQUHAgEWJ2h0dHA6Ly93d3cuZGln +aW5vdGFyLm5sL2Nwcy9wa2lvdmVyaGVpZDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud +DwEB/wQEAwIBBjCBhQYDVR0jBH4wfIAUORCLSZJc22ESIM1JnRqO2pxnQLmhXqRc +MFoxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4x +KzApBgNVBAMMIlN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENBIC0gRzKCBACY +lvQwSQYDVR0fBEIwQDA+oDygOoY4aHR0cDovL2NybC5wa2lvdmVyaGVpZC5ubC9E +b21PcmdhbmlzYXRpZUxhdGVzdENSTC1HMi5jcmwwHQYDVR0OBBYEFLxdlDvZq3sD +JXNhwtst7vyrj2WhMA0GCSqGSIb3DQEBCwUAA4ICAQCP/C1Mt9kt1R+978v0t2gX +dZ1O1ffdnPEqJu2forYcA9VTs+wIzzTi48P0tRYvyMO+19NzqwA2+RpKftZj6V5G +uqW2jhW3oyrYQx3vXcgfgYWzi/f/PPTZ9EYIP5y8HaDZqEzNJVJOCrEg9x/pQ9lU +RoETmsBedGwqmDLq/He7DaWiMZgifnx859qkrey3LhoZcfhIUNpDjyyE3cFAJ+O1 +8BVOltT4XOOGKUYr1zsH6zh/yIZXl9PvKjPEF1DVZGlrK2tFXl0vF8paTs/D1zk8 +9TufRrmb5w5Jl53W1eMbD+qPAU6aE5RZCgIHSEsaYKt/T+0L2FUNaG9VnGllFULs +wNzdbKzDFs4LHVabpMTE0i7gD+JEJytQaaTcYuiKISlCbMwAOpZ2m+9AwKRed4Qy +bCYqOWauXeO5ubIsaB8empADOfCqs6TMSYsYNOk3yXspx4R8b0QVL+xhWQTJRcui +1lKifH8pktZKxYtCqNT+6tjHhyMY5J16fXNAUpigrm7jBT8FD+Clxm1N7YM3iJzH +89xCmmq21yFJNnfy7xhPxXDZnunetyuL9Lx+KN8NQMmFXK6dxTH/0FwOtah+8Okv +uq+IruW10Vilr5xxpykBkINpN4IFuvwJwQhujHg7wzMCgD9EhQgd31VWCK0shS1d +sQPhrqp0xaTzTro3mHuCuQ== +-----END CERTIFICATE----- + +// Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven, +// O=DigiNotar B.V., +// C=NL +// Issuer: CN=Staat der Nederlanden Overheid CA +// O=Staat der Nederlanden, +// C=NL +// Serial: 20015536 (01:31:69:b0) +-----BEGIN CERTIFICATE----- +MIIEiDCCA3CgAwIBAgIEATFpsDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO +TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh +dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDcwNzA1MDg0MjA3WhcN +MTUwNzI3MDgzOTQ2WjBfMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy +IEIuVi4xNzA1BgNVBAMTLkRpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp +ZCBlbiBCZWRyaWp2ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc +vdKnTmoKuzuiheF/AK2+tDBomAfNoHrElM9x+Yo35FPrV3bMi+Zs/u6HVcg+uwQ5 +AKeAeKxbT370vbhUuHE7BzFJOZNUfCA7eSuPu2GQfbGs5h+QLp1FAalkLU3DL7nn +UNVOKlyrdnY3Rtd57EKZ96LspIlw3Dgrh6aqJOadkiQbvvb91C8ZF3rmMgeUVAVT +Q+lsvK9Hy7zL/b07RBKB8WtLu+20z6slTxjSzAL8o0+1QjPLWc0J3NNQ/aB2jKx+ +ZopC9q0ckvO2+xRG603XLzDgbe5bNr5EdLcgBVeFTegAGaL2DOauocBC36esgl3H +aLcY5olLmmv6znn58yynAgMBAAGjggFQMIIBTDBIBgNVHSAEQTA/MD0GBFUdIAAw +NTAzBggrBgEFBQcCARYnaHR0cDovL3d3dy5kaWdpbm90YXIubmwvY3BzL3BraW92 +ZXJoZWlkMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMIGABgNVHSME +eTB3gBQLhtYPd6NosftkCcOIblwEHFfpPaFZpFcwVTELMAkGA1UEBhMCTkwxHjAc +BgNVBAoTFVN0YWF0IGRlciBOZWRlcmxhbmRlbjEmMCQGA1UEAxMdU3RhYXQgZGVy +IE5lZGVybGFuZGVuIFJvb3QgQ0GCBACYmnkwPQYDVR0fBDYwNDAyoDCgLoYsaHR0 +cDovL2NybC5wa2lvdmVyaGVpZC5ubC9Eb21PdkxhdGVzdENSTC5jcmwwHQYDVR0O +BBYEFEwIyY128ZjHPt881y91DbF2eZfMMA0GCSqGSIb3DQEBBQUAA4IBAQAMlIca +v03jheLu19hjeQ5Q38aEW9K72fUxCho1l3TfFPoqDz7toOMI9tVOW6+mriXiRWsi +D7dUKH6S3o0UbNEc5W50BJy37zRERd/Jgx0ZH8Apad+J1T/CsFNt5U4X5HNhIxMm +cUP9TFnLw98iqiEr2b+VERqKpOKrp11Lbyn1UtHk0hWxi/7wA8+nfemZhzizDXMU +5HIs4c71rQZIZPrTKbmi2Lv01QulQERDjqC/zlqlUkxk0xcxYczopIro5Ij76eUv +BjMzm5RmZrGrUDqhCYF0U1onuabSJc/Tw6f/ltAv6uAejVLpGBwgCkegllYOQJBR +RKwa/fHuhR/3Qlpl +-----END CERTIFICATE----- + +// Subject: CN=DigiNotar PKIoverheid CA Overheid +// O=DigiNotar B.V., +// C=NL +// Issuer: CN=Staat der Nederlanden Overheid CA +// O=Staat der Nederlanden, +// C=NL +// Serial: 20006006 (01:31:44:76) +-----BEGIN CERTIFICATE----- +MIIEezCCA2OgAwIBAgIEATFEdjANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO +TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh +dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDQwNjI0MDgxOTMyWhcN +MTAwNjIzMDgxNzM2WjBSMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy +IEIuVi4xKjAoBgNVBAMTIURpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp +ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANSlrubta5tlOjVCi/gb +yLCvRqfBjxG8H594VcKHu0WAYc99SPZF9cycj5mw2GyfQvy/WIrGrL4iyNq1gSqR +0QA/mTXKZIaPqzpDhdm+VvrKkmjrbZfaQxgMSs3ChtBsjcP9Lc0X1zXZ4Q8nBe3k +BTp+zehINfmbjoEgXLxsMR5RQ6GxzKjuC04PQpbJQgTIakglKaqYcDDZbEscWgPV +Hgj/2aoHlj6leW/ThHZ+O41jUguEmBLZA3mu3HrCfrHntb5dPt0ihzSx7GtD/SaX +5HBLxnP189YuqMk5iRA95CtiSdKauvon/xRKRLNgG6XAz0ctSoY7xLDdiBVU5kJd +FScCAwEAAaOCAVAwggFMMEgGA1UdIARBMD8wPQYEVR0gADA1MDMGCCsGAQUFBwIB +FidodHRwOi8vd3d3LmRpZ2lub3Rhci5ubC9jcHMvcGtpb3ZlcmhlaWQwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgYAGA1UdIwR5MHeAFAuG1g93o2ix ++2QJw4huXAQcV+k9oVmkVzBVMQswCQYDVQQGEwJOTDEeMBwGA1UEChMVU3RhYXQg +ZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQYIEAJiaeTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnBraW92 +ZXJoZWlkLm5sL0RvbU92TGF0ZXN0Q1JMLmNybDAdBgNVHQ4EFgQUvRaYQh2+kdE9 +wpcl4CjXWOC1f+IwDQYJKoZIhvcNAQEFBQADggEBAGhQsCWLiaN2EOhPAW+JQP6o +XBOrLv5w6joahzBFVn1BiefzmlMKjibqKYxURRvMAsMkh82/MfL8V0w6ugxl81lu +i42dcxl9cKSVXKMw4bbBzJ2VQI5HTIABwefeNuy/eX6idVwYdt3ajAH7fUA8Q9Cq +vr6H8B+8mwoEqTVTEVlCSsC/EXsokYEUr06PPzRudKjDmijgj7zFaIioZNc8hk7g +ufEgrs/tmcNGylrwRHgCXjCRBt2NHlZ08l7A1AGU8HcHlSbG9Un/2q9kVHUkps0D +gtUaEK+x6jpAu/R8Ojezu/+ZEcwwjI/KOhG+84+ejFmtyEkrUdsAdEdLf/2dKsw= +-----END CERTIFICATE----- + +// Subject: EMAILADDRESS=info@diginotar.nl, +// CN=DigiNotar Services 1024 CA +// O=DigiNotar, C=NL +// Issuer: CN=Entrust.net Secure Server Certification Authority, +// OU=(c) 1999 Entrust.net Limited, +// OU=www.entrust.net/CPS incorp. by ref. (limits liab.), +// O=Entrust.net, +// C=US +// Serial: 1184640176 (46:9c:2c:b0) +-----BEGIN CERTIFICATE----- +MIIDzTCCAzagAwIBAgIERpwssDANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3 +MjYxNTU5MDBaFw0xMzA4MjYxNjI5MDBaMGgxCzAJBgNVBAYTAk5MMRIwEAYDVQQK +EwlEaWdpTm90YXIxIzAhBgNVBAMTGkRpZ2lOb3RhciBTZXJ2aWNlcyAxMDI0IENB +MSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEA2ptNXTz50eKLxsYIIMXZHkjsZlhneWIrQWP0iY1o2q+4 +lDaLGSSkoJPSmQ+yrS01Tc0vauH5mxkrvAQafi09UmTN8T5nD4ku6PJPrqYIoYX+ +oakJ5sarPkP8r3oDkdqmOaZh7phPGKjTs69mgumfvN1y+QYEvRLZGCTnq5NTi1kC +AwEAAaOCASYwggEiMBIGA1UdEwEB/wQIMAYBAf8CAQAwJwYDVR0lBCAwHgYIKwYB +BQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDBDARBgNVHSAECjAIMAYGBFUdIAAwMwYI +KwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5lbnRydXN0Lm5l +dDAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmVudHJ1c3QubmV0L3NlcnZl +cjEuY3JsMB0GA1UdDgQWBBT+3JRJDG/vXH/G8RKZTxZJrfuCZTALBgNVHQ8EBAMC +AQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0BowGQYJKoZIhvZ9B0EA +BAwwChsEVjcuMQMCAIEwDQYJKoZIhvcNAQEFBQADgYEAY3RqN6k/lpxmyFisCcnv +9WWUf6MCxDgxvV0jh+zUVrLJsm7kBQb87PX6iHBZ1O7m3bV6oKNgLwIMq94SXa/w +NUuqikeRGvWFLELHHe+VQ7NeuJWTpdrFKKqtci0xrZlrbP+MISevrZqRK8fdWMNu +B8WfedLHjFW/TMcnXlEWKz4= +-----END CERTIFICATE----- + +// Subject: CN=Buster Paper Comercial Ltda, +// O=Buster Paper Comercial Ltda, +// L=S?o Jos? Dos Campos, +// ST=S?o Paulo, +// C=BR +// Issuer: CN=DigiCert Assured ID Code Signing CA-1, +// OU=www.digicert.com, +// O=DigiCert Inc, +// C=US +// Serial: 07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12 +-----BEGIN CERTIFICATE----- +MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv +ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow +gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT +w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l +cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL +HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn +2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4 +tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi +mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf +Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx +BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw +HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT +BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js +My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6 +Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud +IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov +L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG +AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD +AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh +AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy +AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn +ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs +AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp +AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl +AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho +dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl +cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et +MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI +hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft +jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e +gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44 +/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc +BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj +XMuKLxbh7g== +-----END CERTIFICATE----- + +// Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, +// O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME, +// L=S?o Paulo, +// ST=S?o Paulo, +// C=BR +// Issuer: CN=DigiCert Assured ID Code Signing CA-1, +// OU=www.digicert.com, +// O=DigiCert Inc, +// C=US +// Serial: 0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f +-----BEGIN CERTIFICATE----- +MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv +ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow +gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT +w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF +TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB +IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA +A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR +4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V +JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW +kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb +0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj +NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV +HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30 +o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD +MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1 +cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t +L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB +hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z +c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A +eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA +ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA +IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA +YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA +cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA +aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA +ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC +BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0 +LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp +Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA +MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ +A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE +Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA +XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9 +UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL +zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc +-----END CERTIFICATE----- + +// Subject: CN=CLEARESULT CONSULTING INC., OU=Corporate IT, +// O=CLEARESULT CONSULTING INC., L=Austin, ST=TX, C=US +// Issuer: SERIALNUMBER=07969287, +// CN=Go Daddy Secure Certification Authority, +// OU=http://certificates.godaddy.com/repository, +// O="GoDaddy.com, Inc.", +// L=Scottsdale, +// ST=Arizona, +// C=US +// Serial: 2b:73:43:2a:a8:4f:44 +-----BEGIN CERTIFICATE----- +MIIFYjCCBEqgAwIBAgIHK3NDKqhPRDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE +BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY +BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm +aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5 +IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky +ODcwHhcNMTIwMjE1MjEwOTA2WhcNMTQwMjE1MjEwOTA2WjCBjDELMAkGA1UEBgwC +VVMxCzAJBgNVBAgMAlRYMQ8wDQYDVQQHDAZBdXN0aW4xIzAhBgNVBAoMGkNMRUFS +RVNVTFQgQ09OU1VMVElORyBJTkMuMRUwEwYDVQQLDAxDb3Jwb3JhdGUgSVQxIzAh +BgNVBAMMGkNMRUFSRVNVTFQgQ09OU1VMVElORyBJTkMuMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAtIOjCKeAicull+7ZIzt0/4ya3IeXUFlfypqKMLkU +IbKjn0P5uMj6VE3rlbZr44RCegxvdnR6umBh1c0ZXoN3o+yc0JKcKcLiApmJJ277 +p7IbLwYDhBXRQNoIJm187IOMRPIxsKN4hL91txn9jGBmW+9zKlJlNhR5R7vjwU2E +jrH/6oqsc9EM2yYpfjlNv6+3jSwAYZCkSWr+27PQOV+YHKmIxtJjX0upFz5FdIrV +9CCX+L2Kji1THOkSgG4QTbYxmEcHqGViWz8hXLeNXjcbEsPuIiAu3hknxRHfUTE/ +U0Lh0Ug1e3LrJu+WnxM2SmUY4krsZ22c0yWUW9hzWITIjQIDAQABo4IBhzCCAYMw +DwYDVR0TAQH/BAUwAwEBADATBgNVHSUEDDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8E +BAMCB4AwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5LmNvbS9n +ZHM1LTE2LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcCMDkwNwYIKwYBBQUH +AgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8w +gYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZ29kYWRk +eS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdvZGFkZHku +Y29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSMEGDAWgBT9 +rGEyk2xF1uLuhV+auud2mWjM5zAdBgNVHQ4EFgQUDtdeKqeN2QkcbEp1HovFieNB +XiowDQYJKoZIhvcNAQEFBQADggEBAD74Agw5tvi2aBl4/f/s7/VE/BClzDsKMb9K +v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC +2i/EmfjLgmCfezNFtLq8xcPxF3zIRc44vPrK0z4YZsaHdH+yTEJ51p5EMdTqaLaP +4n5m8LX3RfqlQB9dYFe6dUoYZjKm9d/pIRww3VqfOzjl42Edi1w6dWmBVMx1NZuR +DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI +LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU= +-----END CERTIFICATE----- diff --git a/jdk/test/lib/security/CheckBlacklistedCerts.java b/jdk/test/lib/security/CheckBlacklistedCerts.java new file mode 100644 index 00000000000..1f162b3e499 --- /dev/null +++ b/jdk/test/lib/security/CheckBlacklistedCerts.java @@ -0,0 +1,131 @@ +/* + * 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 8011402 + * @summary Move blacklisting certificate logic from hard code to data + */ + +import sun.security.util.UntrustedCertificates; + +import java.io.*; +import java.security.KeyStore; +import java.security.cert.*; +import java.util.*; + +public class CheckBlacklistedCerts { + public static void main(String[] args) throws Exception { + + String home = System.getProperty("java.home"); + boolean failed = false; + + // Root CAs should always be trusted + File file = new File(home, "lib/security/cacerts"); + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + try (FileInputStream fis = new FileInputStream(file)) { + ks.load(new FileInputStream(file), null); + } + System.out.println("Check for cacerts: " + ks.size()); + for (String alias: Collections.list(ks.aliases())) { + X509Certificate cert = (X509Certificate)ks.getCertificate(alias); + if (UntrustedCertificates.isUntrusted(cert)) { + System.out.print(alias + " is untrusted"); + failed = true; + } + } + + // All certs in the pem files + Set blacklisted = new HashSet<>(); + + // Hopefully src comes with test, but it might be missing if doing + // a -testonly JPRT job. + File[] blacklists = { + new File(System.getProperty("test.src"), + "../../../src/share/lib/security/blacklisted.certs.pem"), + new File(System.getProperty("test.src"), + "../../../src/closed/share/lib/security/blacklisted.certs.pem") + }; + + // Is this an OPENJDK build? + if (!new File(home, "lib/security/local_policy.jar").exists()) { + blacklists = Arrays.copyOf(blacklists, 1); + } + + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + for (File blacklist: blacklists) { + System.out.print("Check for " + blacklist + ": "); + if (!blacklist.exists()) { + System.out.println("does not exist"); + } else { + try (FileInputStream fis = new FileInputStream(blacklist)) { + Collection certs + = cf.generateCertificates(fis); + System.out.println(certs.size()); + for (Certificate c: certs) { + blacklisted.add(c); + X509Certificate cert = ((X509Certificate)c); + if (!UntrustedCertificates.isUntrusted(cert)) { + System.out.println(cert.getSubjectDN() + " is trusted"); + failed = true; + } + } + } + } + } + + // Check the blacklisted.certs file itself + file = new File(home, "lib/security/blacklisted.certs"); + System.out.print("Check for " + file + ": "); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(new FileInputStream(file)))) { + int acount = 0; + int ccount = 0; + while (true) { + String line = reader.readLine(); + if (line == null) break; + if (line.startsWith("Algorithm")) { + acount++; + } else if (!line.isEmpty() && !line.startsWith("#")) { + ccount++; + } + } + System.out.println(acount + " algs, " + ccount + " certs" ); + if (acount != 1) { + System.out.println("There are " + acount + " algorithms"); + failed = true; + } + if (ccount != blacklisted.size() + && !blacklisted.isEmpty()) { + System.out.println("Wrong blacklisted.certs size: " + + ccount + " fingerprints, " + + blacklisted.size() + " certs"); + failed = true; + } + } + + if (failed) { + throw new Exception("Failed"); + } + } +} From 8290ada96c02e38f2d718a9060eeb3a0acdeb3ac Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Wed, 18 Sep 2013 15:13:10 +0100 Subject: [PATCH 087/983] 8015762: TEST_BUG: java/nio/channels/DatagramChannel/AdaptDatagramSocket.java failing intermittently [win] Reviewed-by: chegar, alanb --- .../java/nio/channels/DatagramChannel/AdaptDatagramSocket.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java index 1763ef3a11e..dbeb491acfe 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java +++ b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java @@ -136,7 +136,7 @@ public class AdaptDatagramSocket { echoServer.getPort()); test(address, 0, false, false); test(address, 0, false, true); - test(address, 5000, false, false); + test(address, 15000, false, false); } try (TestServers.UdpDiscardServer discardServer = TestServers.UdpDiscardServer.startNewServer()) { From 100b98aafa33e503f453a52cd41be3cbf4548be4 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Thu, 19 Sep 2013 17:04:45 +0400 Subject: [PATCH 088/983] 8017248: Compiler Diacritics Issue Reviewed-by: naoto --- .../classes/sun/launcher/LauncherHelper.java | 15 ++++++++++++++- jdk/test/tools/launcher/8017248/ClassÁ.java | 5 +++++ jdk/test/tools/launcher/8017248/test.sh | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 jdk/test/tools/launcher/8017248/ClassÁ.java create mode 100644 jdk/test/tools/launcher/8017248/test.sh diff --git a/jdk/src/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/share/classes/sun/launcher/LauncherHelper.java index 5a6f40442ed..dc6a10bfac2 100644 --- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java +++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java @@ -51,6 +51,7 @@ import java.nio.charset.Charset; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; +import java.text.Normalizer; import java.util.ResourceBundle; import java.text.MessageFormat; import java.util.ArrayList; @@ -493,7 +494,19 @@ public enum LauncherHelper { try { mainClass = scloader.loadClass(cn); } catch (NoClassDefFoundError | ClassNotFoundException cnfe) { - abort(cnfe, "java.launcher.cls.error1", cn); + if (System.getProperty("os.name", "").contains("OS X") + && Normalizer.isNormalized(cn, Normalizer.Form.NFD)) { + try { + // On Mac OS X since all names with diacretic symbols are given as decomposed it + // is possible that main class name comes incorrectly from the command line + // and we have to re-compose it + mainClass = scloader.loadClass(Normalizer.normalize(cn, Normalizer.Form.NFC)); + } catch (NoClassDefFoundError | ClassNotFoundException cnfe1) { + abort(cnfe, "java.launcher.cls.error1", cn); + } + } else { + abort(cnfe, "java.launcher.cls.error1", cn); + } } // set to mainClass appClass = mainClass; diff --git a/jdk/test/tools/launcher/8017248/ClassÁ.java b/jdk/test/tools/launcher/8017248/ClassÁ.java new file mode 100644 index 00000000000..2e264990c74 --- /dev/null +++ b/jdk/test/tools/launcher/8017248/ClassÁ.java @@ -0,0 +1,5 @@ +public class ClassÁ { + public static void main(String args[]) { + System.out.println("Succes!"); + } +} diff --git a/jdk/test/tools/launcher/8017248/test.sh b/jdk/test/tools/launcher/8017248/test.sh new file mode 100644 index 00000000000..7a96f46c223 --- /dev/null +++ b/jdk/test/tools/launcher/8017248/test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# @test test.sh +# @bug 8017248 +# @summary Compiler Diacritics Issue +# @run shell test.sh + +OSNAME=`uname -s` +if [ "$OSNAME" == "Darwin" ] +then + rm *.class + ${TESTJAVA}/bin/javac *.java + ${TESTJAVA}/bin/java `echo *.class | cut -d. -f1` +else + echo Test is specific to Mac OS X, skipping. + exit 0 +fi From c7759dc643ac3768e1e05733f82583eed29040d2 Mon Sep 17 00:00:00 2001 From: Peter Levart Date: Thu, 19 Sep 2013 16:14:13 +0200 Subject: [PATCH 089/983] 8011940: java.lang.Class.getAnnotations() always enters synchronized method Reviewed-by: jfranck, chegar, psandoz, shade --- jdk/src/share/classes/java/lang/Class.java | 113 +++++++--- ...tionsInheritanceOrderRedefinitionTest.java | 210 ++++++++++++++++++ 2 files changed, 286 insertions(+), 37 deletions(-) create mode 100644 jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index f884f2efe03..a09aa2c86a4 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -48,6 +48,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import java.util.Map; @@ -2370,11 +2371,14 @@ public final class Class implements java.io.Serializable, private static final long reflectionDataOffset; // offset of Class.annotationType instance field private static final long annotationTypeOffset; + // offset of Class.annotationData instance field + private static final long annotationDataOffset; static { Field[] fields = Class.class.getDeclaredFields0(false); // bypass caches reflectionDataOffset = objectFieldOffset(fields, "reflectionData"); annotationTypeOffset = objectFieldOffset(fields, "annotationType"); + annotationDataOffset = objectFieldOffset(fields, "annotationData"); } private static long objectFieldOffset(Field[] fields, String fieldName) { @@ -2396,6 +2400,12 @@ public final class Class implements java.io.Serializable, AnnotationType newType) { return unsafe.compareAndSwapObject(clazz, annotationTypeOffset, oldType, newType); } + + static boolean casAnnotationData(Class clazz, + AnnotationData oldData, + AnnotationData newData) { + return unsafe.compareAndSwapObject(clazz, annotationDataOffset, oldData, newData); + } } /** @@ -2406,7 +2416,7 @@ public final class Class implements java.io.Serializable, private static boolean useCaches = true; // reflection data that might get invalidated when JVM TI RedefineClasses() is called - static class ReflectionData { + private static class ReflectionData { volatile Field[] declaredFields; volatile Field[] publicFields; volatile Method[] declaredMethods; @@ -3253,8 +3263,7 @@ public final class Class implements java.io.Serializable, public A getAnnotation(Class annotationClass) { Objects.requireNonNull(annotationClass); - initAnnotationsIfNecessary(); - return (A) annotations.get(annotationClass); + return (A) annotationData().annotations.get(annotationClass); } /** @@ -3275,16 +3284,14 @@ public final class Class implements java.io.Serializable, public A[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - initAnnotationsIfNecessary(); - return AnnotationSupport.getMultipleAnnotations(annotations, annotationClass); + return AnnotationSupport.getMultipleAnnotations(annotationData().annotations, annotationClass); } /** * @since 1.5 */ public Annotation[] getAnnotations() { - initAnnotationsIfNecessary(); - return AnnotationParser.toArray(annotations); + return AnnotationParser.toArray(annotationData().annotations); } /** @@ -3296,8 +3303,7 @@ public final class Class implements java.io.Serializable, public A getDeclaredAnnotation(Class annotationClass) { Objects.requireNonNull(annotationClass); - initAnnotationsIfNecessary(); - return (A) declaredAnnotations.get(annotationClass); + return (A) annotationData().declaredAnnotations.get(annotationClass); } /** @@ -3308,52 +3314,85 @@ public final class Class implements java.io.Serializable, public A[] getDeclaredAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - initAnnotationsIfNecessary(); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations, annotationClass); + return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass); } /** * @since 1.5 */ public Annotation[] getDeclaredAnnotations() { - initAnnotationsIfNecessary(); - return AnnotationParser.toArray(declaredAnnotations); + return AnnotationParser.toArray(annotationData().declaredAnnotations); + } + + // annotation data that might get invalidated when JVM TI RedefineClasses() is called + private static class AnnotationData { + final Map, Annotation> annotations; + final Map, Annotation> declaredAnnotations; + + // Value of classRedefinedCount when we created this AnnotationData instance + final int redefinedCount; + + AnnotationData(Map, Annotation> annotations, + Map, Annotation> declaredAnnotations, + int redefinedCount) { + this.annotations = annotations; + this.declaredAnnotations = declaredAnnotations; + this.redefinedCount = redefinedCount; + } } // Annotations cache - private transient Map, Annotation> annotations; - private transient Map, Annotation> declaredAnnotations; - // Value of classRedefinedCount when we last cleared the cached annotations and declaredAnnotations fields - private transient int lastAnnotationsRedefinedCount = 0; + @SuppressWarnings("UnusedDeclaration") + private volatile transient AnnotationData annotationData; - // Clears cached values that might possibly have been obsoleted by - // a class redefinition. - private void clearAnnotationCachesOnClassRedefinition() { - if (lastAnnotationsRedefinedCount != classRedefinedCount) { - annotations = declaredAnnotations = null; - lastAnnotationsRedefinedCount = classRedefinedCount; + private AnnotationData annotationData() { + while (true) { // retry loop + AnnotationData annotationData = this.annotationData; + int classRedefinedCount = this.classRedefinedCount; + if (annotationData != null && + annotationData.redefinedCount == classRedefinedCount) { + return annotationData; + } + // null or stale annotationData -> optimistically create new instance + AnnotationData newAnnotationData = createAnnotationData(classRedefinedCount); + // try to install it + if (Atomic.casAnnotationData(this, annotationData, newAnnotationData)) { + // successfully installed new AnnotationData + return newAnnotationData; + } } } - private synchronized void initAnnotationsIfNecessary() { - clearAnnotationCachesOnClassRedefinition(); - if (annotations != null) - return; - declaredAnnotations = AnnotationParser.parseAnnotations( - getRawAnnotations(), getConstantPool(), this); + private AnnotationData createAnnotationData(int classRedefinedCount) { + Map, Annotation> declaredAnnotations = + AnnotationParser.parseAnnotations(getRawAnnotations(), getConstantPool(), this); Class superClass = getSuperclass(); - if (superClass == null) { + Map, Annotation> annotations = null; + if (superClass != null) { + Map, Annotation> superAnnotations = + superClass.annotationData().annotations; + for (Map.Entry, Annotation> e : superAnnotations.entrySet()) { + Class annotationClass = e.getKey(); + if (AnnotationType.getInstance(annotationClass).isInherited()) { + if (annotations == null) { // lazy construction + annotations = new LinkedHashMap<>((Math.max( + declaredAnnotations.size(), + Math.min(12, declaredAnnotations.size() + superAnnotations.size()) + ) * 4 + 2) / 3 + ); + } + annotations.put(annotationClass, e.getValue()); + } + } + } + if (annotations == null) { + // no inherited annotations -> share the Map with declaredAnnotations annotations = declaredAnnotations; } else { - annotations = new HashMap<>(); - superClass.initAnnotationsIfNecessary(); - for (Map.Entry, Annotation> e : superClass.annotations.entrySet()) { - Class annotationClass = e.getKey(); - if (AnnotationType.getInstance(annotationClass).isInherited()) - annotations.put(annotationClass, e.getValue()); - } + // at least one inherited annotation -> declared may override inherited annotations.putAll(declaredAnnotations); } + return new AnnotationData(annotations, declaredAnnotations, classRedefinedCount); } // Annotation types cache their internal (AnnotationType) form diff --git a/jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java b/jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java new file mode 100644 index 00000000000..909154a7c1e --- /dev/null +++ b/jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java @@ -0,0 +1,210 @@ +/* + * 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 8011940 + * @summary Test inheritance, order and class redefinition behaviour of RUNTIME + * class annotations + * @author plevart + */ + +import sun.reflect.annotation.AnnotationParser; + +import java.lang.annotation.Annotation; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; + +public class AnnotationsInheritanceOrderRedefinitionTest { + + @Retention(RetentionPolicy.RUNTIME) + @Inherited + @interface Ann1 { + String value(); + } + + @Retention(RetentionPolicy.RUNTIME) + @Inherited + @interface Ann2 { + String value(); + } + + @Retention(RetentionPolicy.RUNTIME) + @Inherited + @interface Ann3 { + String value(); + } + + @Ann1("A") + @Ann2("A") + static class A {} + + @Ann3("B") + static class B extends A {} + + @Ann1("C") + @Ann3("C") + static class C extends B {} + + public static void main(String[] args) { + + StringBuilder msgs = new StringBuilder(); + boolean ok = true; + + ok &= annotationsEqual(msgs, A.class, true, + ann(Ann1.class, "A"), ann(Ann2.class, "A")); + ok &= annotationsEqual(msgs, A.class, false, + ann(Ann1.class, "A"), ann(Ann2.class, "A")); + ok &= annotationsEqual(msgs, B.class, true, + ann(Ann3.class, "B")); + ok &= annotationsEqual(msgs, B.class, false, + ann(Ann1.class, "A"), ann(Ann2.class, "A"), ann(Ann3.class, "B")); + ok &= annotationsEqual(msgs, C.class, true, + ann(Ann1.class, "C"), ann(Ann3.class, "C")); + ok &= annotationsEqual(msgs, C.class, false, + ann(Ann1.class, "C"), ann(Ann2.class, "A"), ann(Ann3.class, "C")); + + Annotation[] declaredAnnotatiosA = A.class.getDeclaredAnnotations(); + Annotation[] annotationsA = A.class.getAnnotations(); + Annotation[] declaredAnnotatiosB = B.class.getDeclaredAnnotations(); + Annotation[] annotationsB = B.class.getAnnotations(); + Annotation[] declaredAnnotatiosC = C.class.getDeclaredAnnotations(); + Annotation[] annotationsC = C.class.getAnnotations(); + + incrementClassRedefinedCount(A.class); + incrementClassRedefinedCount(B.class); + incrementClassRedefinedCount(C.class); + + ok &= annotationsEqualButNotSame(msgs, A.class, true, declaredAnnotatiosA); + ok &= annotationsEqualButNotSame(msgs, A.class, false, annotationsA); + ok &= annotationsEqualButNotSame(msgs, B.class, true, declaredAnnotatiosB); + ok &= annotationsEqualButNotSame(msgs, B.class, false, annotationsB); + ok &= annotationsEqualButNotSame(msgs, C.class, true, declaredAnnotatiosC); + ok &= annotationsEqualButNotSame(msgs, C.class, false, annotationsC); + + if (!ok) { + throw new RuntimeException("test failure\n" + msgs); + } + } + + // utility methods + + private static boolean annotationsEqualButNotSame(StringBuilder msgs, + Class declaringClass, boolean declaredOnly, Annotation[] oldAnns) { + if (!annotationsEqual(msgs, declaringClass, declaredOnly, oldAnns)) { + return false; + } + Annotation[] anns = declaredOnly + ? declaringClass.getDeclaredAnnotations() + : declaringClass.getAnnotations(); + List sameAnns = new ArrayList<>(); + for (int i = 0; i < anns.length; i++) { + if (anns[i] == oldAnns[i]) { + sameAnns.add(anns[i]); + } + } + if (!sameAnns.isEmpty()) { + msgs.append(declaredOnly ? "declared " : "").append("annotations for ") + .append(declaringClass.getSimpleName()) + .append(" not re-parsed after class redefinition: ") + .append(toSimpleString(sameAnns)).append("\n"); + return false; + } else { + return true; + } + } + + private static boolean annotationsEqual(StringBuilder msgs, + Class declaringClass, boolean declaredOnly, Annotation... expectedAnns) { + Annotation[] anns = declaredOnly + ? declaringClass.getDeclaredAnnotations() + : declaringClass.getAnnotations(); + if (!Arrays.equals(anns, expectedAnns)) { + msgs.append(declaredOnly ? "declared " : "").append("annotations for ") + .append(declaringClass.getSimpleName()).append(" are: ") + .append(toSimpleString(anns)).append(", expected: ") + .append(toSimpleString(expectedAnns)).append("\n"); + return false; + } else { + return true; + } + } + + private static Annotation ann(Class annotationType, + Object value) { + return AnnotationParser.annotationForMap(annotationType, + Collections.singletonMap("value", value)); + } + + private static String toSimpleString(List anns) { + return toSimpleString(anns.toArray(new Annotation[anns.size()])); + } + + private static String toSimpleString(Annotation[] anns) { + StringJoiner joiner = new StringJoiner(", "); + for (Annotation ann : anns) { + joiner.add(toSimpleString(ann)); + } + return joiner.toString(); + } + + private static String toSimpleString(Annotation ann) { + Class annotationType = ann.annotationType(); + Object value; + try { + value = annotationType.getDeclaredMethod("value").invoke(ann); + } catch (IllegalAccessException | InvocationTargetException + | NoSuchMethodException e) { + throw new RuntimeException(e); + } + return "@" + annotationType.getSimpleName() + "(" + value + ")"; + } + + private static final Field classRedefinedCountField; + + static { + try { + classRedefinedCountField = Class.class.getDeclaredField("classRedefinedCount"); + classRedefinedCountField.setAccessible(true); + } catch (NoSuchFieldException e) { + throw new Error(e); + } + } + + private static void incrementClassRedefinedCount(Class clazz) { + try { + classRedefinedCountField.set(clazz, + ((Integer) classRedefinedCountField.get(clazz)) + 1); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } +} From 6ea068de3a75428cfdf9b19b5f59b4537fd9c0a5 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 19 Sep 2013 10:06:30 -0700 Subject: [PATCH 090/983] 8023113: tools/jar/ChangeDir.java fails if /tmp/a exists Updated the test case Reviewed-by: alanb --- jdk/test/tools/jar/ChangeDir.java | 65 ++++++++++++++++--------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/jdk/test/tools/jar/ChangeDir.java b/jdk/test/tools/jar/ChangeDir.java index f811618af46..6f65fa8542e 100644 --- a/jdk/test/tools/jar/ChangeDir.java +++ b/jdk/test/tools/jar/ChangeDir.java @@ -23,13 +23,15 @@ /** * @test - * @bug 4806786 + * @bug 4806786 8023113 * @summary jar -C doesn't ignore multiple // in path */ import java.io.*; +import java.nio.file.*; import java.util.*; import java.util.jar.*; +import java.util.stream.Stream; import sun.tools.jar.Main; public class ChangeDir { @@ -37,13 +39,16 @@ public class ChangeDir { private final static String fileName = "hello.txt"; /** Remove dirs & files needed for test. */ - private static void cleanup(File dir) throws Throwable { - if (dir != null && dir.exists()) { - for (File ff : dir.listFiles()) { - check(ff.delete()); + private static void cleanup(Path dir) { + try { + if (Files.isDirectory(dir)) { + try (Stream s = Files.list(dir)) { + s.forEach( p -> cleanup(p)); + } } - check(dir.delete()); - check(new File(jarName).delete()); + Files.delete(dir); + } catch (IOException x) { + fail(x.toString()); } } @@ -62,19 +67,16 @@ public class ChangeDir { } static void doTest(String sep) throws Throwable { - File testDir = null; - JarFile jf = null; + Path topDir = Files.createTempDirectory("delete"); try { + Files.deleteIfExists(Paths.get(jarName)); + // Create a subdirectory "a/b" - File f = File.createTempFile("delete", ".me"); - String dirName = f.getParent(); - testDir = new File(dirName + sep + "a" + sep + "b"); - cleanup(testDir); - check(testDir.mkdirs()); + Path testDir = Files.createDirectories(topDir.resolve("a").resolve("b")); // Create file in that subdirectory - File testFile = new File(testDir, fileName); - check(testFile.createNewFile()); + Path testFile = testDir.resolve(fileName); + Files.createFile(testFile); // Create a jar file from that subdirectory, but with a // in the // path name. @@ -82,33 +84,32 @@ public class ChangeDir { argList.add("cf"); argList.add(jarName); argList.add("-C"); - argList.add(dirName + sep + "a" + sep + sep + "b"); // Note double 'sep' is intentional + argList.add(topDir.toString() + sep + "a" + sep + sep + "b"); // Note double 'sep' is intentional argList.add(fileName); - String jarArgs[] = new String[argList.size()]; - jarArgs = argList.toArray(jarArgs); Main jarTool = new Main(System.out, System.err, "jar"); - if (!jarTool.run(jarArgs)) { + if (!jarTool.run(argList.toArray(new String[argList.size()]))) { fail("Could not create jar file."); } // Check that the entry for hello.txt does *not* have a pathname. - jf = new JarFile(jarName); - for (Enumeration i = jf.entries(); i.hasMoreElements();) { - JarEntry je = i.nextElement(); - String name = je.getName(); - if (name.indexOf(fileName) != -1) { - if (name.indexOf(fileName) != 0) { - fail(String.format( - "Expected '%s' but got '%s'%n", fileName, name)); + try (JarFile jf = new JarFile(jarName)) { + for (Enumeration i = jf.entries(); i.hasMoreElements();) { + JarEntry je = i.nextElement(); + String name = je.getName(); + if (name.indexOf(fileName) != -1) { + if (name.indexOf(fileName) != 0) { + fail(String.format( + "Expected '%s' but got '%s'%n", fileName, name)); + } else { + pass(); + } } } } } finally { - if (jf != null) { - jf.close(); - } - cleanup(testDir); + cleanup(topDir); + Files.deleteIfExists(Paths.get(jarName)); } } From 3a559a7ea0774035bf3545735e49264f755da292 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 18 Sep 2013 10:49:34 -0700 Subject: [PATCH 091/983] 8025002: "".codePoints().sorted().iterator().hasNext() causes NegativeArraySizeException Reviewed-by: henryjen, alanb --- jdk/src/share/classes/java/lang/CharSequence.java | 2 +- jdk/test/java/lang/CharSequence/DefaultTest.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/lang/CharSequence.java b/jdk/src/share/classes/java/lang/CharSequence.java index ac80b22f066..a74a9d0d424 100644 --- a/jdk/src/share/classes/java/lang/CharSequence.java +++ b/jdk/src/share/classes/java/lang/CharSequence.java @@ -228,7 +228,7 @@ public interface CharSequence { Spliterators.spliteratorUnknownSize( new CodePointIterator(), Spliterator.ORDERED), - Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED, + Spliterator.ORDERED, false); } } diff --git a/jdk/test/java/lang/CharSequence/DefaultTest.java b/jdk/test/java/lang/CharSequence/DefaultTest.java index dd51ce64122..856b980ff00 100644 --- a/jdk/test/java/lang/CharSequence/DefaultTest.java +++ b/jdk/test/java/lang/CharSequence/DefaultTest.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; import java.util.PrimitiveIterator; +import java.util.Spliterator; import java.util.stream.Collectors; import org.testng.annotations.Test; @@ -34,7 +35,7 @@ import static org.testng.Assert.*; /* * @test * @summary Unit test for CharSequence default methods - * @bug 8012665 + * @bug 8012665 8025002 * @run testng DefaultTest */ @@ -53,6 +54,12 @@ public class DefaultTest { assertEquals(list, Arrays.asList((int) 'a', (int) 'b', (int) 'c')); } + public void testCodePointsCharacteristics() { + Spliterator.OfInt s = "".codePoints().spliterator(); + assertFalse(s.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED)); + assertTrue(s.hasCharacteristics(Spliterator.ORDERED)); + } + @Test(expectedExceptions = NoSuchElementException.class) public void testEmptyCodePoints() { PrimitiveIterator.OfInt s = "".codePoints().iterator(); From 0f59d418d8115e4106c8d81071995d5f4f4352d0 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Thu, 19 Sep 2013 20:41:54 -0700 Subject: [PATCH 092/983] 8024405: Spliterators.spliterator should support CONCURRENT characteristic Reviewed-by: martin --- .../share/classes/java/util/Spliterator.java | 2 +- .../share/classes/java/util/Spliterators.java | 78 +++++----- .../SpliteratorCharacteristics.java | 142 +++++++++++++++++- ...SpliteratorTraversingAndSplittingTest.java | 11 +- 4 files changed, 194 insertions(+), 39 deletions(-) diff --git a/jdk/src/share/classes/java/util/Spliterator.java b/jdk/src/share/classes/java/util/Spliterator.java index 542aec76cde..08d8f1522ca 100644 --- a/jdk/src/share/classes/java/util/Spliterator.java +++ b/jdk/src/share/classes/java/util/Spliterator.java @@ -539,7 +539,7 @@ public interface Spliterator { * Spliterator is expected to have a documented policy concerning the impact * of modifications during traversal. * - *

    A top-level Spliterator should not report {@code CONCURRENT} and + *

    A top-level Spliterator should not report both {@code CONCURRENT} and * {@code SIZED}, since the finite size, if known, may change if the source * is concurrently modified during traversal. Such a Spliterator is * inconsistent and no guarantees can be made about any computation using diff --git a/jdk/src/share/classes/java/util/Spliterators.java b/jdk/src/share/classes/java/util/Spliterators.java index afa2fd379cc..3f97a833a68 100644 --- a/jdk/src/share/classes/java/util/Spliterators.java +++ b/jdk/src/share/classes/java/util/Spliterators.java @@ -409,16 +409,16 @@ public final class Spliterators { * * @param Type of elements * @param c The collection - * @param additionalCharacteristics Additional spliterator characteristics - * of this spliterator's source or elements beyond {@code SIZED} and - * {@code SUBSIZED} which are are always reported + * @param characteristics Characteristics of this spliterator's source or + * elements. The characteristics {@code SIZED} and {@code SUBSIZED} + * are additionally reported unless {@code CONCURRENT} is supplied. * @return A spliterator from an iterator * @throws NullPointerException if the given collection is {@code null} */ public static Spliterator spliterator(Collection c, - int additionalCharacteristics) { + int characteristics) { return new IteratorSpliterator<>(Objects.requireNonNull(c), - additionalCharacteristics); + characteristics); } /** @@ -439,17 +439,17 @@ public final class Spliterators { * @param iterator The iterator for the source * @param size The number of elements in the source, to be reported as * initial {@code estimateSize} - * @param additionalCharacteristics Additional spliterator characteristics - * of this spliterator's source or elements beyond {@code SIZED} and - * {@code SUBSIZED} which are are always reported + * @param characteristics Characteristics of this spliterator's source or + * elements. The characteristics {@code SIZED} and {@code SUBSIZED} + * are additionally reported unless {@code CONCURRENT} is supplied. * @return A spliterator from an iterator * @throws NullPointerException if the given iterator is {@code null} */ public static Spliterator spliterator(Iterator iterator, long size, - int additionalCharacteristics) { + int characteristics) { return new IteratorSpliterator<>(Objects.requireNonNull(iterator), size, - additionalCharacteristics); + characteristics); } /** @@ -467,7 +467,7 @@ public final class Spliterators { * * @param Type of elements * @param iterator The iterator for the source - * @param characteristics Properties of this spliterator's source + * @param characteristics Characteristics of this spliterator's source * or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are * ignored and are not reported.) * @return A spliterator from an iterator @@ -496,17 +496,17 @@ public final class Spliterators { * @param iterator The iterator for the source * @param size The number of elements in the source, to be reported as * initial {@code estimateSize}. - * @param additionalCharacteristics Additional spliterator characteristics - * of this spliterator's source or elements beyond {@code SIZED} and - * {@code SUBSIZED} which are are always reported + * @param characteristics Characteristics of this spliterator's source or + * elements. The characteristics {@code SIZED} and {@code SUBSIZED} + * are additionally reported unless {@code CONCURRENT} is supplied. * @return A spliterator from an iterator * @throws NullPointerException if the given iterator is {@code null} */ public static Spliterator.OfInt spliterator(PrimitiveIterator.OfInt iterator, long size, - int additionalCharacteristics) { + int characteristics) { return new IntIteratorSpliterator(Objects.requireNonNull(iterator), - size, additionalCharacteristics); + size, characteristics); } /** @@ -524,7 +524,7 @@ public final class Spliterators { * operated on after the spliterator is returned. * * @param iterator The iterator for the source - * @param characteristics Properties of this spliterator's source + * @param characteristics Characteristics of this spliterator's source * or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are * ignored and are not reported.) * @return A spliterator from an iterator @@ -553,17 +553,17 @@ public final class Spliterators { * @param iterator The iterator for the source * @param size The number of elements in the source, to be reported as * initial {@code estimateSize}. - * @param additionalCharacteristics Additional spliterator characteristics - * of this spliterator's source or elements beyond {@code SIZED} and - * {@code SUBSIZED} which are are always reported + * @param characteristics Characteristics of this spliterator's source or + * elements. The characteristics {@code SIZED} and {@code SUBSIZED} + * are additionally reported unless {@code CONCURRENT} is supplied. * @return A spliterator from an iterator * @throws NullPointerException if the given iterator is {@code null} */ public static Spliterator.OfLong spliterator(PrimitiveIterator.OfLong iterator, long size, - int additionalCharacteristics) { + int characteristics) { return new LongIteratorSpliterator(Objects.requireNonNull(iterator), - size, additionalCharacteristics); + size, characteristics); } /** @@ -581,7 +581,7 @@ public final class Spliterators { * operated on after the spliterator is returned. * * @param iterator The iterator for the source - * @param characteristics Properties of this spliterator's source + * @param characteristics Characteristics of this spliterator's source * or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are * ignored and are not reported.) * @return A spliterator from an iterator @@ -610,17 +610,17 @@ public final class Spliterators { * @param iterator The iterator for the source * @param size The number of elements in the source, to be reported as * initial {@code estimateSize} - * @param additionalCharacteristics Additional spliterator characteristics - * of this spliterator's source or elements beyond {@code SIZED} and - * {@code SUBSIZED} which are are always reported + * @param characteristics Characteristics of this spliterator's source or + * elements. The characteristics {@code SIZED} and {@code SUBSIZED} + * are additionally reported unless {@code CONCURRENT} is supplied. * @return A spliterator from an iterator * @throws NullPointerException if the given iterator is {@code null} */ public static Spliterator.OfDouble spliterator(PrimitiveIterator.OfDouble iterator, long size, - int additionalCharacteristics) { + int characteristics) { return new DoubleIteratorSpliterator(Objects.requireNonNull(iterator), - size, additionalCharacteristics); + size, characteristics); } /** @@ -638,7 +638,7 @@ public final class Spliterators { * operated on after the spliterator is returned. * * @param iterator The iterator for the source - * @param characteristics Properties of this spliterator's source + * @param characteristics Characteristics of this spliterator's source * or elements ({@code SIZED} and {@code SUBSIZED}, if supplied, are * ignored and are not reported.) * @return A spliterator from an iterator @@ -1710,7 +1710,9 @@ public final class Spliterators { public IteratorSpliterator(Collection collection, int characteristics) { this.collection = collection; this.it = null; - this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED; + this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0 + ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED + : characteristics; } /** @@ -1727,7 +1729,9 @@ public final class Spliterators { this.collection = null; this.it = iterator; this.est = size; - this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED; + this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0 + ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED + : characteristics; } /** @@ -1857,7 +1861,9 @@ public final class Spliterators { public IntIteratorSpliterator(PrimitiveIterator.OfInt iterator, long size, int characteristics) { this.it = iterator; this.est = size; - this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED; + this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0 + ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED + : characteristics; } /** @@ -1949,7 +1955,9 @@ public final class Spliterators { public LongIteratorSpliterator(PrimitiveIterator.OfLong iterator, long size, int characteristics) { this.it = iterator; this.est = size; - this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED; + this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0 + ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED + : characteristics; } /** @@ -2041,7 +2049,9 @@ public final class Spliterators { public DoubleIteratorSpliterator(PrimitiveIterator.OfDouble iterator, long size, int characteristics) { this.it = iterator; this.est = size; - this.characteristics = characteristics | Spliterator.SIZED | Spliterator.SUBSIZED; + this.characteristics = (characteristics & Spliterator.CONCURRENT) == 0 + ? characteristics | Spliterator.SIZED | Spliterator.SUBSIZED + : characteristics; } /** diff --git a/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java b/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java index 3c74ce29dc1..37fbcc769d0 100644 --- a/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java +++ b/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8020156 8020009 8022326 8012913 + * @bug 8020156 8020009 8022326 8012913 8024405 * @run testng SpliteratorCharacteristics */ @@ -36,21 +36,150 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; +import java.util.PrimitiveIterator; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import java.util.Spliterator; +import java.util.Spliterators; import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListSet; +import java.util.function.Supplier; +import java.util.stream.DoubleStream; +import java.util.stream.IntStream; +import java.util.stream.LongStream; import static org.testng.Assert.*; @Test public class SpliteratorCharacteristics { + public void testSpliteratorFromCollection() { + List l = Arrays.asList(1, 2, 3, 4); + + { + Spliterator s = Spliterators.spliterator(l, 0); + assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(l, Spliterator.CONCURRENT); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(l.iterator( ), 1, 0); + assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(l.iterator( ), 1, Spliterator.CONCURRENT); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize(l.iterator( ), 0); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize( + l.iterator(), Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + } + + public void testSpliteratorOfIntFromIterator() { + Supplier si = () -> IntStream.of(1, 2, 3, 4).iterator(); + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, 0); + assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize(si.get(), 0); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize( + si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + } + + public void testSpliteratorOfLongFromIterator() { + Supplier si = () -> LongStream.of(1, 2, 3, 4).iterator(); + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, 0); + assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize(si.get(), 0); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize( + si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + } + + public void testSpliteratorOfDoubleFromIterator() { + Supplier si = () -> DoubleStream.of(1, 2, 3, 4).iterator(); + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, 0); + assertCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliterator(si.get(), 1, Spliterator.CONCURRENT); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + assertCharacteristics(s, Spliterator.CONCURRENT); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize(si.get(), 0); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + + { + Spliterator s = Spliterators.spliteratorUnknownSize( + si.get(), Spliterator.SIZED | Spliterator.SUBSIZED); + assertHasNotCharacteristics(s, Spliterator.SIZED | Spliterator.SUBSIZED); + } + } + + // + public void testHashMap() { assertMapCharacteristics(new HashMap<>(), Spliterator.SIZED | Spliterator.DISTINCT); @@ -199,10 +328,19 @@ public class SpliteratorCharacteristics { } void assertCharacteristics(Collection c, int expectedCharacteristics) { - assertTrue(c.spliterator().hasCharacteristics(expectedCharacteristics), + assertCharacteristics(c.spliterator(), expectedCharacteristics); + } + + void assertCharacteristics(Spliterator s, int expectedCharacteristics) { + assertTrue(s.hasCharacteristics(expectedCharacteristics), "Spliterator characteristics"); } + void assertHasNotCharacteristics(Spliterator s, int expectedCharacteristics) { + assertFalse(s.hasCharacteristics(expectedCharacteristics), + "Spliterator characteristics"); + } + void assertNullComparator(Collection c) { assertNull(c.spliterator().getComparator(), "Comparator of Spliterator of Collection"); diff --git a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java index a84cbbeaebe..69c7cf57436 100644 --- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java +++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java @@ -1159,7 +1159,7 @@ public class SpliteratorTraversingAndSplittingTest { List dest = new ArrayList<>(); spliterator = supplier.get(); - assertSpliterator(spliterator); + assertRootSpliterator(spliterator); // verify splitting with forEach visit(depth, 0, dest, spliterator, boxingAdapter, spliterator.characteristics(), false); @@ -1234,7 +1234,7 @@ public class SpliteratorTraversingAndSplittingTest { UnaryOperator> boxingAdapter) { Spliterator s = supplier.get(); boolean isOrdered = s.hasCharacteristics(Spliterator.ORDERED); - assertSpliterator(s); + assertRootSpliterator(s); List splits = new ArrayList<>(); Consumer c = boxingAdapter.apply(splits::add); @@ -1326,6 +1326,13 @@ public class SpliteratorTraversingAndSplittingTest { } } + private static void assertRootSpliterator(Spliterator s) { + assertFalse(s.hasCharacteristics(Spliterator.SIZED | Spliterator.CONCURRENT), + "Root spliterator should not be SIZED and CONCURRENT"); + + assertSpliterator(s); + } + private static void assertSpliterator(Spliterator s, int rootCharacteristics) { if ((rootCharacteristics & Spliterator.SUBSIZED) != 0) { assertTrue(s.hasCharacteristics(Spliterator.SUBSIZED), From 6de8695342b7af00f6079f6560e3e871da5b2e42 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Fri, 20 Sep 2013 10:14:35 +0200 Subject: [PATCH 093/983] 8024985: com/sun/jdi/StepTest.java failed since jdk8b107 Reviewed-by: dcubed --- jdk/test/com/sun/jdi/ExceptionEvents.java | 4 ++++ jdk/test/com/sun/jdi/FilterNoMatch.java | 10 +++++++--- jdk/test/com/sun/jdi/JDIScaffold.java | 4 ++++ jdk/test/com/sun/jdi/PopAndStepTest.java | 4 ++++ jdk/test/com/sun/jdi/RepStep.java | 4 ++++ jdk/test/com/sun/jdi/TestScaffold.java | 7 ++++++- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/jdk/test/com/sun/jdi/ExceptionEvents.java b/jdk/test/com/sun/jdi/ExceptionEvents.java index 88633b6fcde..42a532e4c44 100644 --- a/jdk/test/com/sun/jdi/ExceptionEvents.java +++ b/jdk/test/com/sun/jdi/ExceptionEvents.java @@ -417,8 +417,12 @@ public class ExceptionEvents extends TestScaffold { request = eventRequestManager().createExceptionRequest(exceptionClass, caught, uncaught); request.addClassExclusionFilter("java.*"); + request.addClassExclusionFilter("javax.*"); request.addClassExclusionFilter("sun.*"); request.addClassExclusionFilter("com.sun.*"); + request.addClassExclusionFilter("com.oracle.*"); + request.addClassExclusionFilter("oracle.*"); + request.addClassExclusionFilter("jdk.internal.*"); request.setSuspendPolicy(suspendPolicy); request.enable(); diff --git a/jdk/test/com/sun/jdi/FilterNoMatch.java b/jdk/test/com/sun/jdi/FilterNoMatch.java index 1feb8992f3a..3a8ecd2abdb 100644 --- a/jdk/test/com/sun/jdi/FilterNoMatch.java +++ b/jdk/test/com/sun/jdi/FilterNoMatch.java @@ -121,9 +121,13 @@ public class FilterNoMatch extends JDIScaffold { // We have to filter out all these so that they don't cause the // listener to be called. - request1.addClassExclusionFilter( "java.*"); - request1.addClassExclusionFilter( "com.*"); - request1.addClassExclusionFilter( "sun.*"); + request1.addClassExclusionFilter("java.*"); + request1.addClassExclusionFilter("javax.*"); + request1.addClassExclusionFilter("sun.*"); + request1.addClassExclusionFilter("com.sun.*"); + request1.addClassExclusionFilter("com.oracle.*"); + request1.addClassExclusionFilter("oracle.*"); + request1.addClassExclusionFilter("jdk.internal.*"); // We want our listener to be called if a pattern does not match. // So, here we want patterns that do not match HelloWorld. diff --git a/jdk/test/com/sun/jdi/JDIScaffold.java b/jdk/test/com/sun/jdi/JDIScaffold.java index e0a95dfbe09..0c60c0767dd 100644 --- a/jdk/test/com/sun/jdi/JDIScaffold.java +++ b/jdk/test/com/sun/jdi/JDIScaffold.java @@ -450,8 +450,12 @@ abstract public class JDIScaffold { requestManager.createStepRequest(thread, gran, depth); sr.addClassExclusionFilter("java.*"); + sr.addClassExclusionFilter("javax.*"); sr.addClassExclusionFilter("sun.*"); sr.addClassExclusionFilter("com.sun.*"); + sr.addClassExclusionFilter("com.oracle.*"); + sr.addClassExclusionFilter("oracle.*"); + sr.addClassExclusionFilter("jdk.internal.*"); sr.addCountFilter(1); sr.enable(); StepEvent retEvent = (StepEvent)waitForRequestedEvent(sr); diff --git a/jdk/test/com/sun/jdi/PopAndStepTest.java b/jdk/test/com/sun/jdi/PopAndStepTest.java index c5487fe787d..76dc0f5038c 100644 --- a/jdk/test/com/sun/jdi/PopAndStepTest.java +++ b/jdk/test/com/sun/jdi/PopAndStepTest.java @@ -130,8 +130,12 @@ public class PopAndStepTest extends TestScaffold { StepRequest srInto = erm.createStepRequest(mainThread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); srInto.addClassExclusionFilter("java.*"); + srInto.addClassExclusionFilter("javax.*"); srInto.addClassExclusionFilter("sun.*"); srInto.addClassExclusionFilter("com.sun.*"); + srInto.addClassExclusionFilter("com.oracle.*"); + srInto.addClassExclusionFilter("oracle.*"); + srInto.addClassExclusionFilter("jdk.internal.*"); srInto.addCountFilter(1); srInto.enable(); // This fails mainThread.popFrames(frameFor("A")); diff --git a/jdk/test/com/sun/jdi/RepStep.java b/jdk/test/com/sun/jdi/RepStep.java index 665dfb79845..80ce449b304 100644 --- a/jdk/test/com/sun/jdi/RepStep.java +++ b/jdk/test/com/sun/jdi/RepStep.java @@ -75,8 +75,12 @@ public class RepStep { DEPTH); sr.addClassExclusionFilter("java.*"); + sr.addClassExclusionFilter("javax.*"); sr.addClassExclusionFilter("sun.*"); sr.addClassExclusionFilter("com.sun.*"); + sr.addClassExclusionFilter("com.oracle.*"); + sr.addClassExclusionFilter("oracle.*"); + sr.addClassExclusionFilter("jdk.internal.*"); sr.enable(); } diff --git a/jdk/test/com/sun/jdi/TestScaffold.java b/jdk/test/com/sun/jdi/TestScaffold.java index 61f8e053eaf..5dc5640f91f 100644 --- a/jdk/test/com/sun/jdi/TestScaffold.java +++ b/jdk/test/com/sun/jdi/TestScaffold.java @@ -746,8 +746,12 @@ abstract public class TestScaffold extends TargetAdapter { requestManager.createStepRequest(thread, gran, depth); sr.addClassExclusionFilter("java.*"); + sr.addClassExclusionFilter("javax.*"); sr.addClassExclusionFilter("sun.*"); sr.addClassExclusionFilter("com.sun.*"); + sr.addClassExclusionFilter("com.oracle.*"); + sr.addClassExclusionFilter("oracle.*"); + sr.addClassExclusionFilter("jdk.internal.*"); sr.addCountFilter(1); sr.enable(); StepEvent retEvent = (StepEvent)waitForRequestedEvent(sr); @@ -829,7 +833,8 @@ abstract public class TestScaffold extends TargetAdapter { Method method = findMethod(rt, methodName, methodSignature); if (method == null) { - throw new IllegalArgumentException("Bad method name/signature"); + throw new IllegalArgumentException("Bad method name/signature: " + + clsName + "." + methodName + ":" + methodSignature); } return resumeTo(method.location()); From a066da5d4d48d6f2eac8fe31f920a7a7f45fb1ce Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Fri, 20 Sep 2013 10:15:02 +0200 Subject: [PATCH 094/983] 8024416: TESTBUG: com/sun/jdi/MethodEntryExitEvents.java: method entry count mismatch Reviewed-by: dcubed --- jdk/test/com/sun/jdi/MethodEntryExitEvents.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/com/sun/jdi/MethodEntryExitEvents.java b/jdk/test/com/sun/jdi/MethodEntryExitEvents.java index a1c67cbfdd4..a14a63e3491 100644 --- a/jdk/test/com/sun/jdi/MethodEntryExitEvents.java +++ b/jdk/test/com/sun/jdi/MethodEntryExitEvents.java @@ -115,7 +115,7 @@ public class MethodEntryExitEvents extends TestScaffold { */ private String[] excludes = {"java.*", "javax.*", "sun.*", "com.sun.*", "com.oracle.*", - "oracle.*"}; + "oracle.*", "jdk.internal.*"}; MethodEntryExitEvents (String args[]) { super(args); From e5fa00ffb59d2297c73848997cd66cc519b4f10a Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Fri, 20 Sep 2013 17:56:54 +0400 Subject: [PATCH 095/983] 8025076: Fix for JDK-8017248 breaks jprt submission for non-unicode locales Reviewed-by: naoto, ksrini --- jdk/test/tools/launcher/8017248/ClassÁ.java | 5 -- jdk/test/tools/launcher/8017248/test.sh | 16 ----- jdk/test/tools/launcher/DiacriticTest.java | 76 +++++++++++++++++++++ 3 files changed, 76 insertions(+), 21 deletions(-) delete mode 100644 jdk/test/tools/launcher/8017248/ClassÁ.java delete mode 100644 jdk/test/tools/launcher/8017248/test.sh create mode 100644 jdk/test/tools/launcher/DiacriticTest.java diff --git a/jdk/test/tools/launcher/8017248/ClassÁ.java b/jdk/test/tools/launcher/8017248/ClassÁ.java deleted file mode 100644 index 2e264990c74..00000000000 --- a/jdk/test/tools/launcher/8017248/ClassÁ.java +++ /dev/null @@ -1,5 +0,0 @@ -public class ClassÁ { - public static void main(String args[]) { - System.out.println("Succes!"); - } -} diff --git a/jdk/test/tools/launcher/8017248/test.sh b/jdk/test/tools/launcher/8017248/test.sh deleted file mode 100644 index 7a96f46c223..00000000000 --- a/jdk/test/tools/launcher/8017248/test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# @test test.sh -# @bug 8017248 -# @summary Compiler Diacritics Issue -# @run shell test.sh - -OSNAME=`uname -s` -if [ "$OSNAME" == "Darwin" ] -then - rm *.class - ${TESTJAVA}/bin/javac *.java - ${TESTJAVA}/bin/java `echo *.class | cut -d. -f1` -else - echo Test is specific to Mac OS X, skipping. - exit 0 -fi diff --git a/jdk/test/tools/launcher/DiacriticTest.java b/jdk/test/tools/launcher/DiacriticTest.java new file mode 100644 index 00000000000..44107bae42f --- /dev/null +++ b/jdk/test/tools/launcher/DiacriticTest.java @@ -0,0 +1,76 @@ +/* + * 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 8017248 + * @summary Compiler Diacritics Issue + * @run main DiacriticTest + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +public class DiacriticTest extends TestHelper { + + // NFD-normalized form of the class name + static String NAME_NFD="ClassA\u0301"; + // NFC-normalized form of the same class name + static String NAME_NFC="Class\u00C1"; + + public static void main(String[] args) throws IOException { + if (!isMacOSX) { + System.out.println("This test is for Mac OS X only. Passing."); + return; + } + + File sourceFile = new File(NAME_NFC + ".java"); + String source = "public class " + NAME_NFC + " { " + + " public static void main(String args[]) {\n" + + " System.out.println(\"Success!\");\n" + + " }\n" + + "}\n"; + ArrayList content = new ArrayList<>(); + content.add(source); + createFile(sourceFile, content); + + HashMap env = new HashMap<>(); + env.put("LC_CTYPE", "UTF-8"); + + TestResult tr; + tr = doExec(env, javacCmd, NAME_NFD + ".java"); + System.out.println(tr.testOutput); + if (!tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("Compilation failed"); + } + tr = doExec(env, javaCmd, "-cp", ".", NAME_NFD); + System.out.println(tr.testOutput); + if (!tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("Test execution failed"); + } + } +} From fdef74ade2c76938a587ba4fe2ca713843a3d117 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Fri, 20 Sep 2013 16:40:32 +0200 Subject: [PATCH 096/983] 7200277: [parfait] potential buffer overflow in npt/utf.c Reviewed-by: dsamersoff, dcubed --- jdk/src/share/npt/utf.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/jdk/src/share/npt/utf.c b/jdk/src/share/npt/utf.c index 9c88ca0583d..55ddd210d57 100644 --- a/jdk/src/share/npt/utf.c +++ b/jdk/src/share/npt/utf.c @@ -105,18 +105,24 @@ utf16ToUtf8m(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, code = utf16[i]; if ( code >= 0x0001 && code <= 0x007F ) { + if ( outputLen + 1 >= outputMaxLen ) { + return -1; + } output[outputLen++] = code; } else if ( code == 0 || ( code >= 0x0080 && code <= 0x07FF ) ) { + if ( outputLen + 2 >= outputMaxLen ) { + return -1; + } output[outputLen++] = ((code>>6) & 0x1F) | 0xC0; output[outputLen++] = (code & 0x3F) | 0x80; } else if ( code >= 0x0800 && code <= 0xFFFF ) { + if ( outputLen + 3 >= outputMaxLen ) { + return -1; + } output[outputLen++] = ((code>>12) & 0x0F) | 0xE0; output[outputLen++] = ((code>>6) & 0x3F) | 0x80; output[outputLen++] = (code & 0x3F) | 0x80; } - if ( outputLen > outputMaxLen ) { - return -1; - } } output[outputLen] = 0; return outputLen; @@ -412,12 +418,15 @@ bytesToPrintable(struct UtfInst *ui, char *bytes, int len, char *output, int out unsigned byte; byte = bytes[i]; - if ( outputLen >= outputMaxLen ) { - return -1; - } if ( byte <= 0x7f && isprint(byte) && !iscntrl(byte) ) { + if ( outputLen + 1 >= outputMaxLen ) { + return -1; + } output[outputLen++] = (char)byte; } else { + if ( outputLen + 4 >= outputMaxLen ) { + return -1; + } (void)sprintf(output+outputLen,"\\x%02x",byte); outputLen += 4; } From 851fd0447ee2e0ee042d4025663d6f9b6ee69fa7 Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Fri, 20 Sep 2013 11:07:06 -0700 Subject: [PATCH 097/983] 8024253: ThreadLocal random can use SecureRandom for the initial seed Co-authored-by: Peter Levart Co-authored-by: Guy Steele Reviewed-by: psandoz, chegar, alanb --- .../classes/java/util/SplittableRandom.java | 31 +++++++++-- .../util/concurrent/ThreadLocalRandom.java | 53 +++++++++++++++++-- .../ThreadLocalRandomTest.java | 2 + 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/jdk/src/share/classes/java/util/SplittableRandom.java b/jdk/src/share/classes/java/util/SplittableRandom.java index 5a990f4d215..c3f5c0b4234 100644 --- a/jdk/src/share/classes/java/util/SplittableRandom.java +++ b/jdk/src/share/classes/java/util/SplittableRandom.java @@ -25,8 +25,7 @@ package java.util; -import java.security.SecureRandom; -import java.net.InetAddress; +import java.net.NetworkInterface; import java.util.concurrent.atomic.AtomicLong; import java.util.function.IntConsumer; import java.util.function.LongConsumer; @@ -242,12 +241,34 @@ public final class SplittableRandom { s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); return s; } - int hh = 0; // hashed host address + long h = 0L; try { - hh = InetAddress.getLocalHost().hashCode(); + Enumeration ifcs = + NetworkInterface.getNetworkInterfaces(); + boolean retry = false; // retry once if getHardwareAddress is null + while (ifcs.hasMoreElements()) { + NetworkInterface ifc = ifcs.nextElement(); + if (!ifc.isVirtual()) { // skip fake addresses + byte[] bs = ifc.getHardwareAddress(); + if (bs != null) { + int n = bs.length; + int m = Math.min(n >>> 1, 4); + for (int i = 0; i < m; ++i) + h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; + if (m < 4) + h = (h << 8) ^ bs[n-1-m]; + h = mix64(h); + break; + } + else if (!retry) + retry = true; + else + break; + } + } } catch (Exception ignore) { } - return (mix64((((long)hh) << 32) ^ System.currentTimeMillis()) ^ + return (h ^ mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); } diff --git a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java index 297f88cd5a3..2cd2b0094bf 100644 --- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -36,6 +36,8 @@ package java.util.concurrent; import java.io.ObjectStreamField; +import java.net.NetworkInterface; +import java.util.Enumeration; import java.util.Random; import java.util.Spliterator; import java.util.concurrent.atomic.AtomicInteger; @@ -71,7 +73,10 @@ import java.util.stream.StreamSupport; * *

    Instances of {@code ThreadLocalRandom} are not cryptographically * secure. Consider instead using {@link java.security.SecureRandom} - * in security-sensitive applications. + * in security-sensitive applications. Additionally, + * default-constructed instances do not use a cryptographically random + * seed unless the {@linkplain System#getProperty system property} + * {@code java.util.secureRandomSeed} is set to {@code true}. * * @since 1.7 * @author Doug Lea @@ -129,9 +134,49 @@ public class ThreadLocalRandom extends Random { /** * The next seed for default constructors. */ - private static final AtomicLong seeder = - new AtomicLong(mix64(System.currentTimeMillis()) ^ - mix64(System.nanoTime())); + private static final AtomicLong seeder = new AtomicLong(initialSeed()); + + private static long initialSeed() { + String pp = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction( + "java.util.secureRandomSeed")); + if (pp != null && pp.equalsIgnoreCase("true")) { + byte[] seedBytes = java.security.SecureRandom.getSeed(8); + long s = (long)(seedBytes[0]) & 0xffL; + for (int i = 1; i < 8; ++i) + s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); + return s; + } + long h = 0L; + try { + Enumeration ifcs = + NetworkInterface.getNetworkInterfaces(); + boolean retry = false; // retry once if getHardwareAddress is null + while (ifcs.hasMoreElements()) { + NetworkInterface ifc = ifcs.nextElement(); + if (!ifc.isVirtual()) { // skip fake addresses + byte[] bs = ifc.getHardwareAddress(); + if (bs != null) { + int n = bs.length; + int m = Math.min(n >>> 1, 4); + for (int i = 0; i < m; ++i) + h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; + if (m < 4) + h = (h << 8) ^ bs[n-1-m]; + h = mix64(h); + break; + } + else if (!retry) + retry = true; + else + break; + } + } + } catch (Exception ignore) { + } + return (h ^ mix64(System.currentTimeMillis()) ^ + mix64(System.nanoTime())); + } /** * The seed increment diff --git a/jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java b/jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java index e4e91f597bb..f159b67d348 100644 --- a/jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java +++ b/jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java @@ -33,7 +33,9 @@ import static org.testng.Assert.*; /** * @test + * @bug 8024253 * @run testng ThreadLocalRandomTest + * @run testng/othervm -Djava.util.secureRandomSeed=true ThreadLocalRandomTest * @summary test methods on ThreadLocalRandom */ @Test From ca9e74c63d031db3f4bba330411831d01013d020 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 20 Sep 2013 15:12:05 -0700 Subject: [PATCH 098/983] 8024331: j.u.Map.computeIfPresent() default/nondefault implementations don't throw NPE if the remappingFunction is null and the key is absent Explicitly check for null remappingFunction parameter. Reviewed-by: mduigou, forax, psandoz --- jdk/src/share/classes/java/util/HashMap.java | 2 + jdk/src/share/classes/java/util/Map.java | 4 ++ jdk/test/java/util/Map/Defaults.java | 61 +++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/util/HashMap.java b/jdk/src/share/classes/java/util/HashMap.java index a6a7d152b5f..16880663f24 100644 --- a/jdk/src/share/classes/java/util/HashMap.java +++ b/jdk/src/share/classes/java/util/HashMap.java @@ -1132,6 +1132,8 @@ public class HashMap extends AbstractMap public V computeIfPresent(K key, BiFunction remappingFunction) { + if (remappingFunction == null) + throw new NullPointerException(); Node e; V oldValue; int hash = hash(key); if ((e = getNode(hash, key)) != null && diff --git a/jdk/src/share/classes/java/util/Map.java b/jdk/src/share/classes/java/util/Map.java index 4340e6d9c8f..bf1ba8391c8 100644 --- a/jdk/src/share/classes/java/util/Map.java +++ b/jdk/src/share/classes/java/util/Map.java @@ -934,6 +934,7 @@ public interface Map { */ default V computeIfAbsent(K key, Function mappingFunction) { + Objects.requireNonNull(mappingFunction); V v, newValue; return ((v = get(key)) == null && (newValue = mappingFunction.apply(key)) != null && @@ -992,6 +993,7 @@ public interface Map { */ default V computeIfPresent(K key, BiFunction remappingFunction) { + Objects.requireNonNull(remappingFunction); V oldValue; while ((oldValue = get(key)) != null) { V newValue = remappingFunction.apply(key, oldValue); @@ -1068,6 +1070,7 @@ public interface Map { */ default V compute(K key, BiFunction remappingFunction) { + Objects.requireNonNull(remappingFunction); V oldValue = get(key); for (;;) { V newValue = remappingFunction.apply(key, oldValue); @@ -1174,6 +1177,7 @@ public interface Map { */ default V merge(K key, V value, BiFunction remappingFunction) { + Objects.requireNonNull(remappingFunction); V oldValue = get(key); for (;;) { if (oldValue != null) { diff --git a/jdk/test/java/util/Map/Defaults.java b/jdk/test/java/util/Map/Defaults.java index 82470019048..f14cd8aaa4b 100644 --- a/jdk/test/java/util/Map/Defaults.java +++ b/jdk/test/java/util/Map/Defaults.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8010122 8004518 + * @bug 8010122 8004518 8024331 * @summary Test Map default methods * @author Mike Duigou * @run testng Defaults @@ -288,6 +288,21 @@ public class Defaults { assertSame(map.get(EXTRA_KEY), EXTRA_VALUE); } + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfAbsentNPEHashMap() { + Object value = new HashMap().computeIfAbsent(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfAbsentNPEHashtable() { + Object value = new Hashtable().computeIfAbsent(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfAbsentNPETreeMap() { + Object value = new TreeMap().computeIfAbsent(KEYS[1], null); + } + @Test(dataProvider = "Map rw=true keys=withNull values=withNull") public void testComputeIfPresentNulls(String description, Map map) { assertTrue(map.containsKey(null), description + ": null key absent"); @@ -328,6 +343,21 @@ public class Defaults { assertSame(map.get(EXTRA_KEY), null); } + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfPresentNPEHashMap() { + Object value = new HashMap().computeIfPresent(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfPresentNPEHashtable() { + Object value = new Hashtable().computeIfPresent(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeIfPresentNPETreeMap() { + Object value = new TreeMap().computeIfPresent(KEYS[1], null); + } + @Test(dataProvider = "Map rw=true keys=withNull values=withNull") public void testComputeNulls(String description, Map map) { assertTrue(map.containsKey(null), "null key absent"); @@ -414,6 +444,20 @@ public class Defaults { assertSame(map.get(EXTRA_KEY), EXTRA_VALUE); } + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeNPEHashMap() { + Object value = new HashMap().compute(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeNPEHashtable() { + Object value = new Hashtable().compute(KEYS[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testComputeNPETreeMap() { + Object value = new TreeMap().compute(KEYS[1], null); + } @Test(dataProvider = "Map rw=true keys=withNull values=withNull") public void testMergeNulls(String description, Map map) { @@ -456,6 +500,21 @@ public class Defaults { assertSame(map.get(EXTRA_KEY), EXTRA_VALUE); } + @Test(expectedExceptions = {NullPointerException.class}) + public void testMergeNPEHashMap() { + Object value = new HashMap().merge(KEYS[1], VALUES[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testMergeNPEHashtable() { + Object value = new Hashtable().merge(KEYS[1], VALUES[1], null); + } + + @Test(expectedExceptions = {NullPointerException.class}) + public void testMergeNPETreeMap() { + Object value = new TreeMap().merge(KEYS[1], VALUES[1], null); + } + enum IntegerEnum { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, From 57f84d86371845457d3b3c0b700c8cca120e30f4 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Fri, 20 Sep 2013 17:11:32 -0700 Subject: [PATCH 099/983] 8024341: j.u.regex.Pattern.splitAsStream() doesn't correspond to split() method if using an example from the spec Reviewed-by: alanb --- .../classes/java/util/regex/Pattern.java | 43 ++++++++++++++----- ...atternTest.java => PatternStreamTest.java} | 37 +++++++++++++++- 2 files changed, 68 insertions(+), 12 deletions(-) rename jdk/test/java/util/regex/{PatternTest.java => PatternStreamTest.java} (82%) diff --git a/jdk/src/share/classes/java/util/regex/Pattern.java b/jdk/src/share/classes/java/util/regex/Pattern.java index 1dc72c10cd3..81ea7145a78 100644 --- a/jdk/src/share/classes/java/util/regex/Pattern.java +++ b/jdk/src/share/classes/java/util/regex/Pattern.java @@ -5755,7 +5755,8 @@ NEXT: while (i <= last) { * input sequence that is terminated by another subsequence that matches * this pattern or is terminated by the end of the input sequence. The * substrings in the stream are in the order in which they occur in the - * input. + * input. Trailing empty strings will be discarded and not encountered in + * the stream. * *

    If this pattern does not match any subsequence of the input then * the resulting stream has just one element, namely the input sequence in @@ -5781,6 +5782,8 @@ NEXT: while (i <= last) { private int current; // null if the next element, if any, needs to obtained private String nextElement; + // > 0 if there are N next empty elements + private int emptyElementCount; MatcherIterator() { this.matcher = matcher(input); @@ -5790,26 +5793,46 @@ NEXT: while (i <= last) { if (!hasNext()) throw new NoSuchElementException(); - String n = nextElement; - nextElement = null; - return n; + if (emptyElementCount == 0) { + String n = nextElement; + nextElement = null; + return n; + } else { + emptyElementCount--; + return ""; + } } public boolean hasNext() { - if (nextElement != null) + if (nextElement != null || emptyElementCount > 0) return true; if (current == input.length()) return false; - if (matcher.find()) { + // Consume the next matching element + // Count sequence of matching empty elements + while (matcher.find()) { nextElement = input.subSequence(current, matcher.start()).toString(); current = matcher.end(); - } else { - nextElement = input.subSequence(current, input.length()).toString(); - current = input.length(); + if (!nextElement.isEmpty()) { + return true; + } else { + emptyElementCount++; + } + } + + // Consume last matching element + nextElement = input.subSequence(current, input.length()).toString(); + current = input.length(); + if (!nextElement.isEmpty()) { + return true; + } else { + // Ignore a terminal sequence of matching empty elements + emptyElementCount = 0; + nextElement = null; + return false; } - return true; } } return StreamSupport.stream(Spliterators.spliteratorUnknownSize( diff --git a/jdk/test/java/util/regex/PatternTest.java b/jdk/test/java/util/regex/PatternStreamTest.java similarity index 82% rename from jdk/test/java/util/regex/PatternTest.java rename to jdk/test/java/util/regex/PatternStreamTest.java index aab17319ae4..374b62378e9 100644 --- a/jdk/test/java/util/regex/PatternTest.java +++ b/jdk/test/java/util/regex/PatternStreamTest.java @@ -23,10 +23,11 @@ /** * @test + * @bug 8016846 8024341 * @summary Unit tests for wrapping classes should delegate to default methods * @library ../stream/bootlib * @build java.util.stream.OpTestCase - * @run testng/othervm PatternTest + * @run testng/othervm PatternStreamTest */ import org.testng.annotations.DataProvider; @@ -42,7 +43,7 @@ import java.util.stream.Stream; import java.util.stream.TestData; @Test -public class PatternTest extends OpTestCase { +public class PatternStreamTest extends OpTestCase { @DataProvider(name = "Stream") public static Object[][] makeStreamTestData() { @@ -132,6 +133,38 @@ public class PatternTest extends OpTestCase { expected.add("different"); expected.add("separators"); + + description = "Repeated separators within and at end"; + input = "boo:and:foo"; + pattern = Pattern.compile("o"); + expected = new ArrayList<>(); + expected.add("b"); + expected.add(""); + expected.add(":and:f"); + + + description = "Many repeated separators within and at end"; + input = "booooo:and:fooooo"; + pattern = Pattern.compile("o"); + expected = new ArrayList<>(); + expected.add("b"); + expected.add(""); + expected.add(""); + expected.add(""); + expected.add(""); + expected.add(":and:f"); + + description = "Many repeated separators before last match"; + input = "fooooo:"; + pattern = Pattern.compile("o"); + expected = new ArrayList<>(); + expected.add("f"); + expected.add(""); + expected.add(""); + expected.add(""); + expected.add(""); + expected.add(":"); + data.add(new Object[] {description, input, pattern, expected}); return data.toArray(new Object[0][]); } From 06571ae86244a9690f8cf213a85edb651adcebcc Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Mon, 23 Sep 2013 04:05:42 +0100 Subject: [PATCH 100/983] 8023130: (process) ProcessBuilder#inheritIO does not work on Windows Reviewed-by: alanb, martin --- .../windows/native/java/lang/ProcessImpl_md.c | 6 +- jdk/test/java/lang/ProcessBuilder/Basic.java | 12 ++- .../ProcessBuilder/InheritIO/InheritIO.java | 47 +++++++++++ .../ProcessBuilder/InheritIO/InheritIO.sh | 81 +++++++++++++++++++ 4 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.java create mode 100644 jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh diff --git a/jdk/src/windows/native/java/lang/ProcessImpl_md.c b/jdk/src/windows/native/java/lang/ProcessImpl_md.c index 1806fb8193c..da7d00b081a 100644 --- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c +++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c @@ -308,7 +308,11 @@ static jlong processCreate( if (success) { PROCESS_INFORMATION pi; - DWORD processFlag = CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT; + DWORD processFlag = CREATE_UNICODE_ENVIRONMENT; + + /* Suppress popping-up of a console window for non-console applications */ + if (GetConsoleWindow() == NULL) + processFlag |= CREATE_NO_WINDOW; si.dwFlags = STARTF_USESTDHANDLES; if (!CreateProcessW( diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index ebccabdd9c4..5a55cb6f0f4 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -298,11 +298,15 @@ public class Basic { System.exit(5); System.err.print("standard error"); System.out.print("standard output"); - } else if (action.equals("testInheritIO")) { + } else if (action.equals("testInheritIO") + || action.equals("testRedirectInherit")) { List childArgs = new ArrayList(javaChildArgs); childArgs.add("testIO"); ProcessBuilder pb = new ProcessBuilder(childArgs); - pb.inheritIO(); + if (action.equals("testInheritIO")) + pb.inheritIO(); + else + redirectIO(pb, INHERIT, INHERIT, INHERIT); ProcessResults r = run(pb); if (! r.out().equals("")) System.exit(7); @@ -1019,10 +1023,10 @@ public class Basic { // Note that this requires __FOUR__ nested JVMs involved in one test, // if you count the harness JVM. //---------------------------------------------------------------- - { + for (String testName : new String[] { "testInheritIO", "testRedirectInherit" } ) { redirectIO(pb, PIPE, PIPE, PIPE); List command = pb.command(); - command.set(command.size() - 1, "testInheritIO"); + command.set(command.size() - 1, testName); Process p = pb.start(); new PrintStream(p.getOutputStream()).print("standard input"); p.getOutputStream().close(); diff --git a/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.java b/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.java new file mode 100644 index 00000000000..83bb23d840c --- /dev/null +++ b/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.java @@ -0,0 +1,47 @@ +/* + * 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 static java.lang.ProcessBuilder.Redirect.*; + +class InheritIO { + + public static class TestInheritIO { + public static void main(String args[]) throws Throwable { + int err = new ProcessBuilder(args).inheritIO().start().waitFor(); + System.err.print("exit value: " + err); + System.exit(err); + } + } + + public static class TestRedirectInherit { + public static void main(String args[]) throws Throwable { + int err = new ProcessBuilder(args) + .redirectInput(INHERIT) + .redirectOutput(INHERIT) + .redirectError(INHERIT) + .start().waitFor(); + System.err.print("exit value: " + err); + System.exit(err); + } + } +} diff --git a/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh b/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh new file mode 100644 index 00000000000..2b33a037296 --- /dev/null +++ b/jdk/test/java/lang/ProcessBuilder/InheritIO/InheritIO.sh @@ -0,0 +1,81 @@ +# +# 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 8023130 +# @summary (process) ProcessBuilder#inheritIO does not work on Windows +# @run shell InheritIO.sh + +if [ "x${TESTSRC}" = "x" ]; then + echo "TESTSRC not set. Test cannot execute. Failed." + exit 1 +fi + +if [ "x${TESTJAVA}" = "x" ]; then + echo "TESTJAVA not set. Test cannot execute. Failed." + exit 1 +fi + + +JAVA="${TESTJAVA}/bin/java" +JAVAC="${TESTJAVA}/bin/javac" + +cp -f ${TESTSRC}/InheritIO.java . + +# compile the class ourselves, so this can run as a standalone test + +${JAVAC} InheritIO.java +RES="$?" +if [ ${RES} != 0 ]; then + echo 'FAIL: Cannot compile InheritIO.java' + exit ${RES} +fi + + +for TEST_NAME in TestInheritIO TestRedirectInherit +do + ${JAVA} ${TESTVMOPTS} -classpath . \ + 'InheritIO$'${TEST_NAME} printf message > stdout.txt 2> stderr.txt + + RES="$?" + if [ ${RES} != 0 ]; then + echo 'FAIL: InheritIO$'${TEST_NAME}' failed with '${RES} + exit ${RES} + fi + + OUT_EXPECTED='message' + OUT_RECEIVED=`cat stdout.txt` + if [ "x${OUT_RECEIVED}" != "x${OUT_EXPECTED}" ]; then + echo "FAIL: unexpected '${OUT_RECEIVED}' in stdout" + exit 1 + fi + + ERR_EXPECTED='exit value: 0' + ERR_RECEIVED=`cat stderr.txt` + if [ "x${ERR_RECEIVED}" != "x${ERR_EXPECTED}" ]; then + echo "FAIL: unexpected '${ERR_RECEIVED}' in stderr" + exit 1 + fi +done + +echo 'PASS: InheritIO works as expected' From ef64db06e24efd1f08aa5e3e5a327d3e38b5734b Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Thu, 29 Aug 2013 11:08:42 +0200 Subject: [PATCH 101/983] 8014659: NPG: performance counters for compressed klass space Reviewed-by: jmasa, sla --- .../sun/tools/jstat/resources/jstat_options | 96 +++++++++++++++++++ .../sun/tools/jstat/gcCapacityOutput1.awk | 8 +- jdk/test/sun/tools/jstat/gcCauseOutput1.awk | 8 +- .../sun/tools/jstat/gcMetaCapacityOutput1.awk | 8 +- jdk/test/sun/tools/jstat/gcOldOutput1.awk | 8 +- jdk/test/sun/tools/jstat/gcOutput1.awk | 8 +- jdk/test/sun/tools/jstat/lineCounts1.awk | 16 ++-- jdk/test/sun/tools/jstat/lineCounts2.awk | 8 +- jdk/test/sun/tools/jstat/lineCounts3.awk | 26 ++--- jdk/test/sun/tools/jstat/lineCounts4.awk | 30 +++--- jdk/test/sun/tools/jstat/timeStamp1.awk | 8 +- .../sun/tools/jstatd/jstatGcutilOutput1.awk | 16 ++-- 12 files changed, 168 insertions(+), 72 deletions(-) diff --git a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options index bead54260fd..a629a3c6206 100644 --- a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options +++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options @@ -207,6 +207,22 @@ option gc { scale K format "0.0" } + column { + header "^CCSC^" /* Compressed Class Space Capacity - Current */ + data sun.gc.compressedclassspace.capacity + align center + width 6 + scale K + format "0.0" + } + column { + header "^CCSU^" /* Compressed Class Space Used */ + data sun.gc.compressedclassspace.used + align center + width 6 + scale K + format "0.0" + } column { header "^YGC^" /* Young Generation Collections */ data sun.gc.collector.0.invocations @@ -353,6 +369,30 @@ option gccapacity { width 8 format "0.0" } + column { + header "^CCSMN^" /* Compressed Class Space Capacity - Minimum */ + data sun.gc.compressedclassspace.minCapacity + scale K + align right + width 8 + format "0.0" + } + column { + header "^CCSMX^" /* Compressed Class Space Capacity - Maximum */ + data sun.gc.compressedclassspace.maxCapacity + scale K + align right + width 8 + format "0.0" + } + column { + header "^CCSC^" /* Compressed Class Space Capacity - Current */ + data sun.gc.compressedclassspace.capacity + scale K + align right + width 8 + format "0.0" + } column { header "^YGC^" /* Young Generation Collections */ data sun.gc.collector.0.invocations @@ -411,6 +451,14 @@ option gccause { scale raw format "0.00" } + column { + header "^CCS^" /* Compressed Class Space - Percent Used */ + data (1-((sun.gc.compressedclassspace.capacity - sun.gc.compressedclassspace.used)/sun.gc.compressedclassspace.capacity)) * 100 + align right + width 6 + scale raw + format "0.00" + } column { header "^YGC^" /* Young Generation Collections */ data sun.gc.collector.0.invocations @@ -661,6 +709,22 @@ option gcold { scale K format "0.0" } + column { + header "^CCSC^" /* Compressed Class Space Capacity - Current */ + data sun.gc.compressedclassspace.capacity + width 8 + align right + scale K + format "0.0" + } + column { + header "^CCSU^" /* Compressed Class Space Used */ + data sun.gc.compressedclassspace.used + width 8 + align right + scale K + format "0.0" + } column { header "^OC^" /* Old Space Capacity - Current */ data sun.gc.generation.1.space.0.capacity @@ -801,6 +865,30 @@ option gcmetacapacity { width 10 format "0.0" } + column { + header "^CCSMN^" /* Compressed Class Space Capacity - Minimum */ + data sun.gc.compressedclassspace.minCapacity + scale K + align right + width 10 + format "0.0" + } + column { + header "^CCSMX^" /* Compressed Class Space Capacity - Maximum */ + data sun.gc.compressedclassspace.maxCapacity + scale K + align right + width 10 + format "0.0" + } + column { + header "^CCSC^" /* Compressed Class Space Capacity - Current */ + data sun.gc.compressedclassspace.capacity + scale K + align right + width 10 + format "0.0" + } column { header "^YGC^" /* Young Generation Collections */ data sun.gc.collector.0.invocations @@ -875,6 +963,14 @@ option gcutil { scale raw format "0.00" } + column { + header "^CCS^" /* Compressed Class Space Space - Percent Used */ + data (1-((sun.gc.compressedclassspace.capacity - sun.gc.compressedclassspace.used)/sun.gc.compressedclassspace.capacity)) * 100 + align right + width 6 + scale raw + format "0.00" + } column { header "^YGC^" /* Young Generation Collections */ data sun.gc.collector.0.invocations diff --git a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk index c59de5f0bdb..ab630d143b6 100644 --- a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk +++ b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk @@ -3,19 +3,19 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC YGC FGC -# 2176.0 7232.0 2176.0 64.0 64.0 2048.0 6016.0 58304.0 6016.0 6016.0 8192.0 65536.0 8192.0 8192.0 0 +# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC +# 4096.0 657408.0 8192.0 512.0 512.0 3072.0 6144.0 1312768.0 6144.0 6144.0 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC YGC FGC $/ { +/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk index 973d2c049e6..f6127e415f5 100644 --- a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk +++ b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk @@ -3,15 +3,15 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O P YGC YGCT FGC FGCT GCT LGCC GCC -# 0.00 100.00 14.01 3.06 23.20 1 0.032 0 0.000 0.032 Allocation Failure No GC +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC +# 0.00 0.00 0.00 9.97 90.94 87.70 2 0.013 0 0.000 0.013 Allocation Failure No GC BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT LGCC GCC $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC $/ { headerlines++; } @@ -23,7 +23,7 @@ BEGIN { # or more letters and spaces. It also provides for the ".", "(", and ")" # characters to allow for the string "System.gc()". # -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk index c015dd69c94..12d9544542a 100644 --- a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk +++ b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk @@ -3,18 +3,18 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# MCMN MCMX MC YGC FGC FGCT GCT -# 8192.0 65536.0 8192.0 8192.0 1 0 0.000 0.029 +# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT +# 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0.000 0.004 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ MCMN MCMX MC YGC FGC FGCT GCT $/ { +/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/gcOldOutput1.awk b/jdk/test/sun/tools/jstat/gcOldOutput1.awk index df7c6b582c5..c007f66b3be 100644 --- a/jdk/test/sun/tools/jstat/gcOldOutput1.awk +++ b/jdk/test/sun/tools/jstat/gcOldOutput1.awk @@ -3,19 +3,19 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# MC MU OC OU YGC FGC FGCT GCT -# 8192.0 1877.3 6016.0 180.8 1 0 0.000 0.030 +# MC MU CCSC CCSU OC OU YGC FGC FGCT GCT +# 5120.0 4152.0 512.0 397.9 6144.0 200.0 1 0 0.000 0.005 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ MC MU OC OU YGC FGC FGCT GCT $/ { +/^ MC MU CCSC CCSU OC OU YGC FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/gcOutput1.awk b/jdk/test/sun/tools/jstat/gcOutput1.awk index 5ac5b2837a2..d1d90a281e2 100644 --- a/jdk/test/sun/tools/jstat/gcOutput1.awk +++ b/jdk/test/sun/tools/jstat/gcOutput1.awk @@ -3,19 +3,19 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0C S1C S0U S1U EC EU OC OU MC MU YGC YGCT FGC FGCT GCT -# 64.0 64.0 0.0 0.0 2048.0 1711.2 6016.0 0.0 8192.0 1948.6 0 0.000 0 0.000 0.000 +# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT +# 512.0 512.0 0.0 496.0 3072.0 615.5 6144.0 280.0 5120.0 4176.0 512.0 401.0 1 0.005 0 0.000 0.005 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0C S1C S0U S1U EC EU OC OU MC MU YGC YGCT FGC FGCT GCT $/ { +/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/lineCounts1.awk b/jdk/test/sun/tools/jstat/lineCounts1.awk index 33b2f08cc61..b5cb1cdd0bd 100644 --- a/jdk/test/sun/tools/jstat/lineCounts1.awk +++ b/jdk/test/sun/tools/jstat/lineCounts1.awk @@ -3,22 +3,22 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 100.00 68.87 1.24 27.75 1 0.044 0 0.000 0.044 -# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0.005 +# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005 +# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005 +# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005 +# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0.005 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/lineCounts2.awk b/jdk/test/sun/tools/jstat/lineCounts2.awk index b1e80482241..1309d04f8cb 100644 --- a/jdk/test/sun/tools/jstat/lineCounts2.awk +++ b/jdk/test/sun/tools/jstat/lineCounts2.awk @@ -3,18 +3,18 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 100.00 68.87 1.24 27.75 1 0.044 0 0.000 0.044 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 93.76 28.40 1.82 77.74 68.02 1 0.005 0 0.000 0.005 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/lineCounts3.awk b/jdk/test/sun/tools/jstat/lineCounts3.awk index e7c362fbd8f..2d8d4bf1368 100644 --- a/jdk/test/sun/tools/jstat/lineCounts3.awk +++ b/jdk/test/sun/tools/jstat/lineCounts3.awk @@ -3,27 +3,27 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 99.99 66.81 1.24 26.55 1 0.028 0 0.000 0.028 -# 0.00 99.99 68.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 72.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 72.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 74.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 74.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 76.81 1.24 27.85 1 0.028 0 0.000 0.028 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 93.76 26.48 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 71.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 +# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstat/lineCounts4.awk b/jdk/test/sun/tools/jstat/lineCounts4.awk index af9487edb27..5ec4ac7e9bf 100644 --- a/jdk/test/sun/tools/jstat/lineCounts4.awk +++ b/jdk/test/sun/tools/jstat/lineCounts4.awk @@ -3,30 +3,30 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 99.99 66.81 1.24 26.55 1 0.028 0 0.000 0.028 -# 0.00 99.99 68.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 70.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 72.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 72.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 74.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 74.81 1.24 27.84 1 0.028 0 0.000 0.028 -# 0.00 99.99 76.81 1.24 27.85 1 0.028 0 0.000 0.028 -# S0 S1 E O P YGC YGCT FGC FGCT GCT -# 0.00 99.99 76.81 1.24 27.85 1 0.028 0 0.000 0.028 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 96.88 66.55 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 71.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 96.88 79.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003 BEGIN { headerlines=0; datalines=0; totallines=0 datalines2=0; } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { if (headerlines == 2) { datalines2++; } diff --git a/jdk/test/sun/tools/jstat/timeStamp1.awk b/jdk/test/sun/tools/jstat/timeStamp1.awk index 825101b3ac4..1d90a18f748 100644 --- a/jdk/test/sun/tools/jstat/timeStamp1.awk +++ b/jdk/test/sun/tools/jstat/timeStamp1.awk @@ -3,18 +3,18 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 100.00 68.87 1.24 27.75 1 0.044 0 0.000 0.044 +#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.3 0.00 100.00 68.74 1.95 77.73 68.02 1 0.004 0 0.000 0.004 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^Timestamp S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk b/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk index 33b2f08cc61..76b355e6707 100644 --- a/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk +++ b/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk @@ -3,22 +3,22 @@ # that the numerical values conform to a specific pattern, rather than # specific values. # -# S0 S1 E O M YGC YGCT FGC FGCT GCT -# 0.00 100.00 68.87 1.24 27.75 1 0.044 0 0.000 0.044 -# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044 -# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044 +# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT +# 0.00 100.00 56.99 7.81 95.03 87.56 1 0.009 0 0.000 0.009 +# 0.00 100.00 63.64 7.81 95.03 87.56 1 0.009 0 0.000 0.009 +# 0.00 100.00 64.68 7.81 95.03 87.56 1 0.009 0 0.000 0.009 +# 0.00 100.00 65.73 7.81 95.03 87.56 1 0.009 0 0.000 0.009 +# 0.00 100.00 67.22 7.81 95.03 87.56 1 0.009 0 0.000 0.009 BEGIN { headerlines=0; datalines=0; totallines=0 } -/^ S0 S1 E O M YGC YGCT FGC FGCT GCT $/ { +/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ { datalines++; } From 1e581e11eaaa51a4631e6a97a960fea9c50dce20 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Thu, 3 Oct 2013 15:16:14 -0400 Subject: [PATCH 102/983] 8024427: Missing java.time.chrono serialization tests Add tests and cleanup existing serialization tests Reviewed-by: sherman --- .../java/time/temporal/ValueRange.java | 16 ++ .../time/tck/java/time/AbstractTCKTest.java | 35 +++- .../time/tck/java/time/TCKClock_Fixed.java | 6 - .../time/tck/java/time/TCKClock_Offset.java | 6 - .../time/tck/java/time/TCKClock_System.java | 8 - .../time/tck/java/time/TCKClock_Tick.java | 10 -- .../time/tck/java/time/chrono/CopticDate.java | 23 +++ .../time/chrono/TCKChronoZonedDateTime.java | 18 -- .../tck/java/time/chrono/TCKChronology.java | 17 -- .../time/chrono/TCKTestServiceLoader.java | 24 +-- .../TCKChronoLocalDateSerialization.java | 164 ++++++++++++++++++ ... TCKChronoLocalDateTimeSerialization.java} | 35 ++-- ... TCKChronoZonedDateTimeSerialization.java} | 46 ++--- .../serial/TCKChronologySerialization.java | 64 +++---- .../chrono/serial/TCKCopticSerialization.java | 82 +++++++++ .../chrono/serial/TCKEraSerialization.java | 135 ++++++++++++++ .../time/serial/TCKClockSerialization.java | 114 ++++++++++++ ...ion.java => TCKDurationSerialization.java} | 22 ++- ...tant.java => TCKInstantSerialization.java} | 4 +- ...te.java => TCKLocalDateSerialization.java} | 6 +- ...ava => TCKLocalDateTimeSerialization.java} | 6 +- ...me.java => TCKLocalTimeSerialization.java} | 4 +- ...Day.java => TCKMonthDaySerialization.java} | 9 +- ...va => TCKOffsetDateTimeSerialization.java} | 7 +- ...e.java => TCKOffsetTimeSerialization.java} | 4 +- ...eriod.java => TCKPeriodSerialization.java} | 5 +- ...th.java => TCKYearMonthSerialization.java} | 7 +- ...TCKYear.java => TCKYearSerialization.java} | 4 +- ...oneId.java => TCKZoneIdSerialization.java} | 4 +- ...t.java => TCKZoneOffsetSerialization.java} | 4 +- ...ava => TCKZonedDateTimeSerialization.java} | 5 +- .../java/time/temporal/TCKJulianFields.java | 17 +- .../serial/TCKChronoFieldSerialization.java | 145 ++++++++++++++++ .../serial/TCKChronoUnitSerialization.java | 122 +++++++++++++ .../serial/TCKJulianFieldsSerialization.java | 94 ++++++++++ .../serial/TCKValueRangeSerialization.java | 120 +++++++++++++ ...s.java => TCKWeekFieldsSerialization.java} | 4 +- .../time/zone/TCKZoneOffsetTransition.java | 2 - .../zone/TCKZoneOffsetTransitionRule.java | 3 - ...va => TCKFixedZoneRulesSerialization.java} | 4 +- ...oneOffsetTransitionRuleSerialization.java} | 34 +++- ...TCKZoneOffsetTransitionSerialization.java} | 26 ++- ...es.java => TCKZoneRulesSerialization.java} | 4 +- .../time/test/java/time/AbstractTest.java | 26 --- .../time/test/java/time/TestDuration.java | 28 --- .../time/temporal/TestDateTimeValueRange.java | 13 -- 46 files changed, 1208 insertions(+), 328 deletions(-) create mode 100644 jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java rename jdk/test/java/time/tck/java/time/chrono/serial/{TCKChronoLocalDateTime.java => TCKChronoLocalDateTimeSerialization.java} (78%) rename jdk/test/java/time/tck/java/time/chrono/serial/{TCKChronoLocalDate.java => TCKChronoZonedDateTimeSerialization.java} (77%) create mode 100644 jdk/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java create mode 100644 jdk/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java create mode 100644 jdk/test/java/time/tck/java/time/serial/TCKClockSerialization.java rename jdk/test/java/time/tck/java/time/serial/{TCKDuration.java => TCKDurationSerialization.java} (83%) rename jdk/test/java/time/tck/java/time/serial/{TCKInstant.java => TCKInstantSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKLocalDate.java => TCKLocalDateSerialization.java} (96%) rename jdk/test/java/time/tck/java/time/serial/{TCKLocalDateTime.java => TCKLocalDateTimeSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKLocalTime.java => TCKLocalTimeSerialization.java} (98%) rename jdk/test/java/time/tck/java/time/serial/{TCKMonthDay.java => TCKMonthDaySerialization.java} (96%) rename jdk/test/java/time/tck/java/time/serial/{TCKOffsetDateTime.java => TCKOffsetDateTimeSerialization.java} (96%) rename jdk/test/java/time/tck/java/time/serial/{TCKOffsetTime.java => TCKOffsetTimeSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKPeriod.java => TCKPeriodSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKYearMonth.java => TCKYearMonthSerialization.java} (96%) rename jdk/test/java/time/tck/java/time/serial/{TCKYear.java => TCKYearSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKZoneId.java => TCKZoneIdSerialization.java} (99%) rename jdk/test/java/time/tck/java/time/serial/{TCKZoneOffset.java => TCKZoneOffsetSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/serial/{TCKZonedDateTime.java => TCKZonedDateTimeSerialization.java} (98%) create mode 100644 jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java create mode 100644 jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java create mode 100644 jdk/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java create mode 100644 jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java rename jdk/test/java/time/tck/java/time/temporal/serial/{TCKWeekFields.java => TCKWeekFieldsSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/zone/serial/{TCKFixedZoneRules.java => TCKFixedZoneRulesSerialization.java} (97%) rename jdk/test/java/time/tck/java/time/zone/serial/{TCKZoneOffsetTransitionRule.java => TCKZoneOffsetTransitionRuleSerialization.java} (77%) rename jdk/test/java/time/tck/java/time/zone/serial/{TCKZoneOffsetTransition.java => TCKZoneOffsetTransitionSerialization.java} (78%) rename jdk/test/java/time/tck/java/time/zone/serial/{TCKZoneRules.java => TCKZoneRulesSerialization.java} (98%) diff --git a/jdk/src/share/classes/java/time/temporal/ValueRange.java b/jdk/src/share/classes/java/time/temporal/ValueRange.java index e003f114adc..a48abafbf10 100644 --- a/jdk/src/share/classes/java/time/temporal/ValueRange.java +++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java @@ -61,6 +61,7 @@ */ package java.time.temporal; +import java.io.InvalidObjectException; import java.io.Serializable; import java.time.DateTimeException; @@ -337,6 +338,21 @@ public final class ValueRange implements Serializable { } } + /** + * Return the ValueRange for the serialized values. + * The values are validated according to the constraints of the {@link #of} + * factory method. + * @return the ValueRange for the serialized fields + * @throws InvalidObjectException if the serialized object has invalid values + */ + private Object readResolve() throws InvalidObjectException { + try { + return of(minSmallest, minLargest, maxSmallest, maxLargest); + } catch (IllegalArgumentException iae) { + throw new InvalidObjectException("Invalid serialized ValueRange: " + iae.getMessage()); + } + } + //----------------------------------------------------------------------- /** * Checks if this range is equal to another range. diff --git a/jdk/test/java/time/tck/java/time/AbstractTCKTest.java b/jdk/test/java/time/tck/java/time/AbstractTCKTest.java index ff7fc02aa1f..29c2aa9fe1a 100644 --- a/jdk/test/java/time/tck/java/time/AbstractTCKTest.java +++ b/jdk/test/java/time/tck/java/time/AbstractTCKTest.java @@ -68,6 +68,8 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamConstants; import java.io.Serializable; import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Formatter; /** * Base test class. @@ -131,10 +133,10 @@ public abstract class AbstractTCKTest { assertEquals(dis.readByte(), ObjectStreamConstants.TC_NULL); // no superclasses if (expectedBytes.length < 256) { assertEquals(dis.readByte(), ObjectStreamConstants.TC_BLOCKDATA); - assertEquals(dis.readUnsignedByte(), expectedBytes.length); + assertEquals(dis.readUnsignedByte(), expectedBytes.length, "blockdata length incorrect"); } else { assertEquals(dis.readByte(), ObjectStreamConstants.TC_BLOCKDATALONG); - assertEquals(dis.readInt(), expectedBytes.length); + assertEquals(dis.readInt(), expectedBytes.length, "blockdatalong length incorrect"); } byte[] input = new byte[expectedBytes.length]; dis.readFully(input); @@ -162,4 +164,33 @@ public abstract class AbstractTCKTest { } } + + /** + * Utility method to dump a byte array in a java syntax. + * @param bytes and array of bytes + * @return a string containing the bytes formatted in java syntax + */ + protected static String dumpSerialStream(byte[] bytes) { + StringBuilder sb = new StringBuilder(bytes.length * 5); + Formatter fmt = new Formatter(sb); + fmt.format(" byte[] bytes = {" ); + final int linelen = 10; + for (int i = 0; i < bytes.length; i++) { + if (i % linelen == 0) { + fmt.format("%n "); + } + fmt.format(" %3d,", bytes[i] & 0xff); + if ((i % linelen) == (linelen-1) || i == bytes.length - 1) { + fmt.format(" /*"); + int s = i / linelen * linelen; + int k = i % linelen; + for (int j = 0; j <= k && s + j < bytes.length; j++) { + fmt.format(" %c", bytes[s + j] & 0xff); + } + fmt.format(" */"); + } + } + fmt.format("%n };%n"); + return sb.toString(); + } } diff --git a/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java b/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java index ef9f12acc47..3dc567d0ec1 100644 --- a/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java +++ b/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java @@ -80,12 +80,6 @@ public class TCKClock_Fixed extends AbstractTCKTest { private static final ZoneId PARIS = ZoneId.of("Europe/Paris"); private static final Instant INSTANT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)).toInstant(); - //----------------------------------------------------------------------- - public void test_isSerializable() throws IOException, ClassNotFoundException { - assertSerializable(Clock.fixed(INSTANT, ZoneOffset.UTC)); - assertSerializable(Clock.fixed(INSTANT, PARIS)); - } - //------------------------------------------------------------------------- public void test_fixed_InstantZoneId() { Clock test = Clock.fixed(INSTANT, PARIS); diff --git a/jdk/test/java/time/tck/java/time/TCKClock_Offset.java b/jdk/test/java/time/tck/java/time/TCKClock_Offset.java index 3bab2acd52f..644c1a63880 100644 --- a/jdk/test/java/time/tck/java/time/TCKClock_Offset.java +++ b/jdk/test/java/time/tck/java/time/TCKClock_Offset.java @@ -62,7 +62,6 @@ package tck.java.time; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; -import java.io.IOException; import java.time.Clock; import java.time.Duration; import java.time.Instant; @@ -83,11 +82,6 @@ public class TCKClock_Offset extends AbstractTCKTest { private static final Instant INSTANT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)).toInstant(); private static final Duration OFFSET = Duration.ofSeconds(2); - //----------------------------------------------------------------------- - public void test_isSerializable() throws IOException, ClassNotFoundException { - assertSerializable(Clock.offset(Clock.system(PARIS), OFFSET)); - } - //----------------------------------------------------------------------- public void test_offset_ClockDuration() { Clock test = Clock.offset(Clock.fixed(INSTANT, PARIS), OFFSET); diff --git a/jdk/test/java/time/tck/java/time/TCKClock_System.java b/jdk/test/java/time/tck/java/time/TCKClock_System.java index b5440b2bfd5..94f3b57a4aa 100644 --- a/jdk/test/java/time/tck/java/time/TCKClock_System.java +++ b/jdk/test/java/time/tck/java/time/TCKClock_System.java @@ -62,7 +62,6 @@ package tck.java.time; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; -import java.io.IOException; import java.time.Clock; import java.time.Instant; import java.time.ZoneId; @@ -79,13 +78,6 @@ public class TCKClock_System extends AbstractTCKTest { private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow"); private static final ZoneId PARIS = ZoneId.of("Europe/Paris"); - //----------------------------------------------------------------------- - public void test_isSerializable() throws IOException, ClassNotFoundException { - assertSerializable(Clock.systemUTC()); - assertSerializable(Clock.systemDefaultZone()); - assertSerializable(Clock.system(PARIS)); - } - //----------------------------------------------------------------------- public void test_instant() { Clock system = Clock.systemUTC(); diff --git a/jdk/test/java/time/tck/java/time/TCKClock_Tick.java b/jdk/test/java/time/tck/java/time/TCKClock_Tick.java index b245d143ccb..c2212373cd8 100644 --- a/jdk/test/java/time/tck/java/time/TCKClock_Tick.java +++ b/jdk/test/java/time/tck/java/time/TCKClock_Tick.java @@ -62,7 +62,6 @@ package tck.java.time; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; -import java.io.IOException; import java.time.Clock; import java.time.Duration; import java.time.Instant; @@ -81,16 +80,7 @@ public class TCKClock_Tick extends AbstractTCKTest { private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow"); private static final ZoneId PARIS = ZoneId.of("Europe/Paris"); - private static final Duration AMOUNT = Duration.ofSeconds(2); private static final ZonedDateTime ZDT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)); - private static final Instant INSTANT = ZDT.toInstant(); - - //----------------------------------------------------------------------- - public void test_isSerializable() throws IOException, ClassNotFoundException { - assertSerializable(Clock.tickSeconds(PARIS)); - assertSerializable(Clock.tickMinutes(MOSCOW)); - assertSerializable(Clock.tick(Clock.fixed(INSTANT, PARIS), AMOUNT)); - } //----------------------------------------------------------------------- public void test_tick_ClockDuration_250millis() { diff --git a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java index eca228adecb..6377c1fc421 100644 --- a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java +++ b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java @@ -354,4 +354,27 @@ public final class CopticDate .append(dom < 10 ? "-0" : "-").append(dom); return buf.toString(); } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof CopticDate) { + CopticDate cd = (CopticDate)obj; + if (this.prolepticYear == cd.prolepticYear && + this.month == cd.month && + this.day == cd.day) { + return true; + } + } + return false; + } + + @Override + public int hashCode() { + long epDay = toEpochDay(); + return getChronology().hashCode() ^ ((int) (epDay ^ (epDay >>> 32))); + } + } diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java index 3b89857fa45..b2b7fc2cc6c 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java @@ -320,24 +320,6 @@ public class TCKChronoZonedDateTime { } } - //----------------------------------------------------------------------- - // Test Serialization of ISO via chrono API - //----------------------------------------------------------------------- - @Test( dataProvider="calendars") - public void test_ChronoZonedDateTimeSerialization(Chronology chrono) throws Exception { - ZonedDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3).atZone(ZoneId.of("GMT+01:23")); - ChronoZonedDateTime orginal = chrono.date(ref).atTime(ref.toLocalTime()).atZone(ref.getZone()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - @SuppressWarnings("unchecked") - ChronoZonedDateTime ser = (ChronoZonedDateTime) in.readObject(); - assertEquals(ser, orginal, "deserialized date is wrong"); - } - //----------------------------------------------------------------------- @Test(dataProvider="calendars") public void test_from_TemporalAccessor(Chronology chrono) { diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java index 363f2b94044..38f85fe08ac 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java @@ -64,7 +64,6 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; -import java.util.Locale; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; @@ -338,20 +337,4 @@ public class TCKChronology { Chronology chrono = Chronology.of("FooFoo"); } - //----------------------------------------------------------------------- - // serialization; serialize and check each calendar system - //----------------------------------------------------------------------- - @Test(dataProvider = "calendarNameAndType") - public void test_chronoSerializationSingleton(String id, String _calendarType) throws Exception { - Chronology original = Chronology.of(id); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(original); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - Chronology ser = (Chronology) in.readObject(); - assertEquals(ser, original, "Deserialized Chronology is not correct"); - } - } diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java b/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java index b67f01185aa..1518c0cde29 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java @@ -60,10 +60,6 @@ package tck.java.time.chrono; import static org.testng.Assert.assertEquals; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.time.LocalDate; import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; @@ -78,29 +74,11 @@ import org.testng.annotations.Test; public class TCKTestServiceLoader { @Test - public void test_CopticServiceLoader() { + public void test_TestServiceLoader() { Chronology chrono = Chronology.of("Coptic"); ChronoLocalDate copticDate = chrono.date(1729, 4, 27); LocalDate ld = LocalDate.from(copticDate); assertEquals(ld, LocalDate.of(2013, 1, 5), "CopticDate does not match LocalDate"); } - - //----------------------------------------------------------------------- - // Test Serialization of Loaded Coptic Calendar - //----------------------------------------------------------------------- - @Test - public void test_ChronoSerialization() throws Exception { - Chronology chrono = Chronology.of("Coptic"); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(chrono); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - - ObjectInputStream in = new ObjectInputStream(bais); - @SuppressWarnings("unchecked") - Chronology ser = (Chronology) in.readObject(); - assertEquals(ser, chrono, "deserialized Chronology is wrong"); - } } diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java new file mode 100644 index 00000000000..af6e9fb2e02 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono.serial; + +import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoField.YEAR; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.ObjectStreamConstants; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.HijrahChronology; +import java.time.chrono.HijrahDate; +import java.time.chrono.JapaneseDate; +import java.time.chrono.JapaneseEra; +import java.time.chrono.MinguoDate; +import java.time.chrono.ThaiBuddhistDate; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + + + +import tck.java.time.AbstractTCKTest; + +/** + * Test serialization of built-in chronologies. + */ +@Test +public class TCKChronoLocalDateSerialization extends AbstractTCKTest { + + static final int CHRONO_TYPE = 1; // java.time.chrono.Ser.CHRONO_TYPE + static final int JAPANESE_DATE_TYPE = 4; // java.time.chrono.Ser.JAPANESE_DATE_TYPE + static final int HIJRAH_DATE_TYPE = 6; // java.time.chrono.Ser.HIJRAH_DATE_TYPE + static final int MINGUO_DATE_TYPE = 7; // java.time.chrono.Ser.MINGUO_DATE_TYPE + static final int THAIBUDDHIST_DATE_TYPE = 8; // java.time.chrono.Ser.THAIBUDDHIST_DATE_TYPE + + //----------------------------------------------------------------------- + // Regular data factory for names and descriptions of available calendars + //----------------------------------------------------------------------- + @DataProvider(name = "calendars") + Object[][] data_of_calendars() { + return new Object[][]{ + {JapaneseDate.of(JapaneseEra.HEISEI, 25, 01, 05), JAPANESE_DATE_TYPE}, + {MinguoDate.of(102, 01, 05), MINGUO_DATE_TYPE}, + {ThaiBuddhistDate.of(2556, 01, 05), THAIBUDDHIST_DATE_TYPE}, + }; + } + + + //----------------------------------------------------------------------- + // Test Serialization of Calendars + //----------------------------------------------------------------------- + @Test( dataProvider="calendars") + public void test_ChronoSerialization(ChronoLocalDate date, int dateType) throws Exception { + assertSerializable(date); + } + + //----------------------------------------------------------------------- + // Test that serialization produces exact sequence of bytes + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + private void test_serialization_format(ChronoLocalDate date, int dateType) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(dateType); + dos.writeInt(date.get(YEAR)); + dos.writeByte(date.get(MONTH_OF_YEAR)); + dos.writeByte(date.get(DAY_OF_MONTH)); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(date, bytes); + } + + //----------------------------------------------------------------------- + // Test HijrajDate serialization is a type, Chronology, year, month, day + //----------------------------------------------------------------------- + @Test() + public void test_hijrahSerialization_format() throws Exception { + HijrahChronology chrono = HijrahChronology.INSTANCE; + HijrahDate date = HijrahDate.of(1433, 10, 29); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + // Expect the type of the HijrahDate in the stream + byte[] hijrahDateBytes = new byte[] {HIJRAH_DATE_TYPE}; + + // Literal reference to Hijrah-Umalqura Chronology + byte[] hijrahChronoBytes = new byte[] { + 115, 113, 0, 126, 0, 0, /* p w \u0001 \u0006 s q \u0000 ~ \u0000 \u0000 */ + 119, 18, 1, 0, 15, 72, 105, 106, 114, 97, /* w \u0012 \u0001 \u0000 \u000f H i j r a */ + 104, 45, 117, 109, 97, 108, 113, 117, 114, 97, /* h - u m a l q u r a */ + 120, /* \u001d x */ + }; + + // Build the sequence that represents the data in the stream + baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA); + dos.writeByte(6); // 6 bytes follow + dos.writeInt(date.get(YEAR)); + dos.writeByte(date.get(MONTH_OF_YEAR)); + dos.writeByte(date.get(DAY_OF_MONTH)); + dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); + } + byte[] dateBytes = baos.toByteArray(); + + assertSerializedBySer(date, hijrahDateBytes, hijrahChronoBytes, dateBytes); + } +} diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java similarity index 78% rename from jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java rename to jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java index 1ab1cda92c5..8da904b41c8 100644 --- a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java @@ -59,21 +59,23 @@ package tck.java.time.chrono.serial; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.chrono.*; +import java.time.chrono.ChronoLocalDateTime; +import java.time.chrono.Chronology; +import java.time.chrono.HijrahChronology; +import java.time.chrono.IsoChronology; +import java.time.chrono.JapaneseChronology; +import java.time.chrono.MinguoChronology; +import java.time.chrono.ThaiBuddhistChronology; -import static org.testng.Assert.assertEquals; +import tck.java.time.AbstractTCKTest; /** - * Test assertions that must be true for all built-in chronologies. + * Test serialization of ChronoLocalDateTime for all built-in chronologies. */ @Test -public class TCKChronoLocalDateTime { +public class TCKChronoLocalDateTimeSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- // regular data factory for available calendars @@ -89,22 +91,13 @@ public class TCKChronoLocalDateTime { } //----------------------------------------------------------------------- - // Test Serialization ZonedDateTime for each Chronology + // Test Serialization of ChronoLocalDateTime //----------------------------------------------------------------------- - @Test( dataProvider="calendars") + @Test(dataProvider="calendars") public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception { LocalDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3); - ChronoLocalDateTime orginal = chrono.date(ref).atTime(ref.toLocalTime()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - ChronoLocalDateTime ser = (ChronoLocalDateTime) in.readObject(); - assertEquals(ser, orginal, "deserialized date is wrong"); + ChronoLocalDateTime original = chrono.date(ref).atTime(ref.toLocalTime()); + assertSerializable(original); } - //----------------------------------------------------------------------- - } diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java similarity index 77% rename from jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java rename to jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java index 4bec5cdc952..c941453a969 100644 --- a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDate.java +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java @@ -56,23 +56,25 @@ */ package tck.java.time.chrono.serial; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.chrono.ChronoZonedDateTime; +import java.time.chrono.Chronology; +import java.time.chrono.HijrahChronology; +import java.time.chrono.IsoChronology; +import java.time.chrono.JapaneseChronology; +import java.time.chrono.MinguoChronology; +import java.time.chrono.ThaiBuddhistChronology; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.time.LocalDate; -import java.time.chrono.*; - -import static org.testng.Assert.assertEquals; +import tck.java.time.AbstractTCKTest; /** * Test assertions that must be true for all built-in chronologies. */ @Test -public class TCKChronoLocalDate { +public class TCKChronoZonedDateTimeSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- // regular data factory for names and descriptions of available calendars @@ -84,28 +86,18 @@ public class TCKChronoLocalDate { {IsoChronology.INSTANCE}, {JapaneseChronology.INSTANCE}, {MinguoChronology.INSTANCE}, - {ThaiBuddhistChronology.INSTANCE}}; + {ThaiBuddhistChronology.INSTANCE}, + }; } - //----------------------------------------------------------------------- - // Test Serialization of Calendars + // Test Serialization of ISO via chrono API //----------------------------------------------------------------------- @Test( dataProvider="calendars") - public void test_ChronoSerialization(Chronology chrono) throws Exception { - LocalDate ref = LocalDate.of(2013, 1, 5); - ChronoLocalDate orginal = chrono.date(ref); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - @SuppressWarnings("unchecked") - ChronoLocalDate ser = (ChronoLocalDate) in.readObject(); - assertEquals(ser, orginal, "deserialized date is wrong"); + public void test_ChronoZonedDateTimeSerialization(Chronology chrono) throws Exception { + ZonedDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3).atZone(ZoneId.of("GMT+01:23")); + ChronoZonedDateTime original = chrono.date(ref).atTime(ref.toLocalTime()).atZone(ref.getZone()); + assertSerializable(original); } - //----------------------------------------------------------------------- - } diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java index aed919adafa..7f9e30d35c5 100644 --- a/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java @@ -56,13 +56,9 @@ */ package tck.java.time.chrono.serial; -import static org.testng.Assert.assertEquals; - -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintStream; +import java.io.DataOutputStream; + import java.time.chrono.Chronology; import java.time.chrono.HijrahChronology; import java.time.chrono.IsoChronology; @@ -73,11 +69,15 @@ import java.time.chrono.ThaiBuddhistChronology; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + @Test -public class TCKChronologySerialization { +public class TCKChronologySerialization extends AbstractTCKTest { + + static final int CHRONO_TYPE = 1; // java.time.chrono.Ser.CHRONO_TYPE //----------------------------------------------------------------------- - // regular data factory for names and descriptions of available calendars + // Regular data factory for available calendars //----------------------------------------------------------------------- @DataProvider(name = "calendars") Chronology[][] data_of_calendars() { @@ -93,44 +93,22 @@ public class TCKChronologySerialization { // Test Serialization of Calendars //----------------------------------------------------------------------- @Test(dataProvider="calendars") - public void test_ChronoSerialization(Chronology chrono) throws Exception { - System.out.printf(" ChronoSerialization: %s%n", chrono); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(chrono); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - - ObjectInputStream in = new ObjectInputStream(bais); - @SuppressWarnings("unchecked") - Chronology ser = (Chronology) in.readObject(); - assertEquals(ser, chrono, "deserialized Chronology is wrong"); + public void test_chronoSerialization(Chronology chrono) throws Exception { + assertSerializable(chrono); } - /** - * Utility method to dump a byte array in a java syntax. - * @param bytes and array of bytes - * @param os the outputstream to receive the output. - */ - static void dumpSerialStream(byte[] bytes, PrintStream os) { - os.printf(" byte[] bytes = {" ); - final int linelen = 10; - for (int i = 0; i < bytes.length; i++) { - if (i % linelen == 0) { - os.printf("%n "); - } - os.printf(" %3d,", bytes[i] & 0xff); - if ((i % linelen) == (linelen-1) || i == bytes.length - 1) { - os.printf(" /*"); - int s = i / linelen * linelen; - int k = i % linelen; - for (int j = 0; j <= k && s + j < bytes.length; j++) { - os.printf(" %c", bytes[s + j] & 0xff); - } - os.printf(" */"); - } + //----------------------------------------------------------------------- + // Test that serialization produces exact sequence of bytes + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + private void test_serializationBytes(Chronology chrono) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(CHRONO_TYPE); + dos.writeUTF(chrono.getId()); } - os.printf("%n };%n"); + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(chrono, bytes); } } diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java new file mode 100644 index 00000000000..0fc489ee27c --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono.serial; + +import java.io.IOException; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.Chronology; + +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + +/** + * Tests the serialization of ChronoLocalDate using a CopticDate. + */ +@Test +public class TCKCopticSerialization extends AbstractTCKTest { + + @Test + public void test_eraSerialization() throws IOException, ClassNotFoundException { + Chronology chrono = Chronology.of("Coptic"); + ChronoLocalDate copticDate = chrono.date(1729, 4, 27); + assertSerializable(copticDate); + } + +} diff --git a/jdk/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java b/jdk/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java new file mode 100644 index 00000000000..8df56baa8ef --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono.serial; + + +import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoField.YEAR; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.Era; +import java.time.chrono.HijrahEra; +import java.time.chrono.IsoEra; +import java.time.chrono.JapaneseEra; +import java.time.chrono.MinguoEra; +import java.time.chrono.ThaiBuddhistEra; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Tests the built-in Eras are serializable. + * Note that the serialized form of IsoEra, MinguoEra, ThaiBuddhistEra, + * and HijrahEra are defined and provided by Enum. + * The serialized form of these types are not tested, only that they are + * serializable. + */ +@Test +public class TCKEraSerialization extends AbstractTCKTest { + + static final int JAPANESE_ERA_TYPE = 5; // java.time.chrono.Ser.JAPANESE_ERA + + + //----------------------------------------------------------------------- + // Regular data factory for the available Eras + //----------------------------------------------------------------------- + @DataProvider(name = "Eras") + Era[][] data_of_calendars() { + return new Era[][] { + {HijrahEra.AH}, + {IsoEra.BCE}, + {IsoEra.CE}, + {MinguoEra.BEFORE_ROC}, + {MinguoEra.ROC}, + {ThaiBuddhistEra.BEFORE_BE}, + {ThaiBuddhistEra.BE}, + }; + } + + @Test(dataProvider="Eras") + public void test_eraSerialization(Era era) throws IOException, ClassNotFoundException { + assertSerializableSame(era); + } + + //----------------------------------------------------------------------- + // Test JapaneseEra serialization produces exact sequence of bytes + //----------------------------------------------------------------------- + @Test + private void test_JapaneseErasSerialization() throws Exception { + for (JapaneseEra era : JapaneseEra.values()) { + assertSerializableSame(era); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (DataOutputStream dos = new DataOutputStream(baos) ) { + dos.writeByte(JAPANESE_ERA_TYPE); + dos.writeByte(era.getValue()); + } + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(era, bytes); + } + } + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKClockSerialization.java b/jdk/test/java/time/tck/java/time/serial/TCKClockSerialization.java new file mode 100644 index 00000000000..d3ef560fb3f --- /dev/null +++ b/jdk/test/java/time/tck/java/time/serial/TCKClockSerialization.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012 Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.serial; + + +import java.io.IOException; +import java.time.Clock; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; + +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Test system and offset clocks serialization. + */ +@Test +public class TCKClockSerialization extends AbstractTCKTest { + + private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow"); + private static final ZoneId PARIS = ZoneId.of("Europe/Paris"); + + private static final Duration AMOUNT = Duration.ofSeconds(2); + private static final ZonedDateTime ZDT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)); + private static final Instant INSTANT = ZDT.toInstant(); + + //----------------------------------------------------------------------- + public void test_systemClockSerializable() throws IOException, ClassNotFoundException { + assertSerializable(Clock.systemUTC()); + assertSerializable(Clock.systemDefaultZone()); + assertSerializable(Clock.system(PARIS)); + } + + //----------------------------------------------------------------------- + public void test_offsetClockSerializable() throws IOException, ClassNotFoundException { + assertSerializable(Clock.offset(Clock.system(PARIS), AMOUNT)); + } + + //----------------------------------------------------------------------- + public void test_tickClockSerializable() throws IOException, ClassNotFoundException { + assertSerializable(Clock.tickSeconds(PARIS)); + assertSerializable(Clock.tickMinutes(MOSCOW)); + assertSerializable(Clock.tick(Clock.fixed(INSTANT, PARIS), AMOUNT)); + } + + //----------------------------------------------------------------------- + public void test_fixedClockSerializable() throws IOException, ClassNotFoundException { + assertSerializable(Clock.fixed(INSTANT, ZoneOffset.UTC)); + assertSerializable(Clock.fixed(INSTANT, PARIS)); + } + +} diff --git a/jdk/test/java/time/tck/java/time/serial/TCKDuration.java b/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java similarity index 83% rename from jdk/test/java/time/tck/java/time/serial/TCKDuration.java rename to jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java index e4a9a3f9a18..15d079b9b41 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKDuration.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java @@ -59,18 +59,28 @@ */ package tck.java.time.serial; +import static org.testng.Assert.assertTrue; + import org.testng.annotations.Test; import tck.java.time.AbstractTCKTest; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; +import java.io.Serializable; import java.time.Duration; /** - * Test Duration. + * Test Duration serialization. */ @Test -public class TCKDuration extends AbstractTCKTest { +public class TCKDurationSerialization extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @Test + public void test_interfaces() { + assertTrue(Serializable.class.isAssignableFrom(Duration.class)); + assertTrue(Comparable.class.isAssignableFrom(Duration.class)); + } //----------------------------------------------------------------------- @Test @@ -92,4 +102,12 @@ public class TCKDuration extends AbstractTCKTest { assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes); } + //----------------------------------------------------------------------- + // serialization + //----------------------------------------------------------------------- + @Test + public void test_deserializationSingleton() throws Exception { + assertSerializableSame(Duration.ZERO); + } + } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKInstant.java b/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKInstant.java rename to jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java index 783ad586375..34a7a513797 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKInstant.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java @@ -68,10 +68,10 @@ import java.io.DataOutputStream; import java.time.Instant; /** - * Test Instant. + * Test Instant serialization. */ @Test -public class TCKInstant extends AbstractTCKTest { +public class TCKInstantSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- @Test diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java similarity index 96% rename from jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java rename to jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java index aeaa96d372d..c42fa5ece91 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKLocalDate.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java @@ -68,10 +68,10 @@ import java.io.DataOutputStream; import java.time.LocalDate; /** - * Test LocalDate. + * Test LocalDate serialization. */ @Test -public class TCKLocalDate extends AbstractTCKTest { +public class TCKLocalDateSerialization extends AbstractTCKTest { private LocalDate TEST_2007_07_15; @@ -102,6 +102,4 @@ public class TCKLocalDate extends AbstractTCKTest { assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes); } - //----------------------------------------------------------------------- - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java rename to jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java index a2ae9d2357c..aa739768808 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java @@ -67,10 +67,10 @@ import java.io.DataOutputStream; import java.time.LocalDateTime; /** - * Test LocalDateTime. + * Test serialization of LocalDateTime. */ @Test -public class TCKLocalDateTime extends AbstractTCKTest { +public class TCKLocalDateTimeSerialization extends AbstractTCKTest { private LocalDateTime TEST_2007_07_15_12_30_40_987654321 = LocalDateTime.of(2007, 7, 15, 12, 30, 40, 987654321); @@ -99,6 +99,4 @@ public class TCKLocalDateTime extends AbstractTCKTest { assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes); } - - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java b/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java similarity index 98% rename from jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java rename to jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java index 06f2ce4c898..d78de651877 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKLocalTime.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java @@ -68,10 +68,10 @@ import java.io.DataOutputStream; import java.time.LocalTime; /** - * Test LocalTime. + * Test LocalTime serialization. */ @Test -public class TCKLocalTime extends AbstractTCKTest { +public class TCKLocalTimeSerialization extends AbstractTCKTest { private LocalTime TEST_12_30_40_987654321; diff --git a/jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java b/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java similarity index 96% rename from jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java rename to jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java index cd441663099..8650e7e641e 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKMonthDay.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java @@ -69,10 +69,10 @@ import java.io.IOException; import java.time.MonthDay; /** - * Test MonthDay. + * Test MonthDay serialization. */ @Test -public class TCKMonthDay extends AbstractTCKTest { +public class TCKMonthDaySerialization extends AbstractTCKTest { private MonthDay TEST_07_15; @@ -81,8 +81,6 @@ public class TCKMonthDay extends AbstractTCKTest { TEST_07_15 = MonthDay.of(7, 15); } - - //----------------------------------------------------------------------- @Test public void test_serialization() throws ClassNotFoundException, IOException { @@ -101,7 +99,4 @@ public class TCKMonthDay extends AbstractTCKTest { assertSerializedBySer(MonthDay.of(9, 16), bytes); } - //----------------------------------------------------------------------- - - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java similarity index 96% rename from jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java rename to jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java index 8a1406b8727..371014f5e5c 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTime.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java @@ -70,10 +70,10 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; /** - * Test OffsetDateTime. + * Test OffsetDateTime serialization. */ @Test -public class TCKOffsetDateTime extends AbstractTCKTest { +public class TCKOffsetDateTimeSerialization extends AbstractTCKTest { private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); private OffsetDateTime TEST_2008_6_30_11_30_59_000000500; @@ -83,9 +83,6 @@ public class TCKOffsetDateTime extends AbstractTCKTest { TEST_2008_6_30_11_30_59_000000500 = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 500, OFFSET_PONE); } - //----------------------------------------------------------------------- - - //----------------------------------------------------------------------- @Test public void test_serialization() throws Exception { diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java rename to jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java index 6bdddba2fb3..ee04e1e298f 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTime.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java @@ -69,10 +69,10 @@ import java.time.OffsetTime; import java.time.ZoneOffset; /** - * Test OffsetTime. + * Test OffsetTime serialization. */ @Test -public class TCKOffsetTime extends AbstractTCKTest { +public class TCKOffsetTimeSerialization extends AbstractTCKTest { private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); private OffsetTime TEST_11_30_59_500_PONE; diff --git a/jdk/test/java/time/tck/java/time/serial/TCKPeriod.java b/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKPeriod.java rename to jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java index 2f94df132f0..57bb92f7dce 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKPeriod.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java @@ -65,10 +65,10 @@ import tck.java.time.AbstractTCKTest; import java.time.Period; /** - * Test Period. + * Test serialization of Period. */ @Test -public class TCKPeriod extends AbstractTCKTest { +public class TCKPeriodSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- @Test @@ -78,5 +78,4 @@ public class TCKPeriod extends AbstractTCKTest { assertSerializable(Period.of(1, 2, 3)); } - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java b/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java similarity index 96% rename from jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java rename to jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java index 675767d976c..878b1639725 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKYearMonth.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java @@ -69,10 +69,10 @@ import java.io.IOException; import java.time.YearMonth; /** - * Test YearMonth. + * Test serialization of YearMonth. */ @Test -public class TCKYearMonth extends AbstractTCKTest { +public class TCKYearMonthSerialization extends AbstractTCKTest { private YearMonth TEST_2008_06; @@ -100,7 +100,4 @@ public class TCKYearMonth extends AbstractTCKTest { assertSerializedBySer(YearMonth.of(2012, 9), bytes); } - //----------------------------------------------------------------------- - - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKYear.java b/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKYear.java rename to jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java index 954dacf0c99..12f3955dcc4 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKYear.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java @@ -67,10 +67,10 @@ import java.io.DataOutputStream; import java.time.Year; /** - * Test Year. + * Test Year serialization. */ @Test -public class TCKYear extends AbstractTCKTest { +public class TCKYearSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- @Test diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZoneId.java b/jdk/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java similarity index 99% rename from jdk/test/java/time/tck/java/time/serial/TCKZoneId.java rename to jdk/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java index 26923f12a80..c6f3abee38c 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKZoneId.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java @@ -73,10 +73,10 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; /** - * Test ZoneId. + * Test serialization of ZoneId. */ @Test -public class TCKZoneId extends AbstractTCKTest { +public class TCKZoneIdSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- @Test diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java rename to jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java index 61196e909a1..223d466fcb3 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKZoneOffset.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java @@ -67,10 +67,10 @@ import java.io.DataOutputStream; import java.time.ZoneOffset; /** - * Test ZoneOffset. + * Test serialization of ZoneOffset. */ @Test -public class TCKZoneOffset extends AbstractTCKTest { +public class TCKZoneOffsetSerialization extends AbstractTCKTest { diff --git a/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java similarity index 98% rename from jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java rename to jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java index a44946b7450..bde33acc04b 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTime.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java @@ -72,10 +72,10 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; /** - * Test ZonedDateTime. + * Test serialization of ZonedDateTime. */ @Test -public class TCKZonedDateTime extends AbstractTCKTest { +public class TCKZonedDateTimeSerialization extends AbstractTCKTest { private static final ZoneOffset OFFSET_0100 = ZoneOffset.ofHours(1); private static final ZoneId ZONE_0100 = OFFSET_0100; @@ -139,5 +139,4 @@ public class TCKZonedDateTime extends AbstractTCKTest { assertSerializedBySer(zdt, bytes); } - } diff --git a/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java b/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java index 711792fbedb..a15c31dd2c7 100644 --- a/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java +++ b/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java @@ -76,7 +76,7 @@ import org.testng.annotations.Test; import tck.java.time.AbstractTCKTest; /** - * Test. + * Test Julian Fields. */ @Test public class TCKJulianFields extends AbstractTCKTest { @@ -86,16 +86,6 @@ public class TCKJulianFields extends AbstractTCKTest { private static final LocalDate NOV12_1945 = LocalDate.of(1945, 11, 12); private static final LocalDate JAN01_0001 = LocalDate.of(1, 1, 1); - //----------------------------------------------------------------------- - @DataProvider(name="julian_fields") - Object[][] julian_samples() { - return new Object[][] { - {JulianFields.JULIAN_DAY}, - {JulianFields.MODIFIED_JULIAN_DAY}, - {JulianFields.RATA_DIE}, - }; - } - @DataProvider(name="samples") Object[][] data_samples() { return new Object[][] { @@ -122,11 +112,6 @@ public class TCKJulianFields extends AbstractTCKTest { } //----------------------------------------------------------------------- - @Test(dataProvider="julian_fields") - public void test_serializable(TemporalField field) throws IOException, ClassNotFoundException { - assertSerializable(field); - } - public void test_basics() { assertEquals(JulianFields.JULIAN_DAY.isDateBased(), true); assertEquals(JulianFields.JULIAN_DAY.isTimeBased(), false); diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java new file mode 100644 index 00000000000..a80869dc775 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.temporal.serial; + +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; +import static java.time.temporal.ChronoField.AMPM_OF_DAY; +import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_AMPM; +import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_DAY; +import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.DAY_OF_WEEK; +import static java.time.temporal.ChronoField.DAY_OF_YEAR; +import static java.time.temporal.ChronoField.EPOCH_DAY; +import static java.time.temporal.ChronoField.HOUR_OF_AMPM; +import static java.time.temporal.ChronoField.HOUR_OF_DAY; +import static java.time.temporal.ChronoField.MICRO_OF_DAY; +import static java.time.temporal.ChronoField.MICRO_OF_SECOND; +import static java.time.temporal.ChronoField.MILLI_OF_DAY; +import static java.time.temporal.ChronoField.MILLI_OF_SECOND; +import static java.time.temporal.ChronoField.MINUTE_OF_DAY; +import static java.time.temporal.ChronoField.MINUTE_OF_HOUR; +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoField.NANO_OF_DAY; +import static java.time.temporal.ChronoField.NANO_OF_SECOND; +import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; +import static java.time.temporal.ChronoField.SECOND_OF_DAY; +import static java.time.temporal.ChronoField.SECOND_OF_MINUTE; +import static java.time.temporal.ChronoField.YEAR; +import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoField.ERA; + +import java.io.IOException; +import java.time.temporal.ChronoField; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Test serialization of ChronoField. + */ +@Test +public class TCKChronoFieldSerialization extends AbstractTCKTest { + + //----------------------------------------------------------------------- + // List of Fields + //----------------------------------------------------------------------- + @DataProvider(name="fieldBased") + Object[][] data_fieldBased() { + return new Object[][] { + {DAY_OF_WEEK}, + {ALIGNED_DAY_OF_WEEK_IN_MONTH}, + {ALIGNED_DAY_OF_WEEK_IN_YEAR}, + {DAY_OF_MONTH}, + {DAY_OF_YEAR}, + {EPOCH_DAY}, + {ALIGNED_WEEK_OF_MONTH}, + {ALIGNED_WEEK_OF_YEAR}, + {MONTH_OF_YEAR}, + {PROLEPTIC_MONTH}, + {YEAR_OF_ERA}, + {YEAR}, + {ERA}, + + {AMPM_OF_DAY}, + {CLOCK_HOUR_OF_DAY}, + {HOUR_OF_DAY}, + {CLOCK_HOUR_OF_AMPM}, + {HOUR_OF_AMPM}, + {MINUTE_OF_DAY}, + {MINUTE_OF_HOUR}, + {SECOND_OF_DAY}, + {SECOND_OF_MINUTE}, + {MILLI_OF_DAY}, + {MILLI_OF_SECOND}, + {MICRO_OF_DAY}, + {MICRO_OF_SECOND}, + {NANO_OF_DAY}, + {NANO_OF_SECOND}, + }; + } + + @Test(dataProvider = "fieldBased") + public void test_fieldSerializable(ChronoField field) throws IOException, ClassNotFoundException { + assertSerializableSame(field); + } + +} diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java new file mode 100644 index 00000000000..15e34c6a1b0 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.temporal.serial; + +import static java.time.temporal.ChronoUnit.CENTURIES; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.DECADES; +import static java.time.temporal.ChronoUnit.ERAS; +import static java.time.temporal.ChronoUnit.FOREVER; +import static java.time.temporal.ChronoUnit.HALF_DAYS; +import static java.time.temporal.ChronoUnit.HOURS; +import static java.time.temporal.ChronoUnit.MICROS; +import static java.time.temporal.ChronoUnit.MILLENNIA; +import static java.time.temporal.ChronoUnit.MILLIS; +import static java.time.temporal.ChronoUnit.MINUTES; +import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.NANOS; +import static java.time.temporal.ChronoUnit.SECONDS; +import static java.time.temporal.ChronoUnit.WEEKS; +import static java.time.temporal.ChronoUnit.YEARS; + +import java.io.IOException; +import java.time.temporal.ChronoUnit; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Test. + */ +@Test +public class TCKChronoUnitSerialization extends AbstractTCKTest { + + //----------------------------------------------------------------------- + // ChronoUnits + //----------------------------------------------------------------------- + @DataProvider(name="chronoUnit") + Object[][] data_chronoUnit() { + return new Object[][] { + {FOREVER}, + {ERAS}, + {MILLENNIA}, + {CENTURIES}, + {DECADES}, + {YEARS}, + {MONTHS}, + {WEEKS}, + {DAYS}, + + {HALF_DAYS}, + {HOURS}, + {MINUTES}, + {SECONDS}, + {MICROS}, + {MILLIS}, + {NANOS}, + + }; + } + + @Test(dataProvider = "chronoUnit") + public void test_unitType(ChronoUnit unit) throws IOException, ClassNotFoundException { + assertSerializableSame(unit); + } + +} diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java new file mode 100644 index 00000000000..53047f8441a --- /dev/null +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.temporal.serial; + +import java.io.IOException; +import java.time.temporal.JulianFields; +import java.time.temporal.TemporalField; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Test serialization of JulianFields + */ +@Test +public class TCKJulianFieldsSerialization extends AbstractTCKTest { + + //----------------------------------------------------------------------- + @DataProvider(name="julian_fields") + Object[][] julian_samples() { + return new Object[][] { + {JulianFields.JULIAN_DAY}, + {JulianFields.MODIFIED_JULIAN_DAY}, + {JulianFields.RATA_DIE}, + }; + } + + + //----------------------------------------------------------------------- + @Test(dataProvider="julian_fields") + public void test_serializable(TemporalField field) throws IOException, ClassNotFoundException { + assertSerializable(field); + } + +} diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java new file mode 100644 index 00000000000..9114bec6ca0 --- /dev/null +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.temporal.serial; + +import static org.testng.Assert.assertEquals; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.time.temporal.ValueRange; + +import org.testng.annotations.Test; + +import tck.java.time.AbstractTCKTest; + +/** + * Test serialization of ValueRange. + */ +@Test +public class TCKValueRangeSerialization extends AbstractTCKTest { + + //----------------------------------------------------------------------- + // Serialization + //----------------------------------------------------------------------- + public void test_serialization() throws Exception { + ValueRange range = ValueRange.of(1, 2, 3, 4); + assertSerializable(range); + } + + + /** + * Verify Serialized bytes of a ValueRange. + * @throws IOException if thrown during serialization is an unexpected test tailure + */ + public void test_valueRangeSerialized() throws IOException { + byte[] expected = { + (byte)172, (byte)237, 0, 5, 115, 114, 0, 29, 106, 97, /* \u00ac \u00ed \u0000 \u0005 s r \u0000 \u001d j a */ + 118, 97, 46, 116, 105, 109, 101, 46, 116, 101, /* v a . t i m e . t e */ + 109, 112, 111, 114, 97, 108, 46, 86, 97, 108, /* m p o r a l . V a l */ + 117, 101, 82, 97, 110, 103, 101, (byte)154, 113, (byte)169, /* u e R a n g e \u009a q \u00a9 */ + 86, (byte)242, (byte)205, 90, (byte)184, 2, 0, 4, 74, 0, /* V \u00f2 \u00cd Z \u00b8 \u0002 \u0000 \u0004 J \u0000 */ + 10, 109, 97, 120, 76, 97, 114, 103, 101, 115, /* m a x L a r g e s */ + 116, 74, 0, 11, 109, 97, 120, 83, 109, 97, /* t J \u0000 \u000b m a x S m a */ + 108, 108, 101, 115, 116, 74, 0, 10, 109, 105,/* l l e s t J \u0000 m i */ + 110, 76, 97, 114, 103, 101, 115, 116, 74, 0, /* n L a r g e s t J \u0000 */ + 11, 109, 105, 110, 83, 109, 97, 108, 108, 101, /* \u000b m i n S m a l l e */ + 115, 116, 120, 112, 0, 0, 0, 0, 0, 0, /* s t x p \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 */ + 0, 40, 0, 0, 0, 0, 0, 0, 0, 30, /* \u0000 ( \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u001e */ + 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, /* \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0014 \u0000 \u0000 */ + 0, 0, 0, 0, 0, 10, /* \u0000 \u0000 \u0000 \u0000 \u0000 */ + }; + + ValueRange range = ValueRange.of(10, 20, 30, 40); + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos) ) { + oos.writeObject(range); + + byte[] actual = baos.toByteArray(); + assertEquals(actual, expected, "Serialized bytes incorrect"); + } + } + +} diff --git a/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java rename to jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java index 749515e7c9d..43f45a84f22 100644 --- a/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFields.java +++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java @@ -65,10 +65,10 @@ import java.time.DayOfWeek; import java.time.temporal.WeekFields; /** - * Test WeekFields. + * Test serialization of WeekFields. */ @Test -public class TCKWeekFields extends AbstractTCKTest { +public class TCKWeekFieldsSerialization extends AbstractTCKTest { //----------------------------------------------------------------------- @Test(dataProvider="weekFields") diff --git a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java index 891deb76733..9cd42624bfa 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java @@ -127,7 +127,6 @@ public class TCKZoneOffsetTransition extends AbstractTCKTest { assertEquals(test.getOffsetBefore(), OFFSET_0200); assertEquals(test.getOffsetAfter(), OFFSET_0300); assertEquals(test.getDuration(), Duration.of(1, HOURS)); - assertSerializable(test); } @Test @@ -143,7 +142,6 @@ public class TCKZoneOffsetTransition extends AbstractTCKTest { assertEquals(test.getOffsetBefore(), OFFSET_0300); assertEquals(test.getOffsetAfter(), OFFSET_0200); assertEquals(test.getDuration(), Duration.of(-1, HOURS)); - assertSerializable(test); } diff --git a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java index 9ad26627edd..58e2ff56e7b 100644 --- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java +++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java @@ -173,7 +173,6 @@ public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { assertEquals(test.getStandardOffset(), OFFSET_0200); assertEquals(test.getOffsetBefore(), OFFSET_0200); assertEquals(test.getOffsetAfter(), OFFSET_0300); - assertSerializable(test); } @Test @@ -190,7 +189,6 @@ public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { assertEquals(test.getStandardOffset(), OFFSET_0200); assertEquals(test.getOffsetBefore(), OFFSET_0200); assertEquals(test.getOffsetAfter(), OFFSET_0300); - assertSerializable(test); } @Test @@ -207,7 +205,6 @@ public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { assertEquals(test.getStandardOffset(), OFFSET_0200); assertEquals(test.getOffsetBefore(), OFFSET_0200); assertEquals(test.getOffsetAfter(), OFFSET_0300); - assertSerializable(test); } diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java similarity index 97% rename from jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java rename to jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java index b5d88d4f983..790e54fbb6d 100644 --- a/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRules.java +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java @@ -72,10 +72,10 @@ import java.time.zone.ZoneRules; import static org.testng.Assert.assertEquals; /** - * Test ZoneRules for fixed offset time-zones. + * Test serialization of ZoneRules for fixed offset time-zones. */ @Test -public class TCKFixedZoneRules { +public class TCKFixedZoneRulesSerialization { private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1); private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2); diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java similarity index 77% rename from jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java rename to jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java index 1ccae56c8d9..9e4bf9b455e 100644 --- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRule.java +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java @@ -59,10 +59,7 @@ */ package tck.java.time.zone.serial; -import static org.testng.Assert.assertEquals; - import java.time.DayOfWeek; -import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Month; import java.time.ZoneOffset; @@ -73,17 +70,19 @@ import org.testng.annotations.Test; import tck.java.time.AbstractTCKTest; /** - * Test ZoneOffsetTransitionRule. + * Test ZoneOffsetTransitionRule serialization. */ @Test -public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { +public class TCKZoneOffsetTransitionRuleSerialization extends AbstractTCKTest { private static final LocalTime TIME_0100 = LocalTime.of(1, 0); private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2); private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3); - + //----------------------------------------------------------------------- + // Test serialization + //----------------------------------------------------------------------- @Test public void test_serialization_unusualOffsets() throws Exception { ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( @@ -110,5 +109,28 @@ public class TCKZoneOffsetTransitionRule extends AbstractTCKTest { assertSerializable(test); } + @Test + public void test_serialization_floatingWeek() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, + OFFSET_0200, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } + + @Test + public void test_serialization_floatingWeekBackwards() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, + OFFSET_0200, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } + + @Test + public void test_serialization_fixedDate() throws Exception { + ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of( + Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.WALL, + OFFSET_0200, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } } diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java similarity index 78% rename from jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java rename to jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java index a57d31eaf71..e70fc747d88 100644 --- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransition.java +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java @@ -59,6 +59,9 @@ */ package tck.java.time.zone.serial; +import static java.time.temporal.ChronoUnit.HOURS; + +import java.time.Duration; import org.testng.annotations.Test; import tck.java.time.AbstractTCKTest; @@ -68,10 +71,13 @@ import java.time.ZoneOffset; import java.time.zone.ZoneOffsetTransition; /** - * Test ZoneOffsetTransition. + * Test serialization of ZoneOffsetTransition. */ @Test -public class TCKZoneOffsetTransition extends AbstractTCKTest { +public class TCKZoneOffsetTransitionSerialization extends AbstractTCKTest { + + private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2); + private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3); //----------------------------------------------------------------------- @Test @@ -88,4 +94,20 @@ public class TCKZoneOffsetTransition extends AbstractTCKTest { assertSerializable(test); } + @Test + public void test_serialization_gap() throws Exception { + LocalDateTime before = LocalDateTime.of(2010, 3, 31, 1, 0); + LocalDateTime after = LocalDateTime.of(2010, 3, 31, 2, 0); + ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0200, OFFSET_0300); + assertSerializable(test); + } + + @Test + public void test_serialization_overlap() throws Exception { + LocalDateTime before = LocalDateTime.of(2010, 10, 31, 1, 0); + LocalDateTime after = LocalDateTime.of(2010, 10, 31, 0, 0); + ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0300, OFFSET_0200); + assertSerializable(test); + } + } diff --git a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java similarity index 98% rename from jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java rename to jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java index 6f83223f07c..80237967990 100644 --- a/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRules.java +++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java @@ -71,10 +71,10 @@ import java.time.zone.ZoneRules; import static org.testng.Assert.assertEquals; /** - * Test ZoneRules. + * Test serialization of ZoneRules. */ @Test -public class TCKZoneRules { +public class TCKZoneRulesSerialization { public void test_serialization_loaded() throws Exception { assertSerialization(europeLondon()); diff --git a/jdk/test/java/time/test/java/time/AbstractTest.java b/jdk/test/java/time/test/java/time/AbstractTest.java index 6d4d1340964..97f1cf4b486 100644 --- a/jdk/test/java/time/test/java/time/AbstractTest.java +++ b/jdk/test/java/time/test/java/time/AbstractTest.java @@ -63,11 +63,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -87,27 +82,6 @@ public abstract class AbstractTest { return true; } - protected static void assertSerializable(Object o) throws IOException, ClassNotFoundException { - Object deserialisedObject = writeThenRead(o); - assertEquals(deserialisedObject, o); - } - - protected static void assertSerializableAndSame(Object o) throws IOException, ClassNotFoundException { - Object deserialisedObject = writeThenRead(o); - assertSame(deserialisedObject, o); - } - - private static Object writeThenRead(Object o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) { - oos.writeObject(o); - } - - try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) { - return ois.readObject(); - } - } - protected static void assertImmutable(Class cls) { assertTrue(Modifier.isPublic(cls.getModifiers())); assertTrue(Modifier.isFinal(cls.getModifiers())); diff --git a/jdk/test/java/time/test/java/time/TestDuration.java b/jdk/test/java/time/test/java/time/TestDuration.java index 23aedd84aa5..2b2043377f3 100644 --- a/jdk/test/java/time/test/java/time/TestDuration.java +++ b/jdk/test/java/time/test/java/time/TestDuration.java @@ -63,11 +63,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; import java.time.Duration; import org.testng.annotations.Test; @@ -84,29 +79,6 @@ public class TestDuration extends AbstractTest { assertImmutable(Duration.class); } - //----------------------------------------------------------------------- - @Test - public void test_interfaces() { - assertTrue(Serializable.class.isAssignableFrom(Duration.class)); - assertTrue(Comparable.class.isAssignableFrom(Duration.class)); - } - - //----------------------------------------------------------------------- - // serialization - //----------------------------------------------------------------------- - @Test - public void test_deserializationSingleton() throws Exception { - Duration orginal = Duration.ZERO; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); - out.writeObject(orginal); - out.close(); - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); - Duration ser = (Duration) in.readObject(); - assertSame(ser, Duration.ZERO); - } - @Test public void plus_zeroReturnsThis() { Duration t = Duration.ofSeconds(-1); diff --git a/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java b/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java index 67a40839257..4fa31f23b69 100644 --- a/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java +++ b/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java @@ -87,19 +87,6 @@ public class TestDateTimeValueRange extends AbstractTest { assertImmutable(ValueRange.class); } - //----------------------------------------------------------------------- - // Serialization - //----------------------------------------------------------------------- - public void test_serialization() throws Exception { - Object obj = ValueRange.of(1, 2, 3, 4); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(obj); - oos.close(); - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); - assertEquals(ois.readObject(), obj); - } - //----------------------------------------------------------------------- // of(long,long) //----------------------------------------------------------------------- From f426e35d99b8c4f49f3b0b3068b480d5f8bb0517 Mon Sep 17 00:00:00 2001 From: Peter Allwin Date: Fri, 4 Oct 2013 15:00:42 +0200 Subject: [PATCH 103/983] 8025829: Add java/lang/instrument/RetransformBigClass.sh to problemlist Reviewed-by: sla, jbachorik --- jdk/test/ProblemList.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 984d431ef35..c8279529c28 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -134,6 +134,9 @@ java/lang/management/MemoryMXBean/LowMemoryTest2.sh generic-all # 8021230 java/lang/ThreadLocal/ThreadLocalSupplierTest.java generic-all +# 8023201 +java/lang/instrument/RetransformBigClass.sh generic-all +java/lang/instrument/RedefineBigClass.sh generic-all ############################################################################ From cbe29b7b72f02cdf21f51695d6cf87c51383bc60 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Fri, 4 Oct 2013 16:05:55 +0100 Subject: [PATCH 104/983] 8008296: keytool utility doesn't support '-importpassword' command Reviewed-by: weijun --- .../sun/security/tools/keytool/Main.java | 115 +++++++++-- .../sun/security/tools/keytool/Resources.java | 11 +- .../tools/keytool/StorePasswords.java | 186 ++++++++++++++++++ .../tools/keytool/StorePasswordsByShell.sh | 140 +++++++++++++ 4 files changed, 440 insertions(+), 12 deletions(-) create mode 100644 jdk/test/sun/security/tools/keytool/StorePasswords.java create mode 100644 jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/share/classes/sun/security/tools/keytool/Main.java index 02ea1d0497f..c5e0fe7d627 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java @@ -72,6 +72,8 @@ import sun.security.provider.certpath.CertStoreHelper; import sun.security.util.Password; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; import sun.security.pkcs.PKCS9Attribute; import sun.security.tools.KeyStoreUtil; @@ -190,6 +192,10 @@ public final class Main { KEYPASS, KEYSTORE, STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V), + IMPORTPASS("Imports.a.password", + ALIAS, KEYPASS, KEYALG, KEYSIZE, KEYSTORE, + STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS, + PROVIDERARG, PROVIDERPATH, V, PROTECTED), IMPORTKEYSTORE("Imports.one.or.all.entries.from.another.keystore", SRCKEYSTORE, DESTKEYSTORE, SRCSTORETYPE, DESTSTORETYPE, SRCSTOREPASS, DESTSTOREPASS, @@ -409,6 +415,8 @@ public final class Main { command = GENKEYPAIR; } else if (collator.compare(flags, "-import") == 0) { command = IMPORTCERT; + } else if (collator.compare(flags, "-importpassword") == 0) { + command = IMPORTPASS; } /* * Help @@ -727,6 +735,7 @@ public final class Main { command != GENSECKEY && command != IDENTITYDB && command != IMPORTCERT && + command != IMPORTPASS && command != IMPORTKEYSTORE && command != PRINTCRL) { throw new Exception(rb.getString @@ -808,6 +817,7 @@ public final class Main { command == GENKEYPAIR || command == GENSECKEY || command == IMPORTCERT || + command == IMPORTPASS || command == IMPORTKEYSTORE || command == KEYCLONE || command == CHANGEALIAS || @@ -958,6 +968,13 @@ public final class Main { } doGenSecretKey(alias, keyAlgName, keysize); kssave = true; + } else if (command == IMPORTPASS) { + if (keyAlgName == null) { + keyAlgName = "PBE"; + } + // password is stored as a secret key + doGenSecretKey(alias, keyAlgName, keysize); + kssave = true; } else if (command == IDENTITYDB) { if (filename != null) { try (InputStream inStream = new FileInputStream(filename)) { @@ -1419,6 +1436,43 @@ public final class Main { } return null; // PKCS11, MSCAPI, or -protected } + + /* + * Prompt the user for the password credential to be stored. + */ + private char[] promptForCredential() throws Exception { + // Handle password supplied via stdin + if (System.console() == null) { + char[] importPass = Password.readPassword(System.in); + passwords.add(importPass); + return importPass; + } + + int count; + for (count = 0; count < 3; count++) { + System.err.print( + rb.getString("Enter.the.password.to.be.stored.")); + System.err.flush(); + char[] entered = Password.readPassword(System.in); + passwords.add(entered); + System.err.print(rb.getString("Re.enter.password.")); + char[] passAgain = Password.readPassword(System.in); + passwords.add(passAgain); + if (!Arrays.equals(entered, passAgain)) { + System.err.println(rb.getString("They.don.t.match.Try.again")); + continue; + } + return entered; + } + + if (count == 3) { + throw new Exception(rb.getString + ("Too.many.failures.key.not.added.to.keystore")); + } + + return null; + } + /** * Creates a new secret key. */ @@ -1436,24 +1490,63 @@ public final class Main { throw new Exception(form.format(source)); } + // Use the keystore's default PBE algorithm for entry protection + boolean useDefaultPBEAlgorithm = true; SecretKey secKey = null; - KeyGenerator keygen = KeyGenerator.getInstance(keyAlgName); - if (keysize != -1) { - keygen.init(keysize); - } else if ("DES".equalsIgnoreCase(keyAlgName)) { - keygen.init(56); - } else if ("DESede".equalsIgnoreCase(keyAlgName)) { - keygen.init(168); + + if (keyAlgName.toUpperCase().startsWith("PBE")) { + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE"); + + // User is prompted for PBE credential + secKey = + factory.generateSecret(new PBEKeySpec(promptForCredential())); + + // Check whether a specific PBE algorithm was specified + if (!"PBE".equalsIgnoreCase(keyAlgName)) { + useDefaultPBEAlgorithm = false; + } + + if (verbose) { + MessageFormat form = new MessageFormat(rb.getString( + "Generated.keyAlgName.secret.key")); + Object[] source = + {useDefaultPBEAlgorithm ? "PBE" : secKey.getAlgorithm()}; + System.err.println(form.format(source)); + } } else { - throw new Exception(rb.getString - ("Please.provide.keysize.for.secret.key.generation")); + KeyGenerator keygen = KeyGenerator.getInstance(keyAlgName); + if (keysize == -1) { + if ("DES".equalsIgnoreCase(keyAlgName)) { + keysize = 56; + } else if ("DESede".equalsIgnoreCase(keyAlgName)) { + keysize = 168; + } else { + throw new Exception(rb.getString + ("Please.provide.keysize.for.secret.key.generation")); + } + } + keygen.init(keysize); + secKey = keygen.generateKey(); + + if (verbose) { + MessageFormat form = new MessageFormat(rb.getString + ("Generated.keysize.bit.keyAlgName.secret.key")); + Object[] source = {new Integer(keysize), + secKey.getAlgorithm()}; + System.err.println(form.format(source)); + } } - secKey = keygen.generateKey(); if (keyPass == null) { keyPass = promptForKeyPass(alias, null, storePass); } - keyStore.setKeyEntry(alias, secKey, keyPass, null); + + if (useDefaultPBEAlgorithm) { + keyStore.setKeyEntry(alias, secKey, keyPass, null); + } else { + keyStore.setEntry(alias, new KeyStore.SecretKeyEntry(secKey), + new KeyStore.PasswordProtection(keyPass, keyAlgName, null)); + } } /** diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources.java index 393aa3babe1..6199927ee44 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources.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 @@ -65,10 +65,16 @@ public class Resources extends java.util.ListResourceBundle { {"Generates.certificate.from.a.certificate.request", "Generates certificate from a certificate request"}, //-gencert {"Generates.CRL", "Generates CRL"}, //-gencrl + {"Generated.keyAlgName.secret.key", + "Generated {0} secret key"}, //-genseckey + {"Generated.keysize.bit.keyAlgName.secret.key", + "Generated {0}-bit {1} secret key"}, //-genseckey {"Imports.entries.from.a.JDK.1.1.x.style.identity.database", "Imports entries from a JDK 1.1.x-style identity database"}, //-identitydb {"Imports.a.certificate.or.a.certificate.chain", "Imports a certificate or a certificate chain"}, //-importcert + {"Imports.a.password", + "Imports a password"}, //-importpass {"Imports.one.or.all.entries.from.another.keystore", "Imports one or all entries from another keystore"}, //-importkeystore {"Clones.a.key.entry", @@ -220,6 +226,8 @@ public class Resources extends java.util.ListResourceBundle { {"Must.specify.alias", "Must specify alias"}, {"Keystore.password.must.be.at.least.6.characters", "Keystore password must be at least 6 characters"}, + {"Enter.the.password.to.be.stored.", + "Enter the password to be stored: "}, {"Enter.keystore.password.", "Enter keystore password: "}, {"Enter.source.keystore.password.", "Enter source keystore password: "}, {"Enter.destination.keystore.password.", "Enter destination keystore password: "}, @@ -328,6 +336,7 @@ public class Resources extends java.util.ListResourceBundle { {"New.prompt.", "New {0}: "}, {"Passwords.must.differ", "Passwords must differ"}, {"Re.enter.new.prompt.", "Re-enter new {0}: "}, + {"Re.enter.passpword.", "Re-enter password: "}, {"Re.enter.new.password.", "Re-enter new password: "}, {"They.don.t.match.Try.again", "They don't match. Try again"}, {"Enter.prompt.alias.name.", "Enter {0} alias name: "}, diff --git a/jdk/test/sun/security/tools/keytool/StorePasswords.java b/jdk/test/sun/security/tools/keytool/StorePasswords.java new file mode 100644 index 00000000000..e1f0c275b94 --- /dev/null +++ b/jdk/test/sun/security/tools/keytool/StorePasswords.java @@ -0,0 +1,186 @@ +/* + * 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 8008296 + * @summary Store and retrieve user passwords using PKCS#12 keystore + */ + +import java.io.*; +import java.security.*; +import java.util.*; +import javax.crypto.*; +import javax.crypto.spec.*; + +/* + * Store and retrieve passwords protected by a selection of PBE algorithms, + * using a PKCS#12 keystore. + */ +public class StorePasswords { + + private static final String[] PBE_ALGORITHMS = new String[] { + "default PBE algorithm", + "PBEWithMD5AndDES", + "PBEWithSHA1AndDESede", + "PBEWithSHA1AndRC2_40", + "PBEWithSHA1AndRC2_128", + "PBEWithSHA1AndRC4_40", + "PBEWithSHA1AndRC4_128", + "PBEWithHmacSHA1AndAES_128", + "PBEWithHmacSHA224AndAES_128", + "PBEWithHmacSHA256AndAES_128", + "PBEWithHmacSHA384AndAES_128", + "PBEWithHmacSHA512AndAES_128", + "PBEWithHmacSHA1AndAES_256", + "PBEWithHmacSHA224AndAES_256", + "PBEWithHmacSHA256AndAES_256", + "PBEWithHmacSHA384AndAES_256", + "PBEWithHmacSHA512AndAES_256" + }; + + private static final String KEYSTORE = "mykeystore.p12"; + private static final char[] KEYSTORE_PWD = "changeit".toCharArray(); + private static final char[] ENTRY_PWD = "protectit".toCharArray(); + private static final char[] USER_PWD = "hello1".toCharArray(); + + public static void main(String[] args) throws Exception { + + new File(KEYSTORE).delete(); + + int storeCount = store(); + int recoverCount = recover(); + + if (recoverCount != storeCount) { + throw new Exception("Stored " + storeCount + " user passwords, " + + "recovered " + recoverCount + " user passwords"); + } + System.out.println("\nStored " + storeCount + " user passwords, " + + "recovered " + recoverCount + " user passwords"); + } + + private static int store() throws Exception { + int count = 0; + // Load an empty PKCS#12 keystore + KeyStore keystore = KeyStore.getInstance("PKCS12"); + System.out.println("\nLoading PKCS#12 keystore..."); + keystore.load(null, null); + + // Derive a PBE key from the password + PBEKeySpec keySpec = new PBEKeySpec(USER_PWD); + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE"); + SecretKey key = factory.generateSecret(keySpec); + PBEParameterSpec specWithEightByteSalt = + new PBEParameterSpec("NaClNaCl".getBytes(), 1024); + + // Store the user password in a keystore entry (for each algorithm) + for (String algorithm : PBE_ALGORITHMS) { + + try { + System.out.println("Storing user password '" + + new String(USER_PWD) + "' (protected by " + algorithm + + ")"); + + if (algorithm.equals("default PBE algorithm")) { + keystore.setKeyEntry( + "this entry is protected by " + algorithm, key, + ENTRY_PWD, null); + } else { + keystore.setEntry( + "this entry is protected by " + algorithm, + new KeyStore.SecretKeyEntry(key), + new KeyStore.PasswordProtection(ENTRY_PWD, algorithm, + null)); + } + count++; + + } catch (KeyStoreException e) { + Throwable inner = e.getCause(); + if (inner instanceof UnrecoverableKeyException) { + Throwable inner2 = inner.getCause(); + if (inner2 instanceof InvalidAlgorithmParameterException) { + System.out.println("...re-trying due to: " + + inner2.getMessage()); + + // Some PBE algorithms demand an 8-byte salt + keystore.setEntry( + "this entry is protected by " + algorithm, + new KeyStore.SecretKeyEntry(key), + new KeyStore.PasswordProtection(ENTRY_PWD, + algorithm, specWithEightByteSalt)); + count++; + + } else if (inner2 instanceof InvalidKeyException) { + System.out.println("...skipping due to: " + + inner2.getMessage()); + // Unsupported crypto keysize + continue; + } + } else { + throw e; + } + } + } + + // Store the PKCS#12 keystore + System.out.println("Storing PKCS#12 keystore to: " + KEYSTORE); + keystore.store(new FileOutputStream(KEYSTORE), KEYSTORE_PWD); + + return count; + } + + private static int recover() throws Exception { + int count = 0; + // Load the PKCS#12 keystore + KeyStore keystore = KeyStore.getInstance("PKCS12"); + System.out.println("\nLoading PKCS#12 keystore from: " + KEYSTORE); + keystore.load(new FileInputStream(KEYSTORE), KEYSTORE_PWD); + + SecretKey key; + SecretKeyFactory factory; + PBEKeySpec keySpec; + + // Retrieve each user password from the keystore + for (String algorithm : PBE_ALGORITHMS) { + key = (SecretKey) keystore.getKey("this entry is protected by " + + algorithm, ENTRY_PWD); + + if (key != null) { + count++; + factory = SecretKeyFactory.getInstance(key.getAlgorithm()); + keySpec = + (PBEKeySpec) factory.getKeySpec(key, PBEKeySpec.class); + char[] pwd = keySpec.getPassword(); + System.out.println("Recovered user password '" + + new String(pwd) + "' (protected by " + algorithm + ")"); + + if (!Arrays.equals(USER_PWD, pwd)) { + throw new Exception("Failed to recover the user password " + + "protected by " + algorithm); + } + } + } + + return count; + } +} diff --git a/jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh b/jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh new file mode 100644 index 00000000000..7347f345878 --- /dev/null +++ b/jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh @@ -0,0 +1,140 @@ +# +# 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 8008296 +# @summary confirm that keytool correctly imports user passwords +# +# @run shell StorePasswordsByShell.sh + +# set a few environment variables so that the shell-script can run stand-alone +# in the source directory +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi + +if [ "${TESTCLASSES}" = "" ] ; then + TESTCLASSES="." +fi + +if [ "${TESTJAVA}" = "" ] ; then + echo "TESTJAVA not set. Test cannot execute." + echo "FAILED!!!" + exit 1 +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + SunOS ) + PATHSEP=":" + FILESEP="/" + ;; + Linux ) + PATHSEP=":" + FILESEP="/" + ;; + Darwin ) + PATHSEP=":" + FILESEP="/" + ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; + Windows* ) + PATHSEP=";" + FILESEP="\\" + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + +PBE_ALGORITHMS="\ + default-PBE-algorithm \ + PBEWithMD5AndDES \ + PBEWithSHA1AndDESede \ + PBEWithSHA1AndRC2_40 \ + PBEWithSHA1AndRC2_128 + PBEWithSHA1AndRC4_40 \ + PBEWithSHA1AndRC4_128 \ + PBEWithHmacSHA1AndAES_128 \ + PBEWithHmacSHA224AndAES_128 \ + PBEWithHmacSHA256AndAES_128 \ + PBEWithHmacSHA384AndAES_128 \ + PBEWithHmacSHA512AndAES_128 \ + PBEWithHmacSHA1AndAES_256 \ + PBEWithHmacSHA224AndAES_256 \ + PBEWithHmacSHA256AndAES_256 \ + PBEWithHmacSHA384AndAES_256 \ + PBEWithHmacSHA512AndAES_256" + +USER_PWD="hello1\n" +ALIAS_PREFIX="this entry is protected by " +COUNTER=0 + +# cleanup +rm mykeystore.p12 > /dev/null 2>&1 + +echo +for i in $PBE_ALGORITHMS; do + + if [ $i = "default-PBE-algorithm" ]; then + KEYALG="" + else + KEYALG="-keyalg ${i}" + fi + + if [ $COUNTER -lt 5 ]; then + IMPORTPASSWORD="-importpassword" + else + IMPORTPASSWORD="-importpass" + fi + + echo "Storing user password (protected by ${i})" + echo "${USER_PWD}" | \ + ${TESTJAVA}${FILESEP}bin${FILESEP}keytool ${IMPORTPASSWORD} \ + -storetype pkcs12 -keystore mykeystore.p12 -storepass changeit \ + -alias "${ALIAS_PREFIX}${i}" ${KEYALG} > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo Error + else + echo OK + COUNTER=`expr ${COUNTER} + 1` + fi +done +echo + +COUNTER2=`${TESTJAVA}${FILESEP}bin${FILESEP}keytool -list -storetype pkcs12 \ + -keystore mykeystore.p12 -storepass changeit | grep -c "${ALIAS_PREFIX}"` + +RESULT="stored ${COUNTER} user passwords, detected ${COUNTER2} user passwords" +if [ $COUNTER -ne $COUNTER2 -o $COUNTER -lt 11 ]; then + echo "ERROR: $RESULT" + exit 1 +else + echo "OK: $RESULT" + exit 0 +fi From c76298448522272938ff347e3210da58f90f74dd Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Thu, 29 Aug 2013 20:38:46 +0100 Subject: [PATCH 105/983] 8023764: Optimize Period addition Optimise plus/minus for common cases Reviewed-by: sherman --- jdk/src/share/classes/java/time/LocalDate.java | 10 ++++++++++ jdk/src/share/classes/java/time/LocalDateTime.java | 10 ++++++++++ jdk/src/share/classes/java/time/ZonedDateTime.java | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/jdk/src/share/classes/java/time/LocalDate.java b/jdk/src/share/classes/java/time/LocalDate.java index 3005658366a..e2043f9a90d 100644 --- a/jdk/src/share/classes/java/time/LocalDate.java +++ b/jdk/src/share/classes/java/time/LocalDate.java @@ -1125,6 +1125,11 @@ public final class LocalDate */ @Override public LocalDate plus(TemporalAmount amountToAdd) { + Objects.requireNonNull(amountToAdd, "amountToAdd"); + if (amountToAdd instanceof Period) { + Period periodToAdd = (Period) amountToAdd; + return plusMonths(periodToAdd.toTotalMonths()).plusDays(periodToAdd.getDays()); + } return (LocalDate) amountToAdd.addTo(this); } @@ -1353,6 +1358,11 @@ public final class LocalDate */ @Override public LocalDate minus(TemporalAmount amountToSubtract) { + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); + if (amountToSubtract instanceof Period) { + Period periodToSubtract = (Period) amountToSubtract; + return minusMonths(periodToSubtract.toTotalMonths()).minusDays(periodToSubtract.getDays()); + } return (LocalDate) amountToSubtract.subtractFrom(this); } diff --git a/jdk/src/share/classes/java/time/LocalDateTime.java b/jdk/src/share/classes/java/time/LocalDateTime.java index de8b246d6bb..d0b72b90f82 100644 --- a/jdk/src/share/classes/java/time/LocalDateTime.java +++ b/jdk/src/share/classes/java/time/LocalDateTime.java @@ -1129,6 +1129,11 @@ public final class LocalDateTime */ @Override public LocalDateTime plus(TemporalAmount amountToAdd) { + Objects.requireNonNull(amountToAdd, "amountToAdd"); + if (amountToAdd instanceof Period) { + Period periodToAdd = (Period) amountToAdd; + return with(date.plus(periodToAdd), time); + } return (LocalDateTime) amountToAdd.addTo(this); } @@ -1343,6 +1348,11 @@ public final class LocalDateTime */ @Override public LocalDateTime minus(TemporalAmount amountToSubtract) { + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); + if (amountToSubtract instanceof Period) { + Period periodToSubtract = (Period) amountToSubtract; + return with(date.minus(periodToSubtract), time); + } return (LocalDateTime) amountToSubtract.subtractFrom(this); } diff --git a/jdk/src/share/classes/java/time/ZonedDateTime.java b/jdk/src/share/classes/java/time/ZonedDateTime.java index 251ca888a14..971ba6daf5b 100644 --- a/jdk/src/share/classes/java/time/ZonedDateTime.java +++ b/jdk/src/share/classes/java/time/ZonedDateTime.java @@ -1540,6 +1540,11 @@ public final class ZonedDateTime */ @Override public ZonedDateTime plus(TemporalAmount amountToAdd) { + Objects.requireNonNull(amountToAdd, "amountToAdd"); + if (amountToAdd instanceof Period) { + Period periodToAdd = (Period) amountToAdd; + return resolveLocal(dateTime.plus(periodToAdd)); + } return (ZonedDateTime) amountToAdd.addTo(this); } @@ -1787,6 +1792,11 @@ public final class ZonedDateTime */ @Override public ZonedDateTime minus(TemporalAmount amountToSubtract) { + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); + if (amountToSubtract instanceof Period) { + Period periodToSubtract = (Period) amountToSubtract; + return resolveLocal(dateTime.minus(periodToSubtract)); + } return (ZonedDateTime) amountToSubtract.subtractFrom(this); } From 2e5604d06b24176d92459274539ce01818019712 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 30 Aug 2013 11:11:53 +0400 Subject: [PATCH 106/983] 8023966: JViewPort.BLIT_SCROLL_MODE does not work in JLightweightFrame Reviewed-by: anthony, ant --- jdk/src/share/classes/javax/swing/JViewport.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jdk/src/share/classes/javax/swing/JViewport.java b/jdk/src/share/classes/javax/swing/JViewport.java index c2ea60bf0ec..c271533e53e 100644 --- a/jdk/src/share/classes/javax/swing/JViewport.java +++ b/jdk/src/share/classes/javax/swing/JViewport.java @@ -25,6 +25,8 @@ package javax.swing; +import sun.swing.JLightweightFrame; + import java.awt.*; import java.awt.event.*; import java.awt.peer.ComponentPeer; @@ -361,6 +363,17 @@ public class JViewport extends JComponent implements Accessible super.remove(child); } + @Override + public void addNotify() { + super.addNotify(); + // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced + Window rootWindow = SwingUtilities.getWindowAncestor(this); + if (rootWindow instanceof JLightweightFrame + && getScrollMode() == BLIT_SCROLL_MODE) { + setScrollMode(BACKINGSTORE_SCROLL_MODE); + } + } + /** * Scrolls the view so that Rectangle From f8b0bf1b232b34fdff58eabcef86417a0a55f86b Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 30 Aug 2013 13:28:15 +0400 Subject: [PATCH 107/983] 8022401: [macosx] javax/swing/text/JTextComponent/5074573/bug5074573.java fails Reviewed-by: anthony --- jdk/src/macosx/native/sun/awt/AWTEvent.m | 2 +- .../event/KeyEvent/KeyChar/KeyCharTest.java | 81 +++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java diff --git a/jdk/src/macosx/native/sun/awt/AWTEvent.m b/jdk/src/macosx/native/sun/awt/AWTEvent.m index b2d54f7e705..c6bda77d172 100644 --- a/jdk/src/macosx/native/sun/awt/AWTEvent.m +++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m @@ -759,7 +759,7 @@ JNF_COCOA_EXIT(env); */ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar -(JNIEnv *env, jclass cls, char nsChar, jint modifierFlags) +(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags) { jchar javaChar = 0; diff --git a/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java b/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java new file mode 100644 index 00000000000..a482cea61dd --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java @@ -0,0 +1,81 @@ +/* + * 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.awt.AWTEvent; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.AWTEventListener; +import java.awt.event.KeyEvent; +import java.util.Locale; +import sun.awt.SunToolkit; + +/* + * @test + * @bug 8022401 + * @summary Wrong key char + * @author Alexandr Scherbatiy + * @run main KeyCharTest + */ +public class KeyCharTest { + + private static volatile int eventsCount = 0; + + static { + Locale.setDefault(Locale.ENGLISH); + + Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { + + @Override + public void eventDispatched(AWTEvent event) { + eventsCount++; + char delete = ((KeyEvent) event).getKeyChar(); + if (delete != '\u007f') { + throw new RuntimeException("Key char is not delete: '" + delete + "'"); + } + } + }, AWTEvent.KEY_EVENT_MASK); + } + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + Frame frame = new Frame(); + frame.setSize(300, 300); + frame.setVisible(true); + toolkit.realSync(); + + Robot robot = new Robot(); + + robot.keyPress(KeyEvent.VK_DELETE); + robot.keyRelease(KeyEvent.VK_DELETE); + toolkit.realSync(); + + frame.dispose(); + + if (eventsCount != 3) { + throw new RuntimeException("Wrong number of key events: " + eventsCount); + } + } +} From 75fb106fec45102b509deef5eb5efdca67cdbb3f Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Fri, 30 Aug 2013 11:43:57 +0100 Subject: [PATCH 108/983] 8023763: Rename ChronoDateImpl Rename ChronoDateImpl to ChronoLocalDateImpl Reviewed-by: sherman --- .../classes/java/time/chrono/ChronoLocalDate.java | 12 ++++++------ ...hronoDateImpl.java => ChronoLocalDateImpl.java} | 14 +++++++------- .../java/time/chrono/ChronoLocalDateTimeImpl.java | 2 +- .../share/classes/java/time/chrono/HijrahDate.java | 2 +- .../classes/java/time/chrono/JapaneseDate.java | 5 +---- .../share/classes/java/time/chrono/MinguoDate.java | 2 +- .../classes/java/time/chrono/ThaiBuddhistDate.java | 2 +- 7 files changed, 18 insertions(+), 21 deletions(-) rename jdk/src/share/classes/java/time/chrono/{ChronoDateImpl.java => ChronoLocalDateImpl.java} (96%) diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java index 923e8960b0f..e02a8cd5392 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java @@ -428,7 +428,7 @@ public interface ChronoLocalDate */ @Override default ChronoLocalDate with(TemporalAdjuster adjuster) { - return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster)); + return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster)); } /** @@ -442,7 +442,7 @@ public interface ChronoLocalDate if (field instanceof ChronoField) { throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } - return ChronoDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue)); + return ChronoLocalDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue)); } /** @@ -452,7 +452,7 @@ public interface ChronoLocalDate */ @Override default ChronoLocalDate plus(TemporalAmount amount) { - return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); + return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); } /** @@ -465,7 +465,7 @@ public interface ChronoLocalDate if (unit instanceof ChronoUnit) { throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return ChronoDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); + return ChronoLocalDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); } /** @@ -475,7 +475,7 @@ public interface ChronoLocalDate */ @Override default ChronoLocalDate minus(TemporalAmount amount) { - return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); + return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); } /** @@ -486,7 +486,7 @@ public interface ChronoLocalDate */ @Override default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) { - return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); + return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java similarity index 96% rename from jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java rename to jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java index 99ba58f05b9..fd8c8f88662 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java @@ -140,7 +140,7 @@ import java.util.Objects; * @param the ChronoLocalDate of this date-time * @since 1.8 */ -abstract class ChronoDateImpl +abstract class ChronoLocalDateImpl implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable { /** @@ -170,7 +170,7 @@ abstract class ChronoDateImpl /** * Creates an instance. */ - ChronoDateImpl() { + ChronoLocalDateImpl() { } @Override @@ -309,7 +309,7 @@ abstract class ChronoDateImpl */ @SuppressWarnings("unchecked") D minusYears(long yearsToSubtract) { - return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract)); + return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract)); } /** @@ -330,7 +330,7 @@ abstract class ChronoDateImpl */ @SuppressWarnings("unchecked") D minusMonths(long monthsToSubtract) { - return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract)); + return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract)); } /** @@ -350,7 +350,7 @@ abstract class ChronoDateImpl */ @SuppressWarnings("unchecked") D minusWeeks(long weeksToSubtract) { - return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract)); + return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract)); } /** @@ -368,7 +368,7 @@ abstract class ChronoDateImpl */ @SuppressWarnings("unchecked") D minusDays(long daysToSubtract) { - return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract)); + return (daysToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract)); } //----------------------------------------------------------------------- @@ -411,7 +411,7 @@ abstract class ChronoDateImpl private long monthsUntil(ChronoLocalDate end) { ValueRange range = getChronology().range(MONTH_OF_YEAR); if (range.getMaximum() != 12) { - throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year"); + throw new IllegalStateException("ChronoLocalDateImpl only supports Chronologies with 12 months per year"); } long packed1 = getLong(PROLEPTIC_MONTH) * 32L + get(DAY_OF_MONTH); // no overflow long packed2 = end.getLong(PROLEPTIC_MONTH) * 32L + end.get(DAY_OF_MONTH); // no overflow diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java index cd7f04e4798..13b3a0e8817 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java @@ -220,7 +220,7 @@ final class ChronoLocalDateTimeImpl return this; } // Validate that the new Temporal is a ChronoLocalDate (and not something else) - D cd = ChronoDateImpl.ensureValid(date.getChronology(), newDate); + D cd = ChronoLocalDateImpl.ensureValid(date.getChronology(), newDate); return new ChronoLocalDateTimeImpl<>(cd, newTime); } diff --git a/jdk/src/share/classes/java/time/chrono/HijrahDate.java b/jdk/src/share/classes/java/time/chrono/HijrahDate.java index 8e385c9470b..c0d942396cd 100644 --- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java +++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java @@ -109,7 +109,7 @@ import java.time.temporal.ValueRange; * @since 1.8 */ public final class HijrahDate - extends ChronoDateImpl + extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { /** diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java index 24ad7a921c0..bc9f473486d 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java @@ -61,10 +61,8 @@ import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; import static java.time.temporal.ChronoField.DAY_OF_MONTH; -import static java.time.temporal.ChronoField.DAY_OF_YEAR; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.YEAR; -import static java.time.temporal.ChronoField.YEAR_OF_ERA; import java.io.DataInput; import java.io.DataOutput; @@ -76,7 +74,6 @@ import java.time.DateTimeException; import java.time.LocalDate; import java.time.LocalTime; import java.time.Period; -import java.time.Year; import java.time.ZoneId; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; @@ -119,7 +116,7 @@ import sun.util.calendar.LocalGregorianCalendar; * @since 1.8 */ public final class JapaneseDate - extends ChronoDateImpl + extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { /** diff --git a/jdk/src/share/classes/java/time/chrono/MinguoDate.java b/jdk/src/share/classes/java/time/chrono/MinguoDate.java index 16585e7e992..fd10e0e985e 100644 --- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java +++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java @@ -96,7 +96,7 @@ import java.util.Objects; * @since 1.8 */ public final class MinguoDate - extends ChronoDateImpl + extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { /** diff --git a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java index 3d8f4078cc9..648793b7337 100644 --- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java +++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java @@ -96,7 +96,7 @@ import java.util.Objects; * @since 1.8 */ public final class ThaiBuddhistDate - extends ChronoDateImpl + extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { /** From 24f316c8610c157c61d390aa166b9fca72e83c53 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 2 Sep 2013 14:06:24 +0400 Subject: [PATCH 109/983] 7156658: JTextComponent.setFocusAccelerator() spec does not state that focus accelerator is L&F dependent Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/text/JTextComponent.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/share/classes/javax/swing/text/JTextComponent.java index 274ae9decc5..c88b1165615 100644 --- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java +++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java @@ -1562,8 +1562,10 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A /** * Sets the key accelerator that will cause the receiving text * component to get the focus. The accelerator will be the - * key combination of the alt key and the character - * given (converted to upper case). By default, there is no focus + * key combination of the platform-specific modifier key and + * the character given (converted to upper case). For example, + * the ALT key is used as a modifier on Windows and the CTRL+ALT + * combination is used on Mac. By default, there is no focus * accelerator key. Any previous key accelerator setting will be * superseded. A '\0' key setting will be registered, and has the * effect of turning off the focus accelerator. When the new key From a0509f709c489ee19da4446269b8b729ceb26242 Mon Sep 17 00:00:00 2001 From: Srikalyan Chandrashekar Date: Mon, 2 Sep 2013 16:48:51 +0400 Subject: [PATCH 110/983] 8022184: Fix static , Raw warnings in classes belonging to java.awt Reviewed-by: art, anthony --- .../share/classes/java/awt/AWTKeyStroke.java | 28 +++++++-------- .../share/classes/java/awt/CardLayout.java | 10 +++--- .../ContainerOrderFocusTraversalPolicy.java | 4 +-- .../java/awt/DefaultKeyboardFocusManager.java | 16 ++++----- .../java/awt/GradientPaintContext.java | 4 +-- .../classes/java/awt/GraphicsEnvironment.java | 10 +++--- .../java/awt/KeyboardFocusManager.java | 36 +++++++++---------- .../classes/java/awt/SequencedEvent.java | 2 +- .../classes/java/awt/TexturePaintContext.java | 18 +++++----- .../classes/java/awt/WaitDispatchSupport.java | 4 +-- 10 files changed, 66 insertions(+), 66 deletions(-) diff --git a/jdk/src/share/classes/java/awt/AWTKeyStroke.java b/jdk/src/share/classes/java/awt/AWTKeyStroke.java index 8966d753fb7..e94194e0a74 100644 --- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java +++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java @@ -67,7 +67,7 @@ import java.lang.reflect.Field; public class AWTKeyStroke implements Serializable { static final long serialVersionUID = -6430539691155161871L; - private static Map modifierKeywords; + private static Map modifierKeywords; /** * Associates VK_XXX (as a String) with code (as Integer). This is * done to avoid the overhead of the reflective call to find the @@ -85,8 +85,8 @@ public class AWTKeyStroke implements Serializable { * AWTKeyStroke class. * Must be called under locked AWTKeyStro */ - private static Class getAWTKeyStrokeClass() { - Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + private static Class getAWTKeyStrokeClass() { + Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (clazz == null) { clazz = AWTKeyStroke.class; AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class); @@ -182,7 +182,7 @@ public class AWTKeyStroke implements Serializable { throw new IllegalArgumentException("subclass cannot be null"); } synchronized (AWTKeyStroke.class) { - Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){ // Already registered return; @@ -229,8 +229,8 @@ public class AWTKeyStroke implements Serializable { */ private static Constructor getCtor(final Class clazz) { - Object ctor = AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Constructor ctor = AccessController.doPrivileged(new PrivilegedAction() { + public Constructor run() { try { Constructor ctor = clazz.getDeclaredConstructor((Class[]) null); if (ctor != null) { @@ -249,17 +249,17 @@ public class AWTKeyStroke implements Serializable { private static synchronized AWTKeyStroke getCachedStroke (char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { - Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); + Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY); if (cache == null) { - cache = new HashMap(); + cache = new HashMap<>(); AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache); } if (cacheKey == null) { try { - Class clazz = getAWTKeyStrokeClass(); + Class clazz = getAWTKeyStrokeClass(); cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null); AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey); } catch (InstantiationException e) { @@ -513,7 +513,7 @@ public class AWTKeyStroke implements Serializable { synchronized (AWTKeyStroke.class) { if (modifierKeywords == null) { - Map uninitializedMap = new HashMap(8, 1.0f); + Map uninitializedMap = new HashMap<>(8, 1.0f); uninitializedMap.put("shift", Integer.valueOf(InputEvent.SHIFT_DOWN_MASK |InputEvent.SHIFT_MASK)); @@ -861,12 +861,12 @@ public class AWTKeyStroke implements Serializable { } class VKCollection { - Map code2name; - Map name2code; + Map code2name; + Map name2code; public VKCollection() { - code2name = new HashMap(); - name2code = new HashMap(); + code2name = new HashMap<>(); + name2code = new HashMap<>(); } public synchronized void put(String name, Integer code) { diff --git a/jdk/src/share/classes/java/awt/CardLayout.java b/jdk/src/share/classes/java/awt/CardLayout.java index 32355efed60..35ee3379267 100644 --- a/jdk/src/share/classes/java/awt/CardLayout.java +++ b/jdk/src/share/classes/java/awt/CardLayout.java @@ -66,7 +66,7 @@ public class CardLayout implements LayoutManager2, * pairs of components and their names. * @see java.util.Vector */ - Vector vector = new Vector(); + Vector vector = new Vector<>(); /* * A pair of Component and String that represents its name. @@ -570,10 +570,10 @@ public class CardLayout implements LayoutManager2, if (f.defaulted("vector")) { // pre-1.4 stream - Hashtable tab = (Hashtable)f.get("tab", null); - vector = new Vector(); + Hashtable tab = (Hashtable)f.get("tab", null); + vector = new Vector<>(); if (tab != null && !tab.isEmpty()) { - for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { + for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { String key = (String)e.nextElement(); Component comp = (Component)tab.get(key); vector.add(new Card(key, comp)); @@ -594,7 +594,7 @@ public class CardLayout implements LayoutManager2, private void writeObject(ObjectOutputStream s) throws IOException { - Hashtable tab = new Hashtable(); + Hashtable tab = new Hashtable<>(); int ncomponents = vector.size(); for (int i = 0; i < ncomponents; i++) { Card card = (Card)vector.get(i); diff --git a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java index 7d36530ce2b..3f53698f7b5 100644 --- a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java +++ b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java @@ -85,7 +85,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy * list should be reused if possible. */ transient private Container cachedRoot; - transient private List cachedCycle; + transient private List cachedCycle; /* * We suppose to use getFocusTraversalCycle & getComponentIndex methods in order @@ -111,7 +111,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy return cycle.indexOf(aComponent); } - private void enumerateCycle(Container container, List cycle) { + private void enumerateCycle(Container container, List cycle) { if (!(container.isVisible() && container.isDisplayable())) { return; } diff --git a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java index 7c0c39d8ffa..4685a88bb6b 100644 --- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -808,13 +808,13 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } } boolean stopPostProcessing = false; - java.util.List processors = getKeyEventPostProcessors(); + java.util.List processors = getKeyEventPostProcessors(); if (processors != null) { - for (java.util.Iterator iter = processors.iterator(); + for (java.util.Iterator iter = processors.iterator(); !stopPostProcessing && iter.hasNext(); ) { - stopPostProcessing = (((KeyEventPostProcessor)(iter.next())). - postProcessKeyEvent(e)); + stopPostProcessing = iter.next(). + postProcessKeyEvent(e); } } if (!stopPostProcessing) { @@ -1059,12 +1059,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { return true; } - java.util.List dispatchers = getKeyEventDispatchers(); + java.util.List dispatchers = getKeyEventDispatchers(); if (dispatchers != null) { - for (java.util.Iterator iter = dispatchers.iterator(); + for (java.util.Iterator iter = dispatchers.iterator(); iter.hasNext(); ) { - if (((KeyEventDispatcher)(iter.next())). + if (iter.next(). dispatchKeyEvent(ke)) { return true; @@ -1131,7 +1131,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(), stroke.getModifiers(), !stroke.isOnKeyRelease()); - Set toTest; + Set toTest; boolean contains, containsOpp; toTest = focusedComponent.getFocusTraversalKeys( diff --git a/jdk/src/share/classes/java/awt/GradientPaintContext.java b/jdk/src/share/classes/java/awt/GradientPaintContext.java index ac21d52da91..2536fa2cf04 100644 --- a/jdk/src/share/classes/java/awt/GradientPaintContext.java +++ b/jdk/src/share/classes/java/awt/GradientPaintContext.java @@ -41,7 +41,7 @@ class GradientPaintContext implements PaintContext { new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000); static ColorModel cachedModel; - static WeakReference cached; + static WeakReference cached; static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) { if (cm == cachedModel) { @@ -76,7 +76,7 @@ class GradientPaintContext implements PaintContext { } } cachedModel = cm; - cached = new WeakReference(ras); + cached = new WeakReference<>(ras); } double x1; diff --git a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java index f3d49b78243..9e1da05e35f 100644 --- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java +++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java @@ -95,18 +95,18 @@ public abstract class GraphicsEnvironment { String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); try { // long t0 = System.currentTimeMillis(); - Class geCls; + Class geCls; try { // First we try if the bootclassloader finds the requested // class. This way we can avoid to run in a privileged block. - geCls = Class.forName(nm); + geCls = (Class)Class.forName(nm); } catch (ClassNotFoundException ex) { // If the bootclassloader fails, we try again with the // application classloader. ClassLoader cl = ClassLoader.getSystemClassLoader(); - geCls = Class.forName(nm, true, cl); + geCls = (Class)Class.forName(nm, true, cl); } - ge = (GraphicsEnvironment) geCls.newInstance(); + ge = geCls.newInstance(); // long t1 = System.currentTimeMillis(); // System.out.println("GE creation took " + (t1-t0)+ "ms."); if (isHeadless()) { @@ -161,7 +161,7 @@ public abstract class GraphicsEnvironment { private static boolean getHeadlessProperty() { if (headless == null) { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { String nm = System.getProperty("java.awt.headless"); diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 51507696cff..9bccdbbeb2f 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -348,7 +348,7 @@ public abstract class KeyboardFocusManager * Component of those Windows that has no such array of its own explicitly * set. */ - private Set[] defaultFocusTraversalKeys = new Set[4]; + private Set[] defaultFocusTraversalKeys = new Set[4]; /** * The current focus cycle root. If the focus owner is itself a focus cycle @@ -376,7 +376,7 @@ public abstract class KeyboardFocusManager * KeyEventDispatchers are registered, this field may be null or refer to * a List of length 0. */ - private java.util.LinkedList keyEventDispatchers; + private java.util.LinkedList keyEventDispatchers; /** * This KeyboardFocusManager's KeyEventPostProcessor chain. The List does @@ -385,12 +385,12 @@ public abstract class KeyboardFocusManager * If no other KeyEventPostProcessors are registered, this field may be * null or refer to a List of length 0. */ - private java.util.LinkedList keyEventPostProcessors; + private java.util.LinkedList keyEventPostProcessors; /** * Maps Windows to those Windows' most recent focus owners. */ - private static java.util.Map mostRecentFocusOwners = new WeakHashMap(); + private static java.util.Map> mostRecentFocusOwners = new WeakHashMap<>(); /** * We cache the permission used to verify that the calling thread is @@ -431,7 +431,7 @@ public abstract class KeyboardFocusManager */ public KeyboardFocusManager() { for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) { - Set work_set = new HashSet(); + Set work_set = new HashSet<>(); for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) { work_set.add(defaultFocusTraversalKeyStrokes[i][j]); } @@ -1125,7 +1125,7 @@ public abstract class KeyboardFocusManager throw new IllegalArgumentException("cannot set null Set of default focus traversal keys"); } - Set oldKeys; + Set oldKeys; synchronized (this) { for (AWTKeyStroke keystroke : keystrokes) { @@ -1153,7 +1153,7 @@ public abstract class KeyboardFocusManager oldKeys = defaultFocusTraversalKeys[id]; defaultFocusTraversalKeys[id] = - Collections.unmodifiableSet(new HashSet(keystrokes)); + Collections.unmodifiableSet(new HashSet<>(keystrokes)); } firePropertyChange(defaultFocusTraversalKeyPropertyNames[id], @@ -1699,7 +1699,7 @@ public abstract class KeyboardFocusManager if (dispatcher != null) { synchronized (this) { if (keyEventDispatchers == null) { - keyEventDispatchers = new java.util.LinkedList(); + keyEventDispatchers = new java.util.LinkedList<>(); } keyEventDispatchers.add(dispatcher); } @@ -1787,7 +1787,7 @@ public abstract class KeyboardFocusManager if (processor != null) { synchronized (this) { if (keyEventPostProcessors == null) { - keyEventPostProcessors = new java.util.LinkedList(); + keyEventPostProcessors = new java.util.LinkedList<>(); } keyEventPostProcessors.add(processor); } @@ -1865,9 +1865,9 @@ public abstract class KeyboardFocusManager // of Component.parent fields. Since WeakHasMap refers to its // values strongly, we need to break the strong link from the // value (component) back to its key (window). - WeakReference weakValue = null; + WeakReference weakValue = null; if (component != null) { - weakValue = new WeakReference(component); + weakValue = new WeakReference<>(component); } mostRecentFocusOwners.put(window, weakValue); } @@ -1906,7 +1906,7 @@ public abstract class KeyboardFocusManager * javax.swing.JComponent.runInputVerifier() using reflection. */ static synchronized Component getMostRecentFocusOwner(Window window) { - WeakReference weakValue = + WeakReference weakValue = (WeakReference)mostRecentFocusOwners.get(window); return weakValue == null ? null : (Component)weakValue.get(); } @@ -2649,11 +2649,11 @@ public abstract class KeyboardFocusManager Component lastFocusOwner = null; Component currentFocusOwner = null; - for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) { + for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) { currentFocusOwner = manager.getGlobalFocusOwner(); LightweightFocusRequest lwFocusRequest = - (LightweightFocusRequest)iter.next(); + iter.next(); /* * WARNING: This is based on DKFM's logic solely! @@ -2978,12 +2978,12 @@ public abstract class KeyboardFocusManager if (hwFocusRequest != null) { heavyweightRequests.removeFirst(); if (hwFocusRequest.lightweightRequests != null) { - for (Iterator lwIter = hwFocusRequest.lightweightRequests. + for (Iterator lwIter = hwFocusRequest.lightweightRequests. iterator(); lwIter.hasNext(); ) { manager.dequeueKeyEvents - (-1, ((LightweightFocusRequest)lwIter.next()). + (-1, lwIter.next(). component); } } @@ -3063,8 +3063,8 @@ public abstract class KeyboardFocusManager // Accessor to private field isProxyActive of KeyEvent private static boolean isProxyActiveImpl(KeyEvent e) { if (proxyActive == null) { - proxyActive = (Field) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + proxyActive = AccessController.doPrivileged(new PrivilegedAction() { + public Field run() { Field field = null; try { field = KeyEvent.class.getDeclaredField("isProxyActive"); diff --git a/jdk/src/share/classes/java/awt/SequencedEvent.java b/jdk/src/share/classes/java/awt/SequencedEvent.java index b57cde2683f..0ae8dad64db 100644 --- a/jdk/src/share/classes/java/awt/SequencedEvent.java +++ b/jdk/src/share/classes/java/awt/SequencedEvent.java @@ -49,7 +49,7 @@ class SequencedEvent extends AWTEvent implements ActiveEvent { private static final int ID = java.awt.event.FocusEvent.FOCUS_LAST + 1; - private static final LinkedList list = new LinkedList(); + private static final LinkedList list = new LinkedList<>(); private final AWTEvent nested; private AppContext appContext; diff --git a/jdk/src/share/classes/java/awt/TexturePaintContext.java b/jdk/src/share/classes/java/awt/TexturePaintContext.java index a6d2e04615d..359071e1015 100644 --- a/jdk/src/share/classes/java/awt/TexturePaintContext.java +++ b/jdk/src/share/classes/java/awt/TexturePaintContext.java @@ -73,11 +73,11 @@ abstract class TexturePaintContext implements PaintContext { WritableRaster raster = bufImg.getRaster(); ColorModel cm = bufImg.getColorModel(); int maxw = devBounds.width; - Object val = hints.get(hints.KEY_INTERPOLATION); + Object val = hints.get(RenderingHints.KEY_INTERPOLATION); boolean filter = (val == null - ? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY) - : (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)); + ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY) + : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)); if (raster instanceof IntegerInterleavedRaster && (!filter || isFilterableDCM(cm))) { @@ -234,8 +234,8 @@ abstract class TexturePaintContext implements PaintContext { return outRas; } - private static WeakReference xrgbRasRef; - private static WeakReference argbRasRef; + private static WeakReference xrgbRasRef; + private static WeakReference argbRasRef; synchronized static WritableRaster makeRaster(ColorModel cm, Raster srcRas, @@ -278,13 +278,13 @@ abstract class TexturePaintContext implements PaintContext { return; } if (xrgbmodel == cm) { - xrgbRasRef = new WeakReference(outRas); + xrgbRasRef = new WeakReference<>(outRas); } else if (argbmodel == cm) { - argbRasRef = new WeakReference(outRas); + argbRasRef = new WeakReference<>(outRas); } } - private static WeakReference byteRasRef; + private static WeakReference byteRasRef; synchronized static WritableRaster makeByteRaster(Raster srcRas, int w, int h) @@ -307,7 +307,7 @@ abstract class TexturePaintContext implements PaintContext { if (outRas == null) { return; } - byteRasRef = new WeakReference(outRas); + byteRasRef = new WeakReference<>(outRas); } public abstract WritableRaster makeRaster(int w, int h); diff --git a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java index 1cfd24a1416..c9a671838a9 100644 --- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java +++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java @@ -224,8 +224,8 @@ class WaitDispatchSupport implements SecondaryLoop { // starts. Thus, the enter() method will not hang. // // Event pump should be privileged. See 6300270. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { run.run(); return null; } From 2f5f83e38c305cd5c3083631abffeda8c8355dbd Mon Sep 17 00:00:00 2001 From: Peter Allwin Date: Mon, 30 Sep 2013 14:28:53 +0200 Subject: [PATCH 111/983] 8012923: [parfait] File Descriptor Leak in jdk/src/windows/demo/jvmti/hprof/hprof_md.c Reviewed-by: chegar, sla, sspitsyn, mgronlun --- jdk/src/windows/demo/jvmti/hprof/hprof_md.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c index 90e15ed5b84..67cf2f63c4c 100644 --- a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c +++ b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c @@ -82,9 +82,6 @@ md_connect(char *hostname, unsigned short port) struct sockaddr_in s; int fd; - /* create a socket */ - fd = (int)socket(AF_INET, SOCK_STREAM, 0); - /* find remote host's addr from name */ if ((hentry = gethostbyname(hostname)) == NULL) { return -1; @@ -97,8 +94,15 @@ md_connect(char *hostname, unsigned short port) s.sin_port = htons(port); s.sin_family = AF_INET; + /* create a socket */ + fd = (int)socket(AF_INET, SOCK_STREAM, 0); + if (INVALID_SOCKET == fd) { + return 0; + } + /* now try connecting */ - if (-1 == connect(fd, (struct sockaddr*)&s, sizeof(s))) { + if (SOCKET_ERROR == connect(fd, (struct sockaddr*)&s, sizeof(s))) { + closesocket(fd); return 0; } return fd; From bae75822436b3f84a52d588efaaee64d8c935582 Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Thu, 19 Sep 2013 11:59:14 -0700 Subject: [PATCH 112/983] 7122707: Security Providers need to have their version numbers updated for JDK8 Reviewed-by: xuelei --- .../classes/apple/security/AppleProvider.java | 4 +- .../com/sun/crypto/provider/SunJCE.java | 2 +- .../com/sun/security/sasl/Provider.java | 4 +- .../jcp/xml/dsig/internal/dom/XMLDSigRI.java | 4 +- .../share/classes/sun/security/ec/SunEC.java | 4 +- .../sun/security/jgss/SunProvider.java | 4 +- .../jgss/wrapper/SunNativeProvider.java | 4 +- .../sun/security/pkcs11/SunPKCS11.java | 4 +- .../classes/sun/security/provider/MD4.java | 4 +- .../classes/sun/security/provider/Sun.java | 2 +- .../provider/VerificationProvider.java | 4 +- .../classes/sun/security/rsa/SunRsaSign.java | 4 +- .../sun/security/smartcardio/SunPCSC.java | 4 +- .../classes/sun/security/ssl/JsseJce.java | 2 +- .../classes/sun/security/ssl/SunJSSE.java | 4 +- .../sun/security/mscapi/SunMSCAPI.java | 4 +- .../Provider/ProviderVersionCheck.java | 60 +++++++++++++++++++ 17 files changed, 89 insertions(+), 29 deletions(-) create mode 100644 jdk/test/java/security/Provider/ProviderVersionCheck.java diff --git a/jdk/src/macosx/classes/apple/security/AppleProvider.java b/jdk/src/macosx/classes/apple/security/AppleProvider.java index e1e3e2fb682..654af3c5345 100644 --- a/jdk/src/macosx/classes/apple/security/AppleProvider.java +++ b/jdk/src/macosx/classes/apple/security/AppleProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -43,7 +43,7 @@ public final class AppleProvider extends Provider { public AppleProvider() { /* We are the Apple provider */ - super("Apple", 1.1, info); + super("Apple", 1.8d, info); AccessController.doPrivileged(new java.security.PrivilegedAction() { public Object run() { diff --git a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java index af828e2a651..08e1e2ae737 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java @@ -104,7 +104,7 @@ public final class SunJCE extends Provider { public SunJCE() { /* We are the "SunJCE" provider */ - super("SunJCE", 1.7d, info); + super("SunJCE", 1.8d, info); final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" + "|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" + diff --git a/jdk/src/share/classes/com/sun/security/sasl/Provider.java b/jdk/src/share/classes/com/sun/security/sasl/Provider.java index 8b9c00c8800..986a18758a1 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/Provider.java +++ b/jdk/src/share/classes/com/sun/security/sasl/Provider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ public final class Provider extends java.security.Provider { " server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM)"; public Provider() { - super("SunSASL", 1.7d, info); + super("SunSASL", 1.8d, info); AccessController.doPrivileged(new PrivilegedAction() { public Void run() { diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java index 2cc871485b3..d4dd77b7948 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java @@ -28,7 +28,7 @@ * =========================================================================== */ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved. */ /* * $Id: XMLDSigRI.java 1400021 2012-10-19 10:16:04Z coheigea $ @@ -61,7 +61,7 @@ public final class XMLDSigRI extends Provider { public XMLDSigRI() { /* We are the XMLDSig provider */ - super("XMLDSig", 1.8, INFO); + super("XMLDSig", 1.8d, INFO); final Map map = new HashMap(); map.put("XMLSignatureFactory.DOM", diff --git a/jdk/src/share/classes/sun/security/ec/SunEC.java b/jdk/src/share/classes/sun/security/ec/SunEC.java index 539cea41162..31891696b4f 100644 --- a/jdk/src/share/classes/sun/security/ec/SunEC.java +++ b/jdk/src/share/classes/sun/security/ec/SunEC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ public final class SunEC extends Provider { } public SunEC() { - super("SunEC", 1.7d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)"); + super("SunEC", 1.8d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)"); // if there is no security manager installed, put directly into // the provider. Otherwise, create a temporary map and use a diff --git a/jdk/src/share/classes/sun/security/jgss/SunProvider.java b/jdk/src/share/classes/sun/security/jgss/SunProvider.java index a49cb8a0fee..42396754b23 100644 --- a/jdk/src/share/classes/sun/security/jgss/SunProvider.java +++ b/jdk/src/share/classes/sun/security/jgss/SunProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ public final class SunProvider extends Provider { public SunProvider() { /* We are the Sun JGSS provider */ - super("SunJGSS", 1.7d, INFO); + super("SunJGSS", 1.8d, INFO); AccessController.doPrivileged( new java.security.PrivilegedAction() { diff --git a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java index b0e81aa2a40..b0bb15d0036 100644 --- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java +++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, 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 @@ -120,7 +120,7 @@ public final class SunNativeProvider extends Provider { public SunNativeProvider() { /* We are the Sun NativeGSS provider */ - super(NAME, 1.0, INFO); + super(NAME, 1.8d, INFO); if (MECH_MAP != null) { AccessController.doPrivileged(new PutAllAction(this, MECH_MAP)); diff --git a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java index ee9169b59d8..b6dd35a80e8 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -94,7 +94,7 @@ public final class SunPKCS11 extends AuthProvider { } public SunPKCS11() { - super("SunPKCS11-Dummy", 1.7d, "SunPKCS11-Dummy"); + super("SunPKCS11-Dummy", 1.8d, "SunPKCS11-Dummy"); throw new ProviderException ("SunPKCS11 requires configuration file argument"); } @@ -127,7 +127,7 @@ public final class SunPKCS11 extends AuthProvider { public SunPKCS11(String configName, InputStream configStream) { super("SunPKCS11-" + Config.getConfig(configName, configStream).getName(), - 1.7d, Config.getConfig(configName, configStream).getDescription()); + 1.8d, Config.getConfig(configName, configStream).getDescription()); this.configName = configName; this.config = Config.removeConfig(configName); diff --git a/jdk/src/share/classes/sun/security/provider/MD4.java b/jdk/src/share/classes/sun/security/provider/MD4.java index d04639f18e5..346bc9db10d 100644 --- a/jdk/src/share/classes/sun/security/provider/MD4.java +++ b/jdk/src/share/classes/sun/security/provider/MD4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, 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 @@ -65,7 +65,7 @@ public final class MD4 extends DigestBase { private final static Provider md4Provider; static { - md4Provider = new Provider("MD4Provider", 1.0d, "MD4 MessageDigest") { + md4Provider = new Provider("MD4Provider", 1.8d, "MD4 MessageDigest") { private static final long serialVersionUID = -8850464997518327965L; }; AccessController.doPrivileged(new PrivilegedAction() { diff --git a/jdk/src/share/classes/sun/security/provider/Sun.java b/jdk/src/share/classes/sun/security/provider/Sun.java index 4af2be50864..07ef2ff4a23 100644 --- a/jdk/src/share/classes/sun/security/provider/Sun.java +++ b/jdk/src/share/classes/sun/security/provider/Sun.java @@ -47,7 +47,7 @@ public final class Sun extends Provider { public Sun() { /* We are the SUN provider */ - super("SUN", 1.8, INFO); + super("SUN", 1.8d, INFO); // if there is no security manager installed, put directly into // the provider. Otherwise, create a temporary map and use a diff --git a/jdk/src/share/classes/sun/security/provider/VerificationProvider.java b/jdk/src/share/classes/sun/security/provider/VerificationProvider.java index 082427d76df..296b0343706 100644 --- a/jdk/src/share/classes/sun/security/provider/VerificationProvider.java +++ b/jdk/src/share/classes/sun/security/provider/VerificationProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ public final class VerificationProvider extends Provider { } public VerificationProvider() { - super("SunJarVerification", 1.7, "Jar Verification Provider"); + super("SunJarVerification", 1.8d, "Jar Verification Provider"); // register all algorithms normally registered by the Sun and SunRsaSign // providers, but only if they are missing if (ACTIVE == false) { diff --git a/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java b/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java index a00bf30172f..65ae02a080e 100644 --- a/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java +++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSign.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ public final class SunRsaSign extends Provider { private static final long serialVersionUID = 866040293550393045L; public SunRsaSign() { - super("SunRsaSign", 1.7d, "Sun RSA signature provider"); + super("SunRsaSign", 1.8d, "Sun RSA signature provider"); // if there is no security manager installed, put directly into // the provider. Otherwise, create a temporary map and use a diff --git a/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java b/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java index fa931922495..c0cb85688f9 100644 --- a/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java +++ b/jdk/src/share/classes/sun/security/smartcardio/SunPCSC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ public final class SunPCSC extends Provider { private static final long serialVersionUID = 6168388284028876579L; public SunPCSC() { - super("SunPCSC", 1.7d, "Sun PC/SC provider"); + super("SunPCSC", 1.8d, "Sun PC/SC provider"); AccessController.doPrivileged(new PrivilegedAction() { public Void run() { put("TerminalFactory.PC/SC", "sun.security.smartcardio.SunPCSC$Factory"); diff --git a/jdk/src/share/classes/sun/security/ssl/JsseJce.java b/jdk/src/share/classes/sun/security/ssl/JsseJce.java index d128f2e7029..4c98772aeca 100644 --- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java +++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java @@ -110,7 +110,7 @@ final class JsseJce { private static final long serialVersionUID = -3284138292032213752L; SunCertificates(final Provider p) { - super("SunCertificates", 1.0d, "SunJSSE internal"); + super("SunCertificates", 1.8d, "SunJSSE internal"); AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { diff --git a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java index 08d03f7042b..aa55be174d9 100644 --- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java +++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public abstract class SunJSSE extends java.security.Provider { private SunJSSE(java.security.Provider cryptoProvider, String providerName) { - super("SunJSSE", 1.6d, fipsInfo + providerName + ")"); + super("SunJSSE", 1.8d, fipsInfo + providerName + ")"); subclassCheck(); if (cryptoProvider == null) { // Calling Security.getProvider() will cause other providers to be diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java index 1af669415ee..7725b27d3c6 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java +++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, 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 @@ -56,7 +56,7 @@ public final class SunMSCAPI extends Provider { } public SunMSCAPI() { - super("SunMSCAPI", 1.7d, INFO); + super("SunMSCAPI", 1.8d, INFO); // if there is no security manager installed, put directly into // the provider. Otherwise, create a temporary map and use a diff --git a/jdk/test/java/security/Provider/ProviderVersionCheck.java b/jdk/test/java/security/Provider/ProviderVersionCheck.java new file mode 100644 index 00000000000..555d1df9428 --- /dev/null +++ b/jdk/test/java/security/Provider/ProviderVersionCheck.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.Provider; +import java.security.Security; +import java.lang.Exception; + +/* + * @test + * @bug 7122707 + * @run main/othervm ProviderVersionCheck + * @summary Verify all providers in the default Providers list have the proper + * version for the release + * @author Anthony Scarpino + */ + +public class ProviderVersionCheck { + + public static void main(String arg[]) throws Exception{ + + boolean failure = false; + + for (Provider p: Security.getProviders()) { + System.out.print(p.getName() + " "); + if (p.getVersion() != 1.8d) { + System.out.println("failed. " + "Version received was " + + p.getVersion()); + failure = true; + } else { + System.out.println("passed."); + } + } + + if (failure) { + throw new Exception("Provider(s) failed to have the expected " + + "version value."); + } + } + +} From cf7cbcdce886a7385a1ee152e54cf3236ec63057 Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Wed, 18 Sep 2013 14:57:29 -0700 Subject: [PATCH 113/983] 8004283: test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failing intermittently Reviewed-by: vinnie --- jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh b/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh index 30334555302..ddfc9da0ac6 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,8 @@ fi cd ${TESTSRC} ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -DDIR=${TESTSRC}${FS}BasicData${FS} \ - -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ + -classpath \ + ${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \ -DNO_DEFAULT=true \ From e9806ae426add1c7d412235d5d30fd1b6536984f Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Mon, 2 Sep 2013 09:52:08 -0700 Subject: [PATCH 114/983] 8009438: sun/security/pkcs11/Secmod tests failing on Ubuntu 12.04 Reviewed-by: vinnie --- jdk/src/share/classes/sun/security/pkcs11/Secmod.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/sun/security/pkcs11/Secmod.java b/jdk/src/share/classes/sun/security/pkcs11/Secmod.java index 927a32ae761..1d2c5c0bdc6 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/Secmod.java +++ b/jdk/src/share/classes/sun/security/pkcs11/Secmod.java @@ -756,8 +756,12 @@ public final class Secmod { if (DEBUG) System.out.println("handles: " + handles.length); for (long handle : handles) { - TrustAttributes trust = new TrustAttributes(token, session, handle); - trustMap.put(trust.getHash(), trust); + try { + TrustAttributes trust = new TrustAttributes(token, session, handle); + trustMap.put(trust.getHash(), trust); + } catch (PKCS11Exception e) { + // skip put on pkcs11 error + } } } finally { token.releaseSession(session); From 4247113e6a6fd62155a793d60a5b91853b5113d1 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 3 Sep 2013 11:00:06 +0400 Subject: [PATCH 115/983] 6943780: JTabbedPane throws ArrayIndexOutOfBoundsException sometimes Reviewed-by: alexsch --- .../swing/plaf/basic/BasicTabbedPaneUI.java | 1 + .../basic/BasicTabbedPaneUI/Test6943780.java | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index a9b3d26358c..983e173e3af 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -3350,6 +3350,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { private void updateView() { int tabPlacement = tabPane.getTabPlacement(); int tabCount = tabPane.getTabCount(); + assureRectsCreated(tabCount); Rectangle vpRect = viewport.getBounds(); Dimension viewSize = viewport.getViewSize(); Rectangle viewRect = viewport.getViewRect(); diff --git a/jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java b/jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java new file mode 100644 index 00000000000..d1739a33574 --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java @@ -0,0 +1,56 @@ +/* + * 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 javax.swing.JButton; +import javax.swing.JTabbedPane; +import java.awt.Component; + +import static javax.swing.SwingUtilities.invokeAndWait; + +/* + * @test + * @bug 4873983 6943780 + * @summary Tests JTabbedPane with SCROLL_TAB_LAYOUT + * @author Sergey Malenkov + */ +public class Test6943780 implements Runnable, Thread.UncaughtExceptionHandler { + public static void main(String[] args) throws Exception { + invokeAndWait(new Test6943780()); + } + + @Override + public void uncaughtException(Thread thread, Throwable throwable) { + throwable.printStackTrace(); + System.exit(1); + } + + @Override + public void run() { + JTabbedPane pane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); + pane.addTab("first", new JButton("first")); + pane.addTab("second", new JButton("second")); + for (Component component : pane.getComponents()) { + component.setSize(100, 100); + } + } +} From 6ffe7bb5137c7608cf2bc6cd0fa57a7618059c09 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Tue, 3 Sep 2013 17:27:20 +0400 Subject: [PATCH 116/983] 8007156: [macosx] Wrong events in processKeyBinding of JTable Submit Date Reviewed-by: leonidr --- .../classes/sun/lwawt/LWComponentPeer.java | 2 + .../classes/sun/lwawt/LWWindowPeer.java | 7 +- .../ExtendedKeyCode/ExtendedKeyCodeTest.java | 81 +++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 05d1d5d1fad..5b081b1f2f2 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -1254,6 +1254,8 @@ public abstract class LWComponentPeer KeyEvent ke = (KeyEvent) e; delegateEvent = new KeyEvent(getDelegateFocusOwner(), ke.getID(), ke.getWhen(), ke.getModifiers(), ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()); + AWTAccessor.getKeyEventAccessor().setExtendedKeyCode((KeyEvent) delegateEvent, + ke.getExtendedKeyCode()); } else if (e instanceof FocusEvent) { FocusEvent fe = (FocusEvent) e; delegateEvent = new FocusEvent(getDelegateFocusOwner(), fe.getID(), fe.isTemporary()); diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 2be41cf3b0d..6000016306a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -933,7 +933,12 @@ public class LWWindowPeer focusOwner = this.getTarget(); } } - postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation)); + + KeyEvent keyEvent = new KeyEvent(focusOwner, id, when, modifiers, + keyCode, keyChar, keyLocation); + AWTAccessor.getKeyEventAccessor().setExtendedKeyCode(keyEvent, + ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar)); + postEvent(keyEvent); } // ---- UTILITY METHODS ---- // diff --git a/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java new file mode 100644 index 00000000000..5d1342d171f --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; +import java.awt.event.KeyAdapter; +import sun.awt.ExtendedKeyCodes; +import sun.awt.SunToolkit; + +/* + * @test + * @bug 8007156 + * @summary Extended key code is not set for a key event + * @author Alexandr Scherbatiy + * @run main ExtendedKeyCodeTest + */ +public class ExtendedKeyCodeTest { + + private static volatile boolean setExtendedKeyCode = true; + private static volatile int eventsCount = 0; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + + Frame frame = new Frame(); + frame.setSize(300, 300); + + frame.addKeyListener(new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + eventsCount++; + setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode() + == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar())); + } + + @Override + public void keyReleased(KeyEvent e) { + eventsCount++; + setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode() + == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar())); + } + }); + + frame.setVisible(true); + toolkit.realSync(); + + robot.keyPress(KeyEvent.VK_D); + robot.keyRelease(KeyEvent.VK_D); + toolkit.realSync(); + + frame.dispose(); + + if (eventsCount != 2 || !setExtendedKeyCode) { + throw new RuntimeException("Wrong extended key code"); + } + } +} From 22039ebd3e8d299215c64b8a27209cf9e8c27cf4 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 3 Sep 2013 21:53:14 +0400 Subject: [PATCH 117/983] 7172865: PropertyDescriptor fails to work with setter method name if setter is non-void Reviewed-by: art, alexsch --- .../java/beans/IndexedPropertyDescriptor.java | 42 ++--- .../classes/java/beans/MethodDescriptor.java | 24 +-- .../share/classes/java/beans/MethodRef.java | 87 ++++++++++ .../java/beans/PropertyDescriptor.java | 46 ++--- .../java/beans/Introspector/Test7172865.java | 162 ++++++++++++++++++ 5 files changed, 287 insertions(+), 74 deletions(-) create mode 100644 jdk/src/share/classes/java/beans/MethodRef.java create mode 100644 jdk/test/java/beans/Introspector/Test7172865.java diff --git a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java index 1d59f7afddb..866d35ba56c 100644 --- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java @@ -41,8 +41,8 @@ import java.lang.reflect.Method; public class IndexedPropertyDescriptor extends PropertyDescriptor { private Reference> indexedPropertyTypeRef; - private Reference indexedReadMethodRef; - private Reference indexedWriteMethodRef; + private final MethodRef indexedReadMethodRef = new MethodRef(); + private final MethodRef indexedWriteMethodRef = new MethodRef(); private String indexedReadMethodName; private String indexedWriteMethodName; @@ -173,11 +173,11 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * May return null if the property isn't indexed or is write-only. */ public synchronized Method getIndexedReadMethod() { - Method indexedReadMethod = getIndexedReadMethod0(); + Method indexedReadMethod = this.indexedReadMethodRef.get(); if (indexedReadMethod == null) { Class cls = getClass0(); if (cls == null || - (indexedReadMethodName == null && indexedReadMethodRef == null)) { + (indexedReadMethodName == null && !this.indexedReadMethodRef.isSet())) { // the Indexed readMethod was explicitly set to null. return null; } @@ -215,20 +215,19 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { // the indexed property type is set by the reader. setIndexedPropertyType(findIndexedPropertyType(readMethod, - getIndexedWriteMethod0())); + this.indexedWriteMethodRef.get())); setIndexedReadMethod0(readMethod); } private void setIndexedReadMethod0(Method readMethod) { + this.indexedReadMethodRef.set(readMethod); if (readMethod == null) { indexedReadMethodName = null; - indexedReadMethodRef = null; return; } setClass0(readMethod.getDeclaringClass()); indexedReadMethodName = readMethod.getName(); - this.indexedReadMethodRef = getSoftReference(readMethod); setTransient(readMethod.getAnnotation(Transient.class)); } @@ -241,11 +240,11 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * May return null if the property isn't indexed or is read-only. */ public synchronized Method getIndexedWriteMethod() { - Method indexedWriteMethod = getIndexedWriteMethod0(); + Method indexedWriteMethod = this.indexedWriteMethodRef.get(); if (indexedWriteMethod == null) { Class cls = getClass0(); if (cls == null || - (indexedWriteMethodName == null && indexedWriteMethodRef == null)) { + (indexedWriteMethodName == null && !this.indexedWriteMethodRef.isSet())) { // the Indexed writeMethod was explicitly set to null. return null; } @@ -301,15 +300,14 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { } private void setIndexedWriteMethod0(Method writeMethod) { + this.indexedWriteMethodRef.set(writeMethod); if (writeMethod == null) { indexedWriteMethodName = null; - indexedWriteMethodRef = null; return; } setClass0(writeMethod.getDeclaringClass()); indexedWriteMethodName = writeMethod.getName(); - this.indexedWriteMethodRef = getSoftReference(writeMethod); setTransient(writeMethod.getAnnotation(Transient.class)); } @@ -349,18 +347,6 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { : null; } - private Method getIndexedReadMethod0() { - return (this.indexedReadMethodRef != null) - ? this.indexedReadMethodRef.get() - : null; - } - - private Method getIndexedWriteMethod0() { - return (this.indexedWriteMethodRef != null) - ? this.indexedWriteMethodRef.get() - : null; - } - private Class findIndexedPropertyType(Method indexedReadMethod, Method indexedWriteMethod) throws IntrospectionException { @@ -492,8 +478,8 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { */ IndexedPropertyDescriptor(IndexedPropertyDescriptor old) { super(old); - indexedReadMethodRef = old.indexedReadMethodRef; - indexedWriteMethodRef = old.indexedWriteMethodRef; + this.indexedReadMethodRef.set(old.indexedReadMethodRef.get()); + this.indexedWriteMethodRef.set(old.indexedWriteMethodRef.get()); indexedPropertyTypeRef = old.indexedPropertyTypeRef; indexedWriteMethodName = old.indexedWriteMethodName; indexedReadMethodName = old.indexedReadMethodName; @@ -502,7 +488,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { void updateGenericsFor(Class type) { super.updateGenericsFor(type); try { - setIndexedPropertyType(findIndexedPropertyType(getIndexedReadMethod0(), getIndexedWriteMethod0())); + setIndexedPropertyType(findIndexedPropertyType(this.indexedReadMethodRef.get(), this.indexedWriteMethodRef.get())); } catch (IntrospectionException exception) { setIndexedPropertyType(null); @@ -532,7 +518,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { void appendTo(StringBuilder sb) { super.appendTo(sb); appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef); - appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef); - appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef); + appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef.get()); + appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef.get()); } } diff --git a/jdk/src/share/classes/java/beans/MethodDescriptor.java b/jdk/src/share/classes/java/beans/MethodDescriptor.java index db760c0e20a..f8cd73d3897 100644 --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java @@ -38,7 +38,7 @@ import java.util.ArrayList; public class MethodDescriptor extends FeatureDescriptor { - private Reference methodRef; + private final MethodRef methodRef = new MethodRef(); private String[] paramNames; @@ -81,7 +81,7 @@ public class MethodDescriptor extends FeatureDescriptor { * @return The low-level description of the method */ public synchronized Method getMethod() { - Method method = getMethod0(); + Method method = this.methodRef.get(); if (method == null) { Class cls = getClass0(); String name = getName(); @@ -114,13 +114,7 @@ public class MethodDescriptor extends FeatureDescriptor { setClass0(method.getDeclaringClass()); } setParams(getParameterTypes(getClass0(), method)); - this.methodRef = getSoftReference(method); - } - - private Method getMethod0() { - return (this.methodRef != null) - ? this.methodRef.get() - : null; + this.methodRef.set(method); } private synchronized void setParams(Class[] param) { @@ -177,12 +171,10 @@ public class MethodDescriptor extends FeatureDescriptor { */ MethodDescriptor(MethodDescriptor x, MethodDescriptor y) { - super(x,y); + super(x, y); - methodRef = x.methodRef; - if (y.methodRef != null) { - methodRef = y.methodRef; - } + Method method = y.methodRef.get(); + this.methodRef.set(null != method ? method : x.methodRef.get()); params = x.params; if (y.params != null) { params = y.params; @@ -205,7 +197,7 @@ public class MethodDescriptor extends FeatureDescriptor { MethodDescriptor(MethodDescriptor old) { super(old); - methodRef = old.methodRef; + this.methodRef.set(old.getMethod()); params = old.params; paramNames = old.paramNames; @@ -219,7 +211,7 @@ public class MethodDescriptor extends FeatureDescriptor { } void appendTo(StringBuilder sb) { - appendTo(sb, "method", this.methodRef); + appendTo(sb, "method", this.methodRef.get()); if (this.parameterDescriptors != null) { sb.append("; parameterDescriptors={"); for (ParameterDescriptor pd : this.parameterDescriptors) { diff --git a/jdk/src/share/classes/java/beans/MethodRef.java b/jdk/src/share/classes/java/beans/MethodRef.java new file mode 100644 index 00000000000..59b2690b4fa --- /dev/null +++ b/jdk/src/share/classes/java/beans/MethodRef.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.beans; + +import java.lang.ref.SoftReference; +import java.lang.ref.WeakReference; +import java.lang.reflect.Method; + +import static sun.reflect.misc.ReflectUtil.isPackageAccessible; + +final class MethodRef { + private String signature; + private SoftReference methodRef; + private WeakReference> typeRef; + + void set(Method method) { + if (method == null) { + this.signature = null; + this.methodRef = null; + this.typeRef = null; + } + else { + this.signature = method.toGenericString(); + this.methodRef = new SoftReference<>(method); + this.typeRef = new WeakReference>(method.getDeclaringClass()); + } + } + + boolean isSet() { + return this.methodRef != null; + } + + Method get() { + if (this.methodRef == null) { + return null; + } + Method method = this.methodRef.get(); + if (method == null) { + method = find(this.typeRef.get(), this.signature); + if (method == null) { + this.signature = null; + this.methodRef = null; + this.typeRef = null; + } + else { + this.methodRef = new SoftReference<>(method); + } + } + return isPackageAccessible(method.getDeclaringClass()) ? method : null; + } + + private static Method find(Class type, String signature) { + if (type != null) { + for (Method method : type.getMethods()) { + if (type.equals(method.getDeclaringClass())) { + if (method.toGenericString().equals(signature)) { + return method; + } + } + } + } + return null; + } +} diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java index c519b504d58..aed5ec57a4d 100644 --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java @@ -36,8 +36,8 @@ import java.lang.reflect.Constructor; public class PropertyDescriptor extends FeatureDescriptor { private Reference> propertyTypeRef; - private Reference readMethodRef; - private Reference writeMethodRef; + private final MethodRef readMethodRef = new MethodRef(); + private final MethodRef writeMethodRef = new MethodRef(); private Reference> propertyEditorClassRef; private boolean bound; @@ -68,8 +68,8 @@ public class PropertyDescriptor extends FeatureDescriptor { public PropertyDescriptor(String propertyName, Class beanClass) throws IntrospectionException { this(propertyName, beanClass, - Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName), - Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName)); + Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName), + Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName)); } /** @@ -203,10 +203,10 @@ public class PropertyDescriptor extends FeatureDescriptor { * May return null if the property can't be read. */ public synchronized Method getReadMethod() { - Method readMethod = getReadMethod0(); + Method readMethod = this.readMethodRef.get(); if (readMethod == null) { Class cls = getClass0(); - if (cls == null || (readMethodName == null && readMethodRef == null)) { + if (cls == null || (readMethodName == null && !this.readMethodRef.isSet())) { // The read method was explicitly set to null. return null; } @@ -247,17 +247,16 @@ public class PropertyDescriptor extends FeatureDescriptor { */ public synchronized void setReadMethod(Method readMethod) throws IntrospectionException { + this.readMethodRef.set(readMethod); if (readMethod == null) { readMethodName = null; - readMethodRef = null; return; } // The property type is determined by the read method. - setPropertyType(findPropertyType(readMethod, getWriteMethod0())); + setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get())); setClass0(readMethod.getDeclaringClass()); readMethodName = readMethod.getName(); - this.readMethodRef = getSoftReference(readMethod); setTransient(readMethod.getAnnotation(Transient.class)); } @@ -268,10 +267,10 @@ public class PropertyDescriptor extends FeatureDescriptor { * May return null if the property can't be written. */ public synchronized Method getWriteMethod() { - Method writeMethod = getWriteMethod0(); + Method writeMethod = this.writeMethodRef.get(); if (writeMethod == null) { Class cls = getClass0(); - if (cls == null || (writeMethodName == null && writeMethodRef == null)) { + if (cls == null || (writeMethodName == null && !this.writeMethodRef.isSet())) { // The write method was explicitly set to null. return null; } @@ -318,9 +317,9 @@ public class PropertyDescriptor extends FeatureDescriptor { */ public synchronized void setWriteMethod(Method writeMethod) throws IntrospectionException { + this.writeMethodRef.set(writeMethod); if (writeMethod == null) { writeMethodName = null; - writeMethodRef = null; return; } // Set the property type - which validates the method @@ -328,22 +327,9 @@ public class PropertyDescriptor extends FeatureDescriptor { setClass0(writeMethod.getDeclaringClass()); writeMethodName = writeMethod.getName(); - this.writeMethodRef = getSoftReference(writeMethod); setTransient(writeMethod.getAnnotation(Transient.class)); } - private Method getReadMethod0() { - return (this.readMethodRef != null) - ? this.readMethodRef.get() - : null; - } - - private Method getWriteMethod0() { - return (this.writeMethodRef != null) - ? this.writeMethodRef.get() - : null; - } - /** * Overridden to ensure that a super class doesn't take precedent */ @@ -617,8 +603,8 @@ public class PropertyDescriptor extends FeatureDescriptor { PropertyDescriptor(PropertyDescriptor old) { super(old); propertyTypeRef = old.propertyTypeRef; - readMethodRef = old.readMethodRef; - writeMethodRef = old.writeMethodRef; + this.readMethodRef.set(old.readMethodRef.get()); + this.writeMethodRef.set(old.writeMethodRef.get()); propertyEditorClassRef = old.propertyEditorClassRef; writeMethodName = old.writeMethodName; @@ -632,7 +618,7 @@ public class PropertyDescriptor extends FeatureDescriptor { void updateGenericsFor(Class type) { setClass0(type); try { - setPropertyType(findPropertyType(getReadMethod0(), getWriteMethod0())); + setPropertyType(findPropertyType(this.readMethodRef.get(), this.writeMethodRef.get())); } catch (IntrospectionException exception) { setPropertyType(null); @@ -723,8 +709,8 @@ public class PropertyDescriptor extends FeatureDescriptor { appendTo(sb, "constrained", this.constrained); appendTo(sb, "propertyEditorClass", this.propertyEditorClassRef); appendTo(sb, "propertyType", this.propertyTypeRef); - appendTo(sb, "readMethod", this.readMethodRef); - appendTo(sb, "writeMethod", this.writeMethodRef); + appendTo(sb, "readMethod", this.readMethodRef.get()); + appendTo(sb, "writeMethod", this.writeMethodRef.get()); } private boolean isAssignable(Method m1, Method m2) { diff --git a/jdk/test/java/beans/Introspector/Test7172865.java b/jdk/test/java/beans/Introspector/Test7172865.java new file mode 100644 index 00000000000..6647225ca8f --- /dev/null +++ b/jdk/test/java/beans/Introspector/Test7172865.java @@ -0,0 +1,162 @@ +/* + * 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.beans.IndexedPropertyDescriptor; +import java.beans.MethodDescriptor; +import java.beans.PropertyDescriptor; + +/* + * @test + * @bug 7172854 7172865 + * @summary Tests that cached methods are not lost + * @author Sergey Malenkov + */ + +public class Test7172865 { + public static void main(String[] args) throws Exception { + int errors = 0; + + MethodDescriptor md = new MethodDescriptor(Test7172865.class.getMethod("getGood")); + + errors += test(PropertyDescriptor.class, "good", true); + PropertyDescriptor pdGoodString = new PropertyDescriptor("good", Test7172865.class, "getGood", "setGood"); + PropertyDescriptor pdGoodMethod = new PropertyDescriptor("good", + Test7172865.class.getMethod("getGood"), + Test7172865.class.getMethod("setGood", args.getClass())); + + errors += test(PropertyDescriptor.class, "bad", false); + PropertyDescriptor pdBadString = new PropertyDescriptor("bad", Test7172865.class, "getBad", null); + PropertyDescriptor pdBadMethod = new PropertyDescriptor("bad", + Test7172865.class.getMethod("getBad"), + Test7172865.class.getMethod("setBad", args.getClass())); + + errors += test(IndexedPropertyDescriptor.class, "good", true); + IndexedPropertyDescriptor ipdGoodString = new IndexedPropertyDescriptor("good", Test7172865.class, "getGood", "setGood", "getGood", "setGood"); + IndexedPropertyDescriptor ipdGoodMethod = new IndexedPropertyDescriptor("good", + Test7172865.class.getMethod("getGood"), + Test7172865.class.getMethod("setGood", args.getClass()), + Test7172865.class.getMethod("getGood", Integer.TYPE), + Test7172865.class.getMethod("setGood", Integer.TYPE, String.class)); + + errors += test(IndexedPropertyDescriptor.class, "bad", false); + IndexedPropertyDescriptor ipdBadString = new IndexedPropertyDescriptor("bad", Test7172865.class, "getBad", null, "getBad", null); + IndexedPropertyDescriptor ipdBadMethod = new IndexedPropertyDescriptor("bad", + Test7172865.class.getMethod("getBad"), + Test7172865.class.getMethod("setBad", args.getClass()), + Test7172865.class.getMethod("getBad", Integer.TYPE), + Test7172865.class.getMethod("setBad", Integer.TYPE, String.class)); + + for (int i = 1; i <= 2; i++) { + System.out.println("STEP: " + i); + errors += test("md", null != md.getMethod()); + + errors += test("pdGoodString", pdGoodString, true, true); + errors += test("pdGoodMethod", pdGoodMethod, true, true); + + errors += test("pdBadString", pdBadString, true, false); + errors += test("pdBadMethod", pdBadMethod, true, true); + + errors += test("ipdGoodString", ipdGoodString, true, true, true, true); + errors += test("ipdGoodMethod", ipdGoodMethod, true, true, true, true); + + errors += test("ipdBadString", ipdBadString, true, false, true, false); + errors += test("ipdBadMethod", ipdBadMethod, true, true, true, true); + + try { + int[] array = new int[1024]; + while (true) { + array = new int[array.length << 1]; + } + } + catch (OutOfMemoryError error) { + System.gc(); + } + } + if (errors > 0) { + throw new Error("found " + errors + " errors"); + } + } + + private static int test(Class type, String property, boolean value) { + String message = type.getSimpleName() + "(" + property + ") "; + try { + type.getConstructor(String.class, Class.class).newInstance(property, Test7172865.class); + message += "passed"; + } + catch (Exception exception) { + message += "failed"; + value = !value; + } + if (value) { + message += " as expected"; + } + System.out.println(message); + return value ? 0 : 1; + } + + private static int test(String message, boolean value) { + System.out.println(message + ": " + (value ? "passed" : "failed")); + return value ? 0 : 1; + } + + private static int test(String message, PropertyDescriptor pd, boolean rm, boolean wm) { + return test(message + ".Read", rm == (null != pd.getReadMethod())) + + test(message + ".Write", wm == (null != pd.getWriteMethod())); + } + + private static int test(String message, IndexedPropertyDescriptor ipd, boolean rm, boolean wm, boolean irm, boolean iwm) { + return test(message, ipd, rm, wm) + + test(message + ".IndexedRead", irm == (null != ipd.getIndexedReadMethod())) + + test(message + ".IndexedWrite", iwm == (null != ipd.getIndexedWriteMethod())); + } + + public String[] getGood() { + return null; + } + + public String getGood(int index) { + return null; + } + + public void setGood(String[] good) { + } + + public void setGood(int index, String value) { + } + + public String[] getBad() { + return null; + } + + public String getBad(int index) { + return null; + } + + public Test7172865 setBad(String[] bad) { + return null; + } + + public Test7172865 setBad(int index, String value) { + return null; + } +} From 1530a30f52266e56a013336f3f1bc6572b0f6337 Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev Date: Wed, 4 Sep 2013 14:32:13 +0400 Subject: [PATCH 118/983] 8021943: FileDialog getFile returns corrupted string after previous setFile Reviewed-by: anthony, serb --- jdk/src/windows/native/sun/windows/awt_FileDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp index d60fbd329b1..276f3647e68 100644 --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -372,7 +372,9 @@ AwtFileDialog::Show(void *p) // Report result to peer. if (result) { - jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile); + jint length = multipleMode + ? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile) + : (jint)_tcslen(ofn.lpstrFile); jcharArray jnames = env->NewCharArray(length); env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile); From b33bcb918589f5f59f89f207af0aee00c2e5d4a0 Mon Sep 17 00:00:00 2001 From: Mikhail Cherkasov Date: Wed, 4 Sep 2013 18:12:49 +0400 Subject: [PATCH 119/983] 8023565: JPG causes javax.imageio.IIOException: ICC APP2 encoutered without prior JFIF Reviewed-by: bae, vadim --- .../com/sun/imageio/plugins/jpeg/JPEGMetadata.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java index 6036cb49870..c7b8fd3d0e5 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -278,10 +278,11 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable { (JFIFMarkerSegment) findMarkerSegment (JFIFMarkerSegment.class, true); if (jfif == null) { - throw new IIOException - ("ICC APP2 encountered without prior JFIF!"); + newGuy = new MarkerSegment(buffer); + newGuy.loadData(buffer); + } else { + jfif.addICC(buffer); } - jfif.addICC(buffer); // newGuy remains null } else { newGuy = new MarkerSegment(buffer); From 61fc7dfe0c702ee5399a453515cc986eae0a7077 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Wed, 4 Sep 2013 15:18:54 +0100 Subject: [PATCH 120/983] 8023762: Add ChronoPeriod interface and bind period to Chronology Make Period ISO-only, adding a Chronology-specific period concept Reviewed-by: sherman --- .../share/classes/java/time/LocalDate.java | 6 +- jdk/src/share/classes/java/time/Period.java | 198 +++++---- .../java/time/chrono/ChronoLocalDate.java | 12 +- .../java/time/chrono/ChronoPeriod.java | 365 ++++++++++++++++ .../java/time/chrono/ChronoPeriodImpl.java | 399 ++++++++++++++++++ .../classes/java/time/chrono/Chronology.java | 35 +- .../classes/java/time/chrono/HijrahDate.java | 5 +- .../java/time/chrono/IsoChronology.java | 19 + .../java/time/chrono/JapaneseDate.java | 5 +- .../classes/java/time/chrono/MinguoDate.java | 5 +- .../share/classes/java/time/chrono/Ser.java | 5 + .../java/time/chrono/ThaiBuddhistDate.java | 5 +- .../classes/java/time/temporal/Temporal.java | 27 +- .../java/time/tck/java/time/TCKPeriod.java | 111 ++++- .../tck/java/time/chrono/TCKChronoPeriod.java | 279 ++++++++++++ .../time/chrono/TCKJapaneseChronology.java | 10 +- .../java/time/chrono/TCKMinguoChronology.java | 12 +- .../chrono/TCKThaiBuddhistChronology.java | 10 +- .../time/chrono/TestUmmAlQuraChronology.java | 22 +- 19 files changed, 1390 insertions(+), 140 deletions(-) create mode 100644 jdk/src/share/classes/java/time/chrono/ChronoPeriod.java create mode 100644 jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java create mode 100644 jdk/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java diff --git a/jdk/src/share/classes/java/time/LocalDate.java b/jdk/src/share/classes/java/time/LocalDate.java index e2043f9a90d..110a80fc9c0 100644 --- a/jdk/src/share/classes/java/time/LocalDate.java +++ b/jdk/src/share/classes/java/time/LocalDate.java @@ -1642,12 +1642,12 @@ public final class LocalDate * * The choice should be made based on which makes the code more readable. * - * @param endDate the end date, exclusive, which may be in any chronology, not null + * @param endDateExclusive the end date, exclusive, which may be in any chronology, not null * @return the period between this date and the end date, not null */ @Override - public Period until(ChronoLocalDate endDate) { - LocalDate end = LocalDate.from(endDate); + public Period until(ChronoLocalDate endDateExclusive) { + LocalDate end = LocalDate.from(endDateExclusive); long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe int days = end.day - this.day; if (totalMonths > 0 && days < 0) { diff --git a/jdk/src/share/classes/java/time/Period.java b/jdk/src/share/classes/java/time/Period.java index 161ce49e565..bd272a9913e 100644 --- a/jdk/src/share/classes/java/time/Period.java +++ b/jdk/src/share/classes/java/time/Period.java @@ -61,7 +61,6 @@ */ package java.time; -import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.YEARS; @@ -70,17 +69,19 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoPeriod; import java.time.chrono.Chronology; +import java.time.chrono.IsoChronology; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; +import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; -import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -89,12 +90,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * A date-based amount of time, such as '2 years, 3 months and 4 days'. + * A date-based amount of time in the ISO-8601 calendar system, + * such as '2 years, 3 months and 4 days'. *

    * This class models a quantity or amount of time in terms of years, months and days. * See {@link Duration} for the time-based equivalent to this class. *

    - * Durations and period differ in their treatment of daylight savings time + * Durations and periods differ in their treatment of daylight savings time * when added to {@link ZonedDateTime}. A {@code Duration} will add an exact * number of seconds, thus a duration of one day is always exactly 24 hours. * By contrast, a {@code Period} will add a conceptual day, trying to maintain @@ -110,14 +112,12 @@ import java.util.regex.Pattern; * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. * All three fields are always present, but may be set to zero. *

    - * The period may be used with any calendar system. - * The meaning of a "year" or "month" is only applied when the object is added to a date. + * The ISO-8601 calendar system is the modern civil calendar system used today + * in most of the world. It is equivalent to the proleptic Gregorian calendar + * system, in which today's rules for leap years are applied for all time. *

    * The period is modeled as a directed amount of time, meaning that individual parts of the * period may be negative. - *

    - * The months and years fields may be {@linkplain #normalized() normalized}. - * The normalization assumes a 12 month year, so is not appropriate for all calendar systems. * * @implSpec * This class is immutable and thread-safe. @@ -125,7 +125,7 @@ import java.util.regex.Pattern; * @since 1.8 */ public final class Period - implements TemporalAmount, Serializable { + implements ChronoPeriod, Serializable { /** * A constant for a period of zero. @@ -140,6 +140,7 @@ public final class Period */ private final static Pattern PATTERN = Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE); + /** * The set of supported units. */ @@ -234,12 +235,14 @@ public final class Period *

    * This obtains a period based on the specified amount. * A {@code TemporalAmount} represents an amount of time, which may be - * date-based or time-based, which this factory extracts to a period. + * date-based or time-based, which this factory extracts to a {@code Period}. *

    * The conversion loops around the set of units from the amount and uses * the {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} * and {@link ChronoUnit#DAYS DAYS} units to create a period. * If any other units are found then an exception is thrown. + *

    + * If the amount is a {@code ChronoPeriod} then it must use the ISO chronology. * * @param amount the temporal amount to convert, not null * @return the equivalent period, not null @@ -247,6 +250,14 @@ public final class Period * @throws ArithmeticException if the amount of years, months or days exceeds an int */ public static Period from(TemporalAmount amount) { + if (amount instanceof Period) { + return (Period) amount; + } + if (amount instanceof ChronoPeriod) { + if (IsoChronology.INSTANCE.equals(((ChronoPeriod) amount).getChronology()) == false) { + throw new DateTimeException("Period requires ISO chronology: " + amount); + } + } Objects.requireNonNull(amount, "amount"); int years = 0; int months = 0; @@ -358,13 +369,13 @@ public final class Period * The result of this method can be a negative period if the end is before the start. * The negative sign will be the same in each of year, month and day. * - * @param startDate the start date, inclusive, not null - * @param endDate the end date, exclusive, not null + * @param startDateInclusive the start date, inclusive, not null + * @param endDateExclusive the end date, exclusive, not null * @return the period between this date and the end date, not null * @see ChronoLocalDate#until(ChronoLocalDate) */ - public static Period between(LocalDate startDate, LocalDate endDate) { - return startDate.until(endDate); + public static Period between(LocalDate startDateInclusive, LocalDate endDateExclusive) { + return startDateInclusive.until(endDateExclusive); } //----------------------------------------------------------------------- @@ -439,6 +450,21 @@ public final class Period return SUPPORTED_UNITS; } + /** + * Gets the chronology of this period, which is the ISO calendar system. + *

    + * The {@code Chronology} represents the calendar system in use. + * The ISO-8601 calendar system is the modern civil calendar system used today + * in most of the world. It is equivalent to the proleptic Gregorian calendar + * system, in which today's rules for leap years are applied for all time. + * + * @return the ISO chronology, not null + */ + @Override + public IsoChronology getChronology() { + return IsoChronology.INSTANCE; + } + //----------------------------------------------------------------------- /** * Checks if all three units of this period are zero. @@ -468,7 +494,7 @@ public final class Period *

    * This returns the years unit. *

    - * The months unit is not normalized with the years unit. + * The months unit is not automatically normalized with the years unit. * This means that a period of "15 months" is different to a period * of "1 year and 3 months". * @@ -483,7 +509,7 @@ public final class Period *

    * This returns the months unit. *

    - * The months unit is not normalized with the years unit. + * The months unit is not automatically normalized with the years unit. * This means that a period of "15 months" is different to a period * of "1 year and 3 months". * @@ -511,7 +537,7 @@ public final class Period * This sets the amount of the years unit in a copy of this period. * The months and days units are unaffected. *

    - * The months unit is not normalized with the years unit. + * The months unit is not automatically normalized with the years unit. * This means that a period of "15 months" is different to a period * of "1 year and 3 months". *

    @@ -533,7 +559,7 @@ public final class Period * This sets the amount of the months unit in a copy of this period. * The years and days units are unaffected. *

    - * The months unit is not normalized with the years unit. + * The months unit is not automatically normalized with the years unit. * This means that a period of "15 months" is different to a period * of "1 year and 3 months". *

    @@ -572,21 +598,28 @@ public final class Period * Returns a copy of this period with the specified period added. *

    * This operates separately on the years, months and days. + * No normalization is performed. *

    * For example, "1 year, 6 months and 3 days" plus "2 years, 2 months and 2 days" * returns "3 years, 8 months and 5 days". *

    + * The specified amount is typically an instance of {@code Period}. + * Other types are interpreted using {@link Period#from(TemporalAmount)}. + *

    * This instance is immutable and unaffected by this method call. * * @param amountToAdd the period to add, not null * @return a {@code Period} based on this period with the requested period added, not null + * @throws DateTimeException if the specified amount has a non-ISO chronology or + * contains an invalid unit * @throws ArithmeticException if numeric overflow occurs */ - public Period plus(Period amountToAdd) { + public Period plus(TemporalAmount amountToAdd) { + Period isoAmount = Period.from(amountToAdd); return create( - Math.addExact(years, amountToAdd.years), - Math.addExact(months, amountToAdd.months), - Math.addExact(days, amountToAdd.days)); + Math.addExact(years, isoAmount.years), + Math.addExact(months, isoAmount.months), + Math.addExact(days, isoAmount.days)); } /** @@ -654,21 +687,28 @@ public final class Period * Returns a copy of this period with the specified period subtracted. *

    * This operates separately on the years, months and days. + * No normalization is performed. *

    * For example, "1 year, 6 months and 3 days" minus "2 years, 2 months and 2 days" * returns "-1 years, 4 months and 1 day". *

    + * The specified amount is typically an instance of {@code Period}. + * Other types are interpreted using {@link Period#from(TemporalAmount)}. + *

    * This instance is immutable and unaffected by this method call. * * @param amountToSubtract the period to subtract, not null * @return a {@code Period} based on this period with the requested period subtracted, not null + * @throws DateTimeException if the specified amount has a non-ISO chronology or + * contains an invalid unit * @throws ArithmeticException if numeric overflow occurs */ - public Period minus(Period amountToSubtract) { + public Period minus(TemporalAmount amountToSubtract) { + Period isoAmount = Period.from(amountToSubtract); return create( - Math.subtractExact(years, amountToSubtract.years), - Math.subtractExact(months, amountToSubtract.months), - Math.subtractExact(days, amountToSubtract.days)); + Math.subtractExact(years, isoAmount.years), + Math.subtractExact(months, isoAmount.months), + Math.subtractExact(days, isoAmount.days)); } /** @@ -766,8 +806,7 @@ public final class Period //----------------------------------------------------------------------- /** - * Returns a copy of this period with the years and months normalized - * using a 12 month year. + * Returns a copy of this period with the years and months normalized. *

    * This normalizes the years and months units, leaving the days unit unchanged. * The months unit is adjusted to have an absolute value less than 11, @@ -778,8 +817,6 @@ public final class Period * For example, a period of "1 year and -25 months" will be normalized to * "-1 year and -1 month". *

    - * This normalization uses a 12 month year which is not valid for all calendar systems. - *

    * This instance is immutable and unaffected by this method call. * * @return a {@code Period} based on this period with excess months normalized to years, not null @@ -796,13 +833,11 @@ public final class Period } /** - * Gets the total number of months in this period using a 12 month year. + * Gets the total number of months in this period. *

    * This returns the total number of months in the period by multiplying the * number of years by 12 and adding the number of months. *

    - * This uses a 12 month year which is not valid for all calendar systems. - *

    * This instance is immutable and unaffected by this method call. * * @return the total number of months in the period, may be negative @@ -817,6 +852,7 @@ public final class Period *

    * This returns a temporal object of the same observable type as the input * with this period added. + * If the temporal has a chronology, it must be the ISO chronology. *

    * In most cases, it is clearer to reverse the calling pattern by using * {@link Temporal#plus(TemporalAmount)}. @@ -826,10 +862,17 @@ public final class Period * dateTime = dateTime.plus(thisPeriod); * *

    - * The calculation will add the years, then months, then days. - * Only non-zero amounts will be added. - * If the date-time has a calendar system with a fixed number of months in a - * year, then the years and months will be combined before being added. + * The calculation operates as follows. + * First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + * Second, if the months are zero, the years are added if non-zero, otherwise + * the combination of years and months is added if non-zero. + * Finally, any days are added. + *

    + * This approach ensures that a partial period can be added to a partial date. + * For example, a period of years and/or months can be added to a {@code YearMonth}, + * but a period including days cannot. + * The approach also adds years and months together when necessary, which ensures + * correct behaviour at the end of the month. *

    * This instance is immutable and unaffected by this method call. * @@ -840,18 +883,15 @@ public final class Period */ @Override public Temporal addTo(Temporal temporal) { - Objects.requireNonNull(temporal, "temporal"); - if ((years | months) != 0) { - long monthRange = monthRange(temporal); - if (monthRange >= 0) { - temporal = temporal.plus(years * monthRange + months, MONTHS); - } else { - if (years != 0) { - temporal = temporal.plus(years, YEARS); - } - if (months != 0) { - temporal = temporal.plus(months, MONTHS); - } + validateChrono(temporal); + if (months == 0) { + if (years != 0) { + temporal = temporal.plus(years, YEARS); + } + } else { + long totalMonths = toTotalMonths(); + if (totalMonths != 0) { + temporal = temporal.plus(totalMonths, MONTHS); } } if (days != 0) { @@ -865,6 +905,7 @@ public final class Period *

    * This returns a temporal object of the same observable type as the input * with this period subtracted. + * If the temporal has a chronology, it must be the ISO chronology. *

    * In most cases, it is clearer to reverse the calling pattern by using * {@link Temporal#minus(TemporalAmount)}. @@ -874,10 +915,17 @@ public final class Period * dateTime = dateTime.minus(thisPeriod); * *

    - * The calculation will subtract the years, then months, then days. - * Only non-zero amounts will be subtracted. - * If the date-time has a calendar system with a fixed number of months in a - * year, then the years and months will be combined before being subtracted. + * The calculation operates as follows. + * First, the chronology of the temporal is checked to ensure it is ISO chronology or null. + * Second, if the months are zero, the years are subtracted if non-zero, otherwise + * the combination of years and months is subtracted if non-zero. + * Finally, any days are subtracted. + *

    + * This approach ensures that a partial period can be subtracted from a partial date. + * For example, a period of years and/or months can be subtracted from a {@code YearMonth}, + * but a period including days cannot. + * The approach also subtracts years and months together when necessary, which ensures + * correct behaviour at the end of the month. *

    * This instance is immutable and unaffected by this method call. * @@ -888,18 +936,15 @@ public final class Period */ @Override public Temporal subtractFrom(Temporal temporal) { - Objects.requireNonNull(temporal, "temporal"); - if ((years | months) != 0) { - long monthRange = monthRange(temporal); - if (monthRange >= 0) { - temporal = temporal.minus(years * monthRange + months, MONTHS); - } else { - if (years != 0) { - temporal = temporal.minus(years, YEARS); - } - if (months != 0) { - temporal = temporal.minus(months, MONTHS); - } + validateChrono(temporal); + if (months == 0) { + if (years != 0) { + temporal = temporal.minus(years, YEARS); + } + } else { + long totalMonths = toTotalMonths(); + if (totalMonths != 0) { + temporal = temporal.minus(totalMonths, MONTHS); } } if (days != 0) { @@ -909,26 +954,21 @@ public final class Period } /** - * Calculates the range of months based on the temporal. - * - * @param temporal the temporal, not null - * @return the month range, negative if not fixed range + * Validates that the temporal has the correct chronology. */ - private long monthRange(Temporal temporal) { - if (temporal.isSupported(MONTH_OF_YEAR)) { - ValueRange startRange = Chronology.from(temporal).range(MONTH_OF_YEAR); - if (startRange.isFixed() && startRange.isIntValue()) { - return startRange.getMaximum() - startRange.getMinimum() + 1; - } + private void validateChrono(TemporalAccessor temporal) { + Objects.requireNonNull(temporal, "temporal"); + Chronology temporalChrono = temporal.query(TemporalQuery.chronology()); + if (temporalChrono != null && IsoChronology.INSTANCE.equals(temporalChrono) == false) { + throw new DateTimeException("Chronology mismatch, expected: ISO, actual: " + temporalChrono.getId()); } - return -1; } //----------------------------------------------------------------------- /** * Checks if this period is equal to another period. *

    - * The comparison is based on the amounts held in the period. + * The comparison is based on the type {@code Period} and each of the three amounts. * To be equal, the years, months and days units must be individually equal. * Note that this means that a period of "15 Months" is not equal to a period * of "1 Year and 3 Months". diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java index e02a8cd5392..58ae3b8c1c5 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java @@ -69,7 +69,6 @@ import static java.time.temporal.ChronoUnit.DAYS; import java.time.DateTimeException; import java.time.LocalDate; import java.time.LocalTime; -import java.time.Period; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; @@ -602,9 +601,12 @@ public interface ChronoLocalDate long until(Temporal endDate, TemporalUnit unit); /** - * Calculates the period between this date and another date as a {@code Period}. + * Calculates the period between this date and another date as a {@code ChronoPeriod}. + *

    + * This calculates the period between two dates. All supplied chronologies + * calculate the period using years, months and days, however the + * {@code ChronoPeriod} API allows the period to be represented using other units. *

    - * This calculates the period between two dates in terms of years, months and days. * The start and end points are {@code this} and the specified date. * The result will be negative if the end is before the start. * The negative sign will be the same in each of year, month and day. @@ -614,12 +616,12 @@ public interface ChronoLocalDate *

    * This instance is immutable and unaffected by this method call. * - * @param endDate the end date, exclusive, which may be in any chronology, not null + * @param endDateExclusive the end date, exclusive, which may be in any chronology, not null * @return the period between this date and the end date, not null * @throws DateTimeException if the period cannot be calculated * @throws ArithmeticException if numeric overflow occurs */ - Period until(ChronoLocalDate endDate); + ChronoPeriod until(ChronoLocalDate endDateExclusive); /** * Formats this date using the specified formatter. diff --git a/jdk/src/share/classes/java/time/chrono/ChronoPeriod.java b/jdk/src/share/classes/java/time/chrono/ChronoPeriod.java new file mode 100644 index 00000000000..0ac1d395143 --- /dev/null +++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriod.java @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package java.time.chrono; + +import java.time.DateTimeException; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAmount; +import java.time.temporal.TemporalUnit; +import java.time.temporal.UnsupportedTemporalTypeException; +import java.util.List; +import java.util.Objects; + +/** + * A date-based amount of time, such as '3 years, 4 months and 5 days' in an + * arbitrary chronology, intended for advanced globalization use cases. + *

    + * This interface models a date-based amount of time in a calendar system. + * While most calendar systems use years, months and days, some do not. + * Therefore, this interface operates solely in terms of a set of supported + * units that are defined by the {@code Chronology}. + * The set of supported units is fixed for a given chronology. + * The amount of a supported unit may be set to zero. + *

    + * The period is modeled as a directed amount of time, meaning that individual + * parts of the period may be negative. + * + * @implSpec + * This interface must be implemented with care to ensure other classes operate correctly. + * All implementations that can be instantiated must be final, immutable and thread-safe. + * Subclasses should be Serializable wherever possible. + * + * @since 1.8 + */ +public interface ChronoPeriod + extends TemporalAmount { + + /** + * Obtains a {@code ChronoPeriod} consisting of amount of time between two dates. + *

    + * The start date is included, but the end date is not. + * The period is calculated using {@link ChronoLocalDate#until(ChronoLocalDate)}. + * As such, the calculation is chronology specific. + *

    + * The chronology of the first date is used. + * The chronology of the second date is ignored, with the date being converted + * to the target chronology system before the calculation starts. + *

    + * The result of this method can be a negative period if the end is before the start. + * In most cases, the positive/negative sign will be the same in each of the supported fields. + * + * @param startDateInclusive the start date, inclusive, specifying the chronology of the calculation, not null + * @param endDateExclusive the end date, exclusive, in any chronology, not null + * @return the period between this date and the end date, not null + * @see ChronoLocalDate#until(ChronoLocalDate) + */ + public static ChronoPeriod between(ChronoLocalDate startDateInclusive, ChronoLocalDate endDateExclusive) { + Objects.requireNonNull(startDateInclusive, "startDateInclusive"); + Objects.requireNonNull(endDateExclusive, "endDateExclusive"); + return startDateInclusive.until(endDateExclusive); + } + + //----------------------------------------------------------------------- + /** + * Gets the value of the requested unit. + *

    + * The supported units are chronology specific. + * They will typically be {@link ChronoUnit#YEARS YEARS}, + * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. + * Requesting an unsupported unit will throw an exception. + * + * @param unit the {@code TemporalUnit} for which to return the value + * @return the long value of the unit + * @throws DateTimeException if the unit is not supported + * @throws UnsupportedTemporalTypeException if the unit is not supported + */ + @Override + long get(TemporalUnit unit); + + /** + * Gets the set of units supported by this period. + *

    + * The supported units are chronology specific. + * They will typically be {@link ChronoUnit#YEARS YEARS}, + * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. + * They are returned in order from largest to smallest. + *

    + * This set can be used in conjunction with {@link #get(TemporalUnit)} + * to access the entire state of the period. + * + * @return a list containing the supported units, not null + */ + @Override + List getUnits(); + + /** + * Gets the chronology that defines the meaning of the supported units. + *

    + * The period is defined by the chronology. + * It controls the supported units and restricts addition/subtraction + * to {@code ChronoLocalDate} instances of the same chronology. + * + * @return the chronology defining the period, not null + */ + Chronology getChronology(); + + //----------------------------------------------------------------------- + /** + * Checks if all the supported units of this period are zero. + * + * @return true if this period is zero-length + */ + default boolean isZero() { + for (TemporalUnit unit : getUnits()) { + if (get(unit) != 0) { + return false; + } + } + return true; + } + + /** + * Checks if any of the supported units of this period are negative. + * + * @return true if any unit of this period is negative + */ + default boolean isNegative() { + for (TemporalUnit unit : getUnits()) { + if (get(unit) < 0) { + return true; + } + } + return false; + } + + //----------------------------------------------------------------------- + /** + * Returns a copy of this period with the specified period added. + *

    + * If the specified amount is a {@code ChronoPeriod} then it must have + * the same chronology as this period. Implementations may choose to + * accept or reject other {@code TemporalAmount} implementations. + *

    + * This instance is immutable and unaffected by this method call. + * + * @param amountToAdd the period to add, not null + * @return a {@code ChronoPeriod} based on this period with the requested period added, not null + * @throws ArithmeticException if numeric overflow occurs + */ + ChronoPeriod plus(TemporalAmount amountToAdd); + + /** + * Returns a copy of this period with the specified period subtracted. + *

    + * If the specified amount is a {@code ChronoPeriod} then it must have + * the same chronology as this period. Implementations may choose to + * accept or reject other {@code TemporalAmount} implementations. + *

    + * This instance is immutable and unaffected by this method call. + * + * @param amountToSubtract the period to subtract, not null + * @return a {@code ChronoPeriod} based on this period with the requested period subtracted, not null + * @throws ArithmeticException if numeric overflow occurs + */ + ChronoPeriod minus(TemporalAmount amountToSubtract); + + //----------------------------------------------------------------------- + /** + * Returns a new instance with each amount in this period in this period + * multiplied by the specified scalar. + *

    + * This returns a period with each supported unit individually multiplied. + * For example, a period of "2 years, -3 months and 4 days" multiplied by + * 3 will return "6 years, -9 months and 12 days". + * No normalization is performed. + * + * @param scalar the scalar to multiply by, not null + * @return a {@code ChronoPeriod} based on this period with the amounts multiplied + * by the scalar, not null + * @throws ArithmeticException if numeric overflow occurs + */ + ChronoPeriod multipliedBy(int scalar); + + /** + * Returns a new instance with each amount in this period negated. + *

    + * This returns a period with each supported unit individually negated. + * For example, a period of "2 years, -3 months and 4 days" will be + * negated to "-2 years, 3 months and -4 days". + * No normalization is performed. + * + * @return a {@code ChronoPeriod} based on this period with the amounts negated, not null + * @throws ArithmeticException if numeric overflow occurs, which only happens if + * one of the units has the value {@code Long.MIN_VALUE} + */ + default ChronoPeriod negated() { + return multipliedBy(-1); + } + + //----------------------------------------------------------------------- + /** + * Returns a copy of this period with the amounts of each unit normalized. + *

    + * The process of normalization is specific to each calendar system. + * For example, in the ISO calendar system, the years and months are + * normalized but the days are not, such that "15 months" would be + * normalized to "1 year and 3 months". + *

    + * This instance is immutable and unaffected by this method call. + * + * @return a {@code ChronoPeriod} based on this period with the amounts of each + * unit normalized, not null + * @throws ArithmeticException if numeric overflow occurs + */ + ChronoPeriod normalized(); + + //------------------------------------------------------------------------- + /** + * Adds this period to the specified temporal object. + *

    + * This returns a temporal object of the same observable type as the input + * with this period added. + *

    + * In most cases, it is clearer to reverse the calling pattern by using + * {@link Temporal#plus(TemporalAmount)}. + *

    +     *   // these two lines are equivalent, but the second approach is recommended
    +     *   dateTime = thisPeriod.addTo(dateTime);
    +     *   dateTime = dateTime.plus(thisPeriod);
    +     * 
    + *

    + * The specified temporal must have the same chronology as this period. + * This returns a temporal with the non-zero supported units added. + *

    + * This instance is immutable and unaffected by this method call. + * + * @param temporal the temporal object to adjust, not null + * @return an object of the same type with the adjustment made, not null + * @throws DateTimeException if unable to add + * @throws ArithmeticException if numeric overflow occurs + */ + @Override + Temporal addTo(Temporal temporal); + + /** + * Subtracts this period from the specified temporal object. + *

    + * This returns a temporal object of the same observable type as the input + * with this period subtracted. + *

    + * In most cases, it is clearer to reverse the calling pattern by using + * {@link Temporal#minus(TemporalAmount)}. + *

    +     *   // these two lines are equivalent, but the second approach is recommended
    +     *   dateTime = thisPeriod.subtractFrom(dateTime);
    +     *   dateTime = dateTime.minus(thisPeriod);
    +     * 
    + *

    + * The specified temporal must have the same chronology as this period. + * This returns a temporal with the non-zero supported units subtracted. + *

    + * This instance is immutable and unaffected by this method call. + * + * @param temporal the temporal object to adjust, not null + * @return an object of the same type with the adjustment made, not null + * @throws DateTimeException if unable to subtract + * @throws ArithmeticException if numeric overflow occurs + */ + @Override + Temporal subtractFrom(Temporal temporal); + + //----------------------------------------------------------------------- + /** + * Checks if this period is equal to another period, including the chronology. + *

    + * Compares this period with another ensuring that the type, each amount and + * the chronology are the same. + * Note that this means that a period of "15 Months" is not equal to a period + * of "1 Year and 3 Months". + * + * @param obj the object to check, null returns false + * @return true if this is equal to the other period + */ + @Override + boolean equals(Object obj); + + /** + * A hash code for this period. + * + * @return a suitable hash code + */ + @Override + int hashCode(); + + //----------------------------------------------------------------------- + /** + * Outputs this period as a {@code String}. + *

    + * The output will include the period amounts and chronology. + * + * @return a string representation of this period, not null + */ + @Override + String toString(); + +} diff --git a/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java new file mode 100644 index 00000000000..d301adb2d03 --- /dev/null +++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package java.time.chrono; + +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.YEARS; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectStreamException; +import java.io.Serializable; +import java.time.DateTimeException; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalAmount; +import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalUnit; +import java.time.temporal.UnsupportedTemporalTypeException; +import java.time.temporal.ValueRange; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * A period expressed in terms of a standard year-month-day calendar system. + *

    + * This class is used by applications seeking to handle dates in non-ISO calendar systems. + * For example, the Japanese, Minguo, Thai Buddhist and others. + * + * @implSpec + * This class is immutable nad thread-safe. + * + * @since 1.8 + */ +final class ChronoPeriodImpl + implements ChronoPeriod, Serializable { + // this class is only used by JDK chronology implementations and makes assumptions based on that fact + + /** + * Serialization version. + */ + private static final long serialVersionUID = 57387258289L; + + /** + * The set of supported units. + */ + private final static List SUPPORTED_UNITS = + Collections.unmodifiableList(Arrays.asList(YEARS, MONTHS, DAYS)); + + /** + * The chronology. + */ + private final Chronology chrono; + /** + * The number of years. + */ + final int years; + /** + * The number of months. + */ + final int months; + /** + * The number of days. + */ + final int days; + + /** + * Creates an instance. + */ + ChronoPeriodImpl(Chronology chrono, int years, int months, int days) { + Objects.requireNonNull(chrono, "chrono"); + this.chrono = chrono; + this.years = years; + this.months = months; + this.days = days; + } + + //----------------------------------------------------------------------- + @Override + public long get(TemporalUnit unit) { + if (unit == ChronoUnit.YEARS) { + return years; + } else if (unit == ChronoUnit.MONTHS) { + return months; + } else if (unit == ChronoUnit.DAYS) { + return days; + } else { + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); + } + } + + @Override + public List getUnits() { + return ChronoPeriodImpl.SUPPORTED_UNITS; + } + + @Override + public Chronology getChronology() { + return chrono; + } + + //----------------------------------------------------------------------- + @Override + public boolean isZero() { + return years == 0 && months == 0 && days == 0; + } + + @Override + public boolean isNegative() { + return years < 0 || months < 0 || days < 0; + } + + //----------------------------------------------------------------------- + @Override + public ChronoPeriod plus(TemporalAmount amountToAdd) { + ChronoPeriodImpl amount = validateAmount(amountToAdd); + return new ChronoPeriodImpl( + chrono, + Math.addExact(years, amount.years), + Math.addExact(months, amount.months), + Math.addExact(days, amount.days)); + } + + @Override + public ChronoPeriod minus(TemporalAmount amountToSubtract) { + ChronoPeriodImpl amount = validateAmount(amountToSubtract); + return new ChronoPeriodImpl( + chrono, + Math.subtractExact(years, amount.years), + Math.subtractExact(months, amount.months), + Math.subtractExact(days, amount.days)); + } + + /** + * Obtains an instance of {@code ChronoPeriodImpl} from a temporal amount. + * + * @param amount the temporal amount to convert, not null + * @return the period, not null + */ + private ChronoPeriodImpl validateAmount(TemporalAmount amount) { + Objects.requireNonNull(amount, "amount"); + if (amount instanceof ChronoPeriodImpl == false) { + throw new DateTimeException("Unable to obtain ChronoPeriod from TemporalAmount: " + amount.getClass()); + } + ChronoPeriodImpl period = (ChronoPeriodImpl) amount; + if (chrono.equals(period.getChronology()) == false) { + throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + period.getChronology().getId()); + } + return period; + } + + //----------------------------------------------------------------------- + @Override + public ChronoPeriod multipliedBy(int scalar) { + if (this.isZero() || scalar == 1) { + return this; + } + return new ChronoPeriodImpl( + chrono, + Math.multiplyExact(years, scalar), + Math.multiplyExact(months, scalar), + Math.multiplyExact(days, scalar)); + } + + //----------------------------------------------------------------------- + @Override + public ChronoPeriod normalized() { + long monthRange = monthRange(); + if (monthRange > 0) { + long totalMonths = years * monthRange + months; + long splitYears = totalMonths / monthRange; + int splitMonths = (int) (totalMonths % monthRange); // no overflow + if (splitYears == years && splitMonths == months) { + return this; + } + return new ChronoPeriodImpl(chrono, Math.toIntExact(splitYears), splitMonths, days); + + } + return this; + } + + /** + * Calculates the range of months. + * + * @return the month range, -1 if not fixed range + */ + private long monthRange() { + ValueRange startRange = chrono.range(MONTH_OF_YEAR); + if (startRange.isFixed() && startRange.isIntValue()) { + return startRange.getMaximum() - startRange.getMinimum() + 1; + } + return -1; + } + + //------------------------------------------------------------------------- + @Override + public Temporal addTo(Temporal temporal) { + validateChrono(temporal); + if (months == 0) { + if (years != 0) { + temporal = temporal.plus(years, YEARS); + } + } else { + long monthRange = monthRange(); + if (monthRange > 0) { + temporal = temporal.plus(years * monthRange + months, MONTHS); + } else { + if (years != 0) { + temporal = temporal.plus(years, YEARS); + } + temporal = temporal.plus(months, MONTHS); + } + } + if (days != 0) { + temporal = temporal.plus(days, DAYS); + } + return temporal; + } + + + + @Override + public Temporal subtractFrom(Temporal temporal) { + validateChrono(temporal); + if (months == 0) { + if (years != 0) { + temporal = temporal.minus(years, YEARS); + } + } else { + long monthRange = monthRange(); + if (monthRange > 0) { + temporal = temporal.minus(years * monthRange + months, MONTHS); + } else { + if (years != 0) { + temporal = temporal.minus(years, YEARS); + } + temporal = temporal.minus(months, MONTHS); + } + } + if (days != 0) { + temporal = temporal.minus(days, DAYS); + } + return temporal; + } + + /** + * Validates that the temporal has the correct chronology. + */ + private void validateChrono(TemporalAccessor temporal) { + Objects.requireNonNull(temporal, "temporal"); + Chronology temporalChrono = temporal.query(TemporalQuery.chronology()); + if (temporalChrono != null && chrono.equals(temporalChrono) == false) { + throw new DateTimeException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + temporalChrono.getId()); + } + } + + //----------------------------------------------------------------------- + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof ChronoPeriodImpl) { + ChronoPeriodImpl other = (ChronoPeriodImpl) obj; + return years == other.years && months == other.months && + days == other.days && chrono.equals(other.chrono); + } + return false; + } + + @Override + public int hashCode() { + return (years + Integer.rotateLeft(months, 8) + Integer.rotateLeft(days, 16)) ^ chrono.hashCode(); + } + + //----------------------------------------------------------------------- + @Override + public String toString() { + if (isZero()) { + return getChronology().toString() + " P0D"; + } else { + StringBuilder buf = new StringBuilder(); + buf.append(getChronology().toString()).append(' ').append('P'); + if (years != 0) { + buf.append(years).append('Y'); + } + if (months != 0) { + buf.append(months).append('M'); + } + if (days != 0) { + buf.append(days).append('D'); + } + return buf.toString(); + } + } + + //----------------------------------------------------------------------- + /** + * Writes the Chronology using a + * dedicated serialized form. + *

    +     *  out.writeByte(12);  // identifies this as a ChronoPeriodImpl
    +     *  out.writeUTF(getId());  // the chronology
    +     *  out.writeInt(years);
    +     *  out.writeInt(months);
    +     *  out.writeInt(days);
    +     * 
    + * + * @return the instance of {@code Ser}, not null + */ + protected Object writeReplace() { + return new Ser(Ser.CHRONO_PERIOD_TYPE, this); + } + + /** + * Defend against malicious streams. + * @return never + * @throws InvalidObjectException always + */ + private Object readResolve() throws ObjectStreamException { + throw new InvalidObjectException("Deserialization via serialization delegate"); + } + + void writeExternal(DataOutput out) throws IOException { + out.writeUTF(chrono.getId()); + out.writeInt(years); + out.writeInt(months); + out.writeInt(days); + } + + static ChronoPeriodImpl readExternal(DataInput in) throws IOException { + Chronology chrono = Chronology.of(in.readUTF()); + int years = in.readInt(); + int months = in.readInt(); + int days = in.readInt(); + return new ChronoPeriodImpl(chrono, years, months, days); + } + +} diff --git a/jdk/src/share/classes/java/time/chrono/Chronology.java b/jdk/src/share/classes/java/time/chrono/Chronology.java index 36c9d31c3fd..ed40f4138f0 100644 --- a/jdk/src/share/classes/java/time/chrono/Chronology.java +++ b/jdk/src/share/classes/java/time/chrono/Chronology.java @@ -91,14 +91,11 @@ import java.time.DayOfWeek; import java.time.Instant; import java.time.LocalDate; import java.time.LocalTime; -import java.time.Month; -import java.time.Year; import java.time.ZoneId; import java.time.format.DateTimeFormatterBuilder; import java.time.format.ResolverStyle; import java.time.format.TextStyle; import java.time.temporal.ChronoField; -import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; @@ -1190,6 +1187,38 @@ public abstract class Chronology implements Comparable { fieldValues.put(field, value); } + //----------------------------------------------------------------------- + /** + * Obtains a period for this chronology based on years, months and days. + *

    + * This returns a period tied to this chronology using the specified + * years, months and days. All supplied chronologies use periods + * based on years, months and days, however the {@code ChronoPeriod} API + * allows the period to be represented using other units. + * + * @implSpec + * The default implementation returns an implementation class suitable + * for most calendar systems. It is based solely on the three units. + * Normalization, addition and subtraction derive the number of months + * in a year from the {@link #range(ChronoField)}. If the number of + * months within a year is fixed, then the calculation approach for + * addition, subtraction and normalization is slightly different. + *

    + * If implementing an unusual calendar system that is not based on + * years, months and days, or where you want direct control, then + * the {@code ChronoPeriod} interface must be directly implemented. + *

    + * The returned period is immutable and thread-safe. + * + * @param years the number of years, may be negative + * @param months the number of years, may be negative + * @param days the number of years, may be negative + * @return the period in terms of this chronology, not null + */ + public ChronoPeriod period(int years, int months, int days) { + return new ChronoPeriodImpl(this, years, months, days); + } + //----------------------------------------------------------------------- /** * Compares this chronology to another chronology. diff --git a/jdk/src/share/classes/java/time/chrono/HijrahDate.java b/jdk/src/share/classes/java/time/chrono/HijrahDate.java index c0d942396cd..d2c9929316c 100644 --- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java +++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java @@ -73,7 +73,6 @@ import java.time.Clock; import java.time.DateTimeException; import java.time.LocalDate; import java.time.LocalTime; -import java.time.Period; import java.time.ZoneId; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; @@ -582,7 +581,7 @@ public final class HijrahDate } @Override - public Period until(ChronoLocalDate endDate) { + public ChronoPeriod until(ChronoLocalDate endDate) { // TODO: untested HijrahDate end = getChronology().date(endDate); long totalMonths = (end.prolepticYear - this.prolepticYear) * 12 + (end.monthOfYear - this.monthOfYear); // safe @@ -597,7 +596,7 @@ public final class HijrahDate } long years = totalMonths / 12; // safe int months = (int) (totalMonths % 12); // safe - return Period.of(Math.toIntExact(years), months, days); + return getChronology().period(Math.toIntExact(years), months, days); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/IsoChronology.java b/jdk/src/share/classes/java/time/chrono/IsoChronology.java index 2012e64e04d..9638f6eea4f 100644 --- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java +++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java @@ -77,6 +77,7 @@ import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Month; +import java.time.Period; import java.time.Year; import java.time.ZoneId; import java.time.ZonedDateTime; @@ -565,6 +566,24 @@ public final class IsoChronology extends Chronology implements Serializable { return field.range(); } + //----------------------------------------------------------------------- + /** + * Obtains a period for this chronology based on years, months and days. + *

    + * This returns a period tied to the ISO chronology using the specified + * years, months and days. See {@link Period} for further details. + * + * @param years the number of years, may be negative + * @param months the number of years, may be negative + * @param days the number of years, may be negative + * @return the period in terms of this chronology, not null + * @return the ISO period, not null + */ + @Override // override with covariant return type + public Period period(int years, int months, int days) { + return Period.of(years, months, days); + } + //----------------------------------------------------------------------- /** * Writes the Chronology using a diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java index bc9f473486d..ae4708dbaff 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java @@ -659,8 +659,9 @@ public final class JapaneseDate } @Override - public Period until(ChronoLocalDate endDate) { - return isoDate.until(endDate); + public ChronoPeriod until(ChronoLocalDate endDate) { + Period period = isoDate.until(endDate); + return getChronology().period(period.getYears(), period.getMonths(), period.getDays()); } @Override // override for performance diff --git a/jdk/src/share/classes/java/time/chrono/MinguoDate.java b/jdk/src/share/classes/java/time/chrono/MinguoDate.java index fd10e0e985e..42e0dab0da5 100644 --- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java +++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java @@ -421,8 +421,9 @@ public final class MinguoDate } @Override - public Period until(ChronoLocalDate endDate) { - return isoDate.until(endDate); + public ChronoPeriod until(ChronoLocalDate endDate) { + Period period = isoDate.until(endDate); + return getChronology().period(period.getYears(), period.getMonths(), period.getDays()); } @Override // override for performance diff --git a/jdk/src/share/classes/java/time/chrono/Ser.java b/jdk/src/share/classes/java/time/chrono/Ser.java index cc99f481f8c..5a4e3c12623 100644 --- a/jdk/src/share/classes/java/time/chrono/Ser.java +++ b/jdk/src/share/classes/java/time/chrono/Ser.java @@ -104,6 +104,7 @@ final class Ser implements Externalizable { static final byte HIJRAH_DATE_TYPE = 6; static final byte MINGUO_DATE_TYPE = 7; static final byte THAIBUDDHIST_DATE_TYPE = 8; + static final byte CHRONO_PERIOD_TYPE = 9; /** The type being serialized. */ private byte type; @@ -183,6 +184,9 @@ final class Ser implements Externalizable { case THAIBUDDHIST_DATE_TYPE: ((ThaiBuddhistDate) object).writeExternal(out); break; + case CHRONO_PERIOD_TYPE: + ((ChronoPeriodImpl) object).writeExternal(out); + break; default: throw new InvalidClassException("Unknown serialized type"); } @@ -235,6 +239,7 @@ final class Ser implements Externalizable { case HIJRAH_DATE_TYPE: return HijrahDate.readExternal(in); case MINGUO_DATE_TYPE: return MinguoDate.readExternal(in); case THAIBUDDHIST_DATE_TYPE: return ThaiBuddhistDate.readExternal(in); + case CHRONO_PERIOD_TYPE: return ChronoPeriodImpl.readExternal(in); default: throw new StreamCorruptedException("Unknown serialized type"); } } diff --git a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java index 648793b7337..89895c8ac48 100644 --- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java +++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java @@ -421,8 +421,9 @@ public final class ThaiBuddhistDate } @Override - public Period until(ChronoLocalDate endDate) { - return isoDate.until(endDate); + public ChronoPeriod until(ChronoLocalDate endDate) { + Period period = isoDate.until(endDate); + return getChronology().period(period.getYears(), period.getMonths(), period.getDays()); } @Override // override for performance diff --git a/jdk/src/share/classes/java/time/temporal/Temporal.java b/jdk/src/share/classes/java/time/temporal/Temporal.java index af8424c1560..54110bed771 100644 --- a/jdk/src/share/classes/java/time/temporal/Temporal.java +++ b/jdk/src/share/classes/java/time/temporal/Temporal.java @@ -170,7 +170,8 @@ public interface Temporal extends TemporalAccessor { * * * @implSpec - * Implementations must not alter either this object. + *

    + * Implementations must not alter either this object or the specified temporal object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. *

    @@ -209,7 +210,7 @@ public interface Temporal extends TemporalAccessor { * is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)} * passing {@code this} as the first argument. *

    - * Implementations must not alter either this object or the specified temporal object. + * Implementations must not alter this object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. * @@ -232,16 +233,17 @@ public interface Temporal extends TemporalAccessor { *

    * Some example code indicating how and why this method is used: *

    -     *  date = date.plus(period);                      // add a Period instance
    -     *  date = date.plus(duration);                    // add a Duration instance
    -     *  date = date.plus(workingDays(6));              // example user-written workingDays method
    +     *  date = date.plus(period);                // add a Period instance
    +     *  date = date.plus(duration);              // add a Duration instance
    +     *  date = date.plus(workingDays(6));        // example user-written workingDays method
          * 
    *

    * Note that calling {@code plus} followed by {@code minus} is not guaranteed to * return the same date-time. * * @implSpec - * Implementations must not alter either this object. + *

    + * Implementations must not alter either this object or the specified temporal object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. *

    @@ -280,7 +282,7 @@ public interface Temporal extends TemporalAccessor { * is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)} * passing {@code this} as the first argument. *

    - * Implementations must not alter either this object or the specified temporal object. + * Implementations must not alter this object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. * @@ -303,16 +305,17 @@ public interface Temporal extends TemporalAccessor { *

    * Some example code indicating how and why this method is used: *

    -     *  date = date.minus(period);                      // subtract a Period instance
    -     *  date = date.minus(duration);                    // subtract a Duration instance
    -     *  date = date.minus(workingDays(6));              // example user-written workingDays method
    +     *  date = date.minus(period);               // subtract a Period instance
    +     *  date = date.minus(duration);             // subtract a Duration instance
    +     *  date = date.minus(workingDays(6));       // example user-written workingDays method
          * 
    *

    * Note that calling {@code plus} followed by {@code minus} is not guaranteed to * return the same date-time. * * @implSpec - * Implementations must not alter either this object. + *

    + * Implementations must not alter either this object or the specified temporal object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. *

    @@ -345,7 +348,7 @@ public interface Temporal extends TemporalAccessor { * @implSpec * Implementations must behave in a manor equivalent to the default method behavior. *

    - * Implementations must not alter either this object or the specified temporal object. + * Implementations must not alter this object. * Instead, an adjusted copy of the original must be returned. * This provides equivalent, safe behavior for immutable and mutable implementations. *

    diff --git a/jdk/test/java/time/tck/java/time/TCKPeriod.java b/jdk/test/java/time/tck/java/time/TCKPeriod.java index 3a1fe42ec45..7743512002f 100644 --- a/jdk/test/java/time/tck/java/time/TCKPeriod.java +++ b/jdk/test/java/time/tck/java/time/TCKPeriod.java @@ -60,6 +60,7 @@ package tck.java.time; import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.HOURS; import static java.time.temporal.ChronoUnit.YEARS; import static org.testng.Assert.assertEquals; @@ -67,6 +68,7 @@ import java.time.DateTimeException; import java.time.Duration; import java.time.LocalDate; import java.time.Period; +import java.time.chrono.ThaiBuddhistChronology; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; @@ -212,6 +214,41 @@ public class TCKPeriod extends AbstractTCKTest { Period.from(amount); } + @Test(expectedExceptions = DateTimeException.class) + public void factory_from_TemporalAmount_DaysHours() { + TemporalAmount amount = new TemporalAmount() { + @Override + public long get(TemporalUnit unit) { + if (unit == DAYS) { + return 1; + } else { + return 2; + } + } + @Override + public List getUnits() { + List list = new ArrayList<>(); + list.add(DAYS); + list.add(HOURS); + return list; + } + @Override + public Temporal addTo(Temporal temporal) { + throw new UnsupportedOperationException(); + } + @Override + public Temporal subtractFrom(Temporal temporal) { + throw new UnsupportedOperationException(); + } + }; + Period.from(amount); + } + + @Test(expectedExceptions = DateTimeException.class) + public void factory_from_TemporalAmount_NonISO() { + Period.from(ThaiBuddhistChronology.INSTANCE.period(1, 1, 1)); + } + @Test(expectedExceptions = DateTimeException.class) public void factory_from_TemporalAmount_Duration() { Period.from(Duration.ZERO); @@ -594,10 +631,45 @@ public class TCKPeriod extends AbstractTCKTest { } @Test(dataProvider="plus") - public void test_plus(Period base, Period add, Period expected) { + public void test_plus_TemporalAmount(Period base, Period add, Period expected) { assertEquals(base.plus(add), expected); } + @Test(expectedExceptions = DateTimeException.class) + public void test_plus_TemporalAmount_nonISO() { + pymd(4, 5, 6).plus(ThaiBuddhistChronology.INSTANCE.period(1, 0, 0)); + } + + @Test(expectedExceptions = DateTimeException.class) + public void test_plus_TemporalAmount_DaysHours() { + TemporalAmount amount = new TemporalAmount() { + @Override + public long get(TemporalUnit unit) { + if (unit == DAYS) { + return 1; + } else { + return 2; + } + } + @Override + public List getUnits() { + List list = new ArrayList<>(); + list.add(DAYS); + list.add(HOURS); + return list; + } + @Override + public Temporal addTo(Temporal temporal) { + throw new UnsupportedOperationException(); + } + @Override + public Temporal subtractFrom(Temporal temporal) { + throw new UnsupportedOperationException(); + } + }; + pymd(4, 5, 6).plus(amount); + } + //----------------------------------------------------------------------- // plusYears() //----------------------------------------------------------------------- @@ -704,10 +776,45 @@ public class TCKPeriod extends AbstractTCKTest { } @Test(dataProvider="minus") - public void test_minus(Period base, Period subtract, Period expected) { + public void test_minus_TemporalAmount(Period base, Period subtract, Period expected) { assertEquals(base.minus(subtract), expected); } + @Test(expectedExceptions = DateTimeException.class) + public void test_minus_TemporalAmount_nonISO() { + pymd(4, 5, 6).minus(ThaiBuddhistChronology.INSTANCE.period(1, 0, 0)); + } + + @Test(expectedExceptions = DateTimeException.class) + public void test_minus_TemporalAmount_DaysHours() { + TemporalAmount amount = new TemporalAmount() { + @Override + public long get(TemporalUnit unit) { + if (unit == DAYS) { + return 1; + } else { + return 2; + } + } + @Override + public List getUnits() { + List list = new ArrayList<>(); + list.add(DAYS); + list.add(HOURS); + return list; + } + @Override + public Temporal addTo(Temporal temporal) { + throw new UnsupportedOperationException(); + } + @Override + public Temporal subtractFrom(Temporal temporal) { + throw new UnsupportedOperationException(); + } + }; + pymd(4, 5, 6).minus(amount); + } + //----------------------------------------------------------------------- // minusYears() //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java new file mode 100644 index 00000000000..58a1c35eddb --- /dev/null +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of JSR-310 nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package tck.java.time.chrono; + +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.HOURS; +import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.YEARS; +import static org.testng.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.time.DateTimeException; +import java.time.LocalDate; +import java.time.Period; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoPeriod; +import java.time.chrono.Chronology; +import java.time.chrono.HijrahChronology; +import java.time.chrono.IsoChronology; +import java.time.chrono.JapaneseChronology; +import java.time.chrono.MinguoChronology; +import java.time.chrono.ThaiBuddhistChronology; +import java.time.temporal.Temporal; +import java.time.temporal.UnsupportedTemporalTypeException; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +public class TCKChronoPeriod { + + //----------------------------------------------------------------------- + // regular data factory for names and descriptions of available calendars + //----------------------------------------------------------------------- + @DataProvider(name = "calendars") + Chronology[][] data_of_calendars() { + return new Chronology[][]{ + {HijrahChronology.INSTANCE}, + {IsoChronology.INSTANCE}, + {JapaneseChronology.INSTANCE}, + {MinguoChronology.INSTANCE}, + {ThaiBuddhistChronology.INSTANCE}}; + } + + //----------------------------------------------------------------------- + // Test Serialization of Calendars + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_serialization(Chronology chrono) throws Exception { + ChronoPeriod period = chrono.period(1, 2, 3); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(period); + out.close(); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + + ObjectInputStream in = new ObjectInputStream(bais); + ChronoPeriod ser = (ChronoPeriod) in.readObject(); + assertEquals(ser, period, "deserialized ChronoPeriod is wrong"); + } + + @Test(dataProvider="calendars") + public void test_get(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + assertEquals(period.get(YEARS), 1); + assertEquals(period.get(MONTHS), 2); + assertEquals(period.get(DAYS), 3); + } + + @Test(dataProvider="calendars", expectedExceptions=UnsupportedTemporalTypeException.class) + public void test_get_unsupported(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + period.get(HOURS); + } + + @Test(dataProvider="calendars") + public void test_getUnits(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + assertEquals(period.getUnits().size(), 3); + assertEquals(period.getUnits().get(0), YEARS); + assertEquals(period.getUnits().get(1), MONTHS); + assertEquals(period.getUnits().get(2), DAYS); + } + + @Test(dataProvider="calendars") + public void test_getChronology(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + assertEquals(period.getChronology(), chrono); + } + + @Test(dataProvider="calendars") + public void test_isZero_isNegative(Chronology chrono) { + ChronoPeriod periodPositive = chrono.period(1, 2, 3); + assertEquals(periodPositive.isZero(), false); + assertEquals(periodPositive.isNegative(), false); + + ChronoPeriod periodZero = chrono.period(0, 0, 0); + assertEquals(periodZero.isZero(), true); + assertEquals(periodZero.isNegative(), false); + + ChronoPeriod periodNegative = chrono.period(-1, 0, 0); + assertEquals(periodNegative.isZero(), false); + assertEquals(periodNegative.isNegative(), true); + } + + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_plus(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoPeriod period2 = chrono.period(2, 3, 4); + ChronoPeriod result = period.plus(period2); + assertEquals(result, chrono.period(3, 5, 7)); + } + + @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) + public void test_plus_wrongChrono(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoPeriod isoPeriod = Period.of(2, 3, 4); + ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4); + // one of these two will fail + period.plus(isoPeriod); + period.plus(thaiPeriod); + } + + @Test(dataProvider="calendars") + public void test_minus(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoPeriod period2 = chrono.period(2, 3, 4); + ChronoPeriod result = period.minus(period2); + assertEquals(result, chrono.period(-1, -1, -1)); + } + + @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) + public void test_minus_wrongChrono(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoPeriod isoPeriod = Period.of(2, 3, 4); + ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4); + // one of these two will fail + period.minus(isoPeriod); + period.minus(thaiPeriod); + } + + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_addTo(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoLocalDate date = chrono.dateNow(); + Temporal result = period.addTo(date); + assertEquals(result, date.plus(14, MONTHS).plus(3, DAYS)); + } + + @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) + public void test_addTo_wrongChrono(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); + ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); + // one of these two will fail + period.addTo(isoDate); + period.addTo(thaiDate); + } + + @Test(dataProvider="calendars") + public void test_subtractFrom(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoLocalDate date = chrono.dateNow(); + Temporal result = period.subtractFrom(date); + assertEquals(result, date.minus(14, MONTHS).minus(3, DAYS)); + } + + @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) + public void test_subtractFrom_wrongChrono(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); + ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); + // one of these two will fail + period.subtractFrom(isoDate); + period.subtractFrom(thaiDate); + } + + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_negated(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + assertEquals(period.negated(), chrono.period(-1, -2, -3)); + } + + @Test(dataProvider="calendars") + public void test_multipliedBy(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + assertEquals(period.multipliedBy(3), chrono.period(3, 6, 9)); + } + + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_equals_equal(Chronology chrono) { + ChronoPeriod a1 = chrono.period(1, 2, 3); + ChronoPeriod a2 = chrono.period(1, 2, 3); + assertEquals(a1, a1); + assertEquals(a1, a2); + assertEquals(a2, a1); + assertEquals(a2, a2); + assertEquals(a1.hashCode(), a2.hashCode()); + } + + @Test(dataProvider="calendars") + public void test_equals_notEqual(Chronology chrono) { + ChronoPeriod a = chrono.period(1, 2, 3); + ChronoPeriod b = chrono.period(2, 2, 3); + assertEquals(a.equals(b), false); + assertEquals(b.equals(a), false); + assertEquals(a.equals(""), false); + assertEquals(a.equals(null), false); + } + + @Test(dataProvider="calendars") + public void test_toString(Chronology chrono) { + ChronoPeriod period = chrono.period(1, 2, 3); + if (period instanceof Period == false) { + assertEquals(period.toString(), chrono.getId() + " P1Y2M3D"); + } + } + +} diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java index e9d963c73af..fd53b0f0be1 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java @@ -79,6 +79,7 @@ import java.time.Year; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoPeriod; import java.time.chrono.Chronology; import java.time.chrono.Era; import java.time.chrono.IsoChronology; @@ -87,6 +88,7 @@ import java.time.chrono.JapaneseDate; import java.time.chrono.JapaneseEra; import java.time.chrono.MinguoChronology; import java.time.chrono.MinguoDate; +import java.time.chrono.ThaiBuddhistChronology; import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; @@ -615,8 +617,8 @@ public class TCKJapaneseChronology { public void test_periodUntilDate() { JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1); JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2); - Period period = mdate1.until(mdate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(mdate2); + assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1)); } @Test @@ -632,8 +634,8 @@ public class TCKJapaneseChronology { JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1); JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2); MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2); - Period period = mdate1.until(ldate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(ldate2); + assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1)); } //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java b/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java index 50ddf70cb3e..ad98e9119b3 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java @@ -69,13 +69,13 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Month; import java.time.OffsetDateTime; -import java.time.Period; import java.time.Year; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.chrono.ChronoLocalDate; import java.time.chrono.ChronoLocalDateTime; +import java.time.chrono.ChronoPeriod; import java.time.chrono.ChronoZonedDateTime; import java.time.chrono.Chronology; import java.time.chrono.Era; @@ -84,8 +84,6 @@ import java.time.chrono.JapaneseDate; import java.time.chrono.MinguoChronology; import java.time.chrono.MinguoDate; import java.time.chrono.MinguoEra; -import java.time.chrono.MinguoChronology; -import java.time.chrono.MinguoDate; import java.time.chrono.ThaiBuddhistChronology; import java.time.chrono.ThaiBuddhistDate; import java.time.format.ResolverStyle; @@ -499,8 +497,8 @@ public class TCKMinguoChronology { public void test_periodUntilDate() { MinguoDate mdate1 = MinguoDate.of(1970, 1, 1); MinguoDate mdate2 = MinguoDate.of(1971, 2, 2); - Period period = mdate1.until(mdate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(mdate2); + assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1)); } @Test @@ -516,8 +514,8 @@ public class TCKMinguoChronology { MinguoDate mdate1 = MinguoDate.of(1970, 1, 1); MinguoDate mdate2 = MinguoDate.of(1971, 2, 2); ThaiBuddhistDate ldate2 = ThaiBuddhistChronology.INSTANCE.date(mdate2); - Period period = mdate1.until(ldate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(ldate2); + assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1)); } //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java b/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java index e57847c0619..5557641738a 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java @@ -72,11 +72,11 @@ import java.time.DateTimeException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Month; -import java.time.Period; import java.time.Year; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoPeriod; import java.time.chrono.Chronology; import java.time.chrono.Era; import java.time.chrono.IsoChronology; @@ -458,8 +458,8 @@ public class TCKThaiBuddhistChronology { public void test_periodUntilDate() { ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1); ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2); - Period period = mdate1.until(mdate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(mdate2); + assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1)); } @Test @@ -475,8 +475,8 @@ public class TCKThaiBuddhistChronology { ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1); ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2); MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2); - Period period = mdate1.until(ldate2); - assertEquals(period, Period.of(1, 1, 1)); + ChronoPeriod period = mdate1.until(ldate2); + assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1)); } //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java b/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java index 3e7cce46d1f..05a6d4b515d 100644 --- a/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java +++ b/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java @@ -26,9 +26,9 @@ package test.java.time.chrono; import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.DAY_OF_YEAR; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.YEAR; -import static java.time.temporal.ChronoField.DAY_OF_YEAR; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -39,12 +39,12 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.OffsetDateTime; -import java.time.Period; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.chrono.ChronoLocalDate; import java.time.chrono.ChronoLocalDateTime; +import java.time.chrono.ChronoPeriod; import java.time.chrono.ChronoZonedDateTime; import java.time.chrono.Chronology; import java.time.chrono.HijrahChronology; @@ -330,26 +330,26 @@ public class TestUmmAlQuraChronology { @DataProvider(name="datesForPeriod") Object[][] data_Period() { return new Object[][] { - {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), Period.of(84, 2, 5)}, - {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), Period.of(31, 1, 22)}, - {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), Period.of(49, 6, 24)}, - {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), Period.of(-50, -1, -20)}, - {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), Period.of(0, 11, 28)}, + {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(84, 2, 5)}, + {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(31, 1, 22)}, + {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), HijrahChronology.INSTANCE.period(49, 6, 24)}, + {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), HijrahChronology.INSTANCE.period(-50, -1, -20)}, + {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), HijrahChronology.INSTANCE.period(0, 11, 28)}, }; } // Test to get the Period between two given dates @Test(dataProvider="datesForPeriod") - public void test_until(HijrahDate h1, HijrahDate h2, Period p) { - Period period = h1.until(h2); + public void test_until(HijrahDate h1, HijrahDate h2, ChronoPeriod p) { + ChronoPeriod period = h1.until(h2); assertEquals(period, p); } // Test to get the Period between dates in different chronologies @Test(dataProvider="datesForPeriod") - public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, Period p) { + public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, ChronoPeriod p) { MinguoDate m = MinguoChronology.INSTANCE.date(h2); - Period period = h1.until(m); + ChronoPeriod period = h1.until(m); assertEquals(period, p); } From 8053376ea24dd855f539094d729095e71b6eff03 Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Thu, 5 Sep 2013 15:37:40 +0400 Subject: [PATCH 121/983] 8023392: Swing text components printed with spaces between chars Reviewed-by: alexsch, alexp --- .../classes/sun/swing/SwingUtilities2.java | 114 +++++-- .../java/awt/print/bug8023392/bug8023392.html | 20 ++ .../java/awt/print/bug8023392/bug8023392.java | 286 ++++++++++++++++++ 3 files changed, 387 insertions(+), 33 deletions(-) create mode 100644 jdk/test/java/awt/print/bug8023392/bug8023392.html create mode 100644 jdk/test/java/awt/print/bug8023392/bug8023392.java diff --git a/jdk/src/share/classes/sun/swing/SwingUtilities2.java b/jdk/src/share/classes/sun/swing/SwingUtilities2.java index a1903f2bdd2..07bb880d0ff 100644 --- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java +++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import java.awt.event.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.print.PrinterGraphics; +import java.text.CharacterIterator; import java.text.AttributedCharacterIterator; import java.text.AttributedString; @@ -504,22 +505,25 @@ public class SwingUtilities2 { * it to fit in the screen width. This distributes the spacing * more evenly than directly laying out to the screen advances. */ - float screenWidth = (float) - g2d.getFont().getStringBounds(text, DEFAULT_FRC).getWidth(); - TextLayout layout = createTextLayout(c, text, g2d.getFont(), - g2d.getFontRenderContext()); + String trimmedText = trimTrailingSpaces(text); + if (!trimmedText.isEmpty()) { + float screenWidth = (float) g2d.getFont().getStringBounds + (trimmedText, DEFAULT_FRC).getWidth(); + TextLayout layout = createTextLayout(c, text, g2d.getFont(), + g2d.getFontRenderContext()); - layout = layout.getJustifiedLayout(screenWidth); - /* Use alternate print color if specified */ - Color col = g2d.getColor(); - if (col instanceof PrintColorUIResource) { - g2d.setColor(((PrintColorUIResource)col).getPrintColor()); + layout = layout.getJustifiedLayout(screenWidth); + /* Use alternate print color if specified */ + Color col = g2d.getColor(); + if (col instanceof PrintColorUIResource) { + g2d.setColor(((PrintColorUIResource)col).getPrintColor()); + } + + layout.draw(g2d, x, y); + + g2d.setColor(col); } - layout.draw(g2d, x, y); - - g2d.setColor(col); - return; } } @@ -789,25 +793,27 @@ public class SwingUtilities2 { if (frc != null && !isFontRenderContextPrintCompatible (deviceFontRenderContext, frc)) { - TextLayout layout = - createTextLayout(c, new String(data, offset, length), - g2d.getFont(), - deviceFontRenderContext); - float screenWidth = (float)g2d.getFont(). - getStringBounds(data, offset, offset + length, frc). - getWidth(); - layout = layout.getJustifiedLayout(screenWidth); - /* Use alternate print color if specified */ - Color col = g2d.getColor(); - if (col instanceof PrintColorUIResource) { - g2d.setColor(((PrintColorUIResource)col).getPrintColor()); + String text = new String(data, offset, length); + TextLayout layout = new TextLayout(text, g2d.getFont(), + deviceFontRenderContext); + String trimmedText = trimTrailingSpaces(text); + if (!trimmedText.isEmpty()) { + float screenWidth = (float)g2d.getFont(). + getStringBounds(trimmedText, frc).getWidth(); + layout = layout.getJustifiedLayout(screenWidth); + + /* Use alternate print color if specified */ + Color col = g2d.getColor(); + if (col instanceof PrintColorUIResource) { + g2d.setColor(((PrintColorUIResource)col).getPrintColor()); + } + + layout.draw(g2d,x,y); + + g2d.setColor(col); } - layout.draw(g2d,x,y); - - g2d.setColor(col); - return nextX; } } @@ -888,14 +894,23 @@ public class SwingUtilities2 { } else { frc = g2d.getFontRenderContext(); } - TextLayout layout = new TextLayout(iterator, frc); + TextLayout layout; if (isPrinting) { FontRenderContext deviceFRC = g2d.getFontRenderContext(); if (!isFontRenderContextPrintCompatible(frc, deviceFRC)) { - float screenWidth = layout.getAdvance(); layout = new TextLayout(iterator, deviceFRC); - layout = layout.getJustifiedLayout(screenWidth); + AttributedCharacterIterator trimmedIt = + getTrimmedTrailingSpacesIterator(iterator); + if (trimmedIt != null) { + float screenWidth = new TextLayout(trimmedIt, frc). + getAdvance(); + layout = layout.getJustifiedLayout(screenWidth); + } + } else { + layout = new TextLayout(iterator, frc); } + } else { + layout = new TextLayout(iterator, frc); } layout.draw(g2d, x, y); retVal = layout.getAdvance(); @@ -1047,6 +1062,39 @@ public class SwingUtilities2 { return (g instanceof PrinterGraphics || g instanceof PrintGraphics); } + private static String trimTrailingSpaces(String s) { + int i = s.length() - 1; + while(i >= 0 && Character.isWhitespace(s.charAt(i))) { + i--; + } + return s.substring(0, i + 1); + } + + private static AttributedCharacterIterator getTrimmedTrailingSpacesIterator + (AttributedCharacterIterator iterator) { + int curIdx = iterator.getIndex(); + + char c = iterator.last(); + while(c != CharacterIterator.DONE && Character.isWhitespace(c)) { + c = iterator.previous(); + } + + if (c != CharacterIterator.DONE) { + int endIdx = iterator.getIndex(); + + if (endIdx == iterator.getEndIndex() - 1) { + iterator.setIndex(curIdx); + return iterator; + } else { + AttributedString trimmedText = new AttributedString(iterator, + iterator.getBeginIndex(), endIdx + 1); + return trimmedText.getIterator(); + } + } else { + return null; + } + } + /** * Determines whether the SelectedTextColor should be used for painting text * foreground for the specified highlight. diff --git a/jdk/test/java/awt/print/bug8023392/bug8023392.html b/jdk/test/java/awt/print/bug8023392/bug8023392.html new file mode 100644 index 00000000000..d796a21c660 --- /dev/null +++ b/jdk/test/java/awt/print/bug8023392/bug8023392.html @@ -0,0 +1,20 @@ + + + + Bug 8023392 + + + +

    Bug ID: 8023392

    + +

    See the dialog box (usually in upper left corner) for instructions

    + + + + diff --git a/jdk/test/java/awt/print/bug8023392/bug8023392.java b/jdk/test/java/awt/print/bug8023392/bug8023392.java new file mode 100644 index 00000000000..6c6fbb26ee9 --- /dev/null +++ b/jdk/test/java/awt/print/bug8023392/bug8023392.java @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + test + @bug 8023392 + @summary Swing text components printed with spaces between chars + @author Anton Nashatyrev + @run applet/manual=yesno bug8023392.html +*/ + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.applet.Applet; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.font.TextAttribute; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.text.AttributedCharacterIterator; +import java.text.AttributedString; + + +public class bug8023392 extends Applet { + static final String[] instructions = { + "A Frame containing several pairs of labels ((a) and (b)) is displayed.", + "Labels of each pair look the same and are left-aligned (with spaces ", + "between chars).", + "1. Hit the print button.", + "2. Select any available printer (printing to file is also fine).", + "3. Look at the printing result (paper, PDF, PS, etc.):", + " The (a) and (b) labels should look almost the same and the (a) labels", + " shouldn't appear as if they are stretched along X axis."}; + + public void init() { + this.setLayout(new BorderLayout()); + add(new SimplePrint2(), BorderLayout.CENTER); + + Sysout.createDialogWithInstructions(instructions); + + } + + public static class SimplePrint2 extends JPanel + implements ActionListener, Printable { + JLabel label1; + JLabel label2; + JButton printButton; + + + public SimplePrint2() { + setLayout(new BorderLayout()); + label1 = new JLabel("2a) a b c d e" + + " "); + label2 = new JLabel("2b) a b c d e"); + + Box p1 = new Box(BoxLayout.Y_AXIS); + p1.add(label1); + p1.add(label2); + p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") { + String s = "3a) a b c d e "; + @Override + protected void paintComponent(Graphics g) { + sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(), + 0, s.length(), 0, 15); + } + }); + p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") { + String s = "3b) a b c d e"; + @Override + protected void paintComponent(Graphics g) { + sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(), + 0, s.length(), 0, 15); + } + }); + p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") { + String s = "4a) a b c d e "; + AttributedCharacterIterator it; + { + AttributedString as = new AttributedString(s); + as.addAttribute(TextAttribute.FONT, getFont()); + as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8); + it = as.getIterator(); + } + @Override + protected void paintComponent(Graphics g) { + sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15); + } + }); + + p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") { + String s = "4b) a b c d e"; + AttributedCharacterIterator it; + { + AttributedString as = new AttributedString(s); + as.addAttribute(TextAttribute.FONT, getFont()); + as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8); + it = as.getIterator(); + } + @Override + protected void paintComponent(Graphics g) { + sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15); + } + }); + + JPanel p2 = new JPanel(); + printButton = new JButton("Print"); + printButton.addActionListener(this); + p2.add(printButton); + + Container c = this; + c.add(p1, BorderLayout.CENTER); + c.add(p2, BorderLayout.SOUTH); + + String[] data = { + "1a) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc" + + " ", + "1b) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc" + }; + JList l0 = new JList(data); + l0.setVisibleRowCount(l0.getModel().getSize()); + JScrollPane jsp = new JScrollPane(l0); + l0.setBorder(new LineBorder(Color.GRAY)); + c.add(jsp, BorderLayout.NORTH); + + for (Component comp : new Component[]{label1, label2, printButton}) { + comp.setFont(new Font("Monospaced", 0, 16)); + } + } + + public void actionPerformed(ActionEvent e) { + PrinterJob job = PrinterJob.getPrinterJob(); + job.setPrintable(this); + if (job.printDialog()) { + try { + job.print(); + } catch (PrinterException ex) { + ex.printStackTrace(); + } + } + } + + public int print(Graphics graphics, + PageFormat pageFormat, + int pageIndex) + throws PrinterException { + if (pageIndex >= 1) { + return Printable.NO_SUCH_PAGE; + } + + this.paint(graphics); + return Printable.PAGE_EXISTS; + } + } +} + + +/** + * ************************************************* + * Standard Test Machinery + * DO NOT modify anything below -- it's a standard + * chunk of code whose purpose is to make user + * interaction uniform, and thereby make it simpler + * to read and understand someone else's test. + * ************************************************** + */ +class Sysout { + private static TestDialog dialog; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + dialog.show(); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + dialog.show(); + println("Any messages for the tester will display here."); + } + + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + + public static void println(String messageIn) { + dialog.displayMessage(messageIn); + } + +}// Sysout class + + +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("South", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } + //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + } + +}// TestDialog class + From 51205b7e55b87c3a4087055aff0448a5d4a10840 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Mon, 9 Sep 2013 17:14:51 +0400 Subject: [PATCH 122/983] 8024413: Add tests for issues JDK-8002077 and JDK-7199708 Reviewed-by: malenkov, leonidr --- .../JFileChooser/7199708/bug7199708.java | 158 ++++++++++++++++++ .../JFileChooser/8002077/bug8002077.java | 82 +++++++++ 2 files changed, 240 insertions(+) create mode 100644 jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java create mode 100644 jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java diff --git a/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java new file mode 100644 index 00000000000..339c6553a18 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java @@ -0,0 +1,158 @@ +/* + * 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.awt.Component; +import java.awt.Container; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; + +import java.nio.file.Files; +import javax.swing.AbstractButton; +import javax.swing.JTable; +import javax.swing.UIManager; +import sun.awt.SunToolkit; + +/** + * @test + * @bug 7199708 + * @author Alexander Scherbatiy + * @summary FileChooser crashs when opening large folder + * @run main bug7199708 + */ +public class bug7199708 { + + private static int FILE_NUMBER = 30000; + private static volatile JFileChooser fileChooser; + private static volatile int locationX; + private static volatile int locationY; + private static volatile int width; + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + final File folder = createLargeFolder(); + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + fileChooser = new JFileChooser(folder); + fileChooser.showSaveDialog(null); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + final String detailsTooltip = UIManager.getString("FileChooser." + + "detailsViewButtonToolTipText", fileChooser.getLocale()); + + doAction(fileChooser, new ComponentAction() { + @Override + public boolean accept(Component component) { + return (component instanceof AbstractButton) + && detailsTooltip.equals( + ((AbstractButton) component).getToolTipText()); + } + + @Override + public void perform(Component component) { + ((AbstractButton) component).doClick(); + } + }); + + doAction(fileChooser, new ComponentAction() { + @Override + public boolean accept(Component component) { + return (component instanceof JTable); + } + + @Override + public void perform(Component component) { + Point tableLocation = component.getLocationOnScreen(); + locationX = (int) tableLocation.getX(); + locationY = (int) tableLocation.getY(); + width = (int) fileChooser.getBounds().getWidth(); + } + }); + } + }); + + toolkit.realSync(); + + int d = 25; + for (int i = 0; i < width / d; i++) { + robot.mouseMove(locationX + i * d, locationY + 5); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + } + + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + } + + static void doAction(Component component, ComponentAction action) { + if (action.accept(component)) { + action.perform(component); + } else if (component instanceof Container) { + for (Component comp : ((Container) component).getComponents()) { + doAction(comp, action); + } + } + } + + private static File createLargeFolder() { + try { + + File largeFolder = Files.createTempDirectory("large_folder").toFile(); + largeFolder.deleteOnExit(); + + for (int i = 0; i < FILE_NUMBER; i++) { + File file = new File(largeFolder, "File_" + i + ".txt"); + file.createNewFile(); + file.deleteOnExit(); + } + return largeFolder; + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + + interface ComponentAction { + + boolean accept(Component component); + + void perform(Component component); + } +} diff --git a/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java new file mode 100644 index 00000000000..ea1470d4ed5 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import sun.awt.SunToolkit; + +/** + * @test + * @bug 8002077 + * @author Alexander Scherbatiy + * @summary Possible mnemonic issue on JFileChooser Save button on nimbus L&F + * @library ../../regtesthelpers/ + * @build Util + * @run main bug8002077 + */ +public class bug8002077 { + + private static volatile int fileChooserState = JFileChooser.ERROR_OPTION; + + public static void main(String[] args) throws Exception { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + runTest(); + break; + } + } + } + + private static void runTest() throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + fileChooserState = new JFileChooser().showSaveDialog(null); + } + }); + toolkit.realSync(); + + Util.hitMnemonics(robot, KeyEvent.VK_N); + toolkit.realSync(); + + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + toolkit.realSync(); + + Util.hitMnemonics(robot, KeyEvent.VK_S); + toolkit.realSync(); + + if (fileChooserState != JFileChooser.APPROVE_OPTION) { + throw new RuntimeException("Save button is not pressed!"); + } + } +} From dfacc4e2721d0f6891c1f380cfdd7009587e7957 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Mon, 9 Sep 2013 18:34:12 +0400 Subject: [PATCH 123/983] 8020060: MoleculeViewerTest demo doesn't work due to SecurityPermissions Reviewed-by: malenkov, erikj --- jdk/makefiles/CompileDemos.gmk | 8 +++----- jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java | 2 +- .../share/demo/applets/MoleculeViewer/example1.html | 6 +++--- .../share/demo/applets/MoleculeViewer/example2.html | 6 +++--- .../share/demo/applets/MoleculeViewer/example3.html | 10 +++++----- jdk/src/share/demo/applets/WireFrame/ThreeD.java | 2 +- jdk/src/share/demo/applets/WireFrame/example1.html | 2 +- jdk/src/share/demo/applets/WireFrame/example2.html | 2 +- jdk/src/share/demo/applets/WireFrame/example3.html | 2 +- jdk/src/share/demo/applets/WireFrame/example4.html | 2 +- 10 files changed, 20 insertions(+), 22 deletions(-) diff --git a/jdk/makefiles/CompileDemos.gmk b/jdk/makefiles/CompileDemos.gmk index 0a093b586a9..6cd5dd4df0d 100644 --- a/jdk/makefiles/CompileDemos.gmk +++ b/jdk/makefiles/CompileDemos.gmk @@ -65,14 +65,10 @@ $(eval $(call SetupAppletDemo,DitherTest)) $(eval $(call SetupAppletDemo,DrawTest)) $(eval $(call SetupAppletDemo,Fractal)) $(eval $(call SetupAppletDemo,GraphicsTest)) -$(eval $(call SetupAppletDemo,MoleculeViewer)) $(eval $(call SetupAppletDemo,NervousText)) $(eval $(call SetupAppletDemo,SimpleGraph)) $(eval $(call SetupAppletDemo,SortDemo)) $(eval $(call SetupAppletDemo,SpreadSheet)) -# Build WireFrame without a server since it -# has a class Matrix3D that also exists in MoleculeViewer. -$(eval $(call SetupAppletDemo,WireFrame,true)) ifndef OPENJDK $(eval $(call SetupAppletDemo,Animator,,closed/)) @@ -83,7 +79,7 @@ endif ################################################################################################## -PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf +PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf .xyz .obj define SetupDemo # Param 1 = Name of the demo @@ -161,6 +157,8 @@ $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services : \ BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services +$(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html XYZApp.java)) +$(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html ThreeD.java)) $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*)) $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt)) $(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*)) diff --git a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java index 5ee3afe38ab..78c816a52a2 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java +++ b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java @@ -348,7 +348,7 @@ public class XYZApp extends Applet implements Runnable, MouseListener, InputStream is = null; try { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); - is = new URL(getDocumentBase(), mdname).openStream(); + is = getClass().getResourceAsStream(mdname); XYZChemModel m = new XYZChemModel(is); Atom.setApplet(this); md = m; diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example1.html b/jdk/src/share/demo/applets/MoleculeViewer/example1.html index de2e84b0943..f87aee60fe8 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example1.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example1.html @@ -2,10 +2,10 @@ MoleculeViewer (example 1) - +

    MoleculeViewer (example 1)


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! @@ -13,7 +13,7 @@
    The source. - + diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example2.html b/jdk/src/share/demo/applets/MoleculeViewer/example2.html index bb8f93a0b31..8468cc816b5 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example2.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example2.html @@ -2,10 +2,10 @@ MoleculeViewer (example 2) - +

    MoleculeViewer (example 2)


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! @@ -13,4 +13,4 @@
    The source. - + diff --git a/jdk/src/share/demo/applets/MoleculeViewer/example3.html b/jdk/src/share/demo/applets/MoleculeViewer/example3.html index 952bc8d5cbd..c5673ea91a9 100644 --- a/jdk/src/share/demo/applets/MoleculeViewer/example3.html +++ b/jdk/src/share/demo/applets/MoleculeViewer/example3.html @@ -5,25 +5,25 @@

    MoleculeViewer (example 3)


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! @@ -31,5 +31,5 @@
    The source. - + diff --git a/jdk/src/share/demo/applets/WireFrame/ThreeD.java b/jdk/src/share/demo/applets/WireFrame/ThreeD.java index 935ca0a99c7..321729ae61c 100644 --- a/jdk/src/share/demo/applets/WireFrame/ThreeD.java +++ b/jdk/src/share/demo/applets/WireFrame/ThreeD.java @@ -416,7 +416,7 @@ public class ThreeD extends Applet InputStream is = null; try { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); - is = new URL(getDocumentBase(), mdname).openStream(); + is = getClass().getResourceAsStream(mdname); Model3D m = new Model3D(is); md = m; m.findBB(); diff --git a/jdk/src/share/demo/applets/WireFrame/example1.html b/jdk/src/share/demo/applets/WireFrame/example1.html index 1992ee53a26..6cc9c552e32 100644 --- a/jdk/src/share/demo/applets/WireFrame/example1.html +++ b/jdk/src/share/demo/applets/WireFrame/example1.html @@ -5,7 +5,7 @@

    3D Model: Cube


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example2.html b/jdk/src/share/demo/applets/WireFrame/example2.html index eec2b1d429f..fb59eff3f82 100644 --- a/jdk/src/share/demo/applets/WireFrame/example2.html +++ b/jdk/src/share/demo/applets/WireFrame/example2.html @@ -5,7 +5,7 @@

    3D Model: Dinosaur


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example3.html b/jdk/src/share/demo/applets/WireFrame/example3.html index 2b49d118ec7..4e4f5f186df 100644 --- a/jdk/src/share/demo/applets/WireFrame/example3.html +++ b/jdk/src/share/demo/applets/WireFrame/example3.html @@ -5,7 +5,7 @@

    3D Model: Hughes


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! diff --git a/jdk/src/share/demo/applets/WireFrame/example4.html b/jdk/src/share/demo/applets/WireFrame/example4.html index faf409254a1..664ee1eaa94 100644 --- a/jdk/src/share/demo/applets/WireFrame/example4.html +++ b/jdk/src/share/demo/applets/WireFrame/example4.html @@ -5,7 +5,7 @@

    3D Model: knoxS


    - + alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag! From cda1bfff5ae59c540fe2854bd8d6c7f3defe02d5 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 9 Sep 2013 21:03:07 +0400 Subject: [PATCH 124/983] 8023042: Inaccuracy in documentation in a sound area Reviewed-by: prr --- jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java | 2 +- jdk/src/share/classes/javax/sound/sampled/AudioFormat.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java index d1216e207a7..659399e616f 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java @@ -57,7 +57,7 @@ import java.util.Map; * be used in implementations: * * - * + * * * * diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java index 2e679784ea3..4a267cf6b6d 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java @@ -85,7 +85,7 @@ import java.util.Map; * service providers should use, if applicable: * *
    Audio File Format Property KeysAudio File Format Properties
    Property keyValue type
    - * + * * * * From 1a1a6829fa23915704ca46b69bbec1b8be8e3930 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Tue, 10 Sep 2013 11:00:21 +0400 Subject: [PATCH 125/983] 8024381: The test for 8020210 does not have @bug tag Reviewed-by: anthony, serb --- .../java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java index 014637acec0..78155f3b9b3 100644 --- a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java +++ b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java @@ -23,6 +23,7 @@ /** * @test @summary JVM crash if the frame maximized from offscreen + * @bug 8020210 * @author Petr Pchelko * @library ../../regtesthelpers * @build Util From 92bfcc0db031964ec2e6466d88a5cb016d55d2da Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Tue, 10 Sep 2013 14:33:48 +0400 Subject: [PATCH 126/983] 8021253: JFileChooser does not react on pressing enter since java 7 Reviewed-by: malenkov --- .../classes/javax/swing/JFileChooser.java | 18 ++- .../JFileChooser/8021253/bug8021253.java | 113 ++++++++++++++++++ 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java diff --git a/jdk/src/share/classes/javax/swing/JFileChooser.java b/jdk/src/share/classes/javax/swing/JFileChooser.java index e053b7af081..61806b439b8 100644 --- a/jdk/src/share/classes/javax/swing/JFileChooser.java +++ b/jdk/src/share/classes/javax/swing/JFileChooser.java @@ -362,6 +362,7 @@ public class JFileChooser extends JComponent implements Accessible { */ protected void setup(FileSystemView view) { installShowFilesListener(); + installHierarchyListener(); if(view == null) { view = FileSystemView.getFileSystemView(); @@ -374,6 +375,22 @@ public class JFileChooser extends JComponent implements Accessible { enableEvents(AWTEvent.MOUSE_EVENT_MASK); } + private void installHierarchyListener() { + addHierarchyListener(new HierarchyListener() { + @Override + public void hierarchyChanged(HierarchyEvent e) { + if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) + == HierarchyEvent.PARENT_CHANGED) { + JFileChooser fc = JFileChooser.this; + JRootPane rootPane = SwingUtilities.getRootPane(fc); + if (rootPane != null) { + rootPane.setDefaultButton(fc.getUI().getDefaultButton(fc)); + } + } + } + }); + } + private void installShowFilesListener() { // Track native setting for showing hidden files Toolkit tk = Toolkit.getDefaultToolkit(); @@ -801,7 +818,6 @@ public class JFileChooser extends JComponent implements Accessible { dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG); } } - dialog.getRootPane().setDefaultButton(ui.getDefaultButton(this)); dialog.pack(); dialog.setLocationRelativeTo(parent); diff --git a/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java new file mode 100644 index 00000000000..5e833926a00 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java @@ -0,0 +1,113 @@ +/* + * 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.File; +import java.io.IOException; +import java.awt.BorderLayout; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import sun.awt.SunToolkit; + +/** + * @test + * @bug 8021253 + * @author Alexander Scherbatiy + * @summary JFileChooser does not react on pressing enter since java 7 + * @run main bug8021253 + */ + +public class bug8021253 { + + private static volatile boolean defaultKeyPressed; + private static JFileChooser fileChooser; + private static File file; + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + fileChooser.setSelectedFile(file); + } + }); + + toolkit.realSync(); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + toolkit.realSync(); + + if (!defaultKeyPressed) { + throw new RuntimeException("Default button is not pressed"); + } + } + + private static void createAndShowGUI() { + + file = getTempFile(); + + final JFrame frame = new JFrame("Test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(200, 300); + + fileChooser = new JFileChooser(file.getParentFile()); + fileChooser.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + defaultKeyPressed = true; + frame.dispose(); + } + }); + + frame.getContentPane().add(BorderLayout.CENTER, fileChooser); + frame.setSize(fileChooser.getPreferredSize()); + frame.setVisible(true); + } + + private static File getTempFile() { + try { + File temp = File.createTempFile("test", ".txt"); + temp.deleteOnExit(); + return temp; + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } +} From 1568ef9e858faf9b996765c090503d5b1d17b3f7 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 10 Sep 2013 17:06:38 +0400 Subject: [PATCH 127/983] 7057770: (spec)Scrollbar spec should specify that unit increment & decrement functionality may not be present Reviewed-by: alexsch --- jdk/src/share/classes/java/awt/Scrollbar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jdk/src/share/classes/java/awt/Scrollbar.java b/jdk/src/share/classes/java/awt/Scrollbar.java index b6a581d96a8..8ecf5783057 100644 --- a/jdk/src/share/classes/java/awt/Scrollbar.java +++ b/jdk/src/share/classes/java/awt/Scrollbar.java @@ -715,6 +715,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * The unit increment must be greater than zero. * Attepts to set the unit increment to a value lower than 1 * will result in a value of 1 being set. + *

    + * In some operating systems, this property + * can be ignored by the underlying controls. * * @param v the amount by which to increment or decrement * the scroll bar's value @@ -752,6 +755,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * scroll bar, generally through a mouse or keyboard gesture * that the scroll bar receives as an adjustment event. * The unit increment must be greater than zero. + *

    + * In some operating systems, this property + * can be ignored by the underlying controls. * * @return the unit increment of this scroll bar * @see java.awt.Scrollbar#setUnitIncrement From 4ac63f2df40430b2ec25c44c9659661fc2b209cf Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 10 Sep 2013 17:12:32 +0400 Subject: [PATCH 128/983] 8024407: [macosx] javax/swing/JScrollBar/7163696/Test7163696.java failed intermittently on macos Reviewed-by: alexsch --- jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java index 922bf2e4963..759012ebe74 100644 --- a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java +++ b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java @@ -59,7 +59,8 @@ public class Test7163696 implements Runnable { UIManager.setLookAndFeel(info.getClassName()); SwingUtilities.invokeAndWait(this); - toolkit.realSync(500); // after creation + toolkit.realSync(); // after creation + Thread.sleep(1000); Point point = this.bar.getLocation(); SwingUtilities.convertPointToScreen(point, this.bar); @@ -69,7 +70,8 @@ public class Test7163696 implements Runnable { robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); - toolkit.realSync(500); // before validation + toolkit.realSync(); // before validation + Thread.sleep(1000); SwingUtilities.invokeAndWait(this); if (this.bar != null) { From e9128877e71931d06ef3533468ca03fa1c075e1a Mon Sep 17 00:00:00 2001 From: Leonid Romanov Date: Tue, 10 Sep 2013 20:42:15 +0400 Subject: [PATCH 129/983] 8003901: [macosx] Need test for JDK-8002114 Reviewed-by: anthony, serb --- .../ActionListenerCalledTwiceTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java index 4b78bb98a0e..69a42d7834b 100644 --- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java +++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java @@ -35,12 +35,13 @@ import java.awt.event.*; import javax.swing.*; public class ActionListenerCalledTwiceTest { - static String menuItems[] = { "Item1", "Item2", "Item3", "Item4" }; + static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5" }; static KeyStroke keyStrokes[] = { KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK), - KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK) + KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK), + KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK) }; static volatile int listenerCallCounter = 0; From 9c2e380d22104332becfb94daf13ee500b87425c Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Thu, 12 Sep 2013 14:56:20 +0400 Subject: [PATCH 130/983] 8003965: Toolkit.beep() documentation is ambiguous Reviewed-by: anthony --- jdk/src/share/classes/java/awt/Toolkit.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index 92bedb7580b..84f3206d6d3 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -1239,7 +1239,8 @@ public abstract class Toolkit { } /** - * Emits an audio beep. + * Emits an audio beep depending on native system settings and hardware + * capabilities. * @since JDK1.1 */ public abstract void beep(); From fcb6d58798f5f6f814a85b71f4ca7d20283bd46e Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Thu, 12 Sep 2013 15:50:25 +0400 Subject: [PATCH 131/983] 7064312: Cleanup: avoid using unsafe string function Reviewed-by: serb, pchelko --- .../windows/native/sun/windows/awt_FileDialog.cpp | 6 +++--- jdk/src/windows/native/sun/windows/awt_Font.cpp | 13 +------------ .../windows/native/sun/windows/awt_PrintControl.cpp | 8 ++++---- jdk/src/windows/native/sun/windows/awt_Toolkit.cpp | 2 +- jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp | 8 ++++---- jdk/src/windows/native/sun/windows/awt_ole.cpp | 2 +- 6 files changed, 14 insertions(+), 25 deletions(-) diff --git a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp index 276f3647e68..3fd993cc646 100644 --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ AwtFileDialog::Initialize(JNIEnv *env, jstring filterDescription) int length = env->GetStringLength(filterDescription); DASSERT(length + 1 < MAX_FILTER_STRING); LPCTSTR tmp = JNU_GetStringPlatformChars(env, filterDescription, NULL); - _tcscpy(s_fileFilterString, tmp); + _tcscpy_s(s_fileFilterString, MAX_FILTER_STRING, tmp); JNU_ReleaseStringPlatformChars(env, filterDescription, tmp); //AdditionalString should be terminated by two NULL characters (Windows @@ -353,7 +353,7 @@ AwtFileDialog::Show(void *p) if (!result) { dlgerr = ::CommDlgExtendedError(); if (dlgerr == FNERR_INVALIDFILENAME) { - _tcscpy(fileBuffer, TEXT("")); + _tcscpy_s(fileBuffer, bufferLimit, TEXT("")); if (mode == java_awt_FileDialog_LOAD) { result = AwtFileDialog::GetOpenFileName(&ofn); } else { diff --git a/jdk/src/windows/native/sun/windows/awt_Font.cpp b/jdk/src/windows/native/sun/windows/awt_Font.cpp index d0d31ff0d07..df3fbcbbb12 100644 --- a/jdk/src/windows/native/sun/windows/awt_Font.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Font.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -366,17 +366,6 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale) return awtFont; } -int CALLBACK FindFamilyName (ENUMLOGFONTEX *lpelfe, - NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam) -{ - if(_tcsstr((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName)) { - _tcscpy((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName); - return 0; - } else { - return 1; - } -} - static void strip_tail(wchar_t* text, wchar_t* tail) { // strips tail and any possible whitespace before it from the end of text if (wcslen(text)<=wcslen(tail)) { return; diff --git a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp index 71a08d3df33..78272a6c521 100644 --- a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp +++ b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp @@ -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 @@ -422,17 +422,17 @@ BOOL AwtPrintControl::CreateDevModeAndDevNames(PRINTDLG *ppd, devnames->wOutputOffset = static_cast(sizeof(DEVNAMES)/sizeof(TCHAR) + lenDriverName + lenPrinterName); if (info2->pDriverName != NULL) { - _tcscpy(lpcDevnames + devnames->wDriverOffset, info2->pDriverName); + _tcscpy_s(lpcDevnames + devnames->wDriverOffset, devnameSize - devnames->wDriverOffset, info2->pDriverName); } else { *(lpcDevnames + devnames->wDriverOffset) = _T('\0'); } if (pPrinterName != NULL) { - _tcscpy(lpcDevnames + devnames->wDeviceOffset, pPrinterName); + _tcscpy_s(lpcDevnames + devnames->wDeviceOffset, devnameSize - devnames->wDeviceOffset, pPrinterName); } else { *(lpcDevnames + devnames->wDeviceOffset) = _T('\0'); } if (info2->pPortName != NULL) { - _tcscpy(lpcDevnames + devnames->wOutputOffset, info2->pPortName); + _tcscpy_s(lpcDevnames + devnames->wOutputOffset, devnameSize - devnames->wOutputOffset, info2->pPortName); } else { *(lpcDevnames + devnames->wOutputOffset) = _T('\0'); } diff --git a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp index 8a3ed22c17d..cdb5247d618 100644 --- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp @@ -228,7 +228,7 @@ BOOL AwtToolkit::activateKeyboardLayout(HKL hkl) { // create input locale string, e.g., "00000409", from hkl. TCHAR inputLocale[9]; TCHAR buf[9]; - _tcscpy(inputLocale, TEXT("00000000")); + _tcscpy_s(inputLocale, 9, TEXT("00000000")); // 64-bit: ::LoadKeyboardLayout() is such a weird API - a string of // the hex value you want?! Here we're converting our HKL value to diff --git a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp index 6cd2ce49954..c26769bf5f2 100644 --- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp +++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -711,7 +711,7 @@ void AwtTrayIcon::SetToolTip(LPCTSTR tooltip) _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE); m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szTip, tooltip); + _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip); } SendTrayMessage(NIM_MODIFY); @@ -817,7 +817,7 @@ void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType) m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szInfoTitle, caption); + _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption); } if (text[0] == '\0') { @@ -830,7 +830,7 @@ void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType) m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0'; } else { - _tcscpy(m_nid.szInfo, text); + _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text); } SendTrayMessage(NIM_MODIFY); diff --git a/jdk/src/windows/native/sun/windows/awt_ole.cpp b/jdk/src/windows/native/sun/windows/awt_ole.cpp index 0643ad8afb9..68912e5545e 100644 --- a/jdk/src/windows/native/sun/windows/awt_ole.cpp +++ b/jdk/src/windows/native/sun/windows/awt_ole.cpp @@ -70,7 +70,7 @@ namespace SUN_DBG_NS{ bErrorReport?_T("Error:"):_T(""), szBuffer) < 0) { - _tcscpy(szBuffer1 + DTRACE_BUF_LEN - 5, _T("...")); //reserver for \n + _tcscpy_s(szBuffer1 + DTRACE_BUF_LEN - 5, 5, _T("...")); //reserver for \n } memcpy(szBuffer1, szTime, iTimeLen*sizeof(TCHAR)); _tcscat(szBuffer1, _T("\n")); From d8c5dcc1fc9b74a37e2e01f2782caae6d0e551c5 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 12 Sep 2013 18:21:06 +0400 Subject: [PATCH 132/983] 7124537: [macosx] Menu shortcuts for all menu items should be disabled if a menu itself is disabled Reviewed-by: anthony, leonidr --- .../macosx/classes/sun/lwawt/macosx/CMenu.java | 16 ++++++++++++++++ .../classes/sun/lwawt/macosx/CMenuItem.java | 17 +++++++++++++++-- .../classes/sun/lwawt/macosx/LWCToolkit.java | 6 +++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java index 56a7061325e..cad1b36aa9c 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java @@ -26,9 +26,11 @@ package sun.lwawt.macosx; import java.awt.*; +import java.awt.peer.MenuItemPeer; import java.awt.peer.MenuPeer; public class CMenu extends CMenuItem implements MenuPeer { + public CMenu(Menu target) { super(target); } @@ -40,6 +42,20 @@ public class CMenu extends CMenuItem implements MenuPeer { setEnabled(target.isEnabled()); } + @Override + public final void setEnabled(final boolean b) { + super.setEnabled(b); + final Menu target = (Menu) getTarget(); + final int count = target.getItemCount(); + for (int i = 0; i < count; ++i) { + MenuItem item = target.getItem(i); + MenuItemPeer p = (MenuItemPeer) LWCToolkit.targetToPeer(item); + if (p != null) { + p.setEnabled(b && item.isEnabled()); + } + } + } + @Override protected long createModel() { CMenuComponent parent = (CMenuComponent) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java index ac3bea392a1..b1492bd0a43 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java @@ -28,17 +28,20 @@ package sun.lwawt.macosx; import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; +import java.awt.MenuContainer; import java.awt.MenuItem; import java.awt.MenuShortcut; import java.awt.event.*; import java.awt.peer.MenuItemPeer; +import java.util.concurrent.atomic.AtomicBoolean; public class CMenuItem extends CMenuComponent implements MenuItemPeer { + private final AtomicBoolean enabled = new AtomicBoolean(true); + public CMenuItem(MenuItem target) { super(target); initialize(target); - } // This way we avoiding invocation of the setters twice @@ -124,9 +127,19 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer { setEnabled(false); } + public final boolean isEnabled() { + return enabled.get(); + } + @Override public void setEnabled(boolean b) { - nativeSetEnabled(getModel(), b); + final Object parent = LWToolkit.targetToPeer(getTarget().getParent()); + if (parent instanceof CMenuItem) { + b &= ((CMenuItem) parent).isEnabled(); + } + if (enabled.compareAndSet(!b, b)) { + nativeSetEnabled(getModel(), b); + } } private native long nativeCreate(long parentMenu, boolean isSeparator); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 943dbe2fe47..e028df560f6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -207,9 +207,9 @@ public final class LWCToolkit extends LWToolkit { @Override public MenuBarPeer createMenuBar(MenuBar target) { - MenuBarPeer peer = new CMenuBar(target); - targetCreatedPeer(target, peer); - return peer; + MenuBarPeer peer = new CMenuBar(target); + targetCreatedPeer(target, peer); + return peer; } @Override From 1ef8009ccfd57220bf6eedcdc2d129a414bf9256 Mon Sep 17 00:00:00 2001 From: Dmitry Markov Date: Thu, 12 Sep 2013 18:44:14 +0400 Subject: [PATCH 133/983] 8024395: Improve fix for line break calculations Reviewed-by: alexp, alexsch --- .../classes/javax/swing/text/FlowView.java | 18 ++- .../share/classes/javax/swing/text/View.java | 78 ++++++---- .../swing/text/View/8014863/bug8014863.java | 140 ++++++++++-------- 3 files changed, 141 insertions(+), 95 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/text/FlowView.java b/jdk/src/share/classes/javax/swing/text/FlowView.java index e04b2fe91bf..8cd647ce961 100644 --- a/jdk/src/share/classes/javax/swing/text/FlowView.java +++ b/jdk/src/share/classes/javax/swing/text/FlowView.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 @@ -796,6 +796,22 @@ public abstract class FlowView extends BoxView { v.setParent(parent); } + /** {@inheritDoc} */ + @Override + protected void forwardUpdate(DocumentEvent.ElementChange ec, + DocumentEvent e, Shape a, ViewFactory f) { + calculateUpdateIndexes(e); + // Send update event to all views followed by the changed place. + lastUpdateIndex = Math.max((getViewCount() - 1), 0); + for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) { + View v = getView(i); + if (v != null) { + Shape childAlloc = getChildAllocation(i, a); + forwardUpdateToView(v, e, childAlloc, f); + } + } + } + // The following methods don't do anything useful, they // simply keep the class from being abstract. diff --git a/jdk/src/share/classes/javax/swing/text/View.java b/jdk/src/share/classes/javax/swing/text/View.java index c2e1e023d5a..be3a0e4336f 100644 --- a/jdk/src/share/classes/javax/swing/text/View.java +++ b/jdk/src/share/classes/javax/swing/text/View.java @@ -1137,32 +1137,9 @@ public abstract class View implements SwingConstants { */ protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f) { - Element elem = getElement(); - int pos = e.getOffset(); - int index0 = getViewIndex(pos, Position.Bias.Forward); - if (index0 == -1 && e.getType() == DocumentEvent.EventType.REMOVE && - pos >= getEndOffset()) { - // Event beyond our offsets. We may have represented this, that is - // the remove may have removed one of our child Elements that - // represented this, so, we should foward to last element. - index0 = getViewCount() - 1; - } - int index1 = index0; - View v = (index0 >= 0) ? getView(index0) : null; - if (v != null) { - if ((v.getStartOffset() == pos) && (pos > 0)) { - // If v is at a boundary, forward the event to the previous - // view too. - index0 = Math.max(index0 - 1, 0); - } - } - if (e.getType() != DocumentEvent.EventType.REMOVE) { - index1 = getViewIndex(pos + e.getLength(), Position.Bias.Forward); - if (index1 < 0) { - index1 = getViewCount() - 1; - } - } - int hole0 = index1 + 1; + calculateUpdateIndexes(e); + + int hole0 = lastUpdateIndex + 1; int hole1 = hole0; Element[] addedElems = (ec != null) ? ec.getChildrenAdded() : null; if ((addedElems != null) && (addedElems.length > 0)) { @@ -1173,11 +1150,9 @@ public abstract class View implements SwingConstants { // forward to any view not in the forwarding hole // formed by added elements (i.e. they will be updated // by initialization. - index0 = Math.max(index0, 0); - index1 = Math.max((getViewCount() - 1), 0); - for (int i = index0; i <= index1; i++) { + for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) { if (! ((i >= hole0) && (i <= hole1))) { - v = getView(i); + View v = getView(i); if (v != null) { Shape childAlloc = getChildAllocation(i, a); forwardUpdateToView(v, e, childAlloc, f); @@ -1186,6 +1161,39 @@ public abstract class View implements SwingConstants { } } + /** + * Calculates the first and the last indexes of the child views + * that need to be notified of the change to the model. + * @param e the change information from the associated document + */ + void calculateUpdateIndexes(DocumentEvent e) { + int pos = e.getOffset(); + firstUpdateIndex = getViewIndex(pos, Position.Bias.Forward); + if (firstUpdateIndex == -1 && e.getType() == DocumentEvent.EventType.REMOVE && + pos >= getEndOffset()) { + // Event beyond our offsets. We may have represented this, that is + // the remove may have removed one of our child Elements that + // represented this, so, we should forward to last element. + firstUpdateIndex = getViewCount() - 1; + } + lastUpdateIndex = firstUpdateIndex; + View v = (firstUpdateIndex >= 0) ? getView(firstUpdateIndex) : null; + if (v != null) { + if ((v.getStartOffset() == pos) && (pos > 0)) { + // If v is at a boundary, forward the event to the previous + // view too. + firstUpdateIndex = Math.max(firstUpdateIndex - 1, 0); + } + } + if (e.getType() != DocumentEvent.EventType.REMOVE) { + lastUpdateIndex = getViewIndex(pos + e.getLength(), Position.Bias.Forward); + if (lastUpdateIndex < 0) { + lastUpdateIndex = getViewCount() - 1; + } + } + firstUpdateIndex = Math.max(firstUpdateIndex, 0); + } + /** * Forwards the DocumentEvent to the give child view. This * simply messages the view with a call to insertUpdate, @@ -1345,4 +1353,14 @@ public abstract class View implements SwingConstants { private View parent; private Element elem; + /** + * The index of the first child view to be notified. + */ + int firstUpdateIndex; + + /** + * The index of the last child view to be notified. + */ + int lastUpdateIndex; + }; diff --git a/jdk/test/javax/swing/text/View/8014863/bug8014863.java b/jdk/test/javax/swing/text/View/8014863/bug8014863.java index ba78b4bbbbb..8618ec4eba7 100644 --- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java +++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java @@ -24,6 +24,7 @@ /* * @test * @bug 8014863 + * @bug 8024395 * @summary Tests the calculation of the line breaks when a text is inserted * @author Dmitry Markov * @library ../../../regtesthelpers @@ -34,91 +35,107 @@ import sun.awt.SunToolkit; import javax.swing.*; +import javax.swing.text.GlyphView; +import javax.swing.text.View; import javax.swing.text.html.HTMLEditorKit; import java.awt.*; import java.awt.event.KeyEvent; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; public class bug8014863 { private static JEditorPane editorPane; + private static JFrame frame; private static Robot robot; private static SunToolkit toolkit; + private static String text1 = "

    one two qqqq this is a test sentence qqqq pp qqqq pp " + + "qqqq pp qqqq pp qqqq pp qqqq pp qqqq pp qqqq pp qqqq

    "; + private static String text2 = "

    qqqq this is a test sentence qqqq pp qqqq pp " + + "qqqq pp qqqq pp qqqq pp qqqq pp qqqq pp qqqq pp qqqq

    "; + + private static ArrayList glyphViews; + public static void main(String[] args) throws Exception { toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); robot = new Robot(); + robot.setAutoDelay(50); + glyphViews = new ArrayList(); - createAndShowGUI(); + createAndShowGUI(text1); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + retrieveGlyphViews(editorPane.getUI().getRootView(editorPane)); + } + }); + GlyphView [] arr1 = glyphViews.toArray(new GlyphView[glyphViews.size()]); + + frame.dispose(); + glyphViews.clear(); + + createAndShowGUI(text2); toolkit.realSync(); Util.hitKeys(robot, KeyEvent.VK_HOME); + toolkit.realSync(); + Util.hitKeys(robot, KeyEvent.VK_O); - - toolkit.realSync(); - - if (3 != getNumberOfTextLines()) { - throw new RuntimeException("The number of texts lines does not meet the expectation"); - } - Util.hitKeys(robot, KeyEvent.VK_N); - - toolkit.realSync(); - - if (3 != getNumberOfTextLines()) { - throw new RuntimeException("The number of texts lines does not meet the expectation"); - } - Util.hitKeys(robot, KeyEvent.VK_E); Util.hitKeys(robot, KeyEvent.VK_SPACE); Util.hitKeys(robot, KeyEvent.VK_T); Util.hitKeys(robot, KeyEvent.VK_W); + Util.hitKeys(robot, KeyEvent.VK_O); + Util.hitKeys(robot, KeyEvent.VK_SPACE); toolkit.realSync(); - if (3 != getNumberOfTextLines()) { - throw new RuntimeException("The number of texts lines does not meet the expectation"); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + retrieveGlyphViews(editorPane.getUI().getRootView(editorPane)); + } + }); + GlyphView [] arr2 = glyphViews.toArray(new GlyphView[glyphViews.size()]); + + if (arr1.length != arr2.length) { + throw new RuntimeException("Test Failed!"); + } + + for (int i=0; iqqqq pp qqqq pp " + - "qqqq pp qqqq pp qqqq pp qqqq pp" + - " qqqq pp qqqq pp qqqq pp qqqq

    "); + editorPane.setText(text); editorPane.setCaretPosition(1); - // An actual font size depends on OS and might be differnet on various OSs. - // It is necessary to calculate the width to meet the expected number of lines. - int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()), - "qqqq pp qqqq pp qqqq pp qqqqqqqq"); + frame.add(editorPane); - frame.setSize(width, 200); + frame.setSize(200, 200); frame.setVisible(true); } }); From 295225d57e61ce41afa4e2e9b1b7f6670b948cbb Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 13 Sep 2013 11:58:39 +0400 Subject: [PATCH 134/983] 8024170: [SwingNode] Implement cursor change Reviewed-by: anthony, ant --- .../sun/lwawt/LWLightweightFramePeer.java | 12 ++++---- .../classes/sun/swing/JLightweightFrame.java | 30 ++++++++++++++++++- .../classes/sun/swing/LightweightContent.java | 8 +++++ .../classes/sun/swing/SwingAccessor.java | 29 ++++++++++++++++++ .../sun/awt/X11/XLightweightFramePeer.java | 7 +++++ .../sun/awt/windows/WComponentPeer.java | 2 +- .../awt/windows/WLightweightFramePeer.java | 7 +++++ 7 files changed, 88 insertions(+), 7 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java b/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java index 90e2e88c441..624be6bfc10 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java @@ -34,6 +34,8 @@ import java.awt.dnd.DropTarget; import sun.awt.CausedFocusEvent; import sun.awt.LightweightFrame; +import sun.swing.JLightweightFrame; +import sun.swing.SwingAccessor; public class LWLightweightFramePeer extends LWWindowPeer { @@ -90,11 +92,6 @@ public class LWLightweightFramePeer extends LWWindowPeer { setBounds(x, y, w, h, op, true, false); } - @Override - public void updateCursorImmediately() { - // TODO: tries to switch to the awt/fx toolkit thread and causes a deadlock on macosx - } - @Override public void addDropTarget(DropTarget dt) { } @@ -112,4 +109,9 @@ public class LWLightweightFramePeer extends LWWindowPeer { public void ungrab() { getLwTarget().ungrabFocus(); } + + @Override + public void updateCursorImmediately() { + SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget()); + } } diff --git a/jdk/src/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/share/classes/sun/swing/JLightweightFrame.java index 36bb1c351b7..e9a655309e2 100644 --- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java +++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java @@ -33,8 +33,9 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.MouseInfo; +import java.awt.Point; import java.awt.Rectangle; -import java.awt.event.ComponentListener; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.image.BufferedImage; @@ -48,6 +49,7 @@ import javax.swing.JPanel; import javax.swing.JRootPane; import javax.swing.LayoutFocusTraversalPolicy; import javax.swing.RootPaneContainer; +import javax.swing.SwingUtilities; import sun.awt.LightweightFrame; import sun.security.action.GetPropertyAction; @@ -88,6 +90,15 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan private PropertyChangeListener layoutSizeListener; + static { + SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() { + @Override + public void updateCursor(JLightweightFrame frame) { + frame.updateClientCursor(); + } + }); + } + /** * Constructs a new, initially invisible {@code JLightweightFrame} * instance. @@ -358,4 +369,21 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan public Component getGlassPane() { return getRootPane().getGlassPane(); } + + + /* + * Notifies client toolkit that it should change a cursor. + * + * Called from the peer via SwingAccessor, because the + * Component.updateCursorImmediately method is final + * and could not be overridden. + */ + private void updateClientCursor() { + Point p = MouseInfo.getPointerInfo().getLocation(); + SwingUtilities.convertPointFromScreen(p, this); + Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y); + if (target != null) { + content.setCursor(target.getCursor()); + } + } } diff --git a/jdk/src/share/classes/sun/swing/LightweightContent.java b/jdk/src/share/classes/sun/swing/LightweightContent.java index 256262dded1..dd3373aea1a 100644 --- a/jdk/src/share/classes/sun/swing/LightweightContent.java +++ b/jdk/src/share/classes/sun/swing/LightweightContent.java @@ -26,6 +26,7 @@ package sun.swing; import javax.swing.JComponent; +import java.awt.Cursor; /** * The interface by means of which the {@link JLightweightFrame} class @@ -179,4 +180,11 @@ public interface LightweightContent { * application that the content minimum size has changed. */ public void minimumSizeChanged(int width, int height); + + /** + * {@code JLightweightFrame} calls this method to notify the client + * application that in needs to set a cursor + * @param cursor a cursor to set + */ + default public void setCursor(Cursor cursor) { } } diff --git a/jdk/src/share/classes/sun/swing/SwingAccessor.java b/jdk/src/share/classes/sun/swing/SwingAccessor.java index 7e5100df6b7..72d15f41bd0 100644 --- a/jdk/src/share/classes/sun/swing/SwingAccessor.java +++ b/jdk/src/share/classes/sun/swing/SwingAccessor.java @@ -71,6 +71,16 @@ public final class SwingAccessor { Object state, boolean forDrop); } + /** + * An accessor for the JLightweightFrame class. + */ + public interface JLightweightFrameAccessor { + /** + * Notifies the JLightweight frame that it needs to update a cursor + */ + void updateCursor(JLightweightFrame frame); + } + /** * The javax.swing.text.JTextComponent class accessor object. */ @@ -93,4 +103,23 @@ public final class SwingAccessor { return jtextComponentAccessor; } + + /** + * The JLightweightFrame class accessor object + */ + private static JLightweightFrameAccessor jLightweightFrameAccessor; + + /** + * Set an accessor object for the JLightweightFrame class. + */ + public static void setJLightweightFrameAccessor(JLightweightFrameAccessor accessor) { + jLightweightFrameAccessor = accessor; + } + + /** + * Retrieve the accessor object for the JLightweightFrame class + */ + public static JLightweightFrameAccessor getJLightweightFrameAccessor() { + return jLightweightFrameAccessor; + } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java index 6292482acdf..49d48c806ae 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java @@ -28,6 +28,8 @@ package sun.awt.X11; import java.awt.Graphics; import sun.awt.LightweightFrame; +import sun.swing.JLightweightFrame; +import sun.swing.SwingAccessor; public class XLightweightFramePeer extends XFramePeer { @@ -62,4 +64,9 @@ public class XLightweightFramePeer extends XFramePeer { getLwTarget().ungrabFocus(); } } + + @Override + public void updateCursorImmediately() { + SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget()); + } } diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java index db62ab477ed..da4135ec033 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java @@ -656,7 +656,7 @@ public abstract class WComponentPeer extends WObjectPeer _setFont(f); } public synchronized native void _setFont(Font f); - public final void updateCursorImmediately() { + public void updateCursorImmediately() { WGlobalCursorManager.getCursorManager().updateCursorImmediately(); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java index c2c1604bef4..ae5afdc56e7 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java @@ -31,6 +31,8 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseEvent; import sun.awt.LightweightFrame; +import sun.swing.JLightweightFrame; +import sun.swing.SwingAccessor; public class WLightweightFramePeer extends WFramePeer { @@ -83,4 +85,9 @@ public class WLightweightFramePeer extends WFramePeer { public void ungrab() { getLwTarget().ungrabFocus(); } + + @Override + public void updateCursorImmediately() { + SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget()); + } } From 0960c5ec562343dcf6929cb1cae83cb6e5fb2c13 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 13 Sep 2013 17:25:31 +0400 Subject: [PATCH 135/983] 8015453: java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java failed on windows with jdk8 since b86 Reviewed-by: art, serb --- .../classes/sun/awt/datatransfer/DataTransferer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java index 83a73dbd51c..493d80a4c82 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -1765,7 +1765,14 @@ search: Reader reader = new InputStreamReader(is, unicode); theObject = constructFlavoredObject(reader, flavor, Reader.class); - + // Target data is a byte array + } else if (byteArrayClass.equals(flavor.getRepresentationClass())) { + if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) { + theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable) + .getBytes(DataTransferer.getTextCharset(flavor)); + } else { + theObject = inputStreamToByteArray(str); + } // Target data is an RMI object } else if (flavor.isRepresentationClassRemote()) { From d6a839a6381e15b44376ab025871199046231f35 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 13 Sep 2013 17:38:28 +0400 Subject: [PATCH 136/983] 8015371: The HTML text without tags does not appear inside the WordPad application, and we try to click the button, but the case exits Reviewed-by: anthony, serb --- jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java index 0ac812dd0a9..e499feb1885 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java @@ -211,9 +211,9 @@ public class WDataTransferer extends DataTransferer { DataFlavor.allHtmlFlavor, format); } else { - // handel other html flavor types, including custom and + // handle other html flavor types, including custom and // fragment ones - bytes = HTMLCodec.convertToHTMLFormat(bytes); + bytes = HTMLCodec.convertToHTMLFormat(super.translateTransferable(contents, flavor, format)); } } else { // we handle non-html types basing on their From 2527551f1d1461a242cd1c1ffa47181d41409acc Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 13 Sep 2013 17:41:47 +0400 Subject: [PATCH 137/983] 8015455: java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java hangs on windows Reviewed-by: serb, anthony --- .../share/classes/java/awt/dnd/DropTarget.java | 17 +++++++++++++++++ .../classes/javax/swing/TransferHandler.java | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/jdk/src/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/share/classes/java/awt/dnd/DropTarget.java index b167b8e63d8..a1fd5b56db9 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java @@ -351,6 +351,8 @@ public class DropTarget implements DropTargetListener, Serializable { * @see #isActive */ public synchronized void dragEnter(DropTargetDragEvent dtde) { + isDraggingInside = true; + if (!active) return; if (dtListener != null) { @@ -421,6 +423,8 @@ public class DropTarget implements DropTargetListener, Serializable { * @see #isActive */ public synchronized void dragExit(DropTargetEvent dte) { + isDraggingInside = false; + if (!active) return; if (dtListener != null && active) dtListener.dragExit(dte); @@ -444,6 +448,8 @@ public class DropTarget implements DropTargetListener, Serializable { * @see #isActive */ public synchronized void drop(DropTargetDropEvent dtde) { + isDraggingInside = false; + clearAutoscroll(); if (dtListener != null && active) @@ -533,6 +539,12 @@ public class DropTarget implements DropTargetListener, Serializable { ((DropTargetPeer)nativePeer).removeDropTarget(this); componentPeer = nativePeer = null; + + synchronized (this) { + if (isDraggingInside) { + dragExit(new DropTargetEvent(getDropTargetContext())); + } + } } /** @@ -855,4 +867,9 @@ public class DropTarget implements DropTargetListener, Serializable { */ private transient FlavorMap flavorMap; + + /* + * If the dragging is currently inside this drop target + */ + private transient boolean isDraggingInside; } diff --git a/jdk/src/share/classes/javax/swing/TransferHandler.java b/jdk/src/share/classes/javax/swing/TransferHandler.java index ed8a8d1ea30..f5d85408e70 100644 --- a/jdk/src/share/classes/javax/swing/TransferHandler.java +++ b/jdk/src/share/classes/javax/swing/TransferHandler.java @@ -1268,6 +1268,14 @@ public class TransferHandler implements Serializable { } } } + if (!isActive()) { + // If the Drop target is inactive the dragExit will not be dispatched to the dtListener, + // so make sure that we clean up the dtListener anyway. + DropTargetListener dtListener = getDropTargetListener(); + if (dtListener != null && dtListener instanceof DropHandler) { + ((DropHandler)dtListener).cleanup(false); + } + } } public void drop(DropTargetDropEvent e) { From d52e73dc35503f66759f011de8b7fd66000c81bd Mon Sep 17 00:00:00 2001 From: Mikhail Cherkasov Date: Fri, 13 Sep 2013 17:48:37 +0400 Subject: [PATCH 138/983] 8015601: [macosx] Test javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java fails on MacOS X Reviewed-by: alexp, alexsch --- .../InternalFrameIsNotCollectedTest.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java index 182e57eef55..fff9c8e1d94 100644 --- a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java +++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java @@ -27,19 +27,19 @@ @author mcherkas @run main InternalFrameIsNotCollectedTest */ - import sun.awt.SunToolkit; import javax.swing.*; import java.awt.*; -import java.awt.event.KeyEvent; import java.beans.PropertyVetoException; import java.util.Date; public class InternalFrameIsNotCollectedTest { - public static final int waitTime = 10000; + public static final int maxWaitTime = 100000; + public static final int waitTime = 5000; private static Robot robot; + private static CustomInternalFrame iFrame; public static void sync() { @@ -62,12 +62,13 @@ public class InternalFrameIsNotCollectedTest { }); sync(); invokeGC(); + System.runFinalization(); Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later Date startWaiting = new Date(); synchronized (CustomInternalFrame.waiter) { // Sync with finalization thread. Date now = new Date(); - while (now.getTime() - startWaiting.getTime() < waitTime && !CustomInternalFrame.finalized) { + while (now.getTime() - startWaiting.getTime() < maxWaitTime && !CustomInternalFrame.finalized) { CustomInternalFrame.waiter.wait(waitTime); now = new Date(); } @@ -83,10 +84,8 @@ public class InternalFrameIsNotCollectedTest { } private static void closeInternalFrame() throws PropertyVetoException { - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_F4); - robot.keyRelease(KeyEvent.VK_F4); - robot.keyRelease(KeyEvent.VK_CONTROL); + iFrame.setClosed(true); + iFrame = null; } private static void initUI() { @@ -96,7 +95,7 @@ public class InternalFrameIsNotCollectedTest { desktopPane.setDesktopManager(new DefaultDesktopManager()); frame.getContentPane().add(desktopPane, BorderLayout.CENTER); - CustomInternalFrame iFrame = new CustomInternalFrame("Dummy Frame"); + iFrame = new CustomInternalFrame("Dummy Frame"); iFrame.setSize(200, 200); iFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); From fee5a04c7bfb5dfbf57e8488f03b90b676da0f5d Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Fri, 13 Sep 2013 17:54:45 +0400 Subject: [PATCH 139/983] 8006087: [TEST_BUG] The BACKSPACE key doesn't work and after pressing 'cancel' and 'DONE' button, the case pass automatically Reviewed-by: alexsch, serb --- .../JFileChooser/4150029/bug4150029.html | 32 +++++++++++++++++++ .../JFileChooser/4150029/bug4150029.java | 19 +++++++---- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html index 15620bf05a3..902dda5b6c9 100644 --- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html +++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html @@ -1,6 +1,38 @@ + + + + +Follow the instructions below. 1.Go into 'subDir' folder. 2.Press BACKSPACE key. 3.Push OPEN button. diff --git a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java index d71bbf46828..bc4b1a8ef43 100644 --- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java +++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,10 @@ * questions. */ -/* @test - @bug 4150029 - @summary BackSpace keyboard button does not lead to parent directory - @author Oleg Mokhovikov - @run applet/manual=done bug4150029.html +/* + bug 4150029 8006087 + summary BackSpace keyboard button does not lead to parent directory + author Oleg Mokhovikov */ import javax.swing.*; @@ -36,6 +35,14 @@ public class bug4150029 extends JApplet { private boolean res; public void init() { + if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + String tmpDir = System.getProperty("java.io.tmpdir"); if (tmpDir.length() == 0) {//'java.io.tmpdir' isn't guaranteed to be defined From 6578d6acada94b72a51a222b4b81c0c674d3142c Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Fri, 13 Sep 2013 17:58:05 +0400 Subject: [PATCH 140/983] 8015597: [TEST_BUG] [macosx] Test closed/javax/swing/JMenuBar/4750590/bug4750590.java fails since JDK 8 b75 on MacOSX Reviewed-by: alexsch, serb --- .../swing/JMenuBar/4750590/bug4750590.java | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java diff --git a/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java new file mode 100644 index 00000000000..2ba8a51ebae --- /dev/null +++ b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java @@ -0,0 +1,98 @@ +/* + * 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 + @library ../../regtesthelpers + @build Util + @bug 4750590 8015597 + @summary SwingSet: Cannot change Themes using menu accelerators + @author Alexander Zuev + @run main bug4750590 + */ + +import javax.swing.*; +import java.awt.event.*; +import java.awt.*; + +public class bug4750590 { + + public static PassedListener pass = new PassedListener(); + public static volatile boolean passed = false; + + public static void main(String args[]) throws Throwable { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + + sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + Robot robo = new Robot(); + robo.setAutoDelay(500); + Util.hitMnemonics(robo, KeyEvent.VK_F); + robo.keyPress(KeyEvent.VK_M); + robo.keyRelease(KeyEvent.VK_M); + + toolkit.realSync(); + + if (passed) { + System.out.println("Test passed!"); + } else { + throw new RuntimeException("Test FAILED!"); + } + } + + private static void createAndShowGUI() { + JFrame mainFrame = new JFrame("Bug 4750590"); + JMenuBar mbar = new JMenuBar(); + JMenu menu = new JMenu("File"); + menu.setMnemonic('F'); + JMenu submenu = new JMenu("Submenu"); + submenu.add(new JMenuItem("SubMenu Item 1")).setMnemonic('S'); + submenu.add(new JMenuItem("SubMenu Item 2")); + menu.add(submenu); + + menu.add(new JMenuItem("Menu Item 1")); + JMenuItem menuItem = menu.add(new JMenuItem("Menu Item 2")); + menuItem.setMnemonic('M'); + menuItem.addActionListener(pass); + mbar.add(menu); + mainFrame.setJMenuBar(mbar); + + mainFrame.setSize(200, 200); + mainFrame.setLocation(200, 200); + mainFrame.setVisible(true); + mainFrame.toFront(); + } + + public static class PassedListener implements ActionListener { + public void actionPerformed(ActionEvent ev) { + passed = true; + } + } + +} From a7d4eaed9ad897dd8868e7a56308b9d2ae01f6c2 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 13 Sep 2013 18:02:18 +0400 Subject: [PATCH 141/983] 8012026: [macosx] Component.getMousePosition() does not work in an applet on MacOS Reviewed-by: anthony, serb --- jdk/make/sun/lwawt/FILES_export_macosx.gmk | 1 - .../sun/lwawt/macosx/CMouseInfoPeer.java | 45 ------- .../classes/sun/lwawt/macosx/LWCToolkit.java | 5 - jdk/src/macosx/native/sun/awt/AWTView.m | 2 +- .../GetMousePositionWithOverlay.java | 108 +++++++++++++++++ .../GetMousePositionWithPopup.java | 111 ++++++++++++++++++ 6 files changed, 220 insertions(+), 52 deletions(-) delete mode 100644 jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java create mode 100644 jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java create mode 100644 jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java diff --git a/jdk/make/sun/lwawt/FILES_export_macosx.gmk b/jdk/make/sun/lwawt/FILES_export_macosx.gmk index 5799b32c954..0750201e9ec 100644 --- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk +++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk @@ -141,7 +141,6 @@ FILES_export = \ sun/lwawt/macosx/CMenuBar.java \ sun/lwawt/macosx/CMenuComponent.java \ sun/lwawt/macosx/CMenuItem.java \ - sun/lwawt/macosx/CMouseInfoPeer.java \ sun/lwawt/macosx/CPlatformView.java \ sun/lwawt/macosx/CPlatformWindow.java \ sun/lwawt/macosx/CWarningWindow.java \ diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java deleted file mode 100644 index 8ee580108dc..00000000000 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.lwawt.macosx; - -import java.awt.Window; -import sun.lwawt.LWMouseInfoPeer; -import sun.lwawt.LWWindowPeer; - -public class CMouseInfoPeer extends LWMouseInfoPeer -{ - //If a new window is to appear under the cursor, - //we get wrong window. - //This is a workaround for macosx. - @Override - public boolean isWindowUnderMouse(Window w) { - if (w == null) { - return false; - } - - return ((LWWindowPeer)w.getPeer()).getPlatformWindow().isUnderMouse(); - } -} diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index e028df560f6..cf395f3ab86 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -302,11 +302,6 @@ public final class LWCToolkit extends LWToolkit { return new OSXPlatformFont(name, style); } - @Override - protected MouseInfoPeer createMouseInfoPeerImpl() { - return new CMouseInfoPeer(); - } - @Override protected int getScreenHeight() { return GraphicsEnvironment.getLocalGraphicsEnvironment() diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 7e1f248c7ed..6ee074f12ab 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -387,7 +387,7 @@ AWT_ASSERT_APPKIT_THREAD; [rolloverTrackingArea release]; } - int options = (NSTrackingActiveInActiveApp | NSTrackingMouseEnteredAndExited | + int options = (NSTrackingActiveAlways | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingEnabledDuringMouseDrag); rolloverTrackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect] diff --git a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java new file mode 100644 index 00000000000..3cb1b735837 --- /dev/null +++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.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 test.java.awt.regtesthelpers.Util; + +import javax.swing.*; +import java.awt.*; +import java.util.concurrent.atomic.AtomicReference; + +/** + * @test + * @bug 8012026 + * @summary Component.getMousePosition() does not work in an applet on MacOS + * @author Petr Pchelko + * @library ../../regtesthelpers + * @build Util + * @compile GetMousePositionWithOverlay.java + * @run main/othervm GetMousePositionWithOverlay + */ + +public class GetMousePositionWithOverlay { + + static Frame backFrame; + static Frame frontFrame; + + public static void main(String[] args) throws Throwable { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + constructTestUI(); + } + }); + Util.waitForIdle(null); + + Robot r = new Robot(); + Util.pointOnComp(frontFrame, r); + Util.waitForIdle(null); + + Point pos = getMousePosition(backFrame); + if (pos != null) { + throw new RuntimeException("Test failed. Mouse position should be null but was" + pos); + } + + pos = getMousePosition(frontFrame); + if (pos == null) { + throw new RuntimeException("Test failed. Mouse position should not be null"); + } + + r.mouseMove(189, 189); + Util.waitForIdle(null); + + pos = getMousePosition(backFrame); + if (pos == null) { + throw new RuntimeException("Test failed. Mouse position should not be null"); + } + } finally { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + backFrame.dispose(); + frontFrame.dispose(); + } + }); + } + } + + private static Point getMousePosition(final Component component) throws Exception { + final AtomicReference pos = new AtomicReference(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + pos.set(component.getMousePosition()); + } + }); + return pos.get(); + } + + private static void constructTestUI() { + backFrame = new Frame(); + backFrame.setBounds(100, 100, 100, 100); + backFrame.setVisible(true); + + frontFrame = new Frame(); + frontFrame.setBounds(120, 120, 60, 60); + frontFrame.setVisible(true); + } +} diff --git a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java new file mode 100644 index 00000000000..d04b50087ad --- /dev/null +++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java @@ -0,0 +1,111 @@ +/* + * 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 test.java.awt.regtesthelpers.Util; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; + +/** + * @test + * @bug 8012026 + * @summary Component.getMousePosition() does not work in an applet on MacOS + * @author Petr Pchelko + * @library ../../regtesthelpers + * @build Util + * @compile GetMousePositionWithPopup.java + * @run main/othervm GetMousePositionWithPopup + */ + +public class GetMousePositionWithPopup { + + private static Frame frame1; + private static Frame frame2; + + public static void main(String[] args) throws Exception { + try { + Robot r = Util.createRobot(); + r.mouseMove(0, 0); + Util.waitForIdle(null); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + constructTestUI(); + } + }); + + Util.waitForIdle(null); + r.mouseMove(149, 149); + Util.waitForIdle(null); + r.mouseMove(150, 150); + Util.waitForIdle(null); + + } finally { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame1.dispose(); + frame2.dispose(); + } + }); + } + } + + private static void constructTestUI() { + frame1 = new Frame(); + frame1.setBounds(100, 100, 100, 100); + frame1.addMouseMotionListener(new MouseMotionAdapter() { + + private boolean shown = false; + + @Override + public void mouseMoved(MouseEvent e) { + if (shown) { + return; + } + + shown = true; + + frame2 = new Frame(); + frame2.setBounds(120, 120, 120, 120); + frame2.setVisible(true); + + Point positionInFrame2 = frame2.getMousePosition(); + if (positionInFrame2.x != 30 || positionInFrame2.y != 30) { + throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" + + positionInFrame2.x + ", " + positionInFrame2.y + "]"); + } + + Point positionInFrame1 = frame1.getMousePosition(); + if (positionInFrame1 != null) { + throw new RuntimeException("Wrong position reported. Should be null"); + } + + } + }); + frame1.setVisible(true); + } +} From c492e4ef1fa7888cf1a5f69249c0fd87b2dcc4ed Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Sat, 14 Sep 2013 22:46:49 +0100 Subject: [PATCH 142/983] 8024835: Change until() to accept any compatible temporal Method until(Temporal,TemporalUnit) now uses from() to convert; Enhance from() methods where necessary Reviewed-by: sherman --- jdk/src/share/classes/java/time/Duration.java | 8 +- jdk/src/share/classes/java/time/Instant.java | 26 ++++--- .../share/classes/java/time/LocalDate.java | 28 ++++--- .../classes/java/time/LocalDateTime.java | 26 +++---- .../share/classes/java/time/LocalTime.java | 23 +++--- jdk/src/share/classes/java/time/MonthDay.java | 3 +- .../classes/java/time/OffsetDateTime.java | 22 +++--- .../share/classes/java/time/OffsetTime.java | 22 +++--- jdk/src/share/classes/java/time/Year.java | 23 +++--- .../share/classes/java/time/YearMonth.java | 23 +++--- .../share/classes/java/time/ZoneOffset.java | 1 + .../classes/java/time/ZonedDateTime.java | 26 +++---- .../java/time/chrono/ChronoLocalDate.java | 17 +++-- .../java/time/chrono/ChronoLocalDateImpl.java | 21 ++---- .../java/time/chrono/ChronoLocalDateTime.java | 1 + .../time/chrono/ChronoLocalDateTimeImpl.java | 15 ++-- .../java/time/chrono/ChronoZonedDateTime.java | 1 + .../time/chrono/ChronoZonedDateTimeImpl.java | 19 ++--- .../java/time/temporal/ChronoUnit.java | 4 +- .../classes/java/time/temporal/IsoFields.java | 11 ++- .../classes/java/time/temporal/Temporal.java | 22 ++++-- .../java/time/temporal/TemporalUnit.java | 23 ++++-- .../java/time/tck/java/time/TCKDuration.java | 10 ++- .../java/time/tck/java/time/TCKInstant.java | 32 ++++++-- .../java/time/tck/java/time/TCKLocalDate.java | 29 +++++-- .../time/tck/java/time/TCKLocalDateTime.java | 27 ++++++- .../java/time/tck/java/time/TCKLocalTime.java | 29 +++++-- .../time/tck/java/time/TCKOffsetDateTime.java | 75 +++++++++++++++++++ .../time/tck/java/time/TCKOffsetTime.java | 62 ++++++++------- jdk/test/java/time/tck/java/time/TCKYear.java | 47 ++++++++---- .../java/time/tck/java/time/TCKYearMonth.java | 44 +++++++---- .../time/tck/java/time/TCKZonedDateTime.java | 22 +++--- .../time/tck/java/time/chrono/CopticDate.java | 12 +-- .../tck/java/time/temporal/TCKIsoFields.java | 11 ++- 34 files changed, 487 insertions(+), 278 deletions(-) diff --git a/jdk/src/share/classes/java/time/Duration.java b/jdk/src/share/classes/java/time/Duration.java index ce2ba7781b0..896a2990eaa 100644 --- a/jdk/src/share/classes/java/time/Duration.java +++ b/jdk/src/share/classes/java/time/Duration.java @@ -441,9 +441,13 @@ public final class Duration //----------------------------------------------------------------------- /** - * Obtains a {@code Duration} representing the duration between two instants. + * Obtains a {@code Duration} representing the duration between two temporal objects. + *

    + * This calculates the duration between two temporal objects. If the objects + * are of different types, then the duration is calculated based on the type + * of the first object. For example, if the first argument is a {@code LocalTime} + * then the second argument is converted to a {@code LocalTime}. *

    - * This calculates the duration between two temporal objects of the same type. * The specified temporal objects must support the {@link ChronoUnit#SECONDS SECONDS} unit. * For full accuracy, either the {@link ChronoUnit#NANOS NANOS} unit or the * {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported. diff --git a/jdk/src/share/classes/java/time/Instant.java b/jdk/src/share/classes/java/time/Instant.java index 9d74e29f91a..a7bd6f92004 100644 --- a/jdk/src/share/classes/java/time/Instant.java +++ b/jdk/src/share/classes/java/time/Instant.java @@ -362,6 +362,10 @@ public final class Instant * @throws DateTimeException if unable to convert to an {@code Instant} */ public static Instant from(TemporalAccessor temporal) { + if (temporal instanceof Instant) { + return (Instant) temporal; + } + Objects.requireNonNull(temporal, "temporal"); long instantSecs = temporal.getLong(INSTANT_SECONDS); int nanoOfSecond = temporal.get(NANO_OF_SECOND); return Instant.ofEpochSecond(instantSecs, nanoOfSecond); @@ -1091,7 +1095,8 @@ public final class Instant * The result will be negative if the end is before the start. * The calculation returns a whole number, representing the number of * complete units between the two instants. - * The {@code Temporal} passed to this method must be an {@code Instant}. + * The {@code Temporal} passed to this method is converted to a + * {@code Instant} using {@link #from(TemporalAccessor)}. * For example, the amount in days between two dates can be calculated * using {@code startInstant.until(endInstant, SECONDS)}. *

    @@ -1112,25 +1117,22 @@ public final class Instant *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endInstant the end date, which must be an {@code Instant}, not null + * @param endExclusive the end date, exclusive, which is converted to an {@code Instant}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this instant and the end instant - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to an {@code Instant} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endInstant, TemporalUnit unit) { - if (endInstant instanceof Instant == false) { - Objects.requireNonNull(endInstant, "endInstant"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - Instant end = (Instant) endInstant; + public long until(Temporal endExclusive, TemporalUnit unit) { + Instant end = Instant.from(endExclusive); if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { @@ -1145,7 +1147,7 @@ public final class Instant } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endInstant); + return unit.between(this, end); } private long nanosUntil(Instant end) { diff --git a/jdk/src/share/classes/java/time/LocalDate.java b/jdk/src/share/classes/java/time/LocalDate.java index 110a80fc9c0..f388959aa63 100644 --- a/jdk/src/share/classes/java/time/LocalDate.java +++ b/jdk/src/share/classes/java/time/LocalDate.java @@ -353,6 +353,7 @@ public final class LocalDate * @throws DateTimeException if unable to convert to a {@code LocalDate} */ public static LocalDate from(TemporalAccessor temporal) { + Objects.requireNonNull(temporal, "temporal"); LocalDate date = temporal.query(TemporalQuery.localDate()); if (date == null) { throw new DateTimeException("Unable to obtain LocalDate from TemporalAccessor: " + temporal.getClass()); @@ -1125,11 +1126,11 @@ public final class LocalDate */ @Override public LocalDate plus(TemporalAmount amountToAdd) { - Objects.requireNonNull(amountToAdd, "amountToAdd"); if (amountToAdd instanceof Period) { Period periodToAdd = (Period) amountToAdd; return plusMonths(periodToAdd.toTotalMonths()).plusDays(periodToAdd.getDays()); } + Objects.requireNonNull(amountToAdd, "amountToAdd"); return (LocalDate) amountToAdd.addTo(this); } @@ -1358,11 +1359,11 @@ public final class LocalDate */ @Override public LocalDate minus(TemporalAmount amountToSubtract) { - Objects.requireNonNull(amountToSubtract, "amountToSubtract"); if (amountToSubtract instanceof Period) { Period periodToSubtract = (Period) amountToSubtract; return minusMonths(periodToSubtract.toTotalMonths()).minusDays(periodToSubtract.getDays()); } + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); return (LocalDate) amountToSubtract.subtractFrom(this); } @@ -1541,7 +1542,8 @@ public final class LocalDate * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified date. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a {@code LocalDate}. + * The {@code Temporal} passed to this method is converted to a + * {@code LocalDate} using {@link #from(TemporalAccessor)}. * For example, the amount in days between two dates can be calculated * using {@code startDate.until(endDate, DAYS)}. *

    @@ -1567,26 +1569,22 @@ public final class LocalDate *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endDate the end date, which must be a {@code LocalDate}, not null + * @param endExclusive the end date, exclusive, which is converted to a {@code LocalDate}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this date and the end date - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code LocalDate} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endDate, TemporalUnit unit) { - Objects.requireNonNull(unit, "unit"); - if (endDate instanceof LocalDate == false) { - Objects.requireNonNull(endDate, "endDate"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - LocalDate end = (LocalDate) endDate; + public long until(Temporal endExclusive, TemporalUnit unit) { + LocalDate end = LocalDate.from(endExclusive); if (unit instanceof ChronoUnit) { switch ((ChronoUnit) unit) { case DAYS: return daysUntil(end); @@ -1600,7 +1598,7 @@ public final class LocalDate } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endDate); + return unit.between(this, end); } long daysUntil(LocalDate end) { diff --git a/jdk/src/share/classes/java/time/LocalDateTime.java b/jdk/src/share/classes/java/time/LocalDateTime.java index d0b72b90f82..aed44dd4bfe 100644 --- a/jdk/src/share/classes/java/time/LocalDateTime.java +++ b/jdk/src/share/classes/java/time/LocalDateTime.java @@ -1129,11 +1129,11 @@ public final class LocalDateTime */ @Override public LocalDateTime plus(TemporalAmount amountToAdd) { - Objects.requireNonNull(amountToAdd, "amountToAdd"); if (amountToAdd instanceof Period) { Period periodToAdd = (Period) amountToAdd; return with(date.plus(periodToAdd), time); } + Objects.requireNonNull(amountToAdd, "amountToAdd"); return (LocalDateTime) amountToAdd.addTo(this); } @@ -1348,11 +1348,11 @@ public final class LocalDateTime */ @Override public LocalDateTime minus(TemporalAmount amountToSubtract) { - Objects.requireNonNull(amountToSubtract, "amountToSubtract"); if (amountToSubtract instanceof Period) { Period periodToSubtract = (Period) amountToSubtract; return with(date.minus(periodToSubtract), time); } + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); return (LocalDateTime) amountToSubtract.subtractFrom(this); } @@ -1621,7 +1621,8 @@ public final class LocalDateTime * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified date-time. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a {@code LocalDateTime}. + * The {@code Temporal} passed to this method is converted to a + * {@code LocalDateTime} using {@link #from(TemporalAccessor)}. * For example, the amount in days between two date-times can be calculated * using {@code startDateTime.until(endDateTime, DAYS)}. *

    @@ -1649,25 +1650,22 @@ public final class LocalDateTime *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endDateTime the end date-time, which must be a {@code LocalDateTime}, not null + * @param endExclusive the end date, exclusive, which is converted to a {@code LocalDateTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this date-time and the end date-time - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code LocalDateTime} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof LocalDateTime == false) { - Objects.requireNonNull(endDateTime, "endDateTime"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - LocalDateTime end = (LocalDateTime) endDateTime; + public long until(Temporal endExclusive, TemporalUnit unit) { + LocalDateTime end = LocalDateTime.from(endExclusive); if (unit instanceof ChronoUnit) { if (unit.isTimeBased()) { long amount = date.daysUntil(end.date); @@ -1721,7 +1719,7 @@ public final class LocalDateTime } return date.until(endDate, unit); } - return unit.between(this, endDateTime); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/LocalTime.java b/jdk/src/share/classes/java/time/LocalTime.java index a6270db19cf..77ab2c7f286 100644 --- a/jdk/src/share/classes/java/time/LocalTime.java +++ b/jdk/src/share/classes/java/time/LocalTime.java @@ -394,6 +394,7 @@ public final class LocalTime * @throws DateTimeException if unable to convert to a {@code LocalTime} */ public static LocalTime from(TemporalAccessor temporal) { + Objects.requireNonNull(temporal, "temporal"); LocalTime time = temporal.query(TemporalQuery.localTime()); if (time == null) { throw new DateTimeException("Unable to obtain LocalTime from TemporalAccessor: " + temporal.getClass()); @@ -1330,7 +1331,8 @@ public final class LocalTime * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified time. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a {@code LocalTime}. + * The {@code Temporal} passed to this method is converted to a + * {@code LocalTime} using {@link #from(TemporalAccessor)}. * For example, the amount in hours between two times can be calculated * using {@code startTime.until(endTime, HOURS)}. *

    @@ -1356,25 +1358,22 @@ public final class LocalTime *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endTime the end time, which must be a {@code LocalTime}, not null + * @param endExclusive the end time, exclusive, which is converted to a {@code LocalTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this time and the end time - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code LocalTime} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endTime, TemporalUnit unit) { - if (endTime instanceof LocalTime == false) { - Objects.requireNonNull(endTime, "endTime"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - LocalTime end = (LocalTime) endTime; + public long until(Temporal endExclusive, TemporalUnit unit) { + LocalTime end = LocalTime.from(endExclusive); if (unit instanceof ChronoUnit) { long nanosUntil = end.toNanoOfDay() - toNanoOfDay(); // no overflow switch ((ChronoUnit) unit) { @@ -1388,7 +1387,7 @@ public final class LocalTime } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endTime); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/MonthDay.java b/jdk/src/share/classes/java/time/MonthDay.java index 22807822f2b..67f5d4fa87f 100644 --- a/jdk/src/share/classes/java/time/MonthDay.java +++ b/jdk/src/share/classes/java/time/MonthDay.java @@ -246,7 +246,8 @@ public final class MonthDay *

    * The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} and * {@link ChronoField#DAY_OF_MONTH DAY_OF_MONTH} fields. - * The extraction is only permitted if the date-time has an ISO chronology. + * The extraction is only permitted if the temporal object has an ISO + * chronology, or can be converted to a {@code LocalDate}. *

    * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used in queries via method reference, {@code MonthDay::from}. diff --git a/jdk/src/share/classes/java/time/OffsetDateTime.java b/jdk/src/share/classes/java/time/OffsetDateTime.java index f894e53e46f..410c7f3a747 100644 --- a/jdk/src/share/classes/java/time/OffsetDateTime.java +++ b/jdk/src/share/classes/java/time/OffsetDateTime.java @@ -1592,7 +1592,8 @@ public final class OffsetDateTime * For example, the period in days between two date-times can be calculated * using {@code startDateTime.until(endDateTime, DAYS)}. *

    - * The {@code Temporal} passed to this method must be an {@code OffsetDateTime}. + * The {@code Temporal} passed to this method is converted to a + * {@code OffsetDateTime} using {@link #from(TemporalAccessor)}. * If the offset differs between the two date-times, the specified * end date-time is normalized to have the same offset as this date-time. *

    @@ -1620,30 +1621,27 @@ public final class OffsetDateTime *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endDateTime the end date-time, which must be an {@code OffsetDateTime}, not null + * @param endExclusive the end date, exclusive, which is converted to an {@code OffsetDateTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this date-time and the end date-time - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to an {@code OffsetDateTime} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof OffsetDateTime == false) { - Objects.requireNonNull(endDateTime, "endDateTime"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + OffsetDateTime end = OffsetDateTime.from(endExclusive); if (unit instanceof ChronoUnit) { - OffsetDateTime end = (OffsetDateTime) endDateTime; end = end.withOffsetSameInstant(offset); return dateTime.until(end.dateTime, unit); } - return unit.between(this, endDateTime); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/OffsetTime.java b/jdk/src/share/classes/java/time/OffsetTime.java index 6c67ef82bb1..a8dbf8a7a56 100644 --- a/jdk/src/share/classes/java/time/OffsetTime.java +++ b/jdk/src/share/classes/java/time/OffsetTime.java @@ -1124,7 +1124,8 @@ public final class OffsetTime * For example, the period in hours between two times can be calculated * using {@code startTime.until(endTime, HOURS)}. *

    - * The {@code Temporal} passed to this method must be an {@code OffsetTime}. + * The {@code Temporal} passed to this method is converted to a + * {@code OffsetTime} using {@link #from(TemporalAccessor)}. * If the offset differs between the two times, then the specified * end time is normalized to have the same offset as this time. *

    @@ -1150,26 +1151,23 @@ public final class OffsetTime *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endTime the end time, which must be an {@code OffsetTime}, not null + * @param endExclusive the end date, exclusive, which is converted to an {@code OffsetTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this time and the end time - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to an {@code OffsetTime} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endTime, TemporalUnit unit) { - if (endTime instanceof OffsetTime == false) { - Objects.requireNonNull(endTime, "endTime"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + OffsetTime end = OffsetTime.from(endExclusive); if (unit instanceof ChronoUnit) { - OffsetTime end = (OffsetTime) endTime; long nanosUntil = end.toEpochNano() - toEpochNano(); // no overflow switch ((ChronoUnit) unit) { case NANOS: return nanosUntil; @@ -1182,7 +1180,7 @@ public final class OffsetTime } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endTime); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/Year.java b/jdk/src/share/classes/java/time/Year.java index f51bda69664..377dfd5185a 100644 --- a/jdk/src/share/classes/java/time/Year.java +++ b/jdk/src/share/classes/java/time/Year.java @@ -242,6 +242,7 @@ public final class Year if (temporal instanceof Year) { return (Year) temporal; } + Objects.requireNonNull(temporal, "temporal"); try { if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) { temporal = LocalDate.from(temporal); @@ -859,7 +860,8 @@ public final class Year * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified year. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a {@code Year}. + * The {@code Temporal} passed to this method is converted to a + * {@code Year} using {@link #from(TemporalAccessor)}. * For example, the period in decades between two year can be calculated * using {@code startYear.until(endYear, DECADES)}. *

    @@ -885,25 +887,22 @@ public final class Year *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endYear the end year, which must be a {@code Year}, not null + * @param endExclusive the end date, exclusive, which is converted to a {@code Year}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this year and the end year - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code Year} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endYear, TemporalUnit unit) { - if (endYear instanceof Year == false) { - Objects.requireNonNull(endYear, "endYear"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - Year end = (Year) endYear; + public long until(Temporal endExclusive, TemporalUnit unit) { + Year end = Year.from(endExclusive); if (unit instanceof ChronoUnit) { long yearsUntil = ((long) end.year) - year; // no overflow switch ((ChronoUnit) unit) { @@ -915,7 +914,7 @@ public final class Year } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endYear); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/YearMonth.java b/jdk/src/share/classes/java/time/YearMonth.java index 541676117eb..223c90ab0f0 100644 --- a/jdk/src/share/classes/java/time/YearMonth.java +++ b/jdk/src/share/classes/java/time/YearMonth.java @@ -245,6 +245,7 @@ public final class YearMonth if (temporal instanceof YearMonth) { return (YearMonth) temporal; } + Objects.requireNonNull(temporal, "temporal"); try { if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) { temporal = LocalDate.from(temporal); @@ -992,7 +993,8 @@ public final class YearMonth * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified year-month. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a {@code YearMonth}. + * The {@code Temporal} passed to this method is converted to a + * {@code YearMonth} using {@link #from(TemporalAccessor)}. * For example, the period in years between two year-months can be calculated * using {@code startYearMonth.until(endYearMonth, YEARS)}. *

    @@ -1018,25 +1020,22 @@ public final class YearMonth *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endYearMonth the end year-month, which must be a {@code YearMonth}, not null + * @param endExclusive the end date, exclusive, which is converted to a {@code YearMonth}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this year-month and the end year-month - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code YearMonth} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endYearMonth, TemporalUnit unit) { - if (endYearMonth instanceof YearMonth == false) { - Objects.requireNonNull(endYearMonth, "endYearMonth"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - YearMonth end = (YearMonth) endYearMonth; + public long until(Temporal endExclusive, TemporalUnit unit) { + YearMonth end = YearMonth.from(endExclusive); if (unit instanceof ChronoUnit) { long monthsUntil = end.getProlepticMonth() - getProlepticMonth(); // no overflow switch ((ChronoUnit) unit) { @@ -1049,7 +1048,7 @@ public final class YearMonth } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endYearMonth); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/ZoneOffset.java b/jdk/src/share/classes/java/time/ZoneOffset.java index 2d63a978d8c..3475e5f4db3 100644 --- a/jdk/src/share/classes/java/time/ZoneOffset.java +++ b/jdk/src/share/classes/java/time/ZoneOffset.java @@ -333,6 +333,7 @@ public final class ZoneOffset * @throws DateTimeException if unable to convert to an {@code ZoneOffset} */ public static ZoneOffset from(TemporalAccessor temporal) { + Objects.requireNonNull(temporal, "temporal"); ZoneOffset offset = temporal.query(TemporalQuery.offset()); if (offset == null) { throw new DateTimeException("Unable to obtain ZoneOffset from TemporalAccessor: " + temporal.getClass()); diff --git a/jdk/src/share/classes/java/time/ZonedDateTime.java b/jdk/src/share/classes/java/time/ZonedDateTime.java index 971ba6daf5b..1114ab4edd3 100644 --- a/jdk/src/share/classes/java/time/ZonedDateTime.java +++ b/jdk/src/share/classes/java/time/ZonedDateTime.java @@ -1540,11 +1540,11 @@ public final class ZonedDateTime */ @Override public ZonedDateTime plus(TemporalAmount amountToAdd) { - Objects.requireNonNull(amountToAdd, "amountToAdd"); if (amountToAdd instanceof Period) { Period periodToAdd = (Period) amountToAdd; return resolveLocal(dateTime.plus(periodToAdd)); } + Objects.requireNonNull(amountToAdd, "amountToAdd"); return (ZonedDateTime) amountToAdd.addTo(this); } @@ -1792,11 +1792,11 @@ public final class ZonedDateTime */ @Override public ZonedDateTime minus(TemporalAmount amountToSubtract) { - Objects.requireNonNull(amountToSubtract, "amountToSubtract"); if (amountToSubtract instanceof Period) { Period periodToSubtract = (Period) amountToSubtract; return resolveLocal(dateTime.minus(periodToSubtract)); } + Objects.requireNonNull(amountToSubtract, "amountToSubtract"); return (ZonedDateTime) amountToSubtract.subtractFrom(this); } @@ -2044,7 +2044,8 @@ public final class ZonedDateTime * For example, the period in days between two date-times can be calculated * using {@code startDateTime.until(endDateTime, DAYS)}. *

    - * The {@code Temporal} passed to this method must be a {@code ZonedDateTime}. + * The {@code Temporal} passed to this method is converted to a + * {@code ZonedDateTime} using {@link #from(TemporalAccessor)}. * If the time-zone differs between the two zoned date-times, the specified * end date-time is normalized to have the same zone as this date-time. *

    @@ -2086,26 +2087,23 @@ public final class ZonedDateTime *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as - * the second argument. + * passing {@code this} as the first argument and the converted input temporal + * as the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endDateTime the end date-time, which must be a {@code ZonedDateTime}, not null + * @param endExclusive the end date, exclusive, which is converted to a {@code ZonedDateTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this date-time and the end date-time - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code ZonedDateTime} * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof ZonedDateTime == false) { - Objects.requireNonNull(endDateTime, "endDateTime"); - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + ZonedDateTime end = ZonedDateTime.from(endExclusive); if (unit instanceof ChronoUnit) { - ZonedDateTime end = (ZonedDateTime) endDateTime; end = end.withZoneSameInstant(zone); if (unit.isDateBased()) { return dateTime.until(end.dateTime, unit); @@ -2113,7 +2111,7 @@ public final class ZonedDateTime return toOffsetDateTime().until(end.toOffsetDateTime(), unit); } } - return unit.between(this, endDateTime); + return unit.between(this, end); } /** diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java index 58ae3b8c1c5..58e4f5d5250 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java @@ -291,6 +291,7 @@ public interface ChronoLocalDate if (temporal instanceof ChronoLocalDate) { return (ChronoLocalDate) temporal; } + Objects.requireNonNull(temporal, "temporal"); Chronology chrono = temporal.query(TemporalQuery.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoLocalDate from TemporalAccessor: " + temporal.getClass()); @@ -560,8 +561,8 @@ public interface ChronoLocalDate * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified date. * The result will be negative if the end is before the start. - * The {@code Temporal} passed to this method must be a - * {@code ChronoLocalDate} in the same chronology. + * The {@code Temporal} passed to this method is converted to a + * {@code ChronoLocalDate} using {@link Chronology#date(TemporalAccessor)}. * The calculation returns a whole number, representing the number of * complete units between the two dates. * For example, the amount in days between two dates can be calculated @@ -585,20 +586,22 @@ public interface ChronoLocalDate *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as + * passing {@code this} as the first argument and the converted input temporal as * the second argument. *

    * This instance is immutable and unaffected by this method call. * - * @param endDate the end date, which must be a {@code ChronoLocalDate} - * in the same chronology, not null + * @param endExclusive the end date, exclusive, which is converted to a + * {@code ChronoLocalDate} in the same chronology, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this date and the end date - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to a {@code ChronoLocalDate} + * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override // override for Javadoc - long until(Temporal endDate, TemporalUnit unit); + long until(Temporal endExclusive, TemporalUnit unit); /** * Calculates the period between this date and another date as a {@code ChronoPeriod}. diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java index fd8c8f88662..6cb115d393e 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java @@ -372,22 +372,10 @@ abstract class ChronoLocalDateImpl } //----------------------------------------------------------------------- - /** - * {@inheritDoc} - * @throws DateTimeException {@inheritDoc} - * @throws ArithmeticException {@inheritDoc} - */ @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - Objects.requireNonNull(endDateTime, "endDateTime"); - Objects.requireNonNull(unit, "unit"); - if (endDateTime instanceof ChronoLocalDate == false) { - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } - ChronoLocalDate end = (ChronoLocalDate) endDateTime; - if (getChronology().equals(end.getChronology()) == false) { - throw new DateTimeException("Unable to calculate amount as objects have different chronologies"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + Objects.requireNonNull(endExclusive, "endExclusive"); + ChronoLocalDate end = getChronology().date(endExclusive); if (unit instanceof ChronoUnit) { switch ((ChronoUnit) unit) { case DAYS: return daysUntil(end); @@ -401,7 +389,8 @@ abstract class ChronoLocalDateImpl } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return unit.between(this, endDateTime); + Objects.requireNonNull(unit, "unit"); + return unit.between(this, end); } private long daysUntil(ChronoLocalDate end) { diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java index be93f0e036a..cde8a982fbc 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java @@ -165,6 +165,7 @@ public interface ChronoLocalDateTime if (temporal instanceof ChronoLocalDateTime) { return (ChronoLocalDateTime) temporal; } + Objects.requireNonNull(temporal, "temporal"); Chronology chrono = temporal.query(TemporalQuery.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass()); diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java index 13b3a0e8817..817ae85411a 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java @@ -69,7 +69,6 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.ObjectStreamException; import java.io.Serializable; -import java.time.DateTimeException; import java.time.LocalTime; import java.time.ZoneId; import java.time.temporal.ChronoField; @@ -369,15 +368,10 @@ final class ChronoLocalDateTimeImpl //----------------------------------------------------------------------- @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof ChronoLocalDateTime == false) { - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + Objects.requireNonNull(endExclusive, "endExclusive"); @SuppressWarnings("unchecked") - ChronoLocalDateTime end = (ChronoLocalDateTime) endDateTime; - if (toLocalDate().getChronology().equals(end.toLocalDate().getChronology()) == false) { - throw new DateTimeException("Unable to calculate amount as objects have different chronologies"); - } + ChronoLocalDateTime end = (ChronoLocalDateTime) toLocalDate().getChronology().localDateTime(endExclusive); if (unit instanceof ChronoUnit) { if (unit.isTimeBased()) { long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY); @@ -398,7 +392,8 @@ final class ChronoLocalDateTimeImpl } return date.until(endDate, unit); } - return unit.between(this, endDateTime); + Objects.requireNonNull(unit, "unit"); + return unit.between(this, end); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java index dd911fcd789..abe84799716 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java @@ -166,6 +166,7 @@ public interface ChronoZonedDateTime if (temporal instanceof ChronoZonedDateTime) { return (ChronoZonedDateTime) temporal; } + Objects.requireNonNull(temporal, "temporal"); Chronology chrono = temporal.query(TemporalQuery.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass()); diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java index 1cc7b5b5786..1fe8ccf0192 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java @@ -69,7 +69,6 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.ObjectStreamException; import java.io.Serializable; -import java.time.DateTimeException; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; @@ -234,7 +233,7 @@ final class ChronoZonedDateTimeImpl if (trans != null && trans.isOverlap()) { ZoneOffset earlierOffset = trans.getOffsetBefore(); if (earlierOffset.equals(offset) == false) { - return new ChronoZonedDateTimeImpl(dateTime, earlierOffset, zone); + return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone); } } return this; @@ -246,7 +245,7 @@ final class ChronoZonedDateTimeImpl if (trans != null) { ZoneOffset offset = trans.getOffsetAfter(); if (offset.equals(getOffset()) == false) { - return new ChronoZonedDateTimeImpl(dateTime, offset, zone); + return new ChronoZonedDateTimeImpl<>(dateTime, offset, zone); } } return this; @@ -308,20 +307,16 @@ final class ChronoZonedDateTimeImpl //----------------------------------------------------------------------- @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof ChronoZonedDateTime == false) { - throw new DateTimeException("Unable to calculate amount as objects are of two different types"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + Objects.requireNonNull(endExclusive, "endExclusive"); @SuppressWarnings("unchecked") - ChronoZonedDateTime end = (ChronoZonedDateTime) endDateTime; - if (toLocalDate().getChronology().equals(end.toLocalDate().getChronology()) == false) { - throw new DateTimeException("Unable to calculate amount as objects have different chronologies"); - } + ChronoZonedDateTime end = (ChronoZonedDateTime) toLocalDate().getChronology().zonedDateTime(endExclusive); if (unit instanceof ChronoUnit) { end = end.withZoneSameInstant(offset); return dateTime.until(end.toLocalDateTime(), unit); } - return unit.between(this, endDateTime); + Objects.requireNonNull(unit, "unit"); + return unit.between(this, end); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java index 19a37e46f4c..c7043272398 100644 --- a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java +++ b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java @@ -268,8 +268,8 @@ public enum ChronoUnit implements TemporalUnit { //----------------------------------------------------------------------- @Override - public long between(Temporal temporal1, Temporal temporal2) { - return temporal1.until(temporal2, this); + public long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive) { + return temporal1Inclusive.until(temporal2Exclusive, this); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/temporal/IsoFields.java b/jdk/src/share/classes/java/time/temporal/IsoFields.java index eae057afb2a..bb19c299875 100644 --- a/jdk/src/share/classes/java/time/temporal/IsoFields.java +++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java @@ -684,13 +684,16 @@ public final class IsoFields { } @Override - public long between(Temporal temporal1, Temporal temporal2) { + public long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive) { + if (temporal1Inclusive.getClass() != temporal2Exclusive.getClass()) { + return temporal1Inclusive.until(temporal2Exclusive, this); + } switch(this) { case WEEK_BASED_YEARS: - return Math.subtractExact(temporal2.getLong(WEEK_BASED_YEAR), - temporal1.getLong(WEEK_BASED_YEAR)); + return Math.subtractExact(temporal2Exclusive.getLong(WEEK_BASED_YEAR), + temporal1Inclusive.getLong(WEEK_BASED_YEAR)); case QUARTER_YEARS: - return temporal1.until(temporal2, MONTHS) / 3; + return temporal1Inclusive.until(temporal2Exclusive, MONTHS) / 3; default: throw new IllegalStateException("Unreachable"); } diff --git a/jdk/src/share/classes/java/time/temporal/Temporal.java b/jdk/src/share/classes/java/time/temporal/Temporal.java index 54110bed771..9931c46f4f1 100644 --- a/jdk/src/share/classes/java/time/temporal/Temporal.java +++ b/jdk/src/share/classes/java/time/temporal/Temporal.java @@ -374,8 +374,9 @@ public interface Temporal extends TemporalAccessor { * Calculates the amount of time until another temporal in terms of the specified unit. *

    * This calculates the amount of time between two temporal objects - * of the same type in terms of a single {@code TemporalUnit}. + * in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified temporal. + * The end point is converted to be of the same type as the start point if different. * The result will be negative if the end is before the start. * For example, the period in hours between two temporal objects can be * calculated using {@code startTime.until(endTime, HOURS)}. @@ -412,31 +413,36 @@ public interface Temporal extends TemporalAccessor { *

    * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} - * passing {@code this} as the first argument and the input temporal as + * passing {@code this} as the first argument and the converted input temporal as * the second argument. *

    - * In summary, implementations must behave in a manner equivalent to this code: + * In summary, implementations must behave in a manner equivalent to this pseudo-code: *

    -     *  // check input temporal is the same type as this class
    +     *  // convert the end temporal to the same type as this class
          *  if (unit instanceof ChronoUnit) {
          *    // if unit is supported, then calculate and return result
          *    // else throw UnsupportedTemporalTypeException for unsupported units
          *  }
    -     *  return unit.between(this, endTemporal);
    +     *  return unit.between(this, convertedEndTemporal);
          * 
    *

    + * Note that the unit's {@code between} method must only be invoked if the + * two temporal objects have exactly the same type evaluated by {@code getClass()}. + *

    * Implementations must ensure that no observable state is altered when this * read-only method is invoked. * - * @param endTemporal the end temporal, of the same type as this object, not null + * @param endExclusive the end temporal, exclusive, converted to be of the + * same type as this object, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this temporal object and the specified one * in terms of the unit; positive if the specified object is later than this one, * negative if it is earlier than this one - * @throws DateTimeException if the amount cannot be calculated + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to the same type as this temporal * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ - long until(Temporal endTemporal, TemporalUnit unit); + long until(Temporal endExclusive, TemporalUnit unit); } diff --git a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java index 05577d713f8..1c41afa0593 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java @@ -231,7 +231,9 @@ public interface TemporalUnit { * Calculates the amount of time between two temporal objects. *

    * This calculates the amount in terms of this unit. The start and end - * points are supplied as temporal objects and must be of the same type. + * points are supplied as temporal objects and must be of compatible types. + * The implementation will convert the second type to be an instance of the + * first type before the calculating the amount. * The result will be negative if the end is before the start. * For example, the amount in hours between two temporal objects can be * calculated using {@code HOURS.between(startTime, endTime)}. @@ -264,15 +266,22 @@ public interface TemporalUnit { * If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. * Implementations must not alter the specified temporal objects. * - * @param temporal1 the base temporal object, not null - * @param temporal2 the other temporal object, not null - * @return the amount of time between temporal1 and temporal2 in terms of this unit; - * positive if temporal2 is later than temporal1, negative if earlier - * @throws DateTimeException if the amount cannot be calculated + * @implSpec + * Implementations must begin by checking to if the two temporals have the + * same type using {@code getClass()}. If they do not, then the result must be + * obtained by calling {@code temporal1Inclusive.until(temporal2Exclusive, this)}. + * + * @param temporal1Inclusive the base temporal object, not null + * @param temporal2Exclusive the other temporal object, exclusive, not null + * @return the amount of time between temporal1Inclusive and temporal2Exclusive + * in terms of this unit; positive if temporal2Exclusive is later than + * temporal1Inclusive, negative if earlier + * @throws DateTimeException if the amount cannot be calculated, or the end + * temporal cannot be converted to the same type as the start temporal * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal * @throws ArithmeticException if numeric overflow occurs */ - long between(Temporal temporal1, Temporal temporal2); + long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive); //----------------------------------------------------------------------- /** diff --git a/jdk/test/java/time/tck/java/time/TCKDuration.java b/jdk/test/java/time/tck/java/time/TCKDuration.java index c3bb0c9c906..c12e914b91f 100644 --- a/jdk/test/java/time/tck/java/time/TCKDuration.java +++ b/jdk/test/java/time/tck/java/time/TCKDuration.java @@ -77,6 +77,7 @@ import java.io.DataOutputStream; import java.time.DateTimeException; import java.time.Duration; import java.time.Instant; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Period; @@ -843,10 +844,17 @@ public class TCKDuration extends AbstractTCKTest { assertEquals(Duration.between(end, start), Duration.between(start, end).negated()); } - @Test(expectedExceptions=DateTimeException.class) + @Test public void factory_between_TemporalTemporal_mixedTypes() { Instant start = Instant.ofEpochSecond(1); ZonedDateTime end = Instant.ofEpochSecond(4).atZone(ZoneOffset.UTC); + assertEquals(Duration.between(start, end), Duration.ofSeconds(3)); + } + + @Test(expectedExceptions=DateTimeException.class) + public void factory_between_TemporalTemporal_invalidMixedTypes() { + Instant start = Instant.ofEpochSecond(1); + LocalDate end = LocalDate.of(2010, 6, 20); Duration.between(start, end); } diff --git a/jdk/test/java/time/tck/java/time/TCKInstant.java b/jdk/test/java/time/tck/java/time/TCKInstant.java index bb3a765de42..bf6ac9e7026 100644 --- a/jdk/test/java/time/tck/java/time/TCKInstant.java +++ b/jdk/test/java/time/tck/java/time/TCKInstant.java @@ -84,6 +84,7 @@ import java.time.DateTimeException; import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.OffsetDateTime; import java.time.ZoneId; import java.time.ZoneOffset; @@ -1800,7 +1801,7 @@ public class TCKInstant extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) { Instant i1 = Instant.ofEpochSecond(seconds1, nanos1); Instant i2 = Instant.ofEpochSecond(seconds2, nanos2); long amount = i1.until(i2, unit); @@ -1808,25 +1809,46 @@ public class TCKInstant extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) { Instant i1 = Instant.ofEpochSecond(seconds1, nanos1); Instant i2 = Instant.ofEpochSecond(seconds2, nanos2); long amount = i2.until(i1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) { + Instant i1 = Instant.ofEpochSecond(seconds1, nanos1); + Instant i2 = Instant.ofEpochSecond(seconds2, nanos2); + long amount = unit.between(i1, i2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + Instant start = Instant.ofEpochSecond(12, 3000); + OffsetDateTime end = start.plusSeconds(2).atOffset(ZoneOffset.ofHours(2)); + assertEquals(start.until(end, SECONDS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + Instant start = Instant.ofEpochSecond(12, 3000); + start.until(LocalTime.of(11, 30), SECONDS); + } + @Test(expectedExceptions = UnsupportedTemporalTypeException.class) - public void test_periodUntil_TemporalUnit_unsupportedUnit() { + public void test_until_TemporalUnit_unsupportedUnit() { TEST_12345_123456789.until(TEST_12345_123456789, MONTHS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_12345_123456789.until(null, HOURS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_12345_123456789.until(TEST_12345_123456789, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKLocalDate.java b/jdk/test/java/time/tck/java/time/TCKLocalDate.java index 3d4cbbbc884..cb41a707945 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalDate.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalDate.java @@ -1723,29 +1723,48 @@ public class TCKLocalDate extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) { long amount = date1.until(date2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) { long amount = date2.until(date1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) { + long amount = unit.between(date1, date2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + LocalDate start = LocalDate.of(2010, 6, 30); + OffsetDateTime end = start.plusDays(2).atStartOfDay().atOffset(OFFSET_PONE); + assertEquals(start.until(end, DAYS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + LocalDate start = LocalDate.of(2010, 6, 30); + start.until(LocalTime.of(11, 30), DAYS); + } + @Test(expectedExceptions = UnsupportedTemporalTypeException.class) - public void test_periodUntil_TemporalUnit_unsupportedUnit() { + public void test_until_TemporalUnit_unsupportedUnit() { TEST_2007_07_15.until(TEST_2007_07_15, HOURS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_2007_07_15.until(null, DAYS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_2007_07_15.until(TEST_2007_07_15, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java index 040704cd9bc..62b53b3b8a3 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java @@ -2895,24 +2895,43 @@ public class TCKLocalDateTime extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) { long amount = dt1.until(dt2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) { long amount = dt2.until(dt1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) { + long amount = unit.between(dt1, dt2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + LocalDateTime start = LocalDateTime.of(2010, 6, 30, 2, 30); + OffsetDateTime end = start.plusDays(2).atOffset(OFFSET_PONE); + assertEquals(start.until(end, DAYS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + LocalDateTime start = LocalDateTime.of(2010, 6, 30, 2, 30); + start.until(LocalTime.of(11, 30), DAYS); + } + @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_2007_07_15_12_30_40_987654321.until(null, HOURS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_2007_07_15_12_30_40_987654321.until(TEST_2007_07_15_12_30_40_987654321, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKLocalTime.java b/jdk/test/java/time/tck/java/time/TCKLocalTime.java index 2291b5ca16b..bac3f8587d1 100644 --- a/jdk/test/java/time/tck/java/time/TCKLocalTime.java +++ b/jdk/test/java/time/tck/java/time/TCKLocalTime.java @@ -1971,29 +1971,48 @@ public class TCKLocalTime extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) { long amount = time1.until(time2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) { long amount = time2.until(time1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) { + long amount = unit.between(time1, time2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + LocalTime start = LocalTime.of(11, 30); + LocalDateTime end = start.plusSeconds(2).atDate(LocalDate.of(2010, 6, 30)); + assertEquals(start.until(end, SECONDS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + LocalTime start = LocalTime.of(11, 30); + start.until(LocalDate.of(2010, 6, 30), SECONDS); + } + @Test(expectedExceptions = UnsupportedTemporalTypeException.class) - public void test_periodUntil_TemporalUnit_unsupportedUnit() { + public void test_until_TemporalUnit_unsupportedUnit() { TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, DAYS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_12_30_40_987654321.until(null, HOURS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java index 0cf024fdde1..0ced814d06b 100644 --- a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java @@ -91,6 +91,13 @@ import static java.time.temporal.ChronoField.SECOND_OF_MINUTE; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.FOREVER; +import static java.time.temporal.ChronoUnit.HALF_DAYS; +import static java.time.temporal.ChronoUnit.HOURS; +import static java.time.temporal.ChronoUnit.MICROS; +import static java.time.temporal.ChronoUnit.MILLIS; +import static java.time.temporal.ChronoUnit.MINUTES; +import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.NANOS; import static java.time.temporal.ChronoUnit.SECONDS; import static org.testng.Assert.assertEquals; @@ -1128,6 +1135,74 @@ public class TCKOffsetDateTime extends AbstractDateTimeTest { assertEquals(test, OffsetDateTime.of(2008, 6, 30, 11, 30, 58, 999999999, OFFSET_PONE)); } + //----------------------------------------------------------------------- + // until(Temporal, TemporalUnit) + //----------------------------------------------------------------------- + @DataProvider(name="periodUntilUnit") + Object[][] data_untilUnit() { + return new Object[][] { + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 13, 1, 1, 0, OFFSET_PONE), HALF_DAYS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), HOURS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MINUTES, 60}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), SECONDS, 3600}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MILLIS, 3600*1000}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MICROS, 3600*1000*1000L}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), NANOS, 3600*1000*1000L*1000}, + + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 14, 1, 1, 0, OFFSET_PTWO), HALF_DAYS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), HOURS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MINUTES, 60}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), SECONDS, 3600}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MILLIS, 3600*1000}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MICROS, 3600*1000*1000L}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), NANOS, 3600*1000*1000L*1000}, + + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 7, 1, 1, 1, 0, 999999999, OFFSET_PONE), DAYS, 0}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 7, 1, 1, 1, 1, 0, OFFSET_PONE), DAYS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 29, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 1}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 30, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 2}, + {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 31, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 2}, + }; + } + + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) { + long amount = odt1.until(odt2, unit); + assertEquals(amount, expected); + } + + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_negated(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) { + long amount = odt2.until(odt1, unit); + assertEquals(amount, -expected); + } + + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) { + long amount = unit.between(odt1, odt2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + OffsetDateTime odt = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE); + ZonedDateTime zdt = odt.plusSeconds(3).toZonedDateTime(); + assertEquals(odt.until(zdt, SECONDS), 3); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + OffsetDateTime odt = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE); + odt.until(Instant.ofEpochSecond(12), SECONDS); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidTemporalUnit() { + OffsetDateTime odt1 = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE); + OffsetDateTime odt2 = OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE); + odt1.until(odt2, FOREVER); + } + //----------------------------------------------------------------------- // format(DateTimeFormatter) //----------------------------------------------------------------------- diff --git a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java index ee5b2d3f69f..5bc2312ea0f 100644 --- a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java +++ b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java @@ -1069,49 +1069,61 @@ public class TCKOffsetTime extends AbstractDateTimeTest { // until(Temporal, TemporalUnit) //----------------------------------------------------------------------- @DataProvider(name="periodUntilUnit") - Object[][] data_periodUntilUnit() { + Object[][] data_untilUnit() { return new Object[][] { - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(13, 1, 1), ZoneOffset.ofHours(1)), HALF_DAYS, 1}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), HOURS, 1}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MINUTES, 60}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), SECONDS, 3600}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MILLIS, 3600*1000}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MICROS, 3600*1000*1000L}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), NANOS, 3600*1000*1000L*1000}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(13, 1, 1, 0, OFFSET_PONE), HALF_DAYS, 1}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), HOURS, 1}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MINUTES, 60}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), SECONDS, 3600}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MILLIS, 3600*1000}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MICROS, 3600*1000*1000L}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), NANOS, 3600*1000*1000L*1000}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(14, 1, 1), ZoneOffset.ofHours(2)), HALF_DAYS, 1}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), HOURS, 1}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MINUTES, 60}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), SECONDS, 3600}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MILLIS, 3600*1000}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MICROS, 3600*1000*1000L}, - {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), NANOS, 3600*1000*1000L*1000}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(14, 1, 1, 0, OFFSET_PTWO), HALF_DAYS, 1}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), HOURS, 1}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MINUTES, 60}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), SECONDS, 3600}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MILLIS, 3600*1000}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MICROS, 3600*1000*1000L}, + {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), NANOS, 3600*1000*1000L*1000}, }; } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) { long amount = offsetTime1.until(offsetTime2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) { long amount = offsetTime2.until(offsetTime1, unit); assertEquals(amount, -expected); } - @Test(expectedExceptions=DateTimeException.class) - public void test_periodUntil_InvalidType() { - OffsetTime offsetTime = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)); - OffsetDateTime offsetDateTime = offsetTime.atDate(LocalDate.of(1980, 2, 10)); - offsetTime.until(offsetDateTime, SECONDS); + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) { + long amount = unit.between(offsetTime1, offsetTime2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + OffsetTime offsetTime = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE); + OffsetDateTime offsetDateTime = offsetTime.plusSeconds(3).atDate(LocalDate.of(1980, 2, 10)); + assertEquals(offsetTime.until(offsetDateTime, SECONDS), 3); } @Test(expectedExceptions=DateTimeException.class) - public void test_periodUntil_InvalidTemporalUnit() { - OffsetTime offsetTime1 = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)); - OffsetTime offsetTime2 = OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)); + public void test_until_invalidType() { + OffsetTime offsetTime = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE); + offsetTime.until(LocalDate.of(1980, 2, 10), SECONDS); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidTemporalUnit() { + OffsetTime offsetTime1 = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE); + OffsetTime offsetTime2 = OffsetTime.of(2, 1, 1, 0, OFFSET_PONE); offsetTime1.until(offsetTime2, MONTHS); } diff --git a/jdk/test/java/time/tck/java/time/TCKYear.java b/jdk/test/java/time/tck/java/time/TCKYear.java index c0a35967a7b..59d464a5373 100644 --- a/jdk/test/java/time/tck/java/time/TCKYear.java +++ b/jdk/test/java/time/tck/java/time/TCKYear.java @@ -65,10 +65,8 @@ import static java.time.temporal.ChronoField.YEAR_OF_ERA; import static java.time.temporal.ChronoUnit.CENTURIES; import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.DECADES; -import static java.time.temporal.ChronoUnit.HOURS; import static java.time.temporal.ChronoUnit.MILLENNIA; import static java.time.temporal.ChronoUnit.MONTHS; -import static java.time.temporal.ChronoUnit.WEEKS; import static java.time.temporal.ChronoUnit.YEARS; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -90,8 +88,8 @@ import java.time.Year; import java.time.YearMonth; import java.time.ZoneId; import java.time.ZoneOffset; -import java.time.chrono.IsoEra; import java.time.chrono.IsoChronology; +import java.time.chrono.IsoEra; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoField; @@ -229,17 +227,17 @@ public class TCKYear extends AbstractDateTimeTest { //----------------------------------------------------------------------- @Test - public void test_factory_CalendricalObject() { + public void test_from_TemporalAccessor() { assertEquals(Year.from(LocalDate.of(2007, 7, 15)), Year.of(2007)); } @Test(expectedExceptions=DateTimeException.class) - public void test_factory_CalendricalObject_invalid_noDerive() { + public void test_from_TemporalAccessor_invalid_noDerive() { Year.from(LocalTime.of(12, 30)); } @Test(expectedExceptions=NullPointerException.class) - public void test_factory_CalendricalObject_null() { + public void test_from_TemporalAccessor_null() { Year.from((TemporalAccessor) null); } @@ -597,13 +595,13 @@ public class TCKYear extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="plus_long_TemporalUnit") + @Test(dataProvider="plus_long_TemporalUnit") public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) { if (expectedEx == null) { assertEquals(base.plus(amount, unit), expectedYear); } else { try { - Year result = base.plus(amount, unit); + base.plus(amount, unit); fail(); } catch (Exception ex) { assertTrue(expectedEx.isInstance(ex)); @@ -729,7 +727,7 @@ public class TCKYear extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="minus_long_TemporalUnit") + @Test(dataProvider="minus_long_TemporalUnit") public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) { if (expectedEx == null) { assertEquals(base.minus(amount, unit), expectedYear); @@ -788,7 +786,7 @@ public class TCKYear extends AbstractDateTimeTest { //----------------------------------------------------------------------- // with(TemporalField, long) //----------------------------------------------------------------------- - @Test(groups={"tck"}) + @Test public void test_with() { Year base = Year.of(5); Year result = base.with(ChronoField.ERA, 0); @@ -923,29 +921,48 @@ public class TCKYear extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(Year year1, Year year2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(Year year1, Year year2, TemporalUnit unit, long expected) { long amount = year1.until(year2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(Year year1, Year year2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(Year year1, Year year2, TemporalUnit unit, long expected) { long amount = year2.until(year1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(Year year1, Year year2, TemporalUnit unit, long expected) { + long amount = unit.between(year1, year2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + Year start = Year.of(2010); + YearMonth end = start.plusYears(2).atMonth(Month.APRIL); + assertEquals(start.until(end, YEARS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + Year start = Year.of(2010); + start.until(LocalTime.of(11, 30), YEARS); + } + @Test(expectedExceptions = UnsupportedTemporalTypeException.class) - public void test_periodUntil_TemporalUnit_unsupportedUnit() { + public void test_until_TemporalUnit_unsupportedUnit() { TEST_2008.until(TEST_2008, MONTHS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_2008.until(null, DAYS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_2008.until(TEST_2008, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKYearMonth.java b/jdk/test/java/time/tck/java/time/TCKYearMonth.java index e1f1a466574..bb16839bda1 100644 --- a/jdk/test/java/time/tck/java/time/TCKYearMonth.java +++ b/jdk/test/java/time/tck/java/time/TCKYearMonth.java @@ -70,7 +70,6 @@ import static java.time.temporal.ChronoUnit.DECADES; import static java.time.temporal.ChronoUnit.HOURS; import static java.time.temporal.ChronoUnit.MILLENNIA; import static java.time.temporal.ChronoUnit.MONTHS; -import static java.time.temporal.ChronoUnit.WEEKS; import static java.time.temporal.ChronoUnit.YEARS; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -270,17 +269,17 @@ public class TCKYearMonth extends AbstractDateTimeTest { //----------------------------------------------------------------------- @Test - public void test_factory_CalendricalObject() { + public void test_from_TemporalAccessor() { assertEquals(YearMonth.from(LocalDate.of(2007, 7, 15)), YearMonth.of(2007, 7)); } @Test(expectedExceptions=DateTimeException.class) - public void test_factory_CalendricalObject_invalid_noDerive() { + public void test_from_TemporalAccessor_invalid_noDerive() { YearMonth.from(LocalTime.of(12, 30)); } @Test(expectedExceptions=NullPointerException.class) - public void test_factory_CalendricalObject_null() { + public void test_from_TemporalAccessor_null() { YearMonth.from((TemporalAccessor) null); } @@ -768,7 +767,7 @@ public class TCKYearMonth extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="plus_long_TemporalUnit") + @Test(dataProvider="plus_long_TemporalUnit") public void test_plus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) { if (expectedEx == null) { assertEquals(base.plus(amount, unit), expectedYearMonth); @@ -820,7 +819,7 @@ public class TCKYearMonth extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="plus_TemporalAmount") + @Test(dataProvider="plus_TemporalAmount") public void test_plus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) { if (expectedEx == null) { assertEquals(base.plus(temporalAmount), expectedYearMonth); @@ -983,7 +982,7 @@ public class TCKYearMonth extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="minus_long_TemporalUnit") + @Test(dataProvider="minus_long_TemporalUnit") public void test_minus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) { if (expectedEx == null) { assertEquals(base.minus(amount, unit), expectedYearMonth); @@ -1035,7 +1034,7 @@ public class TCKYearMonth extends AbstractDateTimeTest { }; } - @Test(groups={"tck"}, dataProvider="minus_TemporalAmount") + @Test(dataProvider="minus_TemporalAmount") public void test_minus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) { if (expectedEx == null) { assertEquals(base.minus(temporalAmount), expectedYearMonth); @@ -1243,29 +1242,48 @@ public class TCKYearMonth extends AbstractDateTimeTest { } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) { long amount = ym1.until(ym2, unit); assertEquals(amount, expected); } @Test(dataProvider="periodUntilUnit") - public void test_periodUntil_TemporalUnit_negated(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) { + public void test_until_TemporalUnit_negated(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) { long amount = ym2.until(ym1, unit); assertEquals(amount, -expected); } + @Test(dataProvider="periodUntilUnit") + public void test_until_TemporalUnit_between(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) { + long amount = unit.between(ym1, ym2); + assertEquals(amount, expected); + } + + @Test + public void test_until_convertedType() { + YearMonth start = YearMonth.of(2010, 6); + LocalDate end = start.plusMonths(2).atDay(12); + assertEquals(start.until(end, MONTHS), 2); + } + + @Test(expectedExceptions=DateTimeException.class) + public void test_until_invalidType() { + YearMonth start = YearMonth.of(2010, 6); + start.until(LocalTime.of(11, 30), MONTHS); + } + @Test(expectedExceptions = UnsupportedTemporalTypeException.class) - public void test_periodUntil_TemporalUnit_unsupportedUnit() { + public void test_until_TemporalUnit_unsupportedUnit() { TEST_2008_06.until(TEST_2008_06, HOURS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullEnd() { + public void test_until_TemporalUnit_nullEnd() { TEST_2008_06.until(null, DAYS); } @Test(expectedExceptions = NullPointerException.class) - public void test_periodUntil_TemporalUnit_nullUnit() { + public void test_until_TemporalUnit_nullUnit() { TEST_2008_06.until(TEST_2008_06, null); } diff --git a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java index 1f5bee32283..4c5319d483a 100644 --- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java +++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java @@ -2001,7 +2001,7 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { // compare results to OffsetDateTime.until, especially wrt dates @Test(dataProvider="plusDays") - public void test_periodUntil_days(ZonedDateTime base, long expected, ZonedDateTime end) { + public void test_until_days(ZonedDateTime base, long expected, ZonedDateTime end) { if (base.toLocalTime().equals(end.toLocalTime()) == false) { return; // avoid DST gap input values } @@ -2009,27 +2009,27 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { } @Test(dataProvider="plusTime") - public void test_periodUntil_hours(ZonedDateTime base, long expected, ZonedDateTime end) { + public void test_until_hours(ZonedDateTime base, long expected, ZonedDateTime end) { assertEquals(base.until(end, HOURS), expected); } @Test(dataProvider="plusTime") - public void test_periodUntil_minutes(ZonedDateTime base, long expected, ZonedDateTime end) { + public void test_until_minutes(ZonedDateTime base, long expected, ZonedDateTime end) { assertEquals(base.until(end, MINUTES), expected * 60); } @Test(dataProvider="plusTime") - public void test_periodUntil_seconds(ZonedDateTime base, long expected, ZonedDateTime end) { + public void test_until_seconds(ZonedDateTime base, long expected, ZonedDateTime end) { assertEquals(base.until(end, SECONDS), expected * 3600); } @Test(dataProvider="plusTime") - public void test_periodUntil_nanos(ZonedDateTime base, long expected, ZonedDateTime end) { + public void test_until_nanos(ZonedDateTime base, long expected, ZonedDateTime end) { assertEquals(base.until(end, NANOS), expected * 3600_000_000_000L); } @Test - public void test_periodUntil_parisLondon() { + public void test_until_parisLondon() { ZonedDateTime midnightLondon = LocalDate.of(2012, 6, 28).atStartOfDay(ZONE_LONDON); ZonedDateTime midnightParis1 = LocalDate.of(2012, 6, 29).atStartOfDay(ZONE_PARIS); ZonedDateTime oneAm1 = LocalDateTime.of(2012, 6, 29, 1, 0).atZone(ZONE_PARIS); @@ -2045,7 +2045,7 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { } @Test - public void test_periodUntil_gap() { + public void test_until_gap() { ZonedDateTime before = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS); ZonedDateTime after = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS); @@ -2054,7 +2054,7 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { } @Test - public void test_periodUntil_overlap() { + public void test_until_overlap() { ZonedDateTime before = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS); ZonedDateTime after = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS); @@ -2063,17 +2063,17 @@ public class TCKZonedDateTime extends AbstractDateTimeTest { } @Test(expectedExceptions=DateTimeException.class) - public void test_periodUntil_differentType() { + public void test_until_differentType() { TEST_DATE_TIME_PARIS.until(TEST_LOCAL_2008_06_30_11_30_59_500, DAYS); } @Test(expectedExceptions=NullPointerException.class) - public void test_periodUntil_nullTemporal() { + public void test_until_nullTemporal() { TEST_DATE_TIME_PARIS.until(null, DAYS); } @Test(expectedExceptions=NullPointerException.class) - public void test_periodUntil_nullUnit() { + public void test_until_nullUnit() { TEST_DATE_TIME_PARIS.until(TEST_DATE_TIME_PARIS, null); } diff --git a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java index 6377c1fc421..c0da6975623 100644 --- a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java +++ b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java @@ -297,18 +297,12 @@ public final class CopticDate } @Override - public long until(Temporal endDateTime, TemporalUnit unit) { - if (endDateTime instanceof ChronoLocalDate == false) { - throw new DateTimeException("Unable to calculate period between objects of two different types"); - } - ChronoLocalDate end = (ChronoLocalDate) endDateTime; - if (getChronology().equals(end.getChronology()) == false) { - throw new DateTimeException("Unable to calculate period between two different chronologies"); - } + public long until(Temporal endExclusive, TemporalUnit unit) { + CopticDate end = getChronology().date(endExclusive); if (unit instanceof ChronoUnit) { return LocalDate.from(this).until(end, unit); // TODO: this is wrong } - return unit.between(this, endDateTime); + return unit.between(this, end); } @Override diff --git a/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java b/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java index 7159b312866..d607571aba1 100644 --- a/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java +++ b/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java @@ -70,11 +70,13 @@ import static org.testng.Assert.fail; import java.time.DayOfWeek; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeParseException; import java.time.format.ResolverStyle; import java.time.temporal.IsoFields; +import java.time.temporal.Temporal; import java.time.temporal.ValueRange; import org.testng.annotations.DataProvider; @@ -276,14 +278,21 @@ public class TCKIsoFields { {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 12, 31), -4}, {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 10, 2), -4}, {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 10, 1), -5}, + + {LocalDate.of(2000, 1, 1), LocalDateTime.of(2001, 4, 5, 0, 0), 5}, }; } @Test(dataProvider="quartersBetween") - public void test_quarters_between(LocalDate start, LocalDate end, long expected) { + public void test_quarters_between(LocalDate start, Temporal end, long expected) { assertEquals(IsoFields.QUARTER_YEARS.between(start, end), expected); } + @Test(dataProvider="quartersBetween") + public void test_quarters_between_until(LocalDate start, Temporal end, long expected) { + assertEquals(start.until(end, IsoFields.QUARTER_YEARS), expected); + } + //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- From d18aae693d00009b2e91a3a852210c7fd4ff09b8 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Fri, 4 Oct 2013 12:01:29 -0400 Subject: [PATCH 143/983] 8024999: Instant.Parse typo in example Javadoc only fix to correct example to use "." and "Z" Reviewed-by: sherman --- jdk/src/share/classes/java/time/Instant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/time/Instant.java b/jdk/src/share/classes/java/time/Instant.java index a7bd6f92004..0e22c7bf972 100644 --- a/jdk/src/share/classes/java/time/Instant.java +++ b/jdk/src/share/classes/java/time/Instant.java @@ -374,7 +374,7 @@ public final class Instant //----------------------------------------------------------------------- /** * Obtains an instance of {@code Instant} from a text string such as - * {@code 2007-12-03T10:15:30:00}. + * {@code 2007-12-03T10:15:30.00Z}. *

    * The string must represent a valid instant in UTC and is parsed using * {@link DateTimeFormatter#ISO_INSTANT}. From 2040c66b16231be86df4e288dcd1b79ae8790df2 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Sat, 14 Sep 2013 22:50:40 +0100 Subject: [PATCH 144/983] 8024807: Add getChronlogy() to CLDT/CZDT Alternative to method is clunky and hard to find Reviewed-by: sherman --- .../java/time/chrono/ChronoLocalDateTime.java | 24 ++++++++++++++----- .../time/chrono/ChronoLocalDateTimeImpl.java | 6 ++--- .../java/time/chrono/ChronoZonedDateTime.java | 24 ++++++++++++++----- .../time/chrono/ChronoZonedDateTimeImpl.java | 12 +++++----- .../time/chrono/TCKChronoLocalDateTime.java | 7 ++++++ .../time/chrono/TCKChronoZonedDateTime.java | 7 ++++++ 6 files changed, 59 insertions(+), 21 deletions(-) diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java index cde8a982fbc..4c2ddfd31a7 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java @@ -174,6 +174,18 @@ public interface ChronoLocalDateTime } //----------------------------------------------------------------------- + /** + * Gets the chronology of this date-time. + *

    + * The {@code Chronology} represents the calendar system in use. + * The era and other fields in {@link ChronoField} are defined by the chronology. + * + * @return the chronology, not null + */ + default Chronology getChronology() { + return toLocalDate().getChronology(); + } + /** * Gets the local date part of this date-time. *

    @@ -251,7 +263,7 @@ public interface ChronoLocalDateTime */ @Override default ChronoLocalDateTime with(TemporalAdjuster adjuster) { - return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster)); + return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.with(adjuster)); } /** @@ -269,7 +281,7 @@ public interface ChronoLocalDateTime */ @Override default ChronoLocalDateTime plus(TemporalAmount amount) { - return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount)); + return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); } /** @@ -287,7 +299,7 @@ public interface ChronoLocalDateTime */ @Override default ChronoLocalDateTime minus(TemporalAmount amount) { - return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount)); + return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); } /** @@ -297,7 +309,7 @@ public interface ChronoLocalDateTime */ @Override default ChronoLocalDateTime minus(long amountToSubtract, TemporalUnit unit) { - return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit)); + return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- @@ -327,7 +339,7 @@ public interface ChronoLocalDateTime } else if (query == TemporalQuery.localTime()) { return (R) toLocalTime(); } else if (query == TemporalQuery.chronology()) { - return (R) toLocalDate().getChronology(); + return (R) getChronology(); } else if (query == TemporalQuery.precision()) { return (R) NANOS; } @@ -489,7 +501,7 @@ public interface ChronoLocalDateTime if (cmp == 0) { cmp = toLocalTime().compareTo(other.toLocalTime()); if (cmp == 0) { - cmp = toLocalDate().getChronology().compareTo(other.toLocalDate().getChronology()); + cmp = getChronology().compareTo(other.getChronology()); } } return cmp; diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java index 817ae85411a..e33e82ebab2 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java @@ -186,9 +186,9 @@ final class ChronoLocalDateTimeImpl static ChronoLocalDateTimeImpl ensureValid(Chronology chrono, Temporal temporal) { @SuppressWarnings("unchecked") ChronoLocalDateTimeImpl other = (ChronoLocalDateTimeImpl) temporal; - if (chrono.equals(other.toLocalDate().getChronology()) == false) { + if (chrono.equals(other.getChronology()) == false) { throw new ClassCastException("Chronology mismatch, required: " + chrono.getId() - + ", actual: " + other.toLocalDate().getChronology().getId()); + + ", actual: " + other.getChronology().getId()); } return other; } @@ -371,7 +371,7 @@ final class ChronoLocalDateTimeImpl public long until(Temporal endExclusive, TemporalUnit unit) { Objects.requireNonNull(endExclusive, "endExclusive"); @SuppressWarnings("unchecked") - ChronoLocalDateTime end = (ChronoLocalDateTime) toLocalDate().getChronology().localDateTime(endExclusive); + ChronoLocalDateTime end = (ChronoLocalDateTime) getChronology().localDateTime(endExclusive); if (unit instanceof ChronoUnit) { if (unit.isTimeBased()) { long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY); diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java index abe84799716..033ab997fdd 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java @@ -246,6 +246,18 @@ public interface ChronoZonedDateTime */ ChronoLocalDateTime toLocalDateTime(); + /** + * Gets the chronology of this date-time. + *

    + * The {@code Chronology} represents the calendar system in use. + * The era and other fields in {@link ChronoField} are defined by the chronology. + * + * @return the chronology, not null + */ + default Chronology getChronology() { + return toLocalDate().getChronology(); + } + /** * Gets the zone offset, such as '+01:00'. *

    @@ -398,7 +410,7 @@ public interface ChronoZonedDateTime */ @Override default ChronoZonedDateTime with(TemporalAdjuster adjuster) { - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster)); + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.with(adjuster)); } /** @@ -416,7 +428,7 @@ public interface ChronoZonedDateTime */ @Override default ChronoZonedDateTime plus(TemporalAmount amount) { - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount)); + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); } /** @@ -434,7 +446,7 @@ public interface ChronoZonedDateTime */ @Override default ChronoZonedDateTime minus(TemporalAmount amount) { - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount)); + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); } /** @@ -444,7 +456,7 @@ public interface ChronoZonedDateTime */ @Override default ChronoZonedDateTime minus(long amountToSubtract, TemporalUnit unit) { - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit)); + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- @@ -476,7 +488,7 @@ public interface ChronoZonedDateTime } else if (query == TemporalQuery.localTime()) { return (R) toLocalTime(); } else if (query == TemporalQuery.chronology()) { - return (R) toLocalDate().getChronology(); + return (R) getChronology(); } else if (query == TemporalQuery.precision()) { return (R) NANOS; } @@ -563,7 +575,7 @@ public interface ChronoZonedDateTime if (cmp == 0) { cmp = getZone().getId().compareTo(other.getZone().getId()); if (cmp == 0) { - cmp = toLocalDate().getChronology().compareTo(other.toLocalDate().getChronology()); + cmp = getChronology().compareTo(other.getChronology()); } } } diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java index 1fe8ccf0192..5222db367f2 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java @@ -185,7 +185,7 @@ final class ChronoZonedDateTimeImpl */ @SuppressWarnings("unchecked") private ChronoZonedDateTimeImpl create(Instant instant, ZoneId zone) { - return (ChronoZonedDateTimeImpl)ofInstant(toLocalDate().getChronology(), instant, zone); + return (ChronoZonedDateTimeImpl)ofInstant(getChronology(), instant, zone); } /** @@ -200,9 +200,9 @@ final class ChronoZonedDateTimeImpl static ChronoZonedDateTimeImpl ensureValid(Chronology chrono, Temporal temporal) { @SuppressWarnings("unchecked") ChronoZonedDateTimeImpl other = (ChronoZonedDateTimeImpl) temporal; - if (chrono.equals(other.toLocalDate().getChronology()) == false) { + if (chrono.equals(other.getChronology()) == false) { throw new ClassCastException("Chronology mismatch, required: " + chrono.getId() - + ", actual: " + other.toLocalDate().getChronology().getId()); + + ", actual: " + other.getChronology().getId()); } return other; } @@ -293,7 +293,7 @@ final class ChronoZonedDateTimeImpl } return ofBest(dateTime.with(field, newValue), zone, offset); } - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), field.adjustInto(this, newValue)); + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), field.adjustInto(this, newValue)); } //----------------------------------------------------------------------- @@ -302,7 +302,7 @@ final class ChronoZonedDateTimeImpl if (unit instanceof ChronoUnit) { return with(dateTime.plus(amountToAdd, unit)); } - return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), unit.addTo(this, amountToAdd)); /// TODO: Generics replacement Risk! + return ChronoZonedDateTimeImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); /// TODO: Generics replacement Risk! } //----------------------------------------------------------------------- @@ -310,7 +310,7 @@ final class ChronoZonedDateTimeImpl public long until(Temporal endExclusive, TemporalUnit unit) { Objects.requireNonNull(endExclusive, "endExclusive"); @SuppressWarnings("unchecked") - ChronoZonedDateTime end = (ChronoZonedDateTime) toLocalDate().getChronology().zonedDateTime(endExclusive); + ChronoZonedDateTime end = (ChronoZonedDateTime) getChronology().zonedDateTime(endExclusive); if (unit instanceof ChronoUnit) { end = end.withZoneSameInstant(offset); return dateTime.until(end.toLocalDateTime(), unit); diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java index 7ca03e2e3fb..51b68bb7c1f 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java @@ -343,6 +343,13 @@ public class TCKChronoLocalDateTime { ChronoLocalDateTime.from(null); } + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_getChronology(Chronology chrono) { + ChronoLocalDateTime test = chrono.localDateTime(LocalDateTime.of(2010, 6, 30, 11, 30)); + assertEquals(test.getChronology(), chrono); + } + //----------------------------------------------------------------------- /** * FixedAdjusted returns a fixed Temporal in all adjustments. diff --git a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java index b2b7fc2cc6c..0cabccab036 100644 --- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java +++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java @@ -344,6 +344,13 @@ public class TCKChronoZonedDateTime { ChronoZonedDateTime.from(null); } + //----------------------------------------------------------------------- + @Test(dataProvider="calendars") + public void test_getChronology(Chronology chrono) { + ChronoZonedDateTime test = chrono.zonedDateTime(ZonedDateTime.of(2010, 6, 30, 11, 30, 0, 0, ZoneOffset.UTC)); + assertEquals(test.getChronology(), chrono); + } + //----------------------------------------------------------------------- /** * FixedAdjusted returns a fixed Temporal in all adjustments. From ea9e3930af2c8ff70178064b53b9455424ffe55b Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Sat, 14 Sep 2013 22:54:38 +0100 Subject: [PATCH 145/983] 8024834: Better return type for TemporalField resolve Allow resolve method to return more than just ChronoLocalDate Reviewed-by: sherman --- .../classes/java/time/format/Parsed.java | 40 +++- .../java/time/temporal/TemporalField.java | 11 +- .../time/format/TCKDateTimeParseResolver.java | 219 ++++++++++++++++++ 3 files changed, 260 insertions(+), 10 deletions(-) diff --git a/jdk/src/share/classes/java/time/format/Parsed.java b/jdk/src/share/classes/java/time/format/Parsed.java index 42223d6c1d9..7413467826d 100644 --- a/jdk/src/share/classes/java/time/format/Parsed.java +++ b/jdk/src/share/classes/java/time/format/Parsed.java @@ -83,6 +83,8 @@ import java.time.LocalTime; import java.time.Period; import java.time.ZoneId; import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoLocalDateTime; +import java.time.chrono.ChronoZonedDateTime; import java.time.chrono.Chronology; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; @@ -260,11 +262,34 @@ final class Parsed implements TemporalAccessor { while (changedCount < 50) { for (Map.Entry entry : fieldValues.entrySet()) { TemporalField targetField = entry.getKey(); - ChronoLocalDate resolvedDate = targetField.resolve(fieldValues, chrono, zone, resolverStyle); - if (resolvedDate != null) { - updateCheckConflict(resolvedDate); - changedCount++; - continue outer; // have to restart to avoid concurrent modification + TemporalAccessor resolvedObject = targetField.resolve(fieldValues, chrono, zone, resolverStyle); + if (resolvedObject != null) { + if (resolvedObject instanceof ChronoZonedDateTime) { + ChronoZonedDateTime czdt = (ChronoZonedDateTime) resolvedObject; + if (zone.equals(czdt.getZone()) == false) { + throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + zone); + } + resolvedObject = czdt.toLocalDateTime(); + } + if (resolvedObject instanceof ChronoLocalDateTime) { + ChronoLocalDateTime cldt = (ChronoLocalDateTime) resolvedObject; + updateCheckConflict(cldt.toLocalTime(), Period.ZERO); + updateCheckConflict(cldt.toLocalDate()); + changedCount++; + continue outer; // have to restart to avoid concurrent modification + } + if (resolvedObject instanceof ChronoLocalDate) { + updateCheckConflict((ChronoLocalDate) resolvedObject); + changedCount++; + continue outer; // have to restart to avoid concurrent modification + } + if (resolvedObject instanceof LocalTime) { + updateCheckConflict((LocalTime) resolvedObject, Period.ZERO); + changedCount++; + continue outer; // have to restart to avoid concurrent modification + } + throw new DateTimeException("Method resolveFields() can only return ChronoZonedDateTime," + + "ChronoLocalDateTime, ChronoLocalDate or LocalTime"); } else if (fieldValues.containsKey(targetField) == false) { changedCount++; continue outer; // have to restart to avoid concurrent modification @@ -302,7 +327,10 @@ final class Parsed implements TemporalAccessor { if (cld != null && date.equals(cld) == false) { throw new DateTimeException("Conflict found: Fields resolved to two different dates: " + date + " " + cld); } - } else { + } else if (cld != null) { + if (chrono.equals(cld.getChronology()) == false) { + throw new DateTimeException("ChronoLocalDate must use the effective parsed chronology: " + chrono); + } date = cld; } } diff --git a/jdk/src/share/classes/java/time/temporal/TemporalField.java b/jdk/src/share/classes/java/time/temporal/TemporalField.java index e4d6b407783..e757734510c 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalField.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java @@ -63,7 +63,6 @@ package java.time.temporal; import java.time.DateTimeException; import java.time.ZoneId; -import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; import java.time.format.ResolverStyle; import java.util.Locale; @@ -350,6 +349,10 @@ public interface TemporalField { * be acceptable for the date fields to be resolved into other {@code ChronoField} * instances that can produce a date, such as {@code EPOCH_DAY}. *

    + * Not all {@code TemporalAccessor} implementations are accepted as return values. + * Implementations must accept {@code ChronoLocalDate}, {@code ChronoLocalDateTime}, + * {@code ChronoZonedDateTime} and {@code LocalTime}. + *

    * The zone is not normally required for resolution, but is provided for completeness. *

    * The default implementation must return null. @@ -358,13 +361,13 @@ public interface TemporalField { * @param chronology the effective chronology, not null * @param zone the effective zone, not null * @param resolverStyle the requested type of resolve, not null - * @return the resolved date; null if resolving only changed the map, - * or no resolve occurred + * @return the resolved temporal object; null if resolving only + * changed the map, or no resolve occurred * @throws ArithmeticException if numeric overflow occurs * @throws DateTimeException if resolving results in an error. This must not be thrown * by querying a field on the temporal without first checking if it is supported */ - default ChronoLocalDate resolve( + default TemporalAccessor resolve( Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { return null; diff --git a/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java b/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java index 9b249f19224..4ef01317b2e 100644 --- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java +++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java @@ -90,20 +90,33 @@ import static java.time.temporal.ChronoField.SECOND_OF_DAY; import static java.time.temporal.ChronoField.SECOND_OF_MINUTE; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.FOREVER; +import static java.time.temporal.ChronoUnit.NANOS; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Period; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.chrono.Chronology; +import java.time.chrono.ThaiBuddhistChronology; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeParseException; import java.time.format.ResolverStyle; +import java.time.temporal.ChronoUnit; import java.time.temporal.IsoFields; +import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalUnit; +import java.time.temporal.ValueRange; +import java.util.Map; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -872,4 +885,210 @@ public class TCKDateTimeParseResolver { } } + //----------------------------------------------------------------------- + @Test + public void test_fieldResolvesToLocalTime() { + TemporalField field = new TemporalField() { + @Override + public TemporalUnit getBaseUnit() { + throw new UnsupportedOperationException(); + } + @Override + public TemporalUnit getRangeUnit() { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange range() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isDateBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isTimeBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isSupportedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange rangeRefinedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public long getFrom(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public R adjustInto(R temporal, long newValue) { + throw new UnsupportedOperationException(); + } + @Override + public TemporalAccessor resolve( + Map fieldValues, Chronology chronology, + ZoneId zone, ResolverStyle resolverStyle) { + return LocalTime.MIDNIGHT.plusNanos(fieldValues.remove(this)); + } + }; + DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter(); + TemporalAccessor accessor = f.parse("1234567890"); + assertEquals(accessor.query(TemporalQuery.localDate()), null); + assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(0, 0, 1, 234_567_890)); + } + + @Test + public void test_fieldResolvesToChronoLocalDateTime() { + TemporalField field = new TemporalField() { + @Override + public TemporalUnit getBaseUnit() { + throw new UnsupportedOperationException(); + } + @Override + public TemporalUnit getRangeUnit() { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange range() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isDateBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isTimeBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isSupportedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange rangeRefinedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public long getFrom(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public R adjustInto(R temporal, long newValue) { + throw new UnsupportedOperationException(); + } + @Override + public TemporalAccessor resolve( + Map fieldValues, Chronology chronology, + ZoneId zone, ResolverStyle resolverStyle) { + fieldValues.remove(this); + return LocalDateTime.of(2010, 6, 30, 12, 30); + } + }; + DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter(); + TemporalAccessor accessor = f.parse("1234567890"); + assertEquals(accessor.query(TemporalQuery.localDate()), LocalDate.of(2010, 6, 30)); + assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(12, 30)); + } + + @Test(expectedExceptions = DateTimeParseException.class) + public void test_fieldResolvesWrongChrono() { + TemporalField field = new TemporalField() { + @Override + public TemporalUnit getBaseUnit() { + throw new UnsupportedOperationException(); + } + @Override + public TemporalUnit getRangeUnit() { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange range() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isDateBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isTimeBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isSupportedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange rangeRefinedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public long getFrom(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public R adjustInto(R temporal, long newValue) { + throw new UnsupportedOperationException(); + } + @Override + public TemporalAccessor resolve( + Map fieldValues, Chronology chronology, + ZoneId zone, ResolverStyle resolverStyle) { + return ThaiBuddhistChronology.INSTANCE.dateNow(); + } + }; + DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter(); + f.parse("1234567890"); + } + + @Test(expectedExceptions = DateTimeParseException.class) + public void test_fieldResolvesWrongZone() { + TemporalField field = new TemporalField() { + @Override + public TemporalUnit getBaseUnit() { + throw new UnsupportedOperationException(); + } + @Override + public TemporalUnit getRangeUnit() { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange range() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isDateBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isTimeBased() { + throw new UnsupportedOperationException(); + } + @Override + public boolean isSupportedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public ValueRange rangeRefinedBy(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public long getFrom(TemporalAccessor temporal) { + throw new UnsupportedOperationException(); + } + @Override + public R adjustInto(R temporal, long newValue) { + throw new UnsupportedOperationException(); + } + @Override + public TemporalAccessor resolve( + Map fieldValues, Chronology chronology, + ZoneId zone, ResolverStyle resolverStyle) { + return ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, ZoneId.of("Europe/Paris")); + } + }; + DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withZone(ZoneId.of("Europe/London")); + f.parse("1234567890"); + } + } From 5b376db4f09b35f7c561d3a360c96d716cc7b143 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Mon, 16 Sep 2013 17:45:07 +0400 Subject: [PATCH 146/983] 8008728: [macosx] Swing. JDialog. Modal dialog goes to background Reviewed-by: serb --- .../sun/lwawt/macosx/CPlatformWindow.java | 5 +- jdk/src/macosx/native/sun/awt/AWTWindow.m | 16 +++ .../ModalDialogOrderingTest.java | 114 ++++++++++++++++++ 3 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index d38946d4376..b85942002fb 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -820,6 +820,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } nativeSetEnabled(getNSWindowPtr(), !blocked); + checkBlockingAndOrder(); } public final void invalidateShadow(){ @@ -984,7 +985,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once } - private boolean checkBlocking() { + private boolean checkBlockingAndOrder() { LWWindowPeer blocker = (peer == null)? null : peer.getBlocker(); if (blocker == null) { return false; @@ -1040,7 +1041,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private void windowDidBecomeMain() { assert CThreading.assertAppKit(); - if (checkBlocking()) return; + if (checkBlockingAndOrder()) return; // If it's not blocked, make sure it's above its siblings orderAboveSiblings(); } diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 5608b4ad98c..89b0f04640b 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -366,6 +366,22 @@ AWT_ASSERT_APPKIT_THREAD; - (BOOL) canBecomeMainWindow { AWT_ASSERT_APPKIT_THREAD; + if(!self.isEnabled){ + // Native system can bring up the NSWindow to + // the top even if the window is not main. + // We should bring up the modal dialog manually + [AWTToolkit eventCountPlusPlus]; + + JNIEnv *env = [ThreadUtilities getJNIEnv]; + jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_checkBlockingAndOrder, jc_CPlatformWindow, + "checkBlockingAndOrder", "()Z"); + JNFCallVoidMethod(env, platformWindow, jm_checkBlockingAndOrder); + (*env)->DeleteLocalRef(env, platformWindow); + } + } + return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN); } diff --git a/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java b/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java new file mode 100644 index 00000000000..e78145e4e12 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import sun.awt.SunToolkit; +/* + * @test + * @bug 8008728 + * @summary [macosx] Swing. JDialog. Modal dialog goes to background + * @author Alexandr Scherbatiy + * @run main ModalDialogOrderingTest + */ + +public class ModalDialogOrderingTest { + + private static final Color DIALOG_COLOR = Color.GREEN; + private static final Color FRAME_COLOR = Color.BLUE; + + public static void main(String[] args) { + + final Frame frame = new Frame("Test"); + frame.setSize(100, 100); + frame.setBackground(FRAME_COLOR); + frame.setVisible(true); + + final Dialog modalDialog = new Dialog((Frame) null, true); + modalDialog.setTitle("Modal Dialog"); + modalDialog.setSize(50, 50); + modalDialog.setBackground(DIALOG_COLOR); + modalDialog.setModal(true); + + new Thread(new Runnable() { + + @Override + public void run() { + runTest(modalDialog, frame); + } + }).start(); + + modalDialog.setVisible(true); + } + + private static void runTest(Dialog dialog, Frame frame) { + try { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(15); + robot.mouseMove(300, 300); + + while (!dialog.isVisible()) { + toolkit.realSync(); + } + + Rectangle dialogBounds = dialog.getBounds(); + Rectangle frameBounds = frame.getBounds(); + + double x0 = dialogBounds.getX(); + double y0 = dialogBounds.getY(); + double x1 = dialogBounds.getX() + dialogBounds.getWidth(); + double y1 = dialogBounds.getY() + dialogBounds.getHeight(); + double x2 = frameBounds.getX() + frameBounds.getWidth(); + double y2 = frameBounds.getY() + frameBounds.getHeight(); + + int clickX = (int) ((x2 + x1) / 2); + int clickY = (int) ((y2 + y1) / 2); + + robot.mouseMove(clickX, clickY); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + int colorX = (int) ((x0 + x1) / 2); + int colorY = (int) ((y0 + y1) / 2); + + Color color = robot.getPixelColor(colorX, colorY); + + dialog.setVisible(false); + frame.setVisible(false); + + if (!DIALOG_COLOR.equals(color)) { + throw new RuntimeException("The frame is on top" + + " of the modal dialog!"); + } + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } +} From 70ab336e389848707f5ffe18dd8dca515683bec4 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Mon, 16 Sep 2013 18:00:06 +0400 Subject: [PATCH 147/983] 8022512: JLightweightFrame: the content pane should be transparent Reviewed-by: anthony --- jdk/src/share/classes/sun/swing/JLightweightFrame.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/share/classes/sun/swing/JLightweightFrame.java index e9a655309e2..dfba20fae2c 100644 --- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java +++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java @@ -106,7 +106,7 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan public JLightweightFrame() { super(); copyBufferEnabled = "true".equals(AccessController. - doPrivileged(new GetPropertyAction("jlf.copyBufferEnabled", "true"))); + doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true"))); add(rootPane, BorderLayout.CENTER); setFocusTraversalPolicy(new LayoutFocusTraversalPolicy()); @@ -250,6 +250,11 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan }; contentPane.setLayout(new BorderLayout()); contentPane.add(component); + if ("true".equals(AccessController. + doPrivileged(new GetPropertyAction("swing.jlf.contentPaneTransparent", "false")))) + { + contentPane.setOpaque(false); + } setContentPane(contentPane); contentPane.addContainerListener(new ContainerListener() { From 52cf3b81e76671914f7e360bb7da285b577ed394 Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Mon, 16 Sep 2013 19:15:53 +0400 Subject: [PATCH 148/983] 7020060: [TEST_BUG] java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java failed Reviewed-by: anthony, serb --- .../java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java index 3c2a636a094..0d5ada5b74b 100644 --- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java +++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java @@ -42,6 +42,7 @@ public class TranslucentWindow { GraphicsDevice gd = ge.getDefaultScreenDevice(); Frame f = new Frame("Test frame"); + f.setUndecorated(true); f.setBounds(100, 100, 320, 240); // First, check it can be made fullscreen window without any effects applied From 441fa0cc1d8cfef87b6f38a40f6363a3fe153d0e Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Mon, 16 Sep 2013 19:21:50 +0400 Subject: [PATCH 149/983] 8015588: [TEST_BUG] [macosx] Test java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java fails on MacOSX Reviewed-by: anthony, serb --- .../java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java index 559d7de4d97..9505c12a374 100644 --- a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java +++ b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java @@ -65,6 +65,12 @@ public final class MenuBarSetFont { } public static void main(final String[] args) throws Exception { + + if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) { + System.err.println("This test is not for OS X. Menu.setFont() is not supported on OS X."); + return; + } + //Components initialization. frame.setMenuBar(mb); mb.setFont(new Font("Helvetica", Font.ITALIC, 5)); From 9d4a780ccd2057c8ae36373e4a49d2755147eddb Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 16 Sep 2013 19:38:32 +0400 Subject: [PATCH 150/983] 8024779: [macosx] SwingNode crashes on exit Reviewed-by: anthony, ant --- jdk/src/macosx/native/sun/awt/AWTView.m | 2 +- jdk/src/macosx/native/sun/awt/AWTWindow.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 6ee074f12ab..28bdb4b9077 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -126,7 +126,7 @@ AWT_ASSERT_APPKIT_THREAD; self.cglLayer = nil; - JNIEnv *env = [ThreadUtilities getJNIEnv]; + JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; (*env)->DeleteGlobalRef(env, m_cPlatformView); m_cPlatformView = NULL; diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 89b0f04640b..c933379f141 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -350,7 +350,7 @@ AWT_ASSERT_APPKIT_THREAD; - (void) dealloc { AWT_ASSERT_APPKIT_THREAD; - JNIEnv *env = [ThreadUtilities getJNIEnv]; + JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; [self.javaPlatformWindow setJObject:nil withEnv:env]; self.nsWindow = nil; From cc5b6c903d58cb2eab9414bc8c295144091fc78b Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 16 Sep 2013 19:44:47 +0400 Subject: [PATCH 151/983] 8024485: For 5-1 step: if input something into the 'File:' and 'Dir:', the dir output isn't empty in the output window after showing and canceling the file dialog Reviewed-by: serb, anthony --- jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java index 92ec5f337ee..bac55be02d3 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java @@ -182,6 +182,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null); AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null); + AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null); WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { From 38fb96b8d131732bb2c9e6142308a0d34a709c40 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 16 Sep 2013 15:43:06 -0400 Subject: [PATCH 152/983] 8024863: X11: Support GNOME Shell as mutter Reviewed-by: anthony --- jdk/src/solaris/classes/sun/awt/X11/XWM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWM.java b/jdk/src/solaris/classes/sun/awt/X11/XWM.java index 54eaa656232..c76892ed0b7 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java @@ -592,7 +592,7 @@ final class XWM } static boolean isMutter() { - return isNetWMName("Mutter"); + return isNetWMName("Mutter") || isNetWMName("GNOME Shell"); } static boolean isNonReparentingWM() { From 86d8a77b06c526275a547f0d2a20f675746a9294 Mon Sep 17 00:00:00 2001 From: Peter Allwin Date: Tue, 17 Sep 2013 17:16:28 +0200 Subject: [PATCH 153/983] 7196151: ParserTest SEGv on solaris Reviewed-by: sla, coleenp, ctornqvi, dsamersoff --- hotspot/src/share/vm/services/diagnosticArgument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp index 0a1c20d8a2c..51126f063b4 100644 --- a/hotspot/src/share/vm/services/diagnosticArgument.cpp +++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp @@ -61,7 +61,7 @@ void GenDCmdArgument::to_string(MemorySizeArgument m, char* buf, size_t len) { } void GenDCmdArgument::to_string(char* c, char* buf, size_t len) { - jio_snprintf(buf, len, "%s", c); + jio_snprintf(buf, len, "%s", (c != NULL) ? c : ""); } void GenDCmdArgument::to_string(StringArrayArgument* f, char* buf, size_t len) { From 7cc012b008641662edc9fbaa84b4b1be7527540a Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 17 Sep 2013 14:17:13 -0700 Subject: [PATCH 154/983] 8024538: -Xdoclint + -Xprefer:source + incremental compilation == FAIL Reviewed-by: darcy --- .../com/sun/tools/doclint/DocLint.java | 19 ++++++++-- .../com/sun/tools/javac/comp/Enter.java | 4 ++- .../implicitSource/ImplicitSourceTest.java | 35 +++++++++++++++++++ .../javac/doclint/implicitSource/Other.java | 25 +++++++++++++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 langtools/test/tools/javac/doclint/implicitSource/ImplicitSourceTest.java create mode 100644 langtools/test/tools/javac/doclint/implicitSource/Other.java diff --git a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java index 20151d1f360..a7b6fb6a15c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java +++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java @@ -29,9 +29,14 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedList; import java.util.List; +import java.util.Queue; +import java.util.Set; import javax.lang.model.element.Name; +import javax.tools.JavaFileObject; import javax.tools.StandardLocation; import com.sun.source.doctree.DocCommentTree; @@ -278,15 +283,25 @@ public class DocLint implements Plugin { TaskListener tl = new TaskListener() { @Override public void started(TaskEvent e) { + switch (e.getKind()) { + case ANALYZE: + CompilationUnitTree tree; + while ((tree = todo.poll()) != null) + ds.scan(tree, null); + break; + } } @Override public void finished(TaskEvent e) { switch (e.getKind()) { - case ENTER: - ds.scan(e.getCompilationUnit(), null); + case PARSE: + todo.add(e.getCompilationUnit()); + break; } } + + Queue todo = new LinkedList(); }; task.addTaskListener(tl); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java index 41c0792acf2..697a6921d01 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java @@ -288,7 +288,9 @@ public class Enter extends JCTree.Visitor { JavaFileObject.Kind.SOURCE); if (tree.pid != null) { tree.packge = reader.enterPackage(TreeInfo.fullName(tree.pid)); - if (tree.packageAnnotations.nonEmpty() || pkginfoOpt == PkgInfo.ALWAYS) { + if (tree.packageAnnotations.nonEmpty() + || pkginfoOpt == PkgInfo.ALWAYS + || tree.docComments != null) { if (isPkgInfo) { addEnv = true; } else if (tree.packageAnnotations.nonEmpty()){ diff --git a/langtools/test/tools/javac/doclint/implicitSource/ImplicitSourceTest.java b/langtools/test/tools/javac/doclint/implicitSource/ImplicitSourceTest.java new file mode 100644 index 00000000000..6ae67ce2819 --- /dev/null +++ b/langtools/test/tools/javac/doclint/implicitSource/ImplicitSourceTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024538 + * @summary -Xdoclint + -Xprefer:source + incremental compilation == FAIL + * @compile -Xdoclint -Xprefer:source ImplicitSourceTest.java + */ + +/** ImplicitSourceTest. */ +class ImplicitSourceTest { + /**

    {@link Other}

    */ + int i; +} diff --git a/langtools/test/tools/javac/doclint/implicitSource/Other.java b/langtools/test/tools/javac/doclint/implicitSource/Other.java new file mode 100644 index 00000000000..65a5dd5b45a --- /dev/null +++ b/langtools/test/tools/javac/doclint/implicitSource/Other.java @@ -0,0 +1,25 @@ +/* + * 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. + */ + +/** Other. */ +class Other { } From cebaf1314e74464e14fe70d851bd1275fbdb5729 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Wed, 18 Sep 2013 12:25:13 +0400 Subject: [PATCH 155/983] 8024839: [Unified Swing/Fx threading] don't schedule an event dispatching from the event dispatch thread Reviewed-by: anthony, pchelko --- jdk/src/share/classes/java/awt/EventQueue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java index 76795eb5ed6..1a04dcb507a 100644 --- a/jdk/src/share/classes/java/awt/EventQueue.java +++ b/jdk/src/share/classes/java/awt/EventQueue.java @@ -690,7 +690,10 @@ public class EventQueue { final Object src = event.getSource(); final PrivilegedAction action = new PrivilegedAction() { public Void run() { - if (fwDispatcher == null) { + // In case fwDispatcher is installed and we're already on the + // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage), + // dispatch the event straight away. + if (fwDispatcher == null || isDispatchThreadImpl()) { dispatchEventImpl(event, src); } else { fwDispatcher.scheduleDispatch(new Runnable() { From dae6feeefd0f1f68ceebed180ecd7a5c210b6f7f Mon Sep 17 00:00:00 2001 From: Mikhail Cherkasov Date: Wed, 18 Sep 2013 15:12:13 +0400 Subject: [PATCH 156/983] 8016746: Test javax/swing/JTable/7068740/bug7068740.java fails Reviewed-by: serb, alexsch --- .../swing/JTable/7068740/bug7068740.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/jdk/test/javax/swing/JTable/7068740/bug7068740.java b/jdk/test/javax/swing/JTable/7068740/bug7068740.java index 7073779f6e6..4dac9cd288c 100644 --- a/jdk/test/javax/swing/JTable/7068740/bug7068740.java +++ b/jdk/test/javax/swing/JTable/7068740/bug7068740.java @@ -37,6 +37,7 @@ import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.KeyEvent; import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicInteger; public class bug7068740 extends JFrame { @@ -66,6 +67,7 @@ public class bug7068740 extends JFrame { }; table = new JTable(model); + table.setRowSelectionInterval(0, 0); LayerUI layerUI = new LayerUI<>(); JLayer layer = new JLayer<>(table, layerUI); JScrollPane scrollPane = new JScrollPane(layer); @@ -78,7 +80,7 @@ public class bug7068740 extends JFrame { try { if (robot == null) { robot = new Robot(); - robot.setAutoDelay(20); + robot.setAutoDelay(50); } if (toolkit == null) { @@ -104,24 +106,37 @@ public class bug7068740 extends JFrame { } } - private static void doTest() { + private static int getSelectedRow() throws Exception { + final AtomicInteger row = new AtomicInteger(-1); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + row.set(table.getSelectedRow()); + } + }); + return row.intValue(); + } + + private static void doTest() throws Exception { toolkit.realSync(); - table.setRowSelectionInterval(0, 0); robot.keyPress(KeyEvent.VK_PAGE_DOWN); + robot.keyRelease(KeyEvent.VK_PAGE_DOWN); toolkit.realSync(); - if (table.getSelectedRow() != 19) { + + if (getSelectedRow() != 19) { throw new RuntimeException("Test failed"); } robot.keyPress(KeyEvent.VK_PAGE_UP); + robot.keyRelease(KeyEvent.VK_PAGE_UP); toolkit.realSync(); - if (table.getSelectedRow() != 0) { + if (getSelectedRow() != 0) { throw new RuntimeException("Test failed"); } } - public static void main(String[] args) { + public static void main(String[] args) throws Exception { try { UIManager.setLookAndFeel(new MetalLookAndFeel()); setUp(); From 775822bed7ad6b5df862bf28fc8b462c203cf247 Mon Sep 17 00:00:00 2001 From: Andreas Lundblad Date: Wed, 18 Sep 2013 14:39:27 +0200 Subject: [PATCH 157/983] 8024127: javac, Code_attribute.exception_table_langth should be Code_attribute.exception_table_length Exception_table_langth renamed to exception_table_length Reviewed-by: jfranck, jjg --- .../classes/com/sun/tools/classfile/Code_attribute.java | 8 ++++---- .../src/share/classes/com/sun/tools/javap/CodeWriter.java | 2 +- langtools/test/tools/javac/T7093325.java | 2 +- .../javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java | 2 +- langtools/test/tools/javac/multicatch/Pos05.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java index 5d7c81474f2..6d5b7e6bef8 100644 --- a/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java +++ b/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java @@ -61,9 +61,9 @@ public class Code_attribute extends Attribute { code_length = cr.readInt(); code = new byte[code_length]; cr.readFully(code); - exception_table_langth = cr.readUnsignedShort(); - exception_table = new Exception_data[exception_table_langth]; - for (int i = 0; i < exception_table_langth; i++) + exception_table_length = cr.readUnsignedShort(); + exception_table = new Exception_data[exception_table_length]; + for (int i = 0; i < exception_table_length; i++) exception_table[i] = new Exception_data(cr); attributes = new Attributes(cr); } @@ -139,7 +139,7 @@ public class Code_attribute extends Attribute { public final int max_locals; public final int code_length; public final byte[] code; - public final int exception_table_langth; + public final int exception_table_length; public final Exception_data[] exception_table; public final Attributes attributes; diff --git a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java index 657194d19c6..6211a2a13cf 100644 --- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java +++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java @@ -208,7 +208,7 @@ public class CodeWriter extends BasicWriter { public void writeExceptionTable(Code_attribute attr) { - if (attr.exception_table_langth > 0) { + if (attr.exception_table_length > 0) { println("Exception table:"); indent(+1); println(" from to target type"); diff --git a/langtools/test/tools/javac/T7093325.java b/langtools/test/tools/javac/T7093325.java index dcdc6e62856..fb11a87e77e 100644 --- a/langtools/test/tools/javac/T7093325.java +++ b/langtools/test/tools/javac/T7093325.java @@ -208,7 +208,7 @@ public class T7093325 } int actualGapsCount = 0; - for (int i = 0; i < code.exception_table_langth ; i++) { + for (int i = 0; i < code.exception_table_length ; i++) { int catchType = code.exception_table[i].catch_type; if (catchType == 0) { //any actualGapsCount++; diff --git a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java index 0dd25871f3a..9b69b074624 100644 --- a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java +++ b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java @@ -100,7 +100,7 @@ public class NoDeadCodeGenerationOnTrySmtTest { if (method.getName(classFile.constant_pool).equals(methodToFind)) { numberOfmethodsFound++; Code_attribute code = (Code_attribute) method.attributes.get("Code"); - Assert.check(code.exception_table_langth == expectedExceptionTable.length, + Assert.check(code.exception_table_length == expectedExceptionTable.length, "The ExceptionTable found has a length different to the expected one"); int i = 0; for (Exception_data entry: code.exception_table) { diff --git a/langtools/test/tools/javac/multicatch/Pos05.java b/langtools/test/tools/javac/multicatch/Pos05.java index e3c3d50d321..32d76b2368b 100644 --- a/langtools/test/tools/javac/multicatch/Pos05.java +++ b/langtools/test/tools/javac/multicatch/Pos05.java @@ -95,7 +95,7 @@ public class Pos05 { throw new Error("Code attribute for test() method not found"); } Exception_data firstExceptionTable = null; - for (int i = 0 ; i < ea.exception_table_langth; i++) { + for (int i = 0 ; i < ea.exception_table_length; i++) { if (firstExceptionTable == null) { firstExceptionTable = ea.exception_table[i]; } From c5c705217bf51ac2a2e329fbffe1db3e0de366f7 Mon Sep 17 00:00:00 2001 From: Sergey Gabdurakhmanov Date: Wed, 18 Sep 2013 16:48:49 +0400 Subject: [PATCH 158/983] 8022836: JVM crashes in JVMTIENVBASE::GET_CURRENT_CONTENDED_MONITOR and GET_OWNED_MONITOR Check that the _java_thread parameter is valid when it is possible that the JavaThread has exited after the initial checks were made in generated/jvmtifiles/jvmtiEnter.cpp: jvmti_GetCurrentContendedMonitor() Reviewed-by: dcubed, dsamersoff --- hotspot/src/share/vm/prims/jvmtiEnvBase.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp index 929dcf22260..265154683ba 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp +++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp @@ -406,7 +406,11 @@ public: VMOp_Type type() const { return VMOp_GetCurrentContendedMonitor; } jvmtiError result() { return _result; } void doit() { - _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr); + _result = JVMTI_ERROR_THREAD_NOT_ALIVE; + if (Threads::includes(_java_thread) && !_java_thread->is_exiting() && + _java_thread->threadObj() != NULL) { + _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr); + } } }; From 41bce440a4f08849888aff8042a6663e9942745c Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 18 Sep 2013 07:02:10 -0700 Subject: [PATCH 159/983] 8019835: Strings interned in different threads equal but does not == Add -XX:+VerifyStringTableAtExit option and code to verify StringTable invariants. Reviewed-by: rdurbin, sspitsyn, coleenp --- .../src/share/vm/classfile/javaClasses.cpp | 23 +++ .../src/share/vm/classfile/javaClasses.hpp | 1 + .../src/share/vm/classfile/symbolTable.cpp | 158 ++++++++++++++++++ .../src/share/vm/classfile/symbolTable.hpp | 20 +++ hotspot/src/share/vm/runtime/globals.hpp | 3 + hotspot/src/share/vm/runtime/java.cpp | 13 ++ 6 files changed, 218 insertions(+) diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 8e94d834ad9..9331cc1246f 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -438,6 +438,29 @@ bool java_lang_String::equals(oop java_string, jchar* chars, int len) { return true; } +bool java_lang_String::equals(oop str1, oop str2) { + assert(str1->klass() == SystemDictionary::String_klass(), + "must be java String"); + assert(str2->klass() == SystemDictionary::String_klass(), + "must be java String"); + typeArrayOop value1 = java_lang_String::value(str1); + int offset1 = java_lang_String::offset(str1); + int length1 = java_lang_String::length(str1); + typeArrayOop value2 = java_lang_String::value(str2); + int offset2 = java_lang_String::offset(str2); + int length2 = java_lang_String::length(str2); + + if (length1 != length2) { + return false; + } + for (int i = 0; i < length1; i++) { + if (value1->char_at(i + offset1) != value2->char_at(i + offset2)) { + return false; + } + } + return true; +} + void java_lang_String::print(Handle java_string, outputStream* st) { oop obj = java_string(); assert(obj->klass() == SystemDictionary::String_klass(), "must be java_string"); diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 8a8e801f387..ffccf2f0e0c 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -182,6 +182,7 @@ class java_lang_String : AllStatic { static unsigned int hash_string(oop java_string); static bool equals(oop java_string, jchar* chars, int len); + static bool equals(oop str1, oop str2); // Conversion between '.' and '/' formats static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); } diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index c00e9581759..747ca870c2b 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -807,6 +807,8 @@ void StringTable::possibly_parallel_oops_do(OopClosure* f) { } } +// This verification is part of Universe::verify() and needs to be quick. +// See StringTable::verify_and_compare() below for exhaustive verification. void StringTable::verify() { for (int i = 0; i < the_table()->table_size(); ++i) { HashtableEntry* p = the_table()->bucket(i); @@ -825,6 +827,162 @@ void StringTable::dump(outputStream* st) { the_table()->dump_table(st, "StringTable"); } +StringTable::VerifyRetTypes StringTable::compare_entries( + int bkt1, int e_cnt1, + HashtableEntry* e_ptr1, + int bkt2, int e_cnt2, + HashtableEntry* e_ptr2) { + // These entries are sanity checked by verify_and_compare_entries() + // before this function is called. + oop str1 = e_ptr1->literal(); + oop str2 = e_ptr2->literal(); + + if (str1 == str2) { + tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") " + "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]", + str1, bkt1, e_cnt1, bkt2, e_cnt2); + return _verify_fail_continue; + } + + if (java_lang_String::equals(str1, str2)) { + tty->print_cr("ERROR: identical String values in entry @ " + "bucket[%d][%d] and entry @ bucket[%d][%d]", + bkt1, e_cnt1, bkt2, e_cnt2); + return _verify_fail_continue; + } + + return _verify_pass; +} + +StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt, + HashtableEntry* e_ptr, + StringTable::VerifyMesgModes mesg_mode) { + + VerifyRetTypes ret = _verify_pass; // be optimistic + + oop str = e_ptr->literal(); + if (str == NULL) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt, + e_cnt); + } + // NULL oop means no more verifications are possible + return _verify_fail_done; + } + + if (str->klass() != SystemDictionary::String_klass()) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]", + bkt, e_cnt); + } + // not a String means no more verifications are possible + return _verify_fail_done; + } + + unsigned int h = java_lang_String::hash_string(str); + if (e_ptr->hash() != h) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], " + "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h); + } + ret = _verify_fail_continue; + } + + if (the_table()->hash_to_index(h) != bkt) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], " + "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h, + the_table()->hash_to_index(h)); + } + ret = _verify_fail_continue; + } + + return ret; +} + +// See StringTable::verify() above for the quick verification that is +// part of Universe::verify(). This verification is exhaustive and +// reports on every issue that is found. StringTable::verify() only +// reports on the first issue that is found. +// +// StringTable::verify_entry() checks: +// - oop value != NULL (same as verify()) +// - oop value is a String +// - hash(String) == hash in entry (same as verify()) +// - index for hash == index of entry (same as verify()) +// +// StringTable::compare_entries() checks: +// - oops are unique across all entries +// - String values are unique across all entries +// +int StringTable::verify_and_compare_entries() { + assert(StringTable_lock->is_locked(), "sanity check"); + + int fail_cnt = 0; + + // first, verify all the entries individually: + for (int bkt = 0; bkt < the_table()->table_size(); bkt++) { + HashtableEntry* e_ptr = the_table()->bucket(bkt); + for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) { + VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs); + if (ret != _verify_pass) { + fail_cnt++; + } + } + } + + // Optimization: if the above check did not find any failures, then + // the comparison loop below does not need to call verify_entry() + // before calling compare_entries(). If there were failures, then we + // have to call verify_entry() to see if the entry can be passed to + // compare_entries() safely. When we call verify_entry() in the loop + // below, we do so quietly to void duplicate messages and we don't + // increment fail_cnt because the failures have already been counted. + bool need_entry_verify = (fail_cnt != 0); + + // second, verify all entries relative to each other: + for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) { + HashtableEntry* e_ptr1 = the_table()->bucket(bkt1); + for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) { + if (need_entry_verify) { + VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1, + _verify_quietly); + if (ret == _verify_fail_done) { + // cannot use the current entry to compare against other entries + continue; + } + } + + for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) { + HashtableEntry* e_ptr2 = the_table()->bucket(bkt2); + int e_cnt2; + for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) { + if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) { + // skip the entries up to and including the one that + // we're comparing against + continue; + } + + if (need_entry_verify) { + VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2, + _verify_quietly); + if (ret == _verify_fail_done) { + // cannot compare against this entry + continue; + } + } + + // compare two entries, report and count any failures: + if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2) + != _verify_pass) { + fail_cnt++; + } + } + } + } + } + return fail_cnt; +} // Create a new table and using alternate hash code, populate the new table // with the existing strings. Set flag to use the alternate hash code afterwards. diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp index 7a0031c9ab4..dc7d0337a0e 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.hpp +++ b/hotspot/src/share/vm/classfile/symbolTable.hpp @@ -311,6 +311,26 @@ public: static void verify(); static void dump(outputStream* st); + enum VerifyMesgModes { + _verify_quietly = 0, + _verify_with_mesgs = 1 + }; + + enum VerifyRetTypes { + _verify_pass = 0, + _verify_fail_continue = 1, + _verify_fail_done = 2 + }; + + static VerifyRetTypes compare_entries(int bkt1, int e_cnt1, + HashtableEntry* e_ptr1, + int bkt2, int e_cnt2, + HashtableEntry* e_ptr2); + static VerifyRetTypes verify_entry(int bkt, int e_cnt, + HashtableEntry* e_ptr, + VerifyMesgModes mesg_mode); + static int verify_and_compare_entries(); + // Sharing static void copy_buckets(char** top, char*end) { the_table()->Hashtable::copy_buckets(top, end); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 7fdf668bac5..bdee0be3c32 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2525,6 +2525,9 @@ class CommandLineFlags { product(bool, PrintStringTableStatistics, false, \ "print statistics about the StringTable and SymbolTable") \ \ + diagnostic(bool, VerifyStringTableAtExit, false, \ + "verify StringTable contents at exit") \ + \ notproduct(bool, PrintSymbolTableSizeHistogram, false, \ "print histogram of the symbol table") \ \ diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index ebc4e087578..874765fa3e5 100644 --- a/hotspot/src/share/vm/runtime/java.cpp +++ b/hotspot/src/share/vm/runtime/java.cpp @@ -544,6 +544,19 @@ void before_exit(JavaThread * thread) { // it will run into trouble when system destroys static variables. MemTracker::shutdown(MemTracker::NMT_normal); + if (VerifyStringTableAtExit) { + int fail_cnt = 0; + { + MutexLocker ml(StringTable_lock); + fail_cnt = StringTable::verify_and_compare_entries(); + } + + if (fail_cnt != 0) { + tty->print_cr("ERROR: fail_cnt=%d", fail_cnt); + guarantee(fail_cnt == 0, "unexpected StringTable verification failures"); + } + } + #undef BEFORE_EXIT_NOT_RUN #undef BEFORE_EXIT_RUNNING #undef BEFORE_EXIT_DONE From 5108c579fee9c92686e3ba9d43f4a723e14075e2 Mon Sep 17 00:00:00 2001 From: Leonid Romanov Date: Wed, 18 Sep 2013 18:36:57 +0400 Subject: [PATCH 160/983] 7188071: closed/java/awt/TrayIcon/TrayIconSecurity/GrantedTrayIconTest fails Reviewed-by: anthony, serb --- jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java index 24f2656f891..e2da468f440 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -459,7 +459,7 @@ public class XTrayIconPeer implements TrayIconPeer, // other class tries to cast source field to Component). // We already filter DRAG events out (CR 6565779). e.setSource(xtiPeer.target); - Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e); + XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e); } public void mouseClicked(MouseEvent e) { if ((e.getClickCount() > 1 || xtiPeer.balloon.isVisible()) && From 3debf156b12b2f2a2d9b964886b5db3e993c2cf2 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Mon, 30 Sep 2013 16:15:49 -0700 Subject: [PATCH 161/983] 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted Reviewed-by: ksrini, akhil --- jdk/src/windows/bin/cmdtoargs.c | 76 ++++++++++------ jdk/test/tools/launcher/I18NArgTest.java | 111 +++++++++++++++++++++++ 2 files changed, 160 insertions(+), 27 deletions(-) create mode 100644 jdk/test/tools/launcher/I18NArgTest.java diff --git a/jdk/src/windows/bin/cmdtoargs.c b/jdk/src/windows/bin/cmdtoargs.c index 69f1aef7383..352b1553a08 100644 --- a/jdk/src/windows/bin/cmdtoargs.c +++ b/jdk/src/windows/bin/cmdtoargs.c @@ -53,6 +53,16 @@ typedef struct { static StdArg *stdargs; static int stdargc; +static int copyCh(USHORT ch, char* dest) { + if (HIBYTE(ch) == 0) { + *dest = (char)ch; + return 1; + } else { + *((USHORT *)dest) = ch; + return 2; + } +} + static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { char* src = cmdline; @@ -61,31 +71,43 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { int quotes = 0; int slashes = 0; - char prev = 0; - char ch = 0; + // "prev"/"ch" may contain either a single byte, or a double byte + // character encoded in CP_ACP. + USHORT prev = 0; + USHORT ch = 0; int i; jboolean done = JNI_FALSE; + int charLength; *wildcard = JNI_FALSE; - while ((ch = *src) != 0 && !done) { + while (!done) { + charLength = CharNextExA(CP_ACP, src, 0) - src; + if (charLength == 0) { + break; + } else if (charLength == 1) { + ch = (USHORT)(UCHAR)src[0]; + } else { + ch = ((USHORT *)src)[0]; + } + switch (ch) { - case '"': + case L'"': if (separator) { done = JNI_TRUE; break; } - if (prev == '\\') { + if (prev == L'\\') { for (i = 1; i < slashes; i += 2) { - *dest++ = prev; + dest += copyCh(prev, dest); } if (slashes % 2 == 1) { - *dest++ = ch; + dest += copyCh(ch, dest); } else { quotes++; } - } else if (prev == '"' && quotes % 2 == 0) { + } else if (prev == L'"' && quotes % 2 == 0) { quotes++; - *dest++ = ch; // emit every other consecutive quote + dest += copyCh(ch, dest); // emit every other consecutive quote } else if (quotes == 0) { quotes++; // starting quote } else { @@ -94,7 +116,7 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { slashes = 0; break; - case '\\': + case L'\\': slashes++; if (separator) { done = JNI_TRUE; @@ -102,23 +124,23 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { } break; - case ' ': - case '\t': - if (prev == '\\') { + case L' ': + case L'\t': + if (prev == L'\\') { for (i = 0 ; i < slashes; i++) { - *dest++ = prev; + dest += copyCh(prev, dest); } } if (quotes % 2 == 1) { - *dest++ = ch; + dest += copyCh(ch, dest); } else { separator = JNI_TRUE; } slashes = 0; break; - case '*': - case '?': + case L'*': + case L'?': if (separator) { done = JNI_TRUE; separator = JNI_FALSE; @@ -127,36 +149,36 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { if (quotes % 2 == 0) { *wildcard = JNI_TRUE; } - if (prev == '\\') { + if (prev == L'\\') { for (i = 0 ; i < slashes ; i++) { - *dest++ = prev; + dest += copyCh(prev, dest); } } - *dest++ = ch; + dest += copyCh(ch, dest); break; default: - if (prev == '\\') { + if (prev == L'\\') { for (i = 0 ; i < slashes ; i++) { - *dest++ = prev; + dest += copyCh(prev, dest); } - *dest++ = ch; + dest += copyCh(ch, dest); } else if (separator) { done = JNI_TRUE; } else { - *dest++ = ch; + dest += copyCh(ch, dest); } slashes = 0; } if (!done) { prev = ch; - src++; + src += charLength; } } - if (prev == '\\') { + if (prev == L'\\') { for (i = 0; i < slashes; i++) { - *dest++ = prev; + dest += copyCh(prev, dest); } } *dest = 0; diff --git a/jdk/test/tools/launcher/I18NArgTest.java b/jdk/test/tools/launcher/I18NArgTest.java new file mode 100644 index 00000000000..d3a28be1b64 --- /dev/null +++ b/jdk/test/tools/launcher/I18NArgTest.java @@ -0,0 +1,111 @@ +/* + * 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 8016110 + * @summary verify Japanese character in an argument are treated correctly + * @compile -XDignore.symbol.file I18NArgTest.java + * @run main I18NArgTest + */ +import java.io.IOException; + +public class I18NArgTest extends TestHelper { + public static void main(String... args) throws IOException { + if (!isWindows) { + return; + } + if (!"MS932".equals(System.getProperty("sun.jnu.encoding"))) { + System.err.println("MS932 encoding not set, test skipped"); + return; + } + if (args.length == 0) { + execTest(0x30bd); // MS932 Katakana SO, 0x835C + } else { + testCharacters(args); + } + } + static void execTest(int unicodeValue) { + String hexValue = Integer.toHexString(unicodeValue); + String unicodeStr = Character.toString((char)unicodeValue); + execTest("\"" + unicodeStr + "\"", hexValue); + execTest("\\" + unicodeStr + "\\", hexValue); + execTest(" " + unicodeStr + " ", hexValue); + execTest("'" + unicodeStr + "'", hexValue); + execTest("\t" + unicodeStr + "\t", hexValue); + execTest("*" + unicodeStr + "*", hexValue); + execTest("?" + unicodeStr + "?", hexValue); + + execTest("\"" + unicodeStr + unicodeStr + "\"", hexValue + hexValue); + execTest("\\" + unicodeStr + unicodeStr + "\\", hexValue + hexValue); + execTest(" " + unicodeStr + unicodeStr + " ", hexValue + hexValue); + execTest("'" + unicodeStr + unicodeStr + "'", hexValue + hexValue); + execTest("\t" + unicodeStr + unicodeStr + "\t", hexValue + hexValue); + execTest("*" + unicodeStr + unicodeStr + "*", hexValue + hexValue); + execTest("?" + unicodeStr + unicodeStr + "?", hexValue + hexValue); + + execTest("\"" + unicodeStr + "a" + unicodeStr + "\"", hexValue + "61" + hexValue); + execTest("\\" + unicodeStr + "a" + unicodeStr + "\\", hexValue + "61" + hexValue); + execTest(" " + unicodeStr + "a" + unicodeStr + " ", hexValue + "61"+ hexValue); + execTest("'" + unicodeStr + "a" + unicodeStr + "'", hexValue + "61"+ hexValue); + execTest("\t" + unicodeStr + "a" + unicodeStr + "\t", hexValue + "61"+ hexValue); + execTest("*" + unicodeStr + "a" + unicodeStr + "*", hexValue + "61"+ hexValue); + execTest("?" + unicodeStr + "a" + unicodeStr + "?", hexValue + "61"+ hexValue); + + execTest("\"" + unicodeStr + "\u00b1" + unicodeStr + "\"", hexValue + "b1" + hexValue); + execTest("\\" + unicodeStr + "\u00b1" + unicodeStr + "\\", hexValue + "b1" + hexValue); + execTest(" " + unicodeStr + "\u00b1" + unicodeStr + " ", hexValue + "b1"+ hexValue); + execTest("'" + unicodeStr + "\u00b1" + unicodeStr + "'", hexValue + "b1"+ hexValue); + execTest("\t" + unicodeStr + "\u00b1" + unicodeStr + "\t", hexValue + "b1"+ hexValue); + execTest("*" + unicodeStr + "\u00b1" + unicodeStr + "*", hexValue + "b1"+ hexValue); + execTest("?" + unicodeStr + "\u00b1" + unicodeStr + "?", hexValue + "b1"+ hexValue); + } + static void execTest(String unicodeStr, String hexValue) { + TestResult tr = doExec(javaCmd, + "-Dtest.src=" + TEST_SOURCES_DIR.getAbsolutePath(), + "-Dtest.classes=" + TEST_CLASSES_DIR.getAbsolutePath(), + "-cp", TEST_CLASSES_DIR.getAbsolutePath(), + "I18NArgTest", unicodeStr, hexValue); + System.out.println(tr.testOutput); + if (!tr.isOK()) { + System.err.println(tr); + throw new RuntimeException("test fails"); + } + } + static void testCharacters(String... args) { + String input = args[0]; + String expected = args[1]; + String hexValue = ""; + for (int i = 0; i < input.length(); i++) { + hexValue = hexValue.concat(Integer.toHexString((int)input.charAt(i))); + } + System.out.println("input:" + input); + System.out.println("expected:" + expected); + System.out.println("obtained:" + hexValue); + if (!hexValue.contains(expected)) { + String message = "Error: output does not contain expected value" + + "expected:" + expected + " obtained:" + hexValue; + throw new RuntimeException(message); + } + } +} From 223c6bf379d4e03e38dacc6069978e1bf958a9a7 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Tue, 1 Oct 2013 12:19:20 +0200 Subject: [PATCH 162/983] 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators Reviewed-by: alanb --- jdk/src/share/classes/java/util/Collection.java | 14 +++++++------- jdk/src/share/classes/java/util/Set.java | 9 ++++++--- jdk/src/share/classes/java/util/SortedSet.java | 11 +++++++---- .../Spliterator/SpliteratorCharacteristics.java | 8 +++++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/jdk/src/share/classes/java/util/Collection.java b/jdk/src/share/classes/java/util/Collection.java index 8e8fd5a76dc..36c7b9d9de1 100644 --- a/jdk/src/share/classes/java/util/Collection.java +++ b/jdk/src/share/classes/java/util/Collection.java @@ -503,12 +503,10 @@ public interface Collection extends Iterable { /** * Creates a {@link Spliterator} over the elements in this collection. * - *

    The returned {@code Spliterator} must report the characteristic - * {@link Spliterator#SIZED}; implementations should document any additional - * characteristic values reported by the returned spliterator. If - * this collection contains no elements then the returned spliterator is - * only required to report {@link Spliterator#SIZED} and is not required to - * report additional characteristic values (if any). + * Implementations should document characteristic values reported by the + * spliterator. Such characteristic values are not required to be reported + * if the spliterator reports {@link Spliterator#SIZED} and this collection + * contains no elements. * *

    The default implementation should be overridden by subclasses that * can return a more efficient spliterator. In order to @@ -534,9 +532,11 @@ public interface Collection extends Iterable { * late-binding spliterator * from the collections's {@code Iterator}. The spliterator inherits the * fail-fast properties of the collection's iterator. + *

    + * The created {@code Spliterator} reports {@link Spliterator#SIZED}. * * @implNote - * The returned {@code Spliterator} additionally reports + * The created {@code Spliterator} additionally reports * {@link Spliterator#SUBSIZED}. * *

    If a spliterator covers no elements then the reporting of additional diff --git a/jdk/src/share/classes/java/util/Set.java b/jdk/src/share/classes/java/util/Set.java index d47a06a4a8a..2703049b30d 100644 --- a/jdk/src/share/classes/java/util/Set.java +++ b/jdk/src/share/classes/java/util/Set.java @@ -386,15 +386,18 @@ public interface Set extends Collection { /** * Creates a {@code Spliterator} over the elements in this set. * - *

    The {@code Spliterator} reports {@link Spliterator#SIZED} and - * {@link Spliterator#DISTINCT}. Implementations should document the - * reporting of additional characteristic values. + *

    The {@code Spliterator} reports {@link Spliterator#DISTINCT}. + * Implementations should document the reporting of additional + * characteristic values. * * @implSpec * The default implementation creates a * late-binding spliterator * from the set's {@code Iterator}. The spliterator inherits the * fail-fast properties of the set's iterator. + *

    + * The created {@code Spliterator} additionally reports + * {@link Spliterator#SIZED}. * * @implNote * The created {@code Spliterator} additionally reports diff --git a/jdk/src/share/classes/java/util/SortedSet.java b/jdk/src/share/classes/java/util/SortedSet.java index 3e64804e7b5..3ea932949a3 100644 --- a/jdk/src/share/classes/java/util/SortedSet.java +++ b/jdk/src/share/classes/java/util/SortedSet.java @@ -223,10 +223,10 @@ public interface SortedSet extends Set { /** * Creates a {@code Spliterator} over the elements in this sorted set. * - *

    The {@code Spliterator} reports {@link Spliterator#SIZED}, - * {@link Spliterator#DISTINCT}, {@link Spliterator#SORTED} and - * {@link Spliterator#ORDERED}. Implementations should document the - * reporting of additional characteristic values. + *

    The {@code Spliterator} reports {@link Spliterator#DISTINCT}, + * {@link Spliterator#SORTED} and {@link Spliterator#ORDERED}. + * Implementations should document the reporting of additional + * characteristic values. * *

    The spliterator's comparator (see * {@link java.util.Spliterator#getComparator()}) must be {@code null} if @@ -240,6 +240,9 @@ public interface SortedSet extends Set { * from the sorted set's {@code Iterator}. The spliterator inherits the * fail-fast properties of the set's iterator. The * spliterator's comparator is the same as the sorted set's comparator. + *

    + * The created {@code Spliterator} additionally reports + * {@link Spliterator#SIZED}. * * @implNote * The created {@code Spliterator} additionally reports diff --git a/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java b/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java index 37fbcc769d0..f226a82b439 100644 --- a/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java +++ b/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8020156 8020009 8022326 8012913 8024405 + * @bug 8020156 8020009 8022326 8012913 8024405 8024408 * @run testng SpliteratorCharacteristics */ @@ -46,6 +46,7 @@ import java.util.Spliterator; import java.util.Spliterators; import java.util.TreeMap; import java.util.TreeSet; +import java.util.WeakHashMap; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListSet; import java.util.function.Supplier; @@ -185,6 +186,11 @@ public class SpliteratorCharacteristics { Spliterator.SIZED | Spliterator.DISTINCT); } + public void testWeakHashMap() { + assertMapCharacteristics(new WeakHashMap<>(), + Spliterator.DISTINCT); + } + public void testHashSet() { assertSetCharacteristics(new HashSet<>(), Spliterator.SIZED | Spliterator.DISTINCT); From 2a5d8d6d8cdf11401312c5fab199abf4825d78fa Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Tue, 1 Oct 2013 17:15:43 +0400 Subject: [PATCH 163/983] 8024707: TransformerException : item() return null with node list of length != 1 Reviewed-by: joehw, lancea --- .../xml/jaxp/parsers/8024707/TestFunc.java | 35 +++++++++++++ .../javax/xml/jaxp/parsers/8024707/XSLT.java | 51 +++++++++++++++++++ .../javax/xml/jaxp/parsers/8024707/in.xml | 4 ++ .../javax/xml/jaxp/parsers/8024707/test.xsl | 10 ++++ 4 files changed, 100 insertions(+) create mode 100644 jdk/test/javax/xml/jaxp/parsers/8024707/TestFunc.java create mode 100644 jdk/test/javax/xml/jaxp/parsers/8024707/XSLT.java create mode 100644 jdk/test/javax/xml/jaxp/parsers/8024707/in.xml create mode 100644 jdk/test/javax/xml/jaxp/parsers/8024707/test.xsl diff --git a/jdk/test/javax/xml/jaxp/parsers/8024707/TestFunc.java b/jdk/test/javax/xml/jaxp/parsers/8024707/TestFunc.java new file mode 100644 index 00000000000..69f181d7f07 --- /dev/null +++ b/jdk/test/javax/xml/jaxp/parsers/8024707/TestFunc.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * bug 8024707 + */ + +public class TestFunc { + public static Node test( NodeList list ) { + return list.item(0); + } +} diff --git a/jdk/test/javax/xml/jaxp/parsers/8024707/XSLT.java b/jdk/test/javax/xml/jaxp/parsers/8024707/XSLT.java new file mode 100644 index 00000000000..e6a03f5af68 --- /dev/null +++ b/jdk/test/javax/xml/jaxp/parsers/8024707/XSLT.java @@ -0,0 +1,51 @@ +/* + * 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 8024707 + * @summary Test for XSLT extension function with 1 element sized nodelist + * @compile TestFunc.java XSLT.java + * @run main/othervm XSLT + * @author aleksej.efimov@oracle.com + */ + +import javax.xml.transform.*; +import javax.xml.transform.stream.*; +import java.io.ByteArrayOutputStream; + +public class XSLT { + static final String XMLTOTRANSFORM = "/in.xml"; + static final String XSLTRANSFORMER = "/test.xsl"; + static final String EXPECTEDRESULT = "inp1_1"; + + public static void main(String[] args) throws Exception { + ByteArrayOutputStream resStream = new ByteArrayOutputStream(); + TransformerFactory trf = TransformerFactory.newInstance(); + Transformer tr = trf.newTransformer( new StreamSource(System.getProperty("test.src", ".")+XSLTRANSFORMER)); + tr.transform( new StreamSource(System.getProperty("test.src", ".")+XMLTOTRANSFORM), new StreamResult(resStream)); + System.out.println("Transformation completed. Result:"+resStream.toString()); + if (!resStream.toString().equals(EXPECTEDRESULT)) + throw new RuntimeException("Incorrect transformation result"); + } +} diff --git a/jdk/test/javax/xml/jaxp/parsers/8024707/in.xml b/jdk/test/javax/xml/jaxp/parsers/8024707/in.xml new file mode 100644 index 00000000000..2cd31165815 --- /dev/null +++ b/jdk/test/javax/xml/jaxp/parsers/8024707/in.xml @@ -0,0 +1,4 @@ + + +inp1_1 + diff --git a/jdk/test/javax/xml/jaxp/parsers/8024707/test.xsl b/jdk/test/javax/xml/jaxp/parsers/8024707/test.xsl new file mode 100644 index 00000000000..59c506370a9 --- /dev/null +++ b/jdk/test/javax/xml/jaxp/parsers/8024707/test.xsl @@ -0,0 +1,10 @@ + + + + + + From 8fd60ce581a797dc26c2d34da7cbd33b25e5b939 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Mon, 30 Sep 2013 15:50:06 -0700 Subject: [PATCH 164/983] 7057785: Add note about optional support of recursive methods for self-referential Collection/Map Reviewed-by: scolebourne, darcy, mduigou --- jdk/src/share/classes/java/util/Collection.java | 7 +++++++ jdk/src/share/classes/java/util/Map.java | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/java/util/Collection.java b/jdk/src/share/classes/java/util/Collection.java index 36c7b9d9de1..2ae88727a06 100644 --- a/jdk/src/share/classes/java/util/Collection.java +++ b/jdk/src/share/classes/java/util/Collection.java @@ -104,6 +104,13 @@ import java.util.stream.StreamSupport; * the specified behavior of underlying {@link Object} methods wherever the * implementor deems it appropriate. * + *

    Some collection operations which perform recursive traversal of the + * collection may fail with an exception for self-referential instances where + * the collection directly or indirectly contains itself. This includes the + * {@code clone()}, {@code equals()}, {@code hashCode()} and {@code toString()} + * methods. Implementations may optionally handle the self-referential scenario, + * however most current implementations do not do so. + * *

    This interface is a member of the * * Java Collections Framework. diff --git a/jdk/src/share/classes/java/util/Map.java b/jdk/src/share/classes/java/util/Map.java index bf1ba8391c8..d1695ef23ee 100644 --- a/jdk/src/share/classes/java/util/Map.java +++ b/jdk/src/share/classes/java/util/Map.java @@ -86,10 +86,6 @@ import java.io.Serializable; * Such exceptions are marked as "optional" in the specification for this * interface. * - *

    This interface is a member of the - * - * Java Collections Framework. - * *

    Many methods in Collections Framework interfaces are defined * in terms of the {@link Object#equals(Object) equals} method. For * example, the specification for the {@link #containsKey(Object) @@ -107,6 +103,17 @@ import java.io.Serializable; * the specified behavior of underlying {@link Object} methods wherever the * implementor deems it appropriate. * + *

    Some map operations which perform recursive traversal of the map may fail + * with an exception for self-referential instances where the map directly or + * indirectly contains itself. This includes the {@code clone()}, + * {@code equals()}, {@code hashCode()} and {@code toString()} methods. + * Implementations may optionally handle the self-referential scenario, however + * most current implementations do not do so. + * + *

    This interface is a member of the + * + * Java Collections Framework. + * * @param the type of keys maintained by this map * @param the type of mapped values * From bf7051420838ce8ea89b9419d455622107343a1d Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Tue, 1 Oct 2013 10:23:00 -0700 Subject: [PATCH 165/983] 8025067: Unconditionally throw NPE if null op provided to Arrays.parallelPrefix Reviewed-by: henryjen, chegar, psandoz --- jdk/src/share/classes/java/util/Arrays.java | 8 + jdk/test/java/util/Arrays/ParallelPrefix.java | 146 +++++++++++++++++- 2 files changed, 147 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/java/util/Arrays.java b/jdk/src/share/classes/java/util/Arrays.java index 47c99ef7f82..43463a5aff6 100644 --- a/jdk/src/share/classes/java/util/Arrays.java +++ b/jdk/src/share/classes/java/util/Arrays.java @@ -1583,6 +1583,7 @@ public class Arrays { * @since 1.8 */ public static void parallelPrefix(T[] array, BinaryOperator op) { + Objects.requireNonNull(op); if (array.length > 0) new ArrayPrefixHelpers.CumulateTask<> (null, op, array, 0, array.length).invoke(); @@ -1606,6 +1607,7 @@ public class Arrays { */ public static void parallelPrefix(T[] array, int fromIndex, int toIndex, BinaryOperator op) { + Objects.requireNonNull(op); rangeCheck(array.length, fromIndex, toIndex); if (fromIndex < toIndex) new ArrayPrefixHelpers.CumulateTask<> @@ -1627,6 +1629,7 @@ public class Arrays { * @since 1.8 */ public static void parallelPrefix(long[] array, LongBinaryOperator op) { + Objects.requireNonNull(op); if (array.length > 0) new ArrayPrefixHelpers.LongCumulateTask (null, op, array, 0, array.length).invoke(); @@ -1649,6 +1652,7 @@ public class Arrays { */ public static void parallelPrefix(long[] array, int fromIndex, int toIndex, LongBinaryOperator op) { + Objects.requireNonNull(op); rangeCheck(array.length, fromIndex, toIndex); if (fromIndex < toIndex) new ArrayPrefixHelpers.LongCumulateTask @@ -1673,6 +1677,7 @@ public class Arrays { * @since 1.8 */ public static void parallelPrefix(double[] array, DoubleBinaryOperator op) { + Objects.requireNonNull(op); if (array.length > 0) new ArrayPrefixHelpers.DoubleCumulateTask (null, op, array, 0, array.length).invoke(); @@ -1695,6 +1700,7 @@ public class Arrays { */ public static void parallelPrefix(double[] array, int fromIndex, int toIndex, DoubleBinaryOperator op) { + Objects.requireNonNull(op); rangeCheck(array.length, fromIndex, toIndex); if (fromIndex < toIndex) new ArrayPrefixHelpers.DoubleCumulateTask @@ -1716,6 +1722,7 @@ public class Arrays { * @since 1.8 */ public static void parallelPrefix(int[] array, IntBinaryOperator op) { + Objects.requireNonNull(op); if (array.length > 0) new ArrayPrefixHelpers.IntCumulateTask (null, op, array, 0, array.length).invoke(); @@ -1738,6 +1745,7 @@ public class Arrays { */ public static void parallelPrefix(int[] array, int fromIndex, int toIndex, IntBinaryOperator op) { + Objects.requireNonNull(op); rangeCheck(array.length, fromIndex, toIndex); if (fromIndex < toIndex) new ArrayPrefixHelpers.IntCumulateTask diff --git a/jdk/test/java/util/Arrays/ParallelPrefix.java b/jdk/test/java/util/Arrays/ParallelPrefix.java index 072de79c42c..8d0d788247a 100644 --- a/jdk/test/java/util/Arrays/ParallelPrefix.java +++ b/jdk/test/java/util/Arrays/ParallelPrefix.java @@ -22,7 +22,7 @@ */ /** - * @test + * @test 8014076 8025067 * @summary unit test for Arrays.ParallelPrefix(). * @author Tristan Yan * @run testng ParallelPrefix @@ -54,30 +54,44 @@ public class ParallelPrefix { private final static int LARGE_ARRAY_SIZE = 1 << 12; private final static int[] ARRAY_SIZE_COLLECTION = new int[]{ - SMALL_ARRAY_SIZE, THRESHOLD_ARRAY_SIZE,MEDIUM_ARRAY_SIZE, LARGE_ARRAY_SIZE}; + SMALL_ARRAY_SIZE, + THRESHOLD_ARRAY_SIZE, + MEDIUM_ARRAY_SIZE, + LARGE_ARRAY_SIZE + }; @DataProvider public static Object[][] intSet(){ - return genericData(size -> IntStream.range(0, size).toArray(), new IntBinaryOperator[]{Integer::sum, Integer::min}); + return genericData(size -> IntStream.range(0, size).toArray(), + new IntBinaryOperator[]{ + Integer::sum, + Integer::min}); } @DataProvider public static Object[][] longSet(){ - return genericData(size -> LongStream.range(0, size).toArray(), new LongBinaryOperator[]{Long::sum, Long::min}); + return genericData(size -> LongStream.range(0, size).toArray(), + new LongBinaryOperator[]{ + Long::sum, + Long::min}); } @DataProvider public static Object[][] doubleSet(){ return genericData(size -> IntStream.range(0, size).mapToDouble(i -> (double)i).toArray(), - new DoubleBinaryOperator[]{Double::sum, Double::min}); + new DoubleBinaryOperator[]{ + Double::sum, + Double::min}); } @DataProvider public static Object[][] stringSet(){ Function stringsFunc = size -> IntStream.range(0, size).mapToObj(Integer::toString).toArray(String[]::new); - BinaryOperator cancatBop = String::concat; - return genericData(stringsFunc, new BinaryOperator[]{cancatBop}); + BinaryOperator concat = String::concat; + return genericData(stringsFunc, + (BinaryOperator[]) new BinaryOperator[]{ + concat }); } private static Object[][] genericData(Function generateFunc, OPS[] ops) { @@ -161,5 +175,123 @@ public class ParallelPrefix { Arrays.parallelPrefix(parallelRangeResult, op); assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex)); } + + @Test + public void testNPEs() { + // null array + assertThrows( () -> Arrays.parallelPrefix((int[]) null, Integer::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((long []) null, Long::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((double []) null, Double::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((String []) null, String::concat), + NullPointerException.class, "should throw NPE"); + + // null array w/ range + assertThrows( () -> Arrays.parallelPrefix((int[]) null, 0, 0, Integer::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((long []) null, 0, 0, Long::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((double []) null, 0, 0, Double::max), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix((String []) null, 0, 0, String::concat), + NullPointerException.class, "should throw NPE"); + + // null op + assertThrows( () -> Arrays.parallelPrefix(new int[] {}, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new long[] {}, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new double[] {}, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new String[] {}, null), + NullPointerException.class, "should throw NPE"); + + // null op w/ range + assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 0, 0, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 0, 0, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 0, 0, null), + NullPointerException.class, "should throw NPE"); + assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 0, 0, null), + NullPointerException.class, "should throw NPE"); + } + + @Test + public void testIAEs() { + assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 1, 0, Integer::max), + IllegalArgumentException.class, "should throw IAE"); + assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 1, 0, Long::max), + IllegalArgumentException.class, "should throw IAE"); + assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 1, 0, Double::max), + IllegalArgumentException.class, "should throw IAE"); + assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 1, 0, String::concat), + IllegalArgumentException.class, "should throw IAE"); + } + + @Test + public void testAIOBEs() { + // bad "fromIndex" + assertThrows( () -> Arrays.parallelPrefix(new int[] {}, -1, 0, Integer::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new long[] {}, -1, 0, Long::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new double[] {}, -1, 0, Double::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new String[] {}, -1, 0, String::concat), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + + // bad "toIndex" + assertThrows( () -> Arrays.parallelPrefix(new int[] {}, 0, 1, Integer::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new long[] {}, 0, 1, Long::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new double[] {}, 0, 1, Double::max), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + assertThrows( () -> Arrays.parallelPrefix(new String[] {}, 0, 1, String::concat), + ArrayIndexOutOfBoundsException.class, "should throw AIOBE"); + } + + // "library" code + + public interface Thrower { + + public void run() throws T; + } + + + public static void assertThrows(Thrower thrower, Class throwable) { + assertThrows(thrower, throwable, null); + } + + public static void assertThrows(Thrower thrower, Class throwable, String message) { + Throwable thrown; + try { + thrower.run(); + thrown = null; + } catch (Throwable caught) { + thrown = caught; + } + + assertInstance(thrown, throwable, + ((null != message) ? message : "") + + " Failed to throw " + throwable.getCanonicalName()); + } + + public static void assertThrows(Class throwable, String message, Thrower... throwers) { + for(Thrower thrower : throwers) { + assertThrows(thrower, throwable, message); + } + } + + public static void assertInstance(Object actual, Class expected) { + assertInstance(expected.isInstance(actual), null); + } + + public static void assertInstance(Object actual, Class expected, String message) { + assertTrue(expected.isInstance(actual), message); + } } From 2a3c1e97b2c2625ee66904abb195ece71f41b093 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Tue, 1 Oct 2013 10:37:05 -0700 Subject: [PATCH 166/983] 8025686: Update jdk repo netbeans projects to support NetBeans 7.4 for Java 8 support Reviewed-by: lancea, chegar --- jdk/make/netbeans/common/java-data-native.ent | 4 ++-- jdk/make/netbeans/common/java-data-no-native.ent | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/make/netbeans/common/java-data-native.ent b/jdk/make/netbeans/common/java-data-native.ent index 54c7486aafb..b50ea59afe7 100644 --- a/jdk/make/netbeans/common/java-data-native.ent +++ b/jdk/make/netbeans/common/java-data-native.ent @@ -31,14 +31,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + ${root}/src/share/classes ${root}/src/macosx/classes ${root}/src/solaris/classes ${root}/src/windows/classes ${bootstrap.jdk}/jre/lib/rt.jar - ${root}/build/${platform}-${arch}/classes + ${root}/../build/${platform}-${arch}/jdk/classes ${root}/build/${platform}-${arch}/docs/api 1.8 diff --git a/jdk/make/netbeans/common/java-data-no-native.ent b/jdk/make/netbeans/common/java-data-no-native.ent index 8e06c66c348..882072e0e9c 100644 --- a/jdk/make/netbeans/common/java-data-no-native.ent +++ b/jdk/make/netbeans/common/java-data-no-native.ent @@ -31,11 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + ${root}/src/share/classes ${bootstrap.jdk}/jre/lib/rt.jar - ${root}/build/${platform}-${arch}/classes + ${root}/../build/${platform}-${arch}/jdk/classes ${root}/build/${platform}-${arch}/docs/api 1.8 From b91ee238953c6148264605205a7bab4d7fcc8347 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 23 Sep 2013 19:51:40 +0400 Subject: [PATCH 167/983] 8001107: @Stable annotation for constant folding of lazily evaluated variables Co-authored-by: John Rose Reviewed-by: twisti, kvn, rbackman --- .../classes/java/lang/invoke/LambdaForm.java | 8 +- .../classes/java/lang/invoke/MethodType.java | 6 +- .../java/lang/invoke/MethodTypeForm.java | 9 ++- .../classes/java/lang/invoke/Stable.java | 73 +++++++++++++++++++ 4 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 jdk/src/share/classes/java/lang/invoke/Stable.java diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java index f5dcf40fd4d..96d83fb4705 100644 --- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java +++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java @@ -120,7 +120,7 @@ import java.util.Objects; class LambdaForm { final int arity; final int result; - final Name[] names; + @Stable final Name[] names; final String debugName; MemberName vmentry; // low-level behavior, or null if not yet prepared private boolean isCompiled; @@ -971,8 +971,8 @@ class LambdaForm { static class NamedFunction { final MemberName member; - MethodHandle resolvedHandle; - MethodHandle invoker; + @Stable MethodHandle resolvedHandle; + @Stable MethodHandle invoker; NamedFunction(MethodHandle resolvedHandle) { this(resolvedHandle.internalMemberName(), resolvedHandle); @@ -1267,7 +1267,7 @@ class LambdaForm { final char type; private short index; final NamedFunction function; - final Object[] arguments; + @Stable final Object[] arguments; private Name(int index, char type, NamedFunction function, Object[] arguments) { this.index = (short)index; diff --git a/jdk/src/share/classes/java/lang/invoke/MethodType.java b/jdk/src/share/classes/java/lang/invoke/MethodType.java index f55479f1345..5fc1f377b90 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodType.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java @@ -94,9 +94,9 @@ class MethodType implements java.io.Serializable { private final Class[] ptypes; // The remaining fields are caches of various sorts: - private MethodTypeForm form; // erased form, plus cached data about primitives - private MethodType wrapAlt; // alternative wrapped/unwrapped version - private Invokers invokers; // cache of handy higher-order adapters + private @Stable MethodTypeForm form; // erased form, plus cached data about primitives + private @Stable MethodType wrapAlt; // alternative wrapped/unwrapped version + private @Stable Invokers invokers; // cache of handy higher-order adapters /** * Check the given parameters for validity and store them into the final fields. diff --git a/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java b/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java index 1106e97baa3..f279035c447 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java @@ -51,12 +51,13 @@ final class MethodTypeForm { final MethodType basicType; // the canonical erasure, with primitives simplified // Cached adapter information: - /*lazy*/ MethodHandle genericInvoker; // JVM hook for inexact invoke - /*lazy*/ MethodHandle basicInvoker; // cached instance of MH.invokeBasic - /*lazy*/ MethodHandle namedFunctionInvoker; // cached helper for LF.NamedFunction + @Stable String typeString; // argument type signature characters + @Stable MethodHandle genericInvoker; // JVM hook for inexact invoke + @Stable MethodHandle basicInvoker; // cached instance of MH.invokeBasic + @Stable MethodHandle namedFunctionInvoker; // cached helper for LF.NamedFunction // Cached lambda form information, for basic types only: - final LambdaForm[] lambdaForms; + final @Stable LambdaForm[] lambdaForms; // Indexes into lambdaForms: static final int LF_INVVIRTUAL = 0, // DMH invokeVirtual diff --git a/jdk/src/share/classes/java/lang/invoke/Stable.java b/jdk/src/share/classes/java/lang/invoke/Stable.java new file mode 100644 index 00000000000..67a3b4fb67a --- /dev/null +++ b/jdk/src/share/classes/java/lang/invoke/Stable.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.invoke; + +import java.lang.annotation.*; + +/** + * A field may be annotated as stable if all of its component variables + * changes value at most once. + * A field's value counts as its component value. + * If the field is typed as an array, then all the non-null components + * of the array, of depth up to the rank of the field's array type, + * also count as component values. + * By extension, any variable (either array or field) which has annotated + * as stable is called a stable variable, and its non-null or non-zero + * value is called a stable value. + *

    + * Since all fields begin with a default value of null for references + * (resp., zero for primitives), it follows that this annotation indicates + * that the first non-null (resp., non-zero) value stored in the field + * will never be changed. + *

    + * If the field is not of an array type, there are no array elements, + * then the value indicated as stable is simply the value of the field. + * If the dynamic type of the field value is an array but the static type + * is not, the components of the array are not regarded as stable. + *

    + * If the field is an array type, then both the field value and + * all the components of the field value (if the field value is non-null) + * are indicated to be stable. + * If the field type is an array type with rank {@code N > 1}, + * then each component of the field value (if the field value is non-null), + * is regarded as a stable array of rank {@code N-1}. + *

    + * Fields which are declared {@code final} may also be annotated as stable. + * Since final fields already behave as stable values, such an annotation + * indicates no additional information, unless the type of the field is + * an array type. + *

    + * It is (currently) undefined what happens if a field annotated as stable + * is given a third value. In practice, if the JVM relies on this annotation + * to promote a field reference to a constant, it may be that the Java memory + * model would appear to be broken, if such a constant (the second value of the field) + * is used as the value of the field even after the field value has changed. + */ +/* package-private */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +@interface Stable { +} From 8e924e70a6cea5014feb17e6065c485153157ba8 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Wed, 18 Sep 2013 20:12:05 +0400 Subject: [PATCH 168/983] 8024616: JSR292: lazily initialize core NamedFunctions used for bootstrapping Reviewed-by: jrose --- .../java/lang/invoke/DirectMethodHandle.java | 110 +++++++++--------- .../java/lang/invoke/MethodHandleImpl.java | 24 ++-- 2 files changed, 73 insertions(+), 61 deletions(-) diff --git a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java index b9c10d827d2..9c054519b43 100644 --- a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java @@ -257,12 +257,12 @@ class DirectMethodHandle extends MethodHandle { assert(names.length == nameCursor); if (doesAlloc) { // names = { argx,y,z,... new C, init method } - names[NEW_OBJ] = new Name(NF_allocateInstance, names[DMH_THIS]); - names[GET_MEMBER] = new Name(NF_constructorMethod, names[DMH_THIS]); + names[NEW_OBJ] = new Name(Lazy.NF_allocateInstance, names[DMH_THIS]); + names[GET_MEMBER] = new Name(Lazy.NF_constructorMethod, names[DMH_THIS]); } else if (needsInit) { - names[GET_MEMBER] = new Name(NF_internalMemberNameEnsureInit, names[DMH_THIS]); + names[GET_MEMBER] = new Name(Lazy.NF_internalMemberNameEnsureInit, names[DMH_THIS]); } else { - names[GET_MEMBER] = new Name(NF_internalMemberName, names[DMH_THIS]); + names[GET_MEMBER] = new Name(Lazy.NF_internalMemberName, names[DMH_THIS]); } Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, GET_MEMBER+1, Object[].class); assert(outArgs[outArgs.length-1] == names[GET_MEMBER]); // look, shifted args! @@ -637,18 +637,18 @@ class DirectMethodHandle extends MethodHandle { final int RESULT = nameCursor-1; // either the call or the cast Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType()); if (needsInit) - names[INIT_BAR] = new Name(NF_ensureInitialized, names[DMH_THIS]); + names[INIT_BAR] = new Name(Lazy.NF_ensureInitialized, names[DMH_THIS]); if (needsCast && !isGetter) - names[PRE_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[SET_VALUE]); + names[PRE_CAST] = new Name(Lazy.NF_checkCast, names[DMH_THIS], names[SET_VALUE]); Object[] outArgs = new Object[1 + linkerType.parameterCount()]; assert(outArgs.length == (isGetter ? 3 : 4)); outArgs[0] = UNSAFE; if (isStatic) { - outArgs[1] = names[F_HOLDER] = new Name(NF_staticBase, names[DMH_THIS]); - outArgs[2] = names[F_OFFSET] = new Name(NF_staticOffset, names[DMH_THIS]); + outArgs[1] = names[F_HOLDER] = new Name(Lazy.NF_staticBase, names[DMH_THIS]); + outArgs[2] = names[F_OFFSET] = new Name(Lazy.NF_staticOffset, names[DMH_THIS]); } else { - outArgs[1] = names[OBJ_CHECK] = new Name(NF_checkBase, names[OBJ_BASE]); - outArgs[2] = names[F_OFFSET] = new Name(NF_fieldOffset, names[DMH_THIS]); + outArgs[1] = names[OBJ_CHECK] = new Name(Lazy.NF_checkBase, names[OBJ_BASE]); + outArgs[2] = names[F_OFFSET] = new Name(Lazy.NF_fieldOffset, names[DMH_THIS]); } if (!isGetter) { outArgs[3] = (needsCast ? names[PRE_CAST] : names[SET_VALUE]); @@ -656,7 +656,7 @@ class DirectMethodHandle extends MethodHandle { for (Object a : outArgs) assert(a != null); names[LINKER_CALL] = new Name(linker, outArgs); if (needsCast && isGetter) - names[POST_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[LINKER_CALL]); + names[POST_CAST] = new Name(Lazy.NF_checkCast, names[DMH_THIS], names[LINKER_CALL]); for (Name n : names) assert(n != null); String fieldOrStatic = (isStatic ? "Static" : "Field"); String lambdaName = (linkerName + fieldOrStatic); // significant only for debugging @@ -665,48 +665,54 @@ class DirectMethodHandle extends MethodHandle { return new LambdaForm(lambdaName, ARG_LIMIT, names, RESULT); } - private static final NamedFunction - NF_internalMemberName, - NF_internalMemberNameEnsureInit, - NF_ensureInitialized, - NF_fieldOffset, - NF_checkBase, - NF_staticBase, - NF_staticOffset, - NF_checkCast, - NF_allocateInstance, - NF_constructorMethod; - static { - try { - NamedFunction nfs[] = { - NF_internalMemberName = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("internalMemberName", Object.class)), - NF_internalMemberNameEnsureInit = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)), - NF_ensureInitialized = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("ensureInitialized", Object.class)), - NF_fieldOffset = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("fieldOffset", Object.class)), - NF_checkBase = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("checkBase", Object.class)), - NF_staticBase = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("staticBase", Object.class)), - NF_staticOffset = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("staticOffset", Object.class)), - NF_checkCast = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("checkCast", Object.class, Object.class)), - NF_allocateInstance = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("allocateInstance", Object.class)), - NF_constructorMethod = new NamedFunction(DirectMethodHandle.class - .getDeclaredMethod("constructorMethod", Object.class)) - }; - for (NamedFunction nf : nfs) { - // Each nf must be statically invocable or we get tied up in our bootstraps. - assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf.member)) : nf; - nf.resolve(); + /** + * Pre-initialized NamedFunctions for bootstrapping purposes. + * Factored in an inner class to delay initialization until first usage. + */ + private static class Lazy { + static final NamedFunction + NF_internalMemberName, + NF_internalMemberNameEnsureInit, + NF_ensureInitialized, + NF_fieldOffset, + NF_checkBase, + NF_staticBase, + NF_staticOffset, + NF_checkCast, + NF_allocateInstance, + NF_constructorMethod; + static { + try { + NamedFunction nfs[] = { + NF_internalMemberName = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("internalMemberName", Object.class)), + NF_internalMemberNameEnsureInit = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)), + NF_ensureInitialized = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("ensureInitialized", Object.class)), + NF_fieldOffset = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("fieldOffset", Object.class)), + NF_checkBase = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("checkBase", Object.class)), + NF_staticBase = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("staticBase", Object.class)), + NF_staticOffset = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("staticOffset", Object.class)), + NF_checkCast = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("checkCast", Object.class, Object.class)), + NF_allocateInstance = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("allocateInstance", Object.class)), + NF_constructorMethod = new NamedFunction(DirectMethodHandle.class + .getDeclaredMethod("constructorMethod", Object.class)) + }; + for (NamedFunction nf : nfs) { + // Each nf must be statically invocable or we get tied up in our bootstraps. + assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf.member)) : nf; + nf.resolve(); + } + } catch (ReflectiveOperationException ex) { + throw newInternalError(ex); } - } catch (ReflectiveOperationException ex) { - throw newInternalError(ex); } } } diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java index 5ab7f7adb7b..6918fec1cca 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -435,7 +435,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; // Spread the array. MethodHandle aload = MethodHandles.arrayElementGetter(spreadArgType); Name array = names[argIndex]; - names[nameCursor++] = new Name(NF_checkSpreadArgument, array, spreadArgCount); + names[nameCursor++] = new Name(Lazy.NF_checkSpreadArgument, array, spreadArgCount); for (int j = 0; j < spreadArgCount; i++, j++) { indexes[i] = nameCursor; names[nameCursor++] = new Name(aload, array, j); @@ -480,14 +480,20 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; throw new WrongMethodTypeException("Array is not of length "+n); } - private static final NamedFunction NF_checkSpreadArgument; - static { - try { - NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class - .getDeclaredMethod("checkSpreadArgument", Object.class, int.class)); - NF_checkSpreadArgument.resolve(); - } catch (ReflectiveOperationException ex) { - throw newInternalError(ex); + /** + * Pre-initialized NamedFunctions for bootstrapping purposes. + * Factored in an inner class to delay initialization until first usage. + */ + private static class Lazy { + static final NamedFunction NF_checkSpreadArgument; + static { + try { + NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class + .getDeclaredMethod("checkSpreadArgument", Object.class, int.class)); + NF_checkSpreadArgument.resolve(); + } catch (ReflectiveOperationException ex) { + throw newInternalError(ex); + } } } From 82705bda51b399bf0901d948fd5846d30107718d Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Wed, 18 Sep 2013 20:08:00 -0400 Subject: [PATCH 169/983] 8024826: (s) : Remove alt-rt.jar, used by +AggressiveOps Reviewed-by: alanb, chegar, dholmes, ksrini --- hotspot/src/share/vm/runtime/arguments.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index ef4da6da740..78b8338265d 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2409,21 +2409,6 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { return result; } - if (AggressiveOpts) { - // Insert alt-rt.jar between user-specified bootclasspath - // prefix and the default bootclasspath. os::set_boot_path() - // uses meta_index_dir as the default bootclasspath directory. - const char* altclasses_jar = "alt-rt.jar"; - size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 + - strlen(altclasses_jar); - char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len, mtInternal); - strcpy(altclasses_path, get_meta_index_dir()); - strcat(altclasses_path, altclasses_jar); - scp.add_suffix_to_prefix(altclasses_path); - scp_assembly_required = true; - FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal); - } - // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) result = parse_java_options_environment_variable(&scp, &scp_assembly_required); if (result != JNI_OK) { From 484e378a9d7a1c3a3c6dd4c8b1e2ddc0b4c1e884 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Wed, 18 Sep 2013 17:13:26 -0700 Subject: [PATCH 170/983] 8015249: javadoc fails to document static final fields in annotation types Reviewed-by: jjg --- .../html/AnnotationTypeFieldWriterImpl.java | 301 ++++++++++++++++++ ...nnotationTypeRequiredMemberWriterImpl.java | 14 + .../html/AnnotationTypeWriterImpl.java | 24 +- .../formats/html/HtmlDocletWriter.java | 5 + .../formats/html/WriterFactoryImpl.java | 13 + .../formats/html/markup/HtmlConstants.java | 12 + .../toolkit/AnnotationTypeFieldWriter.java | 132 ++++++++ .../AnnotationTypeRequiredMemberWriter.java | 16 +- .../toolkit/AnnotationTypeWriter.java | 9 +- .../internal/toolkit/WriterFactory.java | 12 + .../builders/AnnotationTypeBuilder.java | 17 +- .../builders/AnnotationTypeFieldBuilder.java | 240 ++++++++++++++ .../AnnotationTypeRequiredMemberBuilder.java | 13 +- .../toolkit/builders/BuilderFactory.java | 20 +- .../builders/MemberSummaryBuilder.java | 14 + .../internal/toolkit/resources/doclet.xml | 9 + .../toolkit/util/VisibleMemberMap.java | 12 +- .../TestAnnotationTypes.java | 35 +- .../pkg/AnnotationTypeField.java | 35 ++ .../TestNewLanguageFeatures.java | 4 +- 20 files changed, 897 insertions(+), 40 deletions(-) create mode 100644 langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java create mode 100644 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java create mode 100644 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java create mode 100644 langtools/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java new file mode 100644 index 00000000000..f4c7c68f565 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclets.formats.html; + +import java.io.*; + +import com.sun.javadoc.*; +import com.sun.tools.doclets.formats.html.markup.*; +import com.sun.tools.doclets.internal.toolkit.*; + +/** + * Writes annotation type field documentation in HTML format. + * + *

    This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + * + * @author Bhavesh Patel + */ +public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter + implements AnnotationTypeFieldWriter, MemberSummaryWriter { + + /** + * Construct a new AnnotationTypeFieldWriterImpl. + * + * @param writer the writer that will write the output. + * @param annotationType the AnnotationType that holds this member. + */ + public AnnotationTypeFieldWriterImpl(SubWriterHolderWriter writer, + AnnotationTypeDoc annotationType) { + super(writer, annotationType); + } + + /** + * {@inheritDoc} + */ + public Content getMemberSummaryHeader(ClassDoc classDoc, + Content memberSummaryTree) { + memberSummaryTree.addContent( + HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); + Content memberTree = writer.getMemberTreeHeader(); + writer.addSummaryHeader(this, classDoc, memberTree); + return memberTree; + } + + /** + * {@inheritDoc} + */ + public Content getMemberTreeHeader() { + return writer.getMemberTreeHeader(); + } + + /** + * {@inheritDoc} + */ + public void addAnnotationFieldDetailsMarker(Content memberDetails) { + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); + } + + /** + * {@inheritDoc} + */ + public void addAnnotationDetailsTreeHeader(ClassDoc classDoc, + Content memberDetailsTree) { + if (!writer.printedAnnotationFieldHeading) { + memberDetailsTree.addContent(writer.getMarkerAnchor( + "annotation_type_field_detail")); + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + writer.fieldDetailsLabel); + memberDetailsTree.addContent(heading); + writer.printedAnnotationFieldHeading = true; + } + } + + /** + * {@inheritDoc} + */ + public Content getAnnotationDocTreeHeader(MemberDoc member, + Content annotationDetailsTree) { + annotationDetailsTree.addContent( + writer.getMarkerAnchor(member.name())); + Content annotationDocTree = writer.getMemberTreeHeader(); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + heading.addContent(member.name()); + annotationDocTree.addContent(heading); + return annotationDocTree; + } + + /** + * {@inheritDoc} + */ + public Content getSignature(MemberDoc member) { + Content pre = new HtmlTree(HtmlTag.PRE); + writer.addAnnotationInfo(member, pre); + addModifiers(member, pre); + Content link = + writer.getLink(new LinkInfoImpl(configuration, + LinkInfoImpl.Kind.MEMBER, getType(member))); + pre.addContent(link); + pre.addContent(writer.getSpace()); + if (configuration.linksource) { + Content memberName = new StringContent(member.name()); + writer.addSrcLink(member, memberName, pre); + } else { + addName(member.name(), pre); + } + return pre; + } + + /** + * {@inheritDoc} + */ + public void addDeprecated(MemberDoc member, Content annotationDocTree) { + addDeprecatedInfo(member, annotationDocTree); + } + + /** + * {@inheritDoc} + */ + public void addComments(MemberDoc member, Content annotationDocTree) { + addComment(member, annotationDocTree); + } + + /** + * {@inheritDoc} + */ + public void addTags(MemberDoc member, Content annotationDocTree) { + writer.addTagsInfo(member, annotationDocTree); + } + + /** + * {@inheritDoc} + */ + public Content getAnnotationDetails(Content annotationDetailsTree) { + return getMemberTree(annotationDetailsTree); + } + + /** + * {@inheritDoc} + */ + public Content getAnnotationDoc(Content annotationDocTree, + boolean isLastContent) { + return getMemberTree(annotationDocTree, isLastContent); + } + + /** + * Close the writer. + */ + public void close() throws IOException { + writer.close(); + } + + /** + * {@inheritDoc} + */ + public void addSummaryLabel(Content memberTree) { + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + writer.getResource("doclet.Field_Summary")); + memberTree.addContent(label); + } + + /** + * {@inheritDoc} + */ + public String getTableSummary() { + return configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Field_Summary"), + configuration.getText("doclet.fields")); + } + + /** + * {@inheritDoc} + */ + public Content getCaption() { + return configuration.getResource("doclet.Fields"); + } + + /** + * {@inheritDoc} + */ + public String[] getSummaryTableHeader(ProgramElementDoc member) { + String[] header = new String[] { + writer.getModifierTypeHeader(), + configuration.getText("doclet.0_and_1", + configuration.getText("doclet.Fields"), + configuration.getText("doclet.Description")) + }; + return header; + } + + /** + * {@inheritDoc} + */ + public void addSummaryAnchor(ClassDoc cd, Content memberTree) { + memberTree.addContent(writer.getMarkerAnchor( + "annotation_type_field_summary")); + } + + /** + * {@inheritDoc} + */ + public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { + } + + /** + * {@inheritDoc} + */ + public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { + } + + /** + * {@inheritDoc} + */ + protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, + Content tdSummary) { + Content strong = HtmlTree.SPAN(HtmlStyle.strong, + writer.getDocLink(context, (MemberDoc) member, member.name(), false)); + Content code = HtmlTree.CODE(strong); + tdSummary.addContent(code); + } + + /** + * {@inheritDoc} + */ + protected void addInheritedSummaryLink(ClassDoc cd, + ProgramElementDoc member, Content linksTree) { + //Not applicable. + } + + /** + * {@inheritDoc} + */ + protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) { + MemberDoc m = (MemberDoc)member; + addModifierAndType(m, getType(m), tdSummaryType); + } + + /** + * {@inheritDoc} + */ + protected Content getDeprecatedLink(ProgramElementDoc member) { + return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, + (MemberDoc) member, ((MemberDoc)member).qualifiedName()); + } + + /** + * {@inheritDoc} + */ + protected Content getNavSummaryLink(ClassDoc cd, boolean link) { + if (link) { + return writer.getHyperLink("annotation_type_field_summary", + writer.getResource("doclet.navField")); + } else { + return writer.getResource("doclet.navField"); + } + } + + /** + * {@inheritDoc} + */ + protected void addNavDetailLink(boolean link, Content liNav) { + if (link) { + liNav.addContent(writer.getHyperLink("annotation_type_field_detail", + writer.getResource("doclet.navField"))); + } else { + liNav.addContent(writer.getResource("doclet.navField")); + } + } + + private Type getType(MemberDoc member) { + if (member instanceof FieldDoc) { + return ((FieldDoc) member).type(); + } else { + return ((MethodDoc) member).returnType(); + } + } +} diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java index a2fa33b68a5..1833d262db3 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java @@ -68,6 +68,20 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter return memberTree; } + /** + * {@inheritDoc} + */ + public Content getMemberTreeHeader() { + return writer.getMemberTreeHeader(); + } + + /** + * {@inheritDoc} + */ + public void addAnnotationDetailsMarker(Content memberDetails) { + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); + } + /** * {@inheritDoc} */ diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java index c1c4c9d40e6..c90ae08c27e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -275,13 +275,6 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter } } - /** - * {@inheritDoc} - */ - public void addAnnotationDetailsMarker(Content memberDetails) { - memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); - } - /** * {@inheritDoc} */ @@ -319,6 +312,12 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderFactory().getMemberSummaryBuilder(this); + Content liNavField = new HtmlTree(HtmlTag.LI); + addNavSummaryLink(memberSummaryBuilder, + "doclet.navField", + VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField); + addNavGap(liNavField); + ulNav.addContent(liNavField); Content liNavReq = new HtmlTree(HtmlTag.LI); addNavSummaryLink(memberSummaryBuilder, "doclet.navAnnotationTypeRequiredMember", @@ -364,12 +363,23 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderFactory().getMemberSummaryBuilder(this); + AbstractMemberWriter writerField = + ((AbstractMemberWriter) memberSummaryBuilder. + getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS)); AbstractMemberWriter writerOptional = ((AbstractMemberWriter) memberSummaryBuilder. getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL)); AbstractMemberWriter writerRequired = ((AbstractMemberWriter) memberSummaryBuilder. getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED)); + Content liNavField = new HtmlTree(HtmlTag.LI); + if (writerField != null){ + writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField); + } else { + liNavField.addContent(getResource("doclet.navField")); + } + addNavGap(liNavField); + ulNav.addContent(liNavField); if (writerOptional != null){ Content liNavOpt = new HtmlTree(HtmlTag.LI); writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index da36fedcff0..b3bfdcb1c3c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -84,6 +84,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { */ protected boolean printedAnnotationHeading = false; + /** + * To check whether annotation field heading is printed or not. + */ + protected boolean printedAnnotationFieldHeading = false; + /** * To check whether the repeated annotations is documented or not. */ diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java index b8a1775c7be..70bace904ab 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java @@ -104,6 +104,16 @@ public class WriterFactoryImpl implements WriterFactory { annotationType, prevType, nextType); } + /** + * {@inheritDoc} + */ + public AnnotationTypeFieldWriter + getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception { + return new AnnotationTypeFieldWriterImpl( + (SubWriterHolderWriter) annotationTypeWriter, + annotationTypeWriter.getAnnotationTypeDoc()); + } + /** * {@inheritDoc} */ @@ -202,6 +212,9 @@ public class WriterFactoryImpl implements WriterFactory { AnnotationTypeWriter annotationTypeWriter, int memberType) throws Exception { switch (memberType) { + case VisibleMemberMap.ANNOTATION_TYPE_FIELDS: + return (AnnotationTypeFieldWriterImpl) + getAnnotationTypeFieldWriter(annotationTypeWriter); case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL: return (AnnotationTypeOptionalMemberWriterImpl) getAnnotationTypeOptionalMemberWriter(annotationTypeWriter); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java index 7c32503e625..98651468f95 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java @@ -93,6 +93,12 @@ public class HtmlConstants { public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ==========="); + /** + * Marker to identify start of annotation type required member summary. + */ + public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = + new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ==========="); + /** * Marker to identify start of constructor summary. */ @@ -129,6 +135,12 @@ public class HtmlConstants { public static final Content START_OF_ANNOTATION_TYPE_DETAILS = new Comment("============ ANNOTATION TYPE MEMBER DETAIL ==========="); + /** + * Marker to identify start of annotation type field details. + */ + public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS = + new Comment("============ ANNOTATION TYPE FIELD DETAIL ==========="); + /** * Marker to identify start of method details. */ diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java new file mode 100644 index 00000000000..b556ccc7c86 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclets.internal.toolkit; + +import java.io.*; +import com.sun.javadoc.*; + +/** + * The interface for writing annotation type field output. + * + *

    This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + * + * + * @author Bhavesh Patel + * @since 1.8 + */ + +public interface AnnotationTypeFieldWriter { + + /** + * Add the annotation type member tree header. + * + * @return content tree for the member tree header + */ + public Content getMemberTreeHeader(); + + /** + * Add the annotation type field details marker. + * + * @param memberDetails the content tree representing field details marker + */ + public void addAnnotationFieldDetailsMarker(Content memberDetails); + + /** + * Add the annotation type details tree header. + * + * @param classDoc the annotation type being documented + * @param memberDetailsTree the content tree representing member details + */ + public void addAnnotationDetailsTreeHeader(ClassDoc classDoc, + Content memberDetailsTree); + + /** + * Get the annotation type documentation tree header. + * + * @param member the annotation type being documented + * @param annotationDetailsTree the content tree representing annotation type details + * @return content tree for the annotation type documentation header + */ + public Content getAnnotationDocTreeHeader(MemberDoc member, + Content annotationDetailsTree); + + /** + * Get the annotation type details tree. + * + * @param annotationDetailsTree the content tree representing annotation type details + * @return content tree for the annotation type details + */ + public Content getAnnotationDetails(Content annotationDetailsTree); + + /** + * Get the annotation type documentation. + * + * @param annotationDocTree the content tree representing annotation type documentation + * @param isLastContent true if the content to be added is the last content + * @return content tree for the annotation type documentation + */ + public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent); + + /** + * Get the signature for the given member. + * + * @param member the member being documented + * @return content tree for the annotation type signature + */ + public Content getSignature(MemberDoc member); + + /** + * Add the deprecated output for the given member. + * + * @param member the member being documented + * @param annotationDocTree content tree to which the deprecated information will be added + */ + public void addDeprecated(MemberDoc member, Content annotationDocTree); + + /** + * Add the comments for the given member. + * + * @param member the member being documented + * @param annotationDocTree the content tree to which the comments will be added + */ + public void addComments(MemberDoc member, Content annotationDocTree); + + /** + * Add the tags for the given member. + * + * @param member the member being documented + * @param annotationDocTree the content tree to which the tags will be added + */ + public void addTags(MemberDoc member, Content annotationDocTree); + + /** + * Close the writer. + */ + public void close() throws IOException; +} diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java index 28a18f9eaad..294d3217195 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.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 @@ -44,6 +44,20 @@ import com.sun.javadoc.*; public interface AnnotationTypeRequiredMemberWriter { + /** + * Add the annotation type member tree header. + * + * @return content tree for the member tree header + */ + public Content getMemberTreeHeader(); + + /** + * Add the annotation type details marker. + * + * @param memberDetails the content tree representing details marker + */ + public void addAnnotationDetailsMarker(Content memberDetails); + /** * Add the annotation type details tree header. * diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java index b65740edf87..c11dfd8527e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.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 @@ -103,13 +103,6 @@ public interface AnnotationTypeWriter { */ public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree); - /** - * Add the annotation type details marker. - * - * @param memberDetails the content tree representing member details marker - */ - public void addAnnotationDetailsMarker(Content memberDetails); - /** * Get the member tree header for the annotation type. * diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java index 1fa4c2f00e9..985fb646647 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java @@ -129,6 +129,18 @@ public interface WriterFactory { public abstract MethodWriter getMethodWriter(ClassWriter classWriter) throws Exception; + /** + * Return the annotation type field writer for a given annotation type. + * + * @param annotationTypeWriter the writer for the annotation type + * being documented. + * @return the member writer for the given annotation type. Return null if + * this writer is not supported by the doclet. + */ + public abstract AnnotationTypeFieldWriter + getAnnotationTypeFieldWriter( + AnnotationTypeWriter annotationTypeWriter) throws Exception; + /** * Return the annotation type optional member writer for a given annotation * type. diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java index 4de54026794..ae1de88d587 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java @@ -223,13 +223,22 @@ public class AnnotationTypeBuilder extends AbstractBuilder { Content memberDetailsTree = writer.getMemberTreeHeader(); buildChildren(node, memberDetailsTree); if (memberDetailsTree.isValid()) { - Content memberDetails = writer.getMemberTreeHeader(); - writer.addAnnotationDetailsMarker(memberDetails); - memberDetails.addContent(writer.getMemberTree(memberDetailsTree)); - annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails)); + annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree)); } } + /** + * Build the annotation type field documentation. + * + * @param node the XML element that specifies which components to document + * @param memberDetailsTree the content tree to which the documentation will be added + */ + public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree) + throws Exception { + configuration.getBuilderFactory(). + getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree); + } + /** * Build the annotation type optional member documentation. * diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java new file mode 100644 index 00000000000..4cbd4a20213 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclets.internal.toolkit.builders; + +import java.util.*; + +import com.sun.javadoc.*; +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +/** + * Builds documentation for annotation type fields. + * + *

    This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + * + * @author Bhavesh Patel + * @since 1.8 + */ +public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { + + /** + * The annotation type whose members are being documented. + */ + protected ClassDoc classDoc; + + /** + * The visible members for the given class. + */ + protected VisibleMemberMap visibleMemberMap; + + /** + * The writer to output the member documentation. + */ + protected AnnotationTypeFieldWriter writer; + + /** + * The list of members being documented. + */ + protected List members; + + /** + * The index of the current member that is being documented at this point + * in time. + */ + protected int currentMemberIndex; + + /** + * Construct a new AnnotationTypeFieldsBuilder. + * + * @param context the build context. + * @param classDoc the class whose members are being documented. + * @param writer the doclet specific writer. + * @param memberType the type of member that is being documented. + */ + protected AnnotationTypeFieldBuilder(Context context, + ClassDoc classDoc, + AnnotationTypeFieldWriter writer, + int memberType) { + super(context); + this.classDoc = classDoc; + this.writer = writer; + this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType, + configuration); + this.members = new ArrayList( + this.visibleMemberMap.getMembersFor(classDoc)); + if (configuration.getMemberComparator() != null) { + Collections.sort(this.members, configuration.getMemberComparator()); + } + } + + + /** + * Construct a new AnnotationTypeFieldBuilder. + * + * @param context the build context. + * @param classDoc the class whose members are being documented. + * @param writer the doclet specific writer. + */ + public static AnnotationTypeFieldBuilder getInstance( + Context context, ClassDoc classDoc, + AnnotationTypeFieldWriter writer) { + return new AnnotationTypeFieldBuilder(context, classDoc, + writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS); + } + + /** + * {@inheritDoc} + */ + public String getName() { + return "AnnotationTypeFieldDetails"; + } + + /** + * Returns a list of members that will be documented for the given class. + * This information can be used for doclet specific documentation + * generation. + * + * @param classDoc the {@link ClassDoc} we want to check. + * @return a list of members that will be documented. + */ + public List members(ClassDoc classDoc) { + return visibleMemberMap.getMembersFor(classDoc); + } + + /** + * Returns the visible member map for the members of this class. + * + * @return the visible member map for the members of this class. + */ + public VisibleMemberMap getVisibleMemberMap() { + return visibleMemberMap; + } + + /** + * summaryOrder.size() + */ + public boolean hasMembersToDocument() { + return members.size() > 0; + } + + /** + * Build the annotation type field documentation. + * + * @param node the XML element that specifies which components to document + * @param memberDetailsTree the content tree to which the documentation will be added + */ + public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree) { + buildAnnotationTypeMember(node, memberDetailsTree); + } + + /** + * Build the member documentation. + * + * @param node the XML element that specifies which components to document + * @param memberDetailsTree the content tree to which the documentation will be added + */ + public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) { + if (writer == null) { + return; + } + int size = members.size(); + if (size > 0) { + writer.addAnnotationFieldDetailsMarker(memberDetailsTree); + for (currentMemberIndex = 0; currentMemberIndex < size; + currentMemberIndex++) { + Content detailsTree = writer.getMemberTreeHeader(); + writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree); + Content annotationDocTree = writer.getAnnotationDocTreeHeader( + (MemberDoc) members.get(currentMemberIndex), + detailsTree); + buildChildren(node, annotationDocTree); + detailsTree.addContent(writer.getAnnotationDoc( + annotationDocTree, (currentMemberIndex == size - 1))); + memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); + } + } + } + + /** + * Build the signature. + * + * @param node the XML element that specifies which components to document + * @param annotationDocTree the content tree to which the documentation will be added + */ + public void buildSignature(XMLNode node, Content annotationDocTree) { + annotationDocTree.addContent( + writer.getSignature((MemberDoc) members.get(currentMemberIndex))); + } + + /** + * Build the deprecation information. + * + * @param node the XML element that specifies which components to document + * @param annotationDocTree the content tree to which the documentation will be added + */ + public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) { + writer.addDeprecated((MemberDoc) members.get(currentMemberIndex), + annotationDocTree); + } + + /** + * Build the comments for the member. Do nothing if + * {@link Configuration#nocomment} is set to true. + * + * @param node the XML element that specifies which components to document + * @param annotationDocTree the content tree to which the documentation will be added + */ + public void buildMemberComments(XMLNode node, Content annotationDocTree) { + if(! configuration.nocomment){ + writer.addComments((MemberDoc) members.get(currentMemberIndex), + annotationDocTree); + } + } + + /** + * Build the tag information. + * + * @param node the XML element that specifies which components to document + * @param annotationDocTree the content tree to which the documentation will be added + */ + public void buildTagInfo(XMLNode node, Content annotationDocTree) { + writer.addTags((MemberDoc) members.get(currentMemberIndex), + annotationDocTree); + } + + /** + * Return the annotation type field writer for this builder. + * + * @return the annotation type field writer for this builder. + */ + public AnnotationTypeFieldWriter getWriter() { + return writer; + } +} diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java index 84ded901668..29ad9df370d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java @@ -167,16 +167,17 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { } int size = members.size(); if (size > 0) { - writer.addAnnotationDetailsTreeHeader( - classDoc, memberDetailsTree); + writer.addAnnotationDetailsMarker(memberDetailsTree); for (currentMemberIndex = 0; currentMemberIndex < size; - currentMemberIndex++) { + currentMemberIndex++) { + Content detailsTree = writer.getMemberTreeHeader(); + writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree); Content annotationDocTree = writer.getAnnotationDocTreeHeader( - (MemberDoc) members.get(currentMemberIndex), - memberDetailsTree); + (MemberDoc) members.get(currentMemberIndex), detailsTree); buildChildren(node, annotationDocTree); - memberDetailsTree.addContent(writer.getAnnotationDoc( + detailsTree.addContent(writer.getAnnotationDoc( annotationDocTree, (currentMemberIndex == size - 1))); + memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); } } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java index 7152f2bd4f2..3509a06eac9 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java @@ -173,11 +173,27 @@ public class BuilderFactory { writerFactory.getMethodWriter(classWriter)); } + /** + * Return an instance of the annotation type fields builder for the given + * class. + * + * @return an instance of the annotation type field builder for the given + * annotation type. + */ + public AbstractBuilder getAnnotationTypeFieldsBuilder( + AnnotationTypeWriter annotationTypeWriter) + throws Exception { + return AnnotationTypeFieldBuilder.getInstance(context, + annotationTypeWriter.getAnnotationTypeDoc(), + writerFactory.getAnnotationTypeFieldWriter( + annotationTypeWriter)); + } + /** * Return an instance of the annotation type member builder for the given * class. * - * @return an instance of the annotation type memebr builder for the given + * @return an instance of the annotation type member builder for the given * annotation type. */ public AbstractBuilder getAnnotationTypeOptionalMemberBuilder( @@ -193,7 +209,7 @@ public class BuilderFactory { * Return an instance of the annotation type member builder for the given * class. * - * @return an instance of the annotation type memebr builder for the given + * @return an instance of the annotation type member builder for the given * annotation type. */ public AbstractBuilder getAnnotationTypeRequiredMemberBuilder( diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java index 8edb5dd2bad..fb4f14c8253 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java @@ -212,6 +212,20 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { addSummary(writer, visibleMemberMap, false, memberSummaryTree); } + /** + * Build the summary for fields. + * + * @param node the XML element that specifies which components to document + * @param memberSummaryTree the content tree to which the documentation will be added + */ + public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) { + MemberSummaryWriter writer = + memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_FIELDS]; + VisibleMemberMap visibleMemberMap = + visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_FIELDS]; + addSummary(writer, visibleMemberMap, false, memberSummaryTree); + } + /** * Build the summary for the optional members. * diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml index aabaafff250..f7f2f9c7458 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml @@ -66,10 +66,19 @@ + + + + + + + + + diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java index 6c9870405f3..15d41773b4e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java @@ -55,14 +55,15 @@ public class VisibleMemberMap { public static final int FIELDS = 2; public static final int CONSTRUCTORS = 3; public static final int METHODS = 4; - public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 5; - public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 6; - public static final int PROPERTIES = 7; + public static final int ANNOTATION_TYPE_FIELDS = 5; + public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 6; + public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 7; + public static final int PROPERTIES = 8; /** * The total number of member types is {@value}. */ - public static final int NUM_MEMBER_TYPES = 8; + public static final int NUM_MEMBER_TYPES = 9; public static final String STARTLEVEL = "start"; @@ -433,6 +434,9 @@ public class VisibleMemberMap { } ProgramElementDoc[] members = null; switch (kind) { + case ANNOTATION_TYPE_FIELDS: + members = cd.fields(filter); + break; case ANNOTATION_TYPE_MEMBER_OPTIONAL: members = cd.isAnnotationType() ? filter((AnnotationTypeDoc) cd, false) : diff --git a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java index 65a8e5d7cfa..5ffdbab12b2 100644 --- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java +++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.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 @@ -23,20 +23,19 @@ /* * @test - * @bug 4973609 + * @bug 4973609 8015249 * @summary Make sure that annotation types with 0 members does not have * extra HR tags. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestAnnotationTypes + * @build JavadocTester TestAnnotationTypes * @run main TestAnnotationTypes */ public class TestAnnotationTypes extends JavadocTester { //Test information. - private static final String BUG_ID = "4973609"; + private static final String BUG_ID = "4973609-8015249"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -44,7 +43,31 @@ public class TestAnnotationTypes extends JavadocTester { }; //Input for string search tests. - private static final String[][] TEST = NO_TEST; + private static final String[][] TEST = { + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + "

  • Summary: 
  • " + NL + "
  • Field | 
  • "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + "
  • Detail: 
  • " + NL + "
  • Field | 
  • "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + ""}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + "

    Field Summary

    "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + "
    "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + ""}, + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", + "

    DEFAULT_NAME

    " + NL + "
    public static final java." +
    +            "lang.String DEFAULT_NAME
    "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", + "
  • Summary: 
  • " + NL + "
  • Field | 
  • "}, + {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", + "
  • Detail: 
  • " + NL + "
  • Field | 
  • "}, + }; private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "
    " + NL + NL + "

    " + NL + NL + "

    " + diff --git a/langtools/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java b/langtools/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java new file mode 100644 index 00000000000..1dabafcc8db --- /dev/null +++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +import java.lang.annotation.*; + +/** + * This is just a test for annotation type fields. + */ +@Documented public @interface AnnotationTypeField { + String DEFAULT_NAME = "test"; + + String name() default DEFAULT_NAME; +} diff --git a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java index e16fd5450f2..ad0e024bfe6 100644 --- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -155,13 +155,13 @@ public class TestNewLanguageFeatures extends JavadocTester { //================================= //Make sure the summary links are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "

  • Summary: 
  • " + NL + + "
  • Summary: 
  • " + NL + "
  • Field | 
  • " + NL + "
  • " + "Required | 
  • " + NL + "
  • " + "Optional
  • "}, //Make sure the detail links are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "
  • Detail: 
  • " + NL + + "
  • Detail: 
  • " + NL + "
  • Field | 
  • " + NL + "
  • Element
  • "}, //Make sure the heading is correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", From 2be05076f8f9f4c589730cd174f85e656fcca7fb Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Wed, 18 Sep 2013 22:47:06 -0700 Subject: [PATCH 171/983] 8024096: some javadoc tests may contain false positive results Reviewed-by: jjg --- .../com/sun/javadoc/lib/JavadocTester.java | 77 ++++++++++++++++++- .../testDocFileDir/TestDocFileDir.java | 30 +++----- .../sun/javadoc/testEncoding/EncodeTest.java | 6 +- .../javadoc/testEncoding/TestEncoding.java | 8 +- .../testMethodTypes/TestMethodTypes.java | 6 +- .../javadoc/testProfiles/TestProfiles.java | 31 +++----- 6 files changed, 104 insertions(+), 54 deletions(-) diff --git a/langtools/test/com/sun/javadoc/lib/JavadocTester.java b/langtools/test/com/sun/javadoc/lib/JavadocTester.java index 23b8c80482e..e5af454fee8 100644 --- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java +++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,6 +57,7 @@ public abstract class JavadocTester { protected static final String SRC_DIR = System.getProperty("test.src", "."); protected static final String JAVA_VERSION = System.getProperty("java.version"); protected static final String[][] NO_TEST = new String[][] {}; + protected static final String[] NO_FILE_TEST = new String[] {}; /** * Use this as the file name in the test array when you want to search @@ -165,6 +166,26 @@ public abstract class JavadocTester { return returnCode; } + /** + * Execute the tests. + * + * @param tester the tester to execute + * @param args the arguments to pass to Javadoc + * @param testArray the array of tests + * @param negatedTestArray the array of negated tests + * @param fileTestArray the array of file tests + * @param negatedFileTestArray the array of negated file tests + * @return the return code for the execution of Javadoc + */ + public static int run(JavadocTester tester, String[] args, + String[][] testArray, String[][] negatedTestArray, String[] fileTestArray, + String[] negatedFileTestArray) { + int returnCode = tester.runJavadoc(args); + tester.runTestsOnHTML(testArray, negatedTestArray); + tester.runTestsOnFile(fileTestArray, negatedFileTestArray); + return returnCode; + } + /** * Execute Javadoc using the default doclet. * @@ -243,6 +264,19 @@ public abstract class JavadocTester { runTestsOnHTML(negatedTestArray, true); } + /** + * Run array of tests on the generated files. + * This method accepts a fileTestArray for testing if a file is generated + * and a negatedFileTestArray for testing if a file is not found. + * + * @param testArray the array of file tests + * @param negatedTestArray the array of negated file tests + */ + public void runTestsOnFile(String[] fileTestArray, String[] negatedFileTestArray) { + runTestsOnFile(fileTestArray, false); + runTestsOnFile(negatedFileTestArray, true); + } + /** * Run the array of tests on the resulting HTML. * @@ -265,9 +299,11 @@ public abstract class JavadocTester { fileString = readFileToString(testArray[i][0]); } catch (Error e) { if (isNegated) { - numTestsPassed += 1; - System.out.println("Passed\n not found:\n" - + stringToFind + " in non-existent " + testArray[i][0] + "\n"); + System.out.println( "FAILED" + "\n" + + "for bug " + getBugId() + + " (" + getBugName() + ") " + + "due to " + + e + "\n"); continue; } throw e; @@ -290,6 +326,39 @@ public abstract class JavadocTester { } } + /** + * Run the array of file tests on the generated files. + * + * @param testArray the array of file tests + * @param isNegated true if test is negated; false otherwise + */ + private void runTestsOnFile(String[] testArray, boolean isNegated) { + String fileName; + String failedString; + String passedString; + for (int i = 0; i < testArray.length; i++) { + numTestsRun++; + fileName = testArray[i]; + failedString = "FAILED" + "\n" + + "for bug " + getBugId() + " (" + getBugName() + ") " + + "file (" + fileName + ") found" + "\n"; + passedString = "Passed" + "\n" + + "file (" + fileName + ") not found" + "\n"; + System.out.print("Running subtest #" + numTestsRun + "... "); + try { + File file = new File(fileName); + if ((file.exists() && !isNegated) || (!file.exists() && isNegated)) { + numTestsPassed += 1; + System.out.println(passedString); + } else { + System.out.println(failedString); + } + } catch (Error e) { + System.err.println(e); + } + } + } + /** * Iterate through the list of given file pairs and diff each file. * diff --git a/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java b/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java index c5dd3468443..1d1be4e5e02 100644 --- a/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java +++ b/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ import java.io.File; /* * @test - * @bug 4258405 4973606 + * @bug 4258405 4973606 8024096 * @summary This test verifies that the doc-file directory does not * get overwritten when the sourcepath is equal to the destination * directory. @@ -47,25 +47,17 @@ public class TestDocFileDir extends JavadocTester { }; private static final String[][] NEGATED_TEST1 = NO_TEST; - private static final String[][] TEST2 = { - {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used1" + + private static final String[] FILE_TEST2 = { + BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used1" + FS + "testfile.txt", - "passed" - }, - {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used2" + - FS + "testfile.txt", - "passed" - }, + BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used2" + + FS + "testfile.txt" }; - private static final String[][] NEGATED_TEST2 = { - {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded1" + + private static final String[] FILE_NEGATED_TEST2 = { + BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded1" + FS + "testfile.txt", - "passed" - }, - {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded2" + - FS + "testfile.txt", - "passed" - }, + BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded2" + + FS + "testfile.txt" }; private static final String[][] TEST0 = { @@ -106,7 +98,7 @@ public class TestDocFileDir extends JavadocTester { run(tester, ARGS0, TEST0, NEGATED_TEST0); copyDir(SRC_DIR + FS + "pkg", BUG_ID + "-1"); run(tester, ARGS1, TEST1, NEGATED_TEST1); - run(tester, ARGS2, TEST2, NEGATED_TEST2); + run(tester, ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2); tester.printSummary(); } diff --git a/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java b/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java index 3fa762d5bf6..393ba8f5de2 100644 --- a/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java +++ b/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,9 @@ /** - * ɿ ! + * Testing en\u00e7\u00f4ded string. + * In the encoded comment string, Unicode U+00E7 is "Latin small letter C with cedilla" + * and Unicode U+00F4 is "Latin small letter O with circumflex" */ public class EncodeTest { } diff --git a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java index 0e9f1b6f101..db627b69156 100644 --- a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java +++ b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4661481 + * @bug 4661481 8024096 * @summary This test determines if the value of the -encoding option is * properly passed from Javadoc to the source file parser. * @author jamieh @@ -40,12 +40,12 @@ public class TestEncoding extends JavadocTester { //If ??? is found in the output, the source file was not read with the correct encoding setting. private static final String[][] NEGATED_TEST = { - {BUG_ID + FS + "EncodeTest.html", "???"} + {BUG_ID + FS + "EncodeTest.html", "??"} }; private static final String[] ARGS = new String[] { "-d", BUG_ID, "-sourcepath", SRC_DIR, - "-encoding", "SJIS", SRC_DIR + FS + "EncodeTest.java" + "-encoding", "iso-8859-1", SRC_DIR + FS + "EncodeTest.java" }; /** diff --git a/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java b/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java index 634ee4e4407..b0b79de0981 100644 --- a/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java +++ b/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8002304 + * @bug 8002304 8024096 * @summary Test for various method types in the method summary table * @author Bhavesh Patel * @library ../lib/ @@ -107,7 +107,7 @@ public class TestMethodTypes extends JavadocTester { "" }, - {BUG_ID + FS + "pkg" + FS + "D.html", + {BUG_ID + FS + "pkg1" + FS + "D.html", "" }, diff --git a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java index 8dda141791c..4dd70ea2359 100644 --- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java +++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8006124 8009684 8016921 8023700 + * @bug 8006124 8009684 8016921 8023700 8024096 * @summary Test javadoc support for profiles. * @author Bhavesh Patel, Evgeniya Stepanova * @library ../lib/ @@ -187,26 +187,6 @@ public class TestProfiles extends JavadocTester { } }; private static final String[][] PACKAGES_NEGATED_TEST = { - {PACKAGE_BUG_ID + FS + "profile-overview-frame.html", - "All Packages" - }, - {PACKAGE_BUG_ID + FS + "compact2-frame.html", - "" - + "All PackagesAll Profiles" - }, - {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", - "" - + "compact2 - pkg2" - }, - {PACKAGE_BUG_ID + FS + "compact2-summary.html", - "

    Profile compact2

    " - }, - {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", - "
    compact3
    " - }, {PACKAGE_BUG_ID + FS + "overview-frame.html", "All Profiles" @@ -222,6 +202,13 @@ public class TestProfiles extends JavadocTester { "" } }; + private static final String[] PACKAGES_NEGATED_FILE_TEST = { + PACKAGE_BUG_ID + FS + "profile-overview-frame.html", + PACKAGE_BUG_ID + FS + "compact2-frame.html", + PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", + PACKAGE_BUG_ID + FS + "compact2-summary.html", + PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html" + }; /** * The entry point of the test. @@ -231,7 +218,7 @@ public class TestProfiles extends JavadocTester { public static void main(String[] args) { TestProfiles tester = new TestProfiles(); run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST); - run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST); + run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST); tester.printSummary(); } From ca51d27ee3acebaf0475d789b58d3f1c4358c46b Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Thu, 19 Sep 2013 17:05:32 +0400 Subject: [PATCH 172/983] 8017248: Compiler Diacritics Issue Reviewed-by: naoto --- .../sun/tools/javac/file/RegularFileObject.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java index d99d729ac2c..055977f172e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java @@ -40,6 +40,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; import javax.tools.JavaFileObject; +import java.text.Normalizer; /** * A subclass of JavaFileObject representing regular files. @@ -57,6 +58,7 @@ class RegularFileObject extends BaseFileObject { private String name; final File file; private Reference absFileRef; + final static boolean isMacOS = System.getProperty("os.name", "").contains("OS X"); public RegularFileObject(JavacFileManager fileManager, File f) { this(fileManager, f.getName(), f); @@ -180,7 +182,19 @@ class RegularFileObject extends BaseFileObject { if (name.equals(n)) { return true; } - if (name.equalsIgnoreCase(n)) { + if (isMacOS && Normalizer.isNormalized(name, Normalizer.Form.NFD) + && Normalizer.isNormalized(n, Normalizer.Form.NFC)) { + // On Mac OS X it is quite possible to file name and class + // name normalized in a different way - in that case we have to normalize file name + // to the Normal Form Compised (NFC) + String normName = Normalizer.normalize(name, Normalizer.Form.NFC); + if (normName.equals(n)) { + this.name = normName; + return true; + } + } + + if (name.equalsIgnoreCase(n)) { try { // allow for Windows return file.getCanonicalFile().getName().equals(n); From a1f3a95880318c32169ff89dc8784a0dfc629eec Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Thu, 19 Sep 2013 11:04:23 -0400 Subject: [PATCH 173/983] 8024517: runtime/CDSCompressedKPtrs/XShareAuto.java failed with RuntimeException Make sure CDS is off by default when running server compiler. Reviewed-by: dholmes, coleenp --- hotspot/src/share/vm/runtime/arguments.cpp | 22 +++++++++++-------- .../CDSCompressedKPtrs/XShareAuto.java | 11 ++-------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 78b8338265d..36827a518cf 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1096,6 +1096,7 @@ void Arguments::set_mode_flags(Mode mode) { } } +#if defined(COMPILER2) || defined(_LP64) || !INCLUDE_CDS // Conflict: required to use shared spaces (-Xshare:on), but // incompatible command line options were chosen. @@ -1108,6 +1109,7 @@ static void no_shared_spaces() { FLAG_SET_DEFAULT(UseSharedSpaces, false); } } +#endif void Arguments::set_tiered_flags() { // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. @@ -1492,16 +1494,18 @@ void Arguments::set_ergonomics_flags() { FLAG_SET_ERGO(bool, UseParallelGC, true); } } - // Shared spaces work fine with other GCs but causes bytecode rewriting - // to be disabled, which hurts interpreter performance and decreases - // server performance. On server class machines, keep the default - // off unless it is asked for. Future work: either add bytecode rewriting - // at link time, or rewrite bytecodes in non-shared methods. - if (!DumpSharedSpaces && !RequireSharedSpaces && - (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { - no_shared_spaces(); - } } +#ifdef COMPILER2 + // Shared spaces work fine with other GCs but causes bytecode rewriting + // to be disabled, which hurts interpreter performance and decreases + // server performance. When -server is specified, keep the default off + // unless it is asked for. Future work: either add bytecode rewriting + // at link time, or rewrite bytecodes in non-shared methods. + if (!DumpSharedSpaces && !RequireSharedSpaces && + (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { + no_shared_spaces(); + } +#endif #ifndef ZERO #ifdef _LP64 diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java index 7f36977ec70..9bd68e11733 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java @@ -33,16 +33,9 @@ import com.oracle.java.testlibrary.*; public class XShareAuto { public static void main(String[] args) throws Exception { - if (!Platform.is64bit()) { - System.out.println("ObjectAlignmentInBytes for CDS is only " + - "supported on 64bit platforms; this plaform is " + - System.getProperty("sun.arch.data.model")); - System.out.println("Skipping the test"); - return; - } ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", - "-Xshare:dump"); + "-server", "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Loading classes to share"); output.shouldHaveExitValue(0); From 1c9e7a8edc07aa9038adca1cd97d9e98a36c7b15 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 19 Sep 2013 17:05:08 +0200 Subject: [PATCH 174/983] 8022567: Javac Should Generate Warnings For Raw Array Type Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Check.java | 18 ++++++++++++------ .../tools/javac/warnings/6747671/T6747671.java | 9 ++++++++- .../tools/javac/warnings/6747671/T6747671.out | 4 +++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index 5f6d1886bd8..d3f94fdba82 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -1245,6 +1245,7 @@ public class Check { */ class Validator extends JCTree.Visitor { + boolean checkRaw; boolean isOuter; Env env; @@ -1254,7 +1255,7 @@ public class Check { @Override public void visitTypeArray(JCArrayTypeTree tree) { - tree.elemtype.accept(this); + validateTree(tree.elemtype, checkRaw, isOuter); } @Override @@ -1345,15 +1346,20 @@ public class Check { } public void validateTree(JCTree tree, boolean checkRaw, boolean isOuter) { - try { - if (tree != null) { - this.isOuter = isOuter; + if (tree != null) { + boolean prevCheckRaw = this.checkRaw; + this.checkRaw = checkRaw; + this.isOuter = isOuter; + + try { tree.accept(this); if (checkRaw) checkRaw(tree, env); + } catch (CompletionFailure ex) { + completionError(tree.pos(), ex); + } finally { + this.checkRaw = prevCheckRaw; } - } catch (CompletionFailure ex) { - completionError(tree.pos(), ex); } } diff --git a/langtools/test/tools/javac/warnings/6747671/T6747671.java b/langtools/test/tools/javac/warnings/6747671/T6747671.java index c8060a06afd..2bb67ac132f 100644 --- a/langtools/test/tools/javac/warnings/6747671/T6747671.java +++ b/langtools/test/tools/javac/warnings/6747671/T6747671.java @@ -1,6 +1,6 @@ /** * @test /nodynamiccopyright/ - * @bug 6747671 + * @bug 6747671 8022567 * @summary -Xlint:rawtypes * @compile/ref=T6747671.out -XDrawDiagnostics -Xlint:rawtypes T6747671.java */ @@ -32,4 +32,11 @@ class T6747671 { A a2 = new A() {};//raw warning (2) a2.new Z() {};//raw warning } + + @TA B @TA[] arr = new @TA B @TA [0];//JDK-8022567: raw warning (2) + Class classes1;//no warning + Class[] classes2;//no warning + + @java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) + @interface TA { } } diff --git a/langtools/test/tools/javac/warnings/6747671/T6747671.out b/langtools/test/tools/javac/warnings/6747671/T6747671.out index 43069572c62..518804d68b5 100644 --- a/langtools/test/tools/javac/warnings/6747671/T6747671.out +++ b/langtools/test/tools/javac/warnings/6747671/T6747671.out @@ -7,4 +7,6 @@ T6747671.java:29:28: compiler.warn.raw.class.use: T6747671.B, T6747671.B T6747671.java:32:9: compiler.warn.raw.class.use: T6747671.A, T6747671.A T6747671.java:32:20: compiler.warn.raw.class.use: T6747671.A, T6747671.A T6747671.java:33:16: compiler.warn.raw.class.use: T6747671.A.Z, T6747671.A.Z -9 warnings +T6747671.java:36:9: compiler.warn.raw.class.use: @T6747671.TA T6747671.B, T6747671.B +T6747671.java:36:27: compiler.warn.raw.class.use: T6747671.B, T6747671.B +11 warnings From 5db62ec900bbdb41ba2a927eb41787326ae382f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20=C3=96hrstr=C3=B6m?= Date: Thu, 19 Sep 2013 08:26:26 -0700 Subject: [PATCH 175/983] 8024609: sjavac assertion fails during call to BuildState.collectArtifacts Reviewed-by: jjg --- .../classes/com/sun/tools/sjavac/BuildState.java | 16 ++++++++++------ .../share/classes/com/sun/tools/sjavac/Main.java | 8 ++++---- .../com/sun/tools/sjavac/server/JavacServer.java | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java b/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java index 9b90950290c..43606b2b715 100644 --- a/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java +++ b/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,12 +81,13 @@ public class BuildState { } /** - * Collect all packages, sources and artifacts for all modules - * into the build state. + * Store references to all packages, sources and artifacts for all modules + * into the build state. I.e. flatten the module tree structure + * into global maps stored in the BuildState for easy access. * * @param m The set of modules. */ - public void collectPackagesSourcesAndArtifacts(Map m) { + public void flattenPackagesSourcesAndArtifacts(Map m) { modules = m; // Extract all the found packages. for (Module i : modules.values()) { @@ -121,11 +122,12 @@ public class BuildState { } /** - * Collect all the artifacts of all modules and packages. + * Store references to all artifacts found in the module tree into the maps + * stored in the build state. * * @param m The set of modules. */ - public void collectArtifacts(Map m) { + public void flattenArtifacts(Map m) { modules = m; // Extract all the found packages. for (Module i : modules.values()) { @@ -270,6 +272,8 @@ public class BuildState { Module mnew = findModuleFromPackageName(pkg); Package pprev = prev.packages().get(pkg); mnew.addPackage(pprev); + // Do not forget to update the flattened data. + packages.put(pkg, pprev); } } } diff --git a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java index f0ed51432ee..183ebb56e27 100644 --- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java @@ -274,7 +274,7 @@ public class Main { // findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true); // Add the set of sources to the build database. - javac_state.now().collectPackagesSourcesAndArtifacts(modules); + javac_state.now().flattenPackagesSourcesAndArtifacts(modules); javac_state.now().checkInternalState("checking sources", false, sources); javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to); javac_state.setVisibleSources(sources_to_link_to); @@ -311,7 +311,7 @@ public class Main { Map generated_sources = new HashMap(); Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null, generated_sources, modules, current_module, false, true, false); - javac_state.now().collectPackagesSourcesAndArtifacts(modules); + javac_state.now().flattenPackagesSourcesAndArtifacts(modules); // Recheck the the source files and their timestamps again. javac_state.checkSourceStatus(true); @@ -336,8 +336,8 @@ public class Main { // Only update the state if the compile went well. if (rc[0]) { javac_state.save(); - // Collect all the artifacts. - javac_state.now().collectArtifacts(modules); + // Reflatten only the artifacts. + javac_state.now().flattenArtifacts(modules); // Remove artifacts that were generated during the last compile, but not this one. javac_state.removeSuperfluousArtifacts(recently_compiled); } diff --git a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java index 2e59f275fd8..66e3022a76e 100644 --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java @@ -464,7 +464,7 @@ public class JavacServer { PrintStream err) { int rc = -3; try { - int port = portFile.getPort(); + int port = portFile.containsPortInfo() ? portFile.getPort() : 0; if (port == 0) { return ERROR_BUT_TRY_AGAIN; } From 721272b6c0d7cf5690561c5ae75fef3127ef7abc Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Thu, 19 Sep 2013 22:33:21 +0400 Subject: [PATCH 176/983] 7144065: [macosx] Orphaned Choice popup window Reviewed-by: anthony, serb --- .../classes/sun/lwawt/LWChoicePeer.java | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java index dc781d3d682..c90300e8dcf 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -26,13 +26,13 @@ package sun.lwawt; -import java.awt.Choice; -import java.awt.Point; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.peer.ChoicePeer; -import javax.swing.JComboBox; +import javax.accessibility.Accessible; +import javax.swing.*; final class LWChoicePeer extends LWComponentPeer> implements ChoicePeer, ItemListener { @@ -159,5 +159,32 @@ final class LWChoicePeer extends LWComponentPeer> } super.setSelectedItem(anObject); } + + @Override + public void firePopupMenuWillBecomeVisible() { + super.firePopupMenuWillBecomeVisible(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JPopupMenu popupMenu = getPopupMenu(); + if (popupMenu != null) { + if (popupMenu.getInvoker() != LWChoicePeer.this.getTarget()) { + popupMenu.setVisible(false); + popupMenu.show(LWChoicePeer.this.getTarget(), 0, 0); + } + } + } + }); + } + + private JPopupMenu getPopupMenu() { + for (int i = 0; i < getAccessibleContext().getAccessibleChildrenCount(); i++) { + Accessible child = getAccessibleContext().getAccessibleChild(i); + if (child instanceof JPopupMenu) { + return (JPopupMenu) child; + } + } + return null; + } } } From bf404f9ad8af77e55156e84c1765fb5cfd38813b Mon Sep 17 00:00:00 2001 From: Leonid Romanov Date: Thu, 19 Sep 2013 23:46:15 +0400 Subject: [PATCH 177/983] 7129133: [macosx] Accelerators are displayed as Meta instead of the Command symbol Reviewed-by: anthony, serb --- jdk/makefiles/GensrcProperties.gmk | 7 ++ .../sun/awt/resources/awtosx.properties | 71 +++++++++++++++++++ .../classes/sun/lwawt/macosx/LWCToolkit.java | 23 +++++- jdk/src/share/classes/java/awt/Toolkit.java | 24 +++++++ .../share/classes/sun/awt/AWTAccessor.java | 27 +++++++ .../ToolkitPropertyTest/bug7129133.java | 50 +++++++++++++ 6 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 jdk/src/macosx/classes/sun/awt/resources/awtosx.properties create mode 100644 jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java diff --git a/jdk/makefiles/GensrcProperties.gmk b/jdk/makefiles/GensrcProperties.gmk index 3ef3a538475..1e29376f6ad 100644 --- a/jdk/makefiles/GensrcProperties.gmk +++ b/jdk/makefiles/GensrcProperties.gmk @@ -253,6 +253,13 @@ ifeq ($(OPENJDK_TARGET_OS),windows) $(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\ ListResourceBundle,%zh_TW,%zh_HK)) endif +# os x specific awt properties +ifeq ($(OPENJDK_TARGET_OS),macosx) +$(eval $(call add_properties_to_compile,SUN_AWT,\ + $(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\ + $(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\ + ListResourceBundle)) +endif #sun/launcher/resources $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\ diff --git a/jdk/src/macosx/classes/sun/awt/resources/awtosx.properties b/jdk/src/macosx/classes/sun/awt/resources/awtosx.properties new file mode 100644 index 00000000000..bfc3bd01b3b --- /dev/null +++ b/jdk/src/macosx/classes/sun/awt/resources/awtosx.properties @@ -0,0 +1,71 @@ +# +# OS X specific AWT properties +# + +# Modifier names +AWT.shift=\u21e7 +AWT.control=\u2303 +AWT.alt=\u2325 +AWT.meta=\u2318 +AWT.altGraph=\u2325 + +# Key names +AWT.enter=\u23ce +AWT.backSpace=\u232b +AWT.tab=\u21e5 +AWT.cancel=\u238b +AWT.clear=\u2327 +AWT.capsLock=\u21ea +AWT.escape=\u238b +AWT.space=\u2423 +AWT.pgup=\u21de +AWT.pgdn=\u21df +AWT.end=\u2198 +AWT.home=\u2196 +AWT.left=\u2190 +AWT.up=\u2191 +AWT.right=\u2192 +AWT.down=\u2193 +AWT.comma=, +AWT.period=. +AWT.slash=/ +AWT.semicolon=; +AWT.equals=\u003d +AWT.openBracket=[ +AWT.backSlash=\\ +AWT.closeBracket=] +AWT.multiply=\u2328 * +AWT.add=\u2328 + +AWT.separator=\u2328 , +AWT.separater=\u2328 , +AWT.subtract=\u2328 - +AWT.decimal=\u2328 . +AWT.divide=\u2328 / +AWT.delete=\u2326 +AWT.printScreen=\u2399 +AWT.backQuote=` +AWT.quote=' +AWT.ampersand=& +AWT.asterisk=* +AWT.quoteDbl=" +AWT.Less=< +AWT.greater=> +AWT.braceLeft=[ +AWT.braceRight=] +AWT.at=@ +AWT.colon=: +AWT.circumflex=^ +AWT.dollar=$ +AWT.euro=\u20ac +AWT.exclamationMark=! +AWT.invertedExclamationMark=\u00a1 +AWT.leftParenthesis=( +AWT.numberSign=# +AWT.plus=+ +AWT.minus=- +AWT.rightParenthesis=) +AWT.underscore=_ + +# Numeric Keypad +AWT.numpad=\u2328 + diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index cf395f3ab86..d698845e558 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -44,6 +44,8 @@ import sun.lwawt.*; import sun.lwawt.LWWindowPeer.PeerType; import sun.security.action.GetBooleanAction; +import sun.util.CoreResourceBundleControl; + class NamedCursor extends Cursor { NamedCursor(String name) { super(name); @@ -67,13 +69,28 @@ public final class LWCToolkit extends LWToolkit { static { System.err.flush(); - java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() { - public Object run() { + + ResourceBundle platformResources = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public ResourceBundle run() { + ResourceBundle platformResources = null; + try { + platformResources = + ResourceBundle.getBundle("sun.awt.resources.awtosx", + CoreResourceBundleControl.getRBControlInstance()); + } catch (MissingResourceException e) { + // No resource file; defaults will be used. + } + System.loadLibrary("awt"); System.loadLibrary("fontmanager"); - return null; + + return platformResources; } }); + + AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources); + if (!GraphicsEnvironment.isHeadless()) { initIDs(); } diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index ac2dc2244b8..6b669d33677 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -56,6 +56,7 @@ import sun.awt.HeadlessToolkit; import sun.awt.NullComponentPeer; import sun.awt.PeerEvent; import sun.awt.SunToolkit; +import sun.awt.AWTAccessor; import sun.security.util.SecurityConstants; import sun.util.CoreResourceBundleControl; @@ -1599,6 +1600,12 @@ public abstract class Toolkit { * here, so that only one copy is maintained. */ private static ResourceBundle resources; + private static ResourceBundle platformResources; + + // called by platform toolkit + private static void setPlatformResources(ResourceBundle bundle) { + platformResources = bundle; + } /** * Initialize JNI field and method ids @@ -1647,6 +1654,14 @@ public abstract class Toolkit { } static { + AWTAccessor.setToolkitAccessor( + new AWTAccessor.ToolkitAccessor() { + @Override + public void setPlatformResources(ResourceBundle bundle) { + Toolkit.setPlatformResources(bundle); + } + }); + java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Void run() { @@ -1674,6 +1689,15 @@ public abstract class Toolkit { * This method returns defaultValue if the property is not found. */ public static String getProperty(String key, String defaultValue) { + // first try platform specific bundle + if (platformResources != null) { + try { + return platformResources.getString(key); + } + catch (MissingResourceException e) {} + } + + // then shared one if (resources != null) { try { return resources.getString(key); diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index 2b7f73ccd31..d604768f5df 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -39,6 +39,7 @@ import java.lang.reflect.InvocationTargetException; import java.security.AccessControlContext; import java.io.File; +import java.util.ResourceBundle; import java.util.Vector; /** @@ -704,6 +705,13 @@ public final class AWTAccessor { boolean isSequencedEvent(AWTEvent event); } + /* + * An accessor for the Toolkit class + */ + public interface ToolkitAccessor { + void setPlatformResources(ResourceBundle bundle); + } + /* * Accessor instances are initialized in the static initializers of * corresponding AWT classes by using setters defined below. @@ -731,6 +739,7 @@ public final class AWTAccessor { private static TrayIconAccessor trayIconAccessor; private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor; private static SequencedEventAccessor sequencedEventAccessor; + private static ToolkitAccessor toolkitAccessor; /* * Set an accessor object for the java.awt.Component class. @@ -1124,4 +1133,22 @@ public final class AWTAccessor { // (so not a single instance of the event has been created). return sequencedEventAccessor; } + + /* + * Set an accessor object for the java.awt.Toolkit class. + */ + public static void setToolkitAccessor(ToolkitAccessor ta) { + toolkitAccessor = ta; + } + + /* + * Get the accessor object for the java.awt.Toolkit class. + */ + public static ToolkitAccessor getToolkitAccessor() { + if (toolkitAccessor == null) { + unsafe.ensureClassInitialized(Toolkit.class); + } + + return toolkitAccessor; + } } diff --git a/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java new file mode 100644 index 00000000000..4578798066e --- /dev/null +++ b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java @@ -0,0 +1,50 @@ +/* + * 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 7129133 + * @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol + * @author leonid.romanov@oracle.com + * @run main bug7129133 + */ + +import java.awt.*; + +public class bug7129133 { + public static void main(String[] args) throws Exception { + if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + System.out.println("This test is for MacOS only. Automatically passed on other platforms."); + return; + } + + Toolkit.getDefaultToolkit(); + + String cmdSymbol = "\u2318"; + String val = Toolkit.getProperty("AWT.meta", "Meta"); + + if (!val.equals(cmdSymbol)) { + throw new Exception("Wrong property value for AWT.meta. Expected: " + cmdSymbol + ", actual: " + val); + } + } +} From e3d450e3d306cdcd8f2c3762239e96b21d31176c Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Thu, 19 Sep 2013 20:57:37 +0100 Subject: [PATCH 178/983] 8024437: Inferring the exception thrown: sometimes fails to compile Reviewed-by: jjg --- .../com/sun/tools/javac/code/Flags.java | 2 +- .../com/sun/tools/javac/jvm/ClassReader.java | 7 ++ .../ExceptionInferenceFromClassFileTest.java | 74 +++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java index 3a4084ed2a8..2f59cfab7fd 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java @@ -261,7 +261,7 @@ public class Flags { public static final long SIGNATURE_POLYMORPHIC = 1L<<46; /** - * Flag that marks inference variables used in a 'throws' clause + * Flag that indicates that an inference variable is used in a 'throws' clause. */ public static final long THROWS = 1L<<47; diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index d3d9d302f1e..1b57b13cf36 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -56,6 +56,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTag.CLASS; +import static com.sun.tools.javac.code.TypeTag.TYPEVAR; import static com.sun.tools.javac.jvm.ClassFile.*; import static com.sun.tools.javac.jvm.ClassFile.Version.*; @@ -703,6 +704,12 @@ public class ClassReader { sigp++; thrown = thrown.prepend(sigToType()); } + // if there is a typevar in the throws clause we should state it. + for (List l = thrown; l.nonEmpty(); l = l.tail) { + if (l.head.hasTag(TYPEVAR)) { + l.head.tsym.flags_field |= THROWS; + } + } return new MethodType(argtypes, restype, thrown.reverse(), diff --git a/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java b/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java new file mode 100644 index 00000000000..250b18a0614 --- /dev/null +++ b/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024437 + * @summary Inferring the exception thrown by a lambda: sometimes fails to compile + * @library /tools/javac/lib + * @build ToolBox + * @run main ExceptionInferenceFromClassFileTest + */ + +import java.nio.file.Files; +import java.nio.file.Paths; + +public class ExceptionInferenceFromClassFileTest { + + static final String ABSrc = + "class B {\n" + + " public static void t(A a) throws E {\n" + + " a.run();\n" + + " }\n" + + "}\n" + + + "interface A {\n" + + " void run() throws E;\n" + + "}"; + + static final String CSrc = + "class C {\n" + + " public void d() {\n" + + " B.t(null);\n" + + " }\n" + + "}"; + + public static void main(String[] args) throws Exception { + Files.createDirectory(Paths.get("out")); + + ToolBox.JavaToolArgs compileABParams = + new ToolBox.JavaToolArgs() + .setOptions("-d", "out") + .setSources(ABSrc); + ToolBox.javac(compileABParams); + + ToolBox.JavaToolArgs compileCParams = + new ToolBox.JavaToolArgs() + .setOptions("-d", "out", "-cp", "out") + .setSources(CSrc); + ToolBox.javac(compileCParams); + } + +} From 8b909ba5580011b7d810eef7cf9781dc83a1d6b3 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 19 Sep 2013 19:18:37 -0700 Subject: [PATCH 179/983] 8025110: TreeCopier does not correctly copy LabeledStatementTree Reviewed-by: jjg --- .../src/share/classes/com/sun/tools/javac/tree/TreeCopier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java index aa2ce423b4b..1ccbb53518e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java @@ -234,7 +234,7 @@ public class TreeCopier

    implements TreeVisitor { public JCTree visitLabeledStatement(LabeledStatementTree node, P p) { JCLabeledStatement t = (JCLabeledStatement) node; JCStatement body = copy(t.body, p); - return M.at(t.pos).Labelled(t.label, t.body); + return M.at(t.pos).Labelled(t.label, body); } public JCTree visitLiteral(LiteralTree node, P p) { From de71bd104952b7e51b61656171a2116568673ac8 Mon Sep 17 00:00:00 2001 From: Per Liden Date: Fri, 20 Sep 2013 10:53:28 +0200 Subject: [PATCH 180/983] 8024974: Incorrect use of GC_locker::is_active() SymbolTable and StringTable can make calls to GC_locker::is_active() outside a safepoint. This isn't safe because the GC_locker active state (lock count) is only updated at a safepoint and only remains valid as long as _needs_gc is true. However, outside a safepoint_needs_gc can change to false at any time, which makes it impossible to do a correct call to is_active() in that context. In this case these calls can just be removed since the input argument to basic_add() should never be on the heap and so there's no need to check the GC_locker state. This change also adjusts the assert() in is_active() to makes sure all calls to this function are always done under a safepoint. Reviewed-by: brutisso, dcubed --- hotspot/src/share/vm/classfile/symbolTable.cpp | 4 ++-- hotspot/src/share/vm/memory/gcLocker.cpp | 2 +- hotspot/src/share/vm/memory/gcLocker.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index c00e9581759..d0d33d878fe 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -341,7 +341,7 @@ Symbol* SymbolTable::new_permanent_symbol(const char* name, TRAPS) { Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len, unsigned int hashValue_arg, bool c_heap, TRAPS) { - assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(), + assert(!Universe::heap()->is_in_reserved(name), "proposed name of symbol must be stable"); // Don't allow symbols to be created which cannot fit in a Symbol*. @@ -685,7 +685,7 @@ oop StringTable::intern(Handle string_or_null, jchar* name, if (found_string != NULL) return found_string; debug_only(StableMemoryChecker smc(name, len * sizeof(name[0]))); - assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(), + assert(!Universe::heap()->is_in_reserved(name), "proposed name of symbol must be stable"); Handle string; diff --git a/hotspot/src/share/vm/memory/gcLocker.cpp b/hotspot/src/share/vm/memory/gcLocker.cpp index eda728b7047..1b0c94ee171 100644 --- a/hotspot/src/share/vm/memory/gcLocker.cpp +++ b/hotspot/src/share/vm/memory/gcLocker.cpp @@ -122,7 +122,7 @@ void GC_locker::jni_unlock(JavaThread* thread) { // strictly needed. It's added here to make it clear that // the GC will NOT be performed if any other caller // of GC_locker::lock() still needs GC locked. - if (!is_active()) { + if (!is_active_internal()) { _doing_gc = true; { // Must give up the lock while at a safepoint diff --git a/hotspot/src/share/vm/memory/gcLocker.hpp b/hotspot/src/share/vm/memory/gcLocker.hpp index 8ede8fb275b..45b8a8f89e7 100644 --- a/hotspot/src/share/vm/memory/gcLocker.hpp +++ b/hotspot/src/share/vm/memory/gcLocker.hpp @@ -88,7 +88,7 @@ class GC_locker: public AllStatic { public: // Accessors static bool is_active() { - assert(_needs_gc || SafepointSynchronize::is_at_safepoint(), "only read at safepoint"); + assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint"); return is_active_internal(); } static bool needs_gc() { return _needs_gc; } From bbb009b580e819519598c582446b6db98f5950e5 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Fri, 20 Sep 2013 11:00:38 +0200 Subject: [PATCH 181/983] 8025059: Metspace::should_expand mixes bytes and words in check against MaxMetaspaceSize Reviewed-by: coleenp, brutisso, mgerdin, jmasa --- hotspot/src/share/vm/memory/metaspace.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index c12c0b8637b..0a741d674ca 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -1342,8 +1342,9 @@ bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) { // reserved space, because this is a larger space prereserved for compressed // class pointers. if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) { - size_t real_allocated = Metaspace::space_list()->reserved_words() + - MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); + size_t nonclass_allocated = MetaspaceAux::reserved_bytes(Metaspace::NonClassType); + size_t class_allocated = MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); + size_t real_allocated = nonclass_allocated + class_allocated; if (real_allocated >= MaxMetaspaceSize) { return false; } From 62b5b716a0e3e5f6ad6f5137b0673e9446d4672f Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Fri, 20 Sep 2013 17:07:11 +0400 Subject: [PATCH 182/983] 7124314: [TEST_BUG] [macosx] Aqua LAF: JTree doesn't select element by keyboards left and right keys Reviewed-by: alexsch, serb --- .../javax/swing/JTree/4927934/bug4927934.java | 247 ++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 jdk/test/javax/swing/JTree/4927934/bug4927934.java diff --git a/jdk/test/javax/swing/JTree/4927934/bug4927934.java b/jdk/test/javax/swing/JTree/4927934/bug4927934.java new file mode 100644 index 00000000000..b242e57ce46 --- /dev/null +++ b/jdk/test/javax/swing/JTree/4927934/bug4927934.java @@ -0,0 +1,247 @@ +/* + * 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 4927934 + @summary JTree traversal is unlike Native windows tree traversal + @author Andrey Pikalev + @run main bug4927934 +*/ + +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.tree.*; +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.InvocationTargetException; +import sun.awt.*; + +public class bug4927934 implements TreeSelectionListener, TreeExpansionListener, FocusListener { + + final static Object listener = new bug4927934(); + + static boolean focusGained = false; + public static boolean selectionChanged = false; + public static boolean treeExpanded = false; + public static boolean treeCollapsed = false; + + static JFrame frame; + static JTree tree; + static Robot robot; + + public static void main(String args[]) throws Exception { + UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); + + robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + + DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + createNodes(root); + tree = new JTree(root); + JScrollPane scrollPane = new JScrollPane(tree); + frame.getContentPane().add(scrollPane); + + tree.addFocusListener((FocusListener)listener); + tree.addTreeSelectionListener((TreeSelectionListener)listener); + tree.addTreeExpansionListener((TreeExpansionListener)listener); + + frame.setSize(300, 300); + frame.setVisible(true); + } + }); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + Thread.sleep(1000); + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + tree.requestFocus(); + } + }); + + synchronized(listener) { + if (!focusGained) { + System.out.println("waiting focusGained..."); + try { + listener.wait(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + // GO TO RIGHT + selectionChanged = false; + hitKey(KeyEvent.VK_RIGHT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 0)) { + throw new RuntimeException("Root should be selected"); + } + + selectionChanged = false; + hitKey(KeyEvent.VK_RIGHT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 1)) { + throw new RuntimeException("Node should be selected"); + } + + treeExpanded = false; + hitKey(KeyEvent.VK_RIGHT); + toolkit.realSync(); + if (!isTreeExpanded()) { + throw new RuntimeException("Node should be expanded"); + } + + selectionChanged = false; + hitKey(KeyEvent.VK_RIGHT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 2)) { + throw new RuntimeException("Leaf1 should be selected"); + } + + selectionChanged = false; + hitKey(KeyEvent.VK_RIGHT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 2)) { + throw new RuntimeException("Leaf1 should be selected"); + } + + // GO TO LEFT + selectionChanged = false; + hitKey(KeyEvent.VK_LEFT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 1)) { + throw new RuntimeException("Node should be selected"); + } + + treeCollapsed = false; + hitKey(KeyEvent.VK_LEFT); + if (!isTreeCollapsed()) { + throw new RuntimeException("Node should be collapsed"); + } + + selectionChanged = false; + hitKey(KeyEvent.VK_LEFT); + toolkit.realSync(); + if (!checkSelectionChanged(tree, 0)) { + throw new RuntimeException("Root should be selected"); + } + + treeCollapsed = false; + hitKey(KeyEvent.VK_LEFT); + toolkit.realSync(); + if (!isTreeCollapsed()) { + throw new RuntimeException("Root should be collapsed"); + } + } + + + synchronized public void focusLost(FocusEvent e) { + } + + synchronized public void focusGained(FocusEvent e) { + focusGained = true; + System.out.println("focusGained"); + listener.notifyAll(); + } + + private static void createNodes(DefaultMutableTreeNode root) { + DefaultMutableTreeNode node = new DefaultMutableTreeNode("Node"); + node.add(new DefaultMutableTreeNode("Leaf1")); + node.add(new DefaultMutableTreeNode("Leaf2")); + root.add(node); + root.add(new DefaultMutableTreeNode("Leaf3")); + } + + synchronized public void valueChanged(TreeSelectionEvent e) { + selectionChanged = true; + System.out.println("selectionChanged"); + notifyAll(); + } + + synchronized public void treeCollapsed(TreeExpansionEvent e) { + System.out.println("treeCollapsed"); + treeCollapsed = true; + notifyAll(); + } + + synchronized public void treeExpanded(TreeExpansionEvent e) { + System.out.println("treeExpanded"); + treeExpanded = true; + notifyAll(); + } + + private static void hitKey(int key) { + System.out.println("key " + key + " pressed"); + robot.keyPress(key); + robot.keyRelease(key); + } + + private static boolean checkSelectionChanged(JTree tree, int shouldBeSel) { + synchronized(listener) { + if (!selectionChanged) { + System.out.println("waiting for selectionChanged..."); + try { + listener.wait(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + int selRow = tree.getLeadSelectionRow(); + System.out.println("Selected row: " + selRow); + return selRow == shouldBeSel; + } + + private static boolean isTreeExpanded() { + synchronized(listener) { + if (!treeExpanded) { + System.out.println("waiting for treeExpanded..."); + try { + listener.wait(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + return treeExpanded; + } + + private static boolean isTreeCollapsed() { + synchronized(listener) { + if (!treeCollapsed) { + System.out.println("waiting for treeCollapsed..."); + try { + listener.wait(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + return treeCollapsed; + } +} From ae556f32b9924a73631e3b369e8e7402c485af73 Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Fri, 20 Sep 2013 17:16:45 +0400 Subject: [PATCH 183/983] 8017180: [macosx] [TEST_BUG] alt-key doesn't work on macos for menu Reviewed-by: alexsch, serb --- .../KeyEventForBadFocusOwnerTest.java | 144 ++++++++++++++++++ .../swing/JMenuItem/4171437/bug4171437.java | 108 +++++++++++++ .../swing/JPopupMenu/4458079/bug4458079.java | 110 +++++++++++++ 3 files changed, 362 insertions(+) create mode 100644 jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java create mode 100644 jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java create mode 100644 jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java diff --git a/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java new file mode 100644 index 00000000000..d0280374879 --- /dev/null +++ b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java @@ -0,0 +1,144 @@ +/* + * 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 4476629 + @library ../../../../javax/swing/regtesthelpers + @build Util + @summary KeyEvents dispatched to old focus owner that is no longer showing + @author son@sparc.spb.su: area=awt.focus + @run main KeyEventForBadFocusOwnerTest +*/ + +/** + * KeyEventForBadFocusOwnerTest.java + * + * summary: KeyEvents dispatched to old focus owner that is no longer showing + */ + + +import java.awt.Robot; +import java.awt.Toolkit; + +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.event.*; +import sun.awt.SunToolkit; + +public class KeyEventForBadFocusOwnerTest { + final static String ITEM_ONE_TEXT = "one"; + final static String ITEM_TWO_TEXT = "two"; + + volatile static boolean itemOneSelected = false; + volatile static boolean itemTwoSelected = false; + volatile static boolean unexpectedItemSelected = false; + + static Robot robot; + static SunToolkit toolkit; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JFrame frame = new JFrame("TEST"); + JMenuBar mb = new JMenuBar(); + JMenu one = new JMenu(ITEM_ONE_TEXT); + JMenu two = new JMenu(ITEM_TWO_TEXT); + + mb.add(one); + mb.add(two); + + ActionListener al = new ActionListener() { + public void actionPerformed(ActionEvent ae) { + String itemText = ((JMenuItem)ae.getSource()).getText(); + System.out.println("--> " + itemText); + unexpectedItemSelected = true; + } + }; + one.setMnemonic(KeyEvent.VK_O); + JMenuItem item = new JMenuItem("one 1"); + item.setMnemonic(KeyEvent.VK_O); + item.addActionListener(al); + one.add(item); + one.add("two"); + one.add("three"); + + two.setMnemonic(KeyEvent.VK_T); + item = new JMenuItem("two 2"); + item.setMnemonic(KeyEvent.VK_T); + item.addActionListener(al); + two.add(item); + two.add("three"); + two.add("four"); + + PopupMenuListener popupMenuListener = new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + System.out.print(e); + System.out.print(e.getSource()); + String itemText = ((JPopupMenu)e.getSource()).getName(); + System.out.println("Menu " + itemText + "is opened."); + switch(itemText) { + case ITEM_ONE_TEXT: + itemOneSelected = true; + break; + case ITEM_TWO_TEXT: + itemTwoSelected = true; + break; + } + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} + public void popupMenuCanceled(PopupMenuEvent e) {} + }; + one.getPopupMenu().setName(ITEM_ONE_TEXT); + two.getPopupMenu().setName(ITEM_TWO_TEXT); + one.getPopupMenu().addPopupMenuListener(popupMenuListener); + two.getPopupMenu().addPopupMenuListener(popupMenuListener); + frame.setJMenuBar(mb); + frame.setSize(100,100); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + }); + + toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + robot = new Robot(); + robot.setAutoDelay(100); + + Util.hitMnemonics(robot, KeyEvent.VK_O); + Util.hitMnemonics(robot, KeyEvent.VK_T); + + toolkit.realSync(); + Thread.sleep(1000); // workaround for MacOS + + if (unexpectedItemSelected) { + throw new Exception("Test failed. KeyEvent dispatched to old focus owner. "); + } + if (!itemOneSelected || !itemTwoSelected) { + throw new Exception("Not all expected events were received"); + } + } +} diff --git a/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java new file mode 100644 index 00000000000..378bd2a3c66 --- /dev/null +++ b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.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. + */ +/* @test + @bug 4171437 + @library ../../regtesthelpers + @build Util + @author Georges Saab + @run main bug4171437 +*/ +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; +import javax.swing.*; +import javax.swing.event.*; +import sun.awt.SunToolkit; + +public class bug4171437 { + static volatile boolean closeActivated = false; + static volatile boolean customActivated = false; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + + Util.hitMnemonics(robot, KeyEvent.VK_F); + Util.hitKeys(robot, KeyEvent.VK_C); + + toolkit.realSync(); + Thread.sleep(1000); + + if (!closeActivated || customActivated) { + throw new RuntimeException("Didn't pass the muster"); + } + } + public static void createAndShowGUI() { + JMenuBar menubar = new JMenuBar(); + + JMenu fileMenu = new JMenu("File"); + fileMenu.setMnemonic('f'); + + JMenuItem fmi1 = new JMenuItem(); + fmi1 = new JMenuItem("Open"); + JMenuItem fmi2 = new JMenuItem(); + fmi2 = new JMenuItem("Close"); + fmi2.setMnemonic('c'); + fmi2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + closeActivated = true; + } + }); + + fileMenu.add( fmi1); + fileMenu.add( fmi2); + + menubar.add( fileMenu); + + JMenu custom = new JMenu("Custom"); + custom.setMnemonic('c'); + JMenuItem cmi = new JMenuItem(); + cmi = new JMenuItem("Properties"); + cmi.setMnemonic('p'); + custom.add( cmi); + custom.addMenuListener(new MenuListener() { + public void menuSelected(MenuEvent e) { + customActivated = true; + } + public void menuDeselected(MenuEvent e) {} + public void menuCanceled(MenuEvent e) {} + }); + menubar.add( custom); + + JFrame frame = new JFrame(); + frame.setJMenuBar( menubar); + frame.setSize(300, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } +} diff --git a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java new file mode 100644 index 00000000000..a9807d316c1 --- /dev/null +++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java @@ -0,0 +1,110 @@ +/* + * 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 4458079 + @library ../../regtesthelpers + @build Util + @summary Tests calling removeAll() from PopupMenuListener + @author Peter Zhelezniakov + @run main bug4458079 +*/ +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import sun.awt.SunToolkit; + +public class bug4458079 extends JFrame implements PopupMenuListener { + public JMenu menu; + + static volatile boolean itemASelected = false; + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + new bug4458079().createAndShowGUI(); + } + }); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + + Util.hitMnemonics(robot, KeyEvent.VK_M); + + toolkit.realSync(); + Thread.sleep(1000); + + Util.hitKeys(robot, KeyEvent.VK_DOWN); + Util.hitKeys(robot, KeyEvent.VK_ENTER); + + toolkit.realSync(); + Thread.sleep(1000); + + if (!itemASelected) { + throw new RuntimeException("Test failed: arrow key traversal in JMenu broken!"); + } + } + public void createAndShowGUI() { + JMenuBar bar = new JMenuBar(); + menu = new JMenu("Menu"); + menu.add(new JMenuItem("1")); + menu.add(new JMenuItem("2")); + menu.setMnemonic(KeyEvent.VK_M); + menu.getPopupMenu().addPopupMenuListener(this); + bar.add(menu); + + setJMenuBar(bar); + getContentPane().add(new JButton("")); + setSize(300, 300); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + pack(); + setVisible(true); + } + + public void rebuildMenu() { + menu.removeAll(); + final String itemCommand = "A"; + JMenuItem item = new JMenuItem(itemCommand); + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JMenuItem item = ((JMenuItem)e.getSource()); + if (e.getActionCommand() == itemCommand) { + itemASelected = true; + } + } + }); + menu.add(item); + menu.add(new JMenuItem("B")); + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + rebuildMenu(); + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} + public void popupMenuCanceled(PopupMenuEvent e) {} +} From ec5e07f810933f5fdbda6729a1ed609f5f600c14 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 20 Sep 2013 09:30:02 -0400 Subject: [PATCH 184/983] 8022887: Assertion hit while using class and redefining it with RedefineClasses simultaneously Need to refetch each method from InstanceKlass after all safepoints. Removed leaky PreviousVersionInfo code. Reviewed-by: dcubed, sspitsyn --- .../src/share/vm/memory/metaspaceShared.cpp | 5 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 157 +++++------------- hotspot/src/share/vm/oops/instanceKlass.hpp | 71 ++------ hotspot/src/share/vm/prims/jvm.cpp | 117 ++++++------- hotspot/src/share/vm/prims/jvmtiImpl.cpp | 78 ++++----- .../share/vm/prims/jvmtiRedefineClasses.cpp | 39 ++--- hotspot/src/share/vm/runtime/handles.hpp | 4 +- .../src/share/vm/runtime/handles.inline.hpp | 2 + 8 files changed, 169 insertions(+), 304 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index 2a9873957a8..ef51c926662 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -103,9 +103,10 @@ static void calculate_fingerprints() { if (k->oop_is_instance()) { InstanceKlass* ik = InstanceKlass::cast(k); for (int i = 0; i < ik->methods()->length(); i++) { - ResourceMark rm; Method* m = ik->methods()->at(i); - (new Fingerprinter(m))->fingerprint(); + Fingerprinter fp(m); + // The side effect of this call sets method's fingerprint field. + fp.fingerprint(); } } } diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 29c77a07ccb..6e932830b3a 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2847,24 +2847,17 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"field annotations: "); fields_annotations()->print_value_on(st); st->cr(); st->print(BULLET"field type annotations: "); fields_type_annotations()->print_value_on(st); st->cr(); { - ResourceMark rm; - // PreviousVersionInfo objects returned via PreviousVersionWalker - // contain a GrowableArray of handles. We have to clean up the - // GrowableArray _after_ the PreviousVersionWalker destructor - // has destroyed the handles. - { - bool have_pv = false; - PreviousVersionWalker pvw((InstanceKlass*)this); - for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); - pv_info != NULL; pv_info = pvw.next_previous_version()) { - if (!have_pv) - st->print(BULLET"previous version: "); - have_pv = true; - pv_info->prev_constant_pool_handle()()->print_value_on(st); - } - if (have_pv) st->cr(); - } // pvw is cleaned up - } // rm is cleaned up + bool have_pv = false; + PreviousVersionWalker pvw(Thread::current(), (InstanceKlass*)this); + for (PreviousVersionNode * pv_node = pvw.next_previous_version(); + pv_node != NULL; pv_node = pvw.next_previous_version()) { + if (!have_pv) + st->print(BULLET"previous version: "); + have_pv = true; + pv_node->prev_constant_pool()->print_value_on(st); + } + if (have_pv) st->cr(); + } // pvw is cleaned up if (generic_signature() != NULL) { st->print(BULLET"generic signature: "); @@ -3392,34 +3385,34 @@ void InstanceKlass::add_previous_version(instanceKlassHandle ikh, Array* old_methods = ikh->methods(); if (cp_ref->on_stack()) { - PreviousVersionNode * pv_node = NULL; - if (emcp_method_count == 0) { + PreviousVersionNode * pv_node = NULL; + if (emcp_method_count == 0) { // non-shared ConstantPool gets a reference - pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), NULL); - RC_TRACE(0x00000400, - ("add: all methods are obsolete; flushing any EMCP refs")); - } else { - int local_count = 0; + pv_node = new PreviousVersionNode(cp_ref, NULL); + RC_TRACE(0x00000400, + ("add: all methods are obsolete; flushing any EMCP refs")); + } else { + int local_count = 0; GrowableArray* method_refs = new (ResourceObj::C_HEAP, mtClass) - GrowableArray(emcp_method_count, true); - for (int i = 0; i < old_methods->length(); i++) { - if (emcp_methods->at(i)) { - // this old method is EMCP. Save it only if it's on the stack - Method* old_method = old_methods->at(i); - if (old_method->on_stack()) { - method_refs->append(old_method); + GrowableArray(emcp_method_count, true); + for (int i = 0; i < old_methods->length(); i++) { + if (emcp_methods->at(i)) { + // this old method is EMCP. Save it only if it's on the stack + Method* old_method = old_methods->at(i); + if (old_method->on_stack()) { + method_refs->append(old_method); + } + if (++local_count >= emcp_method_count) { + // no more EMCP methods so bail out now + break; } - if (++local_count >= emcp_method_count) { - // no more EMCP methods so bail out now - break; } } - } // non-shared ConstantPool gets a reference - pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), method_refs); + pv_node = new PreviousVersionNode(cp_ref, method_refs); } // append new previous version. - _previous_versions->append(pv_node); + _previous_versions->append(pv_node); } // Since the caller is the VMThread and we are at a safepoint, this @@ -3520,6 +3513,8 @@ Method* InstanceKlass::method_with_idnum(int idnum) { return m; } } + // None found, return null for the caller to handle. + return NULL; } return m; } @@ -3536,10 +3531,9 @@ unsigned char * InstanceKlass::get_cached_class_file_bytes() { // Construct a PreviousVersionNode entry for the array hung off // the InstanceKlass. PreviousVersionNode::PreviousVersionNode(ConstantPool* prev_constant_pool, - bool prev_cp_is_weak, GrowableArray* prev_EMCP_methods) { + GrowableArray* prev_EMCP_methods) { _prev_constant_pool = prev_constant_pool; - _prev_cp_is_weak = prev_cp_is_weak; _prev_EMCP_methods = prev_EMCP_methods; } @@ -3555,99 +3549,38 @@ PreviousVersionNode::~PreviousVersionNode() { } } - -// Construct a PreviousVersionInfo entry -PreviousVersionInfo::PreviousVersionInfo(PreviousVersionNode *pv_node) { - _prev_constant_pool_handle = constantPoolHandle(); // NULL handle - _prev_EMCP_method_handles = NULL; - - ConstantPool* cp = pv_node->prev_constant_pool(); - assert(cp != NULL, "constant pool ref was unexpectedly cleared"); - if (cp == NULL) { - return; // robustness - } - - // make the ConstantPool* safe to return - _prev_constant_pool_handle = constantPoolHandle(cp); - - GrowableArray* method_refs = pv_node->prev_EMCP_methods(); - if (method_refs == NULL) { - // the InstanceKlass did not have any EMCP methods - return; - } - - _prev_EMCP_method_handles = new GrowableArray(10); - - int n_methods = method_refs->length(); - for (int i = 0; i < n_methods; i++) { - Method* method = method_refs->at(i); - assert (method != NULL, "method has been cleared"); - if (method == NULL) { - continue; // robustness - } - // make the Method* safe to return - _prev_EMCP_method_handles->append(methodHandle(method)); - } -} - - -// Destroy a PreviousVersionInfo -PreviousVersionInfo::~PreviousVersionInfo() { - // Since _prev_EMCP_method_handles is not C-heap allocated, we - // don't have to delete it. -} - - // Construct a helper for walking the previous versions array -PreviousVersionWalker::PreviousVersionWalker(InstanceKlass *ik) { +PreviousVersionWalker::PreviousVersionWalker(Thread* thread, InstanceKlass *ik) { + _thread = thread; _previous_versions = ik->previous_versions(); _current_index = 0; - // _hm needs no initialization _current_p = NULL; -} - - -// Destroy a PreviousVersionWalker -PreviousVersionWalker::~PreviousVersionWalker() { - // Delete the current info just in case the caller didn't walk to - // the end of the previous versions list. No harm if _current_p is - // already NULL. - delete _current_p; - - // When _hm is destroyed, all the Handles returned in - // PreviousVersionInfo objects will be destroyed. - // Also, after this destructor is finished it will be - // safe to delete the GrowableArray allocated in the - // PreviousVersionInfo objects. + _current_constant_pool_handle = constantPoolHandle(thread, ik->constants()); } // Return the interesting information for the next previous version // of the klass. Returns NULL if there are no more previous versions. -PreviousVersionInfo* PreviousVersionWalker::next_previous_version() { +PreviousVersionNode* PreviousVersionWalker::next_previous_version() { if (_previous_versions == NULL) { // no previous versions so nothing to return return NULL; } - delete _current_p; // cleanup the previous info for the caller - _current_p = NULL; // reset to NULL so we don't delete same object twice + _current_p = NULL; // reset to NULL + _current_constant_pool_handle = NULL; int length = _previous_versions->length(); while (_current_index < length) { PreviousVersionNode * pv_node = _previous_versions->at(_current_index++); - PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP, mtClass) - PreviousVersionInfo(pv_node); - constantPoolHandle cp_h = pv_info->prev_constant_pool_handle(); - assert (!cp_h.is_null(), "null cp found in previous version"); - - // The caller will need to delete pv_info when they are done with it. - _current_p = pv_info; - return pv_info; + // Save a handle to the constant pool for this previous version, + // which keeps all the methods from being deallocated. + _current_constant_pool_handle = constantPoolHandle(_thread, pv_node->prev_constant_pool()); + _current_p = pv_node; + return pv_node; } - // all of the underlying nodes' info has been deleted return NULL; } // end next_previous_version() diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 123f6b17911..4815294118e 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -1136,21 +1136,11 @@ class BreakpointInfo; // A collection point for interesting information about the previous -// version(s) of an InstanceKlass. This class uses weak references to -// the information so that the information may be collected as needed -// by the system. If the information is shared, then a regular -// reference must be used because a weak reference would be seen as -// collectible. A GrowableArray of PreviousVersionNodes is attached -// to the InstanceKlass as needed. See PreviousVersionWalker below. +// version(s) of an InstanceKlass. A GrowableArray of PreviousVersionNodes +// is attached to the InstanceKlass as needed. See PreviousVersionWalker below. class PreviousVersionNode : public CHeapObj { private: - // A shared ConstantPool is never collected so we'll always have - // a reference to it so we can update items in the cache. We'll - // have a weak reference to a non-shared ConstantPool until all - // of the methods (EMCP or obsolete) have been collected; the - // non-shared ConstantPool becomes collectible at that point. - ConstantPool* _prev_constant_pool; // regular or weak reference - bool _prev_cp_is_weak; // true if not a shared ConstantPool + ConstantPool* _prev_constant_pool; // If the previous version of the InstanceKlass doesn't have any // EMCP methods, then _prev_EMCP_methods will be NULL. If all the @@ -1159,8 +1149,8 @@ class PreviousVersionNode : public CHeapObj { GrowableArray* _prev_EMCP_methods; public: - PreviousVersionNode(ConstantPool* prev_constant_pool, bool prev_cp_is_weak, - GrowableArray* prev_EMCP_methods); + PreviousVersionNode(ConstantPool* prev_constant_pool, + GrowableArray* prev_EMCP_methods); ~PreviousVersionNode(); ConstantPool* prev_constant_pool() const { return _prev_constant_pool; @@ -1171,59 +1161,26 @@ public: }; -// A Handle-ized version of PreviousVersionNode. -class PreviousVersionInfo : public ResourceObj { - private: - constantPoolHandle _prev_constant_pool_handle; - // If the previous version of the InstanceKlass doesn't have any - // EMCP methods, then _prev_EMCP_methods will be NULL. Since the - // methods cannot be collected while we hold a handle, - // _prev_EMCP_methods should never have a length of zero. - GrowableArray* _prev_EMCP_method_handles; - -public: - PreviousVersionInfo(PreviousVersionNode *pv_node); - ~PreviousVersionInfo(); - constantPoolHandle prev_constant_pool_handle() const { - return _prev_constant_pool_handle; - } - GrowableArray* prev_EMCP_method_handles() const { - return _prev_EMCP_method_handles; - } -}; - - -// Helper object for walking previous versions. This helper cleans up -// the Handles that it allocates when the helper object is destroyed. -// The PreviousVersionInfo object returned by next_previous_version() -// is only valid until a subsequent call to next_previous_version() or -// the helper object is destroyed. +// Helper object for walking previous versions. class PreviousVersionWalker : public StackObj { private: + Thread* _thread; GrowableArray* _previous_versions; int _current_index; - // Fields for cleaning up when we are done walking the previous versions: - // A HandleMark for the PreviousVersionInfo handles: - HandleMark _hm; - // It would be nice to have a ResourceMark field in this helper also, - // but the ResourceMark code says to be careful to delete handles held - // in GrowableArrays _before_ deleting the GrowableArray. Since we - // can't guarantee the order in which the fields are destroyed, we - // have to let the creator of the PreviousVersionWalker object do - // the right thing. Also, adding a ResourceMark here causes an - // include loop. + // A pointer to the current node object so we can handle the deletes. + PreviousVersionNode* _current_p; - // A pointer to the current info object so we can handle the deletes. - PreviousVersionInfo * _current_p; + // The constant pool handle keeps all the methods in this class from being + // deallocated from the metaspace during class unloading. + constantPoolHandle _current_constant_pool_handle; public: - PreviousVersionWalker(InstanceKlass *ik); - ~PreviousVersionWalker(); + PreviousVersionWalker(Thread* thread, InstanceKlass *ik); // Return the interesting information for the next previous version // of the klass. Returns NULL if there are no more previous versions. - PreviousVersionInfo* next_previous_version(); + PreviousVersionNode* next_previous_version(); }; diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index caed2d13612..e138df82a24 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -1835,16 +1835,27 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, } JVM_END -JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly)) -{ - JVMWrapper("JVM_GetClassDeclaredMethods"); +static bool select_method(methodHandle method, bool want_constructor) { + if (want_constructor) { + return (method->is_initializer() && !method->is_static()); + } else { + return (!method->is_initializer() && !method->is_overpass()); + } +} + +static jobjectArray get_class_declared_methods_helper( + JNIEnv *env, + jclass ofClass, jboolean publicOnly, + bool want_constructor, + Klass* klass, TRAPS) { + JvmtiVMObjectAllocEventCollector oam; // Exclude primitive types and array types if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) || java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) { // Return empty array - oop res = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), 0, CHECK_NULL); + oop res = oopFactory::new_objArray(klass, 0, CHECK_NULL); return (jobjectArray) JNIHandles::make_local(env, res); } @@ -1855,87 +1866,67 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, Array* methods = k->methods(); int methods_length = methods->length(); + + // Save original method_idnum in case of redefinition, which can change + // the idnum of obsolete methods. The new method will have the same idnum + // but if we refresh the methods array, the counts will be wrong. + ResourceMark rm(THREAD); + GrowableArray* idnums = new GrowableArray(methods_length); int num_methods = 0; - int i; - for (i = 0; i < methods_length; i++) { + for (int i = 0; i < methods_length; i++) { methodHandle method(THREAD, methods->at(i)); - if (!method->is_initializer() && !method->is_overpass()) { + if (select_method(method, want_constructor)) { if (!publicOnly || method->is_public()) { + idnums->push(method->method_idnum()); ++num_methods; } } } // Allocate result - objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), num_methods, CHECK_NULL); + objArrayOop r = oopFactory::new_objArray(klass, num_methods, CHECK_NULL); objArrayHandle result (THREAD, r); - int out_idx = 0; - for (i = 0; i < methods_length; i++) { - methodHandle method(THREAD, methods->at(i)); - if (!method->is_initializer() && !method->is_overpass()) { - if (!publicOnly || method->is_public()) { - oop m = Reflection::new_method(method, UseNewReflection, false, CHECK_NULL); - result->obj_at_put(out_idx, m); - ++out_idx; + // Now just put the methods that we selected above, but go by their idnum + // in case of redefinition. The methods can be redefined at any safepoint, + // so above when allocating the oop array and below when creating reflect + // objects. + for (int i = 0; i < num_methods; i++) { + methodHandle method(THREAD, k->method_with_idnum(idnums->at(i))); + if (method.is_null()) { + // Method may have been deleted and seems this API can handle null + // Otherwise should probably put a method that throws NSME + result->obj_at_put(i, NULL); + } else { + oop m; + if (want_constructor) { + m = Reflection::new_constructor(method, CHECK_NULL); + } else { + m = Reflection::new_method(method, UseNewReflection, false, CHECK_NULL); } + result->obj_at_put(i, m); } } - assert(out_idx == num_methods, "just checking"); + return (jobjectArray) JNIHandles::make_local(env, result()); } + +JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly)) +{ + JVMWrapper("JVM_GetClassDeclaredMethods"); + return get_class_declared_methods_helper(env, ofClass, publicOnly, + /*want_constructor*/ false, + SystemDictionary::reflect_Method_klass(), THREAD); +} JVM_END JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly)) { JVMWrapper("JVM_GetClassDeclaredConstructors"); - JvmtiVMObjectAllocEventCollector oam; - - // Exclude primitive types and array types - if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) - || java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) { - // Return empty array - oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL); - return (jobjectArray) JNIHandles::make_local(env, res); - } - - instanceKlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))); - - // Ensure class is linked - k->link_class(CHECK_NULL); - - Array* methods = k->methods(); - int methods_length = methods->length(); - int num_constructors = 0; - - int i; - for (i = 0; i < methods_length; i++) { - methodHandle method(THREAD, methods->at(i)); - if (method->is_initializer() && !method->is_static()) { - if (!publicOnly || method->is_public()) { - ++num_constructors; - } - } - } - - // Allocate result - objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), num_constructors, CHECK_NULL); - objArrayHandle result(THREAD, r); - - int out_idx = 0; - for (i = 0; i < methods_length; i++) { - methodHandle method(THREAD, methods->at(i)); - if (method->is_initializer() && !method->is_static()) { - if (!publicOnly || method->is_public()) { - oop m = Reflection::new_constructor(method, CHECK_NULL); - result->obj_at_put(out_idx, m); - ++out_idx; - } - } - } - assert(out_idx == num_constructors, "just checking"); - return (jobjectArray) JNIHandles::make_local(env, result()); + return get_class_declared_methods_helper(env, ofClass, publicOnly, + /*want_constructor*/ true, + SystemDictionary::reflect_Constructor_klass(), THREAD); } JVM_END diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp index 6f8b41297a4..0fcd1ba94ed 100644 --- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp @@ -273,59 +273,49 @@ void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { // add/remove breakpoint to/from versions of the method that // are EMCP. Directly or transitively obsolete methods are - // not saved in the PreviousVersionInfo. + // not saved in the PreviousVersionNodes. Thread *thread = Thread::current(); instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder()); Symbol* m_name = _method->name(); Symbol* m_signature = _method->signature(); - { - ResourceMark rm(thread); - // PreviousVersionInfo objects returned via PreviousVersionWalker - // contain a GrowableArray of handles. We have to clean up the - // GrowableArray _after_ the PreviousVersionWalker destructor - // has destroyed the handles. - { - // search previous versions if they exist - PreviousVersionWalker pvw((InstanceKlass *)ikh()); - for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); - pv_info != NULL; pv_info = pvw.next_previous_version()) { - GrowableArray* methods = - pv_info->prev_EMCP_method_handles(); + // search previous versions if they exist + PreviousVersionWalker pvw(thread, (InstanceKlass *)ikh()); + for (PreviousVersionNode * pv_node = pvw.next_previous_version(); + pv_node != NULL; pv_node = pvw.next_previous_version()) { + GrowableArray* methods = pv_node->prev_EMCP_methods(); - if (methods == NULL) { - // We have run into a PreviousVersion generation where - // all methods were made obsolete during that generation's - // RedefineClasses() operation. At the time of that - // operation, all EMCP methods were flushed so we don't - // have to go back any further. - // - // A NULL methods array is different than an empty methods - // array. We cannot infer any optimizations about older - // generations from an empty methods array for the current - // generation. - break; - } + if (methods == NULL) { + // We have run into a PreviousVersion generation where + // all methods were made obsolete during that generation's + // RedefineClasses() operation. At the time of that + // operation, all EMCP methods were flushed so we don't + // have to go back any further. + // + // A NULL methods array is different than an empty methods + // array. We cannot infer any optimizations about older + // generations from an empty methods array for the current + // generation. + break; + } - for (int i = methods->length() - 1; i >= 0; i--) { - methodHandle method = methods->at(i); - // obsolete methods that are running are not deleted from - // previous version array, but they are skipped here. - if (!method->is_obsolete() && - method->name() == m_name && - method->signature() == m_signature) { - RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", - meth_act == &Method::set_breakpoint ? "sett" : "clear", - method->name()->as_C_string(), - method->signature()->as_C_string())); + for (int i = methods->length() - 1; i >= 0; i--) { + Method* method = methods->at(i); + // obsolete methods that are running are not deleted from + // previous version array, but they are skipped here. + if (!method->is_obsolete() && + method->name() == m_name && + method->signature() == m_signature) { + RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", + meth_act == &Method::set_breakpoint ? "sett" : "clear", + method->name()->as_C_string(), + method->signature()->as_C_string())); - ((Method*)method()->*meth_act)(_bci); - break; - } - } + (method->*meth_act)(_bci); + break; } - } // pvw is cleaned up - } // rm is cleaned up + } + } } void JvmtiBreakpoint::set() { diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp index 6894ec3f1f4..60bf9c4bdb5 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -2807,28 +2807,20 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { &trace_name_printed); } } - { - ResourceMark rm(_thread); - // PreviousVersionInfo objects returned via PreviousVersionWalker - // contain a GrowableArray of handles. We have to clean up the - // GrowableArray _after_ the PreviousVersionWalker destructor - // has destroyed the handles. - { - // the previous versions' constant pool caches may need adjustment - PreviousVersionWalker pvw(ik); - for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); - pv_info != NULL; pv_info = pvw.next_previous_version()) { - other_cp = pv_info->prev_constant_pool_handle(); - cp_cache = other_cp->cache(); - if (cp_cache != NULL) { - cp_cache->adjust_method_entries(_matching_old_methods, - _matching_new_methods, - _matching_methods_length, - &trace_name_printed); - } - } - } // pvw is cleaned up - } // rm is cleaned up + + // the previous versions' constant pool caches may need adjustment + PreviousVersionWalker pvw(_thread, ik); + for (PreviousVersionNode * pv_node = pvw.next_previous_version(); + pv_node != NULL; pv_node = pvw.next_previous_version()) { + other_cp = pv_node->prev_constant_pool(); + cp_cache = other_cp->cache(); + if (cp_cache != NULL) { + cp_cache->adjust_method_entries(_matching_old_methods, + _matching_new_methods, + _matching_methods_length, + &trace_name_printed); + } + } } } @@ -2942,10 +2934,9 @@ void VM_RedefineClasses::check_methods_and_mark_as_obsolete( // obsolete methods need a unique idnum u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum(); if (num != ConstMethod::UNSET_IDNUM) { -// u2 old_num = old_method->method_idnum(); old_method->set_method_idnum(num); -// TO DO: attach obsolete annotations to obsolete method's new idnum } + // With tracing we try not to "yack" too much. The position of // this trace assumes there are fewer obsolete methods than // EMCP methods. diff --git a/hotspot/src/share/vm/runtime/handles.hpp b/hotspot/src/share/vm/runtime/handles.hpp index dc254227971..c2ce4b38c5a 100644 --- a/hotspot/src/share/vm/runtime/handles.hpp +++ b/hotspot/src/share/vm/runtime/handles.hpp @@ -136,7 +136,7 @@ DEF_HANDLE(typeArray , is_typeArray ) // Specific Handles for different oop types #define DEF_METADATA_HANDLE(name, type) \ class name##Handle; \ - class name##Handle { \ + class name##Handle : public StackObj { \ type* _value; \ Thread* _thread; \ protected: \ @@ -175,7 +175,7 @@ DEF_METADATA_HANDLE(constantPool, ConstantPool) // Writing this class explicitly, since DEF_METADATA_HANDLE(klass) doesn't // provide the necessary Klass* <-> Klass* conversions. This Klass // could be removed when we don't have the Klass* typedef anymore. -class KlassHandle { +class KlassHandle : public StackObj { Klass* _value; protected: Klass* obj() const { return _value; } diff --git a/hotspot/src/share/vm/runtime/handles.inline.hpp b/hotspot/src/share/vm/runtime/handles.inline.hpp index 9530b127aea..5a0f3f773c2 100644 --- a/hotspot/src/share/vm/runtime/handles.inline.hpp +++ b/hotspot/src/share/vm/runtime/handles.inline.hpp @@ -79,6 +79,7 @@ inline name##Handle::name##Handle(const name##Handle &h) { \ } else { \ _thread = Thread::current(); \ } \ + assert (_thread->is_in_stack((address)this), "not on stack?"); \ _thread->metadata_handles()->push((Metadata*)_value); \ } else { \ _thread = NULL; \ @@ -95,6 +96,7 @@ inline name##Handle& name##Handle::operator=(const name##Handle &s) { \ } else { \ _thread = Thread::current(); \ } \ + assert (_thread->is_in_stack((address)this), "not on stack?"); \ _thread->metadata_handles()->push((Metadata*)_value); \ } else { \ _thread = NULL; \ From d35ad4fbafad51a3f3903aef3f6597fdf000749a Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Fri, 20 Sep 2013 17:35:45 +0400 Subject: [PATCH 185/983] 7124232: [TEST_BUG] [macosx] JSplitPane has wrong divider location Reviewed-by: alexsch, serb --- .../swing/JSplitPane/4816114/bug4816114.java | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java diff --git a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java new file mode 100644 index 00000000000..0b3247f9746 --- /dev/null +++ b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java @@ -0,0 +1,152 @@ +/* + * 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 4816114 + @summary REGRESSION: Regression in divider location behavior when JSplitPane is resized + @author Andrey Pikalev + @run main bug4816114 +*/ + +import javax.swing.*; +import java.awt.*; +import java.lang.reflect.*; +import sun.awt.SunToolkit; + + +public class bug4816114 { + + JFrame fr; + JSplitPane splitPane; + + boolean[] resized = new boolean[] { false, false, false, + false, false, false }; + static int step = 0; + boolean h_passed = false; + boolean v_passed = false; + + static bug4816114 test = new bug4816114(); + + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test.createAndShowGUI(); + } + }); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + Thread.sleep(1000); + Thread.sleep(2000); + + step++; + test.doTest(150, 300); + + step++; + test.doTest(650, 300); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test.splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); + } + }); + + step++; + test.doTest(300, 650); + + step++; + test.doTest(300, 150); + + step++; + test.doTest(300, 650); + + if ( !test.isPassed() ) { + throw new Error("The divider location is wrong."); + } + } + public void createAndShowGUI() { + fr = new JFrame("Test"); + + splitPane = new TestSplitPane(); + splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); + splitPane.setResizeWeight(0); + splitPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); + + JButton leftButton = new JButton("LEFT"); + leftButton.setPreferredSize(new Dimension(300, 300)); + leftButton.setMinimumSize(new Dimension(150, 150)); + splitPane.setLeftComponent(leftButton); + + JButton rightButton = new JButton("RIGHT"); + rightButton.setPreferredSize(new Dimension(300, 300)); + rightButton.setMinimumSize(new Dimension(150, 150)); + splitPane.setRightComponent(rightButton); + + fr.getContentPane().add(splitPane, BorderLayout.CENTER); + + fr.pack(); + fr.setVisible(true); + } + + void doTest(final int width, final int height) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + splitPane.setPreferredSize(new Dimension(width, height)); + fr.pack(); + } + }); + + synchronized (bug4816114.this) { + while (!resized[step]) { + bug4816114.this.wait(); + } + } + } + + synchronized void setPassed(int orientation, boolean passed) { + if (orientation == JSplitPane.HORIZONTAL_SPLIT) { + this.h_passed = passed; + } + else { + this.v_passed = passed; + } + } + + synchronized boolean isPassed() { + return h_passed && v_passed; + } + + + class TestSplitPane extends JSplitPane { + public void setDividerLocation(int location) { + super.setDividerLocation(location); + + if ( splitPane.getDividerLocation() == 151 ) { + setPassed(getOrientation(), true); + } + + synchronized (bug4816114.this) { + resized[step] = true; + bug4816114.this.notifyAll(); + } + } + } +} From 9f6d1df7471c00374d81685f3dfd7a8fe3b1c978 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 20 Sep 2013 16:33:35 +0200 Subject: [PATCH 186/983] 8023835: TreeMaker.QualIdent() too leafy Reviewed-by: jjg --- .../com/sun/tools/javac/tree/TreeMaker.java | 1 + .../test/tools/javac/tree/MakeQualIdent.java | 77 ++++++++++++ .../test/tools/javac/tree/ScopeTest.java | 114 ++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 langtools/test/tools/javac/tree/MakeQualIdent.java create mode 100644 langtools/test/tools/javac/tree/ScopeTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java index 4e6ef7ba6ff..b39fd06471e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java @@ -946,6 +946,7 @@ public class TreeMaker implements JCTree.Factory { boolean isUnqualifiable(Symbol sym) { if (sym.name == names.empty || sym.owner == null || + sym.owner == syms.rootPackage || sym.owner.kind == MTH || sym.owner.kind == VAR) { return true; } else if (sym.kind == TYP && toplevel != null) { diff --git a/langtools/test/tools/javac/tree/MakeQualIdent.java b/langtools/test/tools/javac/tree/MakeQualIdent.java new file mode 100644 index 00000000000..e4b71179672 --- /dev/null +++ b/langtools/test/tools/javac/tree/MakeQualIdent.java @@ -0,0 +1,77 @@ +/* + * 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 8023835 + * @summary Verify that TreeMaker.QualIdent(Symbol) field access cascade ends with + * the top-level package (when no toplevel is set in TreeMaker) + * @run main MakeQualIdent + */ + +import com.sun.source.tree.IdentifierTree; +import com.sun.source.tree.MemberSelectTree; +import com.sun.source.tree.Tree; +import com.sun.source.util.JavacTask; +import com.sun.source.util.TreeScanner; +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.code.Symtab; +import com.sun.tools.javac.tree.TreeMaker; +import com.sun.tools.javac.util.Context; +import java.util.ArrayList; + +public class MakeQualIdent { + public static void main(String... args) throws Exception { + JavacTool tool = JavacTool.create(); + JavacTask task = tool.getTask(null, null, null, new ArrayList(), null, null); + Context ctx = ((JavacTaskImpl)task).getContext(); + TreeMaker treeMaker = TreeMaker.instance(ctx); + Symtab syms = Symtab.instance(ctx); + + String stringTree = printTree(treeMaker.QualIdent(syms.stringType.tsym)); + + if (!"java.lang.String".equals(stringTree)) { + throw new IllegalStateException(stringTree); + } + } + + private static String printTree(Tree tree) { + final StringBuilder result = new StringBuilder(); + + new TreeScanner() { + @Override public Void visitIdentifier(IdentifierTree node, Void p) { + result.append(node.getName()); + return super.visitIdentifier(node, p); + } + @Override public Void visitMemberSelect(MemberSelectTree node, Void p) { + scan(node.getExpression(), null); + result.append("."); + result.append(node.getIdentifier()); + return null; + } + }.scan(tree, null); + + return result.toString(); + } +} diff --git a/langtools/test/tools/javac/tree/ScopeTest.java b/langtools/test/tools/javac/tree/ScopeTest.java new file mode 100644 index 00000000000..5df625eacd0 --- /dev/null +++ b/langtools/test/tools/javac/tree/ScopeTest.java @@ -0,0 +1,114 @@ +/* + * 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 8023835 + * @summary Verify that implicit type of lambda parameter is correctly attributed + * in Scope + * @run main ScopeTest + */ + +import com.sun.source.tree.CompilationUnitTree; +import com.sun.source.tree.MemberSelectTree; +import com.sun.source.tree.Scope; +import com.sun.source.util.JavacTask; +import com.sun.source.util.TreePath; +import com.sun.source.util.TreePathScanner; +import com.sun.source.util.Trees; +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.model.JavacTypes; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import javax.lang.model.element.Element; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.Types; +import javax.tools.JavaFileObject; +import javax.tools.JavaFileObject.Kind; +import javax.tools.SimpleJavaFileObject; + +public class ScopeTest { + + private static final String SOURCE_CODE = + "public class Test {\n" + + " private static void test() {\n" + + " InvokeOn f = null;\n" + + " f.run(x -> { x.correct(); });\n" + + " }\n" + + " public static final class FooBar {\n" + + " public void dontRun() { }\n" + + " }\n" + + "}\n" + + "class InvokeOn {\n" + + " public void run(I i) { }\n" + + "}\n" + + "class FooBar {\n" + + " public void correct() { }\n" + + "}\n" + + "interface I {\n" + + " public void run(FooBar f);\n" + + "}"; + + public static void main(String... args) throws Exception { + verifyLambdaScopeCorrect(""); + verifyLambdaScopeCorrect("package test;"); + } + + private static void verifyLambdaScopeCorrect(final String packageClause) throws Exception { + JavacTool tool = JavacTool.create(); + JavaFileObject source = new SimpleJavaFileObject(URI.create("mem://Test.java"), Kind.SOURCE) { + @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { + return packageClause + SOURCE_CODE; + } + @Override public boolean isNameCompatible(String simpleName, Kind kind) { + return true; + } + }; + Iterable fos = Collections.singletonList(source); + JavacTask task = tool.getTask(null, null, null, new ArrayList(), null, fos); + final Types types = JavacTypes.instance(((JavacTaskImpl) task).getContext()); + final Trees trees = Trees.instance(task); + CompilationUnitTree cu = task.parse().iterator().next(); + + task.analyze(); + + new TreePathScanner() { + @Override public Void visitMemberSelect(MemberSelectTree node, Void p) { + if (node.getIdentifier().contentEquals("correct")) { + TypeMirror xType = trees.getTypeMirror(new TreePath(getCurrentPath(), node.getExpression())); + Scope scope = trees.getScope(getCurrentPath()); + for (Element l : scope.getLocalElements()) { + if (!l.getSimpleName().contentEquals("x")) continue; + if (!types.isSameType(xType, l.asType())) { + throw new IllegalStateException("Incorrect variable type in scope: " + l.asType() + "; should be: " + xType); + } + } + } + return super.visitMemberSelect(node, p); + } + }.scan(cu, null); + } +} From e4e708cefd1cb153188069268f3a238d8ef0dfbc Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Fri, 20 Sep 2013 18:56:41 +0400 Subject: [PATCH 187/983] 7024235: Nimbus L&F: wrong "packing" of a frame containing tabbed pane Reviewed-by: alexsch --- .../swing/plaf/basic/BasicTabbedPaneUI.java | 4 +- .../JTabbedPane/7024235/Test7024235.java | 114 ++++++++++++++++++ 2 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 983e173e3af..495edfb1491 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -2620,7 +2620,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { // Never move a TAB down a run if it is in the first column. // Even if there isn't enough room, moving it to a fresh // line won't help. - if (rect.x != 2 + insets.left && rect.x + rect.width > returnAt) { + if (rect.x != x && rect.x + rect.width > returnAt) { if (runCount > tabRuns.length - 1) { expandTabRunsArray(); } @@ -2648,7 +2648,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { // Never move a TAB over a run if it is in the first run. // Even if there isn't enough room, moving it to a fresh // column won't help. - if (rect.y != 2 + insets.top && rect.y + rect.height > returnAt) { + if (rect.y != y && rect.y + rect.height > returnAt) { if (runCount > tabRuns.length - 1) { expandTabRunsArray(); } diff --git a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java new file mode 100644 index 00000000000..228aa008567 --- /dev/null +++ b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java @@ -0,0 +1,114 @@ +/* + * 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.awt.BorderLayout; +import sun.awt.SunToolkit; + +import java.awt.Container; +import java.awt.Rectangle; +import java.awt.Toolkit; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JTabbedPane; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; + +/* + * @test + * @bug 7024235 + * @summary Tests JFrame.pack() with the JTabbedPane + * @author Sergey Malenkov + */ + +public class Test7024235 implements Runnable { + + private static final boolean AUTO = null != System.getProperty("test.src", null); + + public static void main(String[] args) throws Exception { + Test7024235 test = new Test7024235(); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + UIManager.setLookAndFeel(info.getClassName()); + + test.test(); + toolkit.realSync(); + Thread.sleep(1000); + test.test(); + } + } + + private volatile JTabbedPane pane; + private volatile boolean passed; + + public void run() { + if (this.pane == null) { + this.pane = new JTabbedPane(); + this.pane.addTab("1", new Container()); + this.pane.addTab("2", new JButton()); + this.pane.addTab("3", new JCheckBox()); + + JFrame frame = new JFrame(); + frame.add(BorderLayout.WEST, this.pane); + frame.pack(); + frame.setVisible(true); + + test("first"); + } + else { + test("second"); + if (this.passed || AUTO) { // do not close a frame for manual review + SwingUtilities.getWindowAncestor(this.pane).dispose(); + } + this.pane = null; + } + } + + private void test() throws Exception { + SwingUtilities.invokeAndWait(this); + if (!this.passed && AUTO) { // error reporting only for automatic testing + throw new Error("TEST FAILED"); + } + } + + private void test(String step) { + this.passed = true; + for (int index = 0; index < this.pane.getTabCount(); index++) { + Rectangle bounds = this.pane.getBoundsAt(index); + int centerX = bounds.x + bounds.width / 2; + int centerY = bounds.y + bounds.height / 2; + int actual = this.pane.indexAtLocation(centerX, centerY); + if (index != actual) { + System.out.println("name = " + UIManager.getLookAndFeel().getName()); + System.out.println("step = " + step); + System.out.println("index = " + index); + System.out.println("bounds = " + bounds); + System.out.println("indexAtLocation(" + centerX + "," + centerX + ") returns " + actual); + this.passed = false; + } + } + } +} From c368a33bf7c9aa2b62a82937f40bbfba68ed86fc Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 20 Sep 2013 11:17:04 -0700 Subject: [PATCH 188/983] 8025127: new hotspot build - hs25-b52 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index fa4d6554e16..dc0872c1db3 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013 HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=51 +HS_BUILD_NUMBER=52 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From 3f2082ef809c6f4827d70ebcfeba3a36b9632e74 Mon Sep 17 00:00:00 2001 From: Bill Pittore Date: Fri, 20 Sep 2013 15:06:23 -0400 Subject: [PATCH 189/983] 8014911: Should use SUPPORTS_NATIVE_CX8 define to help C/C++ compiler elide blocks of code If SUPPORTS_NATIVE_CX8 true then supports_cx8() function hard coded to return 'true' Reviewed-by: kvn, twisti, dholmes --- hotspot/src/share/vm/runtime/vm_version.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp index c901b260de5..f03b77ca326 100644 --- a/hotspot/src/share/vm/runtime/vm_version.hpp +++ b/hotspot/src/share/vm/runtime/vm_version.hpp @@ -78,7 +78,13 @@ class Abstract_VM_Version: AllStatic { static const char* jre_release_version(); // does HW support an 8-byte compare-exchange operation? - static bool supports_cx8() {return _supports_cx8;} + static bool supports_cx8() { +#ifdef SUPPORTS_NATIVE_CX8 + return true; +#else + return _supports_cx8; +#endif + } // does HW support atomic get-and-set or atomic get-and-add? Used // to guide intrinsification decisions for Unsafe atomic ops static bool supports_atomic_getset4() {return _supports_atomic_getset4;} From 42589e0f11eac8224f59fe01496aa30a5ba4f81d Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 20 Sep 2013 18:34:00 -0400 Subject: [PATCH 190/983] 8014956: nashorn/api/javaaccess/MethodAccessTest.java test fails on sparc-solaris 64 Reference_map[] array had uninitialized junk that was causing a bogus bootstrap method to be found. Reviewed-by: hseigel, dcubed, sspitsyn --- hotspot/src/share/vm/oops/constantPool.cpp | 26 ++++++++-------------- hotspot/src/share/vm/oops/constantPool.hpp | 1 - 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index 8033d7e3850..82b99d5a1e2 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -108,16 +108,16 @@ objArrayOop ConstantPool::resolved_references() const { void ConstantPool::initialize_resolved_references(ClassLoaderData* loader_data, intStack reference_map, int constant_pool_map_length, - TRAPS) { + TRAPS) { // Initialized the resolved object cache. int map_length = reference_map.length(); if (map_length > 0) { // Only need mapping back to constant pool entries. The map isn't used for - // invokedynamic resolved_reference entries. The constant pool cache index - // has the mapping back to both the constant pool and to the resolved - // reference index. + // invokedynamic resolved_reference entries. For invokedynamic entries, + // the constant pool cache index has the mapping back to both the constant + // pool and to the resolved reference index. if (constant_pool_map_length > 0) { - Array* om = MetadataFactory::new_array(loader_data, map_length, CHECK); + Array* om = MetadataFactory::new_array(loader_data, constant_pool_map_length, CHECK); for (int i = 0; i < constant_pool_map_length; i++) { int x = reference_map.at(i); @@ -182,16 +182,9 @@ oop ConstantPool::lock() { int ConstantPool::cp_to_object_index(int cp_index) { // this is harder don't do this so much. - for (int i = 0; i< reference_map()->length(); i++) { - if (reference_map()->at(i) == cp_index) return i; - // Zero entry is divider between constant pool indices for strings, - // method handles and method types. After that the index is a constant - // pool cache index for invokedynamic. Stop when zero (which can never - // be a constant pool index) - if (reference_map()->at(i) == 0) break; - } - // We might not find the index. - return _no_index_sentinel; + int i = reference_map()->find(cp_index); + // We might not find the index for jsr292 call. + return (i < 0) ? _no_index_sentinel : i; } Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) { @@ -866,8 +859,7 @@ oop ConstantPool::string_at_impl(constantPoolHandle this_oop, int which, int obj // If the string has already been interned, this entry will be non-null oop str = this_oop->resolved_references()->obj_at(obj_index); if (str != NULL) return str; - - Symbol* sym = this_oop->unresolved_string_at(which); + Symbol* sym = this_oop->unresolved_string_at(which); str = StringTable::intern(sym, CHECK_(NULL)); this_oop->string_at_put(which, obj_index, str); assert(java_lang_String::is_instance(str), "must be string"); diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp index eca2dcd9c56..fb64930fb52 100644 --- a/hotspot/src/share/vm/oops/constantPool.hpp +++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -231,7 +231,6 @@ class ConstantPool : public Metadata { static int cache_offset_in_bytes() { return offset_of(ConstantPool, _cache); } static int pool_holder_offset_in_bytes() { return offset_of(ConstantPool, _pool_holder); } static int resolved_references_offset_in_bytes() { return offset_of(ConstantPool, _resolved_references); } - static int reference_map_offset_in_bytes() { return offset_of(ConstantPool, _reference_map); } // Storing constants From 22272f50435943f0404b126d1695082dbed41a1f Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Sat, 21 Sep 2013 10:09:42 +0200 Subject: [PATCH 191/983] 8025096: Move the ChunkManager instances out of the VirtualSpaceLists Reviewed-by: coleenp, mgerdin, jmasa --- hotspot/src/share/vm/memory/metaspace.cpp | 221 ++++++++++------------ hotspot/src/share/vm/memory/metaspace.hpp | 22 ++- 2 files changed, 116 insertions(+), 127 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 0a741d674ca..8498242e848 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" #include "gc_interface/collectedHeap.hpp" +#include "memory/allocation.hpp" #include "memory/binaryTreeDictionary.hpp" #include "memory/freeList.hpp" #include "memory/collectorPolicy.hpp" @@ -111,7 +112,7 @@ typedef class FreeList ChunkList; // Has three lists of free chunks, and a total size and // count that includes all three -class ChunkManager VALUE_OBJ_CLASS_SPEC { +class ChunkManager : public CHeapObj { // Free list of chunks of different sizes. // SpecializedChunk @@ -158,7 +159,12 @@ class ChunkManager VALUE_OBJ_CLASS_SPEC { public: - ChunkManager() : _free_chunks_total(0), _free_chunks_count(0) {} + ChunkManager(size_t specialized_size, size_t small_size, size_t medium_size) + : _free_chunks_total(0), _free_chunks_count(0) { + _free_chunks[SpecializedIndex].set_size(specialized_size); + _free_chunks[SmallIndex].set_size(small_size); + _free_chunks[MediumIndex].set_size(medium_size); + } // add or delete (return) a chunk to the global freelist. Metachunk* chunk_freelist_allocate(size_t word_size); @@ -219,7 +225,7 @@ class ChunkManager VALUE_OBJ_CLASS_SPEC { void locked_print_free_chunks(outputStream* st); void locked_print_sum_free_chunks(outputStream* st); - void print_on(outputStream* st); + void print_on(outputStream* st) const; }; // Used to manage the free list of Metablocks (a block corresponds @@ -276,11 +282,6 @@ class VirtualSpaceNode : public CHeapObj { // VirtualSpace Metachunk* first_chunk() { return (Metachunk*) bottom(); } - void inc_container_count(); -#ifdef ASSERT - uint container_count_slow(); -#endif - public: VirtualSpaceNode(size_t byte_size); @@ -314,8 +315,10 @@ class VirtualSpaceNode : public CHeapObj { void inc_top(size_t word_size) { _top += word_size; } uintx container_count() { return _container_count; } + void inc_container_count(); void dec_container_count(); #ifdef ASSERT + uint container_count_slow(); void verify_container_count(); #endif @@ -421,8 +424,6 @@ class VirtualSpaceList : public CHeapObj { VirtualSpaceNode* _virtual_space_list; // virtual space currently being used for allocations VirtualSpaceNode* _current_virtual_space; - // Free chunk list for all other metadata - ChunkManager _chunk_manager; // Can this virtual list allocate >1 spaces? Also, used to determine // whether to allocate unlimited small chunks in this virtual space @@ -475,7 +476,6 @@ class VirtualSpaceList : public CHeapObj { return _current_virtual_space; } - ChunkManager* chunk_manager() { return &_chunk_manager; } bool is_class() const { return _is_class; } // Allocate the first virtualspace. @@ -494,14 +494,7 @@ class VirtualSpaceList : public CHeapObj { void dec_virtual_space_count(); // Unlink empty VirtualSpaceNodes and free it. - void purge(); - - // Used and capacity in the entire list of virtual spaces. - // These are global values shared by all Metaspaces - size_t capacity_words_sum(); - size_t capacity_bytes_sum() { return capacity_words_sum() * BytesPerWord; } - size_t used_words_sum(); - size_t used_bytes_sum() { return used_words_sum() * BytesPerWord; } + void purge(ChunkManager* chunk_manager); bool contains(const void *ptr); @@ -582,18 +575,12 @@ class SpaceManager : public CHeapObj { // Type of metadata allocated. Metaspace::MetadataType _mdtype; - // Chunk related size - size_t _medium_chunk_bunch; - // List of chunks in use by this SpaceManager. Allocations // are done from the current chunk. The list is used for deallocating // chunks when the SpaceManager is freed. Metachunk* _chunks_in_use[NumberOfInUseLists]; Metachunk* _current_chunk; - // Virtual space where allocation comes from. - VirtualSpaceList* _vs_list; - // Number of small chunks to allocate to a manager // If class space manager, small chunks are unlimited static uint const _small_chunk_limit; @@ -626,7 +613,9 @@ class SpaceManager : public CHeapObj { } Metaspace::MetadataType mdtype() { return _mdtype; } - VirtualSpaceList* vs_list() const { return _vs_list; } + + VirtualSpaceList* vs_list() const { return Metaspace::get_space_list(_mdtype); } + ChunkManager* chunk_manager() const { return Metaspace::get_chunk_manager(_mdtype); } Metachunk* current_chunk() const { return _current_chunk; } void set_current_chunk(Metachunk* v) { @@ -648,18 +637,19 @@ class SpaceManager : public CHeapObj { public: SpaceManager(Metaspace::MetadataType mdtype, - Mutex* lock, - VirtualSpaceList* vs_list); + Mutex* lock); ~SpaceManager(); enum ChunkMultiples { MediumChunkMultiple = 4 }; + bool is_class() { return _mdtype == Metaspace::ClassType; } + // Accessors size_t specialized_chunk_size() { return SpecializedChunk; } - size_t small_chunk_size() { return (size_t) vs_list()->is_class() ? ClassSmallChunk : SmallChunk; } - size_t medium_chunk_size() { return (size_t) vs_list()->is_class() ? ClassMediumChunk : MediumChunk; } + size_t small_chunk_size() { return (size_t) is_class() ? ClassSmallChunk : SmallChunk; } + size_t medium_chunk_size() { return (size_t) is_class() ? ClassMediumChunk : MediumChunk; } size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; } size_t allocated_blocks_words() const { return _allocated_blocks_words; } @@ -762,7 +752,7 @@ void VirtualSpaceNode::inc_container_count() { _container_count++; assert(_container_count == container_count_slow(), err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT - "container_count_slow() " SIZE_FORMAT, + " container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow())); } @@ -775,7 +765,7 @@ void VirtualSpaceNode::dec_container_count() { void VirtualSpaceNode::verify_container_count() { assert(_container_count == container_count_slow(), err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT - "container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow())); + " container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow())); } #endif @@ -1020,7 +1010,7 @@ void ChunkManager::remove_chunk(Metachunk* chunk) { // Walk the list of VirtualSpaceNodes and delete // nodes with a 0 container_count. Remove Metachunks in // the node from their respective freelists. -void VirtualSpaceList::purge() { +void VirtualSpaceList::purge(ChunkManager* chunk_manager) { assert_lock_strong(SpaceManager::expand_lock()); // Don't use a VirtualSpaceListIterator because this // list is being changed and a straightforward use of an iterator is not safe. @@ -1042,7 +1032,7 @@ void VirtualSpaceList::purge() { prev_vsl->set_next(vsl->next()); } - vsl->purge(chunk_manager()); + vsl->purge(chunk_manager); dec_reserved_words(vsl->reserved_words()); dec_committed_words(vsl->committed_words()); dec_virtual_space_count(); @@ -1064,36 +1054,6 @@ void VirtualSpaceList::purge() { #endif } -size_t VirtualSpaceList::used_words_sum() { - size_t allocated_by_vs = 0; - VirtualSpaceListIterator iter(virtual_space_list()); - while (iter.repeat()) { - VirtualSpaceNode* vsl = iter.get_next(); - // Sum used region [bottom, top) in each virtualspace - allocated_by_vs += vsl->used_words_in_vs(); - } - assert(allocated_by_vs >= chunk_manager()->free_chunks_total_words(), - err_msg("Total in free chunks " SIZE_FORMAT - " greater than total from virtual_spaces " SIZE_FORMAT, - allocated_by_vs, chunk_manager()->free_chunks_total_words())); - size_t used = - allocated_by_vs - chunk_manager()->free_chunks_total_words(); - return used; -} - -// Space available in all MetadataVirtualspaces allocated -// for metadata. This is the upper limit on the capacity -// of chunks allocated out of all the MetadataVirtualspaces. -size_t VirtualSpaceList::capacity_words_sum() { - size_t capacity = 0; - VirtualSpaceListIterator iter(virtual_space_list()); - while (iter.repeat()) { - VirtualSpaceNode* vsl = iter.get_next(); - capacity += vsl->capacity_words_in_vs(); - } - return capacity; -} - VirtualSpaceList::VirtualSpaceList(size_t word_size ) : _is_class(false), _virtual_space_list(NULL), @@ -1104,10 +1064,6 @@ VirtualSpaceList::VirtualSpaceList(size_t word_size ) : MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); bool initialization_succeeded = grow_vs(word_size); - - _chunk_manager.free_chunks(SpecializedIndex)->set_size(SpecializedChunk); - _chunk_manager.free_chunks(SmallIndex)->set_size(SmallChunk); - _chunk_manager.free_chunks(MediumIndex)->set_size(MediumChunk); assert(initialization_succeeded, " VirtualSpaceList initialization should not fail"); } @@ -1123,9 +1079,6 @@ VirtualSpaceList::VirtualSpaceList(ReservedSpace rs) : Mutex::_no_safepoint_check_flag); VirtualSpaceNode* class_entry = new VirtualSpaceNode(rs); bool succeeded = class_entry->initialize(); - _chunk_manager.free_chunks(SpecializedIndex)->set_size(SpecializedChunk); - _chunk_manager.free_chunks(SmallIndex)->set_size(ClassSmallChunk); - _chunk_manager.free_chunks(MediumIndex)->set_size(ClassMediumChunk); assert(succeeded, " VirtualSpaceList initialization should not fail"); link_vs(class_entry); } @@ -1195,15 +1148,8 @@ Metachunk* VirtualSpaceList::get_new_chunk(size_t word_size, size_t grow_chunks_by_words, size_t medium_chunk_bunch) { - // Get a chunk from the chunk freelist - Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words); - - if (next != NULL) { - next->container()->inc_container_count(); - } else { - // Allocate a chunk out of the current virtual space. - next = current_virtual_space()->get_chunk_vs(grow_chunks_by_words); - } + // Allocate a chunk out of the current virtual space. + Metachunk* next = current_virtual_space()->get_chunk_vs(grow_chunks_by_words); if (next == NULL) { // Not enough room in current virtual space. Try to commit @@ -1537,15 +1483,15 @@ void Metadebug::deallocate_chunk_a_lot(SpaceManager* sm, if (dummy_chunk == NULL) { break; } - vsl->chunk_manager()->chunk_freelist_deallocate(dummy_chunk); + sm->chunk_manager()->chunk_freelist_deallocate(dummy_chunk); if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->print("Metadebug::deallocate_chunk_a_lot: %d) ", sm->sum_count_in_chunks_in_use()); dummy_chunk->print_on(gclog_or_tty); gclog_or_tty->print_cr(" Free chunks total %d count %d", - vsl->chunk_manager()->free_chunks_total_words(), - vsl->chunk_manager()->free_chunks_count()); + sm->chunk_manager()->free_chunks_total_words(), + sm->chunk_manager()->free_chunks_count()); } } } else { @@ -1797,6 +1743,8 @@ Metachunk* ChunkManager::free_chunks_get(size_t word_size) { // work. chunk->set_is_free(false); #endif + chunk->container()->inc_container_count(); + slow_locked_verify(); return chunk; } @@ -1831,9 +1779,9 @@ Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) { return chunk; } -void ChunkManager::print_on(outputStream* out) { +void ChunkManager::print_on(outputStream* out) const { if (PrintFLSStatistics != 0) { - humongous_dictionary()->report_statistics(); + const_cast(this)->humongous_dictionary()->report_statistics(); } } @@ -1980,8 +1928,8 @@ void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const { } } - vs_list()->chunk_manager()->locked_print_free_chunks(st); - vs_list()->chunk_manager()->locked_print_sum_free_chunks(st); + chunk_manager()->locked_print_free_chunks(st); + chunk_manager()->locked_print_sum_free_chunks(st); } size_t SpaceManager::calc_chunk_size(size_t word_size) { @@ -2085,9 +2033,7 @@ void SpaceManager::print_on(outputStream* st) const { } SpaceManager::SpaceManager(Metaspace::MetadataType mdtype, - Mutex* lock, - VirtualSpaceList* vs_list) : - _vs_list(vs_list), + Mutex* lock) : _mdtype(mdtype), _allocated_blocks_words(0), _allocated_chunks_words(0), @@ -2173,9 +2119,7 @@ SpaceManager::~SpaceManager() { MutexLockerEx fcl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); - ChunkManager* chunk_manager = vs_list()->chunk_manager(); - - chunk_manager->slow_locked_verify(); + chunk_manager()->slow_locked_verify(); dec_total_from_size_metrics(); @@ -2189,8 +2133,8 @@ SpaceManager::~SpaceManager() { // Have to update before the chunks_in_use lists are emptied // below. - chunk_manager->inc_free_chunks_total(allocated_chunks_words(), - sum_count_in_chunks_in_use()); + chunk_manager()->inc_free_chunks_total(allocated_chunks_words(), + sum_count_in_chunks_in_use()); // Add all the chunks in use by this space manager // to the global list of free chunks. @@ -2205,11 +2149,11 @@ SpaceManager::~SpaceManager() { chunk_size_name(i)); } Metachunk* chunks = chunks_in_use(i); - chunk_manager->return_chunks(i, chunks); + chunk_manager()->return_chunks(i, chunks); set_chunks_in_use(i, NULL); if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->print_cr("updated freelist count %d %s", - chunk_manager->free_chunks(i)->count(), + chunk_manager()->free_chunks(i)->count(), chunk_size_name(i)); } assert(i != HumongousIndex, "Humongous chunks are handled explicitly later"); @@ -2246,16 +2190,16 @@ SpaceManager::~SpaceManager() { humongous_chunks->word_size(), HumongousChunkGranularity)); Metachunk* next_humongous_chunks = humongous_chunks->next(); humongous_chunks->container()->dec_container_count(); - chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks); + chunk_manager()->humongous_dictionary()->return_chunk(humongous_chunks); humongous_chunks = next_humongous_chunks; } if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("updated dictionary count %d %s", - chunk_manager->humongous_dictionary()->total_count(), + chunk_manager()->humongous_dictionary()->total_count(), chunk_size_name(HumongousIndex)); } - chunk_manager->slow_locked_verify(); + chunk_manager()->slow_locked_verify(); } const char* SpaceManager::chunk_size_name(ChunkIndex index) const { @@ -2344,9 +2288,7 @@ void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) { gclog_or_tty->print("SpaceManager::add_chunk: %d) ", sum_count_in_chunks_in_use()); new_chunk->print_on(gclog_or_tty); - if (vs_list() != NULL) { - vs_list()->chunk_manager()->locked_print_free_chunks(gclog_or_tty); - } + chunk_manager()->locked_print_free_chunks(gclog_or_tty); } } @@ -2362,10 +2304,14 @@ void SpaceManager::retire_current_chunk() { Metachunk* SpaceManager::get_new_chunk(size_t word_size, size_t grow_chunks_by_words) { + // Get a chunk from the chunk freelist + Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words); - Metachunk* next = vs_list()->get_new_chunk(word_size, - grow_chunks_by_words, - medium_chunk_bunch()); + if (next == NULL) { + next = vs_list()->get_new_chunk(word_size, + grow_chunks_by_words, + medium_chunk_bunch()); + } if (TraceMetadataHumongousAllocation && next != NULL && SpaceManager::is_humongous(next->word_size())) { @@ -2645,13 +2591,12 @@ size_t MetaspaceAux::committed_bytes(Metaspace::MetadataType mdtype) { size_t MetaspaceAux::min_chunk_size_words() { return Metaspace::first_chunk_word_size(); } size_t MetaspaceAux::free_chunks_total_words(Metaspace::MetadataType mdtype) { - VirtualSpaceList* list = Metaspace::get_space_list(mdtype); - if (list == NULL) { + ChunkManager* chunk_manager = Metaspace::get_chunk_manager(mdtype); + if (chunk_manager == NULL) { return 0; } - ChunkManager* chunk = list->chunk_manager(); - chunk->slow_verify(); - return chunk->free_chunks_total_words(); + chunk_manager->slow_verify(); + return chunk_manager->free_chunks_total_words(); } size_t MetaspaceAux::free_chunks_total_bytes(Metaspace::MetadataType mdtype) { @@ -2802,9 +2747,9 @@ void MetaspaceAux::dump(outputStream* out) { } void MetaspaceAux::verify_free_chunks() { - Metaspace::space_list()->chunk_manager()->verify(); + Metaspace::chunk_manager_metadata()->verify(); if (Metaspace::using_class_space()) { - Metaspace::class_space_list()->chunk_manager()->verify(); + Metaspace::chunk_manager_class()->verify(); } } @@ -2875,6 +2820,9 @@ Metaspace::~Metaspace() { VirtualSpaceList* Metaspace::_space_list = NULL; VirtualSpaceList* Metaspace::_class_space_list = NULL; +ChunkManager* Metaspace::_chunk_manager_metadata = NULL; +ChunkManager* Metaspace::_chunk_manager_class = NULL; + #define VIRTUALSPACEMULTIPLIER 2 #ifdef _LP64 @@ -2982,6 +2930,7 @@ void Metaspace::initialize_class_space(ReservedSpace rs) { err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize)); assert(using_class_space(), "Must be using class space"); _class_space_list = new VirtualSpaceList(rs); + _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk); } #endif @@ -3007,6 +2956,7 @@ void Metaspace::global_initialize() { // remainder is the misc code and data chunks. cds_total = FileMapInfo::shared_spaces_size(); _space_list = new VirtualSpaceList(cds_total/wordSize); + _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk); #ifdef _LP64 // Set the compressed klass pointer base so that decoding of these pointers works @@ -3074,15 +3024,30 @@ void Metaspace::global_initialize() { size_t word_size = VIRTUALSPACEMULTIPLIER * first_chunk_word_size(); // Initialize the list of virtual spaces. _space_list = new VirtualSpaceList(word_size); + _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk); } } +Metachunk* Metaspace::get_initialization_chunk(MetadataType mdtype, + size_t chunk_word_size, + size_t chunk_bunch) { + // Get a chunk from the chunk freelist + Metachunk* chunk = get_chunk_manager(mdtype)->chunk_freelist_allocate(chunk_word_size); + if (chunk != NULL) { + return chunk; + } + + return get_space_list(mdtype)->get_initialization_chunk(chunk_word_size, chunk_bunch); +} + void Metaspace::initialize(Mutex* lock, MetaspaceType type) { assert(space_list() != NULL, "Metadata VirtualSpaceList has not been initialized"); + assert(chunk_manager_metadata() != NULL, + "Metadata ChunkManager has not been initialized"); - _vsm = new SpaceManager(NonClassType, lock, space_list()); + _vsm = new SpaceManager(NonClassType, lock); if (_vsm == NULL) { return; } @@ -3091,11 +3056,13 @@ void Metaspace::initialize(Mutex* lock, MetaspaceType type) { vsm()->get_initial_chunk_sizes(type, &word_size, &class_word_size); if (using_class_space()) { - assert(class_space_list() != NULL, - "Class VirtualSpaceList has not been initialized"); + assert(class_space_list() != NULL, + "Class VirtualSpaceList has not been initialized"); + assert(chunk_manager_class() != NULL, + "Class ChunkManager has not been initialized"); // Allocate SpaceManager for classes. - _class_vsm = new SpaceManager(ClassType, lock, class_space_list()); + _class_vsm = new SpaceManager(ClassType, lock); if (_class_vsm == NULL) { return; } @@ -3104,9 +3071,9 @@ void Metaspace::initialize(Mutex* lock, MetaspaceType type) { MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); // Allocate chunk for metadata objects - Metachunk* new_chunk = - space_list()->get_initialization_chunk(word_size, - vsm()->medium_chunk_bunch()); + Metachunk* new_chunk = get_initialization_chunk(NonClassType, + word_size, + vsm()->medium_chunk_bunch()); assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks"); if (new_chunk != NULL) { // Add to this manager's list of chunks in use and current_chunk(). @@ -3115,9 +3082,9 @@ void Metaspace::initialize(Mutex* lock, MetaspaceType type) { // Allocate chunk for class metadata objects if (using_class_space()) { - Metachunk* class_chunk = - class_space_list()->get_initialization_chunk(class_word_size, - class_vsm()->medium_chunk_bunch()); + Metachunk* class_chunk = get_initialization_chunk(ClassType, + class_word_size, + class_vsm()->medium_chunk_bunch()); if (class_chunk != NULL) { class_vsm()->add_chunk(class_chunk, true); } @@ -3334,12 +3301,16 @@ void Metaspace::iterate(Metaspace::AllocRecordClosure *closure) { } } +void Metaspace::purge(MetadataType mdtype) { + get_space_list(mdtype)->purge(get_chunk_manager(mdtype)); +} + void Metaspace::purge() { MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); - space_list()->purge(); + purge(NonClassType); if (using_class_space()) { - class_space_list()->purge(); + purge(ClassType); } } diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp index 242fa61b1cc..29c07e15179 100644 --- a/hotspot/src/share/vm/memory/metaspace.hpp +++ b/hotspot/src/share/vm/memory/metaspace.hpp @@ -56,12 +56,15 @@ // +-------------------+ // +class ChunkManager; class ClassLoaderData; class Metablock; +class Metachunk; class MetaWord; class Mutex; class outputStream; class SpaceManager; +class VirtualSpaceList; // Metaspaces each have a SpaceManager and allocations // are done by the SpaceManager. Allocations are done @@ -76,8 +79,6 @@ class SpaceManager; // allocate() method returns a block for use as a // quantum of metadata. -class VirtualSpaceList; - class Metaspace : public CHeapObj { friend class VMStructs; friend class SpaceManager; @@ -102,6 +103,10 @@ class Metaspace : public CHeapObj { private: void initialize(Mutex* lock, MetaspaceType type); + Metachunk* get_initialization_chunk(MetadataType mdtype, + size_t chunk_word_size, + size_t chunk_bunch); + // Align up the word size to the allocation word size static size_t align_word_size_up(size_t); @@ -134,6 +139,10 @@ class Metaspace : public CHeapObj { static VirtualSpaceList* _space_list; static VirtualSpaceList* _class_space_list; + static ChunkManager* _chunk_manager_metadata; + static ChunkManager* _chunk_manager_class; + + public: static VirtualSpaceList* space_list() { return _space_list; } static VirtualSpaceList* class_space_list() { return _class_space_list; } static VirtualSpaceList* get_space_list(MetadataType mdtype) { @@ -141,6 +150,14 @@ class Metaspace : public CHeapObj { return mdtype == ClassType ? class_space_list() : space_list(); } + static ChunkManager* chunk_manager_metadata() { return _chunk_manager_metadata; } + static ChunkManager* chunk_manager_class() { return _chunk_manager_class; } + static ChunkManager* get_chunk_manager(MetadataType mdtype) { + assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); + return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata(); + } + + private: // This is used by DumpSharedSpaces only, where only _vsm is used. So we will // maintain a single list for now. void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); @@ -199,6 +216,7 @@ class Metaspace : public CHeapObj { void dump(outputStream* const out) const; // Free empty virtualspaces + static void purge(MetadataType mdtype); static void purge(); void print_on(outputStream* st) const; From 70e873ec737ba10be69b27cface7ea50413cad10 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Sun, 22 Sep 2013 12:53:03 +0100 Subject: [PATCH 192/983] 8024696: Missing null check in bound method reference capture Reviewed-by: jjg, briangoetz --- .../sun/tools/javac/comp/LambdaToMethod.java | 4 ++ .../tools/javac/lambda/8023558/T8023558a.java | 8 +++- .../MethodReferenceNullCheckTest.java | 47 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index b2a501d27d6..d22ebfa36e3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -153,6 +153,8 @@ public class LambdaToMethod extends TreeTranslator { return instance; } + private Attr attr; + private LambdaToMethod(Context context) { diags = JCDiagnostic.Factory.instance(context); log = Log.instance(context); @@ -166,6 +168,7 @@ public class LambdaToMethod extends TreeTranslator { analyzer = new LambdaAnalyzerPreprocessor(); Options options = Options.instance(context); dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); + attr = Attr.instance(context); } // @@ -368,6 +371,7 @@ public class LambdaToMethod extends TreeTranslator { case BOUND: /** Expr :: instMethod */ init = tree.getQualifierExpression(); + init = attr.makeNullCheck(init); break; case UNBOUND: /** Type :: instMethod */ diff --git a/langtools/test/tools/javac/lambda/8023558/T8023558a.java b/langtools/test/tools/javac/lambda/8023558/T8023558a.java index 205ff9eefdc..be3ba6494f0 100644 --- a/langtools/test/tools/javac/lambda/8023558/T8023558a.java +++ b/langtools/test/tools/javac/lambda/8023558/T8023558a.java @@ -31,8 +31,14 @@ public class T8023558a { T get(); } + static class K implements SAM { + public T get() { + return (T)this; + } + } + public static void main(String[] args) { - SAM sam = new SAM() { public SAM get() { return null; } }; + SAM sam = new SAM() { public SAM get() { return new K<>(); } }; SAM temp = sam.get()::get; } } diff --git a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java new file mode 100644 index 00000000000..fd2bf655649 --- /dev/null +++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8024696 + * @summary Missing null check in bound method reference capture + */ + +import com.sun.tools.javac.util.Assert; +import java.util.function.*; + +public class MethodReferenceNullCheckTest { + public static void main(String[] args) { + String s = null; + boolean npeFired = false; + try { + Supplier ss = s::isEmpty; + } catch (NullPointerException npe) { + npeFired = true; + } finally { + Assert.check(npeFired, "NPE should have been thrown"); + } + } +} From 5bc8cd08aa15355b35fd273e71d36b710ba99b43 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Sun, 22 Sep 2013 06:31:43 -0700 Subject: [PATCH 193/983] 6989981: jstack causes "fatal error: ExceptionMark destructor expects no pending exceptions" Reviewed-by: sla, dsamersoff --- .../src/share/vm/services/attachListener.cpp | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp index bf002e7fa88..e30c3eeff8c 100644 --- a/hotspot/src/share/vm/services/attachListener.cpp +++ b/hotspot/src/share/vm/services/attachListener.cpp @@ -470,7 +470,17 @@ void AttachListener::init() { vmSymbols::threadgroup_string_void_signature(), thread_group, string, - CHECK); + THREAD); + + if (HAS_PENDING_EXCEPTION) { + tty->print_cr("Exception in VM (AttachListener::init) : "); + java_lang_Throwable::print(PENDING_EXCEPTION, tty); + tty->cr(); + + CLEAR_PENDING_EXCEPTION; + + return; + } KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass()); JavaCalls::call_special(&result, @@ -479,7 +489,17 @@ void AttachListener::init() { vmSymbols::add_method_name(), vmSymbols::thread_void_signature(), thread_oop, // ARG 1 - CHECK); + THREAD); + + if (HAS_PENDING_EXCEPTION) { + tty->print_cr("Exception in VM (AttachListener::init) : "); + java_lang_Throwable::print(PENDING_EXCEPTION, tty); + tty->cr(); + + CLEAR_PENDING_EXCEPTION; + + return; + } { MutexLocker mu(Threads_lock); JavaThread* listener_thread = new JavaThread(&attach_listener_thread_entry); From 4d6a0655f9a953638db8c5a1fbf6c641dde016f6 Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Sun, 22 Sep 2013 18:49:09 +0400 Subject: [PATCH 194/983] 7133122: SA throws sun.jvm.hotspot.debugger.UnmappedAddressException when it should not Replace PT_LOAD segment with library segment when necessary Reviewed-by: dholmes, sla --- hotspot/agent/src/os/linux/ps_core.c | 67 ++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/hotspot/agent/src/os/linux/ps_core.c b/hotspot/agent/src/os/linux/ps_core.c index 85abab802e0..c1620407894 100644 --- a/hotspot/agent/src/os/linux/ps_core.c +++ b/hotspot/agent/src/os/linux/ps_core.c @@ -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 @@ -698,29 +698,58 @@ err: // read segments of a shared object static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* lib_ehdr, uintptr_t lib_base) { - int i = 0; - ELF_PHDR* phbuf; - ELF_PHDR* lib_php = NULL; + int i = 0; + ELF_PHDR* phbuf; + ELF_PHDR* lib_php = NULL; - if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) - return false; + int page_size=sysconf(_SC_PAGE_SIZE); - // we want to process only PT_LOAD segments that are not writable. - // i.e., text segments. The read/write/exec (data) segments would - // have been already added from core file segments. - for (lib_php = phbuf, i = 0; i < lib_ehdr->e_phnum; i++) { - if ((lib_php->p_type == PT_LOAD) && !(lib_php->p_flags & PF_W) && (lib_php->p_filesz != 0)) { - if (add_map_info(ph, lib_fd, lib_php->p_offset, lib_php->p_vaddr + lib_base, lib_php->p_filesz) == NULL) - goto err; + if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) { + return false; + } + + // we want to process only PT_LOAD segments that are not writable. + // i.e., text segments. The read/write/exec (data) segments would + // have been already added from core file segments. + for (lib_php = phbuf, i = 0; i < lib_ehdr->e_phnum; i++) { + if ((lib_php->p_type == PT_LOAD) && !(lib_php->p_flags & PF_W) && (lib_php->p_filesz != 0)) { + + uintptr_t target_vaddr = lib_php->p_vaddr + lib_base; + map_info *existing_map = core_lookup(ph, target_vaddr); + + if (existing_map == NULL){ + if (add_map_info(ph, lib_fd, lib_php->p_offset, + target_vaddr, lib_php->p_filesz) == NULL) { + goto err; + } + } else { + if ((existing_map->memsz != page_size) && + (existing_map->fd != lib_fd) && + (existing_map->memsz != lib_php->p_filesz)){ + + print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)", + target_vaddr, lib_php->p_filesz, lib_php->p_flags); + goto err; + } + + /* replace PT_LOAD segment with library segment */ + print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", + existing_map->memsz, lib_php->p_filesz); + + existing_map->fd = lib_fd; + existing_map->offset = lib_php->p_offset; + existing_map->memsz = lib_php->p_filesz; } - lib_php++; - } + } - free(phbuf); - return true; + lib_php++; + } + + free(phbuf); + return true; err: - free(phbuf); - return false; + free(phbuf); + return false; } // process segments from interpreter (ld.so or ld-linux.so) From a2a38c6b65c0f837c3bccb3987b6243d4e189e17 Mon Sep 17 00:00:00 2001 From: Andreas Lundblad Date: Mon, 23 Sep 2013 10:10:07 +0200 Subject: [PATCH 195/983] 8024988: javac, LVT test harness should generate tests .class files in the scratch folder Set the CLASS_OUTPUT location to the scratch directory. Changed the argument to checkClassFile accordingly. Reviewed-by: jjg, vromero --- .../test/tools/javac/flow/LVTHarness.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/langtools/test/tools/javac/flow/LVTHarness.java b/langtools/test/tools/javac/flow/LVTHarness.java index 7794ded19dd..9aac87c4f00 100644 --- a/langtools/test/tools/javac/flow/LVTHarness.java +++ b/langtools/test/tools/javac/flow/LVTHarness.java @@ -64,6 +64,7 @@ import com.sun.tools.classfile.Method; import static javax.tools.StandardLocation.*; import static com.sun.tools.classfile.LocalVariableTable_attribute.Entry; +import static javax.tools.JavaFileObject.Kind.SOURCE; public class LVTHarness { @@ -73,10 +74,14 @@ public class LVTHarness { static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null); public static void main(String[] args) throws Exception { - fm.setLocation(SOURCE_PATH, - Arrays.asList(new File(System.getProperty("test.src"), "tests"))); - for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", - Collections.singleton(JavaFileObject.Kind.SOURCE), true)) { + + String testDir = System.getProperty("test.src"); + fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests"))); + + // Make sure classes are written to scratch dir. + fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File("."))); + + for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) { new LVTHarness(jfo).check(); } if (nerrors > 0) { @@ -86,8 +91,7 @@ public class LVTHarness { JavaFileObject jfo; - Map aliveRangeMap = - new HashMap(); + Map aliveRangeMap = new HashMap<>(); Set declaredKeys = new HashSet<>(); List seenAliveRanges = new ArrayList<>(); @@ -96,15 +100,19 @@ public class LVTHarness { } protected void check() throws Exception { - JavacTask ct = (JavacTask)comp.getTask(null, fm, null, Arrays.asList("-g"), - null, Arrays.asList(jfo)); - System.err.println("compiling code " + jfo.toString()); + + JavacTask ct = (JavacTask) comp.getTask(null, fm, null, Arrays.asList("-g"), + null, Arrays.asList(jfo)); + System.err.println("compiling code " + jfo); ct.setProcessors(Collections.singleton(new AliveRangeFinder())); if (!ct.call()) { throw new AssertionError("Error during compilation"); } - checkClassFile(new File(jfo.getName().replace(".java", ".class"))); + + File javaFile = new File(jfo.getName()); + File classFile = new File(javaFile.getName().replace(".java", ".class")); + checkClassFile(classFile); //check all candidates have been used up for (Map.Entry entry : aliveRangeMap.entrySet()) { From 48774216f24dfa733f0f53ad0730c5b20d9a06b8 Mon Sep 17 00:00:00 2001 From: Andreas Lundblad Date: Mon, 23 Sep 2013 10:42:38 +0200 Subject: [PATCH 196/983] 6386236: Please rename com.sun.tools.javac.util.ListBuffer.lb() Static factory method ListBuffer.lb removed. Replaced by constructor calls. Reviewed-by: jfranck, jjg --- .../sun/tools/javac/api/JavacTaskImpl.java | 2 +- .../tools/javac/code/DeferredLintHandler.java | 2 +- .../com/sun/tools/javac/code/Printer.java | 4 +-- .../com/sun/tools/javac/code/Symbol.java | 2 +- .../com/sun/tools/javac/code/Type.java | 10 +++--- .../javac/code/TypeAnnotationPosition.java | 4 +-- .../sun/tools/javac/code/TypeAnnotations.java | 12 +++---- .../com/sun/tools/javac/code/Types.java | 31 +++++++++--------- .../com/sun/tools/javac/comp/Attr.java | 16 +++++----- .../com/sun/tools/javac/comp/Check.java | 4 +-- .../sun/tools/javac/comp/DeferredAttr.java | 2 +- .../com/sun/tools/javac/comp/Flow.java | 8 ++--- .../com/sun/tools/javac/comp/Infer.java | 18 +++++------ .../sun/tools/javac/comp/LambdaToMethod.java | 32 +++++++++---------- .../com/sun/tools/javac/comp/Lower.java | 6 ++-- .../com/sun/tools/javac/comp/Resolve.java | 8 ++--- .../com/sun/tools/javac/comp/TransTypes.java | 2 +- .../com/sun/tools/javac/jvm/ClassReader.java | 9 +++--- .../com/sun/tools/javac/jvm/ClassWriter.java | 4 +-- .../classes/com/sun/tools/javac/jvm/Code.java | 2 +- .../sun/tools/javac/main/JavaCompiler.java | 17 +++++----- .../javac/model/JavacAnnoConstructs.java | 4 +-- .../sun/tools/javac/parser/JavacParser.java | 11 +++---- .../com/sun/tools/javac/parser/Tokens.java | 4 +-- .../com/sun/tools/javac/util/GraphUtils.java | 6 ++-- .../com/sun/tools/javac/util/List.java | 8 ++--- .../com/sun/tools/javac/util/ListBuffer.java | 6 +--- .../classes/com/sun/tools/javac/util/Log.java | 2 +- .../IntersectionTypeCastTest.java | 2 +- .../IntersectionTargetTypeTest.java | 4 +-- .../scope/7017664/CompoundScopeTest.java | 4 +-- .../test/tools/javac/types/TypeHarness.java | 4 +-- 32 files changed, 121 insertions(+), 129 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index f5f5a4b120e..e0dde3de7b2 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -472,7 +472,7 @@ public class JavacTaskImpl extends BasicJavacTask { for (TypeElement item: classes) set.add(item); - ListBuffer> defer = ListBuffer.>lb(); + ListBuffer> defer = new ListBuffer<>(); while (list.peek() != null) { Env env = list.remove(); ClassSymbol csym = env.enclClass.sym; diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java index 9392046bb2d..0691498aeb5 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java @@ -81,7 +81,7 @@ public class DeferredLintHandler { } else { ListBuffer loggers = loggersQueue.get(currentPos); if (loggers == null) { - loggersQueue.put(currentPos, loggers = ListBuffer.lb()); + loggersQueue.put(currentPos, loggers = new ListBuffer<>()); } loggers.append(logger); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java index aa05cc29204..d46631504b2 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java @@ -103,7 +103,7 @@ public abstract class Printer implements Type.Visitor, Symbol.Vi * @return localized string representation */ public String visitTypes(List ts, Locale locale) { - ListBuffer sbuf = ListBuffer.lb(); + ListBuffer sbuf = new ListBuffer<>(); for (Type t : ts) { sbuf.append(visit(t, locale)); } @@ -118,7 +118,7 @@ public abstract class Printer implements Type.Visitor, Symbol.Vi * @return localized string representation */ public String visitSymbols(List ts, Locale locale) { - ListBuffer sbuf = ListBuffer.lb(); + ListBuffer sbuf = new ListBuffer<>(); for (Symbol t : ts) { sbuf.append(visit(t, locale)); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java index 65459ec3daf..7a65bd04b10 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java @@ -614,7 +614,7 @@ public abstract class Symbol implements Element { } public List getTypeParameters() { - ListBuffer l = ListBuffer.lb(); + ListBuffer l = new ListBuffer<>(); for (Type t : type.getTypeArguments()) { Assert.check(t.tsym.getKind() == ElementKind.TYPE_PARAMETER); l.append((TypeVariableSymbol)t.tsym); diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java index fb6308ba9bd..a6e4642ce51 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java @@ -433,7 +433,7 @@ public abstract class Type implements TypeMirror { } public static List filter(List ts, Filter tf) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : ts) { if (tf.accepts(t)) { buf.append(t); @@ -1496,7 +1496,7 @@ public abstract class Type implements TypeMirror { /** get all bounds of a given kind */ public List getBounds(InferenceBound... ibs) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (InferenceBound ib : ibs) { buf.appendList(bounds.get(ib)); } @@ -1505,7 +1505,7 @@ public abstract class Type implements TypeMirror { /** get the list of declared (upper) bounds */ public List getDeclaredBounds() { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); int count = 0; for (Type b : getBounds(InferenceBound.UPPER)) { if (count++ == declaredCount) break; @@ -1565,8 +1565,8 @@ public abstract class Type implements TypeMirror { for (Map.Entry> _entry : bounds.entrySet()) { InferenceBound ib = _entry.getKey(); List prevBounds = _entry.getValue(); - ListBuffer newBounds = ListBuffer.lb(); - ListBuffer deps = ListBuffer.lb(); + ListBuffer newBounds = new ListBuffer<>(); + ListBuffer deps = new ListBuffer<>(); //step 1 - re-add bounds that are not dependent on ivars for (Type t : prevBounds) { if (!t.containsAny(instVars)) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java index 89f6ea40799..c481ea5d3e0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java @@ -304,7 +304,7 @@ public class TypeAnnotationPosition { * @param list The bytecode representation of the type path. */ public static List getTypePathFromBinary(java.util.List list) { - ListBuffer loc = ListBuffer.lb(); + ListBuffer loc = new ListBuffer<>(); Iterator iter = list.iterator(); while (iter.hasNext()) { Integer fst = iter.next(); @@ -316,7 +316,7 @@ public class TypeAnnotationPosition { } public static List getBinaryFromTypePath(java.util.List locs) { - ListBuffer loc = ListBuffer.lb(); + ListBuffer loc = new ListBuffer<>(); for (TypePathEntry tpe : locs) { loc = loc.append(tpe.tag.tag); loc = loc.append(tpe.arg); diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index 642de5d4c4a..56acb0e8eb2 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -233,7 +233,7 @@ public class TypeAnnotations { * When traversing the AST we keep the "frames" of visited * trees in order to determine the position of annotations. */ - private ListBuffer frames = ListBuffer.lb(); + private ListBuffer frames = new ListBuffer<>(); protected void push(JCTree t) { frames = frames.prepend(t); } protected JCTree pop() { return frames.next(); } @@ -381,7 +381,7 @@ public class TypeAnnotations { } JCArrayTypeTree arTree = arrayTypeTree(typetree); - ListBuffer depth = ListBuffer.lb(); + ListBuffer depth = new ListBuffer<>(); depth = depth.append(TypePathEntry.ARRAY); while (arType.elemtype.hasTag(TypeTag.ARRAY)) { if (arType.elemtype.isAnnotated()) { @@ -473,7 +473,7 @@ public class TypeAnnotations { // the correct nesting. // The genericLocation for the annotation. - ListBuffer depth = ListBuffer.lb(); + ListBuffer depth = new ListBuffer<>(); Type topTy = enclTy; while (enclEl != null && @@ -793,7 +793,7 @@ public class TypeAnnotations { } case ARRAY_TYPE: { - ListBuffer index = ListBuffer.lb(); + ListBuffer index = new ListBuffer<>(); index = index.append(TypePathEntry.ARRAY); List newPath = path.tail; while (true) { @@ -956,7 +956,7 @@ public class TypeAnnotations { private static void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. - ListBuffer depth = ListBuffer.lb(); + ListBuffer depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && @@ -1226,7 +1226,7 @@ public class TypeAnnotations { public void visitNewArray(JCNewArray tree) { findPosition(tree, tree, tree.annotations); int dimAnnosCount = tree.dimAnnotations.size(); - ListBuffer depth = ListBuffer.lb(); + ListBuffer depth = new ListBuffer<>(); // handle annotations associated with dimensions for (int i = 0; i < dimAnnosCount; ++i) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 0d060b60bb7..996bcd88018 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -51,7 +51,6 @@ import static com.sun.tools.javac.code.Symbol.*; import static com.sun.tools.javac.code.Type.*; import static com.sun.tools.javac.code.TypeTag.*; import static com.sun.tools.javac.jvm.ClassFile.externalize; -import static com.sun.tools.javac.util.ListBuffer.lb; /** * Utility class containing various operations on types. @@ -411,7 +410,7 @@ public class Types { throw failure("not.a.functional.intf", origin); } - final ListBuffer abstracts = ListBuffer.lb(); + final ListBuffer abstracts = new ListBuffer<>(); for (Symbol sym : membersCache.getElements(new DescriptorFilter(origin))) { Type mtype = memberType(origin.type, sym); if (abstracts.isEmpty() || @@ -434,7 +433,7 @@ public class Types { FunctionDescriptor descRes = mergeDescriptors(origin, abstracts.toList()); if (descRes == null) { //we can get here if the functional interface is ill-formed - ListBuffer descriptors = ListBuffer.lb(); + ListBuffer descriptors = new ListBuffer<>(); for (Symbol desc : abstracts) { String key = desc.type.getThrownTypes().nonEmpty() ? "descriptor.throws" : "descriptor"; @@ -596,7 +595,7 @@ public class Types { Type capturedSite = capture(site); if (capturedSite != site) { Type formalInterface = site.tsym.type; - ListBuffer typeargs = ListBuffer.lb(); + ListBuffer typeargs = new ListBuffer<>(); List actualTypeargs = site.getTypeArguments(); List capturedTypeargs = capturedSite.getTypeArguments(); //simply replace the wildcards with its bound @@ -662,7 +661,7 @@ public class Types { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); - ListBuffer overridden = ListBuffer.lb(); + ListBuffer overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { @@ -885,12 +884,12 @@ public class Types { private Type rewriteSupers(Type t) { if (!t.isParameterized()) return t; - ListBuffer from = lb(); - ListBuffer to = lb(); + ListBuffer from = new ListBuffer<>(); + ListBuffer to = new ListBuffer<>(); adaptSelf(t, from, to); if (from.isEmpty()) return t; - ListBuffer rewrite = lb(); + ListBuffer rewrite = new ListBuffer<>(); boolean changed = false; for (Type orig : to.toList()) { Type s = rewriteSupers(orig); @@ -2744,7 +2743,7 @@ public class Types { } public List prune(List methods) { - ListBuffer methodsMin = ListBuffer.lb(); + ListBuffer methodsMin = new ListBuffer<>(); for (MethodSymbol m1 : methods) { boolean isMin_m1 = true; for (MethodSymbol m2 : methods) { @@ -3001,7 +3000,7 @@ public class Types { List to) { if (tvars.isEmpty()) return tvars; - ListBuffer newBoundsBuf = lb(); + ListBuffer newBoundsBuf = new ListBuffer<>(); boolean changed = false; // calculate new bounds for (Type t : tvars) { @@ -3013,7 +3012,7 @@ public class Types { } if (!changed) return tvars; - ListBuffer newTvars = lb(); + ListBuffer newTvars = new ListBuffer<>(); // create new type variables without bounds for (Type t : tvars) { newTvars.append(new TypeVar(t.tsym, null, syms.botType)); @@ -3440,15 +3439,15 @@ public class Types { * compoundMin or glb. */ private List closureMin(List cl) { - ListBuffer classes = lb(); - ListBuffer interfaces = lb(); + ListBuffer classes = new ListBuffer<>(); + ListBuffer interfaces = new ListBuffer<>(); while (!cl.isEmpty()) { Type current = cl.head; if (current.isInterface()) interfaces.append(current); else classes.append(current); - ListBuffer candidates = lb(); + ListBuffer candidates = new ListBuffer<>(); for (Type t : cl.tail) { if (!isSubtypeNoCapture(current, t)) candidates.append(t); @@ -3564,7 +3563,7 @@ public class Types { } // where List erasedSupertypes(Type t) { - ListBuffer buf = lb(); + ListBuffer buf = new ListBuffer<>(); for (Type sup : closure(t)) { if (sup.hasTag(TYPEVAR)) { buf.append(sup); @@ -3914,7 +3913,7 @@ public class Types { } // where public List freshTypeVariables(List types) { - ListBuffer result = lb(); + ListBuffer result = new ListBuffer<>(); for (Type t : types) { if (t.hasTag(WILDCARD)) { t = t.unannotatedType(); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index cb2337f936c..3813a6acd7a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1724,7 +1724,7 @@ public class Attr extends JCTree.Visitor { boolean isConstructorCall = methName == names._this || methName == names._super; - ListBuffer argtypesBuf = ListBuffer.lb(); + ListBuffer argtypesBuf = new ListBuffer<>(); if (isConstructorCall) { // We are seeing a ...this(...) or ...super(...) call. // Check that this is the first statement in a constructor. @@ -1989,7 +1989,7 @@ public class Attr extends JCTree.Visitor { } // Attribute constructor arguments. - ListBuffer argtypesBuf = ListBuffer.lb(); + ListBuffer argtypesBuf = new ListBuffer<>(); int pkind = attribArgs(tree.args, localEnv, argtypesBuf); List argtypes = argtypesBuf.toList(); List typeargtypes = attribTypes(tree.typeargs, localEnv); @@ -2476,8 +2476,8 @@ public class Attr extends JCTree.Visitor { } private TypeSymbol makeNotionalInterface(IntersectionClassType ict) { - ListBuffer targs = ListBuffer.lb(); - ListBuffer supertypes = ListBuffer.lb(); + ListBuffer targs = new ListBuffer<>(); + ListBuffer supertypes = new ListBuffer<>(); for (Type i : ict.interfaces_field) { if (i.isParameterized()) { targs.appendList(i.tsym.type.allparams()); @@ -2907,7 +2907,7 @@ public class Attr extends JCTree.Visitor { } }); } else { - ListBuffer targets = ListBuffer.lb(); + ListBuffer targets = new ListBuffer<>(); if (pt.hasTag(CLASS)) { if (pt.isCompound()) { targets.append(types.removeWildcards(primaryTarget)); //this goes first @@ -3903,7 +3903,7 @@ public class Attr extends JCTree.Visitor { } public void visitTypeUnion(JCTypeUnion tree) { - ListBuffer multicatchTypes = ListBuffer.lb(); + ListBuffer multicatchTypes = new ListBuffer<>(); ListBuffer all_multicatchTypes = null; // lazy, only if needed for (JCExpression typeTree : tree.alternatives) { Type ctype = attribType(typeTree, env); @@ -3930,7 +3930,7 @@ public class Attr extends JCTree.Visitor { all_multicatchTypes.append(ctype); } else { if (all_multicatchTypes == null) { - all_multicatchTypes = ListBuffer.lb(); + all_multicatchTypes = new ListBuffer<>(); all_multicatchTypes.appendList(multicatchTypes); } all_multicatchTypes.append(ctype); @@ -4085,7 +4085,7 @@ public class Attr extends JCTree.Visitor { if (annotations.isEmpty()) return List.nil(); - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (JCAnnotation anno : annotations) { if (anno.attribute != null) { // TODO: this null-check is only needed for an obscure diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index d3f94fdba82..a9ad0a68299 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -2452,8 +2452,8 @@ public class Check { Assert.check(m.kind == MTH); List prov = types.interfaceCandidates(site, (MethodSymbol)m); if (prov.size() > 1) { - ListBuffer abstracts = ListBuffer.lb(); - ListBuffer defaults = ListBuffer.lb(); + ListBuffer abstracts = new ListBuffer<>(); + ListBuffer defaults = new ListBuffer<>(); for (MethodSymbol provSym : prov) { if ((provSym.flags() & DEFAULT) != 0) { defaults = defaults.append(provSym); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 4db110579f7..6357419cf3d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -637,7 +637,7 @@ public class DeferredAttr extends JCTree.Visitor { Env localEnv = env.dup(tree); JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), localEnv, attr.memberReferenceQualifierResult(tree)); - ListBuffer argtypes = ListBuffer.lb(); + ListBuffer argtypes = new ListBuffer<>(); for (Type t : types.findDescriptorType(pt).getParameterTypes()) { argtypes.append(Type.noType); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java index 252124370e5..8c69c814965 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java @@ -713,7 +713,7 @@ public class Flow { ListBuffer prevPending = pendingExits; boolean prevAlive = alive; try { - pendingExits = ListBuffer.lb(); + pendingExits = new ListBuffer<>(); alive = true; scanStat(tree.body); tree.canCompleteNormally = alive; @@ -1265,7 +1265,7 @@ public class Flow { List prevThrown = thrown; ListBuffer prevPending = pendingExits; try { - pendingExits = ListBuffer.lb(); + pendingExits = new ListBuffer<>(); caught = tree.getDescriptorType(types).getThrownTypes(); thrown = List.nil(); scan(tree.body); @@ -1338,7 +1338,7 @@ public class Flow { ListBuffer prevPending = pendingExits; inLambda = true; try { - pendingExits = ListBuffer.lb(); + pendingExits = new ListBuffer<>(); caught = List.of(syms.throwableType); thrown = List.nil(); scan(tree.body); @@ -2030,7 +2030,7 @@ public class Flow { void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {} public void visitTry(JCTry tree) { - ListBuffer resourceVarDecls = ListBuffer.lb(); + ListBuffer resourceVarDecls = new ListBuffer<>(); final Bits uninitsTryPrev = new Bits(uninitsTry); ListBuffer

    prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java index 4c9568eb32c..61f75f068fa 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java @@ -277,7 +277,7 @@ public class Infer { * Infer cyclic inference variables as described in 15.12.2.8. */ private void instantiateAsUninferredVars(List vars, InferenceContext inferenceContext) { - ListBuffer todo = ListBuffer.lb(); + ListBuffer todo = new ListBuffer<>(); //step 1 - create fresh tvars for (Type t : vars) { UndetVar uv = (UndetVar)inferenceContext.asFree(t); @@ -1832,7 +1832,7 @@ public class Infer { } private List filterVars(Filter fu) { - ListBuffer res = ListBuffer.lb(); + ListBuffer res = new ListBuffer<>(); for (Type t : undetvars) { UndetVar uv = (UndetVar)t; if (fu.accepts(uv)) { @@ -1860,7 +1860,7 @@ public class Infer { * Returns a list of free variables in a given type */ final List freeVarsIn(Type t) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type iv : inferenceVars()) { if (t.contains(iv)) { buf.add(iv); @@ -1870,11 +1870,11 @@ public class Infer { } final List freeVarsIn(List ts) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : ts) { buf.appendList(freeVarsIn(t)); } - ListBuffer buf2 = ListBuffer.lb(); + ListBuffer buf2 = new ListBuffer<>(); for (Type t : buf) { if (!buf2.contains(t)) { buf2.add(t); @@ -1893,7 +1893,7 @@ public class Infer { } final List asFree(List ts) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : ts) { buf.append(asFree(t)); } @@ -1901,7 +1901,7 @@ public class Infer { } List instTypes() { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : undetvars) { UndetVar uv = (UndetVar)t; buf.append(uv.inst != null ? uv.inst : uv.qtype); @@ -1919,7 +1919,7 @@ public class Infer { } List asInstTypes(List ts) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : ts) { buf.append(asInstType(t)); } @@ -1967,7 +1967,7 @@ public class Infer { * Save the state of this inference context */ List save() { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Type t : undetvars) { UndetVar uv = (UndetVar)t; UndetVar uv2 = new UndetVar((TypeVar)uv.qtype, types); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index d22ebfa36e3..eb15ef65c11 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -126,7 +126,7 @@ public class LambdaToMethod extends TreeTranslator { private final VarSymbol deserParamSym; private KlassInfo(Symbol kSym) { - appendedMethodList = ListBuffer.lb(); + appendedMethodList = new ListBuffer<>(); deserializeCases = new HashMap>(); long flags = PRIVATE | STATIC | SYNTHETIC; MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType, @@ -191,7 +191,7 @@ public class LambdaToMethod extends TreeTranslator { } List translate(List trees, TranslationContext newContext) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (T tree : trees) { buf.append(translate(tree, newContext)); } @@ -304,7 +304,7 @@ public class LambdaToMethod extends TreeTranslator { // * the "this" argument if it is an instance method // * enclosing locals captured by the lambda expression - ListBuffer syntheticInits = ListBuffer.lb(); + ListBuffer syntheticInits = new ListBuffer<>(); if (!sym.isStatic()) { syntheticInits.append(makeThis( @@ -469,7 +469,7 @@ public class LambdaToMethod extends TreeTranslator { } else if (isLambda_void && isTarget_Void) { //void to Void conversion: // BODY; return null; - ListBuffer stats = ListBuffer.lb(); + ListBuffer stats = new ListBuffer<>(); stats.append(make.Exec(expr)); stats.append(make.Return(make.Literal(BOT, null).setType(syms.botType))); return make.Block(0, stats.toList()); @@ -531,8 +531,8 @@ public class LambdaToMethod extends TreeTranslator { } private JCMethodDecl makeDeserializeMethod(Symbol kSym) { - ListBuffer cases = ListBuffer.lb(); - ListBuffer breaks = ListBuffer.lb(); + ListBuffer cases = new ListBuffer<>(); + ListBuffer breaks = new ListBuffer<>(); for (Map.Entry> entry : kInfo.deserializeCases.entrySet()) { JCBreak br = make.Break(null); breaks.add(br); @@ -594,11 +594,11 @@ public class LambdaToMethod extends TreeTranslator { String implMethodSignature = methodSig(types.erasure(refSym.type)); JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType), make.Literal(implMethodKind)); - ListBuffer serArgs = ListBuffer.lb(); + ListBuffer serArgs = new ListBuffer<>(); int i = 0; for (Type t : indyType.getParameterTypes()) { - List indexAsArg = ListBuffer.lb().append(make.Literal(i)).toList(); - List argTypes = ListBuffer.lb().append(syms.intType).toList(); + List indexAsArg = new ListBuffer().append(make.Literal(i)).toList(); + List argTypes = new ListBuffer().append(syms.intType).toList(); serArgs.add(make.TypeCast(types.erasure(t), deserGetter("getCapturedArg", syms.objectType, argTypes, indexAsArg))); ++i; } @@ -618,7 +618,7 @@ public class LambdaToMethod extends TreeTranslator { null); ListBuffer stmts = kInfo.deserializeCases.get(implMethodName); if (stmts == null) { - stmts = ListBuffer.lb(); + stmts = new ListBuffer<>(); kInfo.deserializeCases.put(implMethodName, stmts); } /**** @@ -728,8 +728,8 @@ public class LambdaToMethod extends TreeTranslator { private final JCMemberReference tree; private final ReferenceTranslationContext localContext; - private final ListBuffer args = ListBuffer.lb(); - private final ListBuffer params = ListBuffer.lb(); + private final ListBuffer args = new ListBuffer<>(); + private final ListBuffer params = new ListBuffer<>(); MemberReferenceBridger(JCMemberReference tree, ReferenceTranslationContext localContext) { this.tree = tree; @@ -934,7 +934,7 @@ public class LambdaToMethod extends TreeTranslator { typeToMethodType(tree.getDescriptorType(types))); //computed indy arg types - ListBuffer indy_args_types = ListBuffer.lb(); + ListBuffer indy_args_types = new ListBuffer<>(); for (JCExpression arg : indy_args) { indy_args_types.append(arg.type); } @@ -949,7 +949,7 @@ public class LambdaToMethod extends TreeTranslator { names.altMetafactory : names.metafactory; if (context.needsAltMetafactory()) { - ListBuffer markers = ListBuffer.lb(); + ListBuffer markers = new ListBuffer<>(); for (Type t : tree.targets.tail) { if (t.tsym != syms.serializableType.tsym) { markers.append(t.tsym); @@ -1027,7 +1027,7 @@ public class LambdaToMethod extends TreeTranslator { } //where private List bsmStaticArgToTypes(List args) { - ListBuffer argtypes = ListBuffer.lb(); + ListBuffer argtypes = new ListBuffer<>(); for (Object arg : args) { argtypes.append(bsmStaticArgToType(arg)); } @@ -1851,7 +1851,7 @@ public class LambdaToMethod extends TreeTranslator { (thisReferenced? (inInterface? DEFAULT : 0) : STATIC); //compute synthetic params - ListBuffer params = ListBuffer.lb(); + ListBuffer params = new ListBuffer<>(); // The signature of the method is augmented with the following // synthetic parameters: diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java index cb054fe80f2..51588257c9b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java @@ -3725,7 +3725,7 @@ public class Lower extends TreeTranslator { (JCVariableDecl)make.VarDef(dollar_tmp, make.Literal(INT, -1)).setType(dollar_tmp.type); dollar_tmp_def.init.type = dollar_tmp.type = syms.intType; stmtList.append(dollar_tmp_def); - ListBuffer caseBuffer = ListBuffer.lb(); + ListBuffer caseBuffer = new ListBuffer<>(); // hashCode will trigger nullcheck on original switch expression JCMethodInvocation hashCodeCall = makeCall(make.Ident(dollar_s), names.hashCode, @@ -3749,7 +3749,7 @@ public class Lower extends TreeTranslator { elsepart); } - ListBuffer lb = ListBuffer.lb(); + ListBuffer lb = new ListBuffer<>(); JCBreak breakStmt = make.Break(null); breakStmt.target = switch1; lb.append(elsepart).append(breakStmt); @@ -3764,7 +3764,7 @@ public class Lower extends TreeTranslator { // with corresponding integer ones from the label to // position map. - ListBuffer lb = ListBuffer.lb(); + ListBuffer lb = new ListBuffer<>(); JCSwitch switch2 = make.Switch(make.Ident(dollar_tmp), lb.toList()); for(JCCase oneCase : caseList ) { // Rewire up old unlabeled break statements to the diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index e3c427413ec..87eb36668f4 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -213,7 +213,7 @@ public class Resolve { int pos = 0; int mostSpecificPos = -1; - ListBuffer subDiags = ListBuffer.lb(); + ListBuffer subDiags = new ListBuffer<>(); for (Candidate c : currentResolutionContext.candidates) { if (currentResolutionContext.step != c.step || (c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.APPLICABLE)) || @@ -783,7 +783,7 @@ public class Resolve { }; List dummyArgs(int length) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (int i = 0 ; i < length ; i++) { buf.append(Type.noType); } @@ -3173,7 +3173,7 @@ public class Resolve { } //where private List pruneInterfaces(Type t) { - ListBuffer result = ListBuffer.lb(); + ListBuffer result = new ListBuffer<>(); for (Type t1 : types.interfaces(t)) { boolean shouldAdd = true; for (Type t2 : types.interfaces(t)) { @@ -3286,7 +3286,7 @@ public class Resolve { if (argtypes == null || argtypes.isEmpty()) { return noArgs; } else { - ListBuffer diagArgs = ListBuffer.lb(); + ListBuffer diagArgs = new ListBuffer<>(); for (Type t : argtypes) { if (t.hasTag(DEFERRED)) { diagArgs.append(((DeferredAttr.DeferredType)t).tree); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java index d747a2b5156..48bd03c7a66 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java @@ -887,7 +887,7 @@ public class TransTypes extends TreeTranslator { private List addOverrideBridgesIfNeeded(DiagnosticPosition pos, final ClassSymbol c) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); if (c.isInterface() || !boundsRestricted(c)) return buf.toList(); Type t = types.supertype(c.type); diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 1b57b13cf36..397069589ff 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1446,8 +1446,7 @@ public class ClassReader { void attachTypeAnnotations(final Symbol sym) { int numAttributes = nextChar(); if (numAttributes != 0) { - ListBuffer proxies = - ListBuffer.lb(); + ListBuffer proxies = new ListBuffer<>(); for (int i = 0; i < numAttributes; i++) proxies.append(readTypeAnnotation()); annotate.normal(new TypeAnnotationCompleter(sym, proxies.toList())); @@ -1596,7 +1595,7 @@ public class ClassReader { { // See whether there is location info and read it int len = nextByte(); - ListBuffer loc = ListBuffer.lb(); + ListBuffer loc = new ListBuffer<>(); for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i) loc = loc.append(nextByte()); position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList()); @@ -1946,7 +1945,7 @@ public class ClassReader { } List deproxyTypeCompoundList(List proxies) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (TypeAnnotationProxy proxy: proxies) { Attribute.Compound compound = deproxyCompound(proxy.compound); Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position); @@ -2033,7 +2032,7 @@ public class ClassReader { boolean isVarargs = (flags & VARARGS) != 0; if (isVarargs) { Type varargsElem = args.last(); - ListBuffer adjustedArgs = ListBuffer.lb(); + ListBuffer adjustedArgs = new ListBuffer<>(); for (Type t : args) { adjustedArgs.append(t != varargsElem ? t : diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java index 6698c7fde27..54122430380 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java @@ -766,8 +766,8 @@ public class ClassWriter extends ClassFile { int writeTypeAnnotations(List typeAnnos, boolean inCode) { if (typeAnnos.isEmpty()) return 0; - ListBuffer visibles = ListBuffer.lb(); - ListBuffer invisibles = ListBuffer.lb(); + ListBuffer visibles = new ListBuffer<>(); + ListBuffer invisibles = new ListBuffer<>(); for (Attribute.TypeCompound tc : typeAnnos) { if (tc.hasUnknownPosition()) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java index d0ed7ec559c..6276a24ad2f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java @@ -1595,7 +1595,7 @@ public class Code { public void compressCatchTable() { - ListBuffer compressedCatchInfo = ListBuffer.lb(); + ListBuffer compressedCatchInfo = new ListBuffer<>(); List handlerPcs = List.nil(); for (char[] catchEntry : catchInfo) { handlerPcs = handlerPcs.prepend((int)catchEntry[2]); diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java index ba369172f43..39a59f662ff 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java +++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java @@ -67,7 +67,6 @@ import com.sun.tools.javac.util.Log.WriterKind; import static com.sun.tools.javac.code.TypeTag.CLASS; import static com.sun.tools.javac.main.Option.*; import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*; -import static com.sun.tools.javac.util.ListBuffer.lb; /** This class could be the main entry point for GJC when GJC is used as a @@ -586,7 +585,7 @@ public class JavaCompiler { } protected final Queue stopIfError(CompileState cs, Queue queue) { - return shouldStop(cs) ? ListBuffer.lb() : queue; + return shouldStop(cs) ? new ListBuffer() : queue; } protected final List stopIfError(CompileState cs, List list) { @@ -952,7 +951,7 @@ public class JavaCompiler { return List.nil(); //parse all files - ListBuffer trees = lb(); + ListBuffer trees = new ListBuffer<>(); Set filesSoFar = new HashSet(); for (JavaFileObject fileObject : fileObjects) { if (!filesSoFar.contains(fileObject)) { @@ -1002,7 +1001,7 @@ public class JavaCompiler { // then remember the classes declared in // the original compilation units listed on the command line. if (needRootClasses || sourceOutput || stubOutput) { - ListBuffer cdefs = lb(); + ListBuffer cdefs = new ListBuffer<>(); for (JCCompilationUnit unit : roots) { for (List defs = unit.defs; defs.nonEmpty(); @@ -1226,7 +1225,7 @@ public class JavaCompiler { * @returns a list of environments for attributd classes. */ public Queue> attribute(Queue> envs) { - ListBuffer> results = lb(); + ListBuffer> results = new ListBuffer<>(); while (!envs.isEmpty()) results.append(attribute(envs.remove())); return stopIfError(CompileState.ATTR, results); @@ -1291,7 +1290,7 @@ public class JavaCompiler { * @returns the list of attributed parse trees */ public Queue> flow(Queue> envs) { - ListBuffer> results = lb(); + ListBuffer> results = new ListBuffer<>(); for (Env env: envs) { flow(env, results); } @@ -1302,7 +1301,7 @@ public class JavaCompiler { * Perform dataflow checks on an attributed parse tree. */ public Queue> flow(Env env) { - ListBuffer> results = lb(); + ListBuffer> results = new ListBuffer<>(); flow(env, results); return stopIfError(CompileState.FLOW, results); } @@ -1356,7 +1355,7 @@ public class JavaCompiler { * @returns a list containing the classes to be generated */ public Queue, JCClassDecl>> desugar(Queue> envs) { - ListBuffer, JCClassDecl>> results = lb(); + ListBuffer, JCClassDecl>> results = new ListBuffer<>(); for (Env env: envs) desugar(env, results); return stopIfError(CompileState.FLOW, results); @@ -1605,7 +1604,7 @@ public class JavaCompiler { } @Override public void visitClassDef(JCClassDecl tree) { - ListBuffer newdefs = lb(); + ListBuffer newdefs = new ListBuffer<>(); for (List it = tree.defs; it.tail != null; it = it.tail) { JCTree t = it.head; switch (t.getTag()) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java index a2cd3c55de7..c05662cbcbb 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java @@ -207,7 +207,7 @@ public class JavacAnnoConstructs { Attribute[] contained0 = null; if (container != null) contained0 = unpackAttributes(container); - ListBuffer compounds = ListBuffer.lb(); + ListBuffer compounds = new ListBuffer<>(); if (contained0 != null) { for (Attribute a : contained0) if (a instanceof Attribute.Compound) @@ -328,7 +328,7 @@ public class JavacAnnoConstructs { Attribute[] contained0 = null; if (container != null) contained0 = unpackAttributes(container); - ListBuffer compounds = ListBuffer.lb(); + ListBuffer compounds = new ListBuffer<>(); if (contained0 != null) { for (Attribute a : contained0) if (a instanceof Attribute.Compound) diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index 182f21158ca..57a492f3a3a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -48,7 +48,6 @@ import static com.sun.tools.javac.parser.Tokens.TokenKind.GT; import static com.sun.tools.javac.parser.Tokens.TokenKind.IMPORT; import static com.sun.tools.javac.parser.Tokens.TokenKind.LT; import static com.sun.tools.javac.tree.JCTree.Tag.*; -import static com.sun.tools.javac.util.ListBuffer.lb; /** The parser maps a token sequence into an abstract syntax * tree. It operates by recursive descent, with code derived @@ -1767,7 +1766,7 @@ public class JavacParser implements Parser { /** Arguments = "(" [Expression { COMMA Expression }] ")" */ List arguments() { - ListBuffer args = lb(); + ListBuffer args = new ListBuffer<>(); if (token.kind == LPAREN) { nextToken(); if (token.kind != RPAREN) { @@ -1834,7 +1833,7 @@ public class JavacParser implements Parser { nextToken(); return List.nil(); } else { - ListBuffer args = ListBuffer.lb(); + ListBuffer args = new ListBuffer<>(); args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); while (token.kind == COMMA) { nextToken(); @@ -2175,7 +2174,7 @@ public class JavacParser implements Parser { ListBuffer dims = new ListBuffer(); // maintain array dimension type annotations - ListBuffer> dimAnnotations = ListBuffer.lb(); + ListBuffer> dimAnnotations = new ListBuffer<>(); dimAnnotations.append(annos); dims.append(parseExpression()); @@ -2626,7 +2625,7 @@ public class JavacParser implements Parser { } List catchTypes() { - ListBuffer catchTypes = ListBuffer.lb(); + ListBuffer catchTypes = new ListBuffer<>(); catchTypes.add(parseType()); while (token.kind == BAR) { checkMulticatch(); @@ -2708,7 +2707,7 @@ public class JavacParser implements Parser { * | { FINAL | '@' Annotation } Type VariableDeclarators */ List forInit() { - ListBuffer stats = lb(); + ListBuffer stats = new ListBuffer<>(); int pos = token.pos; if (token.kind == FINAL || token.kind == MONKEYS_AT) { return variableDeclarators(optFinal(0), parseType(), stats).toList(); diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java index d55defedf73..fcb19dcb5fb 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -402,7 +402,7 @@ public class Tokens { if (comments == null) { return List.nil(); } else { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (Comment c : comments) { if (c.getStyle() == style) { buf.add(c); diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java b/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java index aa9899ed210..f1be519d6c9 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java @@ -103,8 +103,8 @@ public class GraphUtils { * directed graph in linear time. Works on TarjanNode. */ public static > List> tarjan(Iterable nodes) { - ListBuffer> cycles = ListBuffer.lb(); - ListBuffer stack = ListBuffer.lb(); + ListBuffer> cycles = new ListBuffer<>(); + ListBuffer stack = new ListBuffer<>(); int index = 0; for (N node: nodes) { if (node.index == -1) { @@ -132,7 +132,7 @@ public class GraphUtils { } if (v.lowlink == v.index) { N n; - ListBuffer cycle = ListBuffer.lb(); + ListBuffer cycle = new ListBuffer<>(); do { n = stack.remove(); n.active = false; diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/List.java b/langtools/src/share/classes/com/sun/tools/javac/util/List.java index dee69807e2c..3ba7d8b59dc 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java @@ -97,7 +97,7 @@ public class List extends AbstractCollection implements java.util.List } public List intersect(List that) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (A el : this) { if (that.contains(el)) { buf.append(el); @@ -107,7 +107,7 @@ public class List extends AbstractCollection implements java.util.List } public List diff(List that) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (A el : this) { if (!that.contains(el)) { buf.append(el); @@ -120,7 +120,7 @@ public class List extends AbstractCollection implements java.util.List * Create a new list from the first {@code n} elements of this list */ public List take(int n) { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); int count = 0; for (A el : this) { if (count++ == n) break; @@ -167,7 +167,7 @@ public class List extends AbstractCollection implements java.util.List } public static List from(Iterable coll) { - ListBuffer xs = ListBuffer.lb(); + ListBuffer xs = new ListBuffer<>(); for (A a : coll) { xs.append(a); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java index 0aa751ffe96..6d9c1ccda55 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,10 +40,6 @@ import java.util.NoSuchElementException; */ public class ListBuffer extends AbstractQueue { - public static ListBuffer lb() { - return new ListBuffer(); - } - public static ListBuffer of(T x) { ListBuffer lb = new ListBuffer(); lb.add(x); diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index 5ed6d784103..d0d9d5934a6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -123,7 +123,7 @@ public class Log extends AbstractLog { * active diagnostic handler. */ public static class DeferredDiagnosticHandler extends DiagnosticHandler { - private Queue deferred = ListBuffer.lb(); + private Queue deferred = new ListBuffer<>(); private final Filter filter; public DeferredDiagnosticHandler(Log log) { diff --git a/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java b/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java index 7aea2d42476..a398ec1791b 100644 --- a/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java +++ b/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java @@ -237,7 +237,7 @@ public class IntersectionTypeCastTest } static List allCastInfo() { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (CastKind kind : CastKind.values()) { for (ClassKind clazz : ClassKind.values()) { if (kind == CastKind.INTERFACE && clazz != ClassKind.OBJECT) { diff --git a/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java b/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java index 660721ec849..36e18611ba5 100644 --- a/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java +++ b/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,7 +196,7 @@ public class IntersectionTargetTypeTest { } static List allCastInfo() { - ListBuffer buf = ListBuffer.lb(); + ListBuffer buf = new ListBuffer<>(); for (CastKind kind : CastKind.values()) { for (TypeKind b1 : TypeKind.values()) { if (kind.nbounds == 1) { diff --git a/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java b/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java index 075a750a310..e9d44a84d41 100644 --- a/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java +++ b/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java @@ -176,7 +176,7 @@ public class CompoundScopeTest { */ void checkElems(CompoundScope cs, Filter sf) { int count = 0; - ListBuffer found = ListBuffer.lb(); + ListBuffer found = new ListBuffer<>(); List allSymbols = sf == null ? elems : filter(elems, sf); @@ -216,7 +216,7 @@ public class CompoundScopeTest { } List filter(List elems, Filter sf) { - ListBuffer res = ListBuffer.lb(); + ListBuffer res = new ListBuffer<>(); for (Symbol s : elems) { if (sf.accepts(s)) { res.append(s); diff --git a/langtools/test/tools/javac/types/TypeHarness.java b/langtools/test/tools/javac/types/TypeHarness.java index a53d94761ba..b4837907820 100644 --- a/langtools/test/tools/javac/types/TypeHarness.java +++ b/langtools/test/tools/javac/types/TypeHarness.java @@ -213,8 +213,8 @@ public class TypeHarness { /** compute a type substitution on 't' given a list of type mappings */ public Type subst(Type t, Mapping... maps) { - ListBuffer from = ListBuffer.lb(); - ListBuffer to = ListBuffer.lb(); + ListBuffer from = new ListBuffer<>(); + ListBuffer to = new ListBuffer<>(); for (Mapping tm : maps) { from.append(tm.from); to.append(tm.to); From 9ca087d6005f02a0425bcdadb6716094292161e4 Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Mon, 23 Sep 2013 16:14:42 +0400 Subject: [PATCH 197/983] 8015600: [TEST_BUG] [macosx] Test closed/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java fails since JDK 8 b75 on MacOSX Reviewed-by: alexsch, serb --- .../basic/BasicMenuUI/4983388/bug4983388.java | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java diff --git a/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java new file mode 100644 index 00000000000..a09a3480f6d --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java @@ -0,0 +1,89 @@ +/* + * 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 4983388 8015600 + @summary shortcuts on menus do not work on JDS + @author Oleg Mokhovikov + @library ../../../../regtesthelpers + @build Util + @run main bug4983388 +*/ + +import sun.awt.*; +import java.awt.*; +import javax.swing.*; +import javax.swing.event.MenuListener; +import javax.swing.event.MenuEvent; +import java.awt.event.KeyEvent; + +public class bug4983388 { + static volatile boolean bMenuSelected = false; + + private static class TestMenuListener implements MenuListener { + public void menuCanceled(MenuEvent e) {} + public void menuDeselected(MenuEvent e) {} + public void menuSelected(MenuEvent e) { + System.out.println("menuSelected"); + bMenuSelected = true; + } + } + + private static void createAndShowGUI() { + JMenuBar menuBar = new JMenuBar(); + JMenu menu = new JMenu("File"); + menu.setMnemonic('F'); + menuBar.add(menu); + JFrame frame = new JFrame(); + frame.setJMenuBar(menuBar); + frame.pack(); + frame.setVisible(true); + MenuListener listener = new TestMenuListener(); + menu.addMenuListener(listener); + } + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + } catch (UnsupportedLookAndFeelException | ClassNotFoundException ex) { + System.err.println("GTKLookAndFeel is not supported on this platform. Using defailt LaF for this platform."); + } + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + Robot robot = new Robot(); + Util.hitMnemonics(robot, KeyEvent.VK_F); + + toolkit.realSync(); + + if (!bMenuSelected) { + throw new RuntimeException("shortcuts on menus do not work"); + } + } +} From cac6b55e4ee9aa39108e54c2253d412f6f199db2 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 23 Sep 2013 16:17:26 +0400 Subject: [PATCH 198/983] 8005255: [macosx] Cleanup warnings in sun.lwawt Reviewed-by: alexsch, anthony --- jdk/make/sun/lwawt/FILES_export_macosx.gmk | 1 - .../classes/sun/lwawt/LWButtonPeer.java | 9 +- .../classes/sun/lwawt/LWCanvasPeer.java | 6 +- .../classes/sun/lwawt/LWCheckboxPeer.java | 12 ++- .../classes/sun/lwawt/LWChoicePeer.java | 7 +- .../classes/sun/lwawt/LWComponentPeer.java | 90 ++++++++++------- .../classes/sun/lwawt/LWContainerPeer.java | 97 +++++++++---------- .../classes/sun/lwawt/LWCursorManager.java | 6 +- .../macosx/classes/sun/lwawt/LWLabelPeer.java | 4 +- .../macosx/classes/sun/lwawt/LWListPeer.java | 16 +-- .../classes/sun/lwawt/LWMouseInfoPeer.java | 9 +- .../macosx/classes/sun/lwawt/LWPanelPeer.java | 8 +- .../classes/sun/lwawt/LWRepaintArea.java | 25 +++-- .../classes/sun/lwawt/LWScrollBarPeer.java | 8 +- .../classes/sun/lwawt/LWScrollPanePeer.java | 20 ++-- .../classes/sun/lwawt/LWTextAreaPeer.java | 13 ++- .../sun/lwawt/LWTextComponentPeer.java | 11 ++- .../classes/sun/lwawt/LWTextFieldPeer.java | 11 ++- .../macosx/classes/sun/lwawt/LWToolkit.java | 14 +-- .../classes/sun/lwawt/LWWindowPeer.java | 41 +++++--- .../sun/lwawt/SelectionClearListener.java | 34 ------- 21 files changed, 237 insertions(+), 205 deletions(-) delete mode 100644 jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java diff --git a/jdk/make/sun/lwawt/FILES_export_macosx.gmk b/jdk/make/sun/lwawt/FILES_export_macosx.gmk index 0750201e9ec..7b32f911c21 100644 --- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk +++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk @@ -110,7 +110,6 @@ FILES_export = \ sun/lwawt/LWWindowPeer.java \ sun/lwawt/PlatformWindow.java \ sun/lwawt/SecurityWarningWindow.java \ - sun/lwawt/SelectionClearListener.java \ sun/lwawt/macosx/CPrinterDevice.java \ sun/lwawt/macosx/CPrinterDialog.java \ sun/lwawt/macosx/CPrinterDialogPeer.java \ diff --git a/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java index e5f8838c8cd..f4b46c7639a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -33,6 +33,10 @@ import java.awt.peer.ButtonPeer; import javax.swing.JButton; +/** + * Lightweight implementation of {@link ButtonPeer}. Delegates most of the work + * to the {@link JButton}. + */ final class LWButtonPeer extends LWComponentPeer implements ButtonPeer, ActionListener { @@ -42,7 +46,7 @@ final class LWButtonPeer extends LWComponentPeer } @Override - protected JButton createDelegate() { + JButton createDelegate() { return new JButtonDelegate(); } @@ -74,6 +78,7 @@ final class LWButtonPeer extends LWComponentPeer return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JButtonDelegate extends JButton { // Empty non private constructor was added because access to this diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java index 0c80ff0af0d..c7559c216c6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -33,6 +33,10 @@ import java.awt.peer.CanvasPeer; import javax.swing.JComponent; +/** + * Lightweight implementation of {@link CanvasPeer}. This peer is empty, because + * all the components in lwawt use graphic object from the top level window. + */ class LWCanvasPeer extends LWComponentPeer implements CanvasPeer { diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java index de1c378b860..c3b91a2fa86 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -41,6 +41,11 @@ import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.SwingUtilities; +/** + * Lightweight implementation of {@link CheckboxPeer}. Delegates most of the + * work to the {@link JCheckBox} and {@link JRadioButton}, which are placed + * inside an empty {@link JComponent}. + */ final class LWCheckboxPeer extends LWComponentPeer implements CheckboxPeer, ItemListener { @@ -51,12 +56,12 @@ final class LWCheckboxPeer } @Override - protected CheckboxDelegate createDelegate() { + CheckboxDelegate createDelegate() { return new CheckboxDelegate(); } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getDelegate().getCurrentButton(); } @@ -137,6 +142,7 @@ final class LWCheckboxPeer return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class CheckboxDelegate extends JComponent { private final JCheckBox cb; diff --git a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java index c90300e8dcf..5b78e74b6a2 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java @@ -34,6 +34,10 @@ import java.awt.peer.ChoicePeer; import javax.accessibility.Accessible; import javax.swing.*; +/** + * Lightweight implementation of {@link ChoicePeer}. Delegates most of the work + * to the {@link JComboBox}. + */ final class LWChoicePeer extends LWComponentPeer> implements ChoicePeer, ItemListener { @@ -50,7 +54,7 @@ final class LWChoicePeer extends LWComponentPeer> } @Override - protected JComboBox createDelegate() { + JComboBox createDelegate() { return new JComboBoxDelegate(); } @@ -128,6 +132,7 @@ final class LWChoicePeer extends LWComponentPeer> return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JComboBoxDelegate extends JComboBox { // Empty non private constructor was added because access to this diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 5b081b1f2f2..f6adcda7fde 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -72,19 +72,23 @@ public abstract class LWComponentPeer { private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer"); - // State lock is to be used for modifications to this - // peer's fields (e.g. bounds, background, font, etc.) - // It should be the last lock in the lock chain - private final Object stateLock = - new StringBuilder("LWComponentPeer.stateLock"); + /** + * State lock is to be used for modifications to this peer's fields (e.g. + * bounds, background, font, etc.) It should be the last lock in the lock + * chain + */ + private final Object stateLock = new Object(); - // The lock to operate with the peers hierarchy. AWT tree - // lock is not used as there are many peers related ops - // to be done on the toolkit thread, and we don't want to - // depend on a public lock on this thread - private static final Object peerTreeLock = - new StringBuilder("LWComponentPeer.peerTreeLock"); + /** + * The lock to operate with the peers hierarchy. AWT tree lock is not used + * as there are many peers related ops to be done on the toolkit thread, and + * we don't want to depend on a public lock on this thread + */ + private static final Object peerTreeLock = new Object(); + /** + * The associated AWT object. + */ private final T target; /** @@ -95,7 +99,7 @@ public abstract class LWComponentPeer * the hierarchy. The exception is LWWindowPeers: their containers are * always null */ - private final LWContainerPeer containerPeer; + private final LWContainerPeer containerPeer; /** * Handy reference to the top-level window peer. Window peer is borrowed @@ -147,11 +151,18 @@ public abstract class LWComponentPeer */ private Image backBuffer; + /** + * All Swing delegates use delegateContainer as a parent. This container + * intentionally do not use parent of the peer. + */ + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class DelegateContainer extends Container { { enableEvents(0xFFFFFFFF); } + // Empty non private constructor was added because access to this + // class shouldn't be emulated by a synthetic accessor method. DelegateContainer() { super(); } @@ -182,7 +193,7 @@ public abstract class LWComponentPeer } } - public LWComponentPeer(T target, PlatformComponent platformComponent) { + LWComponentPeer(final T target, final PlatformComponent platformComponent) { targetPaintArea = new LWRepaintArea(); this.target = target; this.platformComponent = platformComponent; @@ -276,15 +287,18 @@ public abstract class LWComponentPeer * This method is called under getDelegateLock(). * Overridden in subclasses. */ - protected D createDelegate() { + D createDelegate() { return null; } - protected final D getDelegate() { + final D getDelegate() { return delegate; } - protected Component getDelegateFocusOwner() { + /** + * This method should be called under getDelegateLock(). + */ + Component getDelegateFocusOwner() { return getDelegate(); } @@ -356,7 +370,7 @@ public abstract class LWComponentPeer } // Just a helper method - protected final LWContainerPeer getContainerPeer() { + protected final LWContainerPeer getContainerPeer() { return containerPeer; } @@ -390,7 +404,7 @@ public abstract class LWComponentPeer protected void disposeImpl() { destroyBuffers(); - LWContainerPeer cp = getContainerPeer(); + LWContainerPeer cp = getContainerPeer(); if (cp != null) { cp.removeChildPeer(this); } @@ -462,12 +476,13 @@ public abstract class LWComponentPeer sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion()); } - public Region getVisibleRegion() { + Region getVisibleRegion() { return computeVisibleRect(this, getRegion()); } - static final Region computeVisibleRect(LWComponentPeer c, Region region) { - final LWContainerPeer p = c.getContainerPeer(); + static final Region computeVisibleRect(final LWComponentPeer c, + Region region) { + final LWContainerPeer p = c.getContainerPeer(); if (p != null) { final Rectangle r = c.getBounds(); region = region.getTranslatedRegion(r.x, r.y); @@ -612,7 +627,7 @@ public abstract class LWComponentPeer * @param p Point relative to the peer. * @return Cursor of the peer or null if default cursor should be used. */ - protected Cursor getCursor(final Point p) { + Cursor getCursor(final Point p) { return getTarget().getCursor(); } @@ -717,7 +732,7 @@ public abstract class LWComponentPeer @Override public void setEnabled(final boolean e) { boolean status = e; - final LWComponentPeer cp = getContainerPeer(); + final LWComponentPeer cp = getContainerPeer(); if (cp != null) { status &= cp.isEnabled(); } @@ -802,12 +817,12 @@ public abstract class LWComponentPeer } @Override - public void setZOrder(ComponentPeer above) { - LWContainerPeer cp = getContainerPeer(); + public void setZOrder(final ComponentPeer above) { + LWContainerPeer cp = getContainerPeer(); // Don't check containerPeer for null as it can only happen // for windows, but this method is overridden in // LWWindowPeer and doesn't call super() - cp.setChildPeerZOrder(this, (LWComponentPeer) above); + cp.setChildPeerZOrder(this, (LWComponentPeer) above); } @Override @@ -923,7 +938,9 @@ public abstract class LWComponentPeer LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } - LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer(); + final LWWindowPeer parentPeer = + (LWWindowPeer) AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (parentPeer == null) { focusLog.fine("request rejected, parentPeer is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); @@ -1138,7 +1155,7 @@ public abstract class LWComponentPeer } protected final void repaintParent(final Rectangle oldB) { - final LWContainerPeer cp = getContainerPeer(); + final LWContainerPeer cp = getContainerPeer(); if (cp != null) { // Repaint unobscured part of the parent cp.repaintPeer(cp.getContentSize().intersection(oldB)); @@ -1275,7 +1292,7 @@ public abstract class LWComponentPeer /** * Handler for FocusEvents. */ - protected void handleJavaFocusEvent(FocusEvent e) { + void handleJavaFocusEvent(final FocusEvent e) { // Note that the peer receives all the FocusEvents from // its lightweight children as well KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); @@ -1311,7 +1328,7 @@ public abstract class LWComponentPeer * Finds a top-most visible component for the given point. The location is * specified relative to the peer's parent. */ - public LWComponentPeer findPeerAt(final int x, final int y) { + LWComponentPeer findPeerAt(final int x, final int y) { final Rectangle r = getBounds(); final Region sh = getRegion(); final boolean found = isVisible() && sh.contains(x - r.x, y - r.y); @@ -1328,7 +1345,7 @@ public abstract class LWComponentPeer } public Point windowToLocal(Point p, LWWindowPeer wp) { - LWComponentPeer cp = this; + LWComponentPeer cp = this; while (cp != wp) { Rectangle cpb = cp.getBounds(); p.x -= cpb.x; @@ -1349,7 +1366,7 @@ public abstract class LWComponentPeer } public Point localToWindow(Point p) { - LWComponentPeer cp = getContainerPeer(); + LWComponentPeer cp = getContainerPeer(); Rectangle r = getBounds(); while (cp != null) { p.x += r.x; @@ -1370,7 +1387,7 @@ public abstract class LWComponentPeer repaintPeer(getSize()); } - public void repaintPeer(final Rectangle r) { + void repaintPeer(final Rectangle r) { final Rectangle toPaint = getSize().intersection(r); if (!isShowing() || toPaint.isEmpty()) { return; @@ -1389,7 +1406,7 @@ public abstract class LWComponentPeer protected final boolean isShowing() { synchronized (getPeerTreeLock()) { if (isVisible()) { - final LWContainerPeer container = getContainerPeer(); + final LWContainerPeer container = getContainerPeer(); return (container == null) || container.isShowing(); } } @@ -1397,8 +1414,7 @@ public abstract class LWComponentPeer } /** - * Paints the peer. Overridden in subclasses to delegate the actual painting - * to Swing components. + * Paints the peer. Delegate the actual painting to Swing components. */ protected final void paintPeer(final Graphics g) { final D delegate = getDelegate(); diff --git a/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java index c213664b8ce..3069d3c2a3b 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -41,32 +41,25 @@ import java.util.List; import javax.swing.JComponent; abstract class LWContainerPeer - extends LWCanvasPeer - implements ContainerPeer -{ - // List of child peers sorted by z-order from bottom-most - // to top-most - private List childPeers = - new LinkedList(); + extends LWCanvasPeer implements ContainerPeer { - LWContainerPeer(T target, PlatformComponent platformComponent) { + /** + * List of child peers sorted by z-order from bottom-most to top-most. + */ + private final List> childPeers = new LinkedList<>(); + + LWContainerPeer(final T target, final PlatformComponent platformComponent) { super(target, platformComponent); } - void addChildPeer(LWComponentPeer child) { + final void addChildPeer(final LWComponentPeer child) { synchronized (getPeerTreeLock()) { - addChildPeer(child, childPeers.size()); + childPeers.add(childPeers.size(), child); + // TODO: repaint } } - void addChildPeer(LWComponentPeer child, int index) { - synchronized (getPeerTreeLock()) { - childPeers.add(index, child); - } - // TODO: repaint - } - - void removeChildPeer(LWComponentPeer child) { + final void removeChildPeer(final LWComponentPeer child) { synchronized (getPeerTreeLock()) { childPeers.remove(child); } @@ -74,7 +67,8 @@ abstract class LWContainerPeer } // Used by LWComponentPeer.setZOrder() - void setChildPeerZOrder(LWComponentPeer peer, LWComponentPeer above) { + final void setChildPeerZOrder(final LWComponentPeer peer, + final LWComponentPeer above) { synchronized (getPeerTreeLock()) { childPeers.remove(peer); int index = (above != null) ? childPeers.indexOf(above) : childPeers.size(); @@ -98,25 +92,27 @@ abstract class LWContainerPeer } @Override - public void beginValidate() { - // TODO: it seems that begin/endValidate() is only useful - // for heavyweight windows, when a batch movement for - // child windows occurs. That's why no-op - } - @Override - public void endValidate() { + public final void beginValidate() { // TODO: it seems that begin/endValidate() is only useful // for heavyweight windows, when a batch movement for // child windows occurs. That's why no-op } @Override - public void beginLayout() { + public final void endValidate() { + // TODO: it seems that begin/endValidate() is only useful + // for heavyweight windows, when a batch movement for + // child windows occurs. That's why no-op + } + + @Override + public final void beginLayout() { // Skip all painting till endLayout() setLayouting(true); } + @Override - public void endLayout() { + public final void endLayout() { setLayouting(false); // Post an empty event to flush all the pending target paints @@ -125,18 +121,19 @@ abstract class LWContainerPeer // ---- PEER NOTIFICATIONS ---- // - /* + /** * Returns a copy of the childPeer collection. */ - protected List getChildren() { + @SuppressWarnings("unchecked") + final List> getChildren() { synchronized (getPeerTreeLock()) { - Object copy = ((LinkedList)childPeers).clone(); - return (List)copy; + Object copy = ((LinkedList) childPeers).clone(); + return (List>) copy; } } @Override - public final Region getVisibleRegion() { + final Region getVisibleRegion() { return cutChildren(super.getVisibleRegion(), null); } @@ -144,9 +141,9 @@ abstract class LWContainerPeer * Removes bounds of children above specific child from the region. If above * is null removes all bounds of children. */ - protected final Region cutChildren(Region r, final LWComponentPeer above) { + final Region cutChildren(Region r, final LWComponentPeer above) { boolean aboveFound = above == null; - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { if (!aboveFound && child == above) { aboveFound = true; continue; @@ -170,8 +167,8 @@ abstract class LWContainerPeer * specified relative to the peer's parent. */ @Override - public final LWComponentPeer findPeerAt(int x, int y) { - LWComponentPeer peer = super.findPeerAt(x, y); + final LWComponentPeer findPeerAt(int x, int y) { + LWComponentPeer peer = super.findPeerAt(x, y); final Rectangle r = getBounds(); // Translate to this container's coordinates to pass to children x -= r.x; @@ -179,7 +176,7 @@ abstract class LWContainerPeer if (peer != null && getContentSize().contains(x, y)) { synchronized (getPeerTreeLock()) { for (int i = childPeers.size() - 1; i >= 0; --i) { - LWComponentPeer p = childPeers.get(i).findPeerAt(x, y); + LWComponentPeer p = childPeers.get(i).findPeerAt(x, y); if (p != null) { peer = p; break; @@ -195,7 +192,7 @@ abstract class LWContainerPeer * peers should be repainted */ @Override - public final void repaintPeer(final Rectangle r) { + final void repaintPeer(final Rectangle r) { final Rectangle toPaint = getSize().intersection(r); if (!isShowing() || toPaint.isEmpty()) { return; @@ -208,13 +205,13 @@ abstract class LWContainerPeer repaintChildren(toPaint); } - /* - * Paints all the child peers in the straight z-order, so the - * bottom-most ones are painted first. - */ + /** + * Paints all the child peers in the straight z-order, so the + * bottom-most ones are painted first. + */ private void repaintChildren(final Rectangle r) { final Rectangle content = getContentSize(); - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { final Rectangle childBounds = child.getBounds(); Rectangle toPaint = r.intersection(childBounds); toPaint = toPaint.intersection(content); @@ -223,21 +220,21 @@ abstract class LWContainerPeer } } - protected Rectangle getContentSize() { + Rectangle getContentSize() { return getSize(); } @Override public void setEnabled(final boolean e) { super.setEnabled(e); - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { child.setEnabled(e && child.getTarget().isEnabled()); } } @Override public void setBackground(final Color c) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { if (!child.getTarget().isBackgroundSet()) { child.setBackground(c); } @@ -247,7 +244,7 @@ abstract class LWContainerPeer @Override public void setForeground(final Color c) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { if (!child.getTarget().isForegroundSet()) { child.setForeground(c); } @@ -257,7 +254,7 @@ abstract class LWContainerPeer @Override public void setFont(final Font f) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer child : getChildren()) { if (!child.getTarget().isFontSet()) { child.setFont(f); } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java index de1b537856a..ee9d0dd572e 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -32,6 +32,7 @@ import java.awt.Point; import java.util.concurrent.atomic.AtomicBoolean; +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; public abstract class LWCursorManager { @@ -109,7 +110,8 @@ public abstract class LWCursorManager { cursorPos.y - p.y); } while (c != null) { - if (c.isVisible() && c.isEnabled() && (c.getPeer() != null)) { + final Object p = AWTAccessor.getComponentAccessor().getPeer(c); + if (c.isVisible() && c.isEnabled() && p != null) { break; } c = c.getParent(); diff --git a/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java index 19743da74a3..68af14af333 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -44,7 +44,7 @@ final class LWLabelPeer extends LWComponentPeer } @Override - protected JLabel createDelegate() { + JLabel createDelegate() { return new JLabel(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java index 5edb8e16cd0..e6e1ec38c3d 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -33,7 +33,8 @@ import java.awt.peer.ListPeer; import java.util.Arrays; /** - * Lightweight implementation of {@link ListPeer}. + * Lightweight implementation of {@link ListPeer}. Delegates most of the work to + * the {@link JList}, which is placed inside {@link JScrollPane}. */ final class LWListPeer extends LWComponentPeer implements ListPeer { @@ -56,7 +57,7 @@ final class LWListPeer extends LWComponentPeer } @Override - protected ScrollableJList createDelegate() { + ScrollableJList createDelegate() { return new ScrollableJList(); } @@ -78,7 +79,7 @@ final class LWListPeer extends LWComponentPeer } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getDelegate().getView(); } @@ -193,6 +194,7 @@ final class LWListPeer extends LWComponentPeer } } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class ScrollableJList extends JScrollPane implements ListSelectionListener { private boolean skipStateChangedEvent; @@ -234,9 +236,10 @@ final class LWListPeer extends LWComponentPeer } @Override + @SuppressWarnings("unchecked") public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) { - final JList source = (JList) e.getSource(); + final JList source = (JList) e.getSource(); for(int i = 0 ; i < source.getModel().getSize(); i++) { final boolean wasSelected = Arrays.binarySearch(oldSelectedIndices, i) >= 0; @@ -255,6 +258,7 @@ final class LWListPeer extends LWComponentPeer } } + @SuppressWarnings("unchecked") public JList getView() { return (JList) getViewport().getView(); } @@ -289,7 +293,7 @@ final class LWListPeer extends LWComponentPeer private final class JListDelegate extends JList { JListDelegate() { - super(ScrollableJList.this.model); + super(model); } @Override diff --git a/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java index 2cce1b17269..1920a73d3b0 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -30,10 +30,9 @@ import java.awt.Window; import java.awt.peer.MouseInfoPeer; -public class LWMouseInfoPeer implements MouseInfoPeer { +import sun.awt.AWTAccessor; - public LWMouseInfoPeer() { - } +public class LWMouseInfoPeer implements MouseInfoPeer { @Override public int fillPointWithCoords(Point point) { @@ -52,7 +51,7 @@ public class LWMouseInfoPeer implements MouseInfoPeer { return false; } - LWWindowPeer windowPeer = (LWWindowPeer)w.getPeer(); + final Object windowPeer = AWTAccessor.getComponentAccessor().getPeer(w); return LWWindowPeer.getWindowUnderCursor() == windowPeer; } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java index 6b1f48b08ad..ef1e93e8b11 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -31,6 +31,10 @@ import java.awt.peer.PanelPeer; import javax.swing.JPanel; +/** + * Lightweight implementation of {@link PanelPeer}. Delegates most of the work + * to the {@link JPanel}. + */ final class LWPanelPeer extends LWContainerPeer implements PanelPeer { @@ -39,7 +43,7 @@ final class LWPanelPeer extends LWContainerPeer } @Override - public JPanel createDelegate() { + JPanel createDelegate() { return new JPanel(); } } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java b/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java index e67b2fa435e..7b7c7e8b67d 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -26,39 +26,38 @@ package sun.lwawt; -import sun.awt.RepaintArea; - import java.awt.Component; import java.awt.Graphics; +import sun.awt.AWTAccessor; +import sun.awt.RepaintArea; + /** + * Emulates appearance of heavyweight components before call of the user code. + * * @author Sergey Bylokhov */ final class LWRepaintArea extends RepaintArea { @Override protected void updateComponent(final Component comp, final Graphics g) { + // We shouldn't paint native component as a result of UPDATE events, + // just flush onscreen back-buffer. if (comp != null) { super.updateComponent(comp, g); - flushBuffers((LWComponentPeer) comp.getPeer()); + LWComponentPeer.flushOnscreenGraphics(); } } @Override protected void paintComponent(final Component comp, final Graphics g) { if (comp != null) { - final LWComponentPeer peer = (LWComponentPeer) comp.getPeer(); + Object peer = AWTAccessor.getComponentAccessor().getPeer(comp); if (peer != null) { - peer.paintPeer(g); + ((LWComponentPeer) peer).paintPeer(g); } super.paintComponent(comp, g); - flushBuffers(peer); - } - } - - private static void flushBuffers(final LWComponentPeer peer) { - if (peer != null) { - peer.flushOnscreenGraphics(); + LWComponentPeer.flushOnscreenGraphics(); } } } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java index f5cb0d576e6..6fce0d58461 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java @@ -34,10 +34,14 @@ import java.awt.peer.ScrollbarPeer; import javax.swing.JScrollBar; +/** + * Lightweight implementation of {@link ScrollbarPeer}. Delegates most of the + * work to the {@link JScrollBar}. + */ final class LWScrollBarPeer extends LWComponentPeer implements ScrollbarPeer, AdjustmentListener { - //JScrollBar fires two changes with firePropertyChange (one for old value + // JScrollBar fires two changes with firePropertyChange (one for old value // and one for new one. // We save the last value and don't fire event if not changed. private int currentValue; @@ -48,7 +52,7 @@ final class LWScrollBarPeer extends LWComponentPeer } @Override - protected JScrollBar createDelegate() { + JScrollBar createDelegate() { return new JScrollBar(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java index 723a9dd8da7..4db7cac124a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -33,6 +33,10 @@ import java.awt.event.MouseWheelEvent; import java.awt.peer.ScrollPanePeer; import java.util.List; +/** + * Lightweight implementation of {@link ScrollPanePeer}. Delegates most of the + * work to the {@link JScrollPane}. + */ final class LWScrollPanePeer extends LWContainerPeer implements ScrollPanePeer, ChangeListener { @@ -41,7 +45,8 @@ final class LWScrollPanePeer extends LWContainerPeer super(target, platformComponent); } - protected JScrollPane createDelegate() { + @Override + JScrollPane createDelegate() { final JScrollPane sp = new JScrollPane(); final JPanel panel = new JPanel(); panel.setOpaque(false); @@ -72,7 +77,7 @@ final class LWScrollPanePeer extends LWContainerPeer SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - final LWComponentPeer viewPeer = getViewPeer(); + final LWComponentPeer viewPeer = getViewPeer(); if (viewPeer != null) { final Rectangle r; synchronized (getDelegateLock()) { @@ -96,14 +101,13 @@ final class LWScrollPanePeer extends LWContainerPeer } } - LWComponentPeer getViewPeer() { - List peerList = getChildren(); + LWComponentPeer getViewPeer() { + final List> peerList = getChildren(); return peerList.isEmpty() ? null : peerList.get(0); } - @Override - protected Rectangle getContentSize() { + Rectangle getContentSize() { Rectangle viewRect = getDelegate().getViewport().getViewRect(); return new Rectangle(viewRect.width, viewRect.height); } @@ -112,7 +116,7 @@ final class LWScrollPanePeer extends LWContainerPeer public void layout() { super.layout(); synchronized (getDelegateLock()) { - LWComponentPeer viewPeer = getViewPeer(); + final LWComponentPeer viewPeer = getViewPeer(); if (viewPeer != null) { Component view = getDelegate().getViewport().getView(); view.setBounds(viewPeer.getBounds()); diff --git a/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java index 98032e20c29..5db1b6ca296 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -44,7 +44,7 @@ import javax.swing.text.JTextComponent; /** * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the - * work to the {@link JTextArea} inside JScrollPane. + * work to the {@link JTextArea} inside {@link JScrollPane}. */ final class LWTextAreaPeer extends LWTextComponentPeer @@ -66,7 +66,7 @@ final class LWTextAreaPeer } @Override - protected ScrollableJTextArea createDelegate() { + ScrollableJTextArea createDelegate() { return new ScrollableJTextArea(); } @@ -85,7 +85,7 @@ final class LWTextAreaPeer } @Override - protected Cursor getCursor(final Point p) { + Cursor getCursor(final Point p) { final boolean isContains; synchronized (getDelegateLock()) { isContains = getDelegate().getViewport().getBounds().contains(p); @@ -94,7 +94,7 @@ final class LWTextAreaPeer } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getTextComponent(); } @@ -200,7 +200,7 @@ final class LWTextAreaPeer } } - @SuppressWarnings("serial") + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class ScrollableJTextArea extends JScrollPane { ScrollableJTextArea() { @@ -218,7 +218,6 @@ final class LWTextAreaPeer super.setEnabled(enabled); } - @SuppressWarnings("serial") private final class JTextAreaDelegate extends JTextArea { // Empty non private constructor was added because access to this diff --git a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java index aab0baf43e0..860aa546610 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -44,11 +44,14 @@ import javax.swing.event.DocumentListener; import javax.swing.text.Document; import javax.swing.text.JTextComponent; +/** + * Lightweight implementation of {@link TextComponentPeer}. Provides useful + * methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer} + */ abstract class LWTextComponentPeer extends LWComponentPeer implements DocumentListener, TextComponentPeer, InputMethodListener { - private volatile boolean firstChangeSkipped; LWTextComponentPeer(final T target, @@ -218,14 +221,14 @@ abstract class LWTextComponentPeer implements TextFieldPeer, ActionListener { @@ -47,7 +51,7 @@ final class LWTextFieldPeer } @Override - protected JPasswordField createDelegate() { + JPasswordField createDelegate() { return new JPasswordFieldDelegate(); } @@ -107,7 +111,7 @@ final class LWTextFieldPeer * @param e the focus event */ @Override - protected void handleJavaFocusEvent(final FocusEvent e) { + void handleJavaFocusEvent(final FocusEvent e) { if (e.getID() == FocusEvent.FOCUS_LOST) { // In order to de-select the selection setCaretPosition(0); @@ -115,6 +119,7 @@ final class LWTextFieldPeer super.handleJavaFocusEvent(e); } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JPasswordFieldDelegate extends JPasswordField { // Empty non private constructor was added because access to this diff --git a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java index 9765066d9d2..f98dffbf3f1 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java @@ -557,16 +557,18 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { } @Override - public void grab(Window w) { - if (w.getPeer() != null) { - ((LWWindowPeer)w.getPeer()).grab(); + public void grab(final Window w) { + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((LWWindowPeer) peer).grab(); } } @Override - public void ungrab(Window w) { - if (w.getPeer() != null) { - ((LWWindowPeer)w.getPeer()).ungrab(false); + public void ungrab(final Window w) { + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((LWWindowPeer) peer).ungrab(false); } } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 6000016306a..632fe844e7b 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -43,7 +43,7 @@ public class LWWindowPeer extends LWContainerPeer implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier { - public static enum PeerType { + public enum PeerType { SIMPLEWINDOW, FRAME, DIALOG, @@ -83,15 +83,15 @@ public class LWWindowPeer // A peer where the last mouse event came to. Used by cursor manager to // find the component under cursor - private static volatile LWComponentPeer lastCommonMouseEventPeer = null; + private static volatile LWComponentPeer lastCommonMouseEventPeer; // A peer where the last mouse event came to. Used to generate // MOUSE_ENTERED/EXITED notifications - private volatile LWComponentPeer lastMouseEventPeer; + private volatile LWComponentPeer lastMouseEventPeer; // Peers where all dragged/released events should come to, // depending on what mouse button is being dragged according to Cocoa - private static LWComponentPeer mouseDownTarget[] = new LWComponentPeer[3]; + private static final LWComponentPeer[] mouseDownTarget = new LWComponentPeer[3]; // A bitmask that indicates what mouse buttons produce MOUSE_CLICKED events // on MOUSE_RELEASE. Click events are only generated if there were no drag @@ -129,7 +129,8 @@ public class LWWindowPeer this.peerType = peerType; Window owner = target.getOwner(); - LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null; + LWWindowPeer ownerPeer = owner == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); PlatformWindow ownerDelegate = (ownerPeer != null) ? ownerPeer.getPlatformWindow() : null; // The delegate.initialize() needs a non-null GC on X11. @@ -163,10 +164,10 @@ public class LWWindowPeer // Init warning window(for applets) SecurityWarningWindow warn = null; - if (((Window)target).getWarningString() != null) { + if (target.getWarningString() != null) { // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip // and TrayIcon balloon windows without a warning window. - if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) { + if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) { LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit(); warn = toolkit.createSecurityWarning(target, this); } @@ -210,6 +211,7 @@ public class LWWindowPeer } // Just a helper method + @Override public PlatformWindow getPlatformWindow() { return platformWindow; } @@ -391,7 +393,8 @@ public class LWWindowPeer @Override public void setModalBlocked(Dialog blocker, boolean blocked) { synchronized (getPeerTreeLock()) { - this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null; + this.blocker = !blocked ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(blocker); } platformWindow.setModalBlocked(blocked); @@ -458,6 +461,7 @@ public class LWWindowPeer textured = isTextured; } + @Override public final boolean isTranslucent() { synchronized (getStateLock()) { /* @@ -537,7 +541,8 @@ public class LWWindowPeer public void blockWindows(List windows) { //TODO: LWX will probably need some collectJavaToplevels to speed this up for (Window w : windows) { - WindowPeer wp = (WindowPeer)w.getPeer(); + WindowPeer wp = + (WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { wp.setModalBlocked((Dialog)getTarget(), true); } @@ -694,7 +699,7 @@ public class LWWindowPeer // TODO: fill "bdata" member of AWTEvent Rectangle r = getBounds(); // findPeerAt() expects parent coordinates - LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); + LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); if (id == MouseEvent.MOUSE_EXITED) { isMouseOver = false; @@ -743,7 +748,7 @@ public class LWWindowPeer screenX, screenY, modifiers, clickCount, popupTrigger, targetPeer); } else { - LWComponentPeer topmostTargetPeer = + LWComponentPeer topmostTargetPeer = topmostWindowPeer != null ? topmostWindowPeer.findPeerAt(r.x + x, r.y + y) : null; topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y, screenX, screenY, modifiers, clickCount, popupTrigger, @@ -840,7 +845,7 @@ public class LWWindowPeer private void generateMouseEnterExitEventsForComponents(long when, int button, int x, int y, int screenX, int screenY, int modifiers, int clickCount, boolean popupTrigger, - LWComponentPeer targetPeer) { + final LWComponentPeer targetPeer) { if (!isMouseOver || targetPeer == lastMouseEventPeer) { return; @@ -899,7 +904,7 @@ public class LWWindowPeer // TODO: could we just use the last mouse event target here? Rectangle r = getBounds(); // findPeerAt() expects parent coordinates - final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); + final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); if (targetPeer == null || !targetPeer.isEnabled()) { return; } @@ -1157,8 +1162,9 @@ public class LWWindowPeer if (focusLog.isLoggable(PlatformLogger.Level.FINE)) { focusLog.fine("requesting native focus to the owner " + owner); } - LWWindowPeer currentActivePeer = (currentActive != null ? - (LWWindowPeer)currentActive.getPeer() : null); + LWWindowPeer currentActivePeer = currentActive == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer( + currentActive); // Ensure the opposite is natively active and suppress sending events. if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) { @@ -1270,7 +1276,8 @@ public class LWWindowPeer while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); } - return owner != null ? (LWWindowPeer)owner.getPeer() : null; + return owner == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); } /** @@ -1289,11 +1296,13 @@ public class LWWindowPeer } } + @Override public void enterFullScreenMode() { platformWindow.enterFullScreenMode(); updateSecurityWarningVisibility(); } + @Override public void exitFullScreenMode() { platformWindow.exitFullScreenMode(); updateSecurityWarningVisibility(); diff --git a/jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java b/jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java deleted file mode 100644 index 4b378484240..00000000000 --- a/jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.lwawt; - -/* - * Every time the TextField (or TextArea) change selection, every other text components - * must immediately clear their selections. - */ -interface SelectionClearListener { - void clearSelection(); -} From eacd2bcb72f3c8bc5b17fc31dae78f06a39e3394 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Mon, 23 Sep 2013 17:27:38 +0400 Subject: [PATCH 199/983] 7154966: CRs found to be in Fixed state with no test and no noreg- keyword Reviewed-by: ksrini --- langtools/test/tools/javac/T7090499.java | 14 ++++++++++++++ langtools/test/tools/javac/T7090499.out | 2 ++ langtools/test/tools/javac/T7120463.java | 11 +++++++++++ langtools/test/tools/javac/T7120463.out | 3 +++ langtools/test/tools/javac/T7126754.java | 19 +++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 langtools/test/tools/javac/T7090499.java create mode 100644 langtools/test/tools/javac/T7090499.out create mode 100644 langtools/test/tools/javac/T7120463.java create mode 100644 langtools/test/tools/javac/T7120463.out create mode 100644 langtools/test/tools/javac/T7126754.java diff --git a/langtools/test/tools/javac/T7090499.java b/langtools/test/tools/javac/T7090499.java new file mode 100644 index 00000000000..b05cda52c4b --- /dev/null +++ b/langtools/test/tools/javac/T7090499.java @@ -0,0 +1,14 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7090499 + * @summary missing rawtypes warnings in anonymous inner class + * @compile/ref=T7090499.out -Xlint:rawtypes -XDrawDiagnostics T7090499.java + */ + +class T7090499 { + { + new Object() { + T7090499 x; + }; + } +} diff --git a/langtools/test/tools/javac/T7090499.out b/langtools/test/tools/javac/T7090499.out new file mode 100644 index 00000000000..54b68474f79 --- /dev/null +++ b/langtools/test/tools/javac/T7090499.out @@ -0,0 +1,2 @@ +T7090499.java:11:13: compiler.warn.raw.class.use: T7090499, T7090499 +1 warning diff --git a/langtools/test/tools/javac/T7120463.java b/langtools/test/tools/javac/T7120463.java new file mode 100644 index 00000000000..9f64a17178a --- /dev/null +++ b/langtools/test/tools/javac/T7120463.java @@ -0,0 +1,11 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7120463 + * @summary Fix method reference parser support in order to avoid ambiguities + * @compile/fail/ref=T7120463.out -XDrawDiagnostics T7120463.java + */ + +class T7120463 { + void test() { that(i < len, "oopmap"); } + void that(int i, String s) { }; +} diff --git a/langtools/test/tools/javac/T7120463.out b/langtools/test/tools/javac/T7120463.out new file mode 100644 index 00000000000..527bd52acf2 --- /dev/null +++ b/langtools/test/tools/javac/T7120463.out @@ -0,0 +1,3 @@ +T7120463.java:9:24: compiler.err.cant.resolve.location: kindname.variable, i, , , (compiler.misc.location: kindname.class, T7120463, null) +T7120463.java:9:28: compiler.err.cant.resolve.location: kindname.variable, len, , , (compiler.misc.location: kindname.class, T7120463, null) +2 errors diff --git a/langtools/test/tools/javac/T7126754.java b/langtools/test/tools/javac/T7126754.java new file mode 100644 index 00000000000..0b9d32409db --- /dev/null +++ b/langtools/test/tools/javac/T7126754.java @@ -0,0 +1,19 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7126754 + * @summary Generics compilation failure casting List to List + * @compile T7126754.java + */ + +import java.util.List; +import java.util.Set; + +public class T7126754 { + public static void main(String[] args) { + List> a = null; + List> b = a; + + List> c = null; + List> d = (List>)c; + } +} From 10ff8a3aa481e5ef72e20112c86f98520aa4eadd Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 23 Sep 2013 17:55:36 +0400 Subject: [PATCH 200/983] 7172833: For default java.awt.Toolkit impl methods java.awt.Toolkit.is/setDynamicLayout() are not consistent Reviewed-by: alexsch, anthony --- jdk/src/share/classes/java/awt/Toolkit.java | 9 +- .../awt/Toolkit/DynamicLayout/bug7172833.java | 314 ++++++++++++++++++ 2 files changed, 320 insertions(+), 3 deletions(-) create mode 100644 jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index 6b669d33677..de14eef1fea 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -468,7 +468,7 @@ public abstract class Toolkit { GraphicsEnvironment.checkHeadless(); } -/** + /** * Controls whether the layout of Containers is validated dynamically * during resizing, or statically, after resizing is complete. * Use {@code isDynamicLayoutActive()} to detect if this feature enabled @@ -498,9 +498,12 @@ public abstract class Toolkit { * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 */ - public void setDynamicLayout(boolean dynamic) + public void setDynamicLayout(final boolean dynamic) throws HeadlessException { GraphicsEnvironment.checkHeadless(); + if (this != getDefaultToolkit()) { + getDefaultToolkit().setDynamicLayout(dynamic); + } } /** diff --git a/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java b/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java new file mode 100644 index 00000000000..3780b7deacc --- /dev/null +++ b/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java @@ -0,0 +1,314 @@ +/* + * 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.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.font.TextAttribute; +import java.awt.im.InputMethodHighlight; +import java.awt.image.ColorModel; +import java.awt.image.ImageObserver; +import java.awt.image.ImageProducer; +import java.awt.peer.*; +import java.net.URL; +import java.util.Map; +import java.util.Properties; + + +/** + * @test + * @bug 7172833 + * @summary java.awt.Toolkit methods is/setDynamicLayout() should be consistent. + * @author Sergey Bylokhov + */ +public final class bug7172833 { + + public static void main(final String[] args) throws Exception { + final StubbedToolkit t = new StubbedToolkit(); + + t.setDynamicLayout(true); + if(!t.isDynamicLayoutSet()){ + throw new RuntimeException("'true' expected but 'false' returned"); + } + + t.setDynamicLayout(false); + if(t.isDynamicLayoutSet()){ + throw new RuntimeException("'false' expected but 'true' returned"); + } + } + + static final class StubbedToolkit extends Toolkit { + + @Override + protected boolean isDynamicLayoutSet() throws HeadlessException { + return super.isDynamicLayoutSet(); + } + + @Override + protected DesktopPeer createDesktopPeer(final Desktop target) + throws HeadlessException { + return null; + } + + @Override + protected ButtonPeer createButton(final Button target) + throws HeadlessException { + return null; + } + + @Override + protected TextFieldPeer createTextField(final TextField target) + throws HeadlessException { + return null; + } + + @Override + protected LabelPeer createLabel(final Label target) throws HeadlessException { + return null; + } + + @Override + protected ListPeer createList(final List target) throws HeadlessException { + return null; + } + + @Override + protected CheckboxPeer createCheckbox(final Checkbox target) + throws HeadlessException { + return null; + } + + @Override + protected ScrollbarPeer createScrollbar(final Scrollbar target) + throws HeadlessException { + return null; + } + + @Override + protected ScrollPanePeer createScrollPane(final ScrollPane target) + throws HeadlessException { + return null; + } + + @Override + protected TextAreaPeer createTextArea(final TextArea target) + throws HeadlessException { + return null; + } + + @Override + protected ChoicePeer createChoice(final Choice target) + throws HeadlessException { + return null; + } + + @Override + protected FramePeer createFrame(final Frame target) throws HeadlessException { + return null; + } + + @Override + protected CanvasPeer createCanvas(final Canvas target) { + return null; + } + + @Override + protected PanelPeer createPanel(final Panel target) { + return null; + } + + @Override + protected WindowPeer createWindow(final Window target) + throws HeadlessException { + return null; + } + + @Override + protected DialogPeer createDialog(final Dialog target) + throws HeadlessException { + return null; + } + + @Override + protected MenuBarPeer createMenuBar(final MenuBar target) + throws HeadlessException { + return null; + } + + @Override + protected MenuPeer createMenu(final Menu target) throws HeadlessException { + return null; + } + + @Override + protected PopupMenuPeer createPopupMenu(final PopupMenu target) + throws HeadlessException { + return null; + } + + @Override + protected MenuItemPeer createMenuItem(final MenuItem target) + throws HeadlessException { + return null; + } + + @Override + protected FileDialogPeer createFileDialog(final FileDialog target) + throws HeadlessException { + return null; + } + + @Override + protected CheckboxMenuItemPeer createCheckboxMenuItem( + final CheckboxMenuItem target) throws HeadlessException { + return null; + } + + @Override + protected FontPeer getFontPeer(final String name, final int style) { + return null; + } + + @Override + public Dimension getScreenSize() throws HeadlessException { + return null; + } + + @Override + public int getScreenResolution() throws HeadlessException { + return 0; + } + + @Override + public ColorModel getColorModel() throws HeadlessException { + return null; + } + + @Override + public String[] getFontList() { + return new String[0]; + } + + @Override + public FontMetrics getFontMetrics(final Font font) { + return null; + } + + @Override + public void sync() { + + } + + @Override + public Image getImage(final String filename) { + return null; + } + + @Override + public Image getImage(final URL url) { + return null; + } + + @Override + public Image createImage(final String filename) { + return null; + } + + @Override + public Image createImage(final URL url) { + return null; + } + + @Override + public boolean prepareImage( + final Image image, final int width, final int height, + final ImageObserver observer) { + return false; + } + + @Override + public int checkImage(final Image image, final int width, final int height, + final ImageObserver observer) { + return 0; + } + + @Override + public Image createImage(final ImageProducer producer) { + return null; + } + + @Override + public Image createImage(final byte[] imagedata, final int imageoffset, + final int imagelength) { + return null; + } + + @Override + public PrintJob getPrintJob(final Frame frame, final String jobtitle, + final Properties props) { + return null; + } + + @Override + public void beep() { + + } + + @Override + public Clipboard getSystemClipboard() throws HeadlessException { + return null; + } + + @Override + protected EventQueue getSystemEventQueueImpl() { + return null; + } + + @Override + public DragSourceContextPeer createDragSourceContextPeer( + final DragGestureEvent dge) throws InvalidDnDOperationException { + return null; + } + + @Override + public boolean isModalityTypeSupported( + final Dialog.ModalityType modalityType) { + return false; + } + + @Override + public boolean isModalExclusionTypeSupported( + final Dialog.ModalExclusionType modalExclusionType) { + return false; + } + + @Override + public Map mapInputMethodHighlight( + final InputMethodHighlight highlight) throws HeadlessException { + return null; + } + } +} From e815841576eb30fe7e7b9c0582041044b8eb63e7 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Mon, 23 Sep 2013 18:29:27 +0400 Subject: [PATCH 201/983] 4881267: improve diagnostic for "instanceof T" for type parameter T Reviewed-by: vromero, jjg --- .../classes/com/sun/tools/javac/comp/Attr.java | 10 ++++++++-- .../classes/com/sun/tools/javac/comp/Check.java | 14 -------------- langtools/test/tools/javac/T4881267.java | 12 ++++++++++++ langtools/test/tools/javac/T4881267.out | 2 ++ 4 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 langtools/test/tools/javac/T4881267.java create mode 100644 langtools/test/tools/javac/T4881267.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 3813a6acd7a..0b4db2c059f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -3102,8 +3102,14 @@ public class Attr extends JCTree.Visitor { public void visitTypeTest(JCInstanceOf tree) { Type exprtype = chk.checkNullOrRefType( tree.expr.pos(), attribExpr(tree.expr, env)); - Type clazztype = chk.checkReifiableReferenceType( - tree.clazz.pos(), attribType(tree.clazz, env)); + Type clazztype = attribType(tree.clazz, env); + if (!clazztype.hasTag(TYPEVAR)) { + clazztype = chk.checkClassOrArrayType(tree.clazz.pos(), clazztype); + } + if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) { + log.error(tree.clazz.pos(), "illegal.generic.type.for.instof"); + clazztype = types.createErrorType(clazztype); + } chk.validate(tree.clazz, env, false); chk.checkCastable(tree.expr.pos(), exprtype, clazztype); result = check(tree, syms.booleanType, VAL, resultInfo); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index a9ad0a68299..453bc70edda 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -706,20 +706,6 @@ public class Check { return t; } - /** Check that type is a reifiable class, interface or array type. - * @param pos Position to be used for error reporting. - * @param t The type to be checked. - */ - Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) { - t = checkClassOrArrayType(pos, t); - if (!t.isErroneous() && !types.isReifiable(t)) { - log.error(pos, "illegal.generic.type.for.instof"); - return types.createErrorType(t); - } else { - return t; - } - } - /** Check that type is a reference type, i.e. a class, interface or array type * or a type variable. * @param pos Position to be used for error reporting. diff --git a/langtools/test/tools/javac/T4881267.java b/langtools/test/tools/javac/T4881267.java new file mode 100644 index 00000000000..33690add37b --- /dev/null +++ b/langtools/test/tools/javac/T4881267.java @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 4881267 + * @summary improve diagnostic for "instanceof T" for type parameter T + * @compile/fail/ref=T4881267.out -XDrawDiagnostics T4881267.java + */ + +class T4881267 { + void m(Object o) { + boolean b = o instanceof T; + } +} diff --git a/langtools/test/tools/javac/T4881267.out b/langtools/test/tools/javac/T4881267.out new file mode 100644 index 00000000000..01a732a612e --- /dev/null +++ b/langtools/test/tools/javac/T4881267.out @@ -0,0 +1,2 @@ +T4881267.java:10:34: compiler.err.illegal.generic.type.for.instof +1 error From 522051490c44d11e8bb241eeefc92c0e645c0a96 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 23 Sep 2013 08:56:19 -0700 Subject: [PATCH 202/983] 8025088: Missing cases for JVM_CONSTANT_MethodHandleInError cause crash if debugger steps into error-tagged method handle Need to refetch each method from InstanceKlass after all safepoints. Removed leaky PreviousVersionInfo code. Reviewed-by: coleenp, sspitsyn --- hotspot/src/share/vm/oops/constantPool.cpp | 14 +++++---- hotspot/src/share/vm/oops/constantPool.hpp | 36 ++++++++++++++++++---- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index 4f888eb9ca4..66493a879e1 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -1611,9 +1611,11 @@ jint ConstantPool::cpool_entry_size(jint idx) { case JVM_CONSTANT_UnresolvedClassInError: case JVM_CONSTANT_StringIndex: case JVM_CONSTANT_MethodType: + case JVM_CONSTANT_MethodTypeInError: return 3; case JVM_CONSTANT_MethodHandle: + case JVM_CONSTANT_MethodHandleInError: return 4; //tag, ref_kind, ref_index case JVM_CONSTANT_Integer: @@ -1794,8 +1796,8 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, case JVM_CONSTANT_MethodHandle: case JVM_CONSTANT_MethodHandleInError: { *bytes = JVM_CONSTANT_MethodHandle; - int kind = method_handle_ref_kind_at(idx); - idx1 = method_handle_index_at(idx); + int kind = method_handle_ref_kind_at_error_ok(idx); + idx1 = method_handle_index_at_error_ok(idx); *(bytes+1) = (unsigned char) kind; Bytes::put_Java_u2((address) (bytes+2), idx1); DBG(printf("JVM_CONSTANT_MethodHandle: %d %hd", kind, idx1)); @@ -1804,7 +1806,7 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, case JVM_CONSTANT_MethodType: case JVM_CONSTANT_MethodTypeInError: { *bytes = JVM_CONSTANT_MethodType; - idx1 = method_type_index_at(idx); + idx1 = method_type_index_at_error_ok(idx); Bytes::put_Java_u2((address) (bytes+1), idx1); DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); break; @@ -1992,12 +1994,12 @@ void ConstantPool::print_entry_on(const int index, outputStream* st) { break; case JVM_CONSTANT_MethodHandle : case JVM_CONSTANT_MethodHandleInError : - st->print("ref_kind=%d", method_handle_ref_kind_at(index)); - st->print(" ref_index=%d", method_handle_index_at(index)); + st->print("ref_kind=%d", method_handle_ref_kind_at_error_ok(index)); + st->print(" ref_index=%d", method_handle_index_at_error_ok(index)); break; case JVM_CONSTANT_MethodType : case JVM_CONSTANT_MethodTypeInError : - st->print("signature_index=%d", method_type_index_at(index)); + st->print("signature_index=%d", method_type_index_at_error_ok(index)); break; case JVM_CONSTANT_InvokeDynamic : { diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp index 93c32348573..47a51a835e2 100644 --- a/hotspot/src/share/vm/oops/constantPool.hpp +++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -474,18 +474,42 @@ class ConstantPool : public Metadata { return *int_at_addr(which); } - int method_handle_ref_kind_at(int which) { - assert(tag_at(which).is_method_handle(), "Corrupted constant pool"); + private: + int method_handle_ref_kind_at(int which, bool error_ok) { + assert(tag_at(which).is_method_handle() || + (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool"); return extract_low_short_from_int(*int_at_addr(which)); // mask out unwanted ref_index bits } - int method_handle_index_at(int which) { - assert(tag_at(which).is_method_handle(), "Corrupted constant pool"); + int method_handle_index_at(int which, bool error_ok) { + assert(tag_at(which).is_method_handle() || + (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool"); return extract_high_short_from_int(*int_at_addr(which)); // shift out unwanted ref_kind bits } - int method_type_index_at(int which) { - assert(tag_at(which).is_method_type(), "Corrupted constant pool"); + int method_type_index_at(int which, bool error_ok) { + assert(tag_at(which).is_method_type() || + (error_ok && tag_at(which).is_method_type_in_error()), "Corrupted constant pool"); return *int_at_addr(which); } + public: + int method_handle_ref_kind_at(int which) { + return method_handle_ref_kind_at(which, false); + } + int method_handle_ref_kind_at_error_ok(int which) { + return method_handle_ref_kind_at(which, true); + } + int method_handle_index_at(int which) { + return method_handle_index_at(which, false); + } + int method_handle_index_at_error_ok(int which) { + return method_handle_index_at(which, true); + } + int method_type_index_at(int which) { + return method_type_index_at(which, false); + } + int method_type_index_at_error_ok(int which) { + return method_type_index_at(which, true); + } + // Derived queries: Symbol* method_handle_name_ref_at(int which) { int member = method_handle_index_at(which); From b99f593316af3f74c9e07c1e688b1794f5993a5c Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev Date: Mon, 23 Sep 2013 21:24:34 +0400 Subject: [PATCH 203/983] 8019282: keyRelesed is reached even though key was NOT released Reviewed-by: serb, anthony --- jdk/make/sun/xawt/mapfile-vers | 1 + jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers | 1 + jdk/src/solaris/classes/sun/awt/X11/XToolkit.java | 2 ++ jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java | 1 + jdk/src/solaris/native/sun/xawt/XlibWrapper.c | 8 ++++++-- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/jdk/make/sun/xawt/mapfile-vers b/jdk/make/sun/xawt/mapfile-vers index 5455530cbed..e75f0c1914b 100644 --- a/jdk/make/sun/xawt/mapfile-vers +++ b/jdk/make/sun/xawt/mapfile-vers @@ -305,6 +305,7 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap; Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard; Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode; + Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat; Java_sun_awt_X11_XlibWrapper_XGetModifierMapping; Java_sun_awt_X11_XlibWrapper_XFreeModifiermap; Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping; diff --git a/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers b/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers index 7a1a8117a3d..a2bb9bda97b 100644 --- a/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers +++ b/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers @@ -305,6 +305,7 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap; Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard; Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode; + Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat; Java_sun_awt_X11_XlibWrapper_XGetModifierMapping; Java_sun_awt_X11_XlibWrapper_XFreeModifiermap; Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index 9b4daa1cef6..7fa438f4484 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -2249,6 +2249,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { XConstants.XkbModifierMapMask | XConstants.XkbVirtualModsMask, XConstants.XkbUseCoreKbd); + + XlibWrapper.XkbSetDetectableAutoRepeat(getDisplay(), true); } } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java index 2d8fc851d06..02a7c4b2aa4 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java @@ -509,6 +509,7 @@ static native String XSetLocaleModifiers(String modifier_list); static native long XkbGetUpdatedMap(long display, long which, long xkb); static native void XkbFreeKeyboard(long xkb, long which, boolean free_all); static native boolean XkbTranslateKeyCode(long xkb, int keycode, long mods, long mods_rtrn, long keysym_rtrn); + static native void XkbSetDetectableAutoRepeat(long display, boolean detectable); static native void XConvertCase(long keysym, diff --git a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c index da328719304..3e75f291c94 100644 --- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c +++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c @@ -523,8 +523,12 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode //printf("native, output: keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn)); return b; } - - +JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat +(JNIEnv *env, jclass clazz, jlong display, jboolean detectable) +{ + AWT_CHECK_HAVE_LOCK(); + XkbSetDetectableAutoRepeat((Display *) jlong_to_ptr(display), detectable, NULL); +} /* * Class: sun_awt_X11_XlibWrapper * Method: XNextEvent From c101eca6bb94ad082a0e961dc8e46ee076ef3b30 Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Mon, 23 Sep 2013 15:37:59 -0400 Subject: [PATCH 204/983] 6499673: Assertion check for TypeVariable.getUpperBound() fails Fix TypeVariable.getUpperBound to return results as specified Reviewed-by: jjg --- .../com/sun/tools/javac/code/Type.java | 2 +- .../com/sun/tools/javac/code/Types.java | 23 ++ .../com/sun/tools/javac/model/JavacTypes.java | 6 +- .../cast/intersection/model/Model01.java | 4 +- .../cast/intersection/model/ModelChecker.java | 2 +- .../processing/model/type/BoundsTest.java | 200 ++++++++++++++++++ .../type/IntersectionPropertiesTest.java | 135 ++++++++++++ 7 files changed, 363 insertions(+), 9 deletions(-) create mode 100644 langtools/test/tools/javac/processing/model/type/BoundsTest.java create mode 100644 langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java index a6e4642ce51..699ac7ebedc 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java @@ -977,7 +977,7 @@ public abstract class Type implements TypeMirror { } public java.util.List getBounds() { - return Collections.unmodifiableList(getComponents()); + return Collections.unmodifiableList(getExplicitComponents()); } public List getComponents() { diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 996bcd88018..84eaf4a431e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -2414,6 +2414,29 @@ public class Types { } }; + public List directSupertypes(Type t) { + return directSupertypes.visit(t); + } + // where + private final UnaryVisitor> directSupertypes = new UnaryVisitor>() { + + public List visitType(final Type type, final Void ignored) { + if (!type.isCompound()) { + final Type sup = supertype(type); + return (sup == Type.noType || sup == type || sup == null) + ? interfaces(type) + : interfaces(type).prepend(sup); + } else { + return visitIntersectionType((IntersectionClassType) type); + } + } + + private List visitIntersectionType(final IntersectionClassType it) { + return it.getExplicitComponents(); + } + + }; + public boolean isDirectSuperInterface(TypeSymbol isym, TypeSymbol origin) { for (Type i2 : interfaces(origin.type)) { if (isym == i2.tsym) return true; diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java index 14e377fb37f..726264bb79c 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java @@ -116,11 +116,7 @@ public class JavacTypes implements javax.lang.model.util.Types { public List directSupertypes(TypeMirror t) { validateTypeNotIn(t, EXEC_OR_PKG); - Type type = (Type) t; - Type sup = types.supertype(type); - return (sup == Type.noType || sup == type || sup == null) - ? types.interfaces(type) - : types.interfaces(type).prepend(sup); + return types.directSupertypes((Type) t); } public TypeMirror erasure(TypeMirror t) { diff --git a/langtools/test/tools/javac/cast/intersection/model/Model01.java b/langtools/test/tools/javac/cast/intersection/model/Model01.java index 21740179f49..782644726ca 100644 --- a/langtools/test/tools/javac/cast/intersection/model/Model01.java +++ b/langtools/test/tools/javac/cast/intersection/model/Model01.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8002099 + * @bug 8002099 6499673 * @summary Add support for intersection types in cast expression * @library /tools/javac/lib * @build JavacTestingAbstractProcessor ModelChecker @@ -46,7 +46,7 @@ class Test { } void test(){ - @IntersectionTypeInfo({"java.lang.Object", "Test.A", "Test.B"}) + @IntersectionTypeInfo({"Test.A", "Test.B"}) Object o = (A & B)null; } } diff --git a/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java b/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java index 1486d21bf1b..d2dbf697fdc 100644 --- a/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java +++ b/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java @@ -97,7 +97,7 @@ public class ModelChecker extends JavacTestingAbstractProcessor { } } - assertTrue(assertionCount == 10, "Expected 10 assertions - found " + assertionCount); + assertTrue(assertionCount == 9, "Expected 9 assertions - found " + assertionCount); return super.visitVariable(node, p); } } diff --git a/langtools/test/tools/javac/processing/model/type/BoundsTest.java b/langtools/test/tools/javac/processing/model/type/BoundsTest.java new file mode 100644 index 00000000000..59c73ef6a0c --- /dev/null +++ b/langtools/test/tools/javac/processing/model/type/BoundsTest.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 6499673 + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor BoundsTest + * @run main BoundsTest + * @summary Assertion check for TypeVariable.getUpperBound() fails + */ + +import com.sun.source.util.*; +import com.sun.tools.javac.api.*; +import com.sun.tools.javac.file.*; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.type.*; +import javax.lang.model.util.ElementFilter; +import javax.lang.model.element.*; +import javax.tools.*; +import java.util.*; +import java.io.*; + +public class BoundsTest { + + private int errors = 0; + private static final String Intersection_name = "IntersectionTest.java"; + private static final String Intersection_contents = + "import java.util.List;\n" + + "import java.io.Serializable;\t" + + "public class IntersectionTest {\n" + + " void method(S s) { }\n" + + "}"; + private static final String[] Intersection_bounds = { + "java.util.List", + "java.io.Serializable" + }; + private static final String[] Intersection_supers = { + "java.util.List", + "java.io.Serializable" + }; + + private static final String Single_name = "SingleTest.java"; + private static final String Single_contents = + "import java.util.List;\n" + + "public class SingleTest {\n" + + " void method(S s) { }\n" + + "}"; + private static final String[] Single_bounds = { + "java.util.List", + }; + private static final String[] Single_supers = { + "java.lang.Object", + "java.util.Collection" + }; + + private static final String NoBounds_name = "NoBoundsTest.java"; + private static final String NoBounds_contents = + "public class NoBoundsTest {\n" + + " void method(S s) { }\n" + + "}"; + private static final String[] NoBounds_bounds = { + "java.lang.Object", + }; + private static final String[] NoBounds_supers = {}; + + private HashSet expected_bounds; + private HashSet expected_supers; + + private static final File classesdir = new File("intersectionproperties"); + private static final JavaCompiler comp = + ToolProvider.getSystemJavaCompiler(); + private static final StandardJavaFileManager fm = + comp.getStandardFileManager(null, null, null); + + public void runOne(final String Test_name, final String Test_contents, + final String[] Test_bounds, final String[] Test_supers) + throws IOException { + System.err.println("Testing " + Test_name); + expected_bounds = new HashSet(Arrays.asList(Test_bounds)); + expected_supers = new HashSet(Arrays.asList(Test_supers)); + final Iterable files = + fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents))); + final JavacTask ct = + (JavacTask)comp.getTask(null, fm, null, null, null, files); + ct.setProcessors(Collections.singleton(new TestProcessor())); + + if (!ct.call()) { + System.err.println("Compilation unexpectedly failed"); + errors++; + } + } + + public void run() throws IOException { + runOne(Intersection_name, Intersection_contents, + Intersection_bounds, Intersection_supers); + runOne(Single_name, Single_contents, + Single_bounds, Single_supers); + runOne(NoBounds_name, NoBounds_contents, + NoBounds_bounds, NoBounds_supers); + + if (0 != errors) + throw new RuntimeException(errors + " errors occurred"); + } + + public static void main(String... args) throws IOException { + new IntersectionPropertiesTest().run(); + } + + private static File writeFile(File dir, String path, String body) + throws IOException { + File f = new File(dir, path); + f.getParentFile().mkdirs(); + try (FileWriter out = new FileWriter(f)) { + out.write(body); + } + return f; + } + + private class TestProcessor extends JavacTestingAbstractProcessor { + + private Set rootElements; + + public boolean process(Set annotations, RoundEnvironment roundEnv) { + rootElements = roundEnv.getRootElements(); + if (!rootElements.isEmpty()) { + performCheck(); + } + return true; + } + + private void performCheck() { + TypeElement typeElement = (TypeElement) rootElements.iterator().next(); + ExecutableElement method = ElementFilter.methodsIn(typeElement.getEnclosedElements()).get(0); + TypeVariable typeVariable = (TypeVariable) method.getParameters().get(0).asType(); + + final TypeMirror upperBound = typeVariable.getUpperBound(); + + TypeParameterElement typeParameterElement = ((TypeParameterElement) typeVariable.asElement()); + final List bounds = typeParameterElement.getBounds(); + final List supers = processingEnv.getTypeUtils().directSupertypes(upperBound); + + final HashSet actual_bounds = new HashSet(); + final HashSet actual_supers = new HashSet(); + + for(TypeMirror ty : bounds) { + actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName()); + } + + for(TypeMirror ty : supers) { + actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName()); + } + + + if (!expected_bounds.equals(actual_bounds)) { + System.err.println("Mismatched expected and actual bounds."); + System.err.println("Expected:"); + for(CharSequence tm : expected_bounds) + System.err.println(" " + tm); + System.err.println("Actual:"); + for(CharSequence tm : actual_bounds) + System.err.println(" " + tm); + errors++; + } + + if (!expected_supers.equals(actual_supers)) { + System.err.println("Mismatched expected and actual bounds."); + System.err.println("Expected:"); + for(CharSequence tm : expected_supers) + System.err.println(" " + tm); + System.err.println("Actual:"); + for(CharSequence tm : actual_supers) + System.err.println(" " + tm); + errors++; + } + } + } + +} diff --git a/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java b/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java new file mode 100644 index 00000000000..9beeb6392c8 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 6499673 + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor IntersectionPropertiesTest + * @run main IntersectionPropertiesTest + * @summary Assertion check for TypeVariable.getUpperBound() fails + */ + +import com.sun.source.util.*; +import com.sun.tools.javac.api.*; +import com.sun.tools.javac.file.*; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.type.*; +import javax.lang.model.util.ElementFilter; +import javax.lang.model.element.*; +import javax.tools.*; +import java.util.*; +import java.io.*; + +public class IntersectionPropertiesTest { + + private int errors = 0; + private static final String Intersection_name = "IntersectionTest.java"; + private static final String Intersection_contents = + "import java.util.List;\n" + + "import java.io.Serializable;\t" + + "public class IntersectionTest {\n" + + " void method(S s) { }\n" + + "}"; + + private static final File classesdir = new File("intersectionproperties"); + private static final JavaCompiler comp = + ToolProvider.getSystemJavaCompiler(); + private static final StandardJavaFileManager fm = + comp.getStandardFileManager(null, null, null); + + public void runOne(final String Test_name, final String Test_contents) + throws IOException { + System.err.println("Testing " + Test_name); + final Iterable files = + fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents))); + final JavacTask ct = + (JavacTask)comp.getTask(null, fm, null, null, null, files); + ct.setProcessors(Collections.singleton(new TestProcessor())); + + if (!ct.call()) { + System.err.println("Compilation unexpectedly failed"); + errors++; + } + } + + public void run() throws IOException { + runOne(Intersection_name, Intersection_contents); + + if (0 != errors) + throw new RuntimeException(errors + " errors occurred"); + } + + public static void main(String... args) throws IOException { + new IntersectionPropertiesTest().run(); + } + + private static File writeFile(File dir, String path, String body) + throws IOException { + File f = new File(dir, path); + f.getParentFile().mkdirs(); + try (FileWriter out = new FileWriter(f)) { + out.write(body); + } + return f; + } + + private class TestProcessor extends JavacTestingAbstractProcessor { + + private Set rootElements; + + public boolean process(Set annotations, RoundEnvironment roundEnv) { + rootElements = roundEnv.getRootElements(); + if (!rootElements.isEmpty()) { + performCheck(); + } + return true; + } + + private void performCheck() { + TypeElement typeElement = (TypeElement) rootElements.iterator().next(); + ExecutableElement method = ElementFilter.methodsIn(typeElement.getEnclosedElements()).get(0); + TypeVariable typeVariable = (TypeVariable) method.getParameters().get(0).asType(); + + final TypeMirror upperBound = typeVariable.getUpperBound(); + + TypeParameterElement typeParameterElement = ((TypeParameterElement) typeVariable.asElement()); + final List bounds = typeParameterElement.getBounds(); + final HashSet actual = new HashSet(processingEnv.getTypeUtils().directSupertypes(upperBound)); + final HashSet expected = new HashSet(bounds); + if (!expected.equals(actual)) { + System.err.println("Mismatched expected and actual bounds."); + System.err.println("Expected:"); + for(TypeMirror tm : expected) + System.err.println(" " + tm); + System.err.println("Actual:"); + for(TypeMirror tm : actual) + System.err.println(" " + tm); + errors++; + } + } + + } + +} From af333dc7bb6edd73ccd992f65084d999aec18578 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Tue, 24 Sep 2013 12:25:50 +0400 Subject: [PATCH 205/983] 8025114: Eliminate doclint errors in java.awt.dnd package javadoc Reviewed-by: serb, alexsch --- .../java/awt/dnd/DragGestureRecognizer.java | 10 +++--- .../classes/java/awt/dnd/DragSource.java | 2 +- .../java/awt/dnd/DragSourceContext.java | 2 +- .../java/awt/dnd/DragSourceDragEvent.java | 10 +++--- .../java/awt/dnd/DragSourceDropEvent.java | 6 ++-- .../classes/java/awt/dnd/DragSourceEvent.java | 4 +-- .../classes/java/awt/dnd/DropTarget.java | 4 +-- .../java/awt/dnd/DropTargetDragEvent.java | 12 +++---- .../java/awt/dnd/DropTargetDropEvent.java | 31 +++++++++---------- 9 files changed, 40 insertions(+), 41 deletions(-) diff --git a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java index 1f1b9a3f488..60c1876fddf 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java @@ -114,7 +114,7 @@ public abstract class DragGestureRecognizer implements Serializable { * @param dgl the DragGestureRecognizer * to notify when a drag gesture is detected *

    - * @throws IllegalArgumentException + * @throws IllegalArgumentException * if ds is null. */ @@ -157,7 +157,7 @@ public abstract class DragGestureRecognizer implements Serializable { * @param sa the set (logical OR) of the DnDConstants * that this Drag and Drop operation will support *

    - * @throws IllegalArgumentException + * @throws IllegalArgumentException * if ds is null. */ @@ -185,7 +185,7 @@ public abstract class DragGestureRecognizer implements Serializable { * the DragGestureRecognizer * is not associated with any Component. *

    - * @throws IllegalArgumentException + * @throws IllegalArgumentException * if ds is null. */ @@ -202,7 +202,7 @@ public abstract class DragGestureRecognizer implements Serializable { * DragGestureRecognizer will * use to process the Drag and Drop operation *

    - * @throws IllegalArgumentException + * @throws IllegalArgumentException * if ds is null. */ @@ -332,7 +332,7 @@ public abstract class DragGestureRecognizer implements Serializable { * @param dgl the DragGestureListener to unregister * from this DragGestureRecognizer *

    - * @throws IllegalArgumentException if + * @throws IllegalArgumentException if * dgl is not (equal to) the currently registered DragGestureListener. */ diff --git a/jdk/src/share/classes/java/awt/dnd/DragSource.java b/jdk/src/share/classes/java/awt/dnd/DragSource.java index bceedda646b..d44733b71d8 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSource.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSource.java @@ -676,7 +676,7 @@ public class DragSource implements Serializable { * FooListeners on this * DragSource, or an empty array if no such listeners * have been added - * @exception ClassCastException if listenerType + * @exception ClassCastException if listenerType * doesn't specify a class or interface that implements * java.util.EventListener * diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java index 77fc0e49c43..9655689a237 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java @@ -63,7 +63,7 @@ import java.util.TooManyListenersException; * itself between the platform and the * listeners provided by the initiator of the drag operation. *

    - *   Ctrl + Shift -> ACTION_LINK
    - *   Ctrl         -> ACTION_COPY
    - *   Shift        -> ACTION_MOVE
    + *   Ctrl + Shift -> ACTION_LINK
    + *   Ctrl         -> ACTION_COPY
    + *   Shift        -> ACTION_MOVE
      * 
    * If the user selects a drop action, the user drop action is one of * DnDConstants that represents the selected drop action if this @@ -103,7 +103,7 @@ public class DragSourceDragEvent extends DragSourceEvent { * in one event. Use of the extended modifiers is * preferred. * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @see java.awt.event.InputEvent * @see DragSourceEvent#getLocation @@ -154,7 +154,7 @@ public class DragSourceDragEvent extends DragSourceEvent { * @param x the horizontal coordinate for the cursor location * @param y the vertical coordinate for the cursor location * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @see java.awt.event.InputEvent * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java index 25a7051f0a2..e1116bc68d5 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java @@ -63,7 +63,7 @@ public class DragSourceDropEvent extends DragSourceEvent { * @param action the drop action * @param success a boolean indicating if the drop was successful * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @see DragSourceEvent#getLocation */ @@ -91,7 +91,7 @@ public class DragSourceDropEvent extends DragSourceEvent { * @param x the horizontal coordinate for the cursor location * @param y the vertical coordinate for the cursor location * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @since 1.4 */ @@ -112,7 +112,7 @@ public class DragSourceDropEvent extends DragSourceEvent { * * @param dsc the DragSourceContext * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @see DragSourceEvent#getLocation */ diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java index f2616b06a3a..62ab7fcb27a 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java @@ -96,7 +96,7 @@ public class DragSourceEvent extends EventObject { * * @param dsc the DragSourceContext * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @see #getLocation */ @@ -117,7 +117,7 @@ public class DragSourceEvent extends EventObject { * @param x the horizontal coordinate for the cursor location * @param y the vertical coordinate for the cursor location * - * @throws IllegalArgumentException if dsc is null. + * @throws IllegalArgumentException if dsc is null. * * @since 1.4 */ diff --git a/jdk/src/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/share/classes/java/awt/dnd/DropTarget.java index a1fd5b56db9..4006f728c9b 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java @@ -305,7 +305,7 @@ public class DropTarget implements DropTargetListener, Serializable { *

    * @param dtl The new DropTargetListener *

    - * @throws TooManyListenersException if a + * @throws TooManyListenersException if a * DropTargetListener is already added to this * DropTarget. */ @@ -844,7 +844,7 @@ public class DropTarget implements DropTargetListener, Serializable { int actions = DnDConstants.ACTION_COPY_OR_MOVE; /** - * true if the DropTarget is accepting Drag & Drop operations. + * true if the DropTarget is accepting Drag & Drop operations. * * @serial */ diff --git a/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java b/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java index a315a6d5463..f74d0410664 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java @@ -49,9 +49,9 @@ import java.util.List; * source and the drop action selected by the user. The user can select a drop * action by pressing modifier keys during the drag operation: *

    - *   Ctrl + Shift -> ACTION_LINK
    - *   Ctrl         -> ACTION_COPY
    - *   Shift        -> ACTION_MOVE
    + *   Ctrl + Shift -> ACTION_LINK
    + *   Ctrl         -> ACTION_COPY
    + *   Shift        -> ACTION_MOVE
      * 
    * If the user selects a drop action, the user drop action is one of * DnDConstants that represents the selected drop action if this @@ -88,11 +88,11 @@ public class DropTargetDragEvent extends DropTargetEvent { * @param srcActions The source drop actions * * @throws NullPointerException if cursorLocn is null - * @throws IllegalArgumentException if dropAction is not one of + * @throws IllegalArgumentException if dropAction is not one of * DnDConstants. - * @throws IllegalArgumentException if srcActions is not + * @throws IllegalArgumentException if srcActions is not * a bitwise mask of DnDConstants. - * @throws IllegalArgumentException if dtc is null. + * @throws IllegalArgumentException if dtc is null. */ public DropTargetDragEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions) { diff --git a/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java b/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java index 2b36069d8ea..cb6ff209255 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java @@ -48,9 +48,9 @@ import java.util.List; * source and the drop action selected by the user. The user can select a drop * action by pressing modifier keys during the drag operation: *
    - *   Ctrl + Shift -> ACTION_LINK
    - *   Ctrl         -> ACTION_COPY
    - *   Shift        -> ACTION_MOVE
    + *   Ctrl + Shift -> ACTION_LINK
    + *   Ctrl         -> ACTION_COPY
    + *   Shift        -> ACTION_MOVE
      * 
    * If the user selects a drop action, the user drop action is one of * DnDConstants that represents the selected drop action if this @@ -92,13 +92,13 @@ public class DropTargetDropEvent extends DropTargetEvent { * @param dropAction the user drop action. * @param srcActions the source drop actions. * - * @throws NullPointerException + * @throws NullPointerException * if cursorLocn is null - * @throws IllegalArgumentException if dropAction is not one of - * DnDConstants. - * @throws IllegalArgumentException if srcActions is not - * a bitwise mask of DnDConstants. - * @throws IllegalArgumentException if dtc is null. + * @throws IllegalArgumentException + * if dropAction is not one of DnDConstants. + * @throws IllegalArgumentException + * if srcActions is not a bitwise mask of DnDConstants. + * @throws IllegalArgumentException if dtc is null. */ public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions) { @@ -136,13 +136,12 @@ public class DropTargetDropEvent extends DropTargetEvent { * @param srcActions the source drop actions. * @param isLocal True if the source is in the same JVM as the target * - * @throws NullPointerException if cursorLocn is - * null - * @throws IllegalArgumentException if dropAction is not one of - * DnDConstants. - * @throws IllegalArgumentException if srcActions is not - * a bitwise mask of DnDConstants. - * @throws IllegalArgumentException if dtc is null. + * @throws NullPointerException + * if cursorLocn is null + * @throws IllegalArgumentException + * if dropAction is not one of DnDConstants. + * @throws IllegalArgumentException if srcActions is not a bitwise mask of DnDConstants. + * @throws IllegalArgumentException if dtc is null. */ public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions, boolean isLocal) { From 560d55440f448b00f371f0346c4039ab4faac45b Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Tue, 24 Sep 2013 16:36:00 +0400 Subject: [PATCH 206/983] 8025230: [cleanup] some more javadoc formatting fixes for swing Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/JPanel.java | 10 ++--- .../classes/javax/swing/JPasswordField.java | 12 ++--- .../share/classes/javax/swing/JPopupMenu.java | 16 +++---- .../classes/javax/swing/JRadioButton.java | 4 +- .../javax/swing/JRadioButtonMenuItem.java | 2 +- .../share/classes/javax/swing/JRootPane.java | 8 ++-- .../classes/javax/swing/JScrollPane.java | 8 ++-- .../share/classes/javax/swing/JSeparator.java | 8 ++-- .../share/classes/javax/swing/JSlider.java | 10 ++--- .../share/classes/javax/swing/JSpinner.java | 8 ++-- .../share/classes/javax/swing/JSplitPane.java | 20 ++++----- jdk/src/share/classes/javax/swing/JTable.java | 22 +++++----- .../share/classes/javax/swing/JTextArea.java | 44 +++++++++---------- .../share/classes/javax/swing/JTextField.java | 6 +-- .../share/classes/javax/swing/JToolBar.java | 10 ++--- .../share/classes/javax/swing/JToolTip.java | 4 +- jdk/src/share/classes/javax/swing/JTree.java | 34 +++++++------- .../share/classes/javax/swing/JViewport.java | 8 ++-- .../share/classes/javax/swing/KeyStroke.java | 10 ++--- .../classes/javax/swing/OverlayLayout.java | 4 +- .../classes/javax/swing/ProgressMonitor.java | 4 +- .../classes/javax/swing/SizeRequirements.java | 16 +++---- .../classes/javax/swing/SizeSequence.java | 18 ++++---- 23 files changed, 143 insertions(+), 143 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/JPanel.java b/jdk/src/share/classes/javax/swing/JPanel.java index 288f6814013..7287a53ba27 100644 --- a/jdk/src/share/classes/javax/swing/JPanel.java +++ b/jdk/src/share/classes/javax/swing/JPanel.java @@ -127,7 +127,7 @@ public class JPanel extends JComponent implements Accessible } /** - * Returns the look and feel (L&F) object that renders this component. + * Returns the look and feel (L&amp;F) object that renders this component. * * @return the PanelUI object that renders this component * @since 1.4 @@ -138,9 +138,9 @@ public class JPanel extends JComponent implements Accessible /** - * Sets the look and feel (L&F) object that renders this component. + * Sets the look and feel (L&F) object that renders this component. * - * @param ui the PanelUI L&F object + * @param ui the PanelUI L&F object * @see UIDefaults#getUI * @since 1.4 * @beaninfo @@ -154,7 +154,7 @@ public class JPanel extends JComponent implements Accessible } /** - * Returns a string that specifies the name of the L&F class + * Returns a string that specifies the name of the L&F class * that renders this component. * * @return "PanelUI" @@ -162,7 +162,7 @@ public class JPanel extends JComponent implements Accessible * @see UIDefaults#getUI * @beaninfo * expert: true - * description: A string that specifies the name of the L&F class. + * description: A string that specifies the name of the L&F class. */ public String getUIClassID() { return uiClassID; diff --git a/jdk/src/share/classes/javax/swing/JPasswordField.java b/jdk/src/share/classes/javax/swing/JPasswordField.java index 9be54e1ffd4..1da370921da 100644 --- a/jdk/src/share/classes/javax/swing/JPasswordField.java +++ b/jdk/src/share/classes/javax/swing/JPasswordField.java @@ -101,7 +101,7 @@ public class JPasswordField extends JTextField { * number of columns. A default model is created, and the initial string * is set to null. * - * @param columns the number of columns >= 0 + * @param columns the number of columns >= 0 */ public JPasswordField(int columns) { this(null, null, columns); @@ -113,7 +113,7 @@ public class JPasswordField extends JTextField { * the default. * * @param text the text to be displayed, null if none - * @param columns the number of columns >= 0 + * @param columns the number of columns >= 0 */ public JPasswordField(String text, int columns) { this(null, text, columns); @@ -130,7 +130,7 @@ public class JPasswordField extends JTextField { * @param doc the text storage to use * @param txt the text to be displayed, null if none * @param columns the number of columns to use to calculate - * the preferred width >= 0; if columns is set to zero, the + * the preferred width >= 0; if columns is set to zero, the * preferred width will be whatever naturally results from * the component implementation */ @@ -143,7 +143,7 @@ public class JPasswordField extends JTextField { } /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "PasswordFieldUI" * @see JComponent#getUIClassID @@ -271,8 +271,8 @@ public class JPasswordField extends JTextField { * getPassword method instead. * @deprecated As of Java 2 platform v1.2, * replaced by getPassword. - * @param offs the offset >= 0 - * @param len the length >= 0 + * @param offs the offset >= 0 + * @param len the length >= 0 * @return the text * @exception BadLocationException if the offset or length are invalid */ diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java index 10f9294649f..03532d12fde 100644 --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java @@ -196,7 +196,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { /** - * Returns the look and feel (L&F) object that renders this component. + * Returns the look and feel (L&F) object that renders this component. * * @return the PopupMenuUI object that renders this component */ @@ -205,9 +205,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the new PopupMenuUI L&F object + * @param ui the new PopupMenuUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -230,7 +230,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "PopupMenuUI" * @see JComponent#getUIClassID @@ -461,7 +461,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param pos the position of the item to be removed * @exception IllegalArgumentException if the value of - * pos < 0, or if the value of + * pos < 0, or if the value of * pos is greater than the * number of items */ @@ -560,7 +560,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param a the Action object to insert * @param index specifies the position at which to insert the * Action, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @exception IllegalArgumentException if index < 0 * @see Action */ public void insert(Action a, int index) { @@ -576,7 +576,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param component the Component to insert * @param index specifies the position at which * to insert the component, where 0 is the first - * @exception IllegalArgumentException if index < 0 + * @exception IllegalArgumentException if index < 0 */ public void insert(Component component, int index) { if (index < 0) { @@ -1535,7 +1535,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { } /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "PopupMenuSeparatorUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JRadioButton.java b/jdk/src/share/classes/javax/swing/JRadioButton.java index 79dd973e436..5d594ceac65 100644 --- a/jdk/src/share/classes/javax/swing/JRadioButton.java +++ b/jdk/src/share/classes/javax/swing/JRadioButton.java @@ -193,7 +193,7 @@ public class JRadioButton extends JToggleButton implements Accessible { /** - * Returns the name of the L&F class + * Returns the name of the L&F class * that renders this component. * * @return String "RadioButtonUI" @@ -201,7 +201,7 @@ public class JRadioButton extends JToggleButton implements Accessible { * @see UIDefaults#getUI * @beaninfo * expert: true - * description: A string that specifies the name of the L&F class. + * description: A string that specifies the name of the L&F class. */ public String getUIClassID() { return uiClassID; diff --git a/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java b/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java index 0f05f572dba..1c4dd4c81f0 100644 --- a/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java +++ b/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java @@ -181,7 +181,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible { } /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "RadioButtonMenuItemUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JRootPane.java b/jdk/src/share/classes/javax/swing/JRootPane.java index 542f7e672e3..1f41ccbfd8d 100644 --- a/jdk/src/share/classes/javax/swing/JRootPane.java +++ b/jdk/src/share/classes/javax/swing/JRootPane.java @@ -448,7 +448,7 @@ public class JRootPane extends JComponent implements Accessible { } /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return LabelUI object * @since 1.3 @@ -458,9 +458,9 @@ public class JRootPane extends JComponent implements Accessible { } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the LabelUI L&F object + * @param ui the LabelUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -486,7 +486,7 @@ public class JRootPane extends JComponent implements Accessible { /** - * Returns a string that specifies the name of the L&F class + * Returns a string that specifies the name of the L&F class * that renders this component. * * @return the string "RootPaneUI" diff --git a/jdk/src/share/classes/javax/swing/JScrollPane.java b/jdk/src/share/classes/javax/swing/JScrollPane.java index 5cf91f32a6a..25918e5a3c5 100644 --- a/jdk/src/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/share/classes/javax/swing/JScrollPane.java @@ -353,7 +353,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce /** - * Returns the look and feel (L&F) object that renders this component. + * Returns the look and feel (L&F) object that renders this component. * * @return the ScrollPaneUI object that renders this * component @@ -371,9 +371,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce /** * Sets the ScrollPaneUI object that provides the - * look and feel (L&F) for this component. + * look and feel (L&F) for this component. * - * @param ui the ScrollPaneUI L&F object + * @param ui the ScrollPaneUI L&F object * @see #getUI */ public void setUI(ScrollPaneUI ui) { @@ -395,7 +395,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce /** - * Returns the suffix used to construct the name of the L&F class used to + * Returns the suffix used to construct the name of the L&F class used to * render this component. * * @return the string "ScrollPaneUI" diff --git a/jdk/src/share/classes/javax/swing/JSeparator.java b/jdk/src/share/classes/javax/swing/JSeparator.java index 25567371875..8c5e14f6134 100644 --- a/jdk/src/share/classes/javax/swing/JSeparator.java +++ b/jdk/src/share/classes/javax/swing/JSeparator.java @@ -108,7 +108,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible } /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the SeparatorUI object that renders this component */ @@ -117,9 +117,9 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the SeparatorUI L&F object + * @param ui the SeparatorUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -142,7 +142,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "SeparatorUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JSlider.java b/jdk/src/share/classes/javax/swing/JSlider.java index 94adc94df70..7a948d91b54 100644 --- a/jdk/src/share/classes/javax/swing/JSlider.java +++ b/jdk/src/share/classes/javax/swing/JSlider.java @@ -289,9 +289,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { /** - * Gets the UI object which implements the L&F for this component. + * Gets the UI object which implements the L&F for this component. * - * @return the SliderUI object that implements the Slider L&F + * @return the SliderUI object that implements the Slider L&F */ public SliderUI getUI() { return(SliderUI)ui; @@ -299,9 +299,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { /** - * Sets the UI object which implements the L&F for this component. + * Sets the UI object which implements the L&F for this component. * - * @param ui the SliderUI L&F object + * @param ui the SliderUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -330,7 +330,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return "SliderUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JSpinner.java b/jdk/src/share/classes/javax/swing/JSpinner.java index 9b37d07a040..d60f67cfd5e 100644 --- a/jdk/src/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/share/classes/javax/swing/JSpinner.java @@ -171,7 +171,7 @@ public class JSpinner extends JComponent implements Accessible /** - * Returns the look and feel (L&F) object that renders this component. + * Returns the look and feel (L&F) object that renders this component. * * @return the SpinnerUI object that renders this component */ @@ -181,9 +181,9 @@ public class JSpinner extends JComponent implements Accessible /** - * Sets the look and feel (L&F) object that renders this component. + * Sets the look and feel (L&F) object that renders this component. * - * @param ui the SpinnerUI L&F object + * @param ui the SpinnerUI L&F object * @see UIDefaults#getUI */ public void setUI(SpinnerUI ui) { @@ -193,7 +193,7 @@ public class JSpinner extends JComponent implements Accessible /** * Returns the suffix used to construct the name of the look and feel - * (L&F) class used to render this component. + * (L&F) class used to render this component. * * @return the string "SpinnerUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JSplitPane.java b/jdk/src/share/classes/javax/swing/JSplitPane.java index fa773e5ae67..622c70f270b 100644 --- a/jdk/src/share/classes/javax/swing/JSplitPane.java +++ b/jdk/src/share/classes/javax/swing/JSplitPane.java @@ -359,9 +359,9 @@ public class JSplitPane extends JComponent implements Accessible /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the SplitPaneUI L&F object + * @param ui the SplitPaneUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -384,7 +384,7 @@ public class JSplitPane extends JComponent implements Accessible * @return the SplitPaneUI object that renders this component * @beaninfo * expert: true - * description: The L&F object that renders this component. + * description: The L&F object that renders this component. */ public SplitPaneUI getUI() { return (SplitPaneUI)ui; @@ -392,7 +392,7 @@ public class JSplitPane extends JComponent implements Accessible /** - * Notification from the UIManager that the L&F has changed. + * Notification from the UIManager that the L&F has changed. * Replaces the current UI object with the latest version from the * UIManager. * @@ -405,14 +405,14 @@ public class JSplitPane extends JComponent implements Accessible /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "SplitPaneUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI * @beaninfo * expert: true - * description: A string that specifies the name of the L&F class. + * description: A string that specifies the name of the L&F class. */ public String getUIClassID() { return uiClassID; @@ -714,7 +714,7 @@ public class JSplitPane extends JComponent implements Accessible * extra space. * * @param value as described above - * @exception IllegalArgumentException if value is < 0 or > 1 + * @exception IllegalArgumentException if value is < 0 or > 1 * @since 1.3 * @beaninfo * bound: true @@ -769,8 +769,8 @@ public class JSplitPane extends JComponent implements Accessible * @param proportionalLocation a double-precision floating point value * that specifies a percentage, from zero (top/left) to 1.0 * (bottom/right) - * @exception IllegalArgumentException if the specified location is < 0 - * or > 1.0 + * @exception IllegalArgumentException if the specified location is < 0 + * or > 1.0 * @beaninfo * description: The location of the divider. */ @@ -845,7 +845,7 @@ public class JSplitPane extends JComponent implements Accessible * location (typically a pixel count); or -1 if the UI is * null * @beaninfo - * description: The minimum location of the divider from the L&F. + * description: The minimum location of the divider from the L&F. */ public int getMinimumDividerLocation() { SplitPaneUI ui = getUI(); diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index bed8e5ca93e..cf477533c29 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -1945,7 +1945,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Sets the table's selection mode to allow only single selections, a single * contiguous interval, or multiple intervals. *

    - * Note: + * Note: * JTable provides all the methods for handling * column and row selection. When setting states, * such as setSelectionMode, it not only @@ -2061,7 +2061,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable /** * Returns true if both row and column selection models are enabled. - * Equivalent to getRowSelectionAllowed() && + * Equivalent to getRowSelectionAllowed() && * getColumnSelectionAllowed(). * * @return true if both row and column selection models are enabled @@ -3034,7 +3034,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * adjusted. * *

    - * Note: When a JTable makes adjustments + * Note: When a JTable makes adjustments * to the widths of the columns it respects their minimum and * maximum values absolutely. It is therefore possible that, * even after this method is called, the total width of the columns @@ -3086,14 +3086,14 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * where each individual delta[i] is calculated according to: *

    - * If (DELTA < 0) we are in shrink mode where: + * 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: + * If (DELTA > 0) we are in expand mode where: *

    *

          *                        DELTA
    @@ -3368,7 +3368,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
          * method in order to allow the renderer's tips to be used
          * if it has text set.
          * 

    - * Note: For JTable to properly display + * Note: For JTable to properly display * tooltips of its renderers * JTable must be a registered component with the * ToolTipManager. @@ -3580,7 +3580,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable // /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the TableUI object that renders this component */ @@ -3589,9 +3589,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable } /** - * Sets the L&F object that renders this component and repaints. + * Sets the L&F object that renders this component and repaints. * - * @param ui the TableUI L&F object + * @param ui the TableUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -3607,7 +3607,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable } /** - * Notification from the UIManager that the L&F has changed. + * Notification from the UIManager that the L&F has changed. * Replaces the current UI object with the latest version from the * UIManager. * @@ -3647,7 +3647,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable } /** - * Returns the suffix used to construct the name of the L&F class used to + * Returns the suffix used to construct the name of the L&F class used to * render this component. * * @return the string "TableUI" diff --git a/jdk/src/share/classes/javax/swing/JTextArea.java b/jdk/src/share/classes/javax/swing/JTextArea.java index 2975990eb69..0af83fa9b83 100644 --- a/jdk/src/share/classes/javax/swing/JTextArea.java +++ b/jdk/src/share/classes/javax/swing/JTextArea.java @@ -155,8 +155,8 @@ public class JTextArea extends JTextComponent { * rows and columns. A default model is created, and the initial * string is null. * - * @param rows the number of rows >= 0 - * @param columns the number of columns >= 0 + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 * @exception IllegalArgumentException if the rows or columns * arguments are negative. */ @@ -169,8 +169,8 @@ public class JTextArea extends JTextComponent { * of rows and columns. A default model is created. * * @param text the text to be displayed, or null - * @param rows the number of rows >= 0 - * @param columns the number of columns >= 0 + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 * @exception IllegalArgumentException if the rows or columns * arguments are negative. */ @@ -195,8 +195,8 @@ public class JTextArea extends JTextComponent { * * @param doc the model to use, or create a default one if null * @param text the text to be displayed, null if none - * @param rows the number of rows >= 0 - * @param columns the number of columns >= 0 + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 * @exception IllegalArgumentException if the rows or columns * arguments are negative. */ @@ -364,8 +364,8 @@ public class JTextArea extends JTextComponent { * Translates an offset into the components text to a * line number. * - * @param offset the offset >= 0 - * @return the line number >= 0 + * @param offset the offset >= 0 + * @return the line number >= 0 * @exception BadLocationException thrown if the offset is * less than zero or greater than the document length. */ @@ -384,7 +384,7 @@ public class JTextArea extends JTextComponent { /** * Determines the number of lines contained in the area. * - * @return the number of lines > 0 + * @return the number of lines > 0 */ public int getLineCount() { Element map = getDocument().getDefaultRootElement(); @@ -394,8 +394,8 @@ public class JTextArea extends JTextComponent { /** * Determines the offset of the start of the given line. * - * @param line the line number to translate >= 0 - * @return the offset >= 0 + * @param line the line number to translate >= 0 + * @return the offset >= 0 * @exception BadLocationException thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by @@ -417,8 +417,8 @@ public class JTextArea extends JTextComponent { /** * Determines the offset of the end of the given line. * - * @param line the line >= 0 - * @return the offset >= 0 + * @param line the line >= 0 + * @return the offset >= 0 * @exception BadLocationException Thrown if the line is * less than zero or greater or equal to the number of * lines contained in the document (as reported by @@ -446,7 +446,7 @@ public class JTextArea extends JTextComponent { * if the model is null or if the text is null or empty. * * @param str the text to insert - * @param pos the position at which to insert >= 0 + * @param pos the position at which to insert >= 0 * @exception IllegalArgumentException if pos is an * invalid position in the model * @see TextComponent#setText @@ -486,8 +486,8 @@ public class JTextArea extends JTextComponent { * does a delete if the new string is null or empty. * * @param str the text to use as the replacement - * @param start the start position >= 0 - * @param end the end position >= start + * @param start the start position >= 0 + * @param end the end position >= start * @exception IllegalArgumentException if part of the range is an * invalid position in the model * @see #insert @@ -517,7 +517,7 @@ public class JTextArea extends JTextComponent { /** * Returns the number of rows in the TextArea. * - * @return the number of rows >= 0 + * @return the number of rows >= 0 */ public int getRows() { return rows; @@ -527,7 +527,7 @@ public class JTextArea extends JTextComponent { * Sets the number of rows for this TextArea. Calls invalidate() after * setting the new value. * - * @param rows the number of rows >= 0 + * @param rows the number of rows >= 0 * @exception IllegalArgumentException if rows is less than 0 * @see #getRows * @beaninfo @@ -548,7 +548,7 @@ public class JTextArea extends JTextComponent { * Defines the meaning of the height of a row. This defaults to * the height of the font. * - * @return the height >= 1 + * @return the height >= 1 */ protected int getRowHeight() { if (rowHeight == 0) { @@ -561,7 +561,7 @@ public class JTextArea extends JTextComponent { /** * Returns the number of columns in the TextArea. * - * @return number of columns >= 0 + * @return number of columns >= 0 */ public int getColumns() { return columns; @@ -571,7 +571,7 @@ public class JTextArea extends JTextComponent { * Sets the number of columns for this TextArea. Does an invalidate() * after setting the new value. * - * @param columns the number of columns >= 0 + * @param columns the number of columns >= 0 * @exception IllegalArgumentException if columns is less than 0 * @see #getColumns * @beaninfo @@ -596,7 +596,7 @@ public class JTextArea extends JTextComponent { * character m for the font used. This method can be * redefined to be some alternative amount. * - * @return the column width >= 1 + * @return the column width >= 1 */ protected int getColumnWidth() { if (columnWidth == 0) { diff --git a/jdk/src/share/classes/javax/swing/JTextField.java b/jdk/src/share/classes/javax/swing/JTextField.java index 6451246bf3a..2fd75f0832d 100644 --- a/jdk/src/share/classes/javax/swing/JTextField.java +++ b/jdk/src/share/classes/javax/swing/JTextField.java @@ -128,7 +128,7 @@ import java.io.Serializable;   return;   }   char[] upper = str.toCharArray(); -  for (int i = 0; i < upper.length; i++) { +  for (int i = 0; i < upper.length; i++) {   upper[i] = Character.toUpperCase(upper[i]);   }   super.insertString(offs, new String(upper), a); @@ -223,10 +223,10 @@ public class JTextField extends JTextComponent implements SwingConstants { * createDefaultModel method * @param text the initial string to display, or null * @param columns the number of columns to use to calculate - * the preferred width >= 0; if columns + * the preferred width >= 0; if columns * is set to zero, the preferred width will be whatever * naturally results from the component implementation - * @exception IllegalArgumentException if columns < 0 + * @exception IllegalArgumentException if columns < 0 */ public JTextField(Document doc, String text, int columns) { if (columns < 0) { diff --git a/jdk/src/share/classes/javax/swing/JToolBar.java b/jdk/src/share/classes/javax/swing/JToolBar.java index 5ae0ff90bc2..b1a8c87c609 100644 --- a/jdk/src/share/classes/javax/swing/JToolBar.java +++ b/jdk/src/share/classes/javax/swing/JToolBar.java @@ -167,9 +167,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the ToolBarUI L&F object + * @param ui the ToolBarUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -182,7 +182,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible } /** - * Notification from the UIFactory that the L&F has changed. + * Notification from the UIFactory that the L&F has changed. * Called to replace the UI with the latest version from the * UIFactory. * @@ -202,7 +202,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "ToolBarUI" * @see JComponent#getUIClassID @@ -613,7 +613,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible } /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "ToolBarSeparatorUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JToolTip.java b/jdk/src/share/classes/javax/swing/JToolTip.java index ac79d465ef5..77b29eaed21 100644 --- a/jdk/src/share/classes/javax/swing/JToolTip.java +++ b/jdk/src/share/classes/javax/swing/JToolTip.java @@ -85,7 +85,7 @@ public class JToolTip extends JComponent implements Accessible { } /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the ToolTipUI object that renders this component */ @@ -104,7 +104,7 @@ public class JToolTip extends JComponent implements Accessible { /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "ToolTipUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JTree.java b/jdk/src/share/classes/javax/swing/JTree.java index 09b31da9f28..56aaca10d8e 100644 --- a/jdk/src/share/classes/javax/swing/JTree.java +++ b/jdk/src/share/classes/javax/swing/JTree.java @@ -41,7 +41,7 @@ import static sun.swing.SwingUtilities2.Section.*; /** - * + * * A control that displays a set of hierarchical data as an outline. * You can find task-oriented documentation and examples of using trees in * How to Use Trees, @@ -59,7 +59,7 @@ import static sun.swing.SwingUtilities2.Section.*; * under a collapsed ancestor. All of a viewable nodes parents * are expanded, but may or may not be displayed. A displayed node * is both viewable and in the display area, where it can be seen. - *

    + *

    * The following JTree methods use "visible" to mean "displayed": *
      *
    • isRootVisible() @@ -69,14 +69,12 @@ import static sun.swing.SwingUtilities2.Section.*; *
    • getVisibleRowCount() *
    • setVisibleRowCount() *
    - *

    * The next group of JTree methods use "visible" to mean * "viewable" (under an expanded parent): *

      *
    • isVisible() *
    • makeVisible() *
    - *

    * If you are interested in knowing when the selection changes implement * the TreeSelectionListener interface and add the instance * using the method addTreeSelectionListener. @@ -87,6 +85,7 @@ import static sun.swing.SwingUtilities2.Section.*; * If you are interested in detecting either double-click events or when * a user clicks on a node, regardless of whether or not it was selected, * we recommend you do the following: + *

    *
      * final JTree tree = ...;
      *
    @@ -114,12 +113,13 @@ import static sun.swing.SwingUtilities2.Section.*;
      * a graphic icon and text), subclass {@link TreeCellRenderer} and use
      * {@link #setCellRenderer} to tell the tree to use it. To edit such nodes,
      * subclass {@link TreeCellEditor} and use {@link #setCellEditor}.
    + * 

    *

    * Like all JComponent classes, you can use {@link InputMap} and * {@link ActionMap} * to associate an {@link Action} object with a {@link KeyStroke} * and execute the action under specified conditions. - *

    + *

    * Warning: Swing is not thread safe. For more * information see Swing's Threading @@ -133,7 +133,7 @@ import static sun.swing.SwingUtilities2.Section.*; * of all JavaBeansTM * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. - * + *

    * @beaninfo * attribute: isContainer false * description: A component that displays a set of hierarchical data as an outline. @@ -174,7 +174,7 @@ public class JTree extends JComponent implements Scrollable, Accessible transient protected TreeCellRenderer cellRenderer; /** - * Height to use for each display row. If this is <= 0 the renderer + * Height to use for each display row. If this is <= 0 the renderer * determines the height for each row. */ protected int rowHeight; @@ -671,7 +671,7 @@ public class JTree extends JComponent implements Scrollable, Accessible } /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the TreeUI object that renders this component */ @@ -680,11 +680,11 @@ public class JTree extends JComponent implements Scrollable, Accessible } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. *

    * This is a bound property. * - * @param ui the TreeUI L&F object + * @param ui the TreeUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -706,7 +706,7 @@ public class JTree extends JComponent implements Scrollable, Accessible } /** - * Notification from the UIManager that the L&F has changed. + * Notification from the UIManager that the L&F has changed. * Replaces the current UI object with the latest version from the * UIManager. * @@ -721,7 +721,7 @@ public class JTree extends JComponent implements Scrollable, Accessible /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "TreeUI" * @see JComponent#getUIClassID @@ -1701,7 +1701,7 @@ public class JTree extends JComponent implements Scrollable, Accessible /** * Selects the nodes corresponding to each of the specified rows * in the display. If a particular element of rows is - * < 0 or >= getRowCount, it will be ignored. + * < 0 or >= getRowCount, it will be ignored. * If none of the elements * in rows are valid rows, the selection will * be cleared. That is it will be as if clearSelection @@ -2162,8 +2162,8 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param row an integer specifying a row * @return the TreePath to the specified node, - * null if row < 0 - * or row >= getRowCount() + * null if row < 0 + * or row >= getRowCount() */ public TreePath getPathForRow(int row) { TreeUI tree = getUI(); @@ -2211,7 +2211,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * Ensures that the node in the specified row is expanded and * viewable. *

    - * If row is < 0 or >= getRowCount this + * If row is < 0 or >= getRowCount this * will have no effect. * * @param row an integer specifying a display row, where 0 is the @@ -2234,7 +2234,7 @@ public class JTree extends JComponent implements Scrollable, Accessible /** * Ensures that the node in the specified row is collapsed. *

    - * If row is < 0 or >= getRowCount this + * If row is < 0 or >= getRowCount this * will have no effect. * * @param row an integer specifying a display row, where 0 is the diff --git a/jdk/src/share/classes/javax/swing/JViewport.java b/jdk/src/share/classes/javax/swing/JViewport.java index c271533e53e..7d546a88d9c 100644 --- a/jdk/src/share/classes/javax/swing/JViewport.java +++ b/jdk/src/share/classes/javax/swing/JViewport.java @@ -285,7 +285,7 @@ public class JViewport extends JComponent implements Accessible /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return a ViewportUI object * @since 1.3 @@ -296,9 +296,9 @@ public class JViewport extends JComponent implements Accessible /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the ViewportUI L&F object + * @param ui the ViewportUI L&F object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -323,7 +323,7 @@ public class JViewport extends JComponent implements Accessible /** - * Returns a string that specifies the name of the L&F class + * Returns a string that specifies the name of the L&F class * that renders this component. * * @return the string "ViewportUI" diff --git a/jdk/src/share/classes/javax/swing/KeyStroke.java b/jdk/src/share/classes/javax/swing/KeyStroke.java index 1cf1e841bcc..9aaa15d21c6 100644 --- a/jdk/src/share/classes/javax/swing/KeyStroke.java +++ b/jdk/src/share/classes/javax/swing/KeyStroke.java @@ -284,11 +284,11 @@ public class KeyStroke extends AWTKeyStroke { * If typed, pressed or released is not specified, pressed is assumed. Here * are some examples: *

    -     *     "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
    -     *     "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
    -     *     "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
    -     *     "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
    -     *     "typed a" => getKeyStroke('a');
    +     *     "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
    +     *     "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
    +     *     "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
    +     *     "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
    +     *     "typed a" => getKeyStroke('a');
          * 
    * * In order to maintain backward-compatibility, specifying a null String, diff --git a/jdk/src/share/classes/javax/swing/OverlayLayout.java b/jdk/src/share/classes/javax/swing/OverlayLayout.java index a6fd8e86fc9..89c47c02a40 100644 --- a/jdk/src/share/classes/javax/swing/OverlayLayout.java +++ b/jdk/src/share/classes/javax/swing/OverlayLayout.java @@ -190,7 +190,7 @@ public class OverlayLayout implements LayoutManager2,Serializable { * Returns the alignment along the x axis for the container. * * @param target the container - * @return the alignment >= 0.0f && <= 1.0f + * @return the alignment >= 0.0f && <= 1.0f */ public float getLayoutAlignmentX(Container target) { checkContainer(target); @@ -202,7 +202,7 @@ public class OverlayLayout implements LayoutManager2,Serializable { * Returns the alignment along the y axis for the container. * * @param target the container - * @return the alignment >= 0.0f && <= 1.0f + * @return the alignment >= 0.0f && <= 1.0f */ public float getLayoutAlignmentY(Container target) { checkContainer(target); diff --git a/jdk/src/share/classes/javax/swing/ProgressMonitor.java b/jdk/src/share/classes/javax/swing/ProgressMonitor.java index a7be24d388b..ebfa7389018 100644 --- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java +++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java @@ -251,7 +251,7 @@ public class ProgressMonitor implements Accessible /** * Indicate the progress of the operation being monitored. - * If the specified value is >= the maximum, the progress + * If the specified value is >= the maximum, the progress * monitor is closed. * @param nv an int specifying the current value, between the * maximum and minimum specified for this component @@ -302,7 +302,7 @@ public class ProgressMonitor implements Accessible /** * Indicate that the operation is complete. This happens automatically - * when the value set by setProgress is >= max, but it may be called + * when the value set by setProgress is >= max, but it may be called * earlier if the operation ends early. */ public void close() { diff --git a/jdk/src/share/classes/javax/swing/SizeRequirements.java b/jdk/src/share/classes/javax/swing/SizeRequirements.java index 6208f8a07fb..a1def55cd37 100644 --- a/jdk/src/share/classes/javax/swing/SizeRequirements.java +++ b/jdk/src/share/classes/javax/swing/SizeRequirements.java @@ -142,10 +142,10 @@ public class SizeRequirements implements Serializable { * Creates a SizeRequirements object with the specified minimum, preferred, * and maximum sizes and the specified alignment. * - * @param min the minimum size >= 0 - * @param pref the preferred size >= 0 - * @param max the maximum size >= 0 - * @param a the alignment >= 0.0f && <= 1.0f + * @param min the minimum size >= 0 + * @param pref the preferred size >= 0 + * @param max the maximum size >= 0 + * @param a the alignment >= 0.0f && <= 1.0f */ public SizeRequirements(int min, int pref, int max, float a) { minimum = min; @@ -246,7 +246,7 @@ public class SizeRequirements implements Serializable { * by invoking the getTiledSizeRequirements method. The components * will be tiled in the forward direction with offsets increasing from 0. * - * @param allocated the total span to be allocated >= 0. + * @param allocated the total span to be allocated >= 0. * @param total the total of the children requests. This argument * is optional and may be null. * @param children the size requirements for each component. @@ -282,7 +282,7 @@ public class SizeRequirements implements Serializable { * reverse direction represents components tiled from right to left * or bottom to top. * - * @param allocated the total span to be allocated >= 0. + * @param allocated the total span to be allocated >= 0. * @param total the total of the children requests. This argument * is optional and may be null. * @param children the size requirements for each component. @@ -405,7 +405,7 @@ public class SizeRequirements implements Serializable { * Normal alignment will be done with an alignment value of 0.0f * representing the left/top edge of a component. * - * @param allocated the total span to be allocated >= 0. + * @param allocated the total span to be allocated >= 0. * @param total the total of the children requests. * @param children the size requirements for each component. * @param offsets the offset from 0 for each child where @@ -441,7 +441,7 @@ public class SizeRequirements implements Serializable { * to be aligned. With reverse alignment, 0.0f represents the * right/bottom edge. * - * @param allocated the total span to be allocated >= 0. + * @param allocated the total span to be allocated >= 0. * @param total the total of the children requests. * @param children the size requirements for each component. * @param offsets the offset from 0 for each child where diff --git a/jdk/src/share/classes/javax/swing/SizeSequence.java b/jdk/src/share/classes/javax/swing/SizeSequence.java index 5ebe6dd234b..a04fe2cb867 100644 --- a/jdk/src/share/classes/javax/swing/SizeSequence.java +++ b/jdk/src/share/classes/javax/swing/SizeSequence.java @@ -78,7 +78,7 @@ package javax.swing; * *

    * - *

    Implementation Notes

    + *

    Implementation Notes

    * * Normally when storing the size and position of entries, * one would choose between @@ -145,7 +145,7 @@ public class SizeSequence { * * @param numEntries the number of sizes to track * @exception NegativeArraySizeException if - * numEntries < 0 + * numEntries < 0 */ public SizeSequence(int numEntries) { this(numEntries, 0); @@ -306,7 +306,7 @@ public class SizeSequence { /** * Returns the size of the specified entry. * If index is out of the range - * (0 <= index < getSizes().length) + * (0 <= index < getSizes().length) * the behavior is unspecified. * * @param index the index corresponding to the entry @@ -320,7 +320,7 @@ public class SizeSequence { * Sets the size of the specified entry. * Note that if the value of index * does not fall in the range: - * (0 <= index < getSizes().length) + * (0 <= index < getSizes().length) * the behavior is unspecified. * * @param index the index corresponding to the entry @@ -348,8 +348,8 @@ public class SizeSequence { * Adds a contiguous group of entries to this SizeSequence. * Note that the values of start and * length must satisfy the following - * conditions: (0 <= start < getSizes().length) - * AND (length >= 0). If these conditions are + * conditions: (0 <= start < getSizes().length) + * AND (length >= 0). If these conditions are * not met, the behavior is unspecified and an exception * may be thrown. * @@ -359,7 +359,7 @@ public class SizeSequence { * @param value the size to be assigned to each new entry * @exception ArrayIndexOutOfBoundsException if the parameters * are outside of the range: - * (0 <= start < (getSizes().length)) AND (length >= 0) + * (0 <= start < (getSizes().length)) AND (length >= 0) */ public void insertEntries(int start, int length, int value) { int sizes[] = getSizes(); @@ -383,8 +383,8 @@ public class SizeSequence { * from this SizeSequence. * Note that the values of start and * length must satisfy the following - * conditions: (0 <= start < getSizes().length) - * AND (length >= 0). If these conditions are + * conditions: (0 <= start < getSizes().length) + * AND (length >= 0). If these conditions are * not met, the behavior is unspecified and an exception * may be thrown. * From bd9ffce26767c480b4b4212d414f22bb712bb4a1 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 26 Sep 2013 12:49:45 +0200 Subject: [PATCH 207/983] 8014078: G1: improve remembered set summary information by providing per region type information Add memory consumption breakdown on a per region type in the G1 remembered set summary statistics. This simplifies remembered set memory consumption analysis. Reviewed-by: brutisso --- .../gc_implementation/g1/g1CollectedHeap.cpp | 7 +- .../vm/gc_implementation/g1/g1RemSet.cpp | 4 +- .../vm/gc_implementation/g1/g1RemSet.hpp | 2 +- .../gc_implementation/g1/g1RemSetSummary.cpp | 243 +++++++++++++----- .../test/gc/g1/TestSummarizeRSetStats.java | 149 +++-------- .../g1/TestSummarizeRSetStatsPerRegion.java | 55 ++++ .../gc/g1/TestSummarizeRSetStatsTools.java | 154 +++++++++++ 7 files changed, 430 insertions(+), 184 deletions(-) create mode 100644 hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java create mode 100644 hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 0ecfd3ab3bb..eff0efc6e0f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3681,6 +3681,11 @@ void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); // Fill TLAB's and such ensure_parsability(true); + + if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) && + (total_collections() % G1SummarizeRSetStatsPeriod == 0)) { + g1_rem_set()->print_periodic_summary_info("Before GC RS summary"); + } } void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) { @@ -3689,7 +3694,7 @@ void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) { (G1SummarizeRSetStatsPeriod > 0) && // we are at the end of the GC. Total collections has already been increased. ((total_collections() - 1) % G1SummarizeRSetStatsPeriod == 0)) { - g1_rem_set()->print_periodic_summary_info(); + g1_rem_set()->print_periodic_summary_info("After GC RS summary"); } // FIXME: what is this about? diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index 5a1b92d3422..a8c580b60cd 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -731,12 +731,12 @@ bool G1RemSet::refine_card(jbyte* card_ptr, int worker_i, return has_refs_into_cset; } -void G1RemSet::print_periodic_summary_info() { +void G1RemSet::print_periodic_summary_info(const char* header) { G1RemSetSummary current; current.initialize(this, n_workers()); _prev_period_summary.subtract_from(¤t); - print_summary_info(&_prev_period_summary); + print_summary_info(&_prev_period_summary, header); _prev_period_summary.set(¤t); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp index 513945609fc..7c010f9daf6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp @@ -145,7 +145,7 @@ public: virtual void print_summary_info(); // Print accumulated summary info from the last time called. - virtual void print_periodic_summary_info(); + virtual void print_periodic_summary_info(const char* header); // Prepare remembered set for verification. virtual void prepare_for_verify(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp index 4a6b37654d7..02e90d65103 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp @@ -125,25 +125,115 @@ void G1RemSetSummary::subtract_from(G1RemSetSummary* other) { _sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime; } -class HRRSStatsIter: public HeapRegionClosure { - size_t _occupied; +static double percent_of(size_t numerator, size_t denominator) { + if (denominator != 0) { + return (double)numerator / denominator * 100.0f; + } else { + return 0.0f; + } +} + +static size_t round_to_K(size_t value) { + return value / K; +} + +class RegionTypeCounter VALUE_OBJ_CLASS_SPEC { +private: + const char* _name; + + size_t _rs_mem_size; + size_t _cards_occupied; + size_t _amount; + + size_t _code_root_mem_size; + size_t _code_root_elems; + + double rs_mem_size_percent_of(size_t total) { + return percent_of(_rs_mem_size, total); + } + + double cards_occupied_percent_of(size_t total) { + return percent_of(_cards_occupied, total); + } + + double code_root_mem_size_percent_of(size_t total) { + return percent_of(_code_root_mem_size, total); + } + + double code_root_elems_percent_of(size_t total) { + return percent_of(_code_root_elems, total); + } + + size_t amount() const { return _amount; } + +public: + + RegionTypeCounter(const char* name) : _name(name), _rs_mem_size(0), _cards_occupied(0), + _amount(0), _code_root_mem_size(0), _code_root_elems(0) { } + + void add(size_t rs_mem_size, size_t cards_occupied, size_t code_root_mem_size, + size_t code_root_elems) { + _rs_mem_size += rs_mem_size; + _cards_occupied += cards_occupied; + _code_root_mem_size += code_root_mem_size; + _code_root_elems += code_root_elems; + _amount++; + } + + size_t rs_mem_size() const { return _rs_mem_size; } + size_t cards_occupied() const { return _cards_occupied; } + + size_t code_root_mem_size() const { return _code_root_mem_size; } + size_t code_root_elems() const { return _code_root_elems; } + + void print_rs_mem_info_on(outputStream * out, size_t total) { + out->print_cr(" %8dK (%5.1f%%) by %zd %s regions", round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name); + } + + void print_cards_occupied_info_on(outputStream * out, size_t total) { + out->print_cr(" %8d (%5.1f%%) entries by %zd %s regions", cards_occupied(), cards_occupied_percent_of(total), amount(), _name); + } + + void print_code_root_mem_info_on(outputStream * out, size_t total) { + out->print_cr(" %8dK (%5.1f%%) by %zd %s regions", round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name); + } + + void print_code_root_elems_info_on(outputStream * out, size_t total) { + out->print_cr(" %8d (%5.1f%%) elements by %zd %s regions", code_root_elems(), code_root_elems_percent_of(total), amount(), _name); + } +}; + + +class HRRSStatsIter: public HeapRegionClosure { +private: + RegionTypeCounter _young; + RegionTypeCounter _humonguous; + RegionTypeCounter _free; + RegionTypeCounter _old; + RegionTypeCounter _all; - size_t _total_rs_mem_sz; size_t _max_rs_mem_sz; HeapRegion* _max_rs_mem_sz_region; - size_t _total_code_root_mem_sz; + size_t total_rs_mem_sz() const { return _all.rs_mem_size(); } + size_t total_cards_occupied() const { return _all.cards_occupied(); } + + size_t max_rs_mem_sz() const { return _max_rs_mem_sz; } + HeapRegion* max_rs_mem_sz_region() const { return _max_rs_mem_sz_region; } + size_t _max_code_root_mem_sz; HeapRegion* _max_code_root_mem_sz_region; + + size_t total_code_root_mem_sz() const { return _all.code_root_mem_size(); } + size_t total_code_root_elems() const { return _all.code_root_elems(); } + + size_t max_code_root_mem_sz() const { return _max_code_root_mem_sz; } + HeapRegion* max_code_root_mem_sz_region() const { return _max_code_root_mem_sz_region; } + public: - HRRSStatsIter() : - _occupied(0), - _total_rs_mem_sz(0), - _max_rs_mem_sz(0), - _max_rs_mem_sz_region(NULL), - _total_code_root_mem_sz(0), - _max_code_root_mem_sz(0), - _max_code_root_mem_sz_region(NULL) + HRRSStatsIter() : _all("All"), _young("Young"), _humonguous("Humonguous"), + _free("Free"), _old("Old"), _max_code_root_mem_sz_region(NULL), _max_rs_mem_sz_region(NULL), + _max_rs_mem_sz(0), _max_code_root_mem_sz(0) {} bool doHeapRegion(HeapRegion* r) { @@ -156,46 +246,95 @@ public: _max_rs_mem_sz = rs_mem_sz; _max_rs_mem_sz_region = r; } - _total_rs_mem_sz += rs_mem_sz; - + size_t occupied_cards = hrrs->occupied(); size_t code_root_mem_sz = hrrs->strong_code_roots_mem_size(); - if (code_root_mem_sz > _max_code_root_mem_sz) { - _max_code_root_mem_sz = code_root_mem_sz; + if (code_root_mem_sz > max_code_root_mem_sz()) { _max_code_root_mem_sz_region = r; } - _total_code_root_mem_sz += code_root_mem_sz; + size_t code_root_elems = hrrs->strong_code_roots_list_length(); + + RegionTypeCounter* current = NULL; + if (r->is_young()) { + current = &_young; + } else if (r->isHumongous()) { + current = &_humonguous; + } else if (r->is_empty()) { + current = &_free; + } else { + current = &_old; + } + current->add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems); + _all.add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems); - size_t occ = hrrs->occupied(); - _occupied += occ; return false; } - size_t total_rs_mem_sz() { return _total_rs_mem_sz; } - size_t max_rs_mem_sz() { return _max_rs_mem_sz; } - HeapRegion* max_rs_mem_sz_region() { return _max_rs_mem_sz_region; } - size_t total_code_root_mem_sz() { return _total_code_root_mem_sz; } - size_t max_code_root_mem_sz() { return _max_code_root_mem_sz; } - HeapRegion* max_code_root_mem_sz_region() { return _max_code_root_mem_sz_region; } - size_t occupied() { return _occupied; } + + void print_summary_on(outputStream* out) { + RegionTypeCounter* counters[] = { &_young, &_humonguous, &_free, &_old, NULL }; + + out->print_cr("\n Current rem set statistics"); + out->print_cr(" Total per region rem sets sizes = "SIZE_FORMAT"K." + " Max = "SIZE_FORMAT"K.", + round_to_K(total_rs_mem_sz()), round_to_K(max_rs_mem_sz())); + for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { + (*current)->print_rs_mem_info_on(out, total_rs_mem_sz()); + } + + out->print_cr(" Static structures = "SIZE_FORMAT"K," + " free_lists = "SIZE_FORMAT"K.", + round_to_K(HeapRegionRemSet::static_mem_size()), + round_to_K(HeapRegionRemSet::fl_mem_size())); + + out->print_cr(" "SIZE_FORMAT" occupied cards represented.", + total_cards_occupied()); + for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { + (*current)->print_cards_occupied_info_on(out, total_cards_occupied()); + } + + // Largest sized rem set region statistics + HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set(); + out->print_cr(" Region with largest rem set = "HR_FORMAT", " + "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.", + HR_FORMAT_PARAMS(max_rs_mem_sz_region()), + round_to_K(rem_set->mem_size()), + round_to_K(rem_set->occupied())); + + // Strong code root statistics + HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set(); + out->print_cr(" Total heap region code root sets sizes = "SIZE_FORMAT"K." + " Max = "SIZE_FORMAT"K.", + round_to_K(total_code_root_mem_sz()), + round_to_K(max_code_root_rem_set->strong_code_roots_mem_size())); + for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { + (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz()); + } + + out->print_cr(" "SIZE_FORMAT" code roots represented.", + total_code_root_elems()); + for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { + (*current)->print_code_root_elems_info_on(out, total_code_root_elems()); + } + + out->print_cr(" Region with largest amount of code roots = "HR_FORMAT", " + "size = "SIZE_FORMAT "K, num_elems = "SIZE_FORMAT".", + HR_FORMAT_PARAMS(max_code_root_mem_sz_region()), + round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()), + round_to_K(max_code_root_rem_set->strong_code_roots_list_length())); + } }; -double calc_percentage(size_t numerator, size_t denominator) { - if (denominator != 0) { - return (double)numerator / denominator * 100.0; - } else { - return 0.0f; - } -} - void G1RemSetSummary::print_on(outputStream* out) { - out->print_cr("\n Concurrent RS processed "SIZE_FORMAT" cards", + out->print_cr("\n Recent concurrent refinement statistics"); + out->print_cr(" Processed "SIZE_FORMAT" cards", num_concurrent_refined_cards()); out->print_cr(" Of %d completed buffers:", num_processed_buf_total()); out->print_cr(" %8d (%5.1f%%) by concurrent RS threads.", num_processed_buf_total(), - calc_percentage(num_processed_buf_rs_threads(), num_processed_buf_total())); + percent_of(num_processed_buf_rs_threads(), num_processed_buf_total())); out->print_cr(" %8d (%5.1f%%) by mutator threads.", num_processed_buf_mutator(), - calc_percentage(num_processed_buf_mutator(), num_processed_buf_total())); + percent_of(num_processed_buf_mutator(), num_processed_buf_total())); + out->print_cr(" Did %d coarsenings.", num_coarsenings()); out->print_cr(" Concurrent RS threads times (s)"); out->print(" "); for (uint i = 0; i < _num_vtimes; i++) { @@ -207,33 +346,5 @@ void G1RemSetSummary::print_on(outputStream* out) { HRRSStatsIter blk; G1CollectedHeap::heap()->heap_region_iterate(&blk); - // RemSet stats - out->print_cr(" Total heap region rem set sizes = "SIZE_FORMAT"K." - " Max = "SIZE_FORMAT"K.", - blk.total_rs_mem_sz()/K, blk.max_rs_mem_sz()/K); - out->print_cr(" Static structures = "SIZE_FORMAT"K," - " free_lists = "SIZE_FORMAT"K.", - HeapRegionRemSet::static_mem_size() / K, - HeapRegionRemSet::fl_mem_size() / K); - out->print_cr(" "SIZE_FORMAT" occupied cards represented.", - blk.occupied()); - HeapRegion* max_rs_mem_sz_region = blk.max_rs_mem_sz_region(); - HeapRegionRemSet* max_rs_rem_set = max_rs_mem_sz_region->rem_set(); - out->print_cr(" Max size region = "HR_FORMAT", " - "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.", - HR_FORMAT_PARAMS(max_rs_mem_sz_region), - (max_rs_rem_set->mem_size() + K - 1)/K, - (max_rs_rem_set->occupied() + K - 1)/K); - out->print_cr(" Did %d coarsenings.", num_coarsenings()); - // Strong code root stats - out->print_cr(" Total heap region code-root set sizes = "SIZE_FORMAT"K." - " Max = "SIZE_FORMAT"K.", - blk.total_code_root_mem_sz()/K, blk.max_code_root_mem_sz()/K); - HeapRegion* max_code_root_mem_sz_region = blk.max_code_root_mem_sz_region(); - HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region->rem_set(); - out->print_cr(" Max size region = "HR_FORMAT", " - "size = "SIZE_FORMAT "K, num_elems = "SIZE_FORMAT".", - HR_FORMAT_PARAMS(max_code_root_mem_sz_region), - (max_code_root_rem_set->strong_code_roots_mem_size() + K - 1)/K, - (max_code_root_rem_set->strong_code_roots_list_length())); + blk.print_summary_on(out); } diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStats.java b/hotspot/test/gc/g1/TestSummarizeRSetStats.java index 1990d4c6f39..e78e2df21a3 100644 --- a/hotspot/test/gc/g1/TestSummarizeRSetStats.java +++ b/hotspot/test/gc/g1/TestSummarizeRSetStats.java @@ -25,140 +25,61 @@ * @test TestSummarizeRSetStats.java * @bug 8013895 * @library /testlibrary - * @build TestSummarizeRSetStats + * @build TestSummarizeRSetStatsTools TestSummarizeRSetStats * @summary Verify output of -XX:+G1SummarizeRSetStats * @run main TestSummarizeRSetStats * * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod. */ -import com.oracle.java.testlibrary.*; -import java.lang.Thread; -import java.util.ArrayList; -import java.util.Arrays; - -class RunSystemGCs { - // 4M size, both are directly allocated into the old gen - static Object[] largeObject1 = new Object[1024 * 1024]; - static Object[] largeObject2 = new Object[1024 * 1024]; - - static int[] temp; - - public static void main(String[] args) { - // create some cross-references between these objects - for (int i = 0; i < largeObject1.length; i++) { - largeObject1[i] = largeObject2; - } - - for (int i = 0; i < largeObject2.length; i++) { - largeObject2[i] = largeObject1; - } - - int numGCs = Integer.parseInt(args[0]); - - if (numGCs > 0) { - // try to force a minor collection: the young gen is 4M, the - // amount of data allocated below is roughly that (4*1024*1024 + - // some header data) - for (int i = 0; i < 1024 ; i++) { - temp = new int[1024]; - } - } - - for (int i = 0; i < numGCs - 1; i++) { - System.gc(); - } - } -} - public class TestSummarizeRSetStats { - public static String runTest(String[] additionalArgs, int numGCs) throws Exception { - ArrayList finalargs = new ArrayList(); - String[] defaultArgs = new String[] { - "-XX:+UseG1GC", - "-Xmn4m", - "-Xmx20m", - "-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking - "-XX:+PrintGC", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:G1HeapRegionSize=1M", - }; - - finalargs.addAll(Arrays.asList(defaultArgs)); - - if (additionalArgs != null) { - finalargs.addAll(Arrays.asList(additionalArgs)); - } - - finalargs.add(RunSystemGCs.class.getName()); - finalargs.add(String.valueOf(numGCs)); - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - finalargs.toArray(new String[0])); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - - output.shouldHaveExitValue(0); - - String result = output.getStdout(); - return result; - } - - private static void expectStatistics(String result, int expectedCumulative, int expectedPeriodic) throws Exception { - int actualTotal = result.split("Concurrent RS processed").length - 1; - int actualCumulative = result.split("Cumulative RS summary").length - 1; - - if (expectedCumulative != actualCumulative) { - throw new Exception("Incorrect amount of RSet summaries at the end. Expected " + expectedCumulative + ", got " + actualCumulative); - } - - if (expectedPeriodic != (actualTotal - actualCumulative)) { - throw new Exception("Incorrect amount of per-period RSet summaries at the end. Expected " + expectedPeriodic + ", got " + (actualTotal - actualCumulative)); - } - } - public static void main(String[] args) throws Exception { String result; - // no RSet statistics output - result = runTest(null, 0); - expectStatistics(result, 0, 0); + if (!TestSummarizeRSetStatsTools.testingG1GC()) { + return; + } - // no RSet statistics output - result = runTest(null, 2); - expectStatistics(result, 0, 0); + // no remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(null, 0); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0); - // no RSet statistics output - result = runTest(new String[] { "-XX:G1SummarizeRSetStatsPeriod=1" }, 3); - expectStatistics(result, 0, 0); + // no remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(null, 2); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0); - // single RSet statistics output at the end - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0); - expectStatistics(result, 1, 0); + // no remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:G1SummarizeRSetStatsPeriod=1" }, 3); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0); - // single RSet statistics output at the end - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 2); - expectStatistics(result, 1, 0); + // single remembered set summary output at the end + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0); - // single RSet statistics output - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 0); - expectStatistics(result, 1, 0); + // single remembered set summary output at the end + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 2); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0); - // two times RSet statistics output - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1); - expectStatistics(result, 1, 1); + // single remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 0); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0); - // four times RSet statistics output - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 3); - expectStatistics(result, 1, 3); + // two times remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 2); - // three times RSet statistics output - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=2" }, 3); - expectStatistics(result, 1, 2); + // four times remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 3); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 6); - // single RSet statistics output - result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=100" }, 3); - expectStatistics(result, 1, 1); + // three times remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=2" }, 3); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 4); + + // single remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=100" }, 3); + TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 2); } } diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java new file mode 100644 index 00000000000..437cbc2c70e --- /dev/null +++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java @@ -0,0 +1,55 @@ +/* + * 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 TestSummarizeRSetStatsPerRegion.java + * @bug 8014078 + * @library /testlibrary + * @build TestSummarizeRSetStatsTools TestSummarizeRSetStatsPerRegion + * @summary Verify output of -XX:+G1SummarizeRSetStats in regards to per-region type output + * @run main TestSummarizeRSetStatsPerRegion + */ + +import com.oracle.java.testlibrary.*; +import java.lang.Thread; +import java.util.ArrayList; +import java.util.Arrays; + +public class TestSummarizeRSetStatsPerRegion { + + public static void main(String[] args) throws Exception { + String result; + + if (!TestSummarizeRSetStatsTools.testingG1GC()) { + return; + } + + // single remembered set summary output at the end + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0); + TestSummarizeRSetStatsTools.expectPerRegionRSetSummaries(result, 1, 0); + + // two times remembered set summary output + result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1); + TestSummarizeRSetStatsTools.expectPerRegionRSetSummaries(result, 1, 2); + } +} diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java b/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java new file mode 100644 index 00000000000..096a7c675b5 --- /dev/null +++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java @@ -0,0 +1,154 @@ +/* + * 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. + */ + +/* + * Common helpers for TestSummarizeRSetStats* tests + */ + +import sun.management.ManagementFactoryHelper; +import com.sun.management.HotSpotDiagnosticMXBean; +import com.sun.management.VMOption; + +import com.oracle.java.testlibrary.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.lang.Thread; +import java.util.ArrayList; +import java.util.Arrays; + +class VerifySummaryOutput { + // 4M size, both are directly allocated into the old gen + static Object[] largeObject1 = new Object[1024 * 1024]; + static Object[] largeObject2 = new Object[1024 * 1024]; + + static int[] temp; + + public static void main(String[] args) { + // create some cross-references between these objects + for (int i = 0; i < largeObject1.length; i++) { + largeObject1[i] = largeObject2; + } + + for (int i = 0; i < largeObject2.length; i++) { + largeObject2[i] = largeObject1; + } + + int numGCs = Integer.parseInt(args[0]); + + if (numGCs > 0) { + // try to force a minor collection: the young gen is 4M, the + // amount of data allocated below is roughly that (4*1024*1024 + + // some header data) + for (int i = 0; i < 1024 ; i++) { + temp = new int[1024]; + } + } + + for (int i = 0; i < numGCs - 1; i++) { + System.gc(); + } + } +} + +public class TestSummarizeRSetStatsTools { + + // the VM is currently run using G1GC, i.e. trying to test G1 functionality. + public static boolean testingG1GC() { + HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + + VMOption option = diagnostic.getVMOption("UseG1GC"); + if (option.getValue().equals("false")) { + System.out.println("Skipping this test. It is only a G1 test."); + return false; + } + return true; + } + + public static String runTest(String[] additionalArgs, int numGCs) throws Exception { + ArrayList finalargs = new ArrayList(); + String[] defaultArgs = new String[] { + "-XX:+UseG1GC", + "-XX:+UseCompressedOops", + "-Xmn4m", + "-Xmx20m", + "-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking + "-XX:+PrintGC", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:G1HeapRegionSize=1M", + }; + + finalargs.addAll(Arrays.asList(defaultArgs)); + + if (additionalArgs != null) { + finalargs.addAll(Arrays.asList(additionalArgs)); + } + + finalargs.add(VerifySummaryOutput.class.getName()); + finalargs.add(String.valueOf(numGCs)); + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + finalargs.toArray(new String[0])); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.shouldHaveExitValue(0); + + String result = output.getStdout(); + return result; + } + + private static void checkCounts(int expected, int actual, String which) throws Exception { + if (expected != actual) { + throw new Exception("RSet summaries mention " + which + " regions an incorrect number of times. Expected " + expected + ", got " + actual); + } + } + + public static void expectPerRegionRSetSummaries(String result, int expectedCumulative, int expectedPeriodic) throws Exception { + expectRSetSummaries(result, expectedCumulative, expectedPeriodic); + int actualYoung = result.split("Young regions").length - 1; + int actualHumonguous = result.split("Humonguous regions").length - 1; + int actualFree = result.split("Free regions").length - 1; + int actualOther = result.split("Old regions").length - 1; + + // the strings we check for above are printed four times per summary + int expectedPerRegionTypeInfo = (expectedCumulative + expectedPeriodic) * 4; + + checkCounts(expectedPerRegionTypeInfo, actualYoung, "Young"); + checkCounts(expectedPerRegionTypeInfo, actualHumonguous, "Humonguous"); + checkCounts(expectedPerRegionTypeInfo, actualFree, "Free"); + checkCounts(expectedPerRegionTypeInfo, actualOther, "Old"); + } + + public static void expectRSetSummaries(String result, int expectedCumulative, int expectedPeriodic) throws Exception { + int actualTotal = result.split("concurrent refinement").length - 1; + int actualCumulative = result.split("Cumulative RS summary").length - 1; + + if (expectedCumulative != actualCumulative) { + throw new Exception("Incorrect amount of RSet summaries at the end. Expected " + expectedCumulative + ", got " + actualCumulative); + } + + if (expectedPeriodic != (actualTotal - actualCumulative)) { + throw new Exception("Incorrect amount of per-period RSet summaries at the end. Expected " + expectedPeriodic + ", got " + (actualTotal - actualCumulative)); + } + } +} + From 27565b7f5d9dfcb099a4c7a95c13b48607853c7a Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Fri, 27 Sep 2013 10:23:12 +0200 Subject: [PATCH 208/983] 8025279: metaspace/flags/maxMetaspaceSize throws OOM: out of Compressed Klass space Only put "Compressed class space" as OOM cause if actually using Compressed class space Reviewed-by: jwilhelm, stefank, ehelin, coleenp --- hotspot/src/share/vm/memory/metaspace.cpp | 8 ++++---- hotspot/src/share/vm/memory/metaspace.hpp | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 06f3d09378a..7b9144942d9 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -3104,7 +3104,7 @@ size_t Metaspace::align_word_size_up(size_t word_size) { MetaWord* Metaspace::allocate(size_t word_size, MetadataType mdtype) { // DumpSharedSpaces doesn't use class metadata area (yet) // Also, don't use class_vsm() unless UseCompressedClassPointers is true. - if (mdtype == ClassType && using_class_space()) { + if (is_class_space_allocation(mdtype)) { return class_vsm()->allocate(word_size); } else { return vsm()->allocate(word_size); @@ -3252,8 +3252,8 @@ Metablock* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size, MetaspaceAux::dump(gclog_or_tty); } // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support - const char* space_string = (mdtype == ClassType) ? "Compressed class space" : - "Metadata space"; + const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" : + "Metadata space"; report_java_out_of_memory(space_string); if (JvmtiExport::should_post_resource_exhausted()) { @@ -3261,7 +3261,7 @@ Metablock* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size, JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, space_string); } - if (mdtype == ClassType) { + if (is_class_space_allocation(mdtype)) { THROW_OOP_0(Universe::out_of_memory_error_class_metaspace()); } else { THROW_OOP_0(Universe::out_of_memory_error_metaspace()); diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp index 29c07e15179..925d9c140d6 100644 --- a/hotspot/src/share/vm/memory/metaspace.hpp +++ b/hotspot/src/share/vm/memory/metaspace.hpp @@ -235,6 +235,9 @@ class Metaspace : public CHeapObj { return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers && !DumpSharedSpaces); } + static bool is_class_space_allocation(MetadataType mdType) { + return mdType == ClassType && using_class_space(); + } }; class MetaspaceAux : AllStatic { From b8363e6615bcc65a4aa3c1fe4799dcebb18dedbb Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Tue, 24 Sep 2013 14:46:29 +0200 Subject: [PATCH 209/983] 8025305: Cleanup CardTableModRefBS usage in G1 Move some G1 specific code from CardTableModRefBS to G1SATBCardTableModRefBS. Reviewed-by: brutisso, tschatzl, ehelin --- .../g1/concurrentMark.inline.hpp | 2 +- .../vm/gc_implementation/g1/g1CardCounts.cpp | 4 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 46 ++++++---------- .../gc_implementation/g1/g1CollectedHeap.hpp | 12 +++-- .../g1/g1CollectedHeap.inline.hpp | 2 +- .../vm/gc_implementation/g1/g1EvacFailure.hpp | 4 +- .../vm/gc_implementation/g1/g1MarkSweep.cpp | 2 +- .../vm/gc_implementation/g1/g1RemSet.cpp | 11 ++-- .../g1/g1SATBCardTableModRefBS.cpp | 21 ++++++++ .../g1/g1SATBCardTableModRefBS.hpp | 36 +++++++++++++ .../src/share/vm/memory/cardTableModRefBS.cpp | 54 ------------------- .../src/share/vm/memory/cardTableModRefBS.hpp | 24 --------- 12 files changed, 90 insertions(+), 128 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp index d962842b39a..ea45f2d6466 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp @@ -81,7 +81,7 @@ inline void ConcurrentMark::count_region(MemRegion mr, HeapRegion* hr, size_t* marked_bytes_array, BitMap* task_card_bm) { G1CollectedHeap* g1h = _g1h; - CardTableModRefBS* ct_bs = (CardTableModRefBS*) (g1h->barrier_set()); + CardTableModRefBS* ct_bs = g1h->g1_barrier_set(); HeapWord* start = mr.start(); HeapWord* end = mr.end(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp index 31972bf3c4e..59041d34ae2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp @@ -65,9 +65,7 @@ void G1CardCounts::initialize() { // threshold limit is no more than this. guarantee(G1ConcRSHotCardLimit <= max_jubyte, "sanity"); - ModRefBarrierSet* bs = _g1h->mr_bs(); - guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition"); - _ct_bs = (CardTableModRefBS*)bs; + _ct_bs = _g1h->g1_barrier_set(); _ct_bot = _ct_bs->byte_for_const(_g1h->reserved_region().start()); // Allocate/Reserve the counts table diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index eff0efc6e0f..b5ea461690c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -125,10 +125,8 @@ class ClearLoggedCardTableEntryClosure: public CardTableEntryClosure { int _histo[256]; public: ClearLoggedCardTableEntryClosure() : - _calls(0) + _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) { - _g1h = G1CollectedHeap::heap(); - _ctbs = (CardTableModRefBS*)_g1h->barrier_set(); for (int i = 0; i < 256; i++) _histo[i] = 0; } bool do_card_ptr(jbyte* card_ptr, int worker_i) { @@ -158,11 +156,8 @@ class RedirtyLoggedCardTableEntryClosure: public CardTableEntryClosure { CardTableModRefBS* _ctbs; public: RedirtyLoggedCardTableEntryClosure() : - _calls(0) - { - _g1h = G1CollectedHeap::heap(); - _ctbs = (CardTableModRefBS*)_g1h->barrier_set(); - } + _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) {} + bool do_card_ptr(jbyte* card_ptr, int worker_i) { if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) { _calls++; @@ -478,7 +473,7 @@ bool G1CollectedHeap::is_scavengable(const void* p) { void G1CollectedHeap::check_ct_logs_at_safepoint() { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); - CardTableModRefBS* ct_bs = (CardTableModRefBS*)barrier_set(); + CardTableModRefBS* ct_bs = g1_barrier_set(); // Count the dirty cards at the start. CountNonCleanMemRegionClosure count1(this); @@ -1205,7 +1200,7 @@ public: }; void G1CollectedHeap::clear_rsets_post_compaction() { - PostMCRemSetClearClosure rs_clear(this, mr_bs()); + PostMCRemSetClearClosure rs_clear(this, g1_barrier_set()); heap_region_iterate(&rs_clear); } @@ -2045,20 +2040,13 @@ jint G1CollectedHeap::initialize() { // Create the gen rem set (and barrier set) for the entire reserved region. _rem_set = collector_policy()->create_rem_set(_reserved, 2); set_barrier_set(rem_set()->bs()); - if (barrier_set()->is_a(BarrierSet::ModRef)) { - _mr_bs = (ModRefBarrierSet*)_barrier_set; - } else { - vm_exit_during_initialization("G1 requires a mod ref bs."); + if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) { + vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS"); return JNI_ENOMEM; } // Also create a G1 rem set. - if (mr_bs()->is_a(BarrierSet::CardTableModRef)) { - _g1_rem_set = new G1RemSet(this, (CardTableModRefBS*)mr_bs()); - } else { - vm_exit_during_initialization("G1 requires a cardtable mod ref bs."); - return JNI_ENOMEM; - } + _g1_rem_set = new G1RemSet(this, g1_barrier_set()); // Carve out the G1 part of the heap. @@ -4555,7 +4543,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num) : _g1h(g1h), _refs(g1h->task_queue(queue_num)), _dcq(&g1h->dirty_card_queue_set()), - _ct_bs((CardTableModRefBS*)_g1h->barrier_set()), + _ct_bs(g1h->g1_barrier_set()), _g1_rem(g1h->g1_rem_set()), _hash_seed(17), _queue_num(queue_num), _term_attempts(0), @@ -5984,11 +5972,11 @@ void G1CollectedHeap::update_sets_after_freeing_regions(size_t pre_used, } class G1ParCleanupCTTask : public AbstractGangTask { - CardTableModRefBS* _ct_bs; + G1SATBCardTableModRefBS* _ct_bs; G1CollectedHeap* _g1h; HeapRegion* volatile _su_head; public: - G1ParCleanupCTTask(CardTableModRefBS* ct_bs, + G1ParCleanupCTTask(G1SATBCardTableModRefBS* ct_bs, G1CollectedHeap* g1h) : AbstractGangTask("G1 Par Cleanup CT Task"), _ct_bs(ct_bs), _g1h(g1h) { } @@ -6011,9 +5999,9 @@ public: #ifndef PRODUCT class G1VerifyCardTableCleanup: public HeapRegionClosure { G1CollectedHeap* _g1h; - CardTableModRefBS* _ct_bs; + G1SATBCardTableModRefBS* _ct_bs; public: - G1VerifyCardTableCleanup(G1CollectedHeap* g1h, CardTableModRefBS* ct_bs) + G1VerifyCardTableCleanup(G1CollectedHeap* g1h, G1SATBCardTableModRefBS* ct_bs) : _g1h(g1h), _ct_bs(ct_bs) { } virtual bool doHeapRegion(HeapRegion* r) { if (r->is_survivor()) { @@ -6027,7 +6015,7 @@ public: void G1CollectedHeap::verify_not_dirty_region(HeapRegion* hr) { // All of the region should be clean. - CardTableModRefBS* ct_bs = (CardTableModRefBS*)barrier_set(); + G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); MemRegion mr(hr->bottom(), hr->end()); ct_bs->verify_not_dirty_region(mr); } @@ -6040,13 +6028,13 @@ void G1CollectedHeap::verify_dirty_region(HeapRegion* hr) { // not dirty that area (one less thing to have to do while holding // a lock). So we can only verify that [bottom(),pre_dummy_top()] // is dirty. - CardTableModRefBS* ct_bs = (CardTableModRefBS*) barrier_set(); + G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); MemRegion mr(hr->bottom(), hr->pre_dummy_top()); ct_bs->verify_dirty_region(mr); } void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) { - CardTableModRefBS* ct_bs = (CardTableModRefBS*) barrier_set(); + G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); for (HeapRegion* hr = head; hr != NULL; hr = hr->get_next_young_region()) { verify_dirty_region(hr); } @@ -6058,7 +6046,7 @@ void G1CollectedHeap::verify_dirty_young_regions() { #endif void G1CollectedHeap::cleanUpCardTable() { - CardTableModRefBS* ct_bs = (CardTableModRefBS*) (barrier_set()); + G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); double start = os::elapsedTime(); { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 747b2326236..3a6a0c5f37e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -31,6 +31,7 @@ #include "gc_implementation/g1/g1HRPrinter.hpp" #include "gc_implementation/g1/g1MonitoringSupport.hpp" #include "gc_implementation/g1/g1RemSet.hpp" +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #include "gc_implementation/g1/g1YCTypes.hpp" #include "gc_implementation/g1/heapRegionSeq.hpp" #include "gc_implementation/g1/heapRegionSets.hpp" @@ -791,8 +792,6 @@ protected: // The g1 remembered set of the heap. G1RemSet* _g1_rem_set; - // And it's mod ref barrier set, used to track updates for the above. - ModRefBarrierSet* _mr_bs; // A set of cards that cover the objects for which the Rsets should be updated // concurrently after the collection. @@ -1127,7 +1126,6 @@ public: // The rem set and barrier set. G1RemSet* g1_rem_set() const { return _g1_rem_set; } - ModRefBarrierSet* mr_bs() const { return _mr_bs; } unsigned get_gc_time_stamp() { return _gc_time_stamp; @@ -1346,6 +1344,10 @@ public: virtual bool is_in_closed_subset(const void* p) const; + G1SATBCardTableModRefBS* g1_barrier_set() { + return (G1SATBCardTableModRefBS*) barrier_set(); + } + // This resets the card table to all zeros. It is used after // a collection pause which used the card table to claim cards. void cleanUpCardTable(); @@ -1875,7 +1877,7 @@ protected: G1CollectedHeap* _g1h; RefToScanQueue* _refs; DirtyCardQueue _dcq; - CardTableModRefBS* _ct_bs; + G1SATBCardTableModRefBS* _ct_bs; G1RemSet* _g1_rem; G1ParGCAllocBufferContainer _surviving_alloc_buffer; @@ -1914,7 +1916,7 @@ protected: void add_to_undo_waste(size_t waste) { _undo_waste += waste; } DirtyCardQueue& dirty_card_queue() { return _dcq; } - CardTableModRefBS* ctbs() { return _ct_bs; } + G1SATBCardTableModRefBS* ctbs() { return _ct_bs; } template void immediate_rs_update(HeapRegion* from, T* p, int tid) { if (!from->is_survivor()) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp index 20eb1693c43..5cd3f7f21cd 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @@ -134,7 +134,7 @@ G1CollectedHeap::dirty_young_block(HeapWord* start, size_t word_size) { assert(containing_hr->is_in(end - 1), "it should also contain end - 1"); MemRegion mr(start, end); - ((CardTableModRefBS*)_g1h->barrier_set())->dirty(mr); + g1_barrier_set()->dirty(mr); } inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp index 84d998265a9..1333f287047 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp @@ -41,11 +41,11 @@ class UpdateRSetDeferred : public OopsInHeapRegionClosure { private: G1CollectedHeap* _g1; DirtyCardQueue *_dcq; - CardTableModRefBS* _ct_bs; + G1SATBCardTableModRefBS* _ct_bs; public: UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) : - _g1(g1), _ct_bs((CardTableModRefBS*)_g1->barrier_set()), _dcq(dcq) {} + _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {} virtual void do_oop(narrowOop* p) { do_oop_work(p); } virtual void do_oop( oop* p) { do_oop_work(p); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 74aabc1298d..87650103d60 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -220,7 +220,7 @@ class G1PrepareCompactClosure: public HeapRegionClosure { public: G1PrepareCompactClosure(CompactibleSpace* cs) : _g1h(G1CollectedHeap::heap()), - _mrbs(G1CollectedHeap::heap()->mr_bs()), + _mrbs(_g1h->g1_barrier_set()), _cp(NULL, cs, cs->initialize_threshold()), _humongous_proxy_set("G1MarkSweep Humongous Proxy Set") { } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index a8c580b60cd..0e06c472ffa 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -109,7 +109,7 @@ class ScanRSClosure : public HeapRegionClosure { CodeBlobToOopClosure* _code_root_cl; G1BlockOffsetSharedArray* _bot_shared; - CardTableModRefBS *_ct_bs; + G1SATBCardTableModRefBS *_ct_bs; double _strong_code_root_scan_time_sec; int _worker_i; @@ -130,7 +130,7 @@ public: { _g1h = G1CollectedHeap::heap(); _bot_shared = _g1h->bot_shared(); - _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set()); + _ct_bs = _g1h->g1_barrier_set(); _block_size = MAX2(G1RSetScanBlockSize, 1); } @@ -505,12 +505,7 @@ public: ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) : _g1h(G1CollectedHeap::heap()), _region_bm(region_bm), _card_bm(card_bm), - _ctbs(NULL) - { - ModRefBarrierSet* bs = _g1h->mr_bs(); - guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition"); - _ctbs = (CardTableModRefBS*)bs; - } + _ctbs(_g1h->g1_barrier_set()) {} bool doHeapRegion(HeapRegion* r) { if (!r->continuesHumongous()) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp index 218be0c0e40..48c737e74ab 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @@ -64,6 +64,27 @@ G1SATBCardTableModRefBS::write_ref_array_pre_work(T* dst, int count) { } } +bool G1SATBCardTableModRefBS::mark_card_deferred(size_t card_index) { + jbyte val = _byte_map[card_index]; + // It's already processed + if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) { + return false; + } + // Cached bit can be installed either on a clean card or on a claimed card. + jbyte new_val = val; + if (val == clean_card_val()) { + new_val = (jbyte)deferred_card_val(); + } else { + if (val & claimed_card_val()) { + new_val = val | (jbyte)deferred_card_val(); + } + } + if (new_val != val) { + Atomic::cmpxchg(new_val, &_byte_map[card_index], val); + } + return true; +} + G1SATBCardTableLoggingModRefBS:: G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, int max_covered_regions) : diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp index 6f887583cab..4e807348102 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -89,6 +89,42 @@ public: write_ref_array_pre_work(dst, count); } } + +/* + Claimed and deferred bits are used together in G1 during the evacuation + pause. These bits can have the following state transitions: + 1. The claimed bit can be put over any other card state. Except that + the "dirty -> dirty and claimed" transition is checked for in + G1 code and is not used. + 2. Deferred bit can be set only if the previous state of the card + was either clean or claimed. mark_card_deferred() is wait-free. + We do not care if the operation is be successful because if + it does not it will only result in duplicate entry in the update + buffer because of the "cache-miss". So it's not worth spinning. + */ + + bool is_card_claimed(size_t card_index) { + jbyte val = _byte_map[card_index]; + return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val(); + } + + void set_card_claimed(size_t card_index) { + jbyte val = _byte_map[card_index]; + if (val == clean_card_val()) { + val = (jbyte)claimed_card_val(); + } else { + val |= (jbyte)claimed_card_val(); + } + _byte_map[card_index] = val; + } + + bool mark_card_deferred(size_t card_index); + + bool is_card_deferred(size_t card_index) { + jbyte val = _byte_map[card_index]; + return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val(); + } + }; // Adds card-table logging to the post-barrier. diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index 82336503eb4..5e9d843ff52 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -423,60 +423,6 @@ void CardTableModRefBS::write_ref_field_work(void* field, oop newVal) { inline_write_ref_field(field, newVal); } -/* - Claimed and deferred bits are used together in G1 during the evacuation - pause. These bits can have the following state transitions: - 1. The claimed bit can be put over any other card state. Except that - the "dirty -> dirty and claimed" transition is checked for in - G1 code and is not used. - 2. Deferred bit can be set only if the previous state of the card - was either clean or claimed. mark_card_deferred() is wait-free. - We do not care if the operation is be successful because if - it does not it will only result in duplicate entry in the update - buffer because of the "cache-miss". So it's not worth spinning. - */ - - -bool CardTableModRefBS::claim_card(size_t card_index) { - jbyte val = _byte_map[card_index]; - assert(val != dirty_card_val(), "Shouldn't claim a dirty card"); - while (val == clean_card_val() || - (val & (clean_card_mask_val() | claimed_card_val())) != claimed_card_val()) { - jbyte new_val = val; - if (val == clean_card_val()) { - new_val = (jbyte)claimed_card_val(); - } else { - new_val = val | (jbyte)claimed_card_val(); - } - jbyte res = Atomic::cmpxchg(new_val, &_byte_map[card_index], val); - if (res == val) { - return true; - } - val = res; - } - return false; -} - -bool CardTableModRefBS::mark_card_deferred(size_t card_index) { - jbyte val = _byte_map[card_index]; - // It's already processed - if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) { - return false; - } - // Cached bit can be installed either on a clean card or on a claimed card. - jbyte new_val = val; - if (val == clean_card_val()) { - new_val = (jbyte)deferred_card_val(); - } else { - if (val & claimed_card_val()) { - new_val = val | (jbyte)deferred_card_val(); - } - } - if (new_val != val) { - Atomic::cmpxchg(new_val, &_byte_map[card_index], val); - } - return true; -} void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index 6b5de2a4460..cadb4cb88aa 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -339,34 +339,10 @@ public: _byte_map[card_index] = dirty_card_val(); } - bool is_card_claimed(size_t card_index) { - jbyte val = _byte_map[card_index]; - return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val(); - } - - void set_card_claimed(size_t card_index) { - jbyte val = _byte_map[card_index]; - if (val == clean_card_val()) { - val = (jbyte)claimed_card_val(); - } else { - val |= (jbyte)claimed_card_val(); - } - _byte_map[card_index] = val; - } - - bool claim_card(size_t card_index); - bool is_card_clean(size_t card_index) { return _byte_map[card_index] == clean_card_val(); } - bool is_card_deferred(size_t card_index) { - jbyte val = _byte_map[card_index]; - return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val(); - } - - bool mark_card_deferred(size_t card_index); - // Card marking array base (adjusted for heap low boundary) // This would be the 0th element of _byte_map, if the heap started at 0x0. // But since the heap starts at some higher address, this points to somewhere From cde6d64f602ad01e860dd867ac2c8c0e84a4c4c2 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Tue, 24 Sep 2013 17:04:47 +0400 Subject: [PATCH 210/983] 8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/JLayer.java | 38 ++--- .../share/classes/javax/swing/RowFilter.java | 4 +- .../classes/javax/swing/plaf/TextUI.java | 18 +-- .../javax/swing/plaf/basic/BasicTextUI.java | 28 ++-- .../javax/swing/text/AttributeSet.java | 2 +- .../swing/text/BadLocationException.java | 4 +- .../classes/javax/swing/text/BoxView.java | 46 +++--- .../share/classes/javax/swing/text/Caret.java | 10 +- .../javax/swing/text/ComponentView.java | 12 +- .../javax/swing/text/CompositeView.java | 64 ++++---- .../javax/swing/text/DefaultEditorKit.java | 12 +- .../javax/swing/text/DefaultHighlighter.java | 16 +- .../swing/text/DefaultStyledDocument.java | 40 ++--- .../classes/javax/swing/text/Document.java | 20 +-- .../javax/swing/text/DocumentFilter.java | 12 +- .../classes/javax/swing/text/EditorKit.java | 14 +- .../classes/javax/swing/text/FieldView.java | 10 +- .../classes/javax/swing/text/FlowView.java | 26 ++-- .../classes/javax/swing/text/GapContent.java | 22 +-- .../classes/javax/swing/text/GlyphView.java | 52 +++---- .../classes/javax/swing/text/Highlighter.java | 16 +- .../classes/javax/swing/text/IconView.java | 10 +- .../javax/swing/text/NavigationFilter.java | 8 +- .../javax/swing/text/ParagraphView.java | 18 +-- .../javax/swing/text/PasswordView.java | 34 ++--- .../javax/swing/text/PlainDocument.java | 2 +- .../classes/javax/swing/text/PlainView.java | 44 +++--- .../classes/javax/swing/text/Position.java | 2 +- .../javax/swing/text/StringContent.java | 30 ++-- .../javax/swing/text/StyleContext.java | 4 +- .../javax/swing/text/StyledDocument.java | 16 +- .../javax/swing/text/StyledEditorKit.java | 2 +- .../classes/javax/swing/text/TabExpander.java | 6 +- .../classes/javax/swing/text/TabableView.java | 10 +- .../classes/javax/swing/text/TableView.java | 12 +- .../classes/javax/swing/text/Utilities.java | 64 ++++---- .../share/classes/javax/swing/text/View.java | 26 ++-- .../javax/swing/text/WrappedPlainView.java | 36 ++--- .../classes/javax/swing/text/ZoneView.java | 12 +- .../javax/swing/text/html/BlockView.java | 6 +- .../classes/javax/swing/text/html/CSS.java | 2 +- .../javax/swing/text/html/FormView.java | 2 +- .../javax/swing/text/html/HTMLDocument.java | 139 +++++++++--------- 43 files changed, 476 insertions(+), 475 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/JLayer.java b/jdk/src/share/classes/javax/swing/JLayer.java index 2341c502e04..b0f3894ba70 100644 --- a/jdk/src/share/classes/javax/swing/JLayer.java +++ b/jdk/src/share/classes/javax/swing/JLayer.java @@ -44,16 +44,16 @@ import java.security.PrivilegedAction; * {@code JLayer} is a universal decorator for Swing components * which enables you to implement various advanced painting effects as well as * receive notifications of all {@code AWTEvent}s generated within its borders. - *

    + *

    * {@code JLayer} delegates the handling of painting and input events to a * {@link javax.swing.plaf.LayerUI} object, which performs the actual decoration. - *

    + *

    * The custom painting implemented in the {@code LayerUI} and events notification * work for the JLayer itself and all its subcomponents. * This combination enables you to enrich existing components * by adding new advanced functionality such as temporary locking of a hierarchy, * data tips for compound components, enhanced mouse scrolling etc and so on. - *

    + *

    * {@code JLayer} is a good solution if you only need to do custom painting * over compound component or catch input events from its subcomponents. *

    @@ -202,7 +202,7 @@ public final class JLayer
     
         /**
          * Returns the {@code JLayer}'s view component or {@code null}.
    -     * 
    This is a bound property. + *
    This is a bound property. * * @return the {@code JLayer}'s view component * or {@code null} if none exists @@ -215,7 +215,7 @@ public final class JLayer /** * Sets the {@code JLayer}'s view component, which can be {@code null}. - *
    This is a bound property. + *
    This is a bound property. * * @param view the view component for this {@code JLayer} * @@ -257,7 +257,7 @@ public final class JLayer /** * Returns the {@code JLayer}'s glassPane component or {@code null}. - *
    This is a bound property. + *
    This is a bound property. * * @return the {@code JLayer}'s glassPane component * or {@code null} if none exists @@ -270,7 +270,7 @@ public final class JLayer /** * Sets the {@code JLayer}'s glassPane component, which can be {@code null}. - *
    This is a bound property. + *
    This is a bound property. * * @param glassPane the glassPane component of this {@code JLayer} * @@ -309,7 +309,7 @@ public final class JLayer /** * Sets the layout manager for this container. This method is * overridden to prevent the layout manager from being set. - *

    Note: If {@code mgr} is non-{@code null}, this + *

    Note: If {@code mgr} is non-{@code null}, this * method will throw an exception as layout managers are not supported on * a {@code JLayer}. * @@ -327,7 +327,7 @@ public final class JLayer * of this component from becoming complex enough to inhibit * subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border, * add it to a {@code JPanel} that has a border. - *

    Note: If {@code border} is non-{@code null}, this + *

    Note: If {@code border} is non-{@code null}, this * method will throw an exception as borders are not supported on * a {@code JLayer}. * @@ -471,11 +471,11 @@ public final class JLayer * defined by the specified event mask parameter * to be delivered to the * {@link LayerUI#eventDispatched(AWTEvent, JLayer)} method. - *

    + *

    * Events are delivered provided that {@code LayerUI} is set * for this {@code JLayer} and the {@code JLayer} * is displayable. - *

    + *

    * The following example shows how to correctly use this method * in the {@code LayerUI} implementations: *

    @@ -519,10 +519,10 @@ public final class JLayer
         /**
          * Returns the bitmap of event mask to receive by this {@code JLayer}
          * and its {@code LayerUI}.
    -     * 

    + *

    * It means that {@link javax.swing.plaf.LayerUI#eventDispatched(AWTEvent, JLayer)} method * will only receive events that match the event mask. - *

    + *

    * By default {@code JLayer} receives no events. * * @return the bitmask of event types to receive for this {@code JLayer} @@ -543,7 +543,7 @@ public final class JLayer /** * Returns the preferred size of the viewport for a view component. - *

    + *

    * If the view component of this layer implements {@link Scrollable}, this method delegates its * implementation to the view component. * @@ -562,7 +562,7 @@ public final class JLayer * Returns a scroll increment, which is required for components * that display logical rows or columns in order to completely expose * one block of rows or columns, depending on the value of orientation. - *

    + *

    * If the view component of this layer implements {@link Scrollable}, this method delegates its * implementation to the view component. * @@ -584,7 +584,7 @@ public final class JLayer * Returns {@code false} to indicate that the height of the viewport does not * determine the height of the layer, unless the preferred height * of the layer is smaller than the height of the viewport. - *

    + *

    * If the view component of this layer implements {@link Scrollable}, this method delegates its * implementation to the view component. * @@ -603,7 +603,7 @@ public final class JLayer * Returns {@code false} to indicate that the width of the viewport does not * determine the width of the layer, unless the preferred width * of the layer is smaller than the width of the viewport. - *

    + *

    * If the view component of this layer implements {@link Scrollable}, this method delegates its * implementation to the view component. * @@ -624,10 +624,10 @@ public final class JLayer * one new row or column, depending on the value of orientation. * Ideally, components should handle a partially exposed row or column * by returning the distance required to completely expose the item. - *

    + *

    * Scrolling containers, like {@code JScrollPane}, will use this method * each time the user requests a unit scroll. - *

    + *

    * If the view component of this layer implements {@link Scrollable}, this method delegates its * implementation to the view component. * diff --git a/jdk/src/share/classes/javax/swing/RowFilter.java b/jdk/src/share/classes/javax/swing/RowFilter.java index 219601f1ea2..6d9fc7f33f8 100644 --- a/jdk/src/share/classes/javax/swing/RowFilter.java +++ b/jdk/src/share/classes/javax/swing/RowFilter.java @@ -357,7 +357,7 @@ public abstract class RowFilter { * * @param index the index of the value to get * @return value at the specified index - * @throws IndexOutOfBoundsException if index < 0 or + * @throws IndexOutOfBoundsException if index < 0 or * >= getValueCount */ public abstract Object getValue(int index); @@ -376,7 +376,7 @@ public abstract class RowFilter { * * @param index the index of the value to get * @return {@code non-null} string at the specified index - * @throws IndexOutOfBoundsException if index < 0 || + * @throws IndexOutOfBoundsException if index < 0 || * >= getValueCount */ public String getStringValue(int index) { diff --git a/jdk/src/share/classes/javax/swing/plaf/TextUI.java b/jdk/src/share/classes/javax/swing/plaf/TextUI.java index 6459b29adb3..5d55124ed90 100644 --- a/jdk/src/share/classes/javax/swing/plaf/TextUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/TextUI.java @@ -42,7 +42,7 @@ public abstract class TextUI extends ComponentUI * Converts the given location in the model to a place in * the view coordinate system. * - * @param pos the local location in the model to translate >= 0 + * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle * @exception BadLocationException if the given position does not * represent a valid location in the associated document @@ -53,7 +53,7 @@ public abstract class TextUI extends ComponentUI * Converts the given location in the model to a place in * the view coordinate system. * - * @param pos the local location in the model to translate >= 0 + * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle * @exception BadLocationException if the given position does not * represent a valid location in the associated document @@ -67,7 +67,7 @@ public abstract class TextUI extends ComponentUI * @param pt the location in the view to translate. This * should be in the same coordinate system as the mouse * events. - * @return the offset from the start of the document >= 0 + * @return the offset from the start of the document >= 0 */ public abstract int viewToModel(JTextComponent t, Point pt); @@ -84,7 +84,7 @@ public abstract class TextUI extends ComponentUI * character in the model * * @return the location within the model that best represents the - * given point in the view >= 0 + * given point in the view >= 0 */ public abstract int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn); @@ -96,7 +96,7 @@ public abstract class TextUI extends ComponentUI * might not allow access to some of the locations in the model. * * @param t the text component for which this UI is installed - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param b the bias for the position * @param direction the direction from the current position that can * be thought of as the arrow keys typically found on a keyboard. @@ -117,8 +117,8 @@ public abstract class TextUI extends ComponentUI * Causes the portion of the view responsible for the * given part of the model to be repainted. * - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 */ public abstract void damageRange(JTextComponent t, int p0, int p1); @@ -126,8 +126,8 @@ public abstract class TextUI extends ComponentUI * Causes the portion of the view responsible for the * given part of the model to be repainted. * - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 */ public abstract void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 3cfedb8bd34..b00bcda30be 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1012,7 +1012,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * this translation to be computed. * * @param tc the text component for which this UI is installed - * @param pos the local location in the model to translate >= 0 + * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted * @exception BadLocationException if the given position does not * represent a valid location in the associated document @@ -1029,7 +1029,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * this translation to be computed. * * @param tc the text component for which this UI is installed - * @param pos the local location in the model to translate >= 0 + * @param pos the local location in the model to translate >= 0 * @return the coordinates as a rectangle, null if the model is not painted * @exception BadLocationException if the given position does not * represent a valid location in the associated document @@ -1066,7 +1066,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pt the location in the view to translate. This * should be in the same coordinate system as the mouse events. - * @return the offset from the start of the document >= 0, + * @return the offset from the start of the document >= 0, * -1 if not painted * @see TextUI#viewToModel */ @@ -1083,7 +1083,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * @param tc the text component for which this UI is installed * @param pt the location in the view to translate. This * should be in the same coordinate system as the mouse events. - * @return the offset from the start of the document >= 0, + * @return the offset from the start of the document >= 0, * -1 if the component doesn't yet have a positive size. * @see TextUI#viewToModel */ @@ -1141,8 +1141,8 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * the view is not currently painted. * * @param tc the text component for which this UI is installed - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 * @see TextUI#damageRange */ public void damageRange(JTextComponent tc, int p0, int p1) { @@ -1153,8 +1153,8 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * Causes the portion of the view responsible for the * given part of the model to be repainted. * - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 */ public void damageRange(JTextComponent t, int p0, int p1, Position.Bias p0Bias, Position.Bias p1Bias) { @@ -1271,8 +1271,8 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * it is unable to represent the part of the element. * * @param elem the element - * @param p0 the starting offset >= 0 - * @param p1 the ending offset >= p0 + * @param p0 the starting offset >= 0 + * @param p1 the ending offset >= p0 * @return the view */ public View create(Element elem, int p0, int p1) { @@ -1471,7 +1471,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * the model. This is implemented to return the index of the only * child. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position * @since 1.3 @@ -1515,11 +1515,11 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param p0 the position to convert >= 0 + * @param p0 the position to convert >= 0 * @param b0 the bias toward the previous character or the * next character represented by p0, in case the * position is a boundary of two views. - * @param p1 the position to convert >= 0 + * @param p1 the position to convert >= 0 * @param b1 the bias toward the previous character or the * next character represented by p1, in case the * position is a boundary of two views. @@ -1561,7 +1561,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * they might not be in the same order found in the model, or they just * might not allow access to some of the locations in the model. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @param direction the direction from the current position that can * be thought of as the arrow keys typically found on a keyboard. diff --git a/jdk/src/share/classes/javax/swing/text/AttributeSet.java b/jdk/src/share/classes/javax/swing/text/AttributeSet.java index 07ff04bdb39..659136d9648 100644 --- a/jdk/src/share/classes/javax/swing/text/AttributeSet.java +++ b/jdk/src/share/classes/javax/swing/text/AttributeSet.java @@ -71,7 +71,7 @@ public interface AttributeSet { * This interface is the type signature that is expected * to be present on any attribute key that contributes to * character level presentation. This would be any attribute - * that applies to a so-called run of + * that applies to a so-called run of * style. */ public interface CharacterAttribute { diff --git a/jdk/src/share/classes/javax/swing/text/BadLocationException.java b/jdk/src/share/classes/javax/swing/text/BadLocationException.java index 783996a1c7c..c900e61cf7e 100644 --- a/jdk/src/share/classes/javax/swing/text/BadLocationException.java +++ b/jdk/src/share/classes/javax/swing/text/BadLocationException.java @@ -46,7 +46,7 @@ public class BadLocationException extends Exception * Creates a new BadLocationException object. * * @param s a string indicating what was wrong with the arguments - * @param offs offset within the document that was requested >= 0 + * @param offs offset within the document that was requested >= 0 */ public BadLocationException(String s, int offs) { super(s); @@ -56,7 +56,7 @@ public class BadLocationException extends Exception /** * Returns the offset into the document that was not legal. * - * @return the offset >= 0 + * @return the offset >= 0 */ public int offsetRequested() { return offs; diff --git a/jdk/src/share/classes/javax/swing/text/BoxView.java b/jdk/src/share/classes/javax/swing/text/BoxView.java index 54b52f32be3..250bf43de33 100644 --- a/jdk/src/share/classes/javax/swing/text/BoxView.java +++ b/jdk/src/share/classes/javax/swing/text/BoxView.java @@ -154,7 +154,7 @@ public class BoxView extends CompositeView { * * @param g the graphics context * @param alloc the allocated region to paint into - * @param index the child index, >= 0 && < getViewCount() + * @param index the child index, >= 0 && < getViewCount() */ protected void paintChild(Graphics g, Rectangle alloc, int index) { View child = getView(index); @@ -170,9 +170,9 @@ public class BoxView extends CompositeView { * will have an offset and span of 0. * * @param index the starting index into the child views to insert - * the new views; this should be a value >= 0 and <= getViewCount + * the new views; this should be a value >= 0 and <= getViewCount * @param length the number of existing child views to remove; - * This should be a value >= 0 and <= (getViewCount() - offset) + * This should be a value >= 0 and <= (getViewCount() - offset) * @param elems the child views to add; this value can be * nullto indicate no children are being added * (useful to remove) @@ -390,8 +390,8 @@ public class BoxView extends CompositeView { * information. This is implemented to call the * layout method with the sizes inside of the insets. * - * @param width the width >= 0 - * @param height the height >= 0 + * @param width the width >= 0 + * @param height the height >= 0 */ public void setSize(float width, float height) { layout(Math.max(0, (int)(width - getLeftInset() - getRightInset())), @@ -442,7 +442,7 @@ public class BoxView extends CompositeView { * null if the layout is invalid, * otherwise the superclass behavior is executed. * - * @param index the index of the child, >= 0 && < getViewCount() + * @param index the index of the child, >= 0 && > getViewCount() * @param a the allocation to this view * @return the allocation to the child; or null * if a is null; @@ -469,7 +469,7 @@ public class BoxView extends CompositeView { * to the coordinate space of the view mapped to it. This makes * sure the allocation is valid before calling the superclass. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does @@ -488,11 +488,11 @@ public class BoxView extends CompositeView { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param x x coordinate of the view location to convert >= 0 - * @param y y coordinate of the view location to convert >= 0 + * @param x x coordinate of the view location to convert >= 0 + * @param y y coordinate of the view location to convert >= 0 * @param a the allocated region to render into * @return the location within the model that best represents the - * given point in the view >= 0 + * given point in the view >= 0 * @see View#viewToModel */ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { @@ -513,7 +513,7 @@ public class BoxView extends CompositeView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the desired alignment >= 0.0f && <= 1.0f; this should + * @return the desired alignment >= 0.0f && <= 1.0f; this should * be a value between 0.0 and 1.0 where 0 indicates alignment at the * origin and 1.0 indicates alignment to the full span * away from the origin; an alignment of 0.5 would be the @@ -535,7 +535,7 @@ public class BoxView extends CompositeView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view @@ -558,7 +558,7 @@ public class BoxView extends CompositeView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view @@ -581,7 +581,7 @@ public class BoxView extends CompositeView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view @@ -613,8 +613,8 @@ public class BoxView extends CompositeView { /** * Determines if a point falls before an allocated region. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param innerAlloc the allocated region; this is the area * inside of the insets * @return true if the point lies before the region else false @@ -630,8 +630,8 @@ public class BoxView extends CompositeView { /** * Determines if a point falls after an allocated region. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param innerAlloc the allocated region; this is the area * inside of the insets * @return true if the point lies after the region else false @@ -647,8 +647,8 @@ public class BoxView extends CompositeView { /** * Fetches the child view at the given coordinates. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the parents inner allocation on entry, which should * be changed to the childs allocation on exit * @return the view @@ -688,7 +688,7 @@ public class BoxView extends CompositeView { * Allocates a region for a child view. * * @param index the index of the child view to - * allocate, >= 0 && < getViewCount() + * allocate, >= 0 && < getViewCount() * @param alloc the allocated region */ protected void childAllocation(int index, Rectangle alloc) { @@ -701,8 +701,8 @@ public class BoxView extends CompositeView { /** * Perform layout on the box * - * @param width the width (inside of the insets) >= 0 - * @param height the height (inside of the insets) >= 0 + * @param width the width (inside of the insets) >= 0 + * @param height the height (inside of the insets) >= 0 */ protected void layout(int width, int height) { setSpanOnAxis(X_AXIS, width); diff --git a/jdk/src/share/classes/javax/swing/text/Caret.java b/jdk/src/share/classes/javax/swing/text/Caret.java index fc089b9bffb..7083a6a6cc0 100644 --- a/jdk/src/share/classes/javax/swing/text/Caret.java +++ b/jdk/src/share/classes/javax/swing/text/Caret.java @@ -149,7 +149,7 @@ public interface Caret { * and how fast the caret blinks, commonly used as one * way to attract attention to the caret. * - * @param rate the delay in milliseconds >= 0. If this is + * @param rate the delay in milliseconds >=0. If this is * zero the caret will not blink. */ public void setBlinkRate(int rate); @@ -159,7 +159,7 @@ public interface Caret { * and how fast the caret blinks, commonly used as one * way to attract attention to the caret. * - * @return the delay in milliseconds >= 0. If this is + * @return the delay in milliseconds >=0. If this is * zero the caret will not blink. */ public int getBlinkRate(); @@ -167,7 +167,7 @@ public interface Caret { /** * Fetches the current position of the caret. * - * @return the position >= 0 + * @return the position >=0 */ public int getDot(); @@ -176,7 +176,7 @@ public interface Caret { * is a selection, the mark will not be the same as * the dot. * - * @return the position >= 0 + * @return the position >=0 */ public int getMark(); @@ -197,7 +197,7 @@ public interface Caret { * leaving behind the mark. This is useful for * making selections. * - * @param dot the new position to move the caret to >= 0 + * @param dot the new position to move the caret to >=0 */ public void moveDot(int dot); diff --git a/jdk/src/share/classes/javax/swing/text/ComponentView.java b/jdk/src/share/classes/javax/swing/text/ComponentView.java index a6f546fb185..760856af012 100644 --- a/jdk/src/share/classes/javax/swing/text/ComponentView.java +++ b/jdk/src/share/classes/javax/swing/text/ComponentView.java @@ -125,7 +125,7 @@ public class ComponentView extends View { * axis of interest. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >=0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -153,7 +153,7 @@ public class ComponentView extends View { * axis of interest. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >=0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -181,7 +181,7 @@ public class ComponentView extends View { * axis of interest. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >=0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -319,7 +319,7 @@ public class ComponentView extends View { * Provides a mapping from the coordinate space of the model to * that of the view. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >=0 * @param a the allocated region to render into * @return the bounding box of the given position is returned * @exception BadLocationException if the given position does not @@ -344,8 +344,8 @@ public class ComponentView extends View { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >=0 + * @param y the Y coordinate >=0 * @param a the allocated region to render into * @return the location within the model that best represents * the given point in the view diff --git a/jdk/src/share/classes/javax/swing/text/CompositeView.java b/jdk/src/share/classes/javax/swing/text/CompositeView.java index dc8627b2086..0af70dd335a 100644 --- a/jdk/src/share/classes/javax/swing/text/CompositeView.java +++ b/jdk/src/share/classes/javax/swing/text/CompositeView.java @@ -143,7 +143,7 @@ public abstract class CompositeView extends View { /** * Returns the number of child views of this view. * - * @return the number of views >= 0 + * @return the number of views >= 0 * @see #getView */ public int getViewCount() { @@ -153,7 +153,7 @@ public abstract class CompositeView extends View { /** * Returns the n-th view in this container. * - * @param n the number of the desired view, >= 0 && < getViewCount() + * @param n the number of the desired view, >= 0 && < getViewCount() * @return the view at index n */ public View getView(int n) { @@ -169,9 +169,9 @@ public abstract class CompositeView extends View { * may be garbage collected. * * @param offset the starting index into the child views to insert - * the new views; >= 0 and <= getViewCount + * the new views; >= 0 and <= getViewCount * @param length the number of existing child views to remove; - * this should be a value >= 0 and <= (getViewCount() - offset) + * this should be a value >= 0 and <= (getViewCount() - offset) * @param views the child views to add; this value can be * null * to indicate no children are being added (useful to remove) @@ -223,7 +223,7 @@ public abstract class CompositeView extends View { * render into. This enables finding out where various views * are located. * - * @param index the index of the child, >= 0 && < getViewCount() + * @param index the index of the child, >= 0 && < getViewCount() * @param a the allocation to this view * @return the allocation to the child */ @@ -237,7 +237,7 @@ public abstract class CompositeView extends View { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward @@ -280,13 +280,13 @@ public abstract class CompositeView extends View { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param p0 the position to convert >= 0 + * @param p0 the position to convert >= 0 * @param b0 the bias toward the previous character or the * next character represented by p0, in case the * position is a boundary of two views; either * Position.Bias.Forward or * Position.Bias.Backward - * @param p1 the position to convert >= 0 + * @param p1 the position to convert >= 0 * @param b1 the bias toward the previous character or the * next character represented by p1, in case the * position is a boundary of two views @@ -378,13 +378,13 @@ public abstract class CompositeView extends View { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param x x coordinate of the view location to convert >= 0 - * @param y y coordinate of the view location to convert >= 0 + * @param x x coordinate of the view location to convert >= 0 + * @param y y coordinate of the view location to convert >= 0 * @param a the allocated region to render into * @param bias either Position.Bias.Forward or * Position.Bias.Backward * @return the location within the model that best represents the - * given point in the view >= 0 + * given point in the view >= 0 * @see View#viewToModel */ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { @@ -436,7 +436,7 @@ public abstract class CompositeView extends View { * This is a convenience method for {@link #getNextNorthSouthVisualPositionFrom} * and {@link #getNextEastWestVisualPositionFrom}. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward * @param a the allocated region to render into @@ -484,7 +484,7 @@ public abstract class CompositeView extends View { * getViewIndexByPosition * method for backward compatibility. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position * @since 1.3 @@ -505,8 +505,8 @@ public abstract class CompositeView extends View { /** * Tests whether a point lies before the rectangle range. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the rectangle * @return true if the point is before the specified range */ @@ -515,8 +515,8 @@ public abstract class CompositeView extends View { /** * Tests whether a point lies after the rectangle range. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the rectangle * @return true if the point is after the specified range */ @@ -525,8 +525,8 @@ public abstract class CompositeView extends View { /** * Fetches the child view at the given coordinates. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the parent's allocation on entry, which should * be changed to the child's allocation on exit * @return the child view @@ -536,7 +536,7 @@ public abstract class CompositeView extends View { /** * Returns the allocation for a given child. * - * @param index the index of the child, >= 0 && < getViewCount() + * @param index the index of the child, >= 0 && < getViewCount() * @param a the allocation to the interior of the box on entry, * and the allocation of the child view at the index on exit. */ @@ -547,7 +547,7 @@ public abstract class CompositeView extends View { * the model. This is implemented to fetch the view in the case * where there is a child view for each child element. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @param a the allocation to the interior of the box on entry, * and the allocation of the view containing the position on exit * @return the view representing the given position, or @@ -570,7 +570,7 @@ public abstract class CompositeView extends View { * the model. This is implemented to fetch the view in the case * where there is a child view for each child element. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position */ @@ -639,10 +639,10 @@ public abstract class CompositeView extends View { /** * Sets the insets for the view. * - * @param top the top inset >= 0 - * @param left the left inset >= 0 - * @param bottom the bottom inset >= 0 - * @param right the right inset >= 0 + * @param top the top inset >= 0 + * @param left the left inset >= 0 + * @param bottom the bottom inset >= 0 + * @param right the right inset >= 0 */ protected void setInsets(short top, short left, short bottom, short right) { this.top = top; @@ -654,7 +654,7 @@ public abstract class CompositeView extends View { /** * Gets the left inset. * - * @return the inset >= 0 + * @return the inset >= 0 */ protected short getLeftInset() { return left; @@ -663,7 +663,7 @@ public abstract class CompositeView extends View { /** * Gets the right inset. * - * @return the inset >= 0 + * @return the inset >= 0 */ protected short getRightInset() { return right; @@ -672,7 +672,7 @@ public abstract class CompositeView extends View { /** * Gets the top inset. * - * @return the inset >= 0 + * @return the inset >= 0 */ protected short getTopInset() { return top; @@ -681,7 +681,7 @@ public abstract class CompositeView extends View { /** * Gets the bottom inset. * - * @return the inset >= 0 + * @return the inset >= 0 */ protected short getBottomInset() { return bottom; @@ -691,7 +691,7 @@ public abstract class CompositeView extends View { * Returns the next visual position for the cursor, in either the * north or south direction. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward * @param a the allocated region to render into @@ -723,7 +723,7 @@ public abstract class CompositeView extends View { * Returns the next visual position for the cursor, in either the * east or west direction. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param b a bias value of either Position.Bias.Forward * or Position.Bias.Backward * @param a the allocated region to render into diff --git a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java index 775e7393cb6..cd310104dd3 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java @@ -140,7 +140,7 @@ public class DefaultEditorKit extends EditorKit { * @param in The stream to read from * @param doc The destination for the insertion. * @param pos The location in the document to place the - * content >= 0. + * content >=0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -158,8 +158,8 @@ public class DefaultEditorKit extends EditorKit { * @param out The stream to write to * @param doc The source for the write. * @param pos The location in the document to fetch the - * content >= 0. - * @param len The amount to write out >= 0. + * content >=0. + * @param len The amount to write out >=0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -191,7 +191,7 @@ public class DefaultEditorKit extends EditorKit { * @param in The stream to read from * @param doc The destination for the insertion. * @param pos The location in the document to place the - * content >= 0. + * content >=0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -300,8 +300,8 @@ public class DefaultEditorKit extends EditorKit { * @param out The stream to write to * @param doc The source for the write. * @param pos The location in the document to fetch the - * content from >= 0. - * @param len The amount to write out >= 0. + * content from >=0. + * @param len The amount to write out >=0. * @exception IOException on any I/O error * @exception BadLocationException if pos is not within 0 and * the length of the document. diff --git a/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java b/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java index fce9e8b4869..3614d2a60ed 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java @@ -105,8 +105,8 @@ public class DefaultHighlighter extends LayeredHighlighter { * Adds a highlight to the view. Returns a tag that can be used * to refer to the highlight. * - * @param p0 the start offset of the range to highlight >= 0 - * @param p1 the end offset of the range to highlight >= p0 + * @param p0 the start offset of the range to highlight >= 0 + * @param p1 the end offset of the range to highlight >= p0 * @param p the painter to use to actually render the highlight * @return an object that can be used as a tag * to refer to the highlight @@ -220,8 +220,8 @@ public class DefaultHighlighter extends LayeredHighlighter { * Changes a highlight. * * @param tag the highlight tag - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 * @exception BadLocationException if the specified location is invalid */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException { @@ -395,8 +395,8 @@ public class DefaultHighlighter extends LayeredHighlighter { * Paints 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 for the highlight * @param c the editor */ @@ -441,8 +441,8 @@ public class DefaultHighlighter extends LayeredHighlighter { * 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/text/DefaultStyledDocument.java b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java index 0ab766bd813..4a6419e77d6 100644 --- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java +++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java @@ -176,7 +176,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * Concurrency * in Swing for more information. * - * @param offset the starting offset >= 0 + * @param offset the starting offset >= 0 * @param data the element data * @exception BadLocationException for an invalid starting offset */ @@ -429,7 +429,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * Concurrency * in Swing for more information. * - * @param pos the offset from the start of the document >= 0 + * @param pos the offset from the start of the document >= 0 * @param s the logical style to assign to the paragraph, null if none */ public void setLogicalStyle(int pos, Style s) { @@ -458,7 +458,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * represented by the given position. * * @param p the location to translate to a paragraph - * and determine the logical style assigned >= 0. This + * and determine the logical style assigned >= 0. This * is an offset from the start of the document. * @return the style, null if none */ @@ -486,8 +486,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * Concurrency * in Swing for more information. * - * @param offset the offset in the document >= 0 - * @param length the length >= 0 + * @param offset the offset in the document >= 0 + * @param length the length >= 0 * @param s the attributes * @param replace true if the previous attributes should be replaced * before setting the new attributes @@ -539,8 +539,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * Concurrency * in Swing for more information. * - * @param offset the offset into the paragraph >= 0 - * @param length the number of characters affected >= 0 + * @param offset the offset into the paragraph >= 0 + * @param length the number of characters affected >= 0 * @param s the attributes * @param replace whether to replace existing attributes, or merge them */ @@ -589,7 +589,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * A paragraph consists of at least one child Element, which is usually * a leaf. * - * @param pos the starting offset >= 0 + * @param pos the starting offset >= 0 * @return the element */ public Element getParagraphElement(int pos) { @@ -606,7 +606,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Gets a character element based on a position. * - * @param pos the position in the document >= 0 + * @param pos the position in the document >= 0 * @return the element */ public Element getCharacterElement(int pos) { @@ -1233,7 +1233,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * @param a the attributes for the element * @param type the type of the element (StartTagType, EndTagType, * ContentType) - * @param len the length >= 0 + * @param len the length >= 0 */ public ElementSpec(AttributeSet a, short type, int len) { this(a, type, null, 0, len); @@ -1247,8 +1247,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc * @param type the type of the element (StartTagType, EndTagType, * ContentType) * @param txt the text for the element - * @param offs the offset into the text >= 0 - * @param len the length of the text >= 0 + * @param offs the offset into the text >= 0 + * @param len the length of the text >= 0 */ public ElementSpec(AttributeSet a, short type, char[] txt, int offs, int len) { @@ -1321,7 +1321,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Gets the starting offset. * - * @return the offset >= 0 + * @return the offset >= 0 */ public int getOffset() { return offs; @@ -1330,7 +1330,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Gets the length. * - * @return the length >= 0 + * @return the length >= 0 */ public int getLength() { return len; @@ -1420,8 +1420,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Inserts new content. * - * @param offset the starting offset >= 0 - * @param length the length >= 0 + * @param offset the starting offset >= 0 + * @param length the length >= 0 * @param data the data to insert * @param de the event capturing this edit */ @@ -1500,8 +1500,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Removes content. * - * @param offset the starting offset >= 0 - * @param length the length >= 0 + * @param offset the starting offset >= 0 + * @param length the length >= 0 * @param de the event capturing this edit */ public void remove(int offset, int length, DefaultDocumentEvent de) { @@ -1513,8 +1513,8 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc /** * Changes content. * - * @param offset the starting offset >= 0 - * @param length the length >= 0 + * @param offset the starting offset >= 0 + * @param length the length >= 0 * @param de the event capturing this edit */ public void change(int offset, int length, DefaultDocumentEvent de) { diff --git a/jdk/src/share/classes/javax/swing/text/Document.java b/jdk/src/share/classes/javax/swing/text/Document.java index daacd05b9db..51505707db3 100644 --- a/jdk/src/share/classes/javax/swing/text/Document.java +++ b/jdk/src/share/classes/javax/swing/text/Document.java @@ -58,9 +58,9 @@ import javax.swing.event.*; *

    The following methods give access to the character data * that makes up the content. *

    *

    Structure *

    @@ -79,8 +79,8 @@ import javax.swing.event.*; * AttributeSet interface. *

    The following methods give access to the document structure. *

    * *

    Mutations @@ -93,9 +93,9 @@ import javax.swing.event.*; *

    The following methods are related to mutation of the * document content: *

    * *

    Notification @@ -161,8 +161,8 @@ import javax.swing.event.*; * and the TitleProperty, which can be used to * name the Document. The methods related to the properties are: *

    * *

    For more information on the Document class, see diff --git a/jdk/src/share/classes/javax/swing/text/DocumentFilter.java b/jdk/src/share/classes/javax/swing/text/DocumentFilter.java index 0f6ac84f02f..797cd81a605 100644 --- a/jdk/src/share/classes/javax/swing/text/DocumentFilter.java +++ b/jdk/src/share/classes/javax/swing/text/DocumentFilter.java @@ -68,8 +68,8 @@ public class DocumentFilter { * necessary. * * @param fb FilterBypass that can be used to mutate Document - * @param offset the offset from the beginning >= 0 - * @param length the number of characters to remove >= 0 + * @param offset the offset from the beginning >= 0 + * @param length the number of characters to remove >= 0 * @exception BadLocationException some portion of the removal range * was not a valid part of the document. The location in the exception * is the first bad position encountered. @@ -86,7 +86,7 @@ public class DocumentFilter { * necessary, or call directly into the FilterBypass. * * @param fb FilterBypass that can be used to mutate Document - * @param offset the offset into the document to insert the content >= 0. + * @param offset the offset into the document to insert the content >= 0. * All positions that track change at or after the given location * will move. * @param string the string to insert @@ -141,8 +141,8 @@ public class DocumentFilter { * Removes the specified region of text, bypassing the * DocumentFilter. * - * @param offset the offset from the beginning >= 0 - * @param length the number of characters to remove >= 0 + * @param offset the offset from the beginning >= 0 + * @param length the number of characters to remove >= 0 * @exception BadLocationException some portion of the removal range * was not a valid part of the document. The location in the * exception is the first bad position encountered. @@ -154,7 +154,7 @@ public class DocumentFilter { * Inserts the specified text, bypassing the * DocumentFilter. * @param offset the offset into the document to insert the - * content >= 0. All positions that track change at or after the + * content >= 0. All positions that track change at or after the * given location will move. * @param string the string to insert * @param attr the attributes to associate with the inserted diff --git a/jdk/src/share/classes/javax/swing/text/EditorKit.java b/jdk/src/share/classes/javax/swing/text/EditorKit.java index 8251ae63e7f..c3d2722b098 100644 --- a/jdk/src/share/classes/javax/swing/text/EditorKit.java +++ b/jdk/src/share/classes/javax/swing/text/EditorKit.java @@ -55,7 +55,7 @@ public abstract class EditorKit implements Cloneable, Serializable { /** * Creates a copy of the editor kit. This is implemented - * to use Object.clone. If the kit cannot be cloned, + * to use Object.clone(). If the kit cannot be cloned, * null is returned. * * @return the copy @@ -139,7 +139,7 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param in The stream to read from * @param doc The destination for the insertion. * @param pos The location in the document to place the - * content >= 0. + * content >= 0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -154,8 +154,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param out The stream to write to * @param doc The source for the write. * @param pos The location in the document to fetch the - * content from >= 0. - * @param len The amount to write out >= 0. + * content from >= 0. + * @param len The amount to write out >= 0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -176,7 +176,7 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param in The stream to read from * @param doc The destination for the insertion. * @param pos The location in the document to place the - * content >= 0. + * content >= 0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. @@ -196,8 +196,8 @@ public abstract class EditorKit implements Cloneable, Serializable { * @param out The stream to write to * @param doc The source for the write. * @param pos The location in the document to fetch the - * content >= 0. - * @param len The amount to write out >= 0. + * content >= 0. + * @param len The amount to write out >= 0. * @exception IOException on any I/O error * @exception BadLocationException if pos represents an invalid * location within the document. diff --git a/jdk/src/share/classes/javax/swing/text/FieldView.java b/jdk/src/share/classes/javax/swing/text/FieldView.java index 93f27f92a44..867ef44cc55 100644 --- a/jdk/src/share/classes/javax/swing/text/FieldView.java +++ b/jdk/src/share/classes/javax/swing/text/FieldView.java @@ -200,7 +200,7 @@ public class FieldView extends PlainView { * axis. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >= 0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -241,7 +241,7 @@ public class FieldView extends PlainView { * given axis. A value of 0 or less is not resizable. * * @param axis View.X_AXIS or View.Y_AXIS - * @return the weight -> 1 for View.X_AXIS, else 0 + * @return the weight -> 1 for View.X_AXIS, else 0 */ public int getResizeWeight(int axis) { if (axis == View.X_AXIS) { @@ -254,7 +254,7 @@ public class FieldView extends PlainView { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does not @@ -269,8 +269,8 @@ public class FieldView extends PlainView { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param fx the X coordinate >= 0.0f - * @param fy the Y coordinate >= 0.0f + * @param fx the X coordinate >= 0.0f + * @param fy the Y coordinate >= 0.0f * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view diff --git a/jdk/src/share/classes/javax/swing/text/FlowView.java b/jdk/src/share/classes/javax/swing/text/FlowView.java index 8cd647ce961..972d10e3b22 100644 --- a/jdk/src/share/classes/javax/swing/text/FlowView.java +++ b/jdk/src/share/classes/javax/swing/text/FlowView.java @@ -88,7 +88,7 @@ public abstract class FlowView extends BoxView { * is returned. * * @param index the index of the row being updated. - * This should be a value >= 0 and < getViewCount(). + * This should be a value >= 0 and < getViewCount(). * @see #getFlowStart */ public int getFlowSpan(int index) { @@ -103,7 +103,7 @@ public abstract class FlowView extends BoxView { * for the row constraints. * @param index the index of the row being updated. - * This should be a value >= 0 and < getViewCount(). + * This should be a value >= 0 and < getViewCount(). * @see #getFlowSpan */ public int getFlowStart(int index) { @@ -147,7 +147,7 @@ public abstract class FlowView extends BoxView { * Fetches the child view index representing the given position in * the model. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position */ @@ -175,9 +175,9 @@ public abstract class FlowView extends BoxView { * a preferenceChanged is called. Following all of that, * the normal box layout of the superclass is performed. * - * @param width the width to lay out against >= 0. This is + * @param width the width to lay out against >= 0. This is * the width inside of the inset area. - * @param height the height to lay out against >= 0 This + * @param height the height to lay out against >= 0 This * is the height inside of the inset area. */ protected void layout(int width, int height) { @@ -580,7 +580,7 @@ public abstract class FlowView extends BoxView { * * @param rowIndex the row to adjust to the current layout * span. - * @param desiredSpan the current layout span >= 0 + * @param desiredSpan the current layout span >= 0 * @param x the location r starts at. */ protected void adjustRow(FlowView fv, int rowIndex, int desiredSpan, int x) { @@ -832,8 +832,8 @@ public abstract class FlowView extends BoxView { * Implemented to return false, as hit detection is not * performed on the logical view. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the rectangle * @return true if the point is before the specified range */ @@ -846,8 +846,8 @@ public abstract class FlowView extends BoxView { * Implemented to return false, as hit detection is not * performed on the logical view. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the rectangle * @return true if the point is after the specified range */ @@ -860,8 +860,8 @@ public abstract class FlowView extends BoxView { * Implemented to return null, as hit detection is not * performed on the logical view. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param alloc the parent's allocation on entry, which should * be changed to the child's allocation on exit * @return the child view @@ -875,7 +875,7 @@ public abstract class FlowView extends BoxView { * Implemented to do nothing, as the logical view doesn't * perform layout on the children. * - * @param index the index of the child, >= 0 && < getViewCount() + * @param index the index of the child, >= 0 && < getViewCount() * @param a the allocation to the interior of the box on entry, * and the allocation of the child view at the index on exit. */ diff --git a/jdk/src/share/classes/javax/swing/text/GapContent.java b/jdk/src/share/classes/javax/swing/text/GapContent.java index fecf9c6dc72..160ea1bdecd 100644 --- a/jdk/src/share/classes/javax/swing/text/GapContent.java +++ b/jdk/src/share/classes/javax/swing/text/GapContent.java @@ -107,7 +107,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S /** * Returns the length of the content. * - * @return the length >= 1 + * @return the length >= 1 * @see AbstractDocument.Content#length */ public int length() { @@ -118,7 +118,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S /** * Inserts a string into the content. * - * @param where the starting position >= 0, < length() + * @param where the starting position >= 0, < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing * @exception BadLocationException if the specified position is invalid @@ -136,8 +136,8 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S /** * Removes part of the content. * - * @param where the starting position >= 0, where + nitems < length() - * @param nitems the number of characters to remove >= 0 + * @param where the starting position >= 0, where + nitems < length() + * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove @@ -156,8 +156,8 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S /** * Retrieves a portion of the content. * - * @param where the starting position >= 0 - * @param len the length to retrieve >= 0 + * @param where the starting position >= 0 + * @param len the length to retrieve >= 0 * @return a string representing the content * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString @@ -174,8 +174,8 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * span the gap, the actual store is returned to avoid the copy since * it is contiguous. * - * @param where the starting position >= 0, where + len <= length() - * @param len the number of characters to retrieve >= 0 + * @param where the starting position >= 0, where + len <= length() + * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars @@ -222,7 +222,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * Creates a position within the content that will * track change as the content is mutated. * - * @param offset the offset to track >= 0 + * @param offset the offset to track >= 0 * @return the position * @exception BadLocationException if the specified position is invalid */ @@ -705,8 +705,8 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S * there. The vector with the resulting Positions are returned. * * @param v the Vector to use, with a new one created on null - * @param offset the starting offset >= 0 - * @param length the length >= 0 + * @param offset the starting offset >= 0 + * @param length the length >= 0 * @return the set of instances */ protected Vector getPositionsInRange(Vector v, int offset, int length) { diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java index a0ca975c2c3..0c801cfc04a 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java @@ -121,8 +121,8 @@ public class GlyphView extends View implements TabableView, Cloneable { * the GlyphPainter to determine what characters * it should render glyphs for. * - * @param p0 the starting document offset >= 0 - * @param p1 the ending document offset >= p0 + * @param p0 the starting document offset >= 0 + * @param p1 the ending document offset >= p0 * @return the Segment containing the text */ public Segment getText(int p0, int p1) { @@ -282,9 +282,9 @@ public class GlyphView extends View implements TabableView, Cloneable { * tab expansion implementation. * * @param x the position the view would be located - * at for the purpose of tab expansion >= 0. + * at for the purpose of tab expansion >= 0. * @param e how to expand the tabs when encountered. - * @return the desired span >= 0 + * @return the desired span >= 0 * @see TabableView#getTabbedSpan */ public float getTabbedSpan(float x, TabExpander e) { @@ -321,9 +321,9 @@ public class GlyphView extends View implements TabableView, Cloneable { * arrange for its own text buffer to make the * measurements. * - * @param p0 the starting document offset >= 0 - * @param p1 the ending document offset >= p0 - * @return the span >= 0 + * @param p0 the starting document offset >= 0 + * @param p1 the ending document offset >= p0 + * @return the span >= 0 */ public float getPartialSpan(int p0, int p1) { checkPainter(); @@ -572,7 +572,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * axis. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >= 0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -639,7 +639,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @param b either Position.Bias.Forward * or Position.Bias.Backward @@ -657,14 +657,14 @@ public class GlyphView extends View implements TabableView, Cloneable { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param a the allocated region to render into * @param biasReturn either Position.Bias.Forward * or Position.Bias.Backward is returned as the * zero-th element of this array * @return the location within the model that best represents the - * given point of view >= 0 + * given point of view >= 0 * @see View#viewToModel */ public int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn) { @@ -702,10 +702,10 @@ public class GlyphView extends View implements TabableView, Cloneable { * * @param axis may be either View.X_AXIS or View.Y_AXIS * @param pos the potential location of the start of the - * broken view >= 0. This may be useful for calculating tab + * broken view >= 0. This may be useful for calculating tab * positions. * @param len specifies the relative length from pos - * where a potential break is desired >= 0. + * where a potential break is desired >= 0. * @return the weight, which should be a value between * View.ForcedBreakWeight and View.BadBreakWeight. * @see LabelView @@ -736,12 +736,12 @@ public class GlyphView extends View implements TabableView, Cloneable { * * @param axis may be either View.X_AXIS or View.Y_AXIS * @param p0 the location in the model where the - * fragment should start it's representation >= 0. + * fragment should start it's representation >= 0. * @param pos the position along the axis that the - * broken view would occupy >= 0. This may be useful for + * broken view would occupy >= 0. This may be useful for * things like tab calculations. * @param len specifies the distance along the axis - * where a potential break is desired >= 0. + * where a potential break is desired >= 0. * @return the fragment of the view that represents the * given span, if the view can be broken. If the view * doesn't support breaking behavior, the view itself is @@ -852,10 +852,10 @@ public class GlyphView extends View implements TabableView, Cloneable { * to return a nested class that shares state in this view * representing only a portion of the view. * - * @param p0 the starting offset >= 0. This should be a value + * @param p0 the starting offset >= 0. This should be a value * greater or equal to the element starting offset and * less than the element ending offset. - * @param p1 the ending offset > p0. This should be a value + * @param p1 the ending offset > p0. This should be a value * less than or equal to the elements end offset and * greater than the elements starting offset. * @return the view fragment, or itself if the view doesn't @@ -880,7 +880,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * they just might not allow access to some of the locations in the * model. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @param direction the direction from the current position that can * be thought of as the arrow keys typically found on a keyboard. @@ -1196,12 +1196,12 @@ public class GlyphView extends View implements TabableView, Cloneable { * * @param v the view to find the model location to break at. * @param p0 the location in the model where the - * fragment should start it's representation >= 0. + * fragment should start it's representation >= 0. * @param x the graphic location along the axis that the - * broken view would occupy >= 0. This may be useful for + * broken view would occupy >= 0. This may be useful for * things like tab calculations. * @param len specifies the distance into the view - * where a potential break is desired >= 0. + * where a potential break is desired >= 0. * @return the maximum model location possible for a break. * @see View#breakView */ @@ -1214,8 +1214,8 @@ public class GlyphView extends View implements TabableView, Cloneable { * the painter doesn't hold any significant state, it can * return itself. The default behavior is to return itself. * @param v the GlyphView to provide a painter for - * @param p0 the starting document offset >= 0 - * @param p1 the ending document offset >= p0 + * @param p0 the starting document offset >= 0 + * @param p1 the ending document offset >= p0 */ public GlyphPainter getPainter(GlyphView v, int p0, int p1) { return this; @@ -1229,7 +1229,7 @@ public class GlyphView extends View implements TabableView, Cloneable { * model. * * @param v the view to use - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param b either Position.Bias.Forward * or Position.Bias.Backward * @param a the allocated region to render into diff --git a/jdk/src/share/classes/javax/swing/text/Highlighter.java b/jdk/src/share/classes/javax/swing/text/Highlighter.java index 0f8484ecd3c..f30f66abbc8 100644 --- a/jdk/src/share/classes/javax/swing/text/Highlighter.java +++ b/jdk/src/share/classes/javax/swing/text/Highlighter.java @@ -66,8 +66,8 @@ public interface Highlighter { * Adds a highlight to the view. Returns a tag that can be used * to refer to the highlight. * - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 * @param p the painter to use for the actual highlighting * @return an object that refers to the highlight * @exception BadLocationException for an invalid range specification @@ -93,8 +93,8 @@ public interface Highlighter { * with a mouse) by damaging only what changed. * * @param tag which highlight to change - * @param p0 the beginning of the range >= 0 - * @param p1 the end of the range >= p0 + * @param p0 the beginning of the range >= 0 + * @param p1 the end of the range >= p0 * @exception BadLocationException for an invalid range specification */ public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException; @@ -115,8 +115,8 @@ public interface Highlighter { * Renders the highlight. * * @param g the graphics context - * @param p0 the starting offset in the model >= 0 - * @param p1 the ending offset in the model >= p0 + * @param p0 the starting offset in the model >= 0 + * @param p1 the ending offset in the model >= p0 * @param bounds the bounding box for the highlight * @param c the editor */ @@ -129,14 +129,14 @@ public interface Highlighter { /** * Gets the starting model offset for the highlight. * - * @return the starting offset >= 0 + * @return the starting offset >= 0 */ public int getStartOffset(); /** * Gets the ending model offset for the highlight. * - * @return the ending offset >= 0 + * @return the ending offset >= 0 */ public int getEndOffset(); diff --git a/jdk/src/share/classes/javax/swing/text/IconView.java b/jdk/src/share/classes/javax/swing/text/IconView.java index 1d4f543d740..ef1a41e4698 100644 --- a/jdk/src/share/classes/javax/swing/text/IconView.java +++ b/jdk/src/share/classes/javax/swing/text/IconView.java @@ -101,7 +101,7 @@ public class IconView extends View { * along the x axis. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the desired alignment >= 0.0f && <= 1.0f. This should be + * @return the desired alignment >= 0.0f && <= 1.0f. This should be * a value between 0.0 and 1.0 where 0 indicates alignment at the * origin and 1.0 indicates alignment to the full span * away from the origin. An alignment of 0.5 would be the @@ -120,7 +120,7 @@ public class IconView extends View { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does not @@ -145,11 +145,11 @@ public class IconView extends View { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param x the X coordinate >= 0 - * @param y the Y coordinate >= 0 + * @param x the X coordinate >= 0 + * @param y the Y coordinate >= 0 * @param a the allocated region to render into * @return the location within the model that best represents the - * given point of view >= 0 + * given point of view >= 0 * @see View#viewToModel */ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { diff --git a/jdk/src/share/classes/javax/swing/text/NavigationFilter.java b/jdk/src/share/classes/javax/swing/text/NavigationFilter.java index 96206b82cab..d5ca6575d58 100644 --- a/jdk/src/share/classes/javax/swing/text/NavigationFilter.java +++ b/jdk/src/share/classes/javax/swing/text/NavigationFilter.java @@ -57,7 +57,7 @@ public class NavigationFilter { * on the FilterBypass * * @param fb FilterBypass that can be used to mutate caret position - * @param dot the position >= 0 + * @param dot the position >= 0 * @param bias Bias to place the dot at */ public void setDot(FilterBypass fb, int dot, Position.Bias bias) { @@ -72,7 +72,7 @@ public class NavigationFilter { * methods on the FilterBypass. * * @param fb FilterBypass that can be used to mutate caret position - * @param dot the position >= 0 + * @param dot the position >= 0 * @param bias Bias for new location */ public void moveDot(FilterBypass fb, int dot, Position.Bias bias) { @@ -131,7 +131,7 @@ public class NavigationFilter { /** * Sets the caret location, bypassing the NavigationFilter. * - * @param dot the position >= 0 + * @param dot the position >= 0 * @param bias Bias to place the dot at */ public abstract void setDot(int dot, Position.Bias bias); @@ -139,7 +139,7 @@ public class NavigationFilter { /** * Moves the caret location, bypassing the NavigationFilter. * - * @param dot the position >= 0 + * @param dot the position >= 0 * @param bias Bias for new location */ public abstract void moveDot(int dot, Position.Bias bias); diff --git a/jdk/src/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/ParagraphView.java index 396e153e520..85d70d5f9c9 100644 --- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java +++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java @@ -409,8 +409,8 @@ public class ParagraphView extends FlowView implements TabExpander { * * @param x the X reference position * @param tabOffset the position within the text stream - * that the tab occurred at >= 0 - * @return the trailing end of the tab expansion >= 0 + * that the tab occurred at >= 0 + * @return the trailing end of the tab expansion >= 0 * @see TabSet * @see TabStop * @see LabelView @@ -489,9 +489,9 @@ public class ParagraphView extends FlowView implements TabExpander { * the TabableView interface, * the preferredSpan will be used. * - * @param startOffset the starting document offset >= 0 - * @param endOffset the ending document offset >= startOffset - * @return the size >= 0 + * @param startOffset the starting document offset >= 0 + * @param endOffset the ending document offset >= startOffset + * @return the size >= 0 */ protected float getPartialSize(int startOffset, int endOffset) { float size = 0.0f; @@ -529,7 +529,7 @@ public class ParagraphView extends FlowView implements TabExpander { * there are no characters found, -1 will be returned. * * @param string the string of characters - * @param start where to start in the model >= 0 + * @param start where to start in the model >= 0 * @return the document offset, or -1 if no characters found */ protected int findOffsetToCharactersInString(char[] string, @@ -642,7 +642,7 @@ public class ParagraphView extends FlowView implements TabExpander { * @param axis may be either View.X_AXIS * or View.Y_AXIS * @param len specifies where a potential break is desired - * along the given axis >= 0 + * along the given axis >= 0 * @param a the current allocation of the view * @return the fragment of the view that represents the * given span, if the view can be broken; if the view @@ -675,7 +675,7 @@ public class ParagraphView extends FlowView implements TabExpander { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @param len specifies where a potential break is desired >= 0 + * @param len specifies where a potential break is desired >= 0 * @return a value indicating the attractiveness of breaking here; * either GoodBreakWeight or BadBreakWeight * @see View#getBreakWeight @@ -1141,7 +1141,7 @@ public class ParagraphView extends FlowView implements TabExpander { * Fetches the child view index representing the given position in * the model. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position */ diff --git a/jdk/src/share/classes/javax/swing/text/PasswordView.java b/jdk/src/share/classes/javax/swing/text/PasswordView.java index 5073218dafb..c9b9659a45b 100644 --- a/jdk/src/share/classes/javax/swing/text/PasswordView.java +++ b/jdk/src/share/classes/javax/swing/text/PasswordView.java @@ -55,11 +55,11 @@ public class PasswordView extends FieldView { * using the value returned by getEchoChar(). * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the starting offset in the model >= 0 - * @param p1 the ending offset in the model >= p0 - * @return the X location of the end of the range >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the starting offset in the model >= 0 + * @param p1 the ending offset in the model >= p0 + * @return the X location of the end of the range >= 0 * @exception BadLocationException if p0 or p1 are out of range */ protected int drawUnselectedText(Graphics g, int x, int y, @@ -94,11 +94,11 @@ public class PasswordView extends FieldView { * display the characters. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the starting offset in the model >= 0 - * @param p1 the ending offset in the model >= p0 - * @return the X location of the end of the range >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the starting offset in the model >= 0 + * @param p1 the ending offset in the model >= p0 + * @return the X location of the end of the range >= 0 * @exception BadLocationException if p0 or p1 are out of range */ protected int drawSelectedText(Graphics g, int x, @@ -126,10 +126,10 @@ public class PasswordView extends FieldView { * or unselected text. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 * @param c the echo character - * @return the updated X position >= 0 + * @return the updated X position >= 0 */ protected int drawEchoCharacter(Graphics g, int x, int y, char c) { ONE[0] = c; @@ -142,7 +142,7 @@ public class PasswordView extends FieldView { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does not @@ -172,8 +172,8 @@ public class PasswordView extends FieldView { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param fx the X coordinate >= 0.0f - * @param fy the Y coordinate >= 0.0f + * @param fx the X coordinate >= 0.0f + * @param fy the Y coordinate >= 0.0f * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view @@ -210,7 +210,7 @@ public class PasswordView extends FieldView { * axis. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >= 0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. diff --git a/jdk/src/share/classes/javax/swing/text/PlainDocument.java b/jdk/src/share/classes/javax/swing/text/PlainDocument.java index 05fd22110fa..8424faf092c 100644 --- a/jdk/src/share/classes/javax/swing/text/PlainDocument.java +++ b/jdk/src/share/classes/javax/swing/text/PlainDocument.java @@ -103,7 +103,7 @@ public class PlainDocument extends AbstractDocument { * Concurrency * in Swing for more information. * - * @param offs the starting offset >= 0 + * @param offs the starting offset >= 0 * @param str the string to insert; does nothing with null/empty strings * @param a the attributes for the inserted content * @exception BadLocationException the given insert position is not a valid diff --git a/jdk/src/share/classes/javax/swing/text/PlainView.java b/jdk/src/share/classes/javax/swing/text/PlainView.java index 7a071777010..ec5d6b68366 100644 --- a/jdk/src/share/classes/javax/swing/text/PlainView.java +++ b/jdk/src/share/classes/javax/swing/text/PlainView.java @@ -66,10 +66,10 @@ public class PlainView extends View implements TabExpander { * drawSelectedText so that the way selected and * unselected text are rendered can be customized. * - * @param lineIndex the line to draw >= 0 + * @param lineIndex the line to draw >= 0 * @param g the Graphics context - * @param x the starting X position >= 0 - * @param y the starting Y position >= 0 + * @param x the starting X position >= 0 + * @param y the starting Y position >= 0 * @see #drawUnselectedText * @see #drawSelectedText */ @@ -138,11 +138,11 @@ public class PlainView extends View implements TabExpander { * text. Uses the foreground or disabled color to render the text. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the beginning position in the model >= 0 - * @param p1 the ending position in the model >= 0 - * @return the X location of the end of the range >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the beginning position in the model >= 0 + * @param p1 the ending position in the model >= 0 + * @return the X location of the end of the range >= 0 * @exception BadLocationException if the range is invalid */ protected int drawUnselectedText(Graphics g, int x, int y, @@ -163,10 +163,10 @@ public class PlainView extends View implements TabExpander { * the selected background. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the beginning position in the model >= 0 - * @param p1 the ending position in the model >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the beginning position in the model >= 0 + * @param p1 the ending position in the model >= 0 * @return the location of the end of the range * @exception BadLocationException if the range is invalid */ @@ -218,7 +218,7 @@ public class PlainView extends View implements TabExpander { * axis. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >= 0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. @@ -332,7 +332,7 @@ public class PlainView extends View implements TabExpander { * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. * - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does not @@ -369,11 +369,11 @@ public class PlainView extends View implements TabExpander { * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * - * @param fx the X coordinate >= 0 - * @param fy the Y coordinate >= 0 + * @param fx the X coordinate >= 0 + * @param fy the Y coordinate >= 0 * @param a the allocated region to render into * @return the location within the model that best represents the - * given point in the view >= 0 + * given point in the view >= 0 * @see View#viewToModel */ public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) { @@ -482,8 +482,8 @@ public class PlainView extends View implements TabExpander { * layout of the view along the given axis, if it * has any layout duties. * - * @param width the width >= 0 - * @param height the height >= 0 + * @param width the width >= 0 + * @param height the height >= 0 */ public void setSize(float width, float height) { super.setSize(width, height); @@ -497,10 +497,10 @@ public class PlainView extends View implements TabExpander { * This implementation does not support things like centering so it * ignores the tabOffset argument. * - * @param x the current position >= 0 + * @param x the current position >= 0 * @param tabOffset the position within the text stream - * that the tab occurred at >= 0. - * @return the tab stop, measured in points >= 0 + * that the tab occurred at >= 0. + * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { if (tabSize == 0) { diff --git a/jdk/src/share/classes/javax/swing/text/Position.java b/jdk/src/share/classes/javax/swing/text/Position.java index 92c500f6ce6..7ad9d8bc52a 100644 --- a/jdk/src/share/classes/javax/swing/text/Position.java +++ b/jdk/src/share/classes/javax/swing/text/Position.java @@ -51,7 +51,7 @@ public interface Position { /** * Fetches the current offset within the document. * - * @return the offset >= 0 + * @return the offset >= 0 */ public int getOffset(); diff --git a/jdk/src/share/classes/javax/swing/text/StringContent.java b/jdk/src/share/classes/javax/swing/text/StringContent.java index 7fe6906a4d8..c834894845c 100644 --- a/jdk/src/share/classes/javax/swing/text/StringContent.java +++ b/jdk/src/share/classes/javax/swing/text/StringContent.java @@ -61,7 +61,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab /** * Creates a new StringContent object, with the initial - * size specified. If the length is < 1, a size of 1 is used. + * size specified. If the length is < 1, a size of 1 is used. * * @param initialLength the initial size */ @@ -77,7 +77,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab /** * Returns the length of the content. * - * @return the length >= 1 + * @return the length >= 1 * @see AbstractDocument.Content#length */ public int length() { @@ -87,7 +87,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab /** * Inserts a string into the content. * - * @param where the starting position >= 0 && < length() + * @param where the starting position >= 0 && < length() * @param str the non-null string to insert * @return an UndoableEdit object for undoing * @exception BadLocationException if the specified position is invalid @@ -106,10 +106,10 @@ public final class StringContent implements AbstractDocument.Content, Serializab } /** - * Removes part of the content. where + nitems must be < length(). + * Removes part of the content. where + nitems must be < length(). * - * @param where the starting position >= 0 - * @param nitems the number of characters to remove >= 0 + * @param where the starting position >= 0 + * @param nitems the number of characters to remove >= 0 * @return an UndoableEdit object for undoing * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#remove @@ -129,10 +129,10 @@ public final class StringContent implements AbstractDocument.Content, Serializab } /** - * Retrieves a portion of the content. where + len must be <= length(). + * Retrieves a portion of the content. where + len must be <= length(). * - * @param where the starting position >= 0 - * @param len the length to retrieve >= 0 + * @param where the starting position >= 0 + * @param len the length to retrieve >= 0 * @return a string representing the content; may be empty * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getString @@ -145,10 +145,10 @@ public final class StringContent implements AbstractDocument.Content, Serializab } /** - * Retrieves a portion of the content. where + len must be <= length() + * Retrieves a portion of the content. where + len must be <= length() * - * @param where the starting position >= 0 - * @param len the number of characters to retrieve >= 0 + * @param where the starting position >= 0 + * @param len the number of characters to retrieve >= 0 * @param chars the Segment object to return the characters in * @exception BadLocationException if the specified position is invalid * @see AbstractDocument.Content#getChars @@ -166,7 +166,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab * Creates a position within the content that will * track change as the content is mutated. * - * @param offset the offset to create a position for >= 0 + * @param offset the offset to create a position for >= 0 * @return the position * @exception BadLocationException if the specified position is invalid */ @@ -266,8 +266,8 @@ public final class StringContent implements AbstractDocument.Content, Serializab * to subclasses. * * @param v the Vector to use, with a new one created on null - * @param offset the starting offset >= 0 - * @param length the length >= 0 + * @param offset the starting offset >= 0 + * @param length the length >= 0 * @return the set of instances */ protected Vector getPositionsInRange(Vector v, int offset, diff --git a/jdk/src/share/classes/javax/swing/text/StyleContext.java b/jdk/src/share/classes/javax/swing/text/StyleContext.java index ca0eeea66d7..ac11b1f82f4 100644 --- a/jdk/src/share/classes/javax/swing/text/StyleContext.java +++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java @@ -241,7 +241,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon * * @param family the font family (such as "Monospaced") * @param style the style of the font (such as Font.PLAIN) - * @param size the point size >= 1 + * @param size the point size >= 1 * @return the new font */ public Font getFont(String family, int style, int size) { @@ -1387,7 +1387,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon /** * Gets the number of attributes that are defined. * - * @return the number of attributes >= 0 + * @return the number of attributes >= 0 * @see AttributeSet#getAttributeCount */ public int getAttributeCount() { diff --git a/jdk/src/share/classes/javax/swing/text/StyledDocument.java b/jdk/src/share/classes/javax/swing/text/StyledDocument.java index 9c687189ca2..ad7c1c1eb2a 100644 --- a/jdk/src/share/classes/javax/swing/text/StyledDocument.java +++ b/jdk/src/share/classes/javax/swing/text/StyledDocument.java @@ -76,8 +76,8 @@ public interface StyledDocument extends Document { * giving an Attributes argument that has no attributes defined * and setting replace to true. * - * @param offset the start of the change >= 0 - * @param length the length of the change >= 0 + * @param offset the start of the change >= 0 + * @param length the length of the change >= 0 * @param s the non-null attributes to change to. Any attributes * defined will be applied to the text for the given range. * @param replace indicates whether or not the previous @@ -91,8 +91,8 @@ public interface StyledDocument extends Document { /** * Sets paragraph attributes. * - * @param offset the start of the change >= 0 - * @param length the length of the change >= 0 + * @param offset the start of the change >= 0 + * @param length the length of the change >= 0 * @param s the non-null attributes to change to. Any attributes * defined will be applied to the text for the given range. * @param replace indicates whether or not the previous @@ -111,7 +111,7 @@ public interface StyledDocument extends Document { * in turn may resolve through some hierarchy completely * independent of the element hierarchy in the document. * - * @param pos the starting position >= 0 + * @param pos the starting position >= 0 * @param s the style to set */ public void setLogicalStyle(int pos, Style s); @@ -119,7 +119,7 @@ public interface StyledDocument extends Document { /** * Gets a logical style for a given position in a paragraph. * - * @param p the position >= 0 + * @param p the position >= 0 * @return the style */ public Style getLogicalStyle(int p); @@ -128,7 +128,7 @@ public interface StyledDocument extends Document { * Gets the element that represents the paragraph that * encloses the given offset within the document. * - * @param pos the offset >= 0 + * @param pos the offset >= 0 * @return the element */ public Element getParagraphElement(int pos); @@ -137,7 +137,7 @@ public interface StyledDocument extends Document { * Gets the element that represents the character that * is at the given offset within the document. * - * @param pos the offset >= 0 + * @param pos the offset >= 0 * @return the element */ public Element getCharacterElement(int pos); diff --git a/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java b/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java index d11f75fdf6e..20832c6c8b8 100644 --- a/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java +++ b/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java @@ -689,7 +689,7 @@ public class StyledEditorKit extends DefaultEditorKit { * Creates a new AlignmentAction. * * @param nm the action name - * @param a the alignment >= 0 + * @param a the alignment >= 0 */ public AlignmentAction(String nm, int a) { super(nm); diff --git a/jdk/src/share/classes/javax/swing/text/TabExpander.java b/jdk/src/share/classes/javax/swing/text/TabExpander.java index a6ff2cfc6d3..fa3ec69222e 100644 --- a/jdk/src/share/classes/javax/swing/text/TabExpander.java +++ b/jdk/src/share/classes/javax/swing/text/TabExpander.java @@ -37,10 +37,10 @@ public interface TabExpander { * Returns the next tab stop position given a reference * position. Values are expressed in points. * - * @param x the position in points >= 0 + * @param x the position in points >= 0 * @param tabOffset the position within the text stream - * that the tab occurred at >= 0. - * @return the next tab stop >= 0 + * that the tab occurred at >= 0. + * @return the next tab stop >= 0 */ float nextTabStop(float x, int tabOffset); diff --git a/jdk/src/share/classes/javax/swing/text/TabableView.java b/jdk/src/share/classes/javax/swing/text/TabableView.java index fb409286d60..e28107ab4aa 100644 --- a/jdk/src/share/classes/javax/swing/text/TabableView.java +++ b/jdk/src/share/classes/javax/swing/text/TabableView.java @@ -46,9 +46,9 @@ public interface TabableView { * along the axis of tab expansion. * * @param x the position the view would be located - * at for the purpose of tab expansion >= 0. + * at for the purpose of tab expansion >= 0. * @param e how to expand the tabs when encountered. - * @return the desired span >= 0 + * @return the desired span >= 0 */ float getTabbedSpan(float x, TabExpander e); @@ -62,9 +62,9 @@ public interface TabableView { * an assumption that the range given does not * contain tabs. * - * @param p0 the starting location in the text document >= 0 - * @param p1 the ending location in the text document >= p0 - * @return the span >= 0 + * @param p0 the starting location in the text document >= 0 + * @param p1 the ending location in the text document >= p0 + * @return the span >= 0 */ float getPartialSpan(int p0, int p1); } diff --git a/jdk/src/share/classes/javax/swing/text/TableView.java b/jdk/src/share/classes/javax/swing/text/TableView.java index c579873cf02..159575302e7 100644 --- a/jdk/src/share/classes/javax/swing/text/TableView.java +++ b/jdk/src/share/classes/javax/swing/text/TableView.java @@ -542,7 +542,7 @@ public abstract class TableView extends BoxView { * view the children do not necessarily have a one to one mapping * with the child elements. * - * @param pos the search position >= 0 + * @param pos the search position >= 0 * @param a the allocation to the table on entry, and the * allocation of the view containing the position on exit * @return the view representing the given position, or @@ -755,7 +755,7 @@ public abstract class TableView extends BoxView { * view the children do not necessarily have a one to one mapping * with the child elements. * - * @param pos the search position >= 0 + * @param pos the search position >= 0 * @param a the allocation to the table on entry, and the * allocation of the view containing the position on exit * @return the view representing the given position, or @@ -833,8 +833,8 @@ public abstract class TableView extends BoxView { /** * Sets the grid location. * - * @param row the row >= 0 - * @param col the column >= 0 + * @param row the row >= 0 + * @param col the column >= 0 */ public void setGridLocation(int row, int col) { this.row = row; @@ -871,8 +871,8 @@ public abstract class TableView extends BoxView { /** * Sets the grid location. * - * @param row the row >= 0 - * @param col the column >= 0 + * @param row the row >= 0 + * @param col the column >= 0 */ public void setGridLocation(int row, int col); diff --git a/jdk/src/share/classes/javax/swing/text/Utilities.java b/jdk/src/share/classes/javax/swing/text/Utilities.java index a6cbfadb0d8..87db7911b89 100644 --- a/jdk/src/share/classes/javax/swing/text/Utilities.java +++ b/jdk/src/share/classes/javax/swing/text/Utilities.java @@ -71,12 +71,12 @@ public class Utilities { * where ints are used and 72dpi is assumed. * * @param s the source of the text - * @param x the X origin >= 0 - * @param y the Y origin >= 0 + * @param x the X origin >= 0 + * @param y the Y origin >= 0 * @param g the graphics context * @param e how to expand the tabs. If this value is null, * tabs will be expanded as a space character. - * @param startOffset starting offset of the text in the document >= 0 + * @param startOffset starting offset of the text in the document >= 0 * @return the X location at the end of the rendered text */ public static final int drawTabbedText(Segment s, int x, int y, Graphics g, @@ -92,12 +92,12 @@ public class Utilities { * * @param view View requesting rendering, may be null. * @param s the source of the text - * @param x the X origin >= 0 - * @param y the Y origin >= 0 + * @param x the X origin >= 0 + * @param y the Y origin >= 0 * @param g the graphics context * @param e how to expand the tabs. If this value is null, * tabs will be expanded as a space character. - * @param startOffset starting offset of the text in the document >= 0 + * @param startOffset starting offset of the text in the document >= 0 * @return the X location at the end of the rendered text */ static final int drawTabbedText(View view, @@ -197,10 +197,10 @@ public class Utilities { * * @param s the source of the text * @param metrics the font metrics to use for the calculation - * @param x the X origin >= 0 + * @param x the X origin >= 0 * @param e how to expand the tabs. If this value is null, * tabs will be expanded as a space character. - * @param startOffset starting offset of the text in the document >= 0 + * @param startOffset starting offset of the text in the document >= 0 * @return the width of the text */ public static final int getTabbedTextWidth(Segment s, FontMetrics metrics, int x, @@ -289,13 +289,13 @@ public class Utilities { * @param s the source of the text * @param metrics the font metrics to use for the calculation * @param x0 the starting view location representing the start - * of the given text >= 0. + * of the given text >= 0. * @param x the target view location to translate to an - * offset into the text >= 0. + * offset into the text >= 0. * @param e how to expand the tabs. If this value is null, * tabs will be expanded as a space character. - * @param startOffset starting offset of the text in the document >= 0 - * @return the offset into the text >= 0 + * @param startOffset starting offset of the text in the document >= 0 + * @return the offset into the text >= 0 */ public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, @@ -488,8 +488,8 @@ public class Utilities { * a value of -1 will be returned. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the position >= 0 if the request can be computed, otherwise + * @param offs the offset in the document >= 0 + * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. * @exception BadLocationException if the offset is out of range */ @@ -518,8 +518,8 @@ public class Utilities { * a value of -1 will be returned. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the position >= 0 if the request can be computed, otherwise + * @param offs the offset in the document >= 0 + * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. * @exception BadLocationException if the offset is out of range */ @@ -549,9 +549,9 @@ public class Utilities { * a value of -1 will be returned. * * @param c the editor - * @param offs the offset in the document >= 0 - * @param x the X coordinate >= 0 - * @return the position >= 0 if the request can be computed, otherwise + * @param offs the offset in the document >= 0 + * @param x the X coordinate >= 0 + * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. * @exception BadLocationException if the offset is out of range */ @@ -586,9 +586,9 @@ public class Utilities { * a value of -1 will be returned. * * @param c the editor - * @param offs the offset in the document >= 0 - * @param x the X coordinate >= 0 - * @return the position >= 0 if the request can be computed, otherwise + * @param offs the offset in the document >= 0 + * @param x the X coordinate >= 0 + * @return the position >= 0 if the request can be computed, otherwise * a value of -1 will be returned. * @exception BadLocationException if the offset is out of range */ @@ -622,8 +622,8 @@ public class Utilities { * Uses BreakIterator.getWordInstance() to actually get the words. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the location in the model of the word start >= 0 + * @param offs the offset in the document >= 0 + * @return the location in the model of the word start >= 0 * @exception BadLocationException if the offset is out of range */ public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException { @@ -656,8 +656,8 @@ public class Utilities { * Uses BreakIterator.getWordInstance() to actually get the words. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the location in the model of the word end >= 0 + * @param offs the offset in the document >= 0 + * @return the location in the model of the word end >= 0 * @exception BadLocationException if the offset is out of range */ public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException { @@ -689,8 +689,8 @@ public class Utilities { * Uses BreakIterator.getWordInstance() to actually get the words. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the location in the model of the word start >= 0 + * @param offs the offset in the document >= 0 + * @return the location in the model of the word start >= 0 * @exception BadLocationException if the offset is out of range */ public static final int getNextWord(JTextComponent c, int offs) throws BadLocationException { @@ -767,8 +767,8 @@ public class Utilities { * Uses BreakIterator.getWordInstance() to actually get the words. * * @param c the editor - * @param offs the offset in the document >= 0 - * @return the location in the model of the word start >= 0 + * @param offs the offset in the document >= 0 + * @return the location in the model of the word start >= 0 * @exception BadLocationException if the offset is out of range */ public static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException { @@ -841,7 +841,7 @@ public class Utilities { * Determines the element to use for a paragraph/line. * * @param c the editor - * @param offs the starting offset in the document >= 0 + * @param offs the starting offset in the document >= 0 * @return the element */ public static final Element getParagraphElement(JTextComponent c, int offs) { @@ -972,7 +972,7 @@ public class Utilities { * must then override the flipEastAndWestAtEnds method. * * @param v View to query - * @param pos the position to convert >= 0 + * @param pos the position to convert >= 0 * @param a the allocated region to render into * @param direction the direction from the current position that can * be thought of as the arrow keys typically found on a keyboard; diff --git a/jdk/src/share/classes/javax/swing/text/View.java b/jdk/src/share/classes/javax/swing/text/View.java index be3a0e4336f..7eed01ef111 100644 --- a/jdk/src/share/classes/javax/swing/text/View.java +++ b/jdk/src/share/classes/javax/swing/text/View.java @@ -72,12 +72,12 @@ A view has the following responsibilities: alt="The above text describes this graphic.">

    The minimum set of methods for layout are:

      -
    • getMinimumSpan -
    • getPreferredSpan -
    • getMaximumSpan -
    • getAlignment -
    • preferenceChanged -
    • setSize +
    • {@link #getMinimumSpan(int) getMinimumSpan} +
    • {@link #getPreferredSpan(int) getPreferredSpan} +
    • {@link #getMaximumSpan(int) getMaximumSpan} +
    • {@link #getAlignment(int) getAlignment} +
    • {@link #preferenceChanged(javax.swing.text.View, boolean, boolean) preferenceChanged} +
    • {@link #setSize(float, float) setSize}

    The setSize method should be prepared to be called a number of times @@ -142,7 +142,7 @@ A view has the following responsibilities:

    The methods for rendering are:

      -
    • paint +
    • {@link #paint(java.awt.Graphics, java.awt.Shape) paint}

    @@ -153,12 +153,12 @@ A view has the following responsibilities: to perform translation to properly locate spatial representation of the model. The methods for doing this are:

      -
    • modelToView -
    • viewToModel -
    • getDocument -
    • getElement -
    • getStartOffset -
    • getEndOffset +
    • {@link #modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) modelToView} +
    • {@link #viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) viewToModel} +
    • {@link #getDocument() getDocument} +
    • {@link #getElement() getElement} +
    • {@link #getStartOffset() getStartOffset} +
    • {@link #getEndOffset() getEndOffset}

    The layout must be valid prior to attempting to make the translation. The translation is not valid, and must not be attempted while changes diff --git a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java index 5ee6eaf163b..1ab45943548 100644 --- a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java +++ b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java @@ -93,11 +93,11 @@ public class WrappedPlainView extends BoxView implements TabExpander { * drawSelectedText so that the way selected and * unselected text are rendered can be customized. * - * @param p0 the starting document location to use >= 0 - * @param p1 the ending document location to use >= p1 + * @param p0 the starting document location to use >= 0 + * @param p1 the ending document location to use >= p1 * @param g the graphics context - * @param x the starting X position >= 0 - * @param y the starting Y position >= 0 + * @param x the starting X position >= 0 + * @param y the starting Y position >= 0 * @see #drawUnselectedText * @see #drawSelectedText */ @@ -165,11 +165,11 @@ public class WrappedPlainView extends BoxView implements TabExpander { * text. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the beginning position in the model >= 0 - * @param p1 the ending position in the model >= p0 - * @return the X location of the end of the range >= 0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the beginning position in the model >= 0 + * @param p1 the ending position in the model >= p0 + * @return the X location of the end of the range >= 0 * @exception BadLocationException if the range is invalid */ protected int drawUnselectedText(Graphics g, int x, int y, @@ -190,10 +190,10 @@ public class WrappedPlainView extends BoxView implements TabExpander { * the selected background. * * @param g the graphics context - * @param x the starting X coordinate >= 0 - * @param y the starting Y coordinate >= 0 - * @param p0 the beginning position in the model >= 0 - * @param p1 the ending position in the model >= p0 + * @param x the starting X coordinate >= 0 + * @param y the starting Y coordinate >= 0 + * @param p0 the beginning position in the model >= 0 + * @param p1 the ending position in the model >= p0 * @return the location of the end of the range. * @exception BadLocationException if the range is invalid */ @@ -326,10 +326,10 @@ public class WrappedPlainView extends BoxView implements TabExpander { * This implementation does not support things like centering so it * ignores the tabOffset argument. * - * @param x the current position >= 0 + * @param x the current position >= 0 * @param tabOffset the position within the text stream - * that the tab occurred at >= 0. - * @return the tab stop, measured in points >= 0 + * that the tab occurred at >= 0. + * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { if (tabSize == 0) @@ -374,8 +374,8 @@ public class WrappedPlainView extends BoxView implements TabExpander { * layout of the view along the given axis, if it * has any layout duties. * - * @param width the width >= 0 - * @param height the height >= 0 + * @param width the width >= 0 + * @param height the height >= 0 */ public void setSize(float width, float height) { updateMetrics(); diff --git a/jdk/src/share/classes/javax/swing/text/ZoneView.java b/jdk/src/share/classes/javax/swing/text/ZoneView.java index cb567e3c258..3b79f234c9a 100644 --- a/jdk/src/share/classes/javax/swing/text/ZoneView.java +++ b/jdk/src/share/classes/javax/swing/text/ZoneView.java @@ -130,7 +130,7 @@ public class ZoneView extends BoxView { * * @param mzl the desired maximum number of zones * to be actively loaded, must be greater than 0 - * @exception IllegalArgumentException if mzl is < 1 + * @exception IllegalArgumentException if mzl is < 1 */ public void setMaxZonesLoaded(int mzl) { if (mzl < 1) { @@ -198,11 +198,11 @@ public class ZoneView extends BoxView { * implementation for a zone by changing this method. * * @param p0 the start of the desired zone. This should - * be >= getStartOffset() and < getEndOffset(). This - * value should also be < p1. + * be >= getStartOffset() and < getEndOffset(). This + * value should also be < p1. * @param p1 the end of the desired zone. This should - * be > getStartOffset() and <= getEndOffset(). This - * value should also be > p0. + * be > getStartOffset() and <= getEndOffset(). This + * value should also be > p0. */ protected View createZone(int p0, int p1) { Document doc = getDocument(); @@ -242,7 +242,7 @@ public class ZoneView extends BoxView { * Returns the child view index representing the given position in * the model. * - * @param pos the position >= 0 + * @param pos the position >= 0 * @return index of the view representing the given position, or * -1 if no view represents that position */ diff --git a/jdk/src/share/classes/javax/swing/text/html/BlockView.java b/jdk/src/share/classes/javax/swing/text/html/BlockView.java index 6ba247a3a6a..949b11c7c68 100644 --- a/jdk/src/share/classes/javax/swing/text/html/BlockView.java +++ b/jdk/src/share/classes/javax/swing/text/html/BlockView.java @@ -352,7 +352,7 @@ public class BlockView extends BoxView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view @@ -368,7 +368,7 @@ public class BlockView extends BoxView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view @@ -384,7 +384,7 @@ public class BlockView extends BoxView { * * @param axis may be either View.X_AXIS * or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0; + * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java index f0f8cb2de11..22b3ad9315b 100644 --- a/jdk/src/share/classes/javax/swing/text/html/CSS.java +++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java @@ -117,7 +117,7 @@ import javax.swing.text.*; * *

    Note: for the time being we do not fully support relative units, * unless noted, so that - * p { margin-top: 10% } will be treated as if no margin-top was specified. + * p { margin-top: 10% } will be treated as if no margin-top was specified. * * @author Timothy Prinzing * @author Scott Violet diff --git a/jdk/src/share/classes/javax/swing/text/html/FormView.java b/jdk/src/share/classes/javax/swing/text/html/FormView.java index 2d25516f339..84c0a34c016 100644 --- a/jdk/src/share/classes/javax/swing/text/html/FormView.java +++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java @@ -380,7 +380,7 @@ public class FormView extends ComponentView implements ActionListener { * axis of interest. * * @param axis may be either View.X_AXIS or View.Y_AXIS - * @return the span the view would like to be rendered into >= 0. + * @return the span the view would like to be rendered into >= 0. * Typically the view is told to render into the span * that is returned, although there is no guarantee. * The parent may choose to resize or break the view. 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 a1f99e9cae8..71f26093252 100644 --- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java +++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java @@ -107,21 +107,21 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; *

    With the following HTML content:

    * *
    - * <html>
    - *   <head>
    - *     <title>An example HTMLDocument</title>
    - *     <style type="text/css">
    + * <html>
    + *   <head>
    + *     <title>An example HTMLDocument</title>
    + *     <style type="text/css">
      *       div { background-color: silver; }
      *       ul { color: red; }
    - *     </style>
    - *   </head>
    - *   <body>
    - *     <div id="BOX">
    - *       <p>Paragraph 1</p>
    - *       <p>Paragraph 2</p>
    - *     </div>
    - *   </body>
    - * </html>
    + *     </style>
    + *   </head>
    + *   <body>
    + *     <div id="BOX">
    + *       <p>Paragraph 1</p>
    + *       <p>Paragraph 2</p>
    + *     </div>
    + *   </body>
    + * </html>
      * 
    * *

    All the methods for modifying an HTML document require an {@link @@ -149,10 +149,10 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; * of any non-leaf element by using the methods * insertAfterStart and insertBeforeEnd. * For example, if e is the DIV element, - * d.insertAfterStart(e, "<ul><li>List - * Item</li></ul>") inserts the list before the first - * paragraph, and d.insertBeforeEnd(e, "<ul><li>List - * Item</li></ul>") inserts the list after the last + * d.insertAfterStart(e, "<ul><li>List + * Item</li></ul>") inserts the list before the first + * paragraph, and d.insertBeforeEnd(e, "<ul><li>List + * Item</li></ul>") inserts the list after the last * paragraph. The DIV block becomes the parent of the * newly inserted elements.

    * @@ -160,9 +160,9 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; * using the methods insertBeforeStart and * insertAfterEnd. For example, if e is the * DIV element, d.insertBeforeStart(e, - * "<ul><li>List Item</li></ul>") inserts the list + * "<ul><li>List Item</li></ul>")
    inserts the list * before the DIV element, and d.insertAfterEnd(e, - * "<ul><li>List Item</li></ul>") inserts the list + * "<ul><li>List Item</li></ul>") inserts the list * after the DIV element. The newly inserted elements * become siblings of the DIV element.

    * @@ -171,10 +171,10 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; *

    Elements and all their descendants can be replaced by using the * methods setInnerHTML and setOuterHTML. * For example, if e is the DIV element, - * d.setInnerHTML(e, "<ul><li>List - * Item</li></ul>") replaces all children paragraphs with - * the list, and d.setOuterHTML(e, "<ul><li>List - * Item</li></ul>") replaces the DIV element + * d.setInnerHTML(e, "<ul><li>List + * Item</li></ul>") replaces all children paragraphs with + * the list, and d.setOuterHTML(e, "<ul><li>List + * Item</li></ul>") replaces the DIV element * itself. In latter case the parent of the list is the * BODY element. * @@ -184,6 +184,7 @@ import static sun.swing.SwingUtilities2.IMPLIED_CR; * of various methods described above.

    * *

    - * + * * By default, {@code DragSourceContext} sets the cursor as appropriate * for the current state of the drag and drop operation. For example, if * the user has chosen {@linkplain DnDConstants#ACTION_MOVE the move action}, diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java b/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java index 4ca92d86c07..315fa3c680d 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java @@ -47,9 +47,9 @@ import java.awt.event.InputEvent; * source and the drop action selected by the user. The user can select a drop * action by pressing modifier keys during the drag operation: *

    Audio Format Property KeysAudio Format Properties
    Property keyValue typeDEFAULT_NAME" + + " 
    Methods " + "
    + * * * * @@ -985,25 +986,25 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * - *

    Invoking setInnerHTML(elem, "<ul><li>") + *

    Invoking setInnerHTML(elem, "<ul><li>") * results in the following structure (new elements are in red).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *         \
    -     *         <ul>
    +     *         <ul>
          *           \
    -     *           <li>
    +     *           <li>
          * 
    * *

    Parameter elem must not be a leaf element, @@ -1066,23 +1067,23 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * - *

    Invoking setOuterHTML(elem, "<ul><li>") + *

    Invoking setOuterHTML(elem, "<ul><li>") * results in the following structure (new elements are in red).

    * *
    -     *    <body>
    +     *    <body>
          *      |
    -     *     <ul>
    +     *     <ul>
          *       \
    -     *       <li>
    +     *       <li>
          * 
    * *

    If either elem or htmlText @@ -1136,25 +1137,25 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * *

    Invoking insertAfterStart(elem, - * "<ul><li>") results in the following structure + * "<ul><li>") results in the following structure * (new elements are in red).

    * *
    -     *        <body>
    +     *        <body>
          *          |
    -     *        <div>
    +     *        <div>
          *       /  |  \
    -     *    <ul> <p> <p>
    +     *    <ul> <p> <p>
          *     /
    -     *  <li>
    +     *  <li>
          * 
    * *

    Unlike the insertBeforeStart method, new @@ -1206,25 +1207,25 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * - *

    Invoking insertBeforeEnd(elem, "<ul><li>") + *

    Invoking insertBeforeEnd(elem, "<ul><li>") * results in the following structure (new elements are in red).

    * *
    -     *        <body>
    +     *        <body>
          *          |
    -     *        <div>
    +     *        <div>
          *       /  |  \
    -     *     <p> <p> <ul>
    +     *     <p> <p> <ul>
          *               \
    -     *               <li>
    +     *               <li>
          * 
    * *

    Unlike the insertAfterEnd method, new elements @@ -1273,23 +1274,23 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * *

    Invoking insertBeforeStart(elem, - * "<ul><li>") results in the following structure + * "<ul><li>") results in the following structure * (new elements are in red).

    * *
    -     *        <body>
    +     *        <body>
          *         /  \
    -     *      <ul> <div>
    +     *      <ul> <div>
          *       /    /  \
    -     *     <li> <p>  <p>
    +     *     <li> <p>  <p>
          * 
    * *

    Unlike the insertAfterStart method, new @@ -1331,23 +1332,23 @@ public class HTMLDocument extends DefaultStyledDocument { * parameter is in bold).

    * *
    -     *     <body>
    +     *     <body>
          *       |
    -     *     <div>
    +     *     <div>
          *      /  \
    -     *    <p>   <p>
    +     *    <p>   <p>
          * 
    * - *

    Invoking insertAfterEnd(elem, "<ul><li>") + *

    Invoking insertAfterEnd(elem, "<ul><li>") * results in the following structure (new elements are in red).

    * *
    -     *        <body>
    +     *        <body>
          *         /  \
    -     *      <div> <ul>
    +     *      <div> <ul>
          *       / \    \
    -     *     <p> <p>  <li>
    +     *     <p> <p>  <li>
          * 
    * *

    Unlike the insertBeforeEnd method, new elements @@ -2166,7 +2167,7 @@ public class HTMLDocument extends DefaultStyledDocument { *

    ExampleinsertAfterStart
    HTML.Tag.VAR CharacterAction *
    *

    - * Once </html> is encountered, the Actions are no longer notified. + * Once </html> is encountered, the Actions are no longer notified. */ public class HTMLReader extends HTMLEditorKit.ParserCallback { From 602931b7cee62d117b1117135a62125afa418dcd Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Tue, 24 Sep 2013 17:46:19 +0400 Subject: [PATCH 211/983] 7124320: [TEST_BUG] [macosx] JComboBox doesn't change selection on mouse over Reviewed-by: alexsch, serb --- .../swing/JComboBox/6236162/bug6236162.java | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 jdk/test/javax/swing/JComboBox/6236162/bug6236162.java diff --git a/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java new file mode 100644 index 00000000000..6e0ad44e734 --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java @@ -0,0 +1,119 @@ +/* + * 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 6236162 + @summary Checks that there is no an inconsistence in combo box + behavior when user points an item in combo popup + by mouse and then uses UP/DOWN keys. + @library ../../regtesthelpers + @build Util + @author Mikhail Lapshin + @run main bug6236162 +*/ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.MetalComboBoxUI; +import java.awt.*; +import java.awt.event.KeyEvent; + +public class bug6236162 { + private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + private static JFrame frame; + private static JComboBox combo; + private static MyComboUI comboUI; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + toolkit.realSync(); + test(); + System.out.println("Test passed"); + } + + private static void createAndShowGUI() { + frame = new JFrame("bug6236162"); + + combo = new JComboBox(new String[]{"one", "two", "three", "four", "five"}); + combo.setEditable(true); + comboUI = new MyComboUI(); + combo.setUI(comboUI); + combo.setSelectedIndex(3); + frame.getContentPane().add(combo); + + frame.pack(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static void test() throws AWTException { + Robot robot = new Robot(); + robot.setAutoDelay(50); + + // Open popup menu + realSync(); + Util.hitKeys(robot, KeyEvent.VK_DOWN); + + // Move mouse to the first popup menu item + realSync(); + Point p = combo.getLocationOnScreen(); + Dimension size = combo.getSize(); + p.x += size.width / 2; + p.y += size.height; + float dy = 1; + robot.mouseMove(p.x, p.y - 5); + for (int i=1; i <= 10; i++) { + robot.mouseMove((int)(p.x), (int)(p.y - 5 + dy*i)); + } + + // Select the second popup menu item + realSync(); + Util.hitKeys(robot, KeyEvent.VK_DOWN); + + realSync(); + JList list = comboUI.getComboPopup().getList(); + if (list.getSelectedIndex() != 1) { + throw new RuntimeException("There is an inconsistence in combo box " + + "behavior when user points an item in combo popup " + + "by mouse and then uses UP/DOWN keys."); + } + } + + private static void realSync() { + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + } + + // Gives access to BasicComboBoxUI.popup field + private static class MyComboUI extends MetalComboBoxUI { + public ComboPopup getComboPopup() { + return popup; + } + } +} From a2889becd991625fb922b1916a6adcb4129d3fd7 Mon Sep 17 00:00:00 2001 From: Albert Noll Date: Tue, 24 Sep 2013 15:56:25 +0200 Subject: [PATCH 212/983] 7009641: Don't fail VM when CodeCache is full Allocation in the code cache returns NULL instead of failing the entire VM Reviewed-by: kvn, iveresov --- hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp | 10 ++++++++++ hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp | 10 ++++++++++ hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp | 10 ++++++++++ hotspot/src/share/vm/code/compiledIC.cpp | 10 ++++++++-- hotspot/src/share/vm/code/compiledIC.hpp | 5 ++++- hotspot/src/share/vm/code/vtableStubs.cpp | 11 +++++++---- hotspot/src/share/vm/runtime/sharedRuntime.cpp | 7 +++++-- 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp index ce19d4d7e7b..cdbb57fbecd 100644 --- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp @@ -52,6 +52,11 @@ extern "C" void bad_compiled_vtable_index(JavaThread* thread, oopDesc* receiver, VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { const int sparc_code_length = VtableStub::pd_code_size_limit(true); VtableStub* s = new(sparc_code_length) VtableStub(true, vtable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), sparc_code_length); MacroAssembler* masm = new MacroAssembler(&cb); @@ -125,6 +130,11 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { VtableStub* VtableStubs::create_itable_stub(int itable_index) { const int sparc_code_length = VtableStub::pd_code_size_limit(false); VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), sparc_code_length); MacroAssembler* masm = new MacroAssembler(&cb); diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp index c470004ebc8..7c49d737fa5 100644 --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp @@ -58,6 +58,11 @@ extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { const int i486_code_length = VtableStub::pd_code_size_limit(true); VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), i486_code_length); MacroAssembler* masm = new MacroAssembler(&cb); @@ -132,6 +137,11 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { // add code here, bump the code stub size returned by pd_code_size_limit! const int i486_code_length = VtableStub::pd_code_size_limit(false); VtableStub* s = new(i486_code_length) VtableStub(false, itable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), i486_code_length); MacroAssembler* masm = new MacroAssembler(&cb); diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp index 5f5f94f41a5..911341736d8 100644 --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp @@ -49,6 +49,11 @@ extern "C" void bad_compiled_vtable_index(JavaThread* thread, VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { const int amd64_code_length = VtableStub::pd_code_size_limit(true); VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), amd64_code_length); MacroAssembler* masm = new MacroAssembler(&cb); @@ -126,6 +131,11 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { // returned by pd_code_size_limit! const int amd64_code_length = VtableStub::pd_code_size_limit(false); VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + ResourceMark rm; CodeBuffer cb(s->entry_point(), amd64_code_length); MacroAssembler* masm = new MacroAssembler(&cb); diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp index b9db323e5b2..489e649fadc 100644 --- a/hotspot/src/share/vm/code/compiledIC.cpp +++ b/hotspot/src/share/vm/code/compiledIC.cpp @@ -160,7 +160,7 @@ address CompiledIC::stub_address() const { // High-level access to an inline cache. Guaranteed to be MT-safe. -void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { +bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic"); assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?"); @@ -170,8 +170,10 @@ void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod assert(bytecode == Bytecodes::_invokeinterface, ""); int itable_index = call_info->itable_index(); entry = VtableStubs::find_itable_stub(itable_index); + if (entry == false) { + return false; + } #ifdef ASSERT - assert(entry != NULL, "entry not computed"); int index = call_info->resolved_method()->itable_index(); assert(index == itable_index, "CallInfo pre-computes this"); #endif //ASSERT @@ -184,6 +186,9 @@ void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod int vtable_index = call_info->vtable_index(); assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check"); entry = VtableStubs::find_vtable_stub(vtable_index); + if (entry == NULL) { + return false; + } InlineCacheBuffer::create_transition_stub(this, NULL, entry); } @@ -200,6 +205,7 @@ void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod // race because the IC entry was complete when we safepointed so // cleaning it immediately is harmless. // assert(is_megamorphic(), "sanity check"); + return true; } diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp index 96cb0a582bb..598cbe949e2 100644 --- a/hotspot/src/share/vm/code/compiledIC.hpp +++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -226,7 +226,10 @@ class CompiledIC: public ResourceObj { // void set_to_clean(); // Can only be called during a safepoint operation void set_to_monomorphic(CompiledICInfo& info); - void set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); + + // Returns true if successful and false otherwise. The call can fail if memory + // allocation in the code cache fails. + bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass, bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS); diff --git a/hotspot/src/share/vm/code/vtableStubs.cpp b/hotspot/src/share/vm/code/vtableStubs.cpp index 7d9d7efaf67..5af91a3a6ee 100644 --- a/hotspot/src/share/vm/code/vtableStubs.cpp +++ b/hotspot/src/share/vm/code/vtableStubs.cpp @@ -46,12 +46,9 @@ address VtableStub::_chunk = NULL; address VtableStub::_chunk_end = NULL; VMReg VtableStub::_receiver_location = VMRegImpl::Bad(); -static int num_vtable_chunks = 0; - void* VtableStub::operator new(size_t size, int code_size) throw() { assert(size == sizeof(VtableStub), "mismatched size"); - num_vtable_chunks++; // compute real VtableStub size (rounded to nearest word) const int real_size = round_to(code_size + sizeof(VtableStub), wordSize); // malloc them in chunks to minimize header overhead @@ -60,7 +57,7 @@ void* VtableStub::operator new(size_t size, int code_size) throw() { const int bytes = chunk_factor * real_size + pd_code_alignment(); BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); if (blob == NULL) { - vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "CodeCache: no room for vtable chunks"); + return NULL; } _chunk = blob->content_begin(); _chunk_end = _chunk + bytes; @@ -121,6 +118,12 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { } else { s = create_itable_stub(vtable_index); } + + // Creation of vtable or itable can fail if there is not enough free space in the code cache. + if (s == NULL) { + return NULL; + } + enter(is_vtable_stub, vtable_index, s); if (PrintAdapterHandlers) { tty->print_cr("Decoding VtableStub %s[%d]@%d", diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index d014eda2f80..17ea65ae716 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -1506,8 +1506,11 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) { info, CHECK_(methodHandle())); inline_cache->set_to_monomorphic(info); } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { - // Change to megamorphic - inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); + // Potential change to megamorphic + bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); + if (!successful) { + inline_cache->set_to_clean(); + } } else { // Either clean or megamorphic } From 036eee04735b37db761c1ce2f689d2c0633e81d1 Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Tue, 24 Sep 2013 17:56:32 +0400 Subject: [PATCH 213/983] 7133154: [TEST_BUG] [macosx] closed/javax/swing/JInternalFrame/4251301/bug4251301.java fails on MacOS Reviewed-by: alexsch, serb --- .../JInternalFrame/4251301/bug4251301.java | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java diff --git a/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java new file mode 100644 index 00000000000..304d0582407 --- /dev/null +++ b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java @@ -0,0 +1,139 @@ +/* + * 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 4251301 + @summary Keybinding for show/hide the system menu. + @author Andrey Pikalev + @run main/manual bug4251301 +*/ + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.*; +import sun.awt.OSInfo; +import sun.awt.SunToolkit; + + +public class bug4251301 { + private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + static Test test = new Test(); + public static void main(String[] args) throws Exception { + if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) { + System.out.println("This test is not applicable for MacOS. Passed."); + return; + } + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + toolkit.realSync(); + test.waitTestResult(); + } + + public static void createAndShowGUI() { + final StringBuilder instructions = new StringBuilder(); + instructions.append("Click with your mouse the content area of the internal frame with the title \"IFrame\" "); + instructions.append("and press Ctrl+Space. \n"); + instructions.append("If the system menu shows up, press Esc. Then system menu should hide. \n"); + instructions.append("If you success then press \"Pass\", else press \"Fail\".\n"); + + JDesktopPane dp = new JDesktopPane(); + JInternalFrame jif = new JInternalFrame("IFrame",true,true,true,true); + dp.add(jif); + jif.setBounds(20, 20, 220, 100); + jif.setVisible(true); + try { + jif.setSelected(true); + } catch(PropertyVetoException pve) { + pve.printStackTrace(); + throw new Error("Occures PropertyVetoException while set selection..."); + } + JScrollPane dtScrollPane = new JScrollPane(dp); + JFrame testFrame = test.createTestFrame("Instructions", dtScrollPane, instructions.toString(), 500); + testFrame.setSize(500, 400); + testFrame.setVisible(true); + } + static class Test { + private boolean pass; + JFrame createTestFrame(String name, Component topComponent, String instructions, int instrHeight) { + final String PASS = "Pass"; + final String FAIL = "Fail"; + JFrame frame = new JFrame(name); + frame.setLayout(new BorderLayout()); + + JPanel testButtonsPanel = new JPanel(); + testButtonsPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 20)); + + ActionListener btnAL = new ActionListener() { + public void actionPerformed(ActionEvent event) { + switch (event.getActionCommand()) { + case PASS: + pass(); + break; + default: + throw new RuntimeException("Test failed."); + } + } + }; + JButton passBtn = new JButton(PASS); + passBtn.addActionListener(btnAL); + passBtn.setActionCommand(PASS); + + JButton failBtn = new JButton(FAIL); + failBtn.addActionListener(btnAL); + failBtn.setActionCommand(FAIL); + + testButtonsPanel.add(BorderLayout.WEST, passBtn); + testButtonsPanel.add(BorderLayout.EAST, failBtn); + + JTextArea instrText = new JTextArea(); + instrText.setLineWrap(true); + instrText.setEditable(false); + JScrollPane instrScrollPane = new JScrollPane(instrText); + instrScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, instrHeight)); + instrText.append(instructions); + + JPanel servicePanel = new JPanel(); + servicePanel.setLayout(new BorderLayout()); + servicePanel.add(BorderLayout.CENTER, instrScrollPane); + servicePanel.add(BorderLayout.SOUTH, testButtonsPanel); + + frame.add(BorderLayout.SOUTH, servicePanel); + frame.add(BorderLayout.CENTER, topComponent); + return frame; + } + synchronized void pass() { + pass = true; + notifyAll(); + } + synchronized void waitTestResult() throws InterruptedException { + while (!pass) { + wait(); + } + } + } +} From 91047d3b0737f2889c768a39dd3ed6cdb026c975 Mon Sep 17 00:00:00 2001 From: Vera Akulova Date: Tue, 24 Sep 2013 18:13:24 +0400 Subject: [PATCH 214/983] 7133146: [macosx] closed/javax/swing/JInternalFrame/4193219/IconCoord fails on MacOS Reviewed-by: alexsch, serb --- .../JInternalFrame/4193219/IconCoord.java | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 jdk/test/javax/swing/JInternalFrame/4193219/IconCoord.java diff --git a/jdk/test/javax/swing/JInternalFrame/4193219/IconCoord.java b/jdk/test/javax/swing/JInternalFrame/4193219/IconCoord.java new file mode 100644 index 00000000000..709a197f2ae --- /dev/null +++ b/jdk/test/javax/swing/JInternalFrame/4193219/IconCoord.java @@ -0,0 +1,161 @@ +/* + * 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 4193219 + @summary + @author Your Name: Hania Gajewska area=swing + @run main/manual IconCoord +*/ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class IconCoord { + static Test test = new Test(); + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + new IconCoord().createAndShowGUI(); + } + }); + test.waitTestResult(); + } + + private void createAndShowGUI() { + StringBuilder instrText = new StringBuilder(); + instrText.append("First, iconify internal frame \"Frame 1\" by clicking on its iconify button.\n"); + instrText.append("Now, maximize the top-level window \"IconCoord\".\n"); + instrText.append("The \"Frame 1\" icon should stay in the lower left corner of the desktop; "); + instrText.append("if it doesn't, press \"Fail\".\n"); + instrText.append("Now move the icon to the middle of the desktop by dragging it by its "); + instrText.append("bumpy left side. Then iconify \"Frame 2\" by clicking on its iconify button.\n"); + instrText.append("If the icon for frame two gets placed in the lower left corner of the "); + instrText.append("desktop (where the icon for \"Frame 1\" used to be before you moved it), "); + instrText.append("press \"Pass\". Otherwise, press \"Fail\".\n"); + + JDesktopPane dt = new JDesktopPane(); + + JButton tf; + JInternalFrame if1 = new JInternalFrame("Frame 1", false, false, false, true); + JComponent c = (JComponent) if1.getContentPane(); + c.setLayout(new BorderLayout()); + + tf = new JButton ("ignore"); + c.add (tf, BorderLayout.NORTH); + + tf = new JButton ("ignore"); + c.add (tf, BorderLayout.CENTER); + + JInternalFrame if2 = new JInternalFrame("Frame 2", false, false, false, true); + c = (JComponent) if2.getContentPane(); + c.setLayout(new BorderLayout()); + + tf = new JButton ("ignore"); + c.add (tf, BorderLayout.NORTH); + + tf = new JButton ("ignore"); + c.add (tf, BorderLayout.CENTER); + + if1.pack(); + if1.setBounds(300, 0, 300, 80); + if2.pack(); + if2.setBounds(0, 0, 300, 80); + dt.add(if1); + dt.add(if2); + + if1.setVisible(true); + if2.setVisible(true); + + int frameHeight = 500; + + JScrollPane dtScrollPane = new JScrollPane(dt); + JFrame frame = test.createTestFrame("IconCoord", dtScrollPane, instrText.toString(), 250); + dt.setPreferredSize(new Dimension(650, frameHeight - 250)); + frame.setSize (600,500); + frame.setVisible(true); + } + + static class Test { + private boolean pass; + JFrame createTestFrame(String name, Component topComponent, String instructions, int instrHeight) { + final String PASS = "Pass"; + final String FAIL = "Fail"; + JFrame frame = new JFrame(name); + frame.setLayout(new BorderLayout()); + + JPanel testButtonsPanel = new JPanel(); + testButtonsPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 20)); + + ActionListener btnAL = new ActionListener() { + public void actionPerformed(ActionEvent event) { + switch (event.getActionCommand()) { + case PASS: + pass(); + break; + default: + throw new RuntimeException("Test failed."); + } + } + }; + JButton passBtn = new JButton(PASS); + passBtn.addActionListener(btnAL); + passBtn.setActionCommand(PASS); + + JButton failBtn = new JButton(FAIL); + failBtn.addActionListener(btnAL); + failBtn.setActionCommand(FAIL); + + testButtonsPanel.add(BorderLayout.WEST, passBtn); + testButtonsPanel.add(BorderLayout.EAST, failBtn); + + JTextArea instrText = new JTextArea(); + instrText.setLineWrap(true); + instrText.setEditable(false); + JScrollPane instrScrollPane = new JScrollPane(instrText); + instrScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, instrHeight)); + instrText.append(instructions); + + JPanel servicePanel = new JPanel(); + servicePanel.setLayout(new BorderLayout()); + servicePanel.add(BorderLayout.CENTER, instrScrollPane); + servicePanel.add(BorderLayout.SOUTH, testButtonsPanel); + + frame.add(BorderLayout.SOUTH, servicePanel); + frame.add(BorderLayout.CENTER, topComponent); + return frame; + } + synchronized void pass() { + pass = true; + notifyAll(); + } + synchronized void waitTestResult() throws InterruptedException { + while (!pass) { + wait(); + } + } + } +} From bdcfc36ee6df88404308ae946b2cadb9dc3ff42c Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Tue, 24 Sep 2013 18:20:31 +0400 Subject: [PATCH 215/983] 8015599: [TEST_BUG] [macosx] Test closed/javax/swing/Popup/TaskbarPositionTest.java fails since JDK 8 b75 on MacOSX Reviewed-by: alexsch, serb --- .../swing/Popup/TaskbarPositionTest.java | 340 ++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 jdk/test/javax/swing/Popup/TaskbarPositionTest.java diff --git a/jdk/test/javax/swing/Popup/TaskbarPositionTest.java b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java new file mode 100644 index 00000000000..b4f8989c9db --- /dev/null +++ b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java @@ -0,0 +1,340 @@ +/* + * 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.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * @test @bug 4245587 4474813 4425878 4767478 8015599 + * @author Mark Davidson + * @summary Tests the location of the heavy weight popup portion of JComboBox, + * JMenu and JPopupMenu. + * @library ../regtesthelpers + * @build Util + * @run main TaskbarPositionTest + */ +public class TaskbarPositionTest extends JFrame implements ActionListener { + + private boolean done; + private Throwable error; + private static TaskbarPositionTest test; + private static JPopupMenu popupMenu; + private static JPanel panel; + private static JComboBox combo1; + private static JComboBox combo2; + private static JMenuBar menubar; + private static JMenu menu1; + private static JMenu menu2; + private static Rectangle fullScreenBounds; + // The usable desktop space: screen size - screen insets. + private static Rectangle screenBounds; + private static String[] numData = { + "One", "Two", "Three", "Four", "Five", "Six", "Seven" + }; + private static String[] dayData = { + "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" + }; + private static char[] mnDayData = { + 'M', 'T', 'W', 'R', 'F', 'S', 'U' + }; + + public TaskbarPositionTest() { + super("Use CTRL-down to show a JPopupMenu"); + setContentPane(panel = createContentPane()); + setJMenuBar(createMenuBar("1 - First Menu", true)); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + // CTRL-down will show the popup. + panel.getInputMap().put(KeyStroke.getKeyStroke( + KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP"); + panel.getActionMap().put("OPEN_POPUP", new PopupHandler()); + + pack(); + + Toolkit toolkit = Toolkit.getDefaultToolkit(); + fullScreenBounds = new Rectangle(new Point(), toolkit.getScreenSize()); + screenBounds = new Rectangle(new Point(), toolkit.getScreenSize()); + + // Place the frame near the bottom. This is a pretty wild guess. + this.setLocation(0, (int) screenBounds.getHeight() - 2 * this.getHeight()); + + // Reduce the screen bounds by the insets. + GraphicsConfiguration gc = this.getGraphicsConfiguration(); + if (gc != null) { + Insets screenInsets = toolkit.getScreenInsets(gc); + screenBounds = gc.getBounds(); + screenBounds.width -= (screenInsets.left + screenInsets.right); + screenBounds.height -= (screenInsets.top + screenInsets.bottom); + screenBounds.x += screenInsets.left; + screenBounds.y += screenInsets.top; + } + + setVisible(true); + } + + public static class ComboPopupCheckListener implements PopupMenuListener { + + public void popupMenuCanceled(PopupMenuEvent ev) { + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent ev) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) { + Point cpos = combo1.getLocation(); + SwingUtilities.convertPointToScreen(cpos, panel); + + JPopupMenu pm = (JPopupMenu) combo1.getUI().getAccessibleChild(combo1, 0); + + if (pm != null) { + Point p = pm.getLocation(); + SwingUtilities.convertPointToScreen(p, pm); + if (p.y < cpos.y) { + throw new RuntimeException("ComboBox popup is wrongly aligned"); + } // check that popup was opened down + } + } + } + + private class PopupHandler extends AbstractAction { + + public void actionPerformed(ActionEvent e) { + if (!popupMenu.isVisible()) { + popupMenu.show((Component) e.getSource(), 40, 40); + } + isPopupOnScreen(popupMenu, fullScreenBounds); + } + } + + class PopupListener extends MouseAdapter { + + private JPopupMenu popup; + + public PopupListener(JPopupMenu popup) { + this.popup = popup; + } + + public void mousePressed(MouseEvent e) { + maybeShowPopup(e); + } + + public void mouseReleased(MouseEvent e) { + maybeShowPopup(e); + } + + private void maybeShowPopup(MouseEvent e) { + if (e.isPopupTrigger()) { + popup.show(e.getComponent(), e.getX(), e.getY()); + isPopupOnScreen(popup, fullScreenBounds); + } + } + } + + /** + * Tests if the popup is on the screen. + */ + public static void isPopupOnScreen(JPopupMenu popup, Rectangle checkBounds) { + Dimension dim = popup.getSize(); + Point pt = new Point(); + SwingUtilities.convertPointToScreen(pt, popup); + Rectangle bounds = new Rectangle(pt, dim); + + if (!SwingUtilities.isRectangleContainingRectangle(checkBounds, bounds)) { + throw new RuntimeException("We do not match! " + checkBounds + " / " + bounds); + } + + } + + private JPanel createContentPane() { + JPanel panel = new JPanel(); + + combo1 = new JComboBox<>(numData); + panel.add(combo1); + combo2 = new JComboBox<>(dayData); + combo2.setEditable(true); + panel.add(combo2); + panel.setSize(300, 200); + + popupMenu = new JPopupMenu(); + JMenuItem item; + for (int i = 0; i < dayData.length; i++) { + item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i])); + item.addActionListener(this); + } + panel.addMouseListener(new PopupListener(popupMenu)); + + JTextField field = new JTextField("CTRL+down for Popup"); + // CTRL-down will show the popup. + field.getInputMap().put(KeyStroke.getKeyStroke( + KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP"); + field.getActionMap().put("OPEN_POPUP", new PopupHandler()); + + panel.add(field); + + return panel; + } + + /** + * @param str name of Menu + * @param bFlag set mnemonics on menu items + */ + private JMenuBar createMenuBar(String str, boolean bFlag) { + menubar = new JMenuBar(); + + menu1 = new JMenu(str); + menu1.setMnemonic(str.charAt(0)); + menu1.addActionListener(this); + + menubar.add(menu1); + for (int i = 0; i < 8; i++) { + JMenuItem menuitem = new JMenuItem("1 JMenuItem" + i); + menuitem.addActionListener(this); + if (bFlag) { + menuitem.setMnemonic('0' + i); + } + menu1.add(menuitem); + } + + // second menu + menu2 = new JMenu("2 - Second Menu"); + menu2.addActionListener(this); + menu2.setMnemonic('2'); + + menubar.add(menu2); + for (int i = 0; i < 5; i++) { + JMenuItem menuitem = new JMenuItem("2 JMenuItem" + i); + menuitem.addActionListener(this); + + if (bFlag) { + menuitem.setMnemonic('0' + i); + } + menu2.add(menuitem); + } + JMenu submenu = new JMenu("Sub Menu"); + submenu.setMnemonic('S'); + submenu.addActionListener(this); + for (int i = 0; i < 5; i++) { + JMenuItem menuitem = new JMenuItem("S JMenuItem" + i); + menuitem.addActionListener(this); + if (bFlag) { + menuitem.setMnemonic('0' + i); + } + submenu.add(menuitem); + } + menu2.add(new JSeparator()); + menu2.add(submenu); + + return menubar; + } + + public void actionPerformed(ActionEvent evt) { + Object obj = evt.getSource(); + if (obj instanceof JMenuItem) { + // put the focus on the noneditable combo. + combo1.requestFocus(); + } + } + + public static void main(String[] args) throws Throwable { + + sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test = new TaskbarPositionTest(); + } + }); + + // Use Robot to automate the test + Robot robot; + robot = new Robot(); + robot.setAutoDelay(125); + + // 1 - menu + Util.hitMnemonics(robot, KeyEvent.VK_1); + + toolkit.realSync(); + isPopupOnScreen(menu1.getPopupMenu(), screenBounds); + + // 2 menu with sub menu + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + Util.hitMnemonics(robot, KeyEvent.VK_S); + + toolkit.realSync(); + isPopupOnScreen(menu2.getPopupMenu(), screenBounds); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + // Focus should go to non editable combo box + toolkit.realSync(); + Thread.sleep(500); + + robot.keyPress(KeyEvent.VK_DOWN); + + // How do we check combo boxes? + + // Editable combo box + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + + // combo1.getUI(); + + // Popup from Text field + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_CONTROL); + + // Popup from a mouse click. + Point pt = new Point(2, 2); + SwingUtilities.convertPointToScreen(pt, panel); + robot.mouseMove((int) pt.getX(), (int) pt.getY()); + robot.mousePress(InputEvent.BUTTON3_MASK); + robot.mouseRelease(InputEvent.BUTTON3_MASK); + + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + test.setLocation(-30, 100); + combo1.addPopupMenuListener(new ComboPopupCheckListener()); + combo1.requestFocus(); + } + }); + + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + + toolkit.realSync(); + Thread.sleep(500); + } +} From c31deb38acef708cfc2418904b00bfd6a47c4fcf Mon Sep 17 00:00:00 2001 From: Leonid Romanov Date: Tue, 24 Sep 2013 18:24:03 +0400 Subject: [PATCH 216/983] 8022555: [macosx] AppleScriptEngine.jar MUST call java.awt.Toolkit.getDefaultToolkit() lazily Reviewed-by: anthony, serb --- .../applescript/AppleScriptEngineFactory.java | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java b/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java index 564dfe063f7..8c50b9d9301 100644 --- a/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java +++ b/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -30,14 +30,9 @@ import java.util.*; import javax.script.*; public class AppleScriptEngineFactory implements ScriptEngineFactory { - private static native void initNative(); + private static volatile boolean initialized = false; - static { - java.awt.Toolkit.getDefaultToolkit(); - System.loadLibrary("AppleScriptEngine"); - initNative(); - TRACE(""); - } + private static native void initNative(); static void TRACE(final String str) { // System.out.println(AppleScriptEngineFactory.class.getName() + "." + str); @@ -80,6 +75,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return full name of the ScriptEngine */ + @Override public String getEngineName() { TRACE("getEngineName()"); return ENGINE_NAME; @@ -90,6 +86,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return version of the ScriptEngine */ + @Override public String getEngineVersion() { TRACE("getEngineVersion()"); return ENGINE_VERSION; @@ -100,6 +97,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return name of the language supported by the ScriptEngine(Factory) */ + @Override public String getLanguageName() { TRACE("getLanguageName()"); return LANGUAGE; @@ -110,11 +108,12 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return language version supported by the ScriptEngine(Factory) */ + @Override public String getLanguageVersion() { TRACE("getLanguageVersion()"); return AccessController.doPrivileged(new PrivilegedAction() { public String run() { - final AppleScriptEngine engine = new AppleScriptEngine(AppleScriptEngineFactory.this); + final AppleScriptEngine engine = getScriptEngine(); return engine.getLanguageVersion(); } }); @@ -126,6 +125,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return ArrayList of file extensions AppleScript associates with */ + @Override public List getExtensions() { TRACE("getExtensions()"); return Arrays.asList("scpt", "applescript", "app"); @@ -137,6 +137,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return ArrayList of mimetypes that AppleScript associates with */ + @Override public List getMimeTypes() { TRACE("getMimeTypes()"); return Arrays.asList("application/x-applescript", "text/plain", "text/applescript"); @@ -148,6 +149,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return */ + @Override public List getNames() { TRACE("getNames()"); return Arrays.asList("AppleScriptEngine", "AppleScript", "OSA"); @@ -165,6 +167,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * arguments to the function * @return the AppleScript string calling the method */ + @Override public String getMethodCallSyntax(final String obj, final String fname, final String ... args) { // StringBuilder builder = new StringBuilder(); // builder.append("my " + fname + "("); @@ -181,6 +184,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * @param toDisplay * @return */ + @Override public String getOutputStatement(final String toDisplay) { // TODO -- this might even be good enough? XD return getMethodCallSyntax(null, "print", toDisplay); @@ -193,8 +197,9 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * the key to look up * @return the static preseeded value for the key in the ScriptEngine, if it exists, otherwise null */ + @Override public Object getParameter(final String key) { - final AppleScriptEngine engine = new AppleScriptEngine(this); + final AppleScriptEngine engine = getScriptEngine(); if (!engine.getBindings(ScriptContext.ENGINE_SCOPE).containsKey(key)) return null; return engine.getBindings(ScriptContext.ENGINE_SCOPE).get(key); } @@ -205,6 +210,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * @param statements * @return */ + @Override public String getProgram(final String ... statements) { final StringBuilder program = new StringBuilder(); for (final String statement : statements) { @@ -218,8 +224,21 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory { * * @return new AppleScriptEngine with this factory as it's parent */ - public ScriptEngine getScriptEngine() { + @Override + public AppleScriptEngine getScriptEngine() { AppleScriptEngine.checkSecurity(); + ensureInitialized(); + return new AppleScriptEngine(this); } + + private static synchronized void ensureInitialized() { + if (!initialized) { + initialized = true; + + java.awt.Toolkit.getDefaultToolkit(); + System.loadLibrary("AppleScriptEngine"); + initNative(); + } + } } From 14ceb05e0ea4914bffb6db708b8dd8e6992137c9 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 24 Sep 2013 10:48:11 -0700 Subject: [PATCH 217/983] 8025050: Doclint doesn't recognize tag Reviewed-by: bpatel --- langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java | 3 +++ langtools/test/tools/doclint/html/InlineTagsTest.java | 1 + 2 files changed, 4 insertions(+) diff --git a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java index 3b8f8599e09..2ea92af9ac0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java +++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java @@ -86,6 +86,9 @@ public enum HtmlTag { DD(BlockType.LIST_ITEM, EndKind.OPTIONAL, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)), + DFN(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + DIV(BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), diff --git a/langtools/test/tools/doclint/html/InlineTagsTest.java b/langtools/test/tools/doclint/html/InlineTagsTest.java index 4835b36a9a0..5dda7c27c55 100644 --- a/langtools/test/tools/doclint/html/InlineTagsTest.java +++ b/langtools/test/tools/doclint/html/InlineTagsTest.java @@ -39,6 +39,7 @@ public class InlineTagsTest { *
    * abc * abc + * abc * abc * abc * abc From 026c5d762097591e6e60244ed4fd40cb80a5cd53 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 24 Sep 2013 10:51:28 -0700 Subject: [PATCH 218/983] 8025246: [doclint] doclint is showing error on anchor already defined when it's not Reviewed-by: bpatel --- .../com/sun/tools/doclint/Checker.java | 25 +++++++-- .../tools/doclint/anchorTests/p/Test.java | 53 +++++++++++++++++++ .../doclint/anchorTests/p/Test.javac.out | 7 +++ .../test/tools/doclint/anchorTests/p/Test.out | 19 +++++++ .../doclint/anchorTests/p/package-info.java | 15 ++++++ .../anchorTests/p/package-info.javac.out | 2 + .../doclint/anchorTests/p/package-info.out | 4 ++ 7 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 langtools/test/tools/doclint/anchorTests/p/Test.java create mode 100644 langtools/test/tools/doclint/anchorTests/p/Test.javac.out create mode 100644 langtools/test/tools/doclint/anchorTests/p/Test.out create mode 100644 langtools/test/tools/doclint/anchorTests/p/package-info.java create mode 100644 langtools/test/tools/doclint/anchorTests/p/package-info.javac.out create mode 100644 langtools/test/tools/doclint/anchorTests/p/package-info.out diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java index d7d8ada40f0..fad2e9f46d4 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java +++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java @@ -93,7 +93,7 @@ public class Checker extends DocTreePathScanner { Set foundParams = new HashSet<>(); Set foundThrows = new HashSet<>(); - Map> foundAnchors = new HashMap<>(); + Map> foundAnchors = new HashMap<>(); boolean foundInheritDoc = false; boolean foundReturn = false; @@ -576,13 +576,30 @@ public class Checker extends DocTreePathScanner { } private boolean checkAnchor(String name) { - JavaFileObject fo = env.currPath.getCompilationUnit().getSourceFile(); - Set set = foundAnchors.get(fo); + Element e = getEnclosingPackageOrClass(env.currElement); + if (e == null) + return true; + Set set = foundAnchors.get(e); if (set == null) - foundAnchors.put(fo, set = new HashSet<>()); + foundAnchors.put(e, set = new HashSet<>()); return set.add(name); } + private Element getEnclosingPackageOrClass(Element e) { + while (e != null) { + switch (e.getKind()) { + case CLASS: + case ENUM: + case INTERFACE: + case PACKAGE: + return e; + default: + e = e.getEnclosingElement(); + } + } + return e; + } + // http://www.w3.org/TR/html401/types.html#type-name private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*"); diff --git a/langtools/test/tools/doclint/anchorTests/p/Test.java b/langtools/test/tools/doclint/anchorTests/p/Test.java new file mode 100644 index 00000000000..131629d7ac6 --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/Test.java @@ -0,0 +1,53 @@ +/* @test /nodynamiccopyright/ + * @bug 8025246 + * @summary doclint is showing error on anchor already defined when it's not + * @library ../.. + * @build DocLintTester + * @run main DocLintTester -ref Test.out Test.java + * @compile/fail/ref=Test.javac.out -XDrawDiagnostics -Werror -Xdoclint:all Test.java + */ + +package p; + +/** + * dupTest + * dupTest again + * + * dupTestField + * dupTestMethod + + * okClass + * okField + * okMethod + */ +public class Test { + /** dupTestField again */ + public int f; + + /** dupTestMethod again */ + public void m() { } + + /** + * dupNested + * dupNested again + * dupNestedField + * dupNestedMethod + * + * okClass again + */ + public class Nested { + /** + * dupNestedField + * + * okField again + */ + public int f; + + /** + * dupNestedMethod + * + * okMethod again + */ + public void m() { } + } +} diff --git a/langtools/test/tools/doclint/anchorTests/p/Test.javac.out b/langtools/test/tools/doclint/anchorTests/p/Test.javac.out new file mode 100644 index 00000000000..44a723969eb --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/Test.javac.out @@ -0,0 +1,7 @@ +Test.java:14:7: compiler.err.proc.messager: anchor already defined: dupTest +Test.java:24:12: compiler.err.proc.messager: anchor already defined: dupTestField +Test.java:27:12: compiler.err.proc.messager: anchor already defined: dupTestMethod +Test.java:32:11: compiler.err.proc.messager: anchor already defined: dupNested +Test.java:40:15: compiler.err.proc.messager: anchor already defined: dupNestedField +Test.java:47:15: compiler.err.proc.messager: anchor already defined: dupNestedMethod +6 errors diff --git a/langtools/test/tools/doclint/anchorTests/p/Test.out b/langtools/test/tools/doclint/anchorTests/p/Test.out new file mode 100644 index 00000000000..6f39fcf1e28 --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/Test.out @@ -0,0 +1,19 @@ +Test.java:14: error: anchor already defined: dupTest + * dupTest again + ^ +Test.java:24: error: anchor already defined: dupTestField + /** dupTestField again */ + ^ +Test.java:27: error: anchor already defined: dupTestMethod + /** dupTestMethod again */ + ^ +Test.java:32: error: anchor already defined: dupNested + * dupNested again + ^ +Test.java:40: error: anchor already defined: dupNestedField + * dupNestedField + ^ +Test.java:47: error: anchor already defined: dupNestedMethod + * dupNestedMethod + ^ +6 errors diff --git a/langtools/test/tools/doclint/anchorTests/p/package-info.java b/langtools/test/tools/doclint/anchorTests/p/package-info.java new file mode 100644 index 00000000000..af7682a3676 --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/package-info.java @@ -0,0 +1,15 @@ +/* @test /nodynamiccopyright/ + * @bug 8025246 + * @summary doclint is showing error on anchor already defined when it's not + * @library ../.. + * @build DocLintTester + * @run main DocLintTester -ref package-info.out package-info.java + * @compile/fail/ref=package-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all package-info.java + */ + +/** + * here + * here again + */ +package p; + diff --git a/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out b/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out new file mode 100644 index 00000000000..0a859df5894 --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out @@ -0,0 +1,2 @@ +package-info.java:12:7: compiler.err.proc.messager: anchor already defined: here +1 error diff --git a/langtools/test/tools/doclint/anchorTests/p/package-info.out b/langtools/test/tools/doclint/anchorTests/p/package-info.out new file mode 100644 index 00000000000..dda1b19f0dd --- /dev/null +++ b/langtools/test/tools/doclint/anchorTests/p/package-info.out @@ -0,0 +1,4 @@ +package-info.java:12: error: anchor already defined: here + * here again + ^ +1 error From e762b2997d71aae9de597d0c74a8748a0187aed0 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 24 Sep 2013 11:46:25 -0700 Subject: [PATCH 219/983] 8025272: doclint needs to check for valid usage of @value tag Reviewed-by: bpatel --- .../com/sun/tools/doclint/Checker.java | 24 +++++++ .../doclint/resources/doclint.properties | 2 + langtools/test/tools/doclint/ValueTest.java | 67 +++++++++++++++++++ langtools/test/tools/doclint/ValueTest.out | 22 ++++++ 4 files changed, 115 insertions(+) create mode 100644 langtools/test/tools/doclint/ValueTest.java create mode 100644 langtools/test/tools/doclint/ValueTest.out diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java index fad2e9f46d4..c8d331a43c0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java +++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java @@ -44,6 +44,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Name; +import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.tools.Diagnostic.Kind; @@ -822,10 +823,33 @@ public class Checker extends DocTreePathScanner { @Override public Void visitValue(ValueTree tree, Void ignore) { + ReferenceTree ref = tree.getReference(); + if (ref == null || ref.getSignature().isEmpty()) { + if (!isConstant(env.currElement)) + env.messages.error(REFERENCE, tree, "dc.value.not.allowed.here"); + } else { + Element e = env.trees.getElement(new DocTreePath(getCurrentPath(), ref)); + if (!isConstant(e)) + env.messages.error(REFERENCE, tree, "dc.value.not.a.constant"); + } + markEnclosingTag(Flag.HAS_INLINE_TAG); return super.visitValue(tree, ignore); } + private boolean isConstant(Element e) { + if (e == null) + return false; + + switch (e.getKind()) { + case FIELD: + Object value = ((VariableElement) e).getConstantValue(); + return (value != null); // can't distinguish "not a constant" from "constant is null" + default: + return false; + } + } + @Override public Void visitVersion(VersionTree tree, Void ignore) { warnIfEmpty(tree, tree.getBody()); diff --git a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties index 37470976141..24c3aac76e6 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties +++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties @@ -68,6 +68,8 @@ dc.tag.start.unmatched = end tag missing: dc.tag.unknown = unknown tag: {0} dc.text.not.allowed = text not allowed in <{0}> element dc.unexpected.comment=documentation comment not expected here +dc.value.not.allowed.here='{@value}' not allowed here +dc.value.not.a.constant=value does not refer to a constant dc.main.ioerror=IO error: {0} dc.main.no.files.given=No files given diff --git a/langtools/test/tools/doclint/ValueTest.java b/langtools/test/tools/doclint/ValueTest.java new file mode 100644 index 00000000000..f9de36daf15 --- /dev/null +++ b/langtools/test/tools/doclint/ValueTest.java @@ -0,0 +1,67 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8025272 + * @summary doclint needs to check for valid usage of at-value tag + * @build DocLintTester + * @run main DocLintTester -ref ValueTest.out ValueTest.java + */ + +/** */ +public class ValueTest { + /* + * Tests for {@value} without a reference + */ + + /** valid: {@value} */ + public static final boolean cBoolean = false; + + /** valid: {@value} */ + public static final byte cByte = 0; + + /** valid: {@value} */ + public static final short cShort = 0; + + /** valid: {@value} */ + public static final int cInt = 0; + + /** valid: {@value} */ + public static final long cLong = 0L; + + /** valid: {@value} */ + public static final float cFloat = 0.0f; + + /** valid: {@value} */ + public static final double cDouble = 0.0; + + /** valid: {@value} */ + public static final String cString = ""; + + /** invalid class C: {@value} */ + public class C { } + + /** invalid enum E: {@value} */ + public enum E { + /** invalid enum constant E1: {@value} */ + E1 + } + + /** invalid field 1: {@value} */ + public int f1; + + /** invalid field 2: {@value} */ + public int f2 = 3; + + + /* + * Tests for {@value} with a reference + */ + + /** valid: {@value Integer#SIZE} */ + public int intRef; + + /** invalid method: {@value Object#toString} */ + public int badMethod; + + /** invalid enum constant: {@value Thread.State#NEW} */ + public int badEnum; +} diff --git a/langtools/test/tools/doclint/ValueTest.out b/langtools/test/tools/doclint/ValueTest.out new file mode 100644 index 00000000000..3b2977f9f72 --- /dev/null +++ b/langtools/test/tools/doclint/ValueTest.out @@ -0,0 +1,22 @@ +ValueTest.java:39: error: {@value} not allowed here + /** invalid class C: {@value} */ + ^ +ValueTest.java:42: error: {@value} not allowed here + /** invalid enum E: {@value} */ + ^ +ValueTest.java:44: error: {@value} not allowed here + /** invalid enum constant E1: {@value} */ + ^ +ValueTest.java:48: error: {@value} not allowed here + /** invalid field 1: {@value} */ + ^ +ValueTest.java:51: error: {@value} not allowed here + /** invalid field 2: {@value} */ + ^ +ValueTest.java:62: error: value does not refer to a constant + /** invalid method: {@value Object#toString} */ + ^ +ValueTest.java:65: error: value does not refer to a constant + /** invalid enum constant: {@value Thread.State#NEW} */ + ^ +7 errors From 48d1808d53cb8b4a4b841fc70081e4fcb2cb47c5 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 24 Sep 2013 13:48:12 -0700 Subject: [PATCH 220/983] 8002154: [doclint] doclint should check for issues which are errors in javadoc Reviewed-by: bpatel --- .../classes/com/sun/tools/doclint/Checker.java | 4 ++++ .../sun/tools/doclint/resources/doclint.properties | 1 + langtools/test/tools/doclint/ReferenceTest.java | 10 +++++++++- langtools/test/tools/doclint/ReferenceTest.out | 14 +++++++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java index c8d331a43c0..bc4b86b0a09 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java +++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java @@ -730,6 +730,10 @@ public class Checker extends DocTreePathScanner { @Override public Void visitReference(ReferenceTree tree, Void ignore) { + String sig = tree.getSignature(); + if (sig.contains("<") || sig.contains(">")) + env.messages.error(REFERENCE, tree, "dc.type.arg.not.allowed"); + Element e = env.trees.getElement(getCurrentPath()); if (e == null) env.messages.error(REFERENCE, tree, "dc.ref.not.found"); diff --git a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties index 24c3aac76e6..b51af2a7358 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties +++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties @@ -67,6 +67,7 @@ dc.tag.self.closing = self-closing element not allowed dc.tag.start.unmatched = end tag missing: dc.tag.unknown = unknown tag: {0} dc.text.not.allowed = text not allowed in <{0}> element +dc.type.arg.not.allowed = type arguments not allowed here dc.unexpected.comment=documentation comment not expected here dc.value.not.allowed.here='{@value}' not allowed here dc.value.not.a.constant=value does not refer to a constant diff --git a/langtools/test/tools/doclint/ReferenceTest.java b/langtools/test/tools/doclint/ReferenceTest.java index 57b26aeff24..1ffd633e866 100644 --- a/langtools/test/tools/doclint/ReferenceTest.java +++ b/langtools/test/tools/doclint/ReferenceTest.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8004832 8020556 + * @bug 8004832 8020556 8002154 * @summary Add new doclint package * @build DocLintTester * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java @@ -54,5 +54,13 @@ public class ReferenceTest { * @throws T description */ public void valid_throws_generic() throws T { } + + /** + * {@link java.util.List} + * {@link java.util.List#equals} + * @see java.util.List + * @see java.util.List#equals + */ + public void invalid_type_args() { } } diff --git a/langtools/test/tools/doclint/ReferenceTest.out b/langtools/test/tools/doclint/ReferenceTest.out index df21e5ef990..ab288a34b00 100644 --- a/langtools/test/tools/doclint/ReferenceTest.out +++ b/langtools/test/tools/doclint/ReferenceTest.out @@ -25,6 +25,18 @@ ReferenceTest.java:43: error: invalid use of @return ReferenceTest.java:48: error: exception not thrown: java.lang.Exception * @throws Exception description ^ -8 errors +ReferenceTest.java:59: error: type arguments not allowed here + * {@link java.util.List} + ^ +ReferenceTest.java:60: error: type arguments not allowed here + * {@link java.util.List#equals} + ^ +ReferenceTest.java:61: error: type arguments not allowed here + * @see java.util.List + ^ +ReferenceTest.java:62: error: type arguments not allowed here + * @see java.util.List#equals + ^ +12 errors 1 warning From c5bb090fff3b984b956bd42ed2663982db626400 Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Tue, 24 Sep 2013 14:17:42 -0700 Subject: [PATCH 221/983] 8025215: jdk8 l10n resource file translation update 4 Reviewed-by: naoto, yhuang --- .../apple/laf/resources/aqua_ko.properties | 2 +- .../resources/accessibility_de.properties | 2 +- .../resources/accessibility_es.properties | 2 +- .../resources/accessibility_fr.properties | 2 +- .../resources/accessibility_it.properties | 2 +- .../resources/accessibility_pt_BR.properties | 2 +- .../resources/accessibility_sv.properties | 2 +- .../plaf/motif/resources/motif_de.properties | 2 +- .../plaf/motif/resources/motif_ko.properties | 4 +- .../java/util/jar/pack/DriverResource_ja.java | 131 ++++++++++++++++++ .../util/jar/pack/DriverResource_zh_CN.java | 131 ++++++++++++++++++ .../rowset/RowSetResourceBundle_ko.properties | 6 +- .../plaf/basic/resources/basic_ko.properties | 4 +- .../plaf/metal/resources/metal_sv.properties | 4 +- .../applet/resources/MsgAppletViewer_de.java | 2 +- .../launcher/resources/launcher_de.properties | 4 +- .../launcher/resources/launcher_es.properties | 2 - .../launcher/resources/launcher_fr.properties | 4 +- .../launcher/resources/launcher_it.properties | 2 - .../launcher/resources/launcher_ja.properties | 8 +- .../launcher/resources/launcher_ko.properties | 7 +- .../resources/launcher_pt_BR.properties | 4 +- .../launcher/resources/launcher_sv.properties | 2 - .../resources/launcher_zh_CN.properties | 2 - .../resources/launcher_zh_TW.properties | 2 - .../print/resources/serviceui_de.properties | 18 +-- .../print/resources/serviceui_es.properties | 12 +- .../print/resources/serviceui_fr.properties | 16 +-- .../print/resources/serviceui_it.properties | 6 +- .../resources/serviceui_pt_BR.properties | 22 +-- .../print/resources/serviceui_sv.properties | 12 +- .../resources/rmiregistry_de.properties | 2 +- .../rmi/server/resources/rmid_ko.properties | 2 +- .../tools/jarsigner/Resources_ja.java | 40 +++--- .../tools/jarsigner/Resources_zh_CN.java | 8 +- .../security/tools/keytool/Resources_de.java | 20 +-- .../security/tools/keytool/Resources_es.java | 20 +-- .../security/tools/keytool/Resources_fr.java | 20 +-- .../security/tools/keytool/Resources_it.java | 18 ++- .../security/tools/keytool/Resources_ja.java | 16 ++- .../security/tools/keytool/Resources_ko.java | 18 ++- .../tools/keytool/Resources_pt_BR.java | 26 ++-- .../security/tools/keytool/Resources_sv.java | 22 +-- .../tools/keytool/Resources_zh_CN.java | 44 +++--- .../tools/keytool/Resources_zh_TW.java | 18 ++- .../tools/policytool/Resources_de.java | 5 +- .../tools/policytool/Resources_es.java | 3 + .../tools/policytool/Resources_fr.java | 3 + .../tools/policytool/Resources_it.java | 5 +- .../tools/policytool/Resources_ja.java | 3 + .../tools/policytool/Resources_ko.java | 3 + .../tools/policytool/Resources_pt_BR.java | 3 + .../tools/policytool/Resources_sv.java | 3 + .../tools/policytool/Resources_zh_CN.java | 21 +-- .../tools/policytool/Resources_zh_TW.java | 3 + .../sun/security/util/Resources_fr.java | 8 +- .../sun/tools/jar/resources/jar_de.properties | 5 +- .../sun/tools/jar/resources/jar_es.properties | 5 +- .../sun/tools/jar/resources/jar_fr.properties | 5 +- .../sun/tools/jar/resources/jar_it.properties | 5 +- .../sun/tools/jar/resources/jar_ja.properties | 5 +- .../sun/tools/jar/resources/jar_ko.properties | 7 +- .../tools/jar/resources/jar_pt_BR.properties | 9 +- .../sun/tools/jar/resources/jar_sv.properties | 3 +- .../tools/jar/resources/jar_zh_CN.properties | 3 +- .../tools/jar/resources/jar_zh_TW.properties | 5 +- .../jconsole/resources/messages_ja.properties | 17 ++- .../resources/messages_zh_CN.properties | 17 ++- 68 files changed, 583 insertions(+), 258 deletions(-) create mode 100644 jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java create mode 100644 jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java diff --git a/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties index 3fbfbe7e76e..82c4ce2f2dc 100644 --- a/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties +++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties @@ -46,7 +46,7 @@ FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5 FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30 FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 -FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0 +FileChooser.updateButton.textAndMnemonic=\uC5C5\uB370\uC774\uD2B8 FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0 FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties index fe0f918d9bf..45148664672 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties @@ -102,7 +102,7 @@ horizontal=horizontal # # accessible actions # -toggleexpand=ein-/ausblenden +toggleexpand=einblenden umschalten # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties index c3f90416a30..ce185a10dd1 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties @@ -102,7 +102,7 @@ horizontal=horizontal # # accessible actions # -toggleexpand=activar/desactivar ampliaci\u00F3n +toggleexpand=conmutar ampliaci\u00F3n # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties index c399d9a0b32..88e8ae304b4 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties @@ -102,7 +102,7 @@ horizontal=horizontal # # accessible actions # -toggleexpand=basculer le d\u00E9veloppement +toggleexpand=activer/d\u00E9sactiver d\u00E9veloppement # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties index 94eefb0a2a3..a8af9705d19 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties @@ -102,7 +102,7 @@ horizontal=orizzontale # # accessible actions # -toggleexpand=abilita/disabilita espansione +toggleexpand=attiva/disattiva espansione # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties index f8aaf355040..638b46a7219 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties @@ -102,7 +102,7 @@ horizontal=horizontal # # accessible actions # -toggleexpand=alternar expans\u00E3o +toggleexpand=alternar expandir # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties index 962b9d35dc5..3261b2c9be3 100644 --- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties +++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties @@ -102,7 +102,7 @@ horizontal=horisontell # # accessible actions # -toggleexpand=v\u00E4xla ut\u00F6ka +toggleexpand=v\u00E4xla expandering # new relations, roles and states for J2SE 1.5.0 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties index 43ba5b6d32b..0c177f8b122 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties @@ -30,7 +30,7 @@ FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnername eingeben: FileChooser.filterLabel.textAndMnemonic=Filte&r FileChooser.foldersLabel.textAndMnemonic=Ord&ner FileChooser.filesLabel.textAndMnemonic=Date&ien -FileChooser.enterFileNameLabel.textAndMnemonic=Dateiname ei&ngeben: +FileChooser.enterFileNameLabel.textAndMnemonic=Dateina&me eingeben: FileChooser.enterFolderNameLabel.textAndMnemonic=Ordnernamen eingeben: FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties index f7e2625e9c9..7090ef5a7c4 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties @@ -24,7 +24,7 @@ FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5 FileChooser.openButton.textAndMnemonic=\uD655\uC778 FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 -FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0 +FileChooser.updateButton.textAndMnemonic=\uC5C5\uB370\uC774\uD2B8 FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0 FileChooser.pathLabel.textAndMnemonic=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825(&P): FileChooser.filterLabel.textAndMnemonic=\uD544\uD130(&R) @@ -36,5 +36,5 @@ FileChooser.enterFolderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984 \uC78 FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4. FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4. FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4. -FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uAC31\uC2E0\uD569\uB2C8\uB2E4. +FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4. FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0\uC785\uB2C8\uB2E4. diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java new file mode 100644 index 00000000000..de35d5ac0eb --- /dev/null +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java @@ -0,0 +1,131 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.java.util.jar.pack; + +import java.util.ListResourceBundle; + +public class DriverResource_ja extends ListResourceBundle { + public static final String VERSION ="VERSION"; + public static final String BAD_ARGUMENT ="BAD_ARGUMENT"; + public static final String BAD_OPTION ="BAD_OPTION"; + public static final String BAD_REPACK_OUTPUT="BAD_REPACK_OUTPUT"; + public static final String DETECTED_ZIP_COMMENT="DETECTED_ZIP_COMMENT"; + public static final String SKIP_FOR_REPACKED ="SKIP_FOR_REPACKED"; + public static final String WRITE_PACK_FILE ="WRITE_PACK_FILE"; + public static final String WIRTE_PACKGZ_FILE="WIRTE_PACKGZ_FILE"; + public static final String SKIP_FOR_MOVE_FAILED="SKIP_FOR_MOVE_FAILED"; + public static final String PACK_HELP="PACK_HELP"; + public static final String UNPACK_HELP ="UNPACK_HELP"; + public static final String MORE_INFO = "MORE_INFO"; + public static final String DUPLICATE_OPTION = "DUPLICATE_OPTION"; + public static final String BAD_SPEC = "BAD_SPEC"; + + //The following string is duplicate in PACK and UNPACK comment,which was draw out to ruduce translation work. + private static final String PARAMETER_V = " -v, --verbose increase program verbosity"; + private static final String PARAMETER_Q = " -q, --quiet set verbosity to lowest level"; + private static final String PARAMETER_LF = " -l{F}, --log-file={F} output to the given log file, or '-' for System.out"; + private static final String PARAMETER_H = " -?, -h, --help print this message"; + private static final String PARAMETER_VER = " -V, --version print program version"; + private static final String PARAMETER_J = " -J{X} pass option X to underlying Java VM"; + + + //The following are outputs of command 'pack200' and 'unpack200'. + //Don't translate command arguments ,words with a prefix of '-' or '--'. + // + private static final Object[][] resource= { + {VERSION,"{0}\u30D0\u30FC\u30B8\u30E7\u30F3{1}"},//parameter 0:class name;parameter 1: version value + {BAD_ARGUMENT,"\u7121\u52B9\u306A\u5F15\u6570: {0}"}, + {BAD_OPTION,"\u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}={1}"},//parameter 0:option name;parameter 1:option value + {BAD_REPACK_OUTPUT,"\u7121\u52B9\u306A--repack\u51FA\u529B: {0}"},//parameter 0:filename + {DETECTED_ZIP_COMMENT,"\u691C\u51FA\u3055\u308C\u305FZIP\u30B3\u30E1\u30F3\u30C8: {0}"},//parameter 0:comment + {SKIP_FOR_REPACKED,"\u3059\u3067\u306B\u518D\u5727\u7E2E\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u30B9\u30AD\u30C3\u30D7\u3057\u3066\u3044\u307E\u3059: {0}"},//parameter 0:filename + {WRITE_PACK_FILE,"*.pack\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\u306B\u306F\u3001--no-gzip\u3092\u6307\u5B9A\u3057\u307E\u3059: {0}"},//parameter 0:filename + {WIRTE_PACKGZ_FILE,"*.pack.gz\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\u306B\u306F\u3001--gzip\u3092\u6307\u5B9A\u3057\u307E\u3059: {0}"},//parameter 0:filename + {SKIP_FOR_MOVE_FAILED,"\u79FB\u52D5\u304C\u5931\u6557\u3057\u305F\u305F\u3081\u89E3\u51CD\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u3066\u3044\u307E\u3059: {0}"},//parameter 0:filename + {PACK_HELP,new String[]{ + "\u4F7F\u7528\u65B9\u6CD5: pack200 [-opt... | --option=value]... x.pack[.gz] y.jar", + "", + "\u5727\u7E2E\u30AA\u30D7\u30B7\u30E7\u30F3", + " -g\u3001--no-gzip \u30D7\u30EC\u30FC\u30F3\u306A*.pack\u30D5\u30A1\u30A4\u30EB\u3092\u5727\u7E2E\u305B\u305A\u306B\u51FA\u529B\u3057\u307E\u3059", + " --gzip (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5727\u7E2E\u51FA\u529B\u3092gzip\u3067\u5F8C\u51E6\u7406\u3057\u307E\u3059", + " -G\u3001--strip-debug \u5727\u7E2E\u4E2D\u306B\u30C7\u30D0\u30C3\u30B0\u5C5E\u6027\u3092\u524A\u9664\u3057\u307E\u3059", + " -O\u3001--no-keep-file-order \u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u60C5\u5831\u3092\u8EE2\u9001\u3057\u307E\u305B\u3093", + " --keep-file-order (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u3092\u4FDD\u6301\u3057\u307E\u3059", + " -S{N}\u3001--segment-limit={N} \u30BB\u30B0\u30E1\u30F3\u30C8\u5236\u9650\u3092\u51FA\u529B\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8N=1Mb)", + " -E{N}\u3001--effort={N} \u5727\u7E2E\u306E\u8A66\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8N=5)", + " -H{h}\u3001--deflate-hint={h} \u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u8EE2\u9001\u3057\u307E\u3059: true\u3001false\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)", + " -m{V}\u3001--modification-time={V} \u5909\u66F4\u6642\u9593\u3092\u8EE2\u9001\u3057\u307E\u3059: latest\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)", + " -P{F}\u3001--pass-file={F} \u6307\u5B9A\u3055\u308C\u305F\u5727\u7E2E\u3055\u308C\u3066\u3044\u306A\u3044\u5165\u529B\u8981\u7D20\u3092\u8EE2\u9001\u3057\u307E\u3059", + " -U{a}\u3001--unknown-attribute={a} \u4E0D\u660E\u306E\u5C5E\u6027\u30A2\u30AF\u30B7\u30E7\u30F3: error\u3001strip\u307E\u305F\u306Fpass(\u30C7\u30D5\u30A9\u30EB\u30C8)", + " -C{N}={L}\u3001--class-attribute={N}={L} (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)", + " -F{N}={L}\u3001--field-attribute={N}={L} (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)", + " -M{N}={L}\u3001--method-attribute={N}={L} (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)", + " -D{N}={L}\u3001--code-attribute={N}={L} (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)", + " -f{F}\u3001--config-file={F} Pack200.Packer\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u30D5\u30A1\u30A4\u30EBF\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059", + PARAMETER_V , + PARAMETER_Q , + PARAMETER_LF , + PARAMETER_H , + PARAMETER_VER , + PARAMETER_J, + "", + "\u6CE8\u610F:", + " -P\u3001-C\u3001-F\u3001-M\u304A\u3088\u3073-D\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u7D2F\u7A4D\u3055\u308C\u307E\u3059\u3002", + " \u5C5E\u6027\u5B9A\u7FA9\u306E\u4F8B: -C SourceFile=RUH .", + " Config.\u30D5\u30A1\u30A4\u30EB\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u3001Pack200 API\u306B\u3088\u3063\u3066\u5B9A\u7FA9\u3055\u308C\u307E\u3059\u3002", + " -S\u3001-E\u3001-H\u3001-m\u3001-U\u306E\u5024\u306E\u610F\u5473\u306F\u3001Pack200 API\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002", + " \u30EC\u30A4\u30A2\u30A6\u30C8\u5B9A\u7FA9(RUH\u306A\u3069)\u306FJSR 200\u306B\u3088\u3063\u3066\u5B9A\u7FA9\u3055\u308C\u307E\u3059\u3002", + "", + "\u518D\u5727\u7E2E\u30E2\u30FC\u30C9\u3067\u306F\u3001JAR\u30D5\u30A1\u30A4\u30EB\u304C\u5727\u7E2E/\u89E3\u51CD\u30B5\u30A4\u30AF\u30EB\u3067\u66F4\u65B0\u3055\u308C\u307E\u3059:", + " pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n" + } + }, + {UNPACK_HELP,new String[]{ + "\u4F7F\u7528\u65B9\u6CD5: unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n", + "", + "\u89E3\u51CD\u30AA\u30D7\u30B7\u30E7\u30F3", + " -H{h}\u3001--deflate-hint={h} \u8EE2\u9001\u3055\u308C\u305F\u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059: true\u3001false\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)", + " -r\u3001--remove-pack-file \u89E3\u51CD\u5F8C\u306B\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3057\u307E\u3059", + PARAMETER_V , + PARAMETER_Q , + PARAMETER_LF , + PARAMETER_H , + PARAMETER_VER , + PARAMETER_J, + } + }, + + {MORE_INFO,"(\u8A73\u7D30\u306F\u3001{0} --help\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002)"},//parameter 0:command name + {DUPLICATE_OPTION,"\u91CD\u8907\u30AA\u30D7\u30B7\u30E7\u30F3: {0}"},//parameter 0:option + {BAD_SPEC,"{0}\u306E\u7121\u52B9\u306A\u4ED5\u69D8: {1}"},//parameter 0:option;parameter 1:specifier + }; + + protected Object[][] getContents() { + return resource; + } + + +} diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java new file mode 100644 index 00000000000..25cc710e61f --- /dev/null +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java @@ -0,0 +1,131 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.java.util.jar.pack; + +import java.util.ListResourceBundle; + +public class DriverResource_zh_CN extends ListResourceBundle { + public static final String VERSION ="VERSION"; + public static final String BAD_ARGUMENT ="BAD_ARGUMENT"; + public static final String BAD_OPTION ="BAD_OPTION"; + public static final String BAD_REPACK_OUTPUT="BAD_REPACK_OUTPUT"; + public static final String DETECTED_ZIP_COMMENT="DETECTED_ZIP_COMMENT"; + public static final String SKIP_FOR_REPACKED ="SKIP_FOR_REPACKED"; + public static final String WRITE_PACK_FILE ="WRITE_PACK_FILE"; + public static final String WIRTE_PACKGZ_FILE="WIRTE_PACKGZ_FILE"; + public static final String SKIP_FOR_MOVE_FAILED="SKIP_FOR_MOVE_FAILED"; + public static final String PACK_HELP="PACK_HELP"; + public static final String UNPACK_HELP ="UNPACK_HELP"; + public static final String MORE_INFO = "MORE_INFO"; + public static final String DUPLICATE_OPTION = "DUPLICATE_OPTION"; + public static final String BAD_SPEC = "BAD_SPEC"; + + //The following string is duplicate in PACK and UNPACK comment,which was draw out to ruduce translation work. + private static final String PARAMETER_V = " -v, --verbose increase program verbosity"; + private static final String PARAMETER_Q = " -q, --quiet set verbosity to lowest level"; + private static final String PARAMETER_LF = " -l{F}, --log-file={F} output to the given log file, or '-' for System.out"; + private static final String PARAMETER_H = " -?, -h, --help print this message"; + private static final String PARAMETER_VER = " -V, --version print program version"; + private static final String PARAMETER_J = " -J{X} pass option X to underlying Java VM"; + + + //The following are outputs of command 'pack200' and 'unpack200'. + //Don't translate command arguments ,words with a prefix of '-' or '--'. + // + private static final Object[][] resource= { + {VERSION,"{0}\u7248\u672C{1}"},//parameter 0:class name;parameter 1: version value + {BAD_ARGUMENT,"\u9519\u8BEF\u53C2\u6570: {0}"}, + {BAD_OPTION,"\u9519\u8BEF\u9009\u9879: {0}={1}"},//parameter 0:option name;parameter 1:option value + {BAD_REPACK_OUTPUT,"--repack \u8F93\u51FA\u9519\u8BEF: {0}"},//parameter 0:filename + {DETECTED_ZIP_COMMENT,"\u68C0\u6D4B\u5230 ZIP \u6CE8\u91CA: {0}"},//parameter 0:comment + {SKIP_FOR_REPACKED,"\u7531\u4E8E\u5DF2\u91CD\u65B0\u6253\u5305\u800C\u8DF3\u8FC7: {0}"},//parameter 0:filename + {WRITE_PACK_FILE,"\u8981\u5199\u5165 *.pack \u6587\u4EF6, \u8BF7\u6307\u5B9A --no-gzip: {0}"},//parameter 0:filename + {WIRTE_PACKGZ_FILE,"\u8981\u5199\u5165 *.pack.gz \u6587\u4EF6, \u8BF7\u6307\u5B9A --gzip: {0}"},//parameter 0:filename + {SKIP_FOR_MOVE_FAILED,"\u7531\u4E8E\u79FB\u52A8\u5931\u8D25\u800C\u8DF3\u8FC7\u91CD\u65B0\u6253\u5305: {0}"},//parameter 0:filename + {PACK_HELP,new String[]{ + "\u7528\u6CD5: pack200 [-opt... | --option=value]... x.pack[.gz] y.jar", + "", + "\u6253\u5305\u9009\u9879", + " -g, --no-gzip \u8F93\u51FA\u65E0\u683C\u5F0F\u7684 *.pack \u6587\u4EF6, \u4E0D\u538B\u7F29", + " --gzip (\u9ED8\u8BA4\u503C) \u4F7F\u7528 gzip \u5BF9\u6253\u5305\u8FDB\u884C\u540E\u5904\u7406", + " -G, --strip-debug \u6253\u5305\u65F6\u5220\u9664\u8C03\u8BD5\u5C5E\u6027", + " -O, --no-keep-file-order \u4E0D\u4F20\u8F93\u6587\u4EF6\u6392\u5E8F\u4FE1\u606F", + " --keep-file-order (\u9ED8\u8BA4\u503C) \u4FDD\u7559\u8F93\u5165\u6587\u4EF6\u6392\u5E8F", + " -S{N}, --segment-limit={N} \u8F93\u51FA\u6BB5\u9650\u5236 (\u9ED8\u8BA4\u503C N=1Mb)", + " -E{N}, --effort={N} \u6253\u5305\u6548\u679C (\u9ED8\u8BA4\u503C N=5)", + " -H{h}, --deflate-hint={h} \u4F20\u8F93\u538B\u7F29\u63D0\u793A: true, false \u6216 keep (\u9ED8\u8BA4\u503C)", + " -m{V}, --modification-time={V} \u4F20\u8F93 modtimes: latest \u6216 keep (\u9ED8\u8BA4\u503C)", + " -P{F}, --pass-file={F} \u4F20\u8F93\u672A\u89E3\u538B\u7F29\u7684\u7ED9\u5B9A\u8F93\u5165\u5143\u7D20", + " -U{a}, --unknown-attribute={a} \u672A\u77E5\u5C5E\u6027\u64CD\u4F5C: error, strip \u6216 pass (\u9ED8\u8BA4\u503C)", + " -C{N}={L}, --class-attribute={N}={L} (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)", + " -F{N}={L}, --field-attribute={N}={L} (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)", + " -M{N}={L}, --method-attribute={N}={L} (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)", + " -D{N}={L}, --code-attribute={N}={L} (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)", + " -f{F}, --config-file={F} \u8BFB\u53D6\u6587\u4EF6 F \u7684 Pack200.Packer \u5C5E\u6027", + PARAMETER_V , + PARAMETER_Q , + PARAMETER_LF , + PARAMETER_H , + PARAMETER_VER , + PARAMETER_J, + "", + "\u6CE8:", + " -P, -C, -F, -M \u548C -D \u9009\u9879\u7D2F\u8BA1\u3002", + " \u793A\u4F8B\u5C5E\u6027\u5B9A\u4E49: -C SourceFile=RUH\u3002", + " Config. \u6587\u4EF6\u5C5E\u6027\u7531 Pack200 API \u5B9A\u4E49\u3002", + " \u6709\u5173 -S, -E, -H-, -m, -U \u503C\u7684\u542B\u4E49, \u8BF7\u53C2\u9605 Pack200 API\u3002", + " \u5E03\u5C40\u5B9A\u4E49 (\u4F8B\u5982 RUH) \u7531 JSR 200 \u5B9A\u4E49\u3002", + "", + "\u91CD\u65B0\u6253\u5305\u6A21\u5F0F\u901A\u8FC7\u6253\u5305/\u89E3\u5305\u5468\u671F\u66F4\u65B0 JAR \u6587\u4EF6:", + " pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n" + } + }, + {UNPACK_HELP,new String[]{ + "\u7528\u6CD5: unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n", + "", + "\u89E3\u5305\u9009\u9879", + " -H{h}, --deflate-hint={h} \u8986\u76D6\u5DF2\u4F20\u8F93\u7684\u538B\u7F29\u63D0\u793A: true, false \u6216 keep (\u9ED8\u8BA4\u503C)", + " -r, --remove-pack-file \u89E3\u5305\u4E4B\u540E\u5220\u9664\u8F93\u5165\u6587\u4EF6", + PARAMETER_V , + PARAMETER_Q , + PARAMETER_LF , + PARAMETER_H , + PARAMETER_VER , + PARAMETER_J, + } + }, + + {MORE_INFO,"(\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u8FD0\u884C {0} --help\u3002)"},//parameter 0:command name + {DUPLICATE_OPTION,"\u91CD\u590D\u7684\u9009\u9879: {0}"},//parameter 0:option + {BAD_SPEC,"{0}\u7684\u89C4\u8303\u9519\u8BEF: {1}"},//parameter 0:option;parameter 1:specifier + }; + + protected Object[][] getContents() { + return resource; + } + + +} diff --git a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties index 3dd9ee0d1b9..89bbf67ec53 100644 --- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties +++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties @@ -44,7 +44,7 @@ cachedrowsetimpl.doublefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getDouble cachedrowsetimpl.dtypemismt = \uB370\uC774\uD130 \uC720\uD615\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. cachedrowsetimpl.datefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getDate\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uBCC0\uD658\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. cachedrowsetimpl.timefail = {1} \uC5F4\uC758 \uAC12({0})\uC5D0\uC11C getTime\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uBCC0\uD658\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. -cachedrowsetimpl.posupdate = \uC704\uCE58\uAC00 \uC9C0\uC815\uB41C \uAC31\uC2E0\uC774 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. +cachedrowsetimpl.posupdate = \uC704\uCE58\uAC00 \uC9C0\uC815\uB41C \uC5C5\uB370\uC774\uD2B8\uAC00 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. cachedrowsetimpl.unableins = \uC778\uC2A4\uD134\uC2A4\uD654\uD560 \uC218 \uC5C6\uC74C: {0} cachedrowsetimpl.beforefirst = beforeFirst: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. cachedrowsetimpl.first = \uCC98\uC74C: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. @@ -110,7 +110,7 @@ jdbcrowsetimpl.matchcols2 = \uC77C\uCE58 \uC5F4\uC740 \uB110 \uB610\uB294 \uBE48 jdbcrowsetimpl.unsetmatch = \uC124\uC815\uC744 \uD574\uC81C\uD558\uB824\uB294 \uC5F4\uC774 \uC124\uC815\uB41C \uC5F4\uACFC \uB2E4\uB985\uB2C8\uB2E4. jdbcrowsetimpl.usecolname = \uC5F4 \uC774\uB984\uC744 unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624. jdbcrowsetimpl.usecolid = \uC5F4 ID\uB97C unsetMatchColumn\uC758 \uC778\uC218\uB85C \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624. -jdbcrowsetimpl.resnotupd = ResultSet\uB97C \uAC31\uC2E0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +jdbcrowsetimpl.resnotupd = ResultSet\uB97C \uC5C5\uB370\uC774\uD2B8\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. jdbcrowsetimpl.opnotysupp = \uC791\uC5C5\uC774 \uC544\uC9C1 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. jdbcrowsetimpl.featnotsupp = \uAE30\uB2A5\uC774 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. @@ -157,7 +157,7 @@ xmlrch.errdel = \uD589\uC744 \uC0AD\uC81C\uD558\uB294 \uC911 \uC624\uB958 \uBC1C xmlrch.errinsert = insert \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0} xmlrch.errinsdel = insdel \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0} xmlrch.errupdate = update \uD589\uC744 \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0} -xmlrch.errupdrow = \uD589\uC744 \uAC31\uC2E0\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0} +xmlrch.errupdrow = \uD589\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: {0} xmlrch.chars = \uBB38\uC790: xmlrch.badvalue = \uC798\uBABB\uB41C \uAC12: \uB110\uC77C \uC218 \uC5C6\uB294 \uC18D\uC131\uC785\uB2C8\uB2E4. xmlrch.badvalue1 = \uC798\uBABB\uB41C \uAC12: \uB110\uC77C \uC218 \uC5C6\uB294 \uBA54\uD0C0 \uB370\uC774\uD130\uC785\uB2C8\uB2E4. diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties index 86f010204dc..a8504f7872c 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties @@ -46,7 +46,7 @@ FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5(&S) FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30(&O) FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 -FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0(&U) +FileChooser.updateButton.textAndMnemonic=\uC5C5\uB370\uC774\uD2B8(&U) FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0(&H) FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30(&O) @@ -66,7 +66,7 @@ FileChooser.other.newFolder.subsequent=NewFolder.{0} FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790 \uC911\uB2E8 FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C \uC800\uC7A5 FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C \uC5F4\uAE30 -FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D \uAC31\uC2E0 +FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D \uC5C5\uB370\uC774\uD2B8 FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uB514\uB809\uD1A0\uB9AC \uC5F4\uAE30 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties index 3d799b58a80..1b9b7e217c7 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties @@ -20,8 +20,8 @@ FileChooser.lookInLabel.textAndMnemonic=Leta &i: FileChooser.saveInLabel.textAndMnemonic=Spara i: -FileChooser.fileNameLabel.textAndMnemonic=Fil&namn: -FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn: +FileChooser.fileNameLabel.textAndMnemonic=&Fil: +FileChooser.folderNameLabel.textAndMnemonic=&Mapp: FileChooser.filesOfTypeLabel.textAndMnemonic=Mapp&namn: FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5 FileChooser.upFolderAccessibleName=Upp diff --git a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java index 7163bb5b1a1..b99d3bbd75d 100644 --- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java +++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java @@ -73,7 +73,7 @@ public class MsgAppletViewer_de extends ListResourceBundle { {"appletviewer.parse.warning.embed.requiresheight", "Warnung: F\u00FCr -Tag ist ein \"height\"-Attribut erforderlich."}, {"appletviewer.parse.warning.embed.requireswidth", "Warnung: F\u00FCr -Tag ist ein \"width\"-Attribut erforderlich."}, {"appletviewer.parse.warning.appnotLongersupported", "Warnung: -Tag wird nicht mehr unterst\u00FCtzt. Verwenden Sie stattdessen :"}, - {"appletviewer.usage", "Verwendung: appletviewer url(s)\n\nwobei die Folgendes umfassen:\n -debug Applet Viewer im Java-Debugger starten\n -encoding Zeichencodierung f\u00FCr HTML-Dateien angeben\n -J Argument an den Java-Interpreter \u00FCbergeben\n\nDie Option \"-J\" ist nicht standardm\u00E4\u00DFig und kann ohne vorherige Ank\u00FCndigung ge\u00E4ndert werden."}, + {"appletviewer.usage", "Verwendung: appletviewer url(s)\n\nwobei die Folgendes umfassen:\n -debug Applet Viewer im Java-Debugger starten\n -encoding Zeichencodierung f\u00FCr HTML-Dateien angeben\n -J Argument an den Java-Interpreter \u00FCbergeben\n\nDie Option \"-J\" ist nicht standardm\u00E4\u00DFig und kann ohne vorherige Ank\u00FCndigung ge\u00E4ndert werden."}, {"appletviewer.main.err.unsupportedopt", "Nicht unterst\u00FCtzte Option: {0}"}, {"appletviewer.main.err.unrecognizedarg", "Unbekanntes Argument: {0}"}, {"appletviewer.main.err.dupoption", "Doppelte Verwendung von Option: {0}"}, diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties index 4d5ef284277..9720e4626bc 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties @@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ Die Standard-VM ist {0} java.launcher.ergo.message2 =\ weil die Ausf\u00FChrung auf einem Server-Class-Rechner erfolgt.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \n -classpath \n Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n und ZIP-Archiven zur Suche nach Klassendateien.\n -D=\n Legt eine Systemeigenschaft fest\n -verbose[:class|gc|jni]\n Aktiviert die Verbose-Ausgabe\n -version Druckt Produktversion und beendet das Programm\n -version:\n Erfordert die angegebene Version zur Ausf\u00FChrung\n -showversion Druckt Produktversion und f\u00E4hrt fort\n -jre-restrict-search | -no-jre-restrict-search\n Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n -? -help Druckt diese Hilfemeldung\n -X Druckt Hilfe zu Nicht-Standardoptionen\n -ea[:...|:]\n -enableassertions[:...|:]\n Aktiviert Assertionen mit angegebener Granularit\u00E4t\n -da[:...|:]\n -disableassertions[:...|:]\n Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n -esa | -enablesystemassertions\n Aktiviert Systemassertionen\n -dsa | -disablesystemassertions\n Deaktiviert Systemassertionen\n -agentlib:[=]\n L\u00E4dt native Agent Library , z.B. -agentlib:hprof\n siehe auch -agentlib:jdwp=help und -agentlib:hprof=help\n -agentpath:[=]\n L\u00E4dt native Agent Library nach vollem Pfadnamen\n -javaagent:[=]\n L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:\n Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html +java.launcher.opt.footer =\ -cp \n -classpath \n Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n und ZIP-Archiven zur Suche nach Klassendateien.\n -D=\n Legt eine Systemeigenschaft fest\n -verbose:[class|gc|jni]\n Aktiviert die Verbose-Ausgabe\n -version Druckt Produktversion und beendet das Programm\n -version:\n Erfordert die angegebene Version zur Ausf\u00FChrung\n -showversion Druckt Produktversion und f\u00E4hrt fort\n -jre-restrict-search | -no-jre-restrict-search\n Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n -? -help Druckt diese Hilfemeldung\n -X Druckt Hilfe zu Nicht-Standardoptionen\n -ea[:...|:]\n -enableassertions[:...|:]\n Aktiviert Assertionen mit angegebener Granularit\u00E4t\n -da[:...|:]\n -disableassertions[:...|:]\n Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n -esa | -enablesystemassertions\n Aktiviert Systemassertionen\n -dsa | -disablesystemassertions\n Deaktiviert Systemassertionen\n -agentlib:[=]\n L\u00E4dt native Agent Library , z.B. -agentlib:hprof\n siehe auch -agentlib:jdwp=help und -agentlib:hprof=help\n -agentpath:[=]\n L\u00E4dt native Agent Library nach vollem Pfadnamen\n -javaagent:[=]\n L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:\n Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed Ausf\u00FChrung im gemischten Modus (Standard)\n -Xint Nur Ausf\u00FChrung im interpretierten Modus\n -Xbootclasspath:\n Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n -Xbootclasspath/a:\n H\u00E4ngt an das Ende des Bootstrap Classpath an\n -Xbootclasspath/p:\n Stellt Bootstrap Classpath voran\n -Xdiag Zeigt zus\u00E4tzliche Diagnosemeldungen an\n -Xnoclassgc Deaktiviert Klassen-Garbage Collection\n -Xincgc Aktiviert inkrementelle Garbage Collection\n -Xloggc: Loggt GC-Status in einer Datei mit Zeitstempeln\n -Xbatch Deaktiviert Hintergrundkompilierung\n -Xms Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n -Xmx Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n -Xss Legt Java-Thread-Stackgr\u00F6\u00DFe fest\n -Xprof Gibt CPU-Profiling-Daten aus\n -Xfuture Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n -Xrs Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n -Xcheck:jni F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n -Xshare:off Kein Versuch, gemeinsame Klassendaten zu verwenden\n -Xshare:auto Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n -Xshare:on Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n -XshowSettings Zeigt alle Einstellungen und f\u00E4hrt fort\n -XshowSettings:all\n Zeigt alle Einstellungen und f\u00E4hrt fort\n -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n -XshowSettings:properties\n Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n -XshowSettings:locale\n Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n @@ -50,7 +50,5 @@ java.launcher.cls.error5=Fehler: Zum Ausf\u00FChren dieser Anwendung ben\u00F6ti java.launcher.jar.error1=Fehler: Beim Versuch, Datei {0} zu \u00F6ffnen, ist ein unerwarteter Fehler aufgetreten java.launcher.jar.error2=Manifest in {0} nicht gefunden java.launcher.jar.error3=kein Hauptmanifestattribut, in {0} -java.launcher.jar.error4=kein Profilmanifestattribut in {0} -java.launcher.jar.error5=Das f\u00FCr {1} erforderliche Profil {0} wird von dieser Runtime-Anwendung nicht unterst\u00FCtzt java.launcher.init.error=Initialisierungsfehler java.launcher.javafx.error1=Fehler: Die JavaFX-Methode launchApplication hat die falsche Signatur, sie\nmuss als statisch deklariert werden und einen Wert vom Typ VOID zur\u00FCckgeben diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties index 1aefa5f0194..b2bdab3f63d 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties @@ -50,7 +50,5 @@ java.launcher.cls.error5=Error: faltan los componentes de JavaFX runtime y son n java.launcher.jar.error1=Error: se ha producido un error inesperado al intentar abrir el archivo {0} java.launcher.jar.error2=no se ha encontrado el manifiesto en {0} java.launcher.jar.error3=no hay ning\u00FAn atributo de manifiesto principal en {0} -java.launcher.jar.error4=no hay ning\u00FAn atributo de manifiesto de perfil en {0} -java.launcher.jar.error5=El perfil {0} que necesita {1} no est\u00E1 soportado por este tiempo de ejecuci\u00F3n java.launcher.init.error=error de inicializaci\u00F3n java.launcher.javafx.error1=Error: el m\u00E9todo launchApplication de JavaFX tiene una firma que no es correcta.\\nSe debe declarar est\u00E1tico y devolver un valor de tipo nulo diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties index 6e5d9891828..11f64e009fa 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties @@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ La machine virtuelle par d\u00E java.launcher.ergo.message2 =\ car vous ex\u00E9cutez une machine de classe de serveur.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \n -classpath \n Liste de r\u00E9pertoires, d''archives JAR et\n d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n -D=\n d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n -verbose[:class|gc|jni]\n activation de la sortie en mode verbose\n -version impression de la version du produit et fin de l''op\u00E9ration\n -version:\n ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n -showversion impression de la version du produit et poursuite de l''op\u00E9ration\n -jre-restrict-search | -no-jre-restrict-search\n inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n -? -help impression du message d''aide\n -X impression de l''aide sur les options non standard\n -ea[:...|:]\n -enableassertions[:...|:]\n activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -da[:...|:]\n -disableassertions[:...|:]\n d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -esa | -enablesystemassertions\n activation des assertions syst\u00E8me\n -dsa | -disablesystemassertions\n d\u00E9sactivation des assertions syst\u00E8me\n -agentlib:[=]\n chargement de la biblioth\u00E8que d''agent natif , par exemple -agentlib:hprof\n voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n -agentpath:[=]\n chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n -javaagent:[=]\n chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n -splash:\n affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://www.oracle.com/technetwork/java/javase/documentation/index.html pour plus de d\u00E9tails. +java.launcher.opt.footer =\ -cp \n -classpath \n Liste de r\u00E9pertoires, d''archives JAR et\n d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n -D=\n d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n -verbose:[class|gc|jni]\n activation de la sortie en mode verbose\n -version impression de la version du produit et fin de l''op\u00E9ration\n -version:\n ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n -showversion impression de la version du produit et poursuite de l''op\u00E9ration\n -jre-restrict-search | -no-jre-restrict-search\n inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n -? -help impression du message d''aide\n -X impression de l''aide sur les options non standard\n -ea[:...|:]\n -enableassertions[:...|:]\n activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -da[:...|:]\n -disableassertions[:...|:]\n d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n -esa | -enablesystemassertions\n activation des assertions syst\u00E8me\n -dsa | -disablesystemassertions\n d\u00E9sactivation des assertions syst\u00E8me\n -agentlib:[=]\n chargement de la biblioth\u00E8que d''agent natif , par exemple -agentlib:hprof\n voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n -agentpath:[=]\n chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n -javaagent:[=]\n chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n -splash:\n affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://www.oracle.com/technetwork/java/javase/documentation/index.html pour plus de d\u00E9tails. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n -Xint ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n -Xbootclasspath:\n d\u00E9finition du chemin de recherche pour les ressources et classes bootstrap\n -Xbootclasspath/a:\n ajout \u00E0 la fin du chemin de classe bootstrap\n -Xbootclasspath/p:\n ajout au d\u00E9but du chemin de classe bootstrap\n -Xdiag affichage de messages de diagnostic suppl\u00E9mentaires\n -Xnoclassgc d\u00E9sactivation de l''op\u00E9ration de ramasse-miette (garbage collection) de la classe\n -Xincgc activation de l''op\u00E9ration de ramasse-miette (garbage collection) incr\u00E9mentielle\n -Xloggc: journalisation du statut de l''op\u00E9ration de ramasse-miette (garbage collection) dans un fichier avec horodatages\n -Xbatch d\u00E9sactivation de la compilation en arri\u00E8re-plan\n -Xms d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n -Xmx d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n -Xss d\u00E9finition de la taille de pile de thread Java\n -Xprof sortie des donn\u00E9es de profilage de l''unit\u00E9 centrale\n -Xfuture activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n -Xrs r\u00E9duction de l''utilisation des signaux OS par Java/la machine virtuelle (voir documentation)\n -Xcheck:jni ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n -Xshare:off aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9es\n -Xshare:auto utilisation des donn\u00E9es de classe partag\u00E9es si possible (valeur par d\u00E9faut)\n -Xshare:on utilisation des donn\u00E9es de classe partag\u00E9es obligatoire ou \u00E9chec de l''op\u00E9ration\n -XshowSettings affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n -XshowSettings:all\n affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n -XshowSettings:properties\n affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n -XshowSettings:locale\n affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n\nLes options -X ne sont pas des options standard et peuvent faire l''objet de modifications sans pr\u00E9avis.\n @@ -50,7 +50,5 @@ java.launcher.cls.error5=Erreur : des composants d'ex\u00E9cution JavaFX obligat java.launcher.jar.error1=Erreur : une erreur inattendue est survenue lors de la tentative d''ouverture du fichier {0} java.launcher.jar.error2=fichier manifeste introuvable dans {0} java.launcher.jar.error3=aucun attribut manifest principal dans {0} -java.launcher.jar.error4=aucun attribut manifest ''Profile'' dans {0} -java.launcher.jar.error5=Profil {0} requis par {1} non pris en charge par cette ex\u00E9cution java.launcher.init.error=erreur d'initialisation java.launcher.javafx.error1=Erreur : la signature de la m\u00E9thode launchApplication JavaFX est incorrecte, la\nm\u00E9thode doit \u00EAtre d\u00E9clar\u00E9e statique et renvoyer une valeur de type void diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties index 7ca3cf357c8..492b6755111 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties @@ -50,7 +50,5 @@ java.launcher.cls.error5=Errore: non sono presenti i componenti runtime di JavaF java.launcher.jar.error1=Errore: si \u00E8 verificato un errore imprevisto durante il tentativo di aprire il file {0} java.launcher.jar.error2=manifest non trovato in {0} java.launcher.jar.error3=nessun attributo manifest principale in {0} -java.launcher.jar.error4=nessun attributo manifest di profilo in {0} -java.launcher.jar.error5=Il profilo {0} richiesto da {1} non \u00E8 supportato da questo runtime java.launcher.init.error=errore di inizializzazione java.launcher.javafx.error1=Errore: il metodo JavaFX launchApplication dispone di una firma errata, \nla firma deve essere dichiarata static e restituire un valore di tipo void diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties index 52c220a6926..d1f2f699f2e 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties @@ -34,11 +34,11 @@ java.launcher.ergo.message1 =\ \u30C7\u30D5\u30A9\u30EB\u30C8V java.launcher.ergo.message2 =\ \u3053\u308C\u306F\u30B5\u30FC\u30D0\u30FC\u30AF\u30E9\u30B9\u306E\u30DE\u30B7\u30F3\u3067\u5B9F\u884C\u3057\u3066\u3044\u308B\u305F\u3081\u3067\u3059\u3002\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \n -classpath \n \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n -D=\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n -verbose:[class|gc|jni]\n \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n -version \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n -version:\n \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n -showversion \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n -jre-restrict-search | -no-jre-restrict-search\n \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n -? -help \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n -ea[:...|:]\n -enableassertions[:...|:]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -da[:...|:]\n -disableassertions[:...|:]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -esa | -enablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -dsa | -disablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -agentlib:[=]\n \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n -agentpath:[=]\n \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n -javaagent:[=]\n Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n -splash:\n \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://www.oracle.com/technetwork/java/javase/documentation/index.html\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +java.launcher.opt.footer =\ -cp <\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB\u306E\u30AF\u30E9\u30B9\u691C\u7D22\u30D1\u30B9>\n -classpath <\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB\u306E\u30AF\u30E9\u30B9\u691C\u7D22\u30D1\u30B9>\n \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n -D=\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n -verbose:[class|gc|jni]\n \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n -version \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n -version:\n \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n -showversion \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n -jre-restrict-search | -no-jre-restrict-search\n \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n -? -help \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n -ea[:...|:]\n -enableassertions[:...|:]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -da[:...|:]\n -disableassertions[:...|:]\n \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -esa | -enablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -dsa | -disablesystemassertions\n \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -agentlib:[=]\n \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n -agentpath:[=]\n \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n -javaagent:[=]\n Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n -splash:\n \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://www.oracle.com/technetwork/java/javase/documentation/index.html\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002 # Translators please note do not translate the options themselves -java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xint \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n -Xbootclasspath:\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n -Xbootclasspath/a:\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n -Xbootclasspath/p:\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n -Xdiag \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n -Xnoclassgc \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xincgc \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xloggc: \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n -Xbatch \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xms Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xmx Java\u306E\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xss Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xprof CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n -Xfuture \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xrs Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n -Xcheck:jni JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n -Xshare:off \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n -Xshare:auto \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xshare:on \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n -XshowSettings \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:all\n \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:properties\n \u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:locale\n \ -\u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n +java.launcher.X.usage=\ -Xmixed \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xint \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n -Xbootclasspath:<{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n -Xbootclasspath/a:<{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n -Xbootclasspath/p:<{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB>\n \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n -Xdiag \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n -Xnoclassgc \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xincgc \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xloggc: \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n -Xbatch \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n -Xms Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xmx Java\u306E\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xss Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n -Xprof CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n -Xfuture \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n -Xrs Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n -Xcheck:jni JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n -Xshare:off \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n -Xshare:auto \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -Xshare:on \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n -XshowSettings \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:all\n \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:properties\n \ +\u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n -XshowSettings:locale\n \u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\n\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306FMac OS X\u56FA\u6709\u3067\u3059\u3002\n -XstartOnFirstThread\n main()\u30E1\u30BD\u30C3\u30C9\u3092\u6700\u521D(AppKit)\u306E\u30B9\u30EC\u30C3\u30C9\u3067\u5B9F\u884C\u3059\u308B\n -Xdock:name="\n Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n -Xdock:icon=\n Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n\n @@ -51,7 +51,5 @@ java.launcher.cls.error5=\u30A8\u30E9\u30FC: JavaFX\u30E9\u30F3\u30BF\u30A4\u30E java.launcher.jar.error1=\u30A8\u30E9\u30FC: \u30D5\u30A1\u30A4\u30EB{0}\u3092\u958B\u3053\u3046\u3068\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u3001\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F java.launcher.jar.error2={0}\u306B\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 java.launcher.jar.error3={0}\u306B\u30E1\u30A4\u30F3\u30FB\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093 -java.launcher.jar.error4={0}\u306B\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093 -java.launcher.jar.error5={1}\u306B\u5FC5\u8981\u306A\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB{0}\u306F\u3053\u306E\u30E9\u30F3\u30BF\u30A4\u30E0\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093 java.launcher.init.error=\u521D\u671F\u5316\u30A8\u30E9\u30FC java.launcher.javafx.error1=\u30A8\u30E9\u30FC: JavaFX launchApplication\u30E1\u30BD\u30C3\u30C9\u306B\u8AA4\u3063\u305F\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u3001\nstatic\u3092\u5BA3\u8A00\u3057\u3066void\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties index a4c3d800c2d..d9d471eec9f 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties @@ -34,10 +34,11 @@ java.launcher.ergo.message1 =\ \uAE30\uBCF8 VM\uC740 {0}\uC785 java.launcher.ergo.message2 =\ \uC11C\uBC84\uAE09 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uC2E4\uD589 \uC911\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \\n -classpath \\n \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\\n JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\\n -D=\\n \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\\n -verbose:[class|gc|jni]\\n \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\\n -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\\n -version:\\n \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\\n -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\\n -jre-restrict-search | -no-jre-restrict-search\\n \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\\n -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\\n -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\\n -ea[:...|:]\\n -enableassertions[:...|:]\\n \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\\n -da[:...|:]\\n -disableassertions[:...|:]\\n \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\\n -esa | -enablesystemassertions\\n \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\\n -dsa | -disablesystemassertions\\n \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\\n -agentlib:[=]\\n \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\\n -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\\n -agentpath:[=]\\n \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\\n -javaagent:[=]\\n Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\\n -splash:\\n \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. +java.launcher.opt.footer =\ -cp <\uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C\uC758 \uD074\uB798\uC2A4 \uAC80\uC0C9 \uACBD\uB85C>\n -classpath <\uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C\uC758 \uD074\uB798\uC2A4 \uAC80\uC0C9 \uACBD\uB85C>\n \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n -D=\n \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n -verbose:[class|gc|jni]\n \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n -version:\n \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -jre-restrict-search | -no-jre-restrict-search\n \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n -ea[:...|:]\n -enableassertions[:...|:]\n \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -da[:...|:]\n -disableassertions[:...|:]\n \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -esa | -enablesystemassertions\n \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -dsa | -disablesystemassertions\n \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -agentlib:[=]\n \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n -agentpath:[=]\n \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n -javaagent:[=]\n Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n -splash:\n \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. # Translators please note do not translate the options themselves -java.launcher.X.usage=\ -Xmixed \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xint \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n -Xbootclasspath:\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xbootclasspath/a:\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xbootclasspath/p:\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xdiag \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n -Xnoclassgc \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xincgc \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xloggc: \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n -Xbatch \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xms \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xmx \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xss Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xprof CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n -Xfuture \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xrs Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n -Xcheck:jni JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n -Xshare:off \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -Xshare:auto \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xshare:on \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n -XshowSettings \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:all\n \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:properties\n \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:locale\n \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n +java.launcher.X.usage=\ -Xmixed \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xint \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n -Xbootclasspath:<{0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xbootclasspath/a:<{0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xbootclasspath/p:<{0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C>\n \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n -Xdiag \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n -Xnoclassgc \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xincgc \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xloggc: \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n -Xbatch \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xms \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xmx \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xss Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xprof CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n -Xfuture \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n -Xrs Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n -Xcheck:jni JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n -Xshare:off \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -Xshare:auto \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n -Xshare:on \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n -XshowSettings \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:all\n \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:properties\n \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n -XshowSettings:locale\n \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \ +\uC788\uC2B5\uB2C8\uB2E4.\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n -XstartOnFirstThread\n \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n -Xdock:name="\n \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n -Xdock:icon=\n \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n @@ -50,7 +51,5 @@ java.launcher.cls.error5=\uC624\uB958: \uC774 \uC751\uC6A9 \uD504\uB85C\uADF8\uB java.launcher.jar.error1=\uC624\uB958: {0} \uD30C\uC77C\uC744 \uC5F4\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. java.launcher.jar.error2={0}\uC5D0\uC11C Manifest\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. java.launcher.jar.error3={0}\uC5D0 \uAE30\uBCF8 Manifest \uC18D\uC131\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. -java.launcher.jar.error4={0}\uC5D0 Profile manifest \uC18D\uC131\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. -java.launcher.jar.error5={1}\uC5D0 \uD544\uC694\uD55C {0} \uD504\uB85C\uD30C\uC77C\uC740 \uC774 \uB7F0\uD0C0\uC784\uC5D0\uC11C \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. java.launcher.init.error=\uCD08\uAE30\uD654 \uC624\uB958 java.launcher.javafx.error1=\uC624\uB958: JavaFX launchApplication \uBA54\uC18C\uB4DC\uC5D0 \uC798\uBABB\uB41C \uC11C\uBA85\uC774 \uC788\uC2B5\uB2C8\uB2E4.\\n\uB530\uB77C\uC11C static\uC73C\uB85C \uC120\uC5B8\uD558\uACE0 void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4. diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties index 00425f64412..17d88fef80d 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties @@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ A VM default \u00E9 {0} java.launcher.ergo.message2 =\ porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \n -classpath \n Uma lista separada por {0} de diret\u00F3rios, archives JAR\n e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n -D=\n define uma propriedade do sistema\n -verbose[:classe|gc|jni]\n ativa a sa\u00EDda detalhada\n -version imprime a vers\u00E3o do produto e sai do programa\n -version:\n requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n -showversion imprime a vers\u00E3o do produto e continua\n -jre-restrict-search | -no-jre-restrict-search\n inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n -? -help imprime esta mensagem de ajuda\n -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n -ea[:...|:]\n -enableassertions[:...|:]\n ativa asser\u00E7\u00F5es com granularidade especificada\n -da[:...|:]\n -disableassertions[:...|:]\n desativa asser\u00E7\u00F5es com granularidade especificada\n -esa | -enablesystemassertions\n ativa asser\u00E7\u00F5es do sistema\n -dsa | -disablesystemassertions\n desativa asser\u00E7\u00F5es do sistema\n -agentlib:[=]\n carrega a biblioteca de agentes nativa , por exemplo: -agentlib:hprof\n consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n -agentpath:[=]\n carrega a biblioteca de agentes nativa com base no nome do caminho completo\n -javaagent:[=]\n carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n -splash:\n mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes. +java.launcher.opt.footer =\ -cp \n -classpath \n Uma lista separada por {0} de diret\u00F3rios, archives JAR\n e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n -D=\n define uma propriedade do sistema\n -verbose:[classe|gc|jni]\n ativa a sa\u00EDda detalhada\n -version imprime a vers\u00E3o do produto e sai do programa\n -version:\n requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n -showversion imprime a vers\u00E3o do produto e continua\n -jre-restrict-search | -no-jre-restrict-search\n inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n -? -help imprime esta mensagem de ajuda\n -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n -ea[:...|:]\n -enableassertions[:...|:]\n ativa asser\u00E7\u00F5es com granularidade especificada\n -da[:...|:]\n -disableassertions[:...|:]\n desativa asser\u00E7\u00F5es com granularidade especificada\n -esa | -enablesystemassertions\n ativa asser\u00E7\u00F5es do sistema\n -dsa | -disablesystemassertions\n desativa asser\u00E7\u00F5es do sistema\n -agentlib:[=]\n carrega a biblioteca de agentes nativa , por exemplo: -agentlib:hprof\n consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n -agentpath:[=]\n carrega a biblioteca de agentes nativa com base no nome do caminho completo\n -javaagent:[=]\n carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n -splash:\n mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed execu\u00E7\u00E3o no modo misto (default)\n -Xint execu\u00E7\u00E3o somente no modo interpretado\n -Xbootclasspath:\n define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n -Xbootclasspath/a:\n anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n -Xbootclasspath/p:\n anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n -Xdiag mostra mensagens de diagn\u00F3stico adicionais\n -Xnoclassgc desativa a coleta de lixo da classe\n -Xincgc ativa a coleta de lixo incremental\n -Xloggc: registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n -Xbatch desativa a compila\u00E7\u00E3o em segundo plano\n -Xms define o tamanho inicial do heap Java\n -Xmx define o tamanho m\u00E1ximo do heap Java\n -Xss define o tamanho da pilha de threads java\n -Xprof produz dados de perfil da cpu\n -Xfuture ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n -Xrs reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n -Xcheck:jni executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n -Xshare:off n\u00E3o tenta usar dados da classe compartilhada\n -Xshare:auto se poss\u00EDvel, usa dados da classe compartilhada (default)\n -Xshare:on requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n -XshowSettings mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:all\n mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n -XshowSettings:properties\n mostra todas as defini\u00E7\u00F5es da propriedade e continua\n -XshowSettings:locale\n mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n @@ -50,7 +50,5 @@ java.launcher.cls.error5=Erro: os componentes de runtime do JavaFX n\u00E3o fora java.launcher.jar.error1=Erro: ocorreu um erro inesperado ao tentar abrir o arquivo {0} java.launcher.jar.error2=manifesto n\u00E3o encontrado em {0} java.launcher.jar.error3=nenhum atributo de manifesto principal em {0} -java.launcher.jar.error4=nenhum atributo de manifesto de Perfil em {0} -java.launcher.jar.error5=O perfil {0} exigido por {1} n\u00E3o \u00E9 suportado por este runtime java.launcher.init.error=erro de inicializa\u00E7\u00E3o java.launcher.javafx.error1=Erro: O m\u00E9todo launchApplication do JavaFX tem a assinatura errada. Ele\\ndeve ser declarado como est\u00E1tico e retornar um valor do tipo void diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties index 9577f39477a..d64c3f6f347 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties @@ -50,7 +50,5 @@ java.launcher.cls.error5=Fel: JavaFX-k\u00F6rningskomponenter saknas, och de kr\ java.launcher.jar.error1=Fel: Ett ov\u00E4ntat fel intr\u00E4ffade n\u00E4r filen {0} skulle \u00F6ppnas java.launcher.jar.error2=manifest finns inte i {0} java.launcher.jar.error3=inget huvudmanifestattribut i {0} -java.launcher.jar.error4=inget profilmanifestattribut i {0} -java.launcher.jar.error5=Profil {0} som kr\u00E4vs av {1} kan inte anv\u00E4ndas av den h\u00E4r k\u00F6rningen java.launcher.init.error=initieringsfel java.launcher.javafx.error1=Fel: JavaFX launchApplication-metoden har fel signatur, den \nm\u00E5ste ha deklarerats som statisk och returnera ett v\u00E4rde av typen void diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties index a536e68bfbc..1e352765d39 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties @@ -50,7 +50,5 @@ java.launcher.cls.error5=\u9519\u8BEF: \u7F3A\u5C11 JavaFX \u8FD0\u884C\u65F6\u7 java.launcher.jar.error1=\u9519\u8BEF: \u5C1D\u8BD5\u6253\u5F00\u6587\u4EF6{0}\u65F6\u51FA\u73B0\u610F\u5916\u9519\u8BEF java.launcher.jar.error2=\u5728{0}\u4E2D\u627E\u4E0D\u5230\u6E05\u5355 java.launcher.jar.error3={0}\u4E2D\u6CA1\u6709\u4E3B\u6E05\u5355\u5C5E\u6027 -java.launcher.jar.error4={0}\u4E2D\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u6E05\u5355\u5C5E\u6027 -java.launcher.jar.error5=\u6B64\u8FD0\u884C\u65F6\u4E0D\u652F\u6301{1}\u6240\u9700\u7684\u914D\u7F6E\u6587\u4EF6{0} java.launcher.init.error=\u521D\u59CB\u5316\u9519\u8BEF java.launcher.javafx.error1=\u9519\u8BEF: JavaFX launchApplication \u65B9\u6CD5\u5177\u6709\u9519\u8BEF\u7684\u7B7E\u540D, \u5FC5\u987B\n\u5C06\u65B9\u6CD5\u58F0\u660E\u4E3A\u9759\u6001\u65B9\u6CD5\u5E76\u8FD4\u56DE\u7A7A\u7C7B\u578B\u7684\u503C diff --git a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties index 9fd5ff272a7..57e301d7558 100644 --- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties +++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties @@ -50,7 +50,5 @@ java.launcher.cls.error5=\u932F\u8AA4: \u907A\u6F0F\u57F7\u884C\u6B64\u61C9\u752 java.launcher.jar.error1=\u932F\u8AA4: \u5617\u8A66\u958B\u555F\u6A94\u6848 {0} \u6642\u767C\u751F\u672A\u9810\u671F\u7684\u932F\u8AA4 java.launcher.jar.error2=\u5728 {0} \u4E2D\u627E\u4E0D\u5230\u8CC7\u8A0A\u6E05\u55AE java.launcher.jar.error3={0} \u4E2D\u6C92\u6709\u4E3B\u8981\u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027 -java.launcher.jar.error4={0} \u4E2D\u6C92\u6709 Profile \u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027 -java.launcher.jar.error5=\u6B64\u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u4E0D\u652F\u63F4 {1} \u6240\u9700\u7684\u8A2D\u5B9A\u6A94 {0} java.launcher.init.error=\u521D\u59CB\u5316\u932F\u8AA4 java.launcher.javafx.error1=\u932F\u8AA4: JavaFX launchApplication \u65B9\u6CD5\u7684\u7C3D\u7AE0\u932F\u8AA4\uFF0C\u5B83\n\u5FC5\u9808\u5BA3\u544A\u70BA\u975C\u614B\u4E26\u50B3\u56DE void \u985E\u578B\u7684\u503C diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties index c7a48fcab41..51dac99f71c 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties @@ -17,8 +17,8 @@ button.print=Drucken button.properties=E&igenschaften... # checkbox.collate=&Sortieren -checkbox.jobsheets=&Bannerseite -checkbox.printtofile=Ausgabe in &Datei +checkbox.jobsheets=Banner&seite +checkbox.printtofile=Aus&gabe in Datei # dialog.printtitle=Drucken dialog.pstitle=Seite einrichten @@ -29,7 +29,7 @@ dialog.noprintermsg=Kein Druckservice gefunden. dialog.writeerror=Schreiben in Datei nicht m\u00F6glich: # label.info=Info: -label.jobname=&Job-Name: +label.jobname=&Jobname: label.numcopies=Anzahl &Kopien: label.priority=P&riorit\u00E4t: label.psname=&Name: @@ -42,21 +42,21 @@ label.username=&Benutzername: label.millimetres=(mm) label.inches=(Zoll) label.topmargin=&oben -label.bottommargin=&unten +label.bottommargin=u&nten label.leftmargin=&links -label.rightmargin=&rechts +label.rightmargin=re&chts # radiobutton.color=&Farbe radiobutton.draftq=Ent&wurf -radiobutton.duplex=&Duplex +radiobutton.duplex=Du&plex radiobutton.highq=&Hoch -radiobutton.landscape=&Querformat +radiobutton.landscape=Querforma&t radiobutton.monochrome=&Monochrom radiobutton.normalq=&Normal -radiobutton.oneside=&Einseitig +radiobutton.oneside=E&inseitig radiobutton.portrait=Hochfor&mat radiobutton.rangeall=A&lle -radiobutton.rangepages=S&eiten +radiobutton.rangepages=Sei&ten radiobutton.revlandscape=Umgekehrtes Q&uerformat radiobutton.revportrait=Umgekehrtes &Hochformat radiobutton.tumble=&Kalenderdruck diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties index 70c31fe9506..a0af46041a7 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties @@ -36,29 +36,29 @@ label.psname=&Nombre: label.pstype=Tipo: label.rangeto=A label.size=Tama&\u00F1o: -label.source=Ori&gen: +label.source=Orig&en: label.status=Estado: label.username=&Usuario: label.millimetres=(mm) label.inches=(pulg.) -label.topmargin=&superior +label.topmargin=s&uperior label.bottommargin=in&ferior label.leftmargin=iz&quierdo label.rightmargin=d&erecho # radiobutton.color=&Color -radiobutton.draftq=Bo&rrador +radiobutton.draftq=B&orrador radiobutton.duplex=&D\u00FAplex -radiobutton.highq=&Alta +radiobutton.highq=Al&ta radiobutton.landscape=Hori&zontal radiobutton.monochrome=&Monocromo radiobutton.normalq=&Normal radiobutton.oneside=Una Ca&ra radiobutton.portrait=&Vertical radiobutton.rangeall=&Todo -radiobutton.rangepages=P\u00E1&ginas +radiobutton.rangepages=P\u00E1gina&s radiobutton.revlandscape=&Horizontal Inverso -radiobutton.revportrait=Vertical Inver&so +radiobutton.revportrait=Vertical I&nverso radiobutton.tumble=Cam&bio de Cara # The vkMnemonics correspond with the constants defined in KeyEvent, eg # 65 = KeyEvent.VK_A diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties index a09df3e5846..366aa3ba3e3 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties @@ -29,7 +29,7 @@ dialog.noprintermsg=Service d'impression introuvable. dialog.writeerror=Impossible d'\u00E9crire dans le fichier : # label.info=Infos : -label.jobname=Nom du &travail : +label.jobname=Nom du tra&vail : label.numcopies=Nombre de c&opies : label.priority=P&riorit\u00E9 : label.psname=&Nom : @@ -38,22 +38,22 @@ label.rangeto=A label.size=Tai&lle : label.source=Sour&ce : label.status=Statut : -label.username=Nom &utilisateur : +label.username=Nom ut&ilisateur : label.millimetres=(mm) label.inches=(po) label.topmargin=&haut label.bottommargin=&bas -label.leftmargin=&gauche +label.leftmargin=gauc&he label.rightmargin=&droite # -radiobutton.color=Coule&ur +radiobutton.color=Coul&eur radiobutton.draftq=Broui&llon radiobutton.duplex=&Duplex radiobutton.highq=Ma&x. -radiobutton.landscape=Pay&sage -radiobutton.monochrome=&Monochrome +radiobutton.landscape=Pa&ysage +radiobutton.monochrome=Monoc&hrome radiobutton.normalq=&Normal -radiobutton.oneside=&Un c\u00F4t\u00E9 +radiobutton.oneside=Un &c\u00F4t\u00E9 radiobutton.portrait=&Portrait radiobutton.rangeall=&Tout radiobutton.rangepages=Pag&es @@ -64,7 +64,7 @@ radiobutton.tumble=&T\u00EAte-b\u00EAche # 65 = KeyEvent.VK_A tab.appearance=&Apparence tab.general=&G\u00E9n\u00E9ral -tab.pagesetup=Mi&se en page +tab.pagesetup=&Mise en page # error.pagerange=Plage de pages non valide. Sp\u00E9cifiez les valeurs de nouveau (ex. : 1-3,5,7-10) error.destination=Nom de fichier non valide ; recommencez diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties index b5f5382216c..e87efcd27bd 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties @@ -47,8 +47,8 @@ label.leftmargin=sinis&tro label.rightmargin=&destro # radiobutton.color=&Colore -radiobutton.draftq=&Bozza -radiobutton.duplex=F&ronte retro +radiobutton.draftq=Bo&zza +radiobutton.duplex=&Fronte retro radiobutton.highq=A<a radiobutton.landscape=Orizzonta&le radiobutton.monochrome=Monocrom&atico @@ -62,7 +62,7 @@ radiobutton.revportrait=Vert&icale capovolto radiobutton.tumble=La&to corto # The vkMnemonics correspond with the constants defined in KeyEvent, eg # 65 = KeyEvent.VK_A -tab.appearance=&Aspetto +tab.appearance=As&petto tab.general=&Generale tab.pagesetup=Impo&sta pagina # diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties index 437b432f78e..13d4d72d0ab 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties @@ -31,7 +31,7 @@ dialog.writeerror=N\u00E3o \u00E9 poss\u00EDvel gravar no arquivo: label.info=Informa\u00E7\u00F5es: label.jobname=Nome do &Job: label.numcopies=N\u00FAmer&o de c\u00F3pias: -label.priority=P&rioridade: +label.priority=Pri&oridade: label.psname=&Nome: label.pstype=Tipo: label.rangeto=At\u00E9 @@ -44,27 +44,27 @@ label.inches=(pol) label.topmargin=&superior label.bottommargin=&inferior label.leftmargin=es&querda: -label.rightmargin=di&reita +label.rightmargin=&direita # -radiobutton.color=C&or -radiobutton.draftq=&Rascunho -radiobutton.duplex=&Duplex -radiobutton.highq=&Alta +radiobutton.color=&Cor +radiobutton.draftq=Rascun&ho +radiobutton.duplex=Duple&x +radiobutton.highq=A<a radiobutton.landscape=&Paisagem radiobutton.monochrome=&Monocrom\u00E1tico radiobutton.normalq=&Normal -radiobutton.oneside=Um Lad&o -radiobutton.portrait=&Retrato +radiobutton.oneside=Um La&do +radiobutton.portrait=Re&trato radiobutton.rangeall=T&udo radiobutton.rangepages=&P\u00E1ginas radiobutton.revlandscape=Paisagem I&nvertida -radiobutton.revportrait=Retrato &Invertido +radiobutton.revportrait=Retrato In&vertido radiobutton.tumble=&Virar # The vkMnemonics correspond with the constants defined in KeyEvent, eg # 65 = KeyEvent.VK_A -tab.appearance=&Apar\u00EAncia +tab.appearance=Apa&r\u00EAncia tab.general=&Geral -tab.pagesetup=Configura\u00E7\u00E3o de &P\u00E1gina +tab.pagesetup=Con&figura\u00E7\u00E3o da P\u00E1gina # error.pagerange=Faixa de p\u00E1ginas inv\u00E1lida; insira novamente os valores (por exemplo, 1-3,5,7-10) error.destination=Nome de arquivo inv\u00E1lido; tente novamente diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties index 16f04f634b3..f6475df9f59 100644 --- a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties +++ b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties @@ -17,7 +17,7 @@ button.print=Skriv ut button.properties=&Egenskaper... # checkbox.collate=&Sortera -checkbox.jobsheets=&F\u00F6rs\u00E4ttsblad +checkbox.jobsheets=F&\u00F6rs\u00E4ttsblad checkbox.printtofile=Skriv ut till &fil # dialog.printtitle=Skriv ut @@ -30,13 +30,13 @@ dialog.writeerror=Kan inte skriva till filen: # label.info=Information: label.jobname=&Utskrift: -label.numcopies=Antal &exemplar: +label.numcopies=Antal e&xemplar: label.priority=P&rioritet: label.psname=&Namn: label.pstype=Typ: label.rangeto=Till label.size=Stor&lek: -label.source=K\u00E4l&la: +label.source=&K\u00E4lla: label.status=Status: label.username=A&nv\u00E4ndarnamn: label.millimetres=(mm) @@ -50,7 +50,7 @@ radiobutton.color=&F\u00E4rg radiobutton.draftq=Utka&st radiobutton.duplex=&Dubbelsidig radiobutton.highq=&H\u00F6g -radiobutton.landscape=&Liggande +radiobutton.landscape=Liggan&de radiobutton.monochrome=&Monokrom radiobutton.normalq=&Normal radiobutton.oneside=&Ensidig @@ -62,9 +62,9 @@ radiobutton.revportrait=Omv\u00E4nt st\u00E5en&de radiobutton.tumble=&V\u00E4nd # The vkMnemonics correspond with the constants defined in KeyEvent, eg # 65 = KeyEvent.VK_A -tab.appearance=&Format +tab.appearance=Fo&rmat tab.general=&Allm\u00E4nt -tab.pagesetup=Utskrifts&format +tab.pagesetup=&Utskriftsformat # error.pagerange=Ogiltigt sidintervall. Skriv in v\u00E4rdena igen (t ex 1-3,5,7-10) error.destination=Ogiltigt filnamn. F\u00F6rs\u00F6k igen. diff --git a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties index 51068bff8de..ae2c6bf5cd1 100644 --- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties +++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties @@ -24,5 +24,5 @@ # questions. # -rmiregistry.usage=Verwendung: {0} \n\nwobei die Folgendes beinhalten:\n -J Argument an den Java-Interpreter \u00FCbergeben +rmiregistry.usage=Verwendung: {0} \n\nwobei die Folgendes beinhalten:\n -J Argument an den Java-Interpreter \u00FCbergeben rmiregistry.port.badnumber=Portargument {0} ist keine Zahl. diff --git a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties index e744d9cc433..ea728a6dedb 100644 --- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties +++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties @@ -87,7 +87,7 @@ rmid.restart.group.warning=\nrmid: (\uACBD\uACE0) \uADF8\uB8F9 \uC7AC\uC2DC\uC79 rmid.restart.service.warning=\nrmid: (\uACBD\uACE0) \uC11C\uBE44\uC2A4 \uC7AC\uC2DC\uC791\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: # "rmid" should not be translated -rmid.log.update.warning=\nrmid: (\uACBD\uACE0) \uB85C\uADF8 \uAC31\uC2E0\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: +rmid.log.update.warning=\nrmid: (\uACBD\uACE0) \uB85C\uADF8 \uC5C5\uB370\uC774\uD2B8\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: # "rmid" should not be translated rmid.log.snapshot.warning=\nrmid: (\uC2EC\uAC01) \uB85C\uADF8 \uC2A4\uB0C5\uC0F7\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: diff --git a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java index d5048af0bf9..397a859bcbe 100644 --- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java +++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java @@ -57,49 +57,51 @@ public class Resources_ja extends java.util.ListResourceBundle { {".jarsigner.verify.options.jar.file.alias.", " jarsigner -verify [options] jar-file [alias...]"}, {".keystore.url.keystore.location", - "[-keystore ] \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u4F4D\u7F6E"}, + "[-keystore ] \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u4F4D\u7F6E"}, {".storepass.password.password.for.keystore.integrity", - "[-storepass ] \u30AD\u30FC\u30B9\u30C8\u30A2\u6574\u5408\u6027\u306E\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9"}, + "[-storepass ] \u30AD\u30FC\u30B9\u30C8\u30A2\u6574\u5408\u6027\u306E\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9"}, {".storetype.type.keystore.type", - "[-storetype ] \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u578B"}, + "[-storetype ] \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u578B"}, {".keypass.password.password.for.private.key.if.different.", - "[-keypass ] \u79D8\u5BC6\u9375\u306E\u30D1\u30B9\u30EF\u30FC\u30C9(\u7570\u306A\u308B\u5834\u5408)"}, + "[-keypass ] \u79D8\u5BC6\u9375\u306E\u30D1\u30B9\u30EF\u30FC\u30C9(\u7570\u306A\u308B\u5834\u5408)"}, {".certchain.file.name.of.alternative.certchain.file", "[-certchain ] \u4EE3\u66FF\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"}, {".sigfile.file.name.of.SF.DSA.file", - "[-sigfile ] .SF/.DSA\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"}, + "[-sigfile ] .SF/.DSA\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"}, {".signedjar.file.name.of.signed.JAR.file", - "[-signedjar ] \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"}, + "[-signedjar ] \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"}, {".digestalg.algorithm.name.of.digest.algorithm", - "[-digestalg ] \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"}, + "[-digestalg ] \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"}, {".sigalg.algorithm.name.of.signature.algorithm", - "[-sigalg ] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"}, + "[-sigalg ] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"}, {".verify.verify.a.signed.JAR.file", - "[-verify] \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"}, + "[-verify] \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"}, {".verbose.suboptions.verbose.output.when.signing.verifying.", "[-verbose[:suboptions]] \u7F72\u540D/\u691C\u8A3C\u6642\u306E\u8A73\u7D30\u51FA\u529B\u3002"}, {".suboptions.can.be.all.grouped.or.summary", " \u30B5\u30D6\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u3001\u3059\u3079\u3066\u3001\u30B0\u30EB\u30FC\u30D7\u307E\u305F\u306F\u30B5\u30DE\u30EA\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u3059"}, {".certs.display.certificates.when.verbose.and.verifying", - "[-certs] \u8A73\u7D30\u51FA\u529B\u304A\u3088\u3073\u691C\u8A3C\u6642\u306B\u8A3C\u660E\u66F8\u3092\u8868\u793A"}, + "[-certs] \u8A73\u7D30\u51FA\u529B\u304A\u3088\u3073\u691C\u8A3C\u6642\u306B\u8A3C\u660E\u66F8\u3092\u8868\u793A"}, {".tsa.url.location.of.the.Timestamping.Authority", - "[-tsa ] \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u5834\u6240"}, + "[-tsa ] \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u5834\u6240"}, {".tsacert.alias.public.key.certificate.for.Timestamping.Authority", - "[-tsacert ] \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u516C\u958B\u9375\u8A3C\u660E\u66F8"}, + "[-tsacert ] \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u516C\u958B\u9375\u8A3C\u660E\u66F8"}, + {".tsapolicyid.tsapolicyid.for.Timestamping.Authority", + "[-tsapolicyid ] \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306ETSAPolicyID"}, {".altsigner.class.class.name.of.an.alternative.signing.mechanism", - "[-altsigner ] \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u30AF\u30E9\u30B9\u540D"}, + "[-altsigner ] \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u30AF\u30E9\u30B9\u540D"}, {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism", - "[-altsignerpath ]\u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u4F4D\u7F6E"}, + "[-altsignerpath ] \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u5834\u6240"}, {".internalsf.include.the.SF.file.inside.the.signature.block", - "[-internalsf] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"}, + "[-internalsf] \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"}, {".sectionsonly.don.t.compute.hash.of.entire.manifest", - "[-sectionsonly] \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"}, + "[-sectionsonly] \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"}, {".protected.keystore.has.protected.authentication.path", - "[-protected] \u30AD\u30FC\u30B9\u30C8\u30A2\u306B\u306F\u4FDD\u8B77\u3055\u308C\u305F\u8A8D\u8A3C\u30D1\u30B9\u304C\u3042\u308B"}, + "[-protected] \u30AD\u30FC\u30B9\u30C8\u30A2\u306B\u306F\u4FDD\u8B77\u3055\u308C\u305F\u8A8D\u8A3C\u30D1\u30B9\u304C\u3042\u308B"}, {".providerName.name.provider.name", - "[-providerName ] \u30D7\u30ED\u30D0\u30A4\u30C0\u540D"}, + "[-providerName ] \u30D7\u30ED\u30D0\u30A4\u30C0\u540D"}, {".providerClass.class.name.of.cryptographic.service.provider.s", - "[-providerClass \u6697\u53F7\u5316\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u306E\u540D\u524D"}, + "[-providerClass \u6697\u53F7\u5316\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u306E\u540D\u524D"}, {".providerArg.arg.master.class.file.and.constructor.argument", " [-providerArg ]] ... \u30DE\u30B9\u30BF\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3068\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570"}, {".strict.treat.warnings.as.errors", diff --git a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java index e3a34a7f59d..ee2334d9118 100644 --- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java +++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java @@ -71,9 +71,9 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {".signedjar.file.name.of.signed.JAR.file", "[-signedjar <\u6587\u4EF6>] \u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6\u7684\u540D\u79F0"}, {".digestalg.algorithm.name.of.digest.algorithm", - "[-digestalg <\u7B97\u6CD5>] \u6458\u8981\u7B97\u6CD5\u7684\u540D\u79F0"}, + "[-digestalg <\u7B97\u6CD5>] \u6458\u8981\u7B97\u6CD5\u7684\u540D\u79F0"}, {".sigalg.algorithm.name.of.signature.algorithm", - "[-sigalg <\u7B97\u6CD5>] \u7B7E\u540D\u7B97\u6CD5\u7684\u540D\u79F0"}, + "[-sigalg <\u7B97\u6CD5>] \u7B7E\u540D\u7B97\u6CD5\u7684\u540D\u79F0"}, {".verify.verify.a.signed.JAR.file", "[-verify] \u9A8C\u8BC1\u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6"}, {".verbose.suboptions.verbose.output.when.signing.verifying.", @@ -86,6 +86,8 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "[-tsa ] \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u4F4D\u7F6E"}, {".tsacert.alias.public.key.certificate.for.Timestamping.Authority", "[-tsacert <\u522B\u540D>] \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66"}, + {".tsapolicyid.tsapolicyid.for.Timestamping.Authority", + "[-tsapolicyid ] \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 TSAPolicyID"}, {".altsigner.class.class.name.of.an.alternative.signing.mechanism", "[-altsigner <\u7C7B>] \u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236\u7684\u7C7B\u540D"}, {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism", @@ -132,7 +134,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {".Signature.related.entries.","(\u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6761\u76EE)"}, {".Unsigned.entries.", "(\u672A\u7B7E\u540D\u6761\u76EE)"}, {"jar.is.unsigned.signatures.missing.or.not.parsable.", - "jar \u672A\u7B7E\u540D\u3002(\u7F3A\u5C11\u7B7E\u540D\u6216\u65E0\u6CD5\u5BF9\u7B7E\u540D\u8FDB\u884C\u8BED\u6CD5\u5206\u6790)"}, + "jar \u672A\u7B7E\u540D\u3002(\u7F3A\u5C11\u7B7E\u540D\u6216\u65E0\u6CD5\u89E3\u6790\u7B7E\u540D)"}, {"jar.verified.", "jar \u5DF2\u9A8C\u8BC1\u3002"}, {"jarsigner.", "jarsigner: "}, {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.", diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_de.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_de.java index 087362c7cec..623bf76be44 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_de.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_de.java @@ -40,8 +40,7 @@ public class Resources_de extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Option]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Optionen:"}, {"Use.keytool.help.for.all.available.commands", "\"keytool -help\" f\u00FCr alle verf\u00FCgbaren Befehle verwenden"}, @@ -61,7 +60,6 @@ public class Resources_de extends java.util.ListResourceBundle { "Exportiert ein Zertifikat"}, //-exportcert {"Generates.a.key.pair", "Generiert ein Schl\u00FCsselpaar"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "Generiert einen Secret Key"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_de extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "Zertifizierungsanforderung in Datei <{0}> gespeichert"}, {"Submit.this.to.your.CA", "Leiten Sie dies an die CA weiter"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "Wenn kein Alias angegeben ist, d\u00FCrfen destalias, srckeypass und destkeypass nicht angegeben werden"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "Wenn kein Alias angegeben ist, d\u00FCrfen destalias und srckeypass nicht angegeben werden"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "Der Ziel-Keystore pkcs12 hat unterschiedliche Kennw\u00F6rter f\u00FCr storepass und keypass. Wiederholen Sie den Vorgang, indem Sie -destkeypass angeben."}, {"Certificate.stored.in.file.filename.", "Zertifikat in Datei <{0}> gespeichert"}, {"Certificate.reply.was.installed.in.keystore", @@ -324,7 +324,7 @@ public class Resources_de extends java.util.ListResourceBundle { {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", "M\u00F6chten Sie es trotzdem zu Ihrem eigenen Keystore hinzuf\u00FCgen? [Nein]: "}, {"Trust.this.certificate.no.", "Diesem Zertifikat vertrauen? [Nein]: "}, - {"YES", "Ja"}, + {"YES", "JA"}, {"New.prompt.", "Neues {0}: "}, {"Passwords.must.differ", "Kennw\u00F6rter m\u00FCssen sich unterscheiden"}, {"Re.enter.new.prompt.", "Neues {0} erneut eingeben: "}, @@ -361,7 +361,7 @@ public class Resources_de extends java.util.ListResourceBundle { "Alias <{0}> verweist auf einen Eintragstyp, der kein Private Key-Eintrag ist. Der Befehl -keyclone unterst\u00FCtzt nur das Clonen von Private Key-Eintr\u00E4gen"}, {".WARNING.WARNING.WARNING.", - "***************** Warnung Warnung Warnung *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Signaturgeber #%d:"}, {"Timestamp.", "Zeitstempel:"}, {"Signature.", "Signatur:"}, @@ -386,7 +386,7 @@ public class Resources_de extends java.util.ListResourceBundle { "Zertifikat der obersten Ebene in Antwort:\n"}, {".is.not.trusted.", "... ist nicht vertrauensw\u00FCrdig. "}, {"Install.reply.anyway.no.", "Antwort trotzdem installieren? [Nein]: "}, - {"NO", "Nein"}, + {"NO", "NEIN"}, {"Public.keys.in.reply.and.keystore.don.t.match", "Public Keys in Antwort und Keystore stimmen nicht \u00FCberein"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_de extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Geben Sie -keysize zum Erstellen eines Secret Keys an"}, + {"verified.by.s.in.s", "Gepr\u00FCft von %s in %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "WARNUNG: Nicht gepr\u00FCft. Stellen Sie sicher, dass -keystore korrekt ist."}, + {"Extensions.", "Erweiterungen: "}, {".Empty.value.", "(Leerer Wert)"}, {"Extension.Request.", "Erweiterungsanforderung:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_es.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_es.java index 942c0ecf086..ac12dd0c027 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_es.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_es.java @@ -40,8 +40,7 @@ public class Resources_es extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Opci\u00F3n]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Opciones:"}, {"Use.keytool.help.for.all.available.commands", "Utilice\"keytool -help\" para todos los comandos disponibles"}, @@ -61,7 +60,6 @@ public class Resources_es extends java.util.ListResourceBundle { "Exporta el certificado"}, //-exportcert {"Generates.a.key.pair", "Genera un par de claves"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "Genera un clave secreta"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_es extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "Solicitud de certificaci\u00F3n almacenada en el archivo <{0}>"}, {"Submit.this.to.your.CA", "Enviar a la CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "si no se especifica el alias, no se puede especificar destalias, srckeypass ni destkeypass"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "si no se especifica el alias, no se debe especificar destalias ni srckeypass"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "El almac\u00E9n de claves pkcs12 de destino tiene storepass y keypass diferentes. Vuelva a intentarlo con -destkeypass especificado."}, {"Certificate.stored.in.file.filename.", "Certificado almacenado en el archivo <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -324,7 +324,7 @@ public class Resources_es extends java.util.ListResourceBundle { {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", "\u00BFA\u00FAn desea agregarlo a su propio almac\u00E9n de claves? [no]: "}, {"Trust.this.certificate.no.", "\u00BFConfiar en este certificado? [no]: "}, - {"YES", "S\u00ED"}, + {"YES", "S\u00CD"}, {"New.prompt.", "Nuevo {0}: "}, {"Passwords.must.differ", "Las contrase\u00F1as deben ser distintas"}, {"Re.enter.new.prompt.", "Vuelva a escribir el nuevo {0}: "}, @@ -361,7 +361,7 @@ public class Resources_es extends java.util.ListResourceBundle { "El alias <{0}> hace referencia a un tipo de entrada que no es una clave privada. El comando -keyclone s\u00F3lo permite la clonaci\u00F3n de entradas de claves privadas"}, {".WARNING.WARNING.WARNING.", - "***************** Advertencia Advertencia Advertencia *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "#%d de Firmante:"}, {"Timestamp.", "Registro de Hora:"}, {"Signature.", "Firma:"}, @@ -386,7 +386,7 @@ public class Resources_es extends java.util.ListResourceBundle { "Certificado de nivel superior en la respuesta:\n"}, {".is.not.trusted.", "... no es de confianza. "}, {"Install.reply.anyway.no.", "\u00BFInstalar respuesta de todos modos? [no]: "}, - {"NO", "No"}, + {"NO", "NO"}, {"Public.keys.in.reply.and.keystore.don.t.match", "Las claves p\u00FAblicas en la respuesta y en el almac\u00E9n de claves no coinciden"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_es extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Proporcione el valor de -keysize para la generaci\u00F3n de claves secretas"}, + {"verified.by.s.in.s", "Verificado por %s en %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "ADVERTENCIA: no se ha verificado. Aseg\u00FArese de que el valor de -keystore es correcto."}, + {"Extensions.", "Extensiones: "}, {".Empty.value.", "(Valor vac\u00EDo)"}, {"Extension.Request.", "Solicitud de Extensi\u00F3n:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_fr.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_fr.java index 2ae14764d79..aaa7c2e60d5 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_fr.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_fr.java @@ -40,8 +40,7 @@ public class Resources_fr extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Option]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Options :"}, {"Use.keytool.help.for.all.available.commands", "Utiliser \"keytool -help\" pour toutes les commandes disponibles"}, @@ -61,7 +60,6 @@ public class Resources_fr extends java.util.ListResourceBundle { "Exporte le certificat"}, //-exportcert {"Generates.a.key.pair", "G\u00E9n\u00E8re une paire de cl\u00E9s"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "G\u00E9n\u00E8re une cl\u00E9 secr\u00E8te"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_fr extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "Demande de certification stock\u00E9e dans le fichier <{0}>"}, {"Submit.this.to.your.CA", "Soumettre \u00E0 votre CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "si l'alias n'est pas sp\u00E9cifi\u00E9, destalias, srckeypass et destkeypass ne doivent pas \u00EAtre sp\u00E9cifi\u00E9s"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "si l'alias n'est pas sp\u00E9cifi\u00E9, destalias et srckeypass ne doivent pas \u00EAtre sp\u00E9cifi\u00E9s"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "Le fichier de cl\u00E9s pkcs12 de destination contient un mot de passe de fichier de cl\u00E9s et un mot de passe de cl\u00E9 diff\u00E9rents. R\u00E9essayez en sp\u00E9cifiant -destkeypass."}, {"Certificate.stored.in.file.filename.", "Certificat stock\u00E9 dans le fichier <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -324,7 +324,7 @@ public class Resources_fr extends java.util.ListResourceBundle { {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", "Voulez-vous toujours l'ajouter \u00E0 votre fichier de cl\u00E9s ? [non] : "}, {"Trust.this.certificate.no.", "Faire confiance \u00E0 ce certificat ? [non] : "}, - {"YES", "Oui"}, + {"YES", "OUI"}, {"New.prompt.", "Nouveau {0} : "}, {"Passwords.must.differ", "Les mots de passe doivent diff\u00E9rer"}, {"Re.enter.new.prompt.", "Indiquez encore le nouveau {0} : "}, @@ -361,7 +361,7 @@ public class Resources_fr extends java.util.ListResourceBundle { "L''entr\u00E9e \u00E0 laquelle l''alias <{0}> fait r\u00E9f\u00E9rence n''est pas une entr\u00E9e de type cl\u00E9 priv\u00E9e. La commande -keyclone prend uniquement en charge le clonage des cl\u00E9s priv\u00E9es"}, {".WARNING.WARNING.WARNING.", - "***************** Avertissement Avertissement Avertissement *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Signataire n\u00B0%d :"}, {"Timestamp.", "Horodatage :"}, {"Signature.", "Signature :"}, @@ -386,7 +386,7 @@ public class Resources_fr extends java.util.ListResourceBundle { "Certificat de niveau sup\u00E9rieur dans la r\u00E9ponse :\n"}, {".is.not.trusted.", "... non s\u00E9curis\u00E9. "}, {"Install.reply.anyway.no.", "Installer la r\u00E9ponse quand m\u00EAme ? [non] : "}, - {"NO", "Non"}, + {"NO", "NON"}, {"Public.keys.in.reply.and.keystore.don.t.match", "Les cl\u00E9s publiques de la r\u00E9ponse et du fichier de cl\u00E9s ne concordent pas"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_fr extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Indiquez -keysize pour la g\u00E9n\u00E9ration de la cl\u00E9 secr\u00E8te"}, + {"verified.by.s.in.s", "V\u00E9rifi\u00E9 par %s dans %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "AVERTISSEMENT : non v\u00E9rifi\u00E9. Assurez-vous que -keystore est correct."}, + {"Extensions.", "Extensions\u00A0: "}, {".Empty.value.", "(Valeur vide)"}, {"Extension.Request.", "Demande d'extension :"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_it.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_it.java index 0557fdc0943..a47c97fab2a 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_it.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_it.java @@ -40,8 +40,7 @@ public class Resources_it extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Opzione]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Opzioni:"}, {"Use.keytool.help.for.all.available.commands", "Utilizzare \"keytool -help\" per visualizzare tutti i comandi disponibili"}, @@ -61,7 +60,6 @@ public class Resources_it extends java.util.ListResourceBundle { "Esporta il certificato"}, //-exportcert {"Generates.a.key.pair", "Genera una coppia di chiavi"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "Genera una chiave segreta"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_it extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "La richiesta di certificazione \u00E8 memorizzata nel file <{0}>"}, {"Submit.this.to.your.CA", "Sottomettere alla propria CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "Se l'alias non \u00E8 specificato, destalias, srckeypass e destkeypass non dovranno essere specificati"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "Se l'alias non \u00E8 specificato, destalias e srckeypass non dovranno essere specificati"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "Keystore pkcs12 di destinazione con storepass e keypass differenti. Riprovare con -destkeypass specificato."}, {"Certificate.stored.in.file.filename.", "Il certificato \u00E8 memorizzato nel file <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -361,7 +361,7 @@ public class Resources_it extends java.util.ListResourceBundle { "L''alias <{0}> fa riferimento a un tipo di voce che non \u00E8 una voce di chiave privata. Il comando -keyclone supporta solo la copia delle voci di chiave private."}, {".WARNING.WARNING.WARNING.", - "***************** Avvertenza Avvertenza Avvertenza *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Firmatario #%d:"}, {"Timestamp.", "Indicatore orario:"}, {"Signature.", "Firma:"}, @@ -386,7 +386,7 @@ public class Resources_it extends java.util.ListResourceBundle { "Certificato di primo livello nella risposta:\n"}, {".is.not.trusted.", "...non \u00E8 considerato sicuro. "}, {"Install.reply.anyway.no.", "Installare la risposta? [no]: "}, - {"NO", "No"}, + {"NO", "NO"}, {"Public.keys.in.reply.and.keystore.don.t.match", "Le chiavi pubbliche nella risposta e nel keystore non corrispondono"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_it extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Specificare il valore -keysize per la generazione della chiave segreta"}, + {"verified.by.s.in.s", "Verificato da %s in %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "AVVERTENZA: non verificato. Assicurarsi che -keystore sia corretto."}, + {"Extensions.", "Estensioni: "}, {".Empty.value.", "(valore vuoto)"}, {"Extension.Request.", "Richiesta di estensione:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_ja.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_ja.java index 9b6e6be1cf6..b40b046f06c 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_ja.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_ja.java @@ -40,8 +40,7 @@ public class Resources_ja extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [\u30AA\u30D7\u30B7\u30E7\u30F3]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "\u30AA\u30D7\u30B7\u30E7\u30F3:"}, {"Use.keytool.help.for.all.available.commands", "\u4F7F\u7528\u53EF\u80FD\u306A\u3059\u3079\u3066\u306E\u30B3\u30DE\u30F3\u30C9\u306B\u3064\u3044\u3066\u306F\"keytool -help\"\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044"}, @@ -61,7 +60,6 @@ public class Resources_ja extends java.util.ListResourceBundle { "\u8A3C\u660E\u66F8\u3092\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u3057\u307E\u3059"}, //-exportcert {"Generates.a.key.pair", "\u9375\u30DA\u30A2\u3092\u751F\u6210\u3057\u307E\u3059"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "\u79D8\u5BC6\u9375\u3092\u751F\u6210\u3057\u307E\u3059"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_ja extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "\u8A3C\u660E\u66F8\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u30D5\u30A1\u30A4\u30EB<{0}>\u306B\u4FDD\u5B58\u3055\u308C\u307E\u3057\u305F"}, {"Submit.this.to.your.CA", "\u3053\u308C\u3092CA\u306B\u63D0\u51FA\u3057\u3066\u304F\u3060\u3055\u3044"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "\u5225\u540D\u3092\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u3001\u51FA\u529B\u5148\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u5225\u540D\u3001\u30BD\u30FC\u30B9\u30FB\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u304A\u3088\u3073\u51FA\u529B\u5148\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "\u5225\u540D\u3092\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u3001\u51FA\u529B\u5148\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u5225\u540D\u304A\u3088\u3073\u30BD\u30FC\u30B9\u30FB\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "\u51FA\u529B\u5148pkcs12\u30AD\u30FC\u30B9\u30C8\u30A2\u306B\u3001\u7570\u306A\u308Bstorepass\u304A\u3088\u3073keypass\u304C\u3042\u308A\u307E\u3059\u3002-destkeypass\u3092\u6307\u5B9A\u3057\u3066\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, {"Certificate.stored.in.file.filename.", "\u8A3C\u660E\u66F8\u304C\u30D5\u30A1\u30A4\u30EB<{0}>\u306B\u4FDD\u5B58\u3055\u308C\u307E\u3057\u305F"}, {"Certificate.reply.was.installed.in.keystore", @@ -361,7 +361,7 @@ public class Resources_ja extends java.util.ListResourceBundle { "\u5225\u540D<{0}>\u304C\u53C2\u7167\u3057\u3066\u3044\u308B\u30A8\u30F3\u30C8\u30EA\u30FB\u30BF\u30A4\u30D7\u306F\u79D8\u5BC6\u9375\u30A8\u30F3\u30C8\u30EA\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002-keyclone\u30B3\u30DE\u30F3\u30C9\u306F\u79D8\u5BC6\u9375\u30A8\u30F3\u30C8\u30EA\u306E\u30AF\u30ED\u30FC\u30F3\u4F5C\u6210\u306E\u307F\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059"}, {".WARNING.WARNING.WARNING.", - "*****************\u8B66\u544A \u8B66\u544A \u8B66\u544A*****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "\u7F72\u540D\u8005\u756A\u53F7%d:"}, {"Timestamp.", "\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7:"}, {"Signature.", "\u7F72\u540D:"}, @@ -400,6 +400,10 @@ public class Resources_ja extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "\u79D8\u5BC6\u9375\u306E\u751F\u6210\u6642\u306B\u306F -keysize\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"}, + {"verified.by.s.in.s", "%s(%s\u5185)\u306B\u3088\u308A\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "\u8B66\u544A: \u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002-keystore\u304C\u6B63\u3057\u3044\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, + {"Extensions.", "\u62E1\u5F35: "}, {".Empty.value.", "(\u7A7A\u306E\u5024)"}, {"Extension.Request.", "\u62E1\u5F35\u30EA\u30AF\u30A8\u30B9\u30C8:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_ko.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_ko.java index 9f3f70f5024..6140bc722c0 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_ko.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_ko.java @@ -40,8 +40,7 @@ public class Resources_ko extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [\uC635\uC158]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "\uC635\uC158:"}, {"Use.keytool.help.for.all.available.commands", "\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBAA8\uB4E0 \uBA85\uB839\uC5D0 \"keytool -help\" \uC0AC\uC6A9"}, @@ -61,7 +60,6 @@ public class Resources_ko extends java.util.ListResourceBundle { "\uC778\uC99D\uC11C\uB97C \uC775\uC2A4\uD3EC\uD2B8\uD569\uB2C8\uB2E4."}, //-exportcert {"Generates.a.key.pair", "\uD0A4 \uC30D\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4."}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "\uBCF4\uC548 \uD0A4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4."}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -174,7 +172,7 @@ public class Resources_ko extends java.util.ListResourceBundle { "\uCCA0\uD68C\uD560 \uC778\uC99D\uC11C\uC758 \uC77C\uB828 ID"}, //-id // keytool: Running part {"keytool.error.", "keytool \uC624\uB958: "}, - {"Illegal.option.", "\uC798\uBABB\uB41C \uC635\uC158: "}, + {"Illegal.option.", "\uC798\uBABB\uB41C \uC635\uC158: "}, {"Illegal.value.", "\uC798\uBABB\uB41C \uAC12: "}, {"Unknown.password.type.", "\uC54C \uC218 \uC5C6\uB294 \uBE44\uBC00\uBC88\uD638 \uC720\uD615: "}, {"Cannot.find.environment.variable.", @@ -244,8 +242,10 @@ public class Resources_ko extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "\uC778\uC99D \uC694\uCCAD\uC774 <{0}> \uD30C\uC77C\uC5D0 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4."}, {"Submit.this.to.your.CA", "CA\uC5D0\uAC8C \uC81C\uCD9C\uD558\uC2ED\uC2DC\uC624."}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC9C0 \uC54A\uC740 \uACBD\uC6B0 destalias, srckeypass \uBC0F destkeypass\uB97C \uC9C0\uC815\uD558\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4."}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC9C0 \uC54A\uC740 \uACBD\uC6B0 destalias \uBC0F srckeypass\uB97C \uC9C0\uC815\uD558\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4."}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "\uB300\uC0C1 pkcs12 \uD0A4 \uC800\uC7A5\uC18C\uC5D0 \uB2E4\uB978 storepass \uBC0F keypass\uAC00 \uC788\uC2B5\uB2C8\uB2E4. \uC9C0\uC815\uB41C -destkeypass\uB85C \uC7AC\uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624."}, {"Certificate.stored.in.file.filename.", "\uC778\uC99D\uC11C\uAC00 <{0}> \uD30C\uC77C\uC5D0 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4."}, {"Certificate.reply.was.installed.in.keystore", @@ -361,7 +361,7 @@ public class Resources_ko extends java.util.ListResourceBundle { "<{0}> \uBCC4\uCE6D\uC740 \uC804\uC6A9 \uD0A4 \uD56D\uBAA9\uC774 \uC544\uB2CC \uD56D\uBAA9 \uC720\uD615\uC744 \uCC38\uC870\uD569\uB2C8\uB2E4. -keyclone \uBA85\uB839\uC740 \uC804\uC6A9 \uD0A4 \uD56D\uBAA9\uC758 \uBCF5\uC81C\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4."}, {".WARNING.WARNING.WARNING.", - "***************** \uACBD\uACE0 \uACBD\uACE0 \uACBD\uACE0 *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "\uC11C\uBA85\uC790 #%d:"}, {"Timestamp.", "\uC2DC\uAC04 \uAE30\uB85D:"}, {"Signature.", "\uC11C\uBA85:"}, @@ -400,6 +400,10 @@ public class Resources_ko extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "\uBCF4\uC548 \uD0A4\uB97C \uC0DD\uC131\uD558\uB824\uBA74 -keysize\uB97C \uC81C\uACF5\uD558\uC2ED\uC2DC\uC624."}, + {"verified.by.s.in.s", "%s(%s)\uC5D0 \uC758\uD574 \uD655\uC778\uB428"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "\uACBD\uACE0: \uD655\uC778\uB418\uC9C0 \uC54A\uC74C. -keystore\uAC00 \uC62C\uBC14\uB978\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624."}, + {"Extensions.", "\uD655\uC7A5: "}, {".Empty.value.", "(\uBE44\uC5B4 \uC788\uB294 \uAC12)"}, {"Extension.Request.", "\uD655\uC7A5 \uC694\uCCAD:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java index 50b4d26067e..0080342146b 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_pt_BR.java @@ -40,8 +40,7 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Op\u00E7\u00E3o]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Op\u00E7\u00F5es:"}, {"Use.keytool.help.for.all.available.commands", "Use \"keytool -help\" para todos os comandos dispon\u00EDveis"}, @@ -61,9 +60,8 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { "Exporta o certificado"}, //-exportcert {"Generates.a.key.pair", "Gera um par de chaves"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", - "Gera uma chave Secreta"}, //-genseckey + "Gera uma chave secreta"}, //-genseckey {"Generates.certificate.from.a.certificate.request", "Gera um certificado de uma solicita\u00E7\u00E3o de certificado"}, //-gencert {"Generates.CRL", "Gera CRL"}, //-gencrl @@ -244,8 +242,10 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "Solicita\u00E7\u00E3o de certificado armazenada no arquivo <{0}>"}, {"Submit.this.to.your.CA", "Submeter \u00E0 CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "se o alias n\u00E3o estiver especificado, destalias, srckeypass e destkeypass n\u00E3o dever\u00E3o ser especificados"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "se o alias n\u00E3o estiver especificado, destalias e srckeypass n\u00E3o dever\u00E3o ser especificados"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "O armazenamento de chaves pkcs12 de destino tem storepass e keypass diferentes. Tente novamente especificando -destkeypass."}, {"Certificate.stored.in.file.filename.", "Certificado armazenado no arquivo <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -298,14 +298,14 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { {"Entry.type.type.", "Tipo de entrada: {0}"}, {"Certificate.chain.length.", "Comprimento da cadeia de certificados: "}, {"Certificate.i.1.", "Certificado[{0,number,integer}]:"}, - {"Certificate.fingerprint.SHA1.", "Fingerprint (MD5) do certificado: "}, + {"Certificate.fingerprint.SHA1.", "Fingerprint (SHA1) do certificado: "}, {"Keystore.type.", "Tipo de \u00E1rea de armazenamento de chaves: "}, {"Keystore.provider.", "Fornecedor da \u00E1rea de armazenamento de chaves: "}, {"Your.keystore.contains.keyStore.size.entry", "Sua \u00E1rea de armazenamento de chaves cont\u00E9m {0,number,integer} entrada"}, {"Your.keystore.contains.keyStore.size.entries", "Sua \u00E1rea de armazenamento de chaves cont\u00E9m {0,number,integer} entradas"}, - {"Failed.to.parse.input", "Falha durante o parse da entrada"}, + {"Failed.to.parse.input", "Falha durante o parsing da entrada"}, {"Empty.input", "Entrada vazia"}, {"Not.X.509.certificate", "N\u00E3o \u00E9 um certificado X.509"}, {"alias.has.no.public.key", "{0} n\u00E3o tem chave p\u00FAblica"}, @@ -324,7 +324,7 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", "Ainda deseja adicion\u00E1-lo \u00E0 sua \u00E1rea de armazenamento de chaves? [n\u00E3o]: "}, {"Trust.this.certificate.no.", "Confiar neste certificado? [n\u00E3o]: "}, - {"YES", "Sim"}, + {"YES", "SIM"}, {"New.prompt.", "Nova {0}: "}, {"Passwords.must.differ", "As senhas devem ser diferentes"}, {"Re.enter.new.prompt.", "Informe novamente a nova {0}: "}, @@ -361,7 +361,7 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { "O alias <{0}> faz refer\u00EAncia a um tipo de entrada que n\u00E3o \u00E9 uma entrada de chave privada. O comando -keyclone oferece suporte somente \u00E0 clonagem de entradas de chave privada"}, {".WARNING.WARNING.WARNING.", - "***************** Advert\u00EAncia Advert\u00EAncia Advert\u00EAncia *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Signat\u00E1rio #%d:"}, {"Timestamp.", "Timestamp:"}, {"Signature.", "Assinatura:"}, @@ -386,7 +386,7 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { "Certificado de n\u00EDvel superior na resposta:\n"}, {".is.not.trusted.", "... n\u00E3o \u00E9 confi\u00E1vel. "}, {"Install.reply.anyway.no.", "Instalar resposta assim mesmo? [n\u00E3o]: "}, - {"NO", "N\u00E3o"}, + {"NO", "N\u00C3O"}, {"Public.keys.in.reply.and.keystore.don.t.match", "As chaves p\u00FAblicas da resposta e da \u00E1rea de armazenamento de chaves n\u00E3o correspondem"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Forne\u00E7a o -keysize para a gera\u00E7\u00E3o da chave secreta"}, + {"verified.by.s.in.s", "Verificado por %s em %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "ADVERT\u00CANCIA: n\u00E3o verificado. Certifique-se que -keystore esteja correto."}, + {"Extensions.", "Extens\u00F5es: "}, {".Empty.value.", "(Valor vazio)"}, {"Extension.Request.", "Solicita\u00E7\u00E3o de Extens\u00E3o:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_sv.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_sv.java index a4727e64c88..7c2aa3cba43 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_sv.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_sv.java @@ -40,8 +40,7 @@ public class Resources_sv extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [Alternativ]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "Alternativ:"}, {"Use.keytool.help.for.all.available.commands", "L\u00E4s \"Hj\u00E4lp - Nyckelverktyg\" f\u00F6r alla tillg\u00E4ngliga kommandon"}, @@ -61,7 +60,6 @@ public class Resources_sv extends java.util.ListResourceBundle { "Exporterar certifikat"}, //-exportcert {"Generates.a.key.pair", "Genererar nyckelpar"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "Genererar hemlig nyckel"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -178,7 +176,7 @@ public class Resources_sv extends java.util.ListResourceBundle { {"Illegal.value.", "Otill\u00E5tet v\u00E4rde: "}, {"Unknown.password.type.", "Ok\u00E4nd l\u00F6senordstyp: "}, {"Cannot.find.environment.variable.", - "Kan inte hitta milj\u00F6variabel: "}, + "Hittar inte milj\u00F6variabel: "}, {"Cannot.find.file.", "Hittar inte fil: "}, {"Command.option.flag.needs.an.argument.", "Kommandoalternativet {0} beh\u00F6ver ett argument."}, {"Warning.Different.store.and.key.passwords.not.supported.for.PKCS12.KeyStores.Ignoring.user.specified.command.value.", @@ -244,8 +242,10 @@ public class Resources_sv extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "Certifikatbeg\u00E4ran har lagrats i filen <{0}>"}, {"Submit.this.to.your.CA", "Skicka detta till certifikatutf\u00E4rdaren"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "om n\u00E5got alias inte anges f\u00E5r destalias, srckeypass och destkeypass inte anges"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "om alias inte angivits ska inte heller destalias och srckeypass anges"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "Destinationsnyckellagret pkcs12 har olika storepass och keypass. F\u00F6rs\u00F6k igen med -destkeypass angivet."}, {"Certificate.stored.in.file.filename.", "Certifikatet har lagrats i filen <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -324,7 +324,7 @@ public class Resources_sv extends java.util.ListResourceBundle { {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", "Vill du fortfarande l\u00E4gga till det i ditt eget nyckellagret? [nej]: "}, {"Trust.this.certificate.no.", "Litar du p\u00E5 det h\u00E4r certifikatet? [nej]: "}, - {"YES", "Ja"}, + {"YES", "JA"}, {"New.prompt.", "Nytt {0}: "}, {"Passwords.must.differ", "L\u00F6senorden m\u00E5ste vara olika"}, {"Re.enter.new.prompt.", "Ange nytt {0} igen: "}, @@ -361,7 +361,7 @@ public class Resources_sv extends java.util.ListResourceBundle { "Aliaset <{0}> refererar till en posttyp som inte \u00E4r n\u00E5gon privat nyckelpost. Kommandot -keyclone har endast st\u00F6d f\u00F6r kloning av privata nyckelposter"}, {".WARNING.WARNING.WARNING.", - "***************** Varning Varning Varning *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Signerare #%d:"}, {"Timestamp.", "Tidsst\u00E4mpel:"}, {"Signature.", "Underskrift:"}, @@ -386,7 +386,7 @@ public class Resources_sv extends java.util.ListResourceBundle { "Toppniv\u00E5certifikatet i svaret:\n"}, {".is.not.trusted.", "... \u00E4r inte betrott. "}, {"Install.reply.anyway.no.", "Vill du installera svaret \u00E4nd\u00E5? [nej]: "}, - {"NO", "Nej"}, + {"NO", "NEJ"}, {"Public.keys.in.reply.and.keystore.don.t.match", "De offentliga nycklarna i svaret och nyckellagret matchar inte varandra"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -400,6 +400,10 @@ public class Resources_sv extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "Ange -keysize f\u00F6r att skapa hemlig nyckel"}, + {"verified.by.s.in.s", "Verifierad av %s i %s"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "VARNING: ej verifierad. Se till att -nyckellager \u00E4r korrekt."}, + {"Extensions.", "Till\u00E4gg: "}, {".Empty.value.", "(Tomt v\u00E4rde)"}, {"Extension.Request.", "Till\u00E4ggsbeg\u00E4ran:"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java index 6836bd769f9..814e0fe78c2 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_CN.java @@ -40,8 +40,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [\u9009\u9879]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "\u9009\u9879:"}, {"Use.keytool.help.for.all.available.commands", "\u4F7F\u7528 \"keytool -help\" \u83B7\u53D6\u6240\u6709\u53EF\u7528\u547D\u4EE4"}, @@ -61,9 +60,8 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "\u5BFC\u51FA\u8BC1\u4E66"}, //-exportcert {"Generates.a.key.pair", "\u751F\u6210\u5BC6\u94A5\u5BF9"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", - "\u751F\u6210\u5BF9\u79F0\u5BC6\u94A5"}, //-genseckey + "\u751F\u6210\u5BC6\u94A5"}, //-genseckey {"Generates.certificate.from.a.certificate.request", "\u6839\u636E\u8BC1\u4E66\u8BF7\u6C42\u751F\u6210\u8BC1\u4E66"}, //-gencert {"Generates.CRL", "\u751F\u6210 CRL"}, //-gencrl @@ -182,7 +180,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Cannot.find.file.", "\u627E\u4E0D\u5230\u6587\u4EF6: "}, {"Command.option.flag.needs.an.argument.", "\u547D\u4EE4\u9009\u9879{0}\u9700\u8981\u4E00\u4E2A\u53C2\u6570\u3002"}, {"Warning.Different.store.and.key.passwords.not.supported.for.PKCS12.KeyStores.Ignoring.user.specified.command.value.", - "\u8B66\u544A: PKCS12 KeyStore \u4E0D\u652F\u6301\u5176\u4ED6\u5B58\u50A8\u548C\u5BC6\u94A5\u53E3\u4EE4\u3002\u6B63\u5728\u5FFD\u7565\u7528\u6237\u6307\u5B9A\u7684{0}\u503C\u3002"}, + "\u8B66\u544A: PKCS12 \u5BC6\u94A5\u5E93\u4E0D\u652F\u6301\u5176\u4ED6\u5B58\u50A8\u548C\u5BC6\u94A5\u53E3\u4EE4\u3002\u6B63\u5728\u5FFD\u7565\u7528\u6237\u6307\u5B9A\u7684{0}\u503C\u3002"}, {".keystore.must.be.NONE.if.storetype.is.{0}", "\u5982\u679C -storetype \u4E3A {0}, \u5219 -keystore \u5FC5\u987B\u4E3A NONE"}, {"Too.many.retries.program.terminated", @@ -203,13 +201,13 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "\u5982\u679C\u6E90\u5BC6\u94A5\u5E93\u672A\u53D7\u53E3\u4EE4\u4FDD\u62A4, \u5219\u4E0D\u80FD\u6307\u5B9A -srcstorepass \u548C -srckeypass"}, {"Illegal.startdate.value", "\u975E\u6CD5\u5F00\u59CB\u65E5\u671F\u503C"}, {"Validity.must.be.greater.than.zero", - "\u6709\u6548\u671F\u5FC5\u987B\u5927\u4E8E\u96F6"}, + "\u6709\u6548\u6027\u5FC5\u987B\u5927\u4E8E\u96F6"}, {"provName.not.a.provider", "{0}\u4E0D\u662F\u63D0\u4F9B\u65B9"}, {"Usage.error.no.command.provided", "\u7528\u6CD5\u9519\u8BEF: \u6CA1\u6709\u63D0\u4F9B\u547D\u4EE4"}, {"Source.keystore.file.exists.but.is.empty.", "\u6E90\u5BC6\u94A5\u5E93\u6587\u4EF6\u5B58\u5728, \u4F46\u4E3A\u7A7A: "}, {"Please.specify.srckeystore", "\u8BF7\u6307\u5B9A -srckeystore"}, {"Must.not.specify.both.v.and.rfc.with.list.command", - "'list' \u547D\u4EE4\u4E0D\u80FD\u540C\u65F6\u6307\u5B9A -v \u53CA -rfc"}, + "\u4E0D\u80FD\u4F7F\u7528 'list' \u547D\u4EE4\u6765\u6307\u5B9A -v \u53CA -rfc"}, {"Key.password.must.be.at.least.6.characters", "\u5BC6\u94A5\u53E3\u4EE4\u81F3\u5C11\u5FC5\u987B\u4E3A 6 \u4E2A\u5B57\u7B26"}, {"New.password.must.be.at.least.6.characters", @@ -239,13 +237,15 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Warning.Overwriting.existing.alias.alias.in.destination.keystore", "\u8B66\u544A: \u6B63\u5728\u8986\u76D6\u76EE\u6807\u5BC6\u94A5\u5E93\u4E2D\u7684\u73B0\u6709\u522B\u540D {0}"}, {"Existing.entry.alias.alias.exists.overwrite.no.", - "\u5B58\u5728\u73B0\u6709\u6761\u76EE\u522B\u540D {0}, \u662F\u5426\u8986\u76D6? [no]: "}, + "\u5B58\u5728\u73B0\u6709\u6761\u76EE\u522B\u540D {0}, \u662F\u5426\u8986\u76D6? [\u5426]: "}, {"Too.many.failures.try.later", "\u6545\u969C\u592A\u591A - \u8BF7\u7A0D\u540E\u518D\u8BD5"}, {"Certification.request.stored.in.file.filename.", "\u5B58\u50A8\u5728\u6587\u4EF6 <{0}> \u4E2D\u7684\u8BA4\u8BC1\u8BF7\u6C42"}, {"Submit.this.to.your.CA", "\u5C06\u6B64\u63D0\u4EA4\u7ED9\u60A8\u7684 CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u522B\u540D, \u5219\u4E0D\u80FD\u6307\u5B9A\u76EE\u6807\u522B\u540D, \u6E90\u5BC6\u94A5\u5E93\u53E3\u4EE4\u548C\u76EE\u6807\u5BC6\u94A5\u5E93\u53E3\u4EE4"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u522B\u540D, \u5219\u4E0D\u80FD\u6307\u5B9A\u76EE\u6807\u522B\u540D\u548C\u6E90\u5BC6\u94A5\u5E93\u53E3\u4EE4"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "\u76EE\u6807 pkcs12 \u5BC6\u94A5\u5E93\u5177\u6709\u4E0D\u540C\u7684 storepass \u548C keypass\u3002\u8BF7\u5728\u6307\u5B9A\u4E86 -destkeypass \u65F6\u91CD\u8BD5\u3002"}, {"Certificate.stored.in.file.filename.", "\u5B58\u50A8\u5728\u6587\u4EF6 <{0}> \u4E2D\u7684\u8BC1\u4E66"}, {"Certificate.reply.was.installed.in.keystore", @@ -305,7 +305,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "\u60A8\u7684\u5BC6\u94A5\u5E93\u5305\u542B {0,number,integer} \u4E2A\u6761\u76EE"}, {"Your.keystore.contains.keyStore.size.entries", "\u60A8\u7684\u5BC6\u94A5\u5E93\u5305\u542B {0,number,integer} \u4E2A\u6761\u76EE"}, - {"Failed.to.parse.input", "\u65E0\u6CD5\u5BF9\u8F93\u5165\u8FDB\u884C\u8BED\u6CD5\u5206\u6790"}, + {"Failed.to.parse.input", "\u65E0\u6CD5\u89E3\u6790\u8F93\u5165"}, {"Empty.input", "\u7A7A\u8F93\u5165"}, {"Not.X.509.certificate", "\u975E X.509 \u8BC1\u4E66"}, {"alias.has.no.public.key", "{0}\u6CA1\u6709\u516C\u5171\u5BC6\u94A5"}, @@ -318,13 +318,13 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Certificate.already.exists.in.keystore.under.alias.trustalias.", "\u5728\u522B\u540D <{0}> \u4E4B\u4E0B, \u8BC1\u4E66\u5DF2\u7ECF\u5B58\u5728\u4E8E\u5BC6\u94A5\u5E93\u4E2D"}, {"Do.you.still.want.to.add.it.no.", - "\u662F\u5426\u4ECD\u8981\u6DFB\u52A0? [no]: "}, + "\u662F\u5426\u4ECD\u8981\u6DFB\u52A0? [\u5426]: "}, {"Certificate.already.exists.in.system.wide.CA.keystore.under.alias.trustalias.", "\u5728\u522B\u540D <{0}> \u4E4B\u4E0B, \u8BC1\u4E66\u5DF2\u7ECF\u5B58\u5728\u4E8E\u7CFB\u7EDF\u8303\u56F4\u7684 CA \u5BC6\u94A5\u5E93\u4E2D"}, {"Do.you.still.want.to.add.it.to.your.own.keystore.no.", - "\u662F\u5426\u4ECD\u8981\u5C06\u5B83\u6DFB\u52A0\u5230\u81EA\u5DF1\u7684\u5BC6\u94A5\u5E93? [no]: "}, - {"Trust.this.certificate.no.", "\u662F\u5426\u4FE1\u4EFB\u6B64\u8BC1\u4E66? [no]: "}, - {"YES", "\u662F"}, + "\u662F\u5426\u4ECD\u8981\u5C06\u5B83\u6DFB\u52A0\u5230\u81EA\u5DF1\u7684\u5BC6\u94A5\u5E93? [\u5426]: "}, + {"Trust.this.certificate.no.", "\u662F\u5426\u4FE1\u4EFB\u6B64\u8BC1\u4E66? [\u5426]: "}, + {"YES", "YES"}, {"New.prompt.", "\u65B0{0}: "}, {"Passwords.must.differ", "\u53E3\u4EE4\u4E0D\u80FD\u76F8\u540C"}, {"Re.enter.new.prompt.", "\u91CD\u65B0\u8F93\u5165\u65B0{0}: "}, @@ -332,7 +332,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"They.don.t.match.Try.again", "\u5B83\u4EEC\u4E0D\u5339\u914D\u3002\u8BF7\u91CD\u8BD5"}, {"Enter.prompt.alias.name.", "\u8F93\u5165{0}\u522B\u540D: "}, {"Enter.new.alias.name.RETURN.to.cancel.import.for.this.entry.", - "\u8F93\u5165\u65B0\u7684\u522B\u540D\t(\u6309\u56DE\u8F66\u4EE5\u53D6\u6D88\u5BF9\u6B64\u6761\u76EE\u7684\u5BFC\u5165): "}, + "\u5BFC\u5165\u65B0\u7684\u522B\u540D\t(\u6309\u56DE\u8F66\u4EE5\u53D6\u6D88\u5BF9\u6B64\u6761\u76EE\u7684\u5BFC\u5165): "}, {"Enter.alias.name.", "\u8F93\u5165\u522B\u540D: "}, {".RETURN.if.same.as.for.otherAlias.", "\t(\u5982\u679C\u548C <{0}> \u76F8\u540C, \u5219\u6309\u56DE\u8F66)"}, @@ -361,7 +361,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { "\u522B\u540D <{0}> \u5F15\u7528\u4E86\u4E0D\u5C5E\u4E8E\u79C1\u6709\u5BC6\u94A5\u6761\u76EE\u7684\u6761\u76EE\u7C7B\u578B\u3002-keyclone \u547D\u4EE4\u4EC5\u652F\u6301\u5BF9\u79C1\u6709\u5BC6\u94A5\u6761\u76EE\u7684\u514B\u9686"}, {".WARNING.WARNING.WARNING.", - "***************** \u8B66\u544A \u8B66\u544A \u8B66\u544A *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "\u7B7E\u540D\u8005 #%d:"}, {"Timestamp.", "\u65F6\u95F4\u6233:"}, {"Signature.", "\u7B7E\u540D:"}, @@ -385,8 +385,8 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Top.level.certificate.in.reply.", "\u56DE\u590D\u4E2D\u7684\u9876\u7EA7\u8BC1\u4E66:\n"}, {".is.not.trusted.", "... \u662F\u4E0D\u53EF\u4FE1\u7684\u3002"}, - {"Install.reply.anyway.no.", "\u662F\u5426\u4ECD\u8981\u5B89\u88C5\u56DE\u590D? [no]: "}, - {"NO", "\u5426"}, + {"Install.reply.anyway.no.", "\u662F\u5426\u4ECD\u8981\u5B89\u88C5\u56DE\u590D? [\u5426]: "}, + {"NO", "NO"}, {"Public.keys.in.reply.and.keystore.don.t.match", "\u56DE\u590D\u4E2D\u7684\u516C\u5171\u5BC6\u94A5\u4E0E\u5BC6\u94A5\u5E93\u4E0D\u5339\u914D"}, {"Certificate.reply.and.certificate.in.keystore.are.identical", @@ -398,7 +398,11 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Secret.key.not.generated.alias.alias.already.exists", "\u6CA1\u6709\u751F\u6210\u5BC6\u94A5, \u522B\u540D <{0}> \u5DF2\u7ECF\u5B58\u5728"}, {"Please.provide.keysize.for.secret.key.generation", - "\u8BF7\u63D0\u4F9B -keysize \u4EE5\u751F\u6210\u5BF9\u79F0\u5BC6\u94A5"}, + "\u8BF7\u63D0\u4F9B -keysize \u4EE5\u751F\u6210\u5BC6\u94A5"}, + + {"verified.by.s.in.s", "\u7531 %s \u9A8C\u8BC1(\u5728 %s \u4E2D)"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "\u8B66\u544A: \u672A\u9A8C\u8BC1\u3002\u8BF7\u786E\u4FDD\u5BC6\u94A5\u5E93\u662F\u6B63\u786E\u7684\u3002"}, {"Extensions.", "\u6269\u5C55: "}, {".Empty.value.", "(\u7A7A\u503C)"}, diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java index 2c7bdf5e1b7..0b6afb8a74f 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources_zh_TW.java @@ -40,8 +40,7 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { "*******************************************\n\n"}, // keytool: Help part -// "Option" should be translated. - {".OPTION.", " [\u9078\u9805]..."}, + {".OPTION.", " [OPTION]..."}, {"Options.", "\u9078\u9805:"}, {"Use.keytool.help.for.all.available.commands", "\u4F7F\u7528 \"keytool -help\" \u53D6\u5F97\u6240\u6709\u53EF\u7528\u7684\u547D\u4EE4"}, @@ -61,7 +60,6 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { "\u532F\u51FA\u6191\u8B49"}, //-exportcert {"Generates.a.key.pair", "\u7522\u751F\u91D1\u9470\u7D44"}, //-genkeypair -// translation of "secret" key should be different to "private" key. {"Generates.a.secret.key", "\u7522\u751F\u79D8\u5BC6\u91D1\u9470"}, //-genseckey {"Generates.certificate.from.a.certificate.request", @@ -244,8 +242,10 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { {"Certification.request.stored.in.file.filename.", "\u8A8D\u8B49\u8981\u6C42\u5132\u5B58\u5728\u6A94\u6848 <{0}>"}, {"Submit.this.to.your.CA", "\u5C07\u6B64\u9001\u51FA\u81F3\u60A8\u7684 CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "\u5982\u679C\u672A\u6307\u5B9A\u5225\u540D\uFF0C\u5247\u4E0D\u80FD\u6307\u5B9A destalias\u3001srckeypass \u53CA destkeypass"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "\u5982\u679C\u672A\u6307\u5B9A\u5225\u540D\uFF0C\u5247\u4E0D\u80FD\u6307\u5B9A destalias \u548C srckeypass"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "\u76EE\u7684\u5730 pkcs12 \u91D1\u9470\u5132\u5B58\u5EAB\u7684 storepass \u548C keypass \u4E0D\u540C\u3002\u8ACB\u91CD\u65B0\u4EE5 -destkeypass \u6307\u5B9A\u3002"}, {"Certificate.stored.in.file.filename.", "\u6191\u8B49\u5132\u5B58\u5728\u6A94\u6848 <{0}>"}, {"Certificate.reply.was.installed.in.keystore", @@ -361,7 +361,7 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { "\u5225\u540D <{0}> \u6240\u53C3\u7167\u7684\u9805\u76EE\u4E0D\u662F\u79C1\u5BC6\u91D1\u9470\u985E\u578B\u3002-keyclone \u547D\u4EE4\u50C5\u652F\u63F4\u79C1\u5BC6\u91D1\u9470\u9805\u76EE\u7684\u8907\u88FD"}, {".WARNING.WARNING.WARNING.", - "***************** \u8B66\u544A \u8B66\u544A \u8B66\u544A *****************"}, + "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "\u7C3D\u7F72\u8005 #%d:"}, {"Timestamp.", "\u6642\u6233:"}, {"Signature.", "\u7C3D\u7AE0:"}, @@ -383,7 +383,7 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { {"Certificate.chain.in.reply.does.not.verify.", "\u56DE\u8986\u6642\u7684\u6191\u8B49\u93C8\u672A\u9A57\u8B49: "}, {"Top.level.certificate.in.reply.", - "\u56DE\u8986\u6642\u7684\u6700\u9AD8\u7D1A\u6191\u8B49:\\n"}, + "\u56DE\u8986\u6642\u7684\u6700\u9AD8\u7D1A\u6191\u8B49:\n"}, {".is.not.trusted.", "... \u662F\u4E0D\u88AB\u4FE1\u4EFB\u7684\u3002"}, {"Install.reply.anyway.no.", "\u9084\u662F\u8981\u5B89\u88DD\u56DE\u8986\uFF1F [\u5426]: "}, {"NO", "\u5426"}, @@ -400,6 +400,10 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { {"Please.provide.keysize.for.secret.key.generation", "\u8ACB\u63D0\u4F9B -keysize \u4EE5\u7522\u751F\u79D8\u5BC6\u91D1\u9470"}, + {"verified.by.s.in.s", "\u7531 %s \u9A57\u8B49 (\u5728 %s \u4E2D)"}, + {"warning.not.verified.make.sure.keystore.is.correct", + "\u8B66\u544A: \u672A\u9A57\u8B49\u3002\u8ACB\u78BA\u5B9A -keystore \u6B63\u78BA\u3002"}, + {"Extensions.", "\u64F4\u5145\u5957\u4EF6: "}, {".Empty.value.", "(\u7A7A\u767D\u503C)"}, {"Extension.Request.", "\u64F4\u5145\u5957\u4EF6\u8981\u6C42:"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_de.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_de.java index 4ca4c7e3394..a00f9e9d809 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_de.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_de.java @@ -57,7 +57,7 @@ public class Resources_de extends java.util.ListResourceBundle { {"Retain", "Beibehalten"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", - "Warnung: M\u00F6glicherweise enth\u00E4lt der Dateiname Escape-Zeichen mit Backslash. Es ist nicht notwendig, Backslash-Zeichen zu escapen (das Tool f\u00FChrt dies automatisch beim Schreiben des Policy-Contents in den persistenten Speicher aus).\n\nKlicken Sie auf \"Beibehalten\", um den eingegebenen Namen beizubehalten oder auf \"Bearbeiten\", um den Namen zu bearbeiten."}, + "Warnung: M\u00F6glicherweise enth\u00E4lt der Dateiname Escapezeichen mit Backslash. Es ist nicht notwendig, Backslash-Zeichen zu escapen (das Tool f\u00FChrt dies automatisch beim Schreiben des Policy-Contents in den persistenten Speicher aus).\n\nKlicken Sie auf \"Beibehalten\", um den eingegebenen Namen beizubehalten oder auf \"Bearbeiten\", um den Namen zu bearbeiten."}, {"Add.Public.Key.Alias", "Public Key-Alias hinzuf\u00FCgen"}, {"Remove.Public.Key.Alias", "Public Key-Alias entfernen"}, @@ -134,6 +134,9 @@ public class Resources_de extends java.util.ListResourceBundle { {"policy.type", "Policy-Typ"}, {"property.name", "Eigenschaftsname"}, {"provider.name", "Providername"}, + {"url", "URL"}, + {"method.list", "Methodenliste"}, + {"request.headers.list", "Headerliste anfordern"}, {"Principal.List", "Principal-Liste"}, {"Permission.List", "Berechtigungsliste"}, {"Code.Base", "Codebase"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_es.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_es.java index 142550094bd..6e92889c1bd 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_es.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_es.java @@ -134,6 +134,9 @@ public class Resources_es extends java.util.ListResourceBundle { {"policy.type", "tipo de pol\u00EDtica"}, {"property.name", "nombre de la propiedad"}, {"provider.name", "nombre del proveedor"}, + {"url", "url"}, + {"method.list", "lista de m\u00E9todos"}, + {"request.headers.list", "lista de cabeceras de solicitudes"}, {"Principal.List", "Lista de Principales"}, {"Permission.List", "Lista de Permisos"}, {"Code.Base", "Base de C\u00F3digo"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_fr.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_fr.java index 898e9cc8c9b..adba418d9b4 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_fr.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_fr.java @@ -134,6 +134,9 @@ public class Resources_fr extends java.util.ListResourceBundle { {"policy.type", "type de r\u00E8gle"}, {"property.name", "nom de propri\u00E9t\u00E9"}, {"provider.name", "nom du fournisseur"}, + {"url", "url"}, + {"method.list", "liste des m\u00E9thodes"}, + {"request.headers.list", "liste des en-t\u00EAtes de demande"}, {"Principal.List", "Liste de principaux"}, {"Permission.List", "Liste de droits"}, {"Code.Base", "Base de code"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_it.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_it.java index 3daf8616bee..813be7cfb19 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_it.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_it.java @@ -41,7 +41,7 @@ public class Resources_it extends java.util.ListResourceBundle { "Avvertenza: argomento o argomenti non validi per il costruttore {0}"}, {"Illegal.Principal.Type.type", "Tipo principal non valido: {0}"}, {"Illegal.option.option", "Opzione non valida: {0}"}, - {"Usage.policytool.options.", "Utilizzo: policytool [opzioni]"}, + {"Usage.policytool.options.", "Uso: policytool [opzioni]"}, {".file.file.policy.file.location", " [-file ] posizione del file dei criteri"}, {"New", "Nuovo"}, @@ -134,6 +134,9 @@ public class Resources_it extends java.util.ListResourceBundle { {"policy.type", "tipo di criteri"}, {"property.name", "nome propriet\u00E0"}, {"provider.name", "nome provider"}, + {"url", "url"}, + {"method.list", "lista metodi"}, + {"request.headers.list", "lista intestazioni di richiesta"}, {"Principal.List", "Lista principal"}, {"Permission.List", "Lista autorizzazioni"}, {"Code.Base", "Codebase"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_ja.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_ja.java index a3f901aa8f5..bd07eb0ee70 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_ja.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_ja.java @@ -134,6 +134,9 @@ public class Resources_ja extends java.util.ListResourceBundle { {"policy.type", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30BF\u30A4\u30D7"}, {"property.name", "\u30D7\u30ED\u30D1\u30C6\u30A3\u540D"}, {"provider.name", "\u30D7\u30ED\u30D0\u30A4\u30C0\u540D"}, + {"url", "URL"}, + {"method.list", "\u30E1\u30BD\u30C3\u30C9\u30FB\u30EA\u30B9\u30C8"}, + {"request.headers.list", "\u30EA\u30AF\u30A8\u30B9\u30C8\u30FB\u30D8\u30C3\u30C0\u30FC\u30FB\u30EA\u30B9\u30C8"}, {"Principal.List", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30EA\u30B9\u30C8"}, {"Permission.List", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u30EA\u30B9\u30C8"}, {"Code.Base", "\u30B3\u30FC\u30C9\u30FB\u30D9\u30FC\u30B9"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_ko.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_ko.java index 7797ec803a0..3dc58f2eeb2 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_ko.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_ko.java @@ -134,6 +134,9 @@ public class Resources_ko extends java.util.ListResourceBundle { {"policy.type", "\uC815\uCC45 \uC720\uD615"}, {"property.name", "\uC18D\uC131 \uC774\uB984"}, {"provider.name", "\uC81C\uACF5\uC790 \uC774\uB984"}, + {"url", "URL"}, + {"method.list", "\uBA54\uC18C\uB4DC \uBAA9\uB85D"}, + {"request.headers.list", "\uC694\uCCAD \uD5E4\uB354 \uBAA9\uB85D"}, {"Principal.List", "\uC8FC\uCCB4 \uBAA9\uB85D"}, {"Permission.List", "\uAD8C\uD55C \uBAA9\uB85D"}, {"Code.Base", "\uCF54\uB4DC \uBCA0\uC774\uC2A4"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java index 9bd9808d0b5..2290701f755 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java @@ -134,6 +134,9 @@ public class Resources_pt_BR extends java.util.ListResourceBundle { {"policy.type", "tipo de pol\u00EDtica"}, {"property.name", "nome da propriedade"}, {"provider.name", "nome do fornecedor"}, + {"url", "url"}, + {"method.list", "lista de m\u00E9todos"}, + {"request.headers.list", "solicitar lista de cabe\u00E7alhos"}, {"Principal.List", "Lista de Principais"}, {"Permission.List", "Lista de Permiss\u00F5es"}, {"Code.Base", "Base de C\u00F3digo"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_sv.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_sv.java index f0bf734ae40..0929eec984e 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_sv.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_sv.java @@ -134,6 +134,9 @@ public class Resources_sv extends java.util.ListResourceBundle { {"policy.type", "policytyp"}, {"property.name", "egenskapsnamn"}, {"provider.name", "leverant\u00F6rsnamn"}, + {"url", "url"}, + {"method.list", "metodlista"}, + {"request.headers.list", "beg\u00E4ranrubriklista"}, {"Principal.List", "Lista \u00F6ver identitetshavare"}, {"Permission.List", "Beh\u00F6righetslista"}, {"Code.Base", "Kodbas"}, diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java index fcf8e126d4c..d96dc07d71b 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java @@ -35,7 +35,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { private static final Object[][] contents = { {"NEWLINE", "\n"}, {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.", - "\u8B66\u544A: \u522B\u540D {0} \u7684\u516C\u5171\u5BC6\u94A5\u4E0D\u5B58\u5728\u3002\u8BF7\u786E\u4FDD\u5DF2\u6B63\u786E\u914D\u7F6E KeyStore\u3002"}, + "\u8B66\u544A: \u522B\u540D {0} \u7684\u516C\u5171\u5BC6\u94A5\u4E0D\u5B58\u5728\u3002\u8BF7\u786E\u4FDD\u5DF2\u6B63\u786E\u914D\u7F6E\u5BC6\u94A5\u5E93\u3002"}, {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u7C7B: {0}"}, {"Warning.Invalid.argument.s.for.constructor.arg", "\u8B66\u544A: \u6784\u9020\u5668\u7684\u53C2\u6570\u65E0\u6548: {0}"}, @@ -62,7 +62,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Add.Public.Key.Alias", "\u6DFB\u52A0\u516C\u5171\u5BC6\u94A5\u522B\u540D"}, {"Remove.Public.Key.Alias", "\u5220\u9664\u516C\u5171\u5BC6\u94A5\u522B\u540D"}, {"File", "\u6587\u4EF6"}, - {"KeyStore", "KeyStore"}, + {"KeyStore", "\u5BC6\u94A5\u5E93"}, {"Policy.File.", "\u7B56\u7565\u6587\u4EF6:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "\u65E0\u6CD5\u6253\u5F00\u7B56\u7565\u6587\u4EF6: {0}: {1}"}, @@ -94,10 +94,10 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {".Edit.Permission", " \u7F16\u8F91\u6743\u9650"}, {"Remove.Permission", "\u5220\u9664\u6743\u9650"}, {"Done", "\u5B8C\u6210"}, - {"KeyStore.URL.", "KeyStore URL:"}, - {"KeyStore.Type.", "KeyStore \u7C7B\u578B:"}, - {"KeyStore.Provider.", "KeyStore \u63D0\u4F9B\u65B9:"}, - {"KeyStore.Password.URL.", "KeyStore \u53E3\u4EE4 URL:"}, + {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL:"}, + {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B:"}, + {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9:"}, + {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"}, {"Principals", "\u4E3B\u7528\u6237"}, {".Edit.Principal.", " \u7F16\u8F91\u4E3B\u7528\u6237:"}, {".Add.New.Principal.", " \u6DFB\u52A0\u65B0\u4E3B\u7528\u6237:"}, @@ -123,7 +123,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Save.Changes", "\u4FDD\u5B58\u66F4\u6539"}, {"No.Policy.Entry.selected", "\u6CA1\u6709\u9009\u62E9\u7B56\u7565\u6761\u76EE"}, {"Unable.to.open.KeyStore.ex.toString.", - "\u65E0\u6CD5\u6253\u5F00 KeyStore: {0}"}, + "\u65E0\u6CD5\u6253\u5F00\u5BC6\u94A5\u5E93: {0}"}, {"No.principal.selected", "\u672A\u9009\u62E9\u4E3B\u7528\u6237"}, {"No.permission.selected", "\u6CA1\u6709\u9009\u62E9\u6743\u9650"}, {"name", "\u540D\u79F0"}, @@ -134,11 +134,14 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"policy.type", "\u7B56\u7565\u7C7B\u578B"}, {"property.name", "\u5C5E\u6027\u540D\u79F0"}, {"provider.name", "\u63D0\u4F9B\u65B9\u540D\u79F0"}, + {"url", "URL"}, + {"method.list", "\u65B9\u6CD5\u5217\u8868"}, + {"request.headers.list", "\u8BF7\u6C42\u6807\u5934\u5217\u8868"}, {"Principal.List", "\u4E3B\u7528\u6237\u5217\u8868"}, {"Permission.List", "\u6743\u9650\u5217\u8868"}, {"Code.Base", "\u4EE3\u7801\u5E93"}, - {"KeyStore.U.R.L.", "KeyStore URL:"}, - {"KeyStore.Password.U.R.L.", "KeyStore \u53E3\u4EE4 URL:"} + {"KeyStore.U.R.L.", "\u5BC6\u94A5\u5E93 URL:"}, + {"KeyStore.Password.U.R.L.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"} }; diff --git a/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java b/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java index 1c241a6afa1..5a9af4ed40f 100644 --- a/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java +++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java @@ -134,6 +134,9 @@ public class Resources_zh_TW extends java.util.ListResourceBundle { {"policy.type", "\u539F\u5247\u985E\u578B"}, {"property.name", "\u5C6C\u6027\u540D\u7A31"}, {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"}, + {"url", "URL"}, + {"method.list", "\u65B9\u6CD5\u6E05\u55AE"}, + {"request.headers.list", "\u8981\u6C42\u6A19\u982D\u6E05\u55AE"}, {"Principal.List", "Principal \u6E05\u55AE"}, {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"}, {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"}, diff --git a/jdk/src/share/classes/sun/security/util/Resources_fr.java b/jdk/src/share/classes/sun/security/util/Resources_fr.java index 44a6d5f9e79..f31968fcf42 100644 --- a/jdk/src/share/classes/sun/security/util/Resources_fr.java +++ b/jdk/src/share/classes/sun/security/util/Resources_fr.java @@ -65,12 +65,12 @@ public class Resources_fr extends java.util.ListResourceBundle { {"invalid.null.Class.provided", "classe NULL fournie non valide"}, {"Subject.", "Objet :\n"}, {".Principal.", "\tPrincipal : "}, - {".Public.Credential.", "\tInformations d'identification et de connexion publiques : "}, + {".Public.Credential.", "\tInformations d'identification publiques : "}, {".Private.Credentials.inaccessible.", - "\tInformations d'identification et de connexion priv\u00E9es inaccessibles\n"}, - {".Private.Credential.", "\tInformations d'identification et de connexion priv\u00E9es : "}, + "\tInformations d'identification priv\u00E9es inaccessibles\n"}, + {".Private.Credential.", "\tInformations d'identification priv\u00E9es : "}, {".Private.Credential.inaccessible.", - "\tInformations d'identification et de connexion priv\u00E9es inaccessibles\n"}, + "\tInformations d'identification priv\u00E9es inaccessibles\n"}, {"Subject.is.read.only", "Sujet en lecture seule"}, {"attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set", "tentative d'ajout d'un objet qui n'est pas une instance de java.security.Principal dans un ensemble de principaux du sujet"}, 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 678d292b4f2..4dd5d5f9129 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 @@ -29,7 +29,6 @@ error.bad.option=Eine der Optionen -{ctxu} muss angegeben werden. error.bad.cflag=Kennzeichen "c" erfordert Angabe von Manifest oder Eingabedateien. error.bad.uflag=Kennzeichen "u" erfordert Angabe von Manifest, Kennzeichen "e" oder Eingabedateien. error.bad.eflag=Kennzeichen "e" und Manifest mit dem Attribut "Main-Class" k\u00F6nnen nicht zusammen angegeben\nwerden. -error.bad.pvalue=ung\u00FCltiger Wert f\u00FCr Attribut "Profil": {0} 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 @@ -42,7 +41,7 @@ out.deflated=({0} % verkleinert) out.stored=(0 % gespeichert) out.create=\ erstellt: {0} out.extracted=extrahiert: {0} -out.inflated=\ \\vergr\u00F6\u00DFert: {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 Manifestinformationen von angegebener Manifestdatei einschlie\u00DFen\n -e Anwendungseinstiegspunkt f\u00FCr die \n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n -p Profilnamen angeben\n -0 Nur speichern (keine ZIP-Komprimierung)\n -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Indexinformationen f\u00FCr angegebene 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 Manifestdatei, 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 dem Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifestdatei "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}[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 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 ff24bed068d..e5ce11bda79 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 @@ -29,7 +29,6 @@ error.bad.option=Se debe especificar una de las opciones -{ctxu}. error.bad.cflag=El indicador 'c' necesita la especificaci\u00F3n de archivos de manifiesto o de entrada. error.bad.uflag=El indicador 'u' necesita la especificaci\u00F3n de archivos de manifiesto, de entrada o indicador 'e'. error.bad.eflag=El indicador 'e' y el manifiesto con el atributo 'Main-Class' no pueden especificarse \na la vez. -error.bad.pvalue=valor err\u00F3neo para el atributo ''Profile'': {0} 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 @@ -42,7 +41,7 @@ out.deflated=(desinflado {0}%) out.stored=(almacenado 0%) out.create=\ creado: {0} out.extracted=extra\u00EDdo: {0} -out.inflated=\ \\inflado: {0} +out.inflated=\ inflado: {0} out.size=(entrada = {0}) (salida = {1}) -usage=Sintaxis: archivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOpciones:\n -c crear nuevo archivo\n -t mostrar la tabla de contenido del archivo\n -x extraer los archivos mencionados (o todos) del archivo\n -u actualizar archivo existente\n -v generar salida detallada de los datos de salida est\u00E1ndar\n -f especificar nombre de archivo de almacenamiento\n -m incluir informaci\u00F3n de manifiesto del archivo 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 archivo jar ejecutable\n -p especificar nombre de perfil\n -0 solo almacenar; no utilizar compresi\u00F3n ZIP\n -M no crear un archivo de manifiesto para las entradas\n -i generar informaci\u00F3n de \u00EDndice para los archivos 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\narchivos del directorio foo/ en'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n +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 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 f26335287fb..c7cae813be4 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 @@ -29,7 +29,6 @@ error.bad.option=Une des options -{ctxu} doit \u00EAtre sp\u00E9cifi\u00E9e. error.bad.cflag=L'indicateur c requiert la sp\u00E9cification d'un fichier manifeste ou d'un fichier d'entr\u00E9e. error.bad.uflag=L'indicateur u requiert la sp\u00E9cification d'un fichier manifeste, d'un fichier d'entr\u00E9e ou d'un indicateur e. error.bad.eflag=L'indicateur e et le fichier manifeste portant l'attribut Main-Class ne peuvent pas \u00EAtre sp\u00E9cifi\u00E9s \nensemble. -error.bad.pvalue=valeur incorrecte pour l''attribut ''Profile'' : {0} 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 @@ -42,7 +41,7 @@ out.deflated=(compression : {0} %) out.stored=(stockage : 0 %) out.create=\ cr\u00E9\u00E9 : {0} out.extracted=extrait : {0} -out.inflated=\ \\d\u00E9compress\u00E9 : {0} +out.inflated=\ d\u00E9compress\u00E9 : {0} out.size=(entr\u00E9e = {0}) (sortie = {1}) -usage=Syntaxe : jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\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 sortie en mode verbose d'une sortie standard\n -f sp\u00E9cifie le nom du fichier d'archive\n -m inclut les informations de manifest \u00E0 partir du fichier manifest 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 -p indique le nom de profil\n -0 stockage uniquement, pas de compression ZIP\n -M ne cr\u00E9e pas de fichier manifest 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 manifest, 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 manifest existant 'mymanifest', puis archiver tous les\n fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n jar cvfm classes.jar mymanifest -C foo/ .\n +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 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 313169c83b0..50652a82056 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 @@ -29,7 +29,6 @@ error.bad.option=\u00C8 necessario specificare una delle opzioni -{ctxu}. error.bad.cflag=Per il flag 'c' \u00E8 necessario specificare file manifest o di input. error.bad.uflag=Per il flag 'u' \u00E8 necessario specificare il flag 'e' oppure file manifest o di input. error.bad.eflag=Il flag 'e' e il manifest con l'attributo 'Main-Class' non possono essere specificati\ninsieme. -error.bad.pvalue=valore non valido per l''attributo ''Profile'': {0} 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 @@ -42,7 +41,7 @@ out.deflated=(compresso {0}%) out.stored=(memorizzato 0%) out.create=\ creato: {0} out.extracted=estratto: {0} -out.inflated=\ \\decompresso: {0} +out.inflated=\ decompresso: {0} out.size=(in = {0}) (out = {1}) -usage=Uso: jar {ctxui}[vfm0Me] [jar-file] [file manifest] [punto di accesso] [-C dir] file ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza il sommario dell'archivio\n -x estrae i file specificati (o tutti i file) dall'archivio\n -u aggiorna un archivio esistente\n -v genera un output descrittivo dall'output standard\n -f specifica il nome file dell'archivio\n -m include le informazioni manifest dal file manifest specificato\n -e specifica il punto di accesso per l'applicazione standalone \n inclusa in un file JAR eseguibile\n -p specifica il nome del profilo\n -0 esegue solo la memorizzazione; non utilizza la compressione ZIP\n -M non crea un file manifest per le voci\n -i genera le informazioni di indice per i file JAR specificati\n -C passa alla directory specificata e include il file seguente\nSe un file qualsiasi \u00E8 una directory, viene elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di accesso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' e 'e'.\n\nEsempio 1: archiviazione di due file di classe nell'archivio denominato classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: uso 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}[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 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 b909c46d04a..7167ef10ec0 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 @@ -29,7 +29,6 @@ error.bad.option=\u30AA\u30D7\u30B7\u30E7\u30F3-{ctxu}\u306E\u3046\u3061\u306E1\ error.bad.cflag=\u30D5\u30E9\u30B0'c'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002 error.bad.uflag=\u30D5\u30E9\u30B0'u'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304B'e'\u30D5\u30E9\u30B0\u3001\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002 error.bad.eflag='e'\u30D5\u30E9\u30B0\u3068'Main-Class'\u5C5E\u6027\u3092\u6301\u3064\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u540C\u6642\u306B\n\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002 -error.bad.pvalue=''Profile''\u5C5E\u6027\u306E\u5024\u304C\u4E0D\u6B63\u3067\u3059: {0} error.nosuch.fileordir={0}\u3068\u3044\u3046\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u3042\u308A\u307E\u305B\u3093 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 @@ -42,7 +41,7 @@ out.deflated=({0}%\u53CE\u7E2E\u3055\u308C\u307E\u3057\u305F) out.stored=(0%\u683C\u7D0D\u3055\u308C\u307E\u3057\u305F) out.create=\ {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F out.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F -out.inflated=\ \\{0}\u304C\u5C55\u958B\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 -p \u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u540D\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'\u3068\u540C\u3058\u9806\u5E8F\u3067\u6307\u5B9A\u3057\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}[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 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 472d2d94dc2..2b414a0369d 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 @@ -29,20 +29,19 @@ error.bad.option=\uC635\uC158 -{ctxu} \uC911 \uD558\uB098\uB97C \uC9C0\uC815\uD5 error.bad.cflag='c' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4! error.bad.uflag='u' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest, 'e' \uD50C\uB798\uADF8 \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4! error.bad.eflag='e' \uD50C\uB798\uADF8 \uBC0F Manifest\uB97C 'Main-Class' \uC18D\uC131\uACFC \uD568\uAED8 \uC9C0\uC815\uD560 \uC218\n\uC5C6\uC2B5\uB2C8\uB2E4! -error.bad.pvalue=''Profile'' \uC18D\uC131\uC5D0 \uB300\uD574 \uC798\uBABB\uB41C \uAC12: {0} error.nosuch.fileordir={0}: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. 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} out.added.manifest=Manifest\uB97C \uCD94\uAC00\uD568 -out.update.manifest=Manifest\uB97C \uAC31\uC2E0\uD568 +out.update.manifest=Manifest\uB97C \uC5C5\uB370\uC774\uD2B8\uD568 out.ignore.entry={0} \uD56D\uBAA9\uC744 \uBB34\uC2DC\uD558\uB294 \uC911 out.adding=\uCD94\uAC00\uD558\uB294 \uC911: {0} out.deflated=({0}%\uB97C \uAC10\uC18C\uD568) out.stored=(0%\uB97C \uC800\uC7A5\uD568) out.create=\ \uC0DD\uC131\uB428: {0} out.extracted=\uCD94\uCD9C\uB428: {0} -out.inflated=\ \\\uC99D\uAC00\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 -p \uD504\uB85C\uD30C\uC77C \uC774\uB984\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}[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 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 4c4c9f89e21..db6bd74b1e3 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 @@ -29,7 +29,6 @@ error.bad.option=Uma das op\u00E7\u00F5es -{ctxu} deve ser especificada. error.bad.cflag=flag 'c' requer que os arquivos de manifesto ou entrada sejam especificados! error.bad.uflag=o flag 'u' requer que arquivos de manifesto, o flag 'e' ou arquivos de entrada sejam especificados! error.bad.eflag=o flag 'e' e manifesto com o atributo 'Main-Class' n\u00E3o podem ser especificados \njuntos! -error.bad.pvalue=valor inv\u00E1lido do atributo de ''Perfil'': {0} 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 @@ -38,11 +37,11 @@ out.added.manifest=manifesto adicionado out.update.manifest=manifesto atualizado out.ignore.entry=ignorando entrada {0} out.adding=adicionando: {0} -out.deflated=(vazio {0}%) +out.deflated=(compactado {0}%) out.stored=(armazenado 0%) out.create=\ criado: {0} out.extracted=extra\u00EDdo: {0} -out.inflated=\ \\cheio: {0} -out.size=(dentro = {0}) (fora= {1}) +out.inflated=\ inflado: {0} +out.size=(entrada = {0}) (sa\u00EDda= {1}) -usage=Uso: arquivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\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 empacotado em um arquivo jar execut\u00E1vel\n -p especifca o nome do perfil\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}[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 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 e91207a7151..a90708825c1 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 @@ -29,7 +29,6 @@ error.bad.option=Ett av alternativen -{ctxu} m\u00E5ste anges. error.bad.cflag=f\u00F6r c-flaggan m\u00E5ste manifest- eller indatafiler anges. error.bad.uflag=f\u00F6r u-flaggan m\u00E5ste manifest-, e-flagg- eller indatafiler anges. error.bad.eflag=e-flaggan och manifest med attributet Main-Class kan inte anges \ntillsammans. -error.bad.pvalue=felaktigt v\u00E4rde f\u00F6r ''Profile''-attribut: {0} 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 @@ -45,4 +44,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 -p ange profilnamn\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 +usage=Syntax: jar {ctxui}[vfm0Me] [jar fil] [manifestfil] [startpunkt] [-C-katalog] ...\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 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 250bf2b783e..2ee8e568ffa 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 @@ -29,7 +29,6 @@ error.bad.option=\u5FC5\u987B\u6307\u5B9A {ctxu} \u4E2D\u7684\u4EFB\u4E00\u9009\ error.bad.cflag='c' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355\u6216\u8F93\u5165\u6587\u4EF6! error.bad.uflag='u' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355, 'e' \u6807\u8BB0\u6216\u8F93\u5165\u6587\u4EF6! error.bad.eflag=\u4E0D\u80FD\u540C\u65F6\u6307\u5B9A 'e' \u6807\u8BB0\u548C\u5177\u6709 'Main-Class' \u5C5E\u6027\u7684\n\u6E05\u5355! -error.bad.pvalue=''Profile'' \u5C5E\u6027\u7684\u503C\u9519\u8BEF: {0} error.nosuch.fileordir={0}: \u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6\u6216\u76EE\u5F55 error.write.file=\u5199\u5165\u73B0\u6709\u7684 jar \u6587\u4EF6\u65F6\u51FA\u9519 error.create.dir={0}: \u65E0\u6CD5\u521B\u5EFA\u76EE\u5F55 @@ -45,4 +44,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:\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 -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 -p \u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u540D\u79F0\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\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/\u3002\n +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/\u3002\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 ff5eedccaa8..7dd4f65390b 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 @@ -29,7 +29,6 @@ error.bad.option=\u5176\u4E2D\u4E00\u500B\u9078\u9805 -{ctxu} \u5FC5\u9808\u52A0 error.bad.cflag='c' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u6216\u8F38\u5165\u6A94\u6848\uFF01 error.bad.uflag='u' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u3001'e' \u65D7\u6A19\u6216\u8F38\u5165\u6A94\u6848\uFF01 error.bad.eflag=\u7121\u6CD5\u540C\u6642\u6307\u5B9A 'e' \u65D7\u6A19\u548C\u5177\u6709 'Main-Class' \u5C6C\u6027\u7684\n\u8CC7\u8A0A\u6E05\u55AE\uFF01 -error.bad.pvalue=''Profile'' \u5C6C\u6027\u503C\u7121\u6548: {0} error.nosuch.fileordir={0} : \u6C92\u6709\u9019\u985E\u6A94\u6848\u6216\u76EE\u9304 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 @@ -42,7 +41,7 @@ out.deflated=(\u58D3\u7E2E {0}%) out.stored=(\u5132\u5B58 0%) out.create=\ \u5EFA\u7ACB: {0} out.extracted=\u64F7\u53D6: {0} -out.inflated=\ \\\u64F4\u5C55: {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] files ...\n\u9078\u9805:\n -c \u5EFA\u7ACB\u65B0\u7684\u5B58\u6A94\n -t \u5217\u51FA\u5B58\u6A94\u7684\u76EE\u9304\n -x \u5F9E\u5B58\u6A94\u4E2D\u64F7\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n -u \u66F4\u65B0\u73FE\u6709\u5B58\u6A94\n -v \u5728\u6A19\u6E96\u8F38\u51FA\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n -f \u6307\u5B9A\u5B58\u6A94\u6A94\u6848\u540D\u7A31\n -m \u5305\u542B\u6307\u5B9A\u4E4B\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n -e \u6307\u5B9A\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u7684\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE \n \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n -p \u6307\u5B9A\u8A2D\u5B9A\u6A94\u540D\u7A31\n -0 \u53EA\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n -M \u4E0D\u66FF\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n -i \u7522\u751F\u6307\u5B9A\u4E4B jar \u6A94\u6848\u7684\u7D22\u5F15\u8CC7\u8A0A\n -C \u8B8A\u66F4\u81F3\u6307\u5B9A\u7684\u76EE\u9304\u4E26\u5305\u542B\u4E0B\u5217\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u905E\u8FF4\u5730\u8655\u7406\u6A94\u6848\u3002\n\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u5B58\u6A94\u6A94\u6848\u540D\u7A31\u4EE5\u53CA\u9032\u5165\u9EDE\u540D\u7A31\u7684\n\u6307\u5B9A\u9806\u5E8F\u8207 '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\u5B58\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u5B58\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'\uFF0C\u5C07 foo/ \u76EE\u9304\n \u4E2D\u7684\u6240\u6709\u6A94\u6848\u5B58\u6A94\u81F3 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ \n +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 diff --git a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties index c66ace77035..7c14da631e1 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties +++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties @@ -113,6 +113,7 @@ HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=Hotspot MBeans\u306E\u7BA1\u7406\u7 IMPACT=\u5F71\u97FF INFO=\u60C5\u5831 INFO_CAPITALIZED=INFO +INSECURE=\u4FDD\u8B77\u3055\u308C\u3066\u3044\u306A\u3044\u63A5\u7D9A INVALID_PLUGIN_PATH=\u8B66\u544A: \u7121\u52B9\u306A\u30D7\u30E9\u30B0\u30A4\u30F3\u30FB\u30D1\u30B9: {0} INVALID_URL=\u7121\u52B9\u306AURL: {0} IS=\u6B21\u306B\u4E00\u81F4\u3059\u308B @@ -135,14 +136,14 @@ MBEAN_OPERATION_INFO=MBeanOperationInfo MBEANS=MBeans MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u30AF\u30EA\u30A2(&C) MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u306E\u30AF\u30EA\u30A2 -MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1} -MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3 +MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30C7\u30FC\u30BF\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1} +MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30C7\u30FC\u30BF\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3 MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5(&R) MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5C5E\u6027\u306E\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5 MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6(&S) MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u958B\u59CB -MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1} -MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3 +MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30BF\u30D6\u30FB\u30C7\u30FC\u30BF\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1} +MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30BF\u30D6\u30FB\u30C7\u30FC\u30BF\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3 MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6\u89E3\u9664(&U) MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u505C\u6B62 MANAGE_HOTSPOT_MBEANS_IN_COLON_=Hotspot MBeans\u306E\u7BA1\u7406: @@ -196,6 +197,11 @@ PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u30C7\u30FC\u30BF\u304C\u30D7\u30ED\u30C3\u30C8\u3055\u308C\u307E\u305B\u3093\u3002 PLOTTER_SAVE_AS_MENU_ITEM=\u540D\u524D\u3092\u4ED8\u3051\u3066\u30C7\u30FC\u30BF\u3092\u4FDD\u5B58(&A)... PLOTTER_TIME_RANGE_MENU=\u6642\u9593\u7BC4\u56F2(&T) +PLUGIN_EXCEPTION_DIALOG_BUTTON_EXIT=\u7D42\u4E86 +PLUGIN_EXCEPTION_DIALOG_BUTTON_IGNORE=\u7121\u8996 +PLUGIN_EXCEPTION_DIALOG_BUTTON_OK=OK +PLUGIN_EXCEPTION_DIALOG_MESSAGE=%s\u3067\u4E88\u671F\u3057\u306A\u3044\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n\n%s\n\n\u8A73\u7D30\u306F\u3001\u5148\u982D\u306B-debug\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u8996\u3059\u308B\u3068\u3001\u4F8B\u5916\u306F\u3053\u308C\u4EE5\u4E0A\u8868\u793A\u3055\u308C\u306A\u304F\u306A\u308A\u307E\u3059\u3002 +PLUGIN_EXCEPTION_DIALOG_TITLE=\u30D7\u30E9\u30B0\u30A4\u30F3\u4F8B\u5916 PROBLEM_ADDING_LISTENER=\u30EA\u30B9\u30CA\u30FC\u8FFD\u52A0\u4E2D\u306E\u554F\u984C PROBLEM_DISPLAYING_MBEAN=MBean\u8868\u793A\u4E2D\u306E\u554F\u984C PROBLEM_INVOKING=\u547C\u51FA\u3057\u4E2D\u306E\u554F\u984C @@ -223,6 +229,7 @@ SUMMARY_TAB_VM_VERSION={0}\u30D0\u30FC\u30B8\u30E7\u30F3{1} THREADS=\u30B9\u30EC\u30C3\u30C9 THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u60C5\u5831 THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u6570\u306E\u30C1\u30E3\u30FC\u30C8\u3002 +THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE=[\u30B9\u30EC\u30C3\u30C9\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093] THRESHOLD=\u3057\u304D\u3044\u5024 TILE=\u4E26\u3079\u3066\u8868\u793A(&T) TIME_RANGE_COLON=\u6642\u9593\u7BC4\u56F2(&T): @@ -260,6 +267,8 @@ WINDOWS=\u30A6\u30A3\u30F3\u30C9\u30A6 WRITABLE=\u66F8\u8FBC\u307F\u53EF\u80FD CONNECTION_FAILED1=\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \u518D\u8A66\u884C\u3057\u307E\u3059\u304B\u3002 CONNECTION_FAILED2={0}\u3078\u306E\u63A5\u7D9A\u304C\u6210\u529F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002
    \u3082\u3046\u4E00\u5EA6\u8A66\u3057\u307E\u3059\u304B\u3002 +CONNECTION_FAILED_SSL1=\u4FDD\u8B77\u3055\u308C\u305F\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u4FDD\u8B77\u305B\u305A\u306B\u518D\u8A66\u884C\u3057\u307E\u3059\u304B\u3002 +CONNECTION_FAILED_SSL2=SSL\u3092\u4F7F\u7528\u3057\u3066{0}\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3002
    SSL\u306A\u3057\u3067\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002
    (\u30E6\u30FC\u30B6\u30FC\u540D\u304A\u3088\u3073\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u30D7\u30EC\u30FC\u30F3\u30FB\u30C6\u30AD\u30B9\u30C8\u3067\u9001\u4FE1\u3055\u308C\u307E\u3059\u3002) CONNECTION_LOST1=\u63A5\u7D9A\u304C\u5931\u308F\u308C\u307E\u3057\u305F: \u518D\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002 CONNECTING_TO1={0}\u306B\u63A5\u7D9A\u4E2D CONNECTING_TO2={0}\u306B\u73FE\u5728\u63A5\u7D9A\u4E2D\u3067\u3059\u3002
    \u3053\u308C\u306B\u306F\u6570\u5206\u304B\u304B\u308A\u307E\u3059\u3002 diff --git a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties index 3f782adc620..eff5155bce7 100644 --- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties +++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties @@ -113,6 +113,7 @@ HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u7BA1\u7406 HotSpot MB IMPACT=\u5F71\u54CD INFO=\u4FE1\u606F INFO_CAPITALIZED=\u4FE1\u606F +INSECURE=\u4E0D\u5B89\u5168\u7684\u8FDE\u63A5 INVALID_PLUGIN_PATH=\u8B66\u544A: \u63D2\u4EF6\u8DEF\u5F84\u65E0\u6548: {0} INVALID_URL=URL \u65E0\u6548: {0} IS=\u662F @@ -135,14 +136,14 @@ MBEAN_OPERATION_INFO=MBeanOperationInfo MBEANS=MBean MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u6E05\u9664(&C) MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u6E05\u9664\u901A\u77E5 -MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7EC4\u5408\u5BFC\u822A{0}/{1} -MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7EC4\u5408\u5BFC\u822A +MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7EC4\u5408\u6570\u636E\u5BFC\u822A{0}/{1} +MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7EC4\u5408\u6570\u636E\u5BFC\u822A MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u5237\u65B0(&R) MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5237\u65B0\u5C5E\u6027 MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u8BA2\u9605(&S) MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u5F00\u59CB\u76D1\u542C\u901A\u77E5 -MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683C\u5F0F\u5BFC\u822A{0}/{1} -MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683C\u5F0F\u5BFC\u822A +MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683C\u5F0F\u6570\u636E\u5BFC\u822A{0}/{1} +MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683C\u5F0F\u6570\u636E\u5BFC\u822A MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u53D6\u6D88\u8BA2\u9605(&U) MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u505C\u6B62\u76D1\u542C\u901A\u77E5 MANAGE_HOTSPOT_MBEANS_IN_COLON_=\u7BA1\u7406\u4EE5\u4E0B\u4F4D\u7F6E\u7684 HotSpot MBean: @@ -196,6 +197,11 @@ PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u672A\u7ED8\u5236\u6570\u636E\u3002 PLOTTER_SAVE_AS_MENU_ITEM=\u5C06\u6570\u636E\u53E6\u5B58\u4E3A(&A)... PLOTTER_TIME_RANGE_MENU=\u65F6\u95F4\u8303\u56F4(&T) +PLUGIN_EXCEPTION_DIALOG_BUTTON_EXIT=\u9000\u51FA +PLUGIN_EXCEPTION_DIALOG_BUTTON_IGNORE=\u5FFD\u7565 +PLUGIN_EXCEPTION_DIALOG_BUTTON_OK=\u786E\u5B9A +PLUGIN_EXCEPTION_DIALOG_MESSAGE=%s \u4E2D\u51FA\u73B0\u610F\u5916\u7684\u5F02\u5E38\u9519\u8BEF:\n\n%s\n\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u8FD0\u884C\u4EE5 -debug \u5F00\u5934\u7684\u547D\u4EE4\u83B7\u53D6\u3002\u5982\u679C\u5FFD\u7565, \u5219\u5C06\u9690\u85CF\u540E\u9762\u7684\u5F02\u5E38\u9519\u8BEF\u3002 +PLUGIN_EXCEPTION_DIALOG_TITLE=\u63D2\u4EF6\u5F02\u5E38\u9519\u8BEF PROBLEM_ADDING_LISTENER=\u6DFB\u52A0\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898 PROBLEM_DISPLAYING_MBEAN=\u663E\u793A MBean \u65F6\u51FA\u73B0\u95EE\u9898 PROBLEM_INVOKING=\u8C03\u7528\u65F6\u51FA\u73B0\u95EE\u9898 @@ -223,6 +229,7 @@ SUMMARY_TAB_VM_VERSION={0}\u7248\u672C {1} THREADS=\u7EBF\u7A0B THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7EBF\u7A0B\u4FE1\u606F THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793A\u7EBF\u7A0B\u6570\u7684\u56FE\u8868\u3002 +THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE=[\u672A\u9009\u62E9\u7EBF\u7A0B] THRESHOLD=\u9608\u503C TILE=\u5E73\u94FA(&T) TIME_RANGE_COLON=\u65F6\u95F4\u8303\u56F4(&T): @@ -260,6 +267,8 @@ WINDOWS=\u7A97\u53E3 WRITABLE=\u53EF\u5199\u5165 CONNECTION_FAILED1=\u8FDE\u63A5\u5931\u8D25: \u662F\u5426\u91CD\u8BD5? CONNECTION_FAILED2=\u672A\u6210\u529F\u8FDE\u63A5\u5230{0}\u3002
    \u662F\u5426\u8981\u91CD\u8BD5? +CONNECTION_FAILED_SSL1=\u5B89\u5168\u8FDE\u63A5\u5931\u8D25\u3002\u662F\u5426\u4EE5\u4E0D\u5B89\u5168\u7684\u65B9\u5F0F\u91CD\u8BD5? +CONNECTION_FAILED_SSL2=\u65E0\u6CD5\u4F7F\u7528 SSL \u8FDE\u63A5\u5230{0}\u3002
    \u662F\u5426\u5728\u4E0D\u4F7F\u7528 SSL \u7684\u60C5\u51B5\u4E0B\u8FDB\u884C\u5C1D\u8BD5?
    (\u7528\u6237\u540D\u548C\u53E3\u4EE4\u5C06\u4EE5\u7EAF\u6587\u672C\u683C\u5F0F\u53D1\u9001\u3002) CONNECTION_LOST1=\u8FDE\u63A5\u4E22\u5931: \u662F\u5426\u91CD\u65B0\u8FDE\u63A5? CONNECTING_TO1=\u6B63\u5728\u8FDE\u63A5\u5230{0} CONNECTING_TO2=\u60A8\u5F53\u524D\u6B63\u5728\u8FDE\u63A5\u5230{0}\u3002
    \u8FD9\u5C06\u9700\u8981\u51E0\u5206\u949F\u7684\u65F6\u95F4\u3002 From 072f43e117657352a099187cbf051e407038b70b Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Tue, 24 Sep 2013 14:20:33 -0700 Subject: [PATCH 222/983] 8025215: jdk8 l10n resource file translation update 4 Reviewed-by: naoto, yhuang --- .../html/resources/standard_ja.properties | 8 ++--- .../html/resources/standard_zh_CN.properties | 6 ++-- .../toolkit/resources/doclets_ja.properties | 14 ++++++-- .../resources/doclets_zh_CN.properties | 14 ++++++-- .../doclint/resources/doclint_ja.properties | 9 +++++- .../resources/doclint_zh_CN.properties | 8 ++++- .../javac/resources/compiler_ja.properties | 32 ++++++++++++++++--- .../javac/resources/compiler_zh_CN.properties | 32 ++++++++++++++++--- .../tools/javac/resources/javac_ja.properties | 11 +++++-- .../javac/resources/javac_zh_CN.properties | 11 +++++-- .../javadoc/resources/javadoc_ja.properties | 11 +++++-- .../resources/javadoc_zh_CN.properties | 11 +++++-- .../tools/javah/resources/l10n_ja.properties | 7 ++-- .../javah/resources/l10n_zh_CN.properties | 5 +-- .../tools/javap/resources/javap_ja.properties | 4 ++- .../javap/resources/javap_zh_CN.properties | 4 ++- 16 files changed, 145 insertions(+), 42 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties index 373b5334c42..5592f1032d6 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties @@ -185,9 +185,9 @@ doclet.Error_in_packagelist=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u4F7F\u75 doclet.Groupname_already_used=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u304A\u3044\u3066\u3001\u3059\u3067\u306B\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0} doclet.Same_package_name_used=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u5F62\u5F0F\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0} doclet.exception_encountered={1}\u306E\u51E6\u7406\u4E2D\u306B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n{0} -doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex 1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link \u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline \u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir :.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group :.. \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier ::... \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag ::
    \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-Xdocrootparent \ - \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u5185\u306E@docRoot(\u3053\u306E\u5F8C\u306B\u306F/..\u304C\u7D9A\u304F)\u306E\u3059\u3079\u3066\u306E\u51FA\u73FE\u7B87\u6240\u3092\u3067\u7F6E\u63DB\u3059\u308B\n-charset \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding \u51FA\u529B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D - - +doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex 1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link \u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline \u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir :.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group :.. \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier ::... \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag ::
    \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-charset \ + \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding \u51FA\u529B\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3059\u308B +# L10N: do not localize these words: all none accessibility html missing reference syntax +doclet.X.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n -Xdocrootparent doc\u30B3\u30E1\u30F3\u30C8\u5185\u306E/..\u304C\u5F8C\u306B\u7D9A\u304F@docRoot\u306E\u3059\u3079\u3066\u3092\n \u3067\u7F6E\u63DB\u3057\u307E\u3059\n -Xdoclint javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u63A8\u5968\u3055\u308C\u308B\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3057\u307E\u3059\n -Xdoclint:(all|none|[-]) \n javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n \u3053\u3053\u3067\u3001\u306Fhtml\u3001missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002\n diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties index 61fd72cbe10..23d1b9b46d1 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties @@ -185,8 +185,8 @@ doclet.Error_in_packagelist=\u4F7F\u7528 -group \u9009\u9879\u65F6\u51FA\u9519: doclet.Groupname_already_used=\u5728 -group \u9009\u9879\u4E2D, groupname \u5DF2\u4F7F\u7528: {0} doclet.Same_package_name_used=\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0} doclet.exception_encountered=\u5904\u7406{1}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\n{0} -doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n-d \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n-use \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n-version \u5305\u542B @version \u6BB5\n-author \u5305\u542B @author \u6BB5\n-docfilessubdirs \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n-splitindex \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n-windowtitle \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n-doctitle \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n-header \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n-footer \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n-top \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n-bottom \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n-link \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n-linkoffline \u5229\u7528\u4F4D\u4E8E \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E \u7684\u6587\u6863\n-excludedocfilessubdir :.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n-group :.. \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n-nocomment \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n-nodeprecated \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n-noqualifier ::... \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n-nosince \u4E0D\u5305\u542B @since \u4FE1\u606F\n-notimestamp \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n-nodeprecatedlist \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n-notree \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n-noindex \u4E0D\u751F\u6210\u7D22\u5F15\n-nohelp \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n-nonavbar \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n-serialwarn \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n-tag ::
    \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n-taglet \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n-tagletpath Taglet \u7684\u8DEF\u5F84\n-Xdocrootparent \u5C06\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u540E\u8DDF /.. \u7684 @docRoot \u66FF\u6362\u4E3A \n-charset \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n-helpfile \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n-linksource \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n-sourcetab \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n-keywords \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n-stylesheetfile \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n-docencoding \u8F93\u51FA\u7F16\u7801\u540D\u79F0 - - +doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n -d \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n -use \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n -version \u5305\u542B @version \u6BB5\n -author \u5305\u542B @author \u6BB5\n -docfilessubdirs \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n -splitindex \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n -windowtitle \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n -doctitle \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n -header \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n -footer \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n -top \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n -bottom \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n -link \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n -linkoffline \u5229\u7528\u4F4D\u4E8E \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E \u7684\u6587\u6863\n -excludedocfilessubdir :.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n -group :.. \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n -nocomment \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n -nodeprecated \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n -noqualifier ::... \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u6307\u5B9A\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n -nosince \u4E0D\u5305\u542B @since \u4FE1\u606F\n -notimestamp \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n -nodeprecatedlist \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n -notree \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n -noindex \u4E0D\u751F\u6210\u7D22\u5F15\n -nohelp \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n -nonavbar \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n -serialwarn \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n -tag ::
    \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n -taglet \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n -tagletpath Taglet \u7684\u8DEF\u5F84\n -charset \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n -helpfile \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n -linksource \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n -sourcetab \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n -keywords \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n -stylesheetfile \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n -docencoding \u6307\u5B9A\u8F93\u51FA\u7684\u5B57\u7B26\u7F16\u7801 +# L10N: do not localize these words: all none accessibility html missing reference syntax +doclet.X.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n -Xdocrootparent \u4F7F\u7528 \u66FF\u6362\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\n \u6240\u6709\u5176\u540E\u8DDF\u968F /.. \u7684 @docRoot\n -Xdoclint \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5\n -Xdoclint:(all|none|[-]) \n \u5BF9 javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5\u3002\n \u5176\u4E2D \u662F accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties index 82509fc3a63..24909fe13c1 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties @@ -174,6 +174,16 @@ doclet.Value=\u5024 doclet.0_and_1={0}\u3068{1} #Documentation for Enums -doclet.enum_values_doc=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n
    \nfor({0} c: {0}.values())\n  System.out.println(c);\n
    \n@return\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\n\u542B\u3080\u914D\u5217 +doclet.enum_values_doc.main=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n
    \nfor({0} c: {0}.values())\n  System.out.println(c);\n
    \n -doclet.enum_valueof_doc=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068\u6B63\u78BA\u306B\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n\n@param name\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\n@return\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5217\u6319\u578B\u5B9A\u6570\n@throws IllegalArgumentException\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5B9A\u6570\u3092\n\u3053\u306E\u5217\u6319\u578B\u304C\u6301\u3063\u3066\u3044\u306A\u3044\u5834\u5408\n@throws NullPointerException\u5F15\u6570\u304Cnull\u306E\u5834\u5408 +doclet.enum_values_doc.return=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u3001\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u306E\u914D\u5217 + +doclet.enum_valueof_doc.main=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068\u6B63\u78BA\u306B\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n + +doclet.enum_valueof_doc.param_name=\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\u3002 + +doclet.enum_valueof_doc.return=\u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u5217\u6319\u578B\u5B9A\u6570 + +doclet.enum_valueof_doc.throws_ila=\u3053\u306E\u5217\u6319\u578B\u306B\u3001\u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u5B9A\u6570\u304C\u306A\u3044\u5834\u5408 + +doclet.enum_valueof_doc.throws_npe=\u5F15\u6570\u304Cnull\u306E\u5834\u5408 diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties index 602682459a4..905a179fdb4 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties @@ -174,6 +174,16 @@ doclet.Value=\u503C doclet.0_and_1={0}\u548C{1} #Documentation for Enums -doclet.enum_values_doc=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n
    \nfor ({0} c : {0}.values())\n    System.out.println(c);\n
    \n@return \u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4 +doclet.enum_values_doc.main=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n
    \nfor ({0} c : {0}.values())\n    System.out.println(c);\n
    -doclet.enum_valueof_doc=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26\u5B8C\u5168\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002)\n\n@param name \u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002\n@return \u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF\n@throws \u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF, \n\u5219\u629B\u51FA IllegalArgumentException\n@throws \u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C, \u5219\u629B\u51FA NullPointerException +doclet.enum_values_doc.return=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F\u8FD4\u56DE\u7684\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4 + +doclet.enum_valueof_doc.main=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26\u5B8C\u5168\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002) + +doclet.enum_valueof_doc.param_name=\u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002 + +doclet.enum_valueof_doc.return=\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF + +doclet.enum_valueof_doc.throws_ila=\u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF + +doclet.enum_valueof_doc.throws_npe=\u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C diff --git a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties index 10282be9632..6089737db60 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties @@ -26,6 +26,7 @@ dc.anchor.already.defined = \u30A2\u30F3\u30AB\u30FC\u304C\u3059\u3067\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059: {0} dc.anchor.value.missing = \u30A2\u30F3\u30AB\u30FC\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 dc.attr.lacks.value = \u5C5E\u6027\u306B\u5024\u304C\u3042\u308A\u307E\u305B\u3093 +dc.attr.not.number = \u5C5E\u6027\u5024\u304C\u6570\u5B57\u3067\u306F\u3042\u308A\u307E\u305B\u3093 dc.attr.obsolete = \u5C5E\u6027\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059: {0} dc.attr.obsolete.use.css = \u5C5E\u6027\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u304B\u308F\u308A\u306BCSS\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044: {0} dc.attr.repeated = \u7E70\u308A\u8FD4\u3055\u308C\u305F\u5C5E\u6027: {0} @@ -46,7 +47,7 @@ dc.missing.return = @return\u304C\u3042\u308A\u307E\u305B\u3093 dc.missing.throws = {0}\u306E@throws\u304C\u3042\u308A\u307E\u305B\u3093 dc.no.alt.attr.for.image = \u30A4\u30E1\u30FC\u30B8\u306E"alt"\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093 dc.no.summary.or.caption.for.table=\u8868\u306E\u8981\u7D04\u307E\u305F\u306F\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093 -dc.param.name.not.found = @param\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 +dc.param.name.not.found = @param name\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 dc.ref.not.found = \u53C2\u7167\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 dc.tag.code.within.code = \u5185\u306E'{@code'} dc.tag.empty = \u7A7A\u306E<{0}>\u30BF\u30B0 @@ -66,3 +67,9 @@ dc.tag.self.closing = \u81EA\u5DF1\u7D42\u4E86\u8981\u7D20\u306F\u4F7F\u7528\u30 dc.tag.start.unmatched = \u7D42\u4E86\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093: dc.tag.unknown = \u4E0D\u660E\u306A\u30BF\u30B0: {0} dc.text.not.allowed = <{0}>\u8981\u7D20\u3067\u306F\u30C6\u30AD\u30B9\u30C8\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093 +dc.unexpected.comment=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30B3\u30E1\u30F3\u30C8\u306F\u3053\u3053\u3067\u306F\u5FC5\u8981\u3042\u308A\u307E\u305B\u3093 + +dc.main.ioerror=IO\u30A8\u30E9\u30FC: {0} +dc.main.no.files.given=\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 +dc.main.usage=\u4F7F\u7528\u65B9\u6CD5:\n doclint [options] source-files...\n\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n -Xmsgs \n -Xmsgs:all\u3068\u540C\u3058\n -Xmsgs:values\n \u30C1\u30A7\u30C3\u30AF\u3059\u308B\u554F\u984C\u306E\u30AB\u30C6\u30B4\u30EA\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002\u3053\u3053\u3067\u306E''values''\u306F\u3001\n \u30AB\u30F3\u30DE\u3067\u533A\u5207\u3089\u308C\u305F\u6B21\u306E\u5024\u306E\u30EA\u30B9\u30C8\u3067\u3059:\n reference Java\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9\u8981\u7D20\u3078\u306E\u4E0D\u6B63\u306A\u53C2\u7167\u3092\u542B\u3080\u30B3\u30E1\u30F3\u30C8\u306E\n \u5834\u6240\u3092\u8868\u793A\u3057\u307E\u3059\n syntax \u30B3\u30E1\u30F3\u30C8\u5185\u306E\u57FA\u672C\u69CB\u6587\u30A8\u30E9\u30FC\u3092\u8868\u793A\u3057\u307E\u3059\n html HTML\u30BF\u30D6\u304A\u3088\u3073\u5C5E\u6027\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n accessibility \u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n missing \u6B20\u843D\u3057\u3066\u3044\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n all \u524D\u8FF0\u306E\u3059\u3079\u3066\n \u3053\u308C\u3092\u5426\u5B9A\u3059\u308B\u306B\u306F\u3001\u5024\u306E\u524D\u306B''-''\u3092\u6307\u5B9A\u3057\u307E\u3059\n \u30AB\u30C6\u30B4\u30EA\u306F\u3001\u6B21\u306E\u3044\u305A\u308C\u304B\u3067\u4FEE\u98FE\u3067\u304D\u307E\u3059:\n /public /protected /package /private\n \u6B63\u306E\u30AB\u30C6\u30B4\u30EA(''-''\u3067\u59CB\u307E\u3089\u306A\u3044)\u306E\u5834\u5408\n \u4FEE\u98FE\u5B50\u306F\u3001\u305D\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u4EE5\u4E0A\u306B\u9069\u7528\u3055\u308C\u307E\u3059\u3002\n \u8CA0\u306E\u30AB\u30C6\u30B4\u30EA(''-''\u3067\u59CB\u307E\u308B)\u306E\u5834\u5408\n \u4FEE\u98FE\u5B50\u306F\u3001\u305D\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u4EE5\u4E0B\u306B\u9069\u7528\u3055\u308C\u307E\u3059\u3002\n \u4FEE\u98FE\u5B50\u304C\u306A\u3044\u5834\u5408\u3001\u30AB\u30C6\u30B4\u30EA\u306F\u3059\u3079\u3066\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u306B\n \u9069\u7528\u3055\u308C\u307E\u3059\u3002\n \u4F8B: -Xmsgs:all,-syntax/private\n \u3053\u306E\u5834\u5408\u3001private\u30E1\u30BD\u30C3\u30C9\u306Edoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u69CB\u6587\u30A8\u30E9\u30FC\u3092\u9664\u304D\u3001\n \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u6709\u52B9\u5316\u3055\u308C\u307E\u3059\u3002\n -Xmsgs\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u3001\n -Xmsgs:all/protected\u3068\u540C\u7B49\u306B\u306A\u308A\u3001\u3053\u308C\u306F\n \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u3001protected\u304A\u3088\u3073public\u306E\u5BA3\u8A00\u306E\u307F\u306B\u5831\u544A\u3055\u308C\u308B\u3053\u3068\u3092\n \u610F\u5473\u3057\u307E\u3059\u3002\n -stats\n \u5831\u544A\u3055\u308C\u305F\u554F\u984C\u306B\u5BFE\u3057\u3066\u7D71\u8A08\u3092\u5831\u544A\u3057\u307E\u3059\u3002\n -h -help --help -usage -?\n \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\n\n\u6B21\u306Ejavac\u30AA\u30D7\u30B7\u30E7\u30F3\u3082\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\n \ +-bootclasspath\u3001-classpath\u3001-cp\u3001-sourcepath\u3001-Xmaxerrs\u3001-Xmaxwarns\n\n\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u90E8\u306B\u5BFE\u3057\u3066doclint\u3092\u5B9F\u884C\u3059\u308B\u306B\u306F\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3055\u308C\u305F\u30AF\u30E9\u30B9\u3092\n\u30AF\u30E9\u30B9\u30D1\u30B9(\u307E\u305F\u306F\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9)\u306B\u6307\u5B9A\u3057\u3001\u30B3\u30DE\u30F3\u30C9\u30FB\u30E9\u30A4\u30F3\u3067\n\u30C1\u30A7\u30C3\u30AF\u3059\u308B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002 diff --git a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties index b3a9c7041bc..4d25a4d5c71 100644 --- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties @@ -26,6 +26,7 @@ dc.anchor.already.defined = \u951A\u5B9A\u70B9\u5DF2\u5B9A\u4E49: {0} dc.anchor.value.missing = \u6CA1\u6709\u4E3A\u951A\u5B9A\u70B9\u6307\u5B9A\u503C dc.attr.lacks.value = \u5C5E\u6027\u7F3A\u5C11\u503C +dc.attr.not.number = \u5C5E\u6027\u503C\u4E0D\u662F\u6570\u5B57 dc.attr.obsolete = \u5C5E\u6027\u5DF2\u8FC7\u65F6: {0} dc.attr.obsolete.use.css = \u5C5E\u6027\u5DF2\u8FC7\u65F6, \u8BF7\u6539\u7528 CSS: {0} dc.attr.repeated = \u5C5E\u6027\u91CD\u590D: {0} @@ -46,7 +47,7 @@ dc.missing.return = \u6CA1\u6709 @return dc.missing.throws = {0}\u6CA1\u6709 @throws dc.no.alt.attr.for.image = \u56FE\u50CF\u6CA1\u6709 "alt" \u5C5E\u6027 dc.no.summary.or.caption.for.table=\u8868\u6CA1\u6709\u6982\u8981\u6216\u6807\u9898 -dc.param.name.not.found = \u627E\u4E0D\u5230 @param \u540D\u79F0 +dc.param.name.not.found = @param name \u672A\u627E\u5230 dc.ref.not.found = \u627E\u4E0D\u5230\u5F15\u7528 dc.tag.code.within.code = '{@code'} \u5728 \u4E2D dc.tag.empty = <{0}> \u6807\u8BB0\u4E3A\u7A7A @@ -66,3 +67,8 @@ dc.tag.self.closing = \u4E0D\u5141\u8BB8\u4F7F\u7528\u81EA\u5173\u95ED\u5143\u7D dc.tag.start.unmatched = \u7F3A\u5C11\u7ED3\u675F\u6807\u8BB0: dc.tag.unknown = \u672A\u77E5\u6807\u8BB0: {0} dc.text.not.allowed = <{0}> \u5143\u7D20\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u6587\u672C +dc.unexpected.comment=\u6B64\u5904\u672A\u9884\u671F\u6587\u6863\u6CE8\u91CA + +dc.main.ioerror=IO \u9519\u8BEF: {0} +dc.main.no.files.given=\u672A\u6307\u5B9A\u6587\u4EF6 +dc.main.usage=\u7528\u6CD5:\n doclint [options] source-files...\n\n\u9009\u9879:\n -Xmsgs \n \u4E0E -Xmsgs:all \u76F8\u540C\n -Xmsgs:values\n \u6307\u5B9A\u8981\u68C0\u67E5\u7684\u95EE\u9898\u7684\u7C7B\u522B, \u5176\u4E2D ''values''\n \u662F\u4EFB\u610F\u4EE5\u4E0B\u5185\u5BB9\u7684\u4EE5\u9017\u53F7\u5206\u9694\u7684\u5217\u8868:\n reference \u663E\u793A\u5305\u542B\u5BF9 Java \u6E90\u4EE3\u7801\u5143\u7D20\n \u9519\u8BEF\u5F15\u7528\u7684\u6CE8\u91CA\u7684\u4F4D\u7F6E\n syntax \u663E\u793A\u6CE8\u91CA\u4E2D\u7684\u57FA\u672C\u8BED\u6CD5\u9519\u8BEF\n html \u663E\u793A HTML \u6807\u8BB0\u548C\u5C5E\u6027\u95EE\u9898\n accessibility \u663E\u793A\u53EF\u8BBF\u95EE\u6027\u7684\u95EE\u9898\n missing \u663E\u793A\u7F3A\u5C11\u6587\u6863\u7684\u95EE\u9898\n all \u6240\u6709\u4EE5\u4E0A\u5185\u5BB9\n \u5728\u503C\u4E4B\u524D\u4F7F\u7528 ''-'' \u53EF\u4F7F\u7528\u5176\u53CD\u503C\n \u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u4E00\u9879\u6765\u9650\u5B9A\u7C7B\u522B:\n /public /protected /package /private\n \u5BF9\u4E8E\u6B63\u7C7B\u522B (\u4E0D\u4EE5 ''-'' \u5F00\u5934)\n \u9650\u5B9A\u7B26\u9002\u7528\u4E8E\u8BE5\u8BBF\u95EE\u7EA7\u522B\u53CA\u66F4\u9AD8\u7EA7\u522B\u3002\n \u5BF9\u4E8E\u8D1F\u7C7B\u522B (\u4EE5 ''-'' \u5F00\u5934)\n \u9650\u5B9A\u7B26\u9002\u7528\u4E8E\u8BE5\u8BBF\u95EE\u7EA7\u522B\u53CA\u66F4\u4F4E\u7EA7\u522B\u3002\n \u5982\u679C\u6CA1\u6709\u9650\u5B9A\u7B26, \u5219\u8BE5\u7C7B\u522B\u9002\u7528\u4E8E\n \u6240\u6709\u8BBF\u95EE\u7EA7\u522B\u3002\n \u4F8B\u5982, -Xmsgs:all,-syntax/private\n \u8FD9\u5C06\u5728\u4E13\u7528\u65B9\u6CD5\u7684\u6587\u6863\u6CE8\u91CA\u4E2D\n \u542F\u7528\u9664\u8BED\u6CD5\u9519\u8BEF\u4E4B\u5916\u7684\u6240\u6709\u6D88\u606F\u3002\n \u5982\u679C\u672A\u63D0\u4F9B -Xmsgs \u9009\u9879, \u5219\u9ED8\u8BA4\u503C\n \u7B49\u540C\u4E8E -Xmsgs:all/protected, \u8868\u793A\n \u4EC5\u62A5\u544A\u53D7\u4FDD\u62A4\u548C\u516C\u5171\u58F0\u660E\u4E2D\u7684\n \u6240\u6709\u6D88\u606F\n -stats\n \u62A5\u544A\u6240\u62A5\u544A\u95EE\u9898\u7684\u7EDF\u8BA1\u4FE1\u606F\u3002\n -h -help --help -usage -?\n \u663E\u793A\u6B64\u6D88\u606F\u3002\n\n\u8FD8\u652F\u6301\u4EE5\u4E0B javac \u9009\u9879\n -bootclasspath, -classpath, -cp, -sourcepath, -Xmaxerrs, -Xmaxwarns\n\n\u8981\u5728\u9879\u76EE\u7684\u4E00\u90E8\u5206\u4E0A\u8FD0\u884C doclint, \u8BF7\u5C06\u9879\u76EE\u4E2D\u5DF2\u7F16\u8BD1\u7684\u7C7B\n\u653E\u5728\u7C7B\u8DEF\u5F84 (\u6216\u5F15\u5BFC\u7C7B\u8DEF\u5F84) \u4E0A, \u7136\u540E\u5728\u547D\u4EE4\u884C\u4E0A\u6307\u5B9A\n\u8981\u68C0\u67E5\u7684\u6E90\u6587\u4EF6\u3002 diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties index bff4e9a217b..9702e684c78 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties @@ -524,9 +524,6 @@ compiler.misc.incompatible.ret.type.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u306E\u62 # 0: type compiler.misc.incompatible.ret.type.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u623B\u308A\u578B\u304C\u4E0D\u6B63\u3067\u3059\n{0} -# 0: list of type -compiler.err.incompatible.thrown.types.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u3067\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059 - # 0: list of type compiler.err.incompatible.thrown.types.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059 @@ -642,12 +639,18 @@ compiler.err.repeated.modifier=\u4FEE\u98FE\u5B50\u304C\u7E70\u308A\u8FD4\u3055\ # 0: symbol, 1: set of modifier, 2: symbol compiler.err.report.access={0}\u306F{2}\u3067{1}\u30A2\u30AF\u30BB\u30B9\u3055\u308C\u307E\u3059 +# 0: symbol, 1: set of modifier, 2: symbol +compiler.misc.report.access={0}\u306F{2}\u3067{1}\u30A2\u30AF\u30BB\u30B9\u3055\u308C\u307E\u3059 + compiler.err.ret.outside.meth=\u30E1\u30BD\u30C3\u30C9\u306E\u5916\u306Ereturn\u6587\u3067\u3059 compiler.err.signature.doesnt.match.supertype=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30B9\u30FC\u30D1\u30FC\u30BF\u30A4\u30D7\u3067\u3059 compiler.err.signature.doesnt.match.intf=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3059 +# 0: number, 1: number +compiler.err.method.invoked.with.incorrect.number.arguments=\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3057\u305F\u5F15\u6570\u306E\u6570\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u4E88\u671F\u3055\u308C\u308B\u6570\u306F{0}\u3067\u3059\u304C\u3001{1}\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F + # 0: symbol, 1: symbol, 2: symbol compiler.err.does.not.override.abstract={0}\u306Fabstract\u3067\u306A\u304F\u3001{2}\u5185\u306Eabstract\u30E1\u30BD\u30C3\u30C9{1}\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u305B\u3093 @@ -755,6 +758,9 @@ compiler.err.var.might.already.be.assigned=\u5909\u6570{0}\u306F\u3059\u3067\u30 # 0: symbol compiler.err.var.might.not.have.been.initialized=\u5909\u6570{0}\u306F\u521D\u671F\u5316\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059 +# 0: symbol +compiler.err.var.not.initialized.in.default.constructor=\u5909\u6570{0}\u306F\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u3067\u521D\u671F\u5316\u3055\u308C\u3066\u3044\u307E\u305B\u3093 + # 0: symbol compiler.err.var.might.be.assigned.in.loop=\u5909\u6570{0}\u306F\u30EB\u30FC\u30D7\u5185\u3067\u4EE3\u5165\u3055\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059 @@ -829,6 +835,14 @@ compiler.note.compressed.diags=\u4E00\u90E8\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\ compiler.note.potential.lambda.found=\u3053\u306E\u533F\u540D\u5185\u90E8\u30AF\u30E9\u30B9\u3092\u30E9\u30E0\u30C0\u5F0F\u306B\u5909\u63DB\u3067\u304D\u307E\u3059\u3002 +# 0: boolean, 1: symbol +compiler.note.lambda.stat=\u30E9\u30E0\u30C0\u5F0F\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n\u5408\u6210\u30E1\u30BD\u30C3\u30C9 = {1} + +# 0: boolean, 1: unused +compiler.note.mref.stat=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n +# 0: boolean, 1: symbol +compiler.note.mref.stat.1=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n\u30D6\u30EA\u30C3\u30B8\u30FB\u30E1\u30BD\u30C3\u30C9 = {1} + compiler.note.note=\u6CE8\u610F: # 0: file name @@ -1015,6 +1029,14 @@ compiler.warn.static.not.qualified.by.type=static {0}\u306F\u5F0F\u3067\u306F\u3 # 0: string compiler.warn.source.no.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9\u304C-source {0}\u3068\u4E00\u7DD2\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 +# 0: string +compiler.warn.option.obsolete.source=\u30BD\u30FC\u30B9\u5024{0}\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u3066\u3001\u4ECA\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059 + +# 0: string +compiler.warn.option.obsolete.target=\u30BF\u30FC\u30B2\u30C3\u30C8\u5024{0}\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u3066\u3001\u4ECA\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059 + +compiler.warn.option.obsolete.suppression=\u5EC3\u6B62\u3055\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u3064\u3044\u3066\u306E\u8B66\u544A\u3092\u8868\u793A\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u306B\u306F\u3001-Xlint:\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002 + # 0: name, 1: number, 2: number, 3: number, 4: number compiler.warn.future.attr=\u30D0\u30FC\u30B8\u30E7\u30F3{1}.{2}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u5C0E\u5165\u3055\u308C\u305F{0}\u5C5E\u6027\u306F\u3001\u30D0\u30FC\u30B8\u30E7\u30F3{3}.{4}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u7121\u8996\u3055\u308C\u307E\u3059 @@ -1550,7 +1572,7 @@ compiler.warn.enum.as.identifier=\u30EA\u30EA\u30FC\u30B95\u304B\u3089''enum''\u compiler.warn.assert.as.identifier=\u30EA\u30EA\u30FC\u30B91.4\u304B\u3089''assert''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u3001\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''assert''\u3092\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F\u3001-source 1.4\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044) -compiler.warn.underscore.as.identifier=\u8B58\u5225\u5B50\u3068\u3057\u3066''_''\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n(\u8B58\u5225\u5B50\u3068\u3057\u3066\u306E''_''\u306E\u4F7F\u7528\u306F\u3001\u5C06\u6765\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059) +compiler.warn.underscore.as.identifier=\u8B58\u5225\u5B50\u3068\u3057\u3066''_''\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n(\u8B58\u5225\u5B50\u3068\u3057\u3066\u306E''_''\u306E\u4F7F\u7528\u306F\u3001Java SE 8\u3088\u308A\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059) compiler.err.enum.as.identifier=\u30EA\u30EA\u30FC\u30B95\u304B\u3089''enum''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''enum''\u3092\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F-source 1.4\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044) @@ -1567,7 +1589,7 @@ compiler.err.cant.annotate.static.class=\u5305\u542B\u3059\u308Bstatic\u306E\u30 # TODO 308: make a better error message # 0: unused -compiler.err.cant.annotate.nested.type=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 +compiler.err.cant.annotate.nested.type=static\u306E\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306E\u30B9\u30B3\u30FC\u30D7\u30FB\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30C8\u306B\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 # 0: type, 1: type compiler.err.incorrect.receiver.name=\u53D7\u53D6\u308A\u5074\u306E\u540D\u524D\u304C\u3001\u5305\u542B\u3059\u308B\u30AF\u30E9\u30B9\u30FB\u30BF\u30A4\u30D7\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\n\u5FC5\u9808: {0}\n\u691C\u51FA: {1} diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties index b2e76c037f4..d4f1a214cd0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties @@ -524,9 +524,6 @@ compiler.misc.incompatible.ret.type.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u7 # 0: type compiler.misc.incompatible.ret.type.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u7684\u8FD4\u56DE\u7C7B\u578B\u9519\u8BEF\n{0} -# 0: list of type -compiler.err.incompatible.thrown.types.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9 - # 0: list of type compiler.err.incompatible.thrown.types.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9 @@ -642,12 +639,18 @@ compiler.err.repeated.modifier=\u4FEE\u9970\u7B26\u91CD\u590D # 0: symbol, 1: set of modifier, 2: symbol compiler.err.report.access={0}\u53EF\u4EE5\u5728{2}\u4E2D\u8BBF\u95EE{1} +# 0: symbol, 1: set of modifier, 2: symbol +compiler.misc.report.access={0}\u53EF\u4EE5\u5728{2}\u4E2D\u8BBF\u95EE{1} + compiler.err.ret.outside.meth=\u8FD4\u56DE\u5916\u90E8\u65B9\u6CD5 compiler.err.signature.doesnt.match.supertype=\u7B7E\u540D\u4E0E{0}\u4E0D\u5339\u914D; \u4E0D\u517C\u5BB9\u7684\u8D85\u7C7B\u578B compiler.err.signature.doesnt.match.intf=\u7B7E\u540D\u4E0E{0}\u4E0D\u5339\u914D; \u4E0D\u517C\u5BB9\u7684\u63A5\u53E3 +# 0: number, 1: number +compiler.err.method.invoked.with.incorrect.number.arguments=\u4F7F\u7528\u4E0D\u6B63\u786E\u6570\u91CF\u7684\u53C2\u6570\u8C03\u7528\u4E86\u65B9\u6CD5; \u9884\u671F\u4E3A {0} \u4E2A, \u627E\u5230 {1} \u4E2A + # 0: symbol, 1: symbol, 2: symbol compiler.err.does.not.override.abstract={0}\u4E0D\u662F\u62BD\u8C61\u7684, \u5E76\u4E14\u672A\u8986\u76D6{2}\u4E2D\u7684\u62BD\u8C61\u65B9\u6CD5{1} @@ -755,6 +758,9 @@ compiler.err.var.might.already.be.assigned=\u53EF\u80FD\u5DF2\u5206\u914D\u53D8\ # 0: symbol compiler.err.var.might.not.have.been.initialized=\u53EF\u80FD\u5C1A\u672A\u521D\u59CB\u5316\u53D8\u91CF{0} +# 0: symbol +compiler.err.var.not.initialized.in.default.constructor=\u53D8\u91CF {0} \u672A\u5728\u9ED8\u8BA4\u6784\u9020\u5668\u4E2D\u521D\u59CB\u5316 + # 0: symbol compiler.err.var.might.be.assigned.in.loop=\u53EF\u80FD\u5728 loop \u4E2D\u5206\u914D\u4E86\u53D8\u91CF{0} @@ -829,6 +835,14 @@ compiler.note.compressed.diags=\u67D0\u4E9B\u6D88\u606F\u5DF2\u7ECF\u8FC7\u7B80\ compiler.note.potential.lambda.found=\u53EF\u5C06\u6B64\u533F\u540D\u5185\u90E8\u7C7B\u521B\u5EFA\u8F6C\u6362\u4E3A lambda \u8868\u8FBE\u5F0F\u3002 +# 0: boolean, 1: symbol +compiler.note.lambda.stat=\u8F6C\u6362 lambda \u8868\u8FBE\u5F0F\n\u66FF\u4EE3 metafactory = {0}\n\u5408\u6210\u65B9\u6CD5 = {1} + +# 0: boolean, 1: unused +compiler.note.mref.stat=\u8F6C\u6362\u65B9\u6CD5\u5F15\u7528\n\u66FF\u4EE3 metafactory = {0}\n +# 0: boolean, 1: symbol +compiler.note.mref.stat.1=\u8F6C\u6362\u65B9\u6CD5\u5F15\u7528\n\u66FF\u4EE3 metafactory = {0}\nbridge \u65B9\u6CD5 = {1} + compiler.note.note=\u6CE8: # 0: file name @@ -1015,6 +1029,14 @@ compiler.warn.static.not.qualified.by.type=static {0}\u5E94\u7531\u7C7B\u578B\u5 # 0: string compiler.warn.source.no.bootclasspath=\u672A\u4E0E -source {0} \u4E00\u8D77\u8BBE\u7F6E\u5F15\u5BFC\u7C7B\u8DEF\u5F84 +# 0: string +compiler.warn.option.obsolete.source=\u6E90\u503C{0}\u5DF2\u8FC7\u65F6, \u5C06\u5728\u672A\u6765\u6240\u6709\u53D1\u884C\u7248\u4E2D\u5220\u9664 + +# 0: string +compiler.warn.option.obsolete.target=\u76EE\u6807\u503C{0}\u5DF2\u8FC7\u65F6, \u5C06\u5728\u672A\u6765\u6240\u6709\u53D1\u884C\u7248\u4E2D\u5220\u9664 + +compiler.warn.option.obsolete.suppression=\u8981\u9690\u85CF\u6709\u5173\u5DF2\u8FC7\u65F6\u9009\u9879\u7684\u8B66\u544A, \u8BF7\u4F7F\u7528 -Xlint:-options\u3002 + # 0: name, 1: number, 2: number, 3: number, 4: number compiler.warn.future.attr={1}.{2} \u7248\u7C7B\u6587\u4EF6\u4E2D\u5F15\u5165\u7684 {0} \u5C5E\u6027\u5728 {3}.{4} \u7248\u7C7B\u6587\u4EF6\u4E2D\u88AB\u5FFD\u7565 @@ -1550,7 +1572,7 @@ compiler.warn.enum.as.identifier=\u4ECE\u53D1\u884C\u7248 5 \u5F00\u59CB, ''enum compiler.warn.assert.as.identifier=\u4ECE\u53D1\u884C\u7248 1.4 \u5F00\u59CB, ''assert'' \u662F\u4E00\u4E2A\u5173\u952E\u5B57, \u4F46\u4E0D\u80FD\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u5C06 ''assert'' \u7528\u4F5C\u5173\u952E\u5B57) -compiler.warn.underscore.as.identifier=''_'' \u5DF2\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u4EE5\u540E\u7684\u53D1\u884C\u7248\u53EF\u80FD\u4E0D\u652F\u6301\u5C06 ''_'' \u7528\u4F5C\u6807\u8BC6\u7B26) +compiler.warn.underscore.as.identifier=''_'' \u7528\u4F5C\u6807\u8BC6\u7B26\n(Java SE 8 \u4E4B\u540E\u7684\u53D1\u884C\u7248\u4E2D\u53EF\u80FD\u4E0D\u652F\u6301\u4F7F\u7528 ''_'' \u4F5C\u4E3A\u6807\u8BC6\u7B26) compiler.err.enum.as.identifier=\u4ECE\u53D1\u884C\u7248 5 \u5F00\u59CB, ''enum'' \u4E3A\u5173\u952E\u5B57, \u800C\u4E0D\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u4F4E\u7248\u672C\u4EE5\u5C06 ''enum'' \u7528\u4F5C\u6807\u8BC6\u7B26) @@ -1567,7 +1589,7 @@ compiler.err.cant.annotate.static.class=\u65E0\u6CD5\u5BF9\u5C01\u95ED\u9759\u60 # TODO 308: make a better error message # 0: unused -compiler.err.cant.annotate.nested.type=\u65E0\u6CD5\u5BF9\u5D4C\u5957\u7C7B\u578B\u8FDB\u884C\u6CE8\u91CA +compiler.err.cant.annotate.nested.type=\u65E0\u6CD5\u6CE8\u91CA\u7528\u4E8E\u9759\u6001\u5D4C\u5957\u7C7B\u578B\u7684\u786E\u5B9A\u4F5C\u7528\u57DF\u7ED3\u6784 # 0: type, 1: type compiler.err.incorrect.receiver.name=\u63A5\u6536\u65B9\u540D\u79F0\u4E0E\u5C01\u95ED\u7C7B\u7C7B\u578B\u4E0D\u5339\u914D\n\u9700\u8981: {0}\n\u627E\u5230: {1} diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties index 0170a70384d..2c68780c9a6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -87,8 +87,12 @@ javac.opt.arg.file= javac.opt.Xlint=\u63A8\u5968\u306E\u8B66\u544A\u3092\u6709\u52B9\u306B\u3059\u308B javac.opt.Xlint.suboptlist=\u7279\u5B9A\u306E\u8B66\u544A\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3059\u308B javac.opt.Xdoclint=javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u63A8\u5968\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B -javac.opt.Xdoclint.subopts = (all|[-])[/] -javac.opt.Xdoclint.custom=\n javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n \u3053\u3053\u3067\u3001\u306Faccessibility\u3001html\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3001\n \u306Fpublic\u3001protected\u3001package\u307E\u305F\u306Fprivate\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002 +# L10N: do not localize: all none +javac.opt.Xdoclint.subopts = (all|none|[-])[/] + +# L10N: do not localize: accessibility html missing reference syntax +# L10N: do not localize: public protected package private +javac.opt.Xdoclint.custom=\n javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n \u3053\u3053\u3067\u3001\u306Faccessibility\u3001html\u3001missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3001\n \u306Fpublic\u3001protected\u3001package\u307E\u305F\u306Fprivate\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002 javac.opt.Xstdout=\u6A19\u6E96\u51FA\u529B\u3092\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3059\u308B javac.opt.X=\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B javac.opt.help=\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B @@ -105,6 +109,7 @@ javac.err.empty.A.argument=-A\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3 javac.err.invalid.arg={0}\u306F\u7121\u52B9\u306A\u5F15\u6570\u3067\u3059 javac.err.invalid.A.key=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306E\u30AD\u30FC\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u4E00\u9023\u306E\u8B58\u5225\u5B50\u304C\u3001\u30C9\u30C3\u30C8\u3067\u533A\u5207\u3089\u308C\u3066\u3044\u307E\u305B\u3093 javac.err.invalid.flag={0}\u306F\u7121\u52B9\u306A\u30D5\u30E9\u30B0\u3067\u3059 +javac.err.profile.bootclasspath.conflict=profile\u3068bootclasspath\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u540C\u6642\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093 javac.err.invalid.profile=\u7121\u52B9\u306A\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: {0} javac.err.invalid.target={0}\u306F\u7121\u52B9\u306A\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u3059 javac.err.no.source.files=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093 diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties index 79e497f1f87..2ad0c68edbd 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -87,8 +87,12 @@ javac.opt.arg.file=<\u6587\u4EF6\u540D> javac.opt.Xlint=\u542F\u7528\u5EFA\u8BAE\u7684\u8B66\u544A javac.opt.Xlint.suboptlist=\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u7684\u8B66\u544A javac.opt.Xdoclint=\u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5 -javac.opt.Xdoclint.subopts = (all|[-])[/] -javac.opt.Xdoclint.custom=\n \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n \u5176\u4E2D \u4E3A\u53EF\u8BBF\u95EE\u6027, html, \u5F15\u7528\u6216\u8BED\u6CD5\u4E4B\u4E00,\n \u4E3A public, protected, package \u6216 private \u4E4B\u4E00\u3002 +# L10N: do not localize: all none +javac.opt.Xdoclint.subopts = (all|none|[-])[/] + +# L10N: do not localize: accessibility html missing reference syntax +# L10N: do not localize: public protected package private +javac.opt.Xdoclint.custom=\n \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n \u5176\u4E2D \u4E3A accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n \u4E3A public, protected, package \u6216 private \u4E4B\u4E00\u3002 javac.opt.Xstdout=\u91CD\u5B9A\u5411\u6807\u51C6\u8F93\u51FA javac.opt.X=\u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981 javac.opt.help=\u8F93\u51FA\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981 @@ -105,6 +109,7 @@ javac.err.empty.A.argument=-A \u9700\u8981\u4E00\u4E2A\u53C2\u6570; \u4F7F\u7528 javac.err.invalid.arg=\u65E0\u6548\u7684\u53C2\u6570: {0} javac.err.invalid.A.key=\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u9009\u9879 ''{0}'' \u4E2D\u7684\u5173\u952E\u5B57\u4E0D\u662F\u4EE5\u70B9\u5206\u9694\u7684\u6807\u8BC6\u7B26\u5E8F\u5217 javac.err.invalid.flag=\u65E0\u6548\u7684\u6807\u8BB0: {0} +javac.err.profile.bootclasspath.conflict=\u6982\u8981\u4FE1\u606F\u548C\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u9009\u9879\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528 javac.err.invalid.profile=\u914D\u7F6E\u6587\u4EF6\u65E0\u6548: {0} javac.err.invalid.target=\u65E0\u6548\u7684\u76EE\u6807\u53D1\u884C\u7248: {0} javac.err.no.source.files=\u65E0\u6E90\u6587\u4EF6 diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties index a31ba5973da..b95a435689f 100644 --- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,13 @@ main.errors=\u30A8\u30E9\u30FC{0}\u500B main.error=\u30A8\u30E9\u30FC{0}\u500B main.warnings=\u8B66\u544A{0}\u500B main.warning=\u8B66\u544A{0}\u500B -main.usage=\u4F7F\u7528\u65B9\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n-overview HTML\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u6982\u8981\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3080\n-public public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u793A\u3059\n-protected protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n-package package/protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n-private \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n-help \u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n-doclet \u4EE3\u66FFdoclet\u3092\u4ECB\u3057\u3066\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n-docletpath doclet\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u63A2\u3059\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-sourcepath \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-classpath \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-exclude \u9664\u5916\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u6307\u5B9A\u3059\u308B\n-subpackages \u518D\u5E30\u7684\u306B\u30ED\u30FC\u30C9\u3059\u308B\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3059\u308B\n-breakiterator BreakIterator\u3067\u6700\u521D\u306E\u6587\u3092\u8A08\u7B97\u3059\u308B\n-bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u306B\u3088\u308A\u30ED\u30FC\u30C9\u3055\u308C\u305F\n\t\t\t \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n-source \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n-extdirs \u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u305F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n-verbose Javadoc\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n-locale en_US\u3084en_US_WIN\u306A\u3069\u306E\u4F7F\u7528\u3059\u308B\u30ED\u30B1\u30FC\u30EB\n-encoding \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D\n-quiet \u72B6\u614B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u306A\u3044\n-J \u3092\u5B9F\u884C\u6642\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059\n-X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B\n -main.Xusage=-Xmaxerrs \u51FA\u529B\u3059\u308B\u30A8\u30E9\u30FC\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n-Xmaxwarns \u51FA\u529B\u3059\u308B\u8B66\u544A\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n\n\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002 + +main.usage=\u4F7F\u7528\u65B9\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n -overview HTML\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u6982\u8981\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3080\n -public public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u793A\u3059\n -protected protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -package package/protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n -private \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n -help \u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n -doclet \u4EE3\u66FFdoclet\u3092\u4ECB\u3057\u3066\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n -docletpath doclet\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u63A2\u3059\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -sourcepath \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -classpath \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -cp \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\r\n -exclude \u9664\u5916\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -subpackages \u518D\u5E30\u7684\u306B\u30ED\u30FC\u30C9\u3059\u308B\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3059\u308B\n -breakiterator BreakIterator\u3067\u6700\u521D\u306E\u6587\u3092\u8A08\u7B97\u3059\u308B\n -bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u306B\u3088\u308A\u30ED\u30FC\u30C9\u3055\u308C\u305F\n \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n -source \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n -extdirs \u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u305F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n -verbose Javadoc\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n -locale en_US\u3084en_US_WIN\u306A\u3069\u306E\u4F7F\u7528\u3059\u308B\u30ED\u30B1\u30FC\u30EB\n -encoding \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D\n -quiet \u72B6\u614B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u306A\u3044\n -J \u3092\u5B9F\u884C\u6642\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059\n -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3057\u7D42\u4E86\u3059\u308B\n + +main.Xusage=\ -Xmaxerrs \u51FA\u529B\u3059\u308B\u30A8\u30E9\u30FC\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n -Xmaxwarns \u51FA\u529B\u3059\u308B\u8B66\u544A\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n + +main.Xusage.foot=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002 + main.option.already.seen={0}\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u8907\u6570\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002 main.requires_argument=\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002 main.locale_first=\u30AA\u30D7\u30B7\u30E7\u30F3-locale\u306F\u3001\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u306E\u6700\u521D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties index bb16ec27d9b..591f5771a07 100644 --- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,13 @@ main.errors={0} \u4E2A\u9519\u8BEF main.error={0} \u4E2A\u9519\u8BEF main.warnings={0} \u4E2A\u8B66\u544A main.warning={0} \u4E2A\u8B66\u544A -main.usage=\u7528\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n-overview \u4ECE HTML \u6587\u4EF6\u8BFB\u53D6\u6982\u89C8\u6587\u6863\n-public \u4EC5\u663E\u793A public \u7C7B\u548C\u6210\u5458\n-protected \u663E\u793A protected/public \u7C7B\u548C\u6210\u5458 (\u9ED8\u8BA4\u503C)\n-package \u663E\u793A package/protected/public \u7C7B\u548C\u6210\u5458\n-private \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458\n-help \u663E\u793A\u547D\u4EE4\u884C\u9009\u9879\u5E76\u9000\u51FA\n-doclet \u901A\u8FC7\u66FF\u4EE3 doclet \u751F\u6210\u8F93\u51FA\n-docletpath \u6307\u5B9A\u67E5\u627E doclet \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-sourcepath \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n-classpath \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-exclude \u6307\u5B9A\u8981\u6392\u9664\u7684\u7A0B\u5E8F\u5305\u5217\u8868\n-subpackages \u6307\u5B9A\u8981\u9012\u5F52\u52A0\u8F7D\u7684\u5B50\u7A0B\u5E8F\u5305\n-breakiterator \u8BA1\u7B97\u5E26\u6709 BreakIterator \u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5\n-bootclasspath \u8986\u76D6\u7531\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u6240\u52A0\u8F7D\u7684\n\t\t\t \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-source \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n-extdirs \u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E\n-verbose \u8F93\u51FA\u6709\u5173 Javadoc \u6B63\u5728\u6267\u884C\u7684\u64CD\u4F5C\u7684\u4FE1\u606F\n-locale \u8981\u4F7F\u7528\u7684\u533A\u57DF\u8BBE\u7F6E, \u4F8B\u5982 en_US \u6216 en_US_WIN\n-encoding \u6E90\u6587\u4EF6\u7F16\u7801\u540D\u79F0\n-quiet \u4E0D\u663E\u793A\u72B6\u6001\u6D88\u606F\n-J \u76F4\u63A5\u5C06 \u4F20\u9012\u5230\u8FD0\u884C\u65F6\u7CFB\u7EDF\n-X \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981\n -main.Xusage=-Xmaxerrs \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u9519\u8BEF\u6570\n-Xmaxwarns \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u8B66\u544A\u6570\n\n\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002 + +main.usage=\u7528\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n -overview \u4ECE HTML \u6587\u4EF6\u8BFB\u53D6\u6982\u89C8\u6587\u6863\n -public \u4EC5\u663E\u793A public \u7C7B\u548C\u6210\u5458\n -protected \u663E\u793A protected/public \u7C7B\u548C\u6210\u5458 (\u9ED8\u8BA4\u503C)\n -package \u663E\u793A package/protected/public \u7C7B\u548C\u6210\u5458\n -private \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458\n -help \u663E\u793A\u547D\u4EE4\u884C\u9009\u9879\u5E76\u9000\u51FA\n -doclet \u901A\u8FC7\u66FF\u4EE3 doclet \u751F\u6210\u8F93\u51FA\n -docletpath \u6307\u5B9A\u67E5\u627E doclet \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -sourcepath \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n -classpath \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -cp \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -exclude \u6307\u5B9A\u8981\u6392\u9664\u7684\u7A0B\u5E8F\u5305\u5217\u8868\n -subpackages \u6307\u5B9A\u8981\u9012\u5F52\u52A0\u8F7D\u7684\u5B50\u7A0B\u5E8F\u5305\n -breakiterator \u8BA1\u7B97\u5E26\u6709 BreakIterator \u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5\n -bootclasspath \u8986\u76D6\u7531\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u6240\u52A0\u8F7D\u7684\n \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -source \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n -extdirs \u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E\n -verbose \u8F93\u51FA\u6709\u5173 Javadoc \u6B63\u5728\u6267\u884C\u7684\u64CD\u4F5C\u7684\u4FE1\u606F\n -locale \u8981\u4F7F\u7528\u7684\u533A\u57DF\u8BBE\u7F6E, \u4F8B\u5982 en_US \u6216 en_US_WIN\n -encoding \u6E90\u6587\u4EF6\u7F16\u7801\u540D\u79F0\n -quiet \u4E0D\u663E\u793A\u72B6\u6001\u6D88\u606F\n -J \u76F4\u63A5\u5C06 \u4F20\u9012\u5230\u8FD0\u884C\u65F6\u7CFB\u7EDF\n -X \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981\n + +main.Xusage=\ -Xmaxerrs \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u9519\u8BEF\u6570\n -Xmaxwarns \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u8B66\u544A\u6570\n + +main.Xusage.foot=\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002 + main.option.already.seen={0}\u9009\u9879\u53EA\u80FD\u6307\u5B9A\u4E00\u6B21\u3002 main.requires_argument=\u9009\u9879{0}\u9700\u8981\u53C2\u6570\u3002 main.locale_first=\u5728\u547D\u4EE4\u884C\u4E2D, \u9009\u9879 -locale \u5FC5\u987B\u4E3A\u7B2C\u4E00\u4E2A\u9009\u9879\u3002 diff --git a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties index 6a5e90e7836..27aa006bdc6 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ tracing.not.supported=\u8B66\u544A: \u30C8\u30EC\u30FC\u30B9\u306F\u73FE\u5728\u # # Usage message. # -usage=\u4F7F\u7528\u65B9\u6CD5: javah [options] \n\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n\n\t-help \u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n\t-classpath \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-d \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n\t-o \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)\n\t-jni JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\t-version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n\t-verbose \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\t-force \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\n\n \u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002\n +usage=\u4F7F\u7528\u65B9\u6CD5: javah [options] \n\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n\n\t-help \u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n\t-classpath \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-cp \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\r\n\t-bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-d \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n\t-o \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)\n\t-jni JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\t-version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n\t-verbose \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\t-force \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\n\n\u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002\n main.usage=\u4F7F\u7528\u65B9\u6CD5: \n javah [options] \n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002 main.opt.o=\ -o \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B) @@ -60,6 +60,7 @@ main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C main.opt.jni=\ -jni JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8) main.opt.force=\ -force \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080 main.opt.classpath=\ -classpath \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 +main.opt.cp=\ -cp \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 main.opt.bootclasspath=\ -bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9 main.usage.foot=\u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002 @@ -90,7 +91,7 @@ unknown.type.in.method.signature=\u53E4\u3044\u5F62\u5F0F\u306E\u30B9\u30BF\u30D err.prefix=\u30A8\u30E9\u30FC: err.cant.use.option.for.fm=\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3067{0}\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093 err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} -err.ioerror=\u5165\u51FA\u529B\u30A8\u30E9\u30FC: {0} +err.ioerror=IO\u30A8\u30E9\u30FC: {0} err.missing.arg={0}\u306E\u5024\u304C\u3042\u308A\u307E\u305B\u3093 err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0} diff --git a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties index 995b1cad499..e4565df67fd 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ tracing.not.supported=\u8B66\u544A: \u4E0D\u518D\u652F\u6301\u8DDF\u8E2A\u3002\u # # Usage message. # -usage=\u7528\u6CD5: javah [options] \n\n\u5176\u4E2D, [options] \u5305\u62EC:\n\n\t-help \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\u5E76\u9000\u51FA\n\t-classpath \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-bootclasspath \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84\n\t-d \u8F93\u51FA\u76EE\u5F55\n\t-o \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)\n\t-jni \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)\n\t-version \u8F93\u51FA\u7248\u672C\u4FE1\u606F\n\t-verbose \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\t-force \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6\n\n \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684,\n(\u4F8B\u5982 java.lang.Object)\u3002\n +usage=\u7528\u6CD5: javah [options] \n\n\u5176\u4E2D, [options] \u5305\u62EC:\n\n\t-help \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\u5E76\u9000\u51FA\n\t-classpath \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-cp \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-bootclasspath \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84\n\t-d \u8F93\u51FA\u76EE\u5F55\n\t-o \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)\n\t-jni \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)\n\t-version \u8F93\u51FA\u7248\u672C\u4FE1\u606F\n\t-verbose \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\t-force \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6\n\n \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684,\n(\u4F8B\u5982, java.lang.Object)\u3002\n main.usage=\u7528\u6CD5: \n javah [options] \n\u5176\u4E2D, [options] \u5305\u62EC: main.opt.o=\ -o \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00) @@ -60,6 +60,7 @@ main.opt.version=\ -version \u8F93\u51FA\u7248\u672C\u4FE1\u606 main.opt.jni=\ -jni \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C) main.opt.force=\ -force \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6 main.opt.classpath=\ -classpath \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84 +main.opt.cp=\ -cp \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84 main.opt.bootclasspath=\ -bootclasspath \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84 main.usage.foot= \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684\n(\u4F8B\u5982, java.lang.Object)\u3002 diff --git a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties index e5b96053f10..72787232d52 100644 --- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties +++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties @@ -1,5 +1,5 @@ -err.prefix=\u30A8\u30E9\u30FC: +err.prefix=\u30A8\u30E9\u30FC: err.bad.constant.pool={0}\u306E\u5B9A\u6570\u30D7\u30FC\u30EB\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1} err.class.not.found=\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0} @@ -55,6 +55,8 @@ main.opt.s=\ -s \u5185\u90E8\u30BF\u30A4\u30D7\u7F72\u540 main.opt.classpath=\ -classpath \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B +main.opt.cp=\ -cp \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B + main.opt.bootclasspath=\ -bootclasspath \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B main.opt.constants=\ -constants \u9759\u7684final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B diff --git a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties index 97e4f5ce972..b9027ec9500 100644 --- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties @@ -1,5 +1,5 @@ -err.prefix=\u9519\u8BEF: +err.prefix=\u9519\u8BEF: err.bad.constant.pool=\u8BFB\u53D6{0}\u7684\u5E38\u91CF\u6C60\u65F6\u51FA\u9519: {1} err.class.not.found=\u627E\u4E0D\u5230\u7C7B: {0} @@ -55,6 +55,8 @@ main.opt.s=\ -s \u8F93\u51FA\u5185\u90E8\u7C7B\u578B\u7B7 main.opt.classpath=\ -classpath \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E +main.opt.cp=\ -cp \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E + main.opt.bootclasspath=\ -bootclasspath \u8986\u76D6\u5F15\u5BFC\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E main.opt.constants=\ -constants \u663E\u793A\u9759\u6001\u6700\u7EC8\u5E38\u91CF From 0ccb2841ea32b7cee8321fc6563f0d269f010d6d Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 24 Sep 2013 16:08:00 -0700 Subject: [PATCH 223/983] 8022585: VM crashes when ran with -XX:+PrintInlining Use adr_at() to access inline info structures in growableArray. Add ability to specify print inlining per method. Reviewed-by: twisti --- hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 4 ++- hotspot/src/share/vm/opto/bytecodeInfo.cpp | 10 +++--- hotspot/src/share/vm/opto/callGenerator.hpp | 3 +- hotspot/src/share/vm/opto/compile.cpp | 12 ++++--- hotspot/src/share/vm/opto/compile.hpp | 26 ++++++++------ hotspot/src/share/vm/opto/doCall.cpp | 4 +-- hotspot/src/share/vm/opto/library_call.cpp | 26 +++++++------- .../test/compiler/print/PrintInlining.java | 36 +++++++++++++++++++ 8 files changed, 84 insertions(+), 37 deletions(-) create mode 100644 hotspot/test/compiler/print/PrintInlining.java diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index b7ea6eebb26..03d0d75fa30 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -4219,7 +4219,9 @@ void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool succes } } - if (!PrintInlining) return; + if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) { + return; + } CompileTask::print_inlining(callee, scope()->level(), bci(), msg); if (success && CIPrintMethodCodes) { callee->print_codes(); diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 45ba8d758b0..2ba7b1cf3b4 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -123,7 +123,7 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, // Allows targeted inlining if(callee_method->should_inline()) { *wci_result = *(WarmCallInfo::always_hot()); - if (PrintInlining && Verbose) { + if (C->print_inlining() && Verbose) { CompileTask::print_inline_indent(inline_level()); tty->print_cr("Inlined method is hot: "); } @@ -137,7 +137,7 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, if(callee_method->interpreter_throwout_count() > InlineThrowCount && size < InlineThrowMaxSize ) { wci_result->set_profit(wci_result->profit() * 100); - if (PrintInlining && Verbose) { + if (C->print_inlining() && Verbose) { CompileTask::print_inline_indent(inline_level()); tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count()); } @@ -491,7 +491,7 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, C->log()->inline_fail(inline_msg); } } - if (PrintInlining) { + if (C->print_inlining()) { C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg); if (callee_method == NULL) tty->print(" callee not monotonic or profiled"); if (Verbose && callee_method) { @@ -540,7 +540,7 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, #ifndef PRODUCT if (UseOldInlining && InlineWarmCalls - && (PrintOpto || PrintOptoInlining || PrintInlining)) { + && (PrintOpto || C->print_inlining())) { bool cold = wci.is_cold(); bool hot = !cold && wci.is_hot(); bool old_cold = !success; @@ -617,7 +617,7 @@ InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, J callee_method->is_compiled_lambda_form()) { max_inline_level_adjust += 1; // don't count method handle calls from java.lang.invoke implem } - if (max_inline_level_adjust != 0 && PrintInlining && (Verbose || WizardMode)) { + if (max_inline_level_adjust != 0 && C->print_inlining() && (Verbose || WizardMode)) { CompileTask::print_inline_indent(inline_level()); tty->print_cr(" \\-> discounting inline depth"); } diff --git a/hotspot/src/share/vm/opto/callGenerator.hpp b/hotspot/src/share/vm/opto/callGenerator.hpp index 0f6b2d16590..a1616de4dc7 100644 --- a/hotspot/src/share/vm/opto/callGenerator.hpp +++ b/hotspot/src/share/vm/opto/callGenerator.hpp @@ -159,8 +159,9 @@ class CallGenerator : public ResourceObj { virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); } static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) { - if (PrintInlining) + if (C->print_inlining()) { C->print_inlining(callee, inline_level, bci, msg); + } } }; diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 1c625d679b3..0fed4e06c72 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -654,7 +654,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr _inlining_progress(false), _inlining_incrementally(false), _print_inlining_list(NULL), - _print_inlining(0) { + _print_inlining_idx(0) { C = this; CompileWrapper cw(this); @@ -679,6 +679,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr set_print_assembly(print_opto_assembly); set_parsed_irreducible_loop(false); #endif + set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); + set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); if (ProfileTraps) { // Make sure the method being compiled gets its own MDO, @@ -710,7 +712,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr PhaseGVN gvn(node_arena(), estimated_size); set_initial_gvn(&gvn); - if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { + if (print_inlining() || print_intrinsics()) { _print_inlining_list = new (comp_arena())GrowableArray(comp_arena(), 1, 1, PrintInliningBuffer()); } { // Scope for timing the parser @@ -937,7 +939,7 @@ Compile::Compile( ciEnv* ci_env, _inlining_progress(false), _inlining_incrementally(false), _print_inlining_list(NULL), - _print_inlining(0) { + _print_inlining_idx(0) { C = this; #ifndef PRODUCT @@ -3611,7 +3613,7 @@ void Compile::ConstantTable::fill_jump_table(CodeBuffer& cb, MachConstantNode* n } void Compile::dump_inlining() { - if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { + if (print_inlining() || print_intrinsics()) { // Print inlining message for candidates that we couldn't inline // for lack of space or non constant receiver for (int i = 0; i < _late_inlines.length(); i++) { @@ -3635,7 +3637,7 @@ void Compile::dump_inlining() { } } for (int i = 0; i < _print_inlining_list->length(); i++) { - tty->print(_print_inlining_list->at(i).ss()->as_string()); + tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); } } } diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 8d862c24125..631372efabc 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -312,6 +312,8 @@ class Compile : public Phase { bool _do_method_data_update; // True if we generate code to update MethodData*s int _AliasLevel; // Locally-adjusted version of AliasLevel flag. bool _print_assembly; // True if we should dump assembly code for this compilation + bool _print_inlining; // True if we should print inlining for this compilation + bool _print_intrinsics; // True if we should print intrinsics for this compilation #ifndef PRODUCT bool _trace_opto_output; bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing @@ -414,7 +416,7 @@ class Compile : public Phase { }; GrowableArray* _print_inlining_list; - int _print_inlining; + int _print_inlining_idx; // Only keep nodes in the expensive node list that need to be optimized void cleanup_expensive_nodes(PhaseIterGVN &igvn); @@ -426,24 +428,24 @@ class Compile : public Phase { public: outputStream* print_inlining_stream() const { - return _print_inlining_list->at(_print_inlining).ss(); + return _print_inlining_list->adr_at(_print_inlining_idx)->ss(); } void print_inlining_skip(CallGenerator* cg) { - if (PrintInlining) { - _print_inlining_list->at(_print_inlining).set_cg(cg); - _print_inlining++; - _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer()); + if (_print_inlining) { + _print_inlining_list->adr_at(_print_inlining_idx)->set_cg(cg); + _print_inlining_idx++; + _print_inlining_list->insert_before(_print_inlining_idx, PrintInliningBuffer()); } } void print_inlining_insert(CallGenerator* cg) { - if (PrintInlining) { + if (_print_inlining) { for (int i = 0; i < _print_inlining_list->length(); i++) { - if (_print_inlining_list->at(i).cg() == cg) { + if (_print_inlining_list->adr_at(i)->cg() == cg) { _print_inlining_list->insert_before(i+1, PrintInliningBuffer()); - _print_inlining = i+1; - _print_inlining_list->at(i).set_cg(NULL); + _print_inlining_idx = i+1; + _print_inlining_list->adr_at(i)->set_cg(NULL); return; } } @@ -572,6 +574,10 @@ class Compile : public Phase { int AliasLevel() const { return _AliasLevel; } bool print_assembly() const { return _print_assembly; } void set_print_assembly(bool z) { _print_assembly = z; } + bool print_inlining() const { return _print_inlining; } + void set_print_inlining(bool z) { _print_inlining = z; } + bool print_intrinsics() const { return _print_intrinsics; } + void set_print_intrinsics(bool z) { _print_intrinsics = z; } // check the CompilerOracle for special behaviours for this compile bool method_has_option(const char * option) { return method() != NULL && method()->has_option(option); diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index e55a01ba638..8784bbe2dc5 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -41,9 +41,9 @@ #include "runtime/sharedRuntime.hpp" void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { - if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { + if (TraceTypeProfile || C->print_inlining()) { outputStream* out = tty; - if (!PrintInlining) { + if (!C->print_inlining()) { if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { method->print_short_name(); tty->cr(); diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 2bfa25fa9c2..902ed5919f3 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -543,7 +543,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { Compile* C = kit.C; int nodes = C->unique(); #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { char buf[1000]; const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf)); tty->print_cr("Intrinsic %s", str); @@ -554,7 +554,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { // Try to inline the intrinsic. if (kit.try_to_inline()) { - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { + if (C->print_intrinsics() || C->print_inlining()) { C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); @@ -570,7 +570,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { } // The intrinsic bailed out - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { + if (C->print_intrinsics() || C->print_inlining()) { if (jvms->has_method()) { // Not a root compile. const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)"; @@ -592,7 +592,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms) { int nodes = C->unique(); #ifndef PRODUCT assert(is_predicted(), "sanity"); - if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { char buf[1000]; const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf)); tty->print_cr("Predicate for intrinsic %s", str); @@ -603,7 +603,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms) { Node* slow_ctl = kit.try_to_predicate(); if (!kit.failing()) { - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { + if (C->print_intrinsics() || C->print_inlining()) { C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); @@ -617,7 +617,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms) { } // The intrinsic bailed out - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { + if (C->print_intrinsics() || C->print_inlining()) { if (jvms->has_method()) { // Not a root compile. const char* msg = "failed to generate predicate for intrinsic"; @@ -2299,7 +2299,7 @@ const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_ const TypeOopPtr* tjp = TypeOopPtr::make_from_klass(sharpened_klass); #ifndef PRODUCT - if (PrintIntrinsics || PrintInlining || PrintOptoInlining) { + if (C->print_intrinsics() || C->print_inlining()) { tty->print(" from base type: "); adr_type->dump(); tty->print(" sharpened value: "); tjp->dump(); } @@ -3260,7 +3260,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { if (mirror_con == NULL) return false; // cannot happen? #ifndef PRODUCT - if (PrintIntrinsics || PrintInlining || PrintOptoInlining) { + if (C->print_intrinsics() || C->print_inlining()) { ciType* k = mirror_con->java_mirror_type(); if (k) { tty->print("Inlining %s on constant Class ", vmIntrinsics::name_at(intrinsic_id())); @@ -3952,14 +3952,14 @@ bool LibraryCallKit::inline_native_getClass() { // caller sensitive methods. bool LibraryCallKit::inline_native_Reflection_getCallerClass() { #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { tty->print_cr("Attempting to inline sun.reflect.Reflection.getCallerClass"); } #endif if (!jvms()->has_method()) { #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { tty->print_cr(" Bailing out because intrinsic was inlined at top level"); } #endif @@ -3983,7 +3983,7 @@ bool LibraryCallKit::inline_native_Reflection_getCallerClass() { // Frame 0 and 1 must be caller sensitive (see JVM_GetCallerClass). if (!m->caller_sensitive()) { #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { tty->print_cr(" Bailing out: CallerSensitive annotation expected at frame %d", n); } #endif @@ -3999,7 +3999,7 @@ bool LibraryCallKit::inline_native_Reflection_getCallerClass() { set_result(makecon(TypeInstPtr::make(caller_mirror))); #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { tty->print_cr(" Succeeded: caller = %d) %s.%s, JVMS depth = %d", n, caller_klass->name()->as_utf8(), caller_jvms->method()->name()->as_utf8(), jvms()->depth()); tty->print_cr(" JVM state at this point:"); for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) { @@ -4015,7 +4015,7 @@ bool LibraryCallKit::inline_native_Reflection_getCallerClass() { } #ifndef PRODUCT - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { tty->print_cr(" Bailing out because caller depth exceeded inlining depth = %d", jvms()->depth()); tty->print_cr(" JVM state at this point:"); for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) { diff --git a/hotspot/test/compiler/print/PrintInlining.java b/hotspot/test/compiler/print/PrintInlining.java new file mode 100644 index 00000000000..877d25e8c38 --- /dev/null +++ b/hotspot/test/compiler/print/PrintInlining.java @@ -0,0 +1,36 @@ +/* + * 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 8022585 + * @summary VM crashes when ran with -XX:+PrintInlining + * @run main/othervm -Xcomp -XX:+PrintInlining PrintInlining + * + */ + +public class PrintInlining { + public static void main(String[] args) { + System.out.println("Passed"); + } +} From 2233312946292ac77ccf9092fb50e1fc91391c34 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Tue, 24 Sep 2013 16:12:06 -0700 Subject: [PATCH 224/983] 8016328: Regression : Javadoc i18n regression caused by fix for 8012375 Reviewed-by: jjg --- .../doclets/formats/html/markup/HtmlTree.java | 43 ++++++++++++++++++- .../formats/html/markup/HtmlWriter.java | 9 +++- .../com/sun/javadoc/testHref/TestHref.java | 10 ++--- .../testJavascript/TestJavascript.java | 11 ++++- .../testLinkTaglet/TestLinkTaglet.java | 8 ++-- .../TestPrivateClasses.java | 4 +- .../javadoc/testUseOption/TestUseOption.java | 6 +-- 7 files changed, 73 insertions(+), 18 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java index dc59eb0f4a0..fb7c409c3f0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java @@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html.markup; import java.io.IOException; import java.io.Writer; import java.util.*; +import java.nio.charset.*; import com.sun.tools.doclets.internal.toolkit.Content; import com.sun.tools.doclets.internal.toolkit.util.*; @@ -163,6 +164,46 @@ public class HtmlTree extends Content { return s; } + /** + * A set of ASCII URI characters to be left unencoded. + */ + public static BitSet NONENCODING_CHARS = new BitSet(256); + + static { + // alphabetic characters + for (int i = 'a'; i <= 'z'; i++) { + NONENCODING_CHARS.set(i); + } + for (int i = 'A'; i <= 'Z'; i++) { + NONENCODING_CHARS.set(i); + } + // numeric characters + for (int i = '0'; i <= '9'; i++) { + NONENCODING_CHARS.set(i); + } + // Reserved characters as per RFC 3986. These are set of delimiting characters. + String noEnc = ":/?#[]@!$&'()*+,;="; + // Unreserved characters as per RFC 3986 which should not be percent encoded. + noEnc += "-._~"; + for (int i = 0; i < noEnc.length(); i++) { + NONENCODING_CHARS.set(noEnc.charAt(i)); + } + } + + private static String encodeURL(String url) { + byte[] urlBytes = url.getBytes(Charset.forName("UTF-8")); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < urlBytes.length; i++) { + int c = urlBytes[i]; + if (NONENCODING_CHARS.get(c & 0xFF)) { + sb.append((char) c); + } else { + sb.append(String.format("%%%02X", c & 0xFF)); + } + } + return sb.toString(); + } + /** * Generates an HTML anchor tag. * @@ -172,7 +213,7 @@ public class HtmlTree extends Content { */ public static HtmlTree A(String ref, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body)); - htmltree.addAttr(HtmlAttr.HREF, ref); + htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref)); return htmltree; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java index 36becd2e7ef..e1da06598a6 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java @@ -335,6 +335,12 @@ public class HtmlWriter { " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL + " targetPage = \"undefined\";" + DocletConstants.NL + " function validURL(url) {" + DocletConstants.NL + + " try {" + DocletConstants.NL + + " url = decodeURIComponent(url);" + DocletConstants.NL + + " }" + DocletConstants.NL + + " catch (error) {" + DocletConstants.NL + + " return false;" + DocletConstants.NL + + " }" + DocletConstants.NL + " var pos = url.indexOf(\".html\");" + DocletConstants.NL + " if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL + " return false;" + DocletConstants.NL + @@ -346,7 +352,8 @@ public class HtmlWriter { " if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL + " 'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL + " ch == '$' ||" + DocletConstants.NL + - " ch == '_') {" + DocletConstants.NL + + " ch == '_' ||" + DocletConstants.NL + + " ch.charCodeAt(0) > 127) {" + DocletConstants.NL + " allowNumber = true;" + DocletConstants.NL + " allowSep = true;" + DocletConstants.NL + " } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL + diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java index 297ddc69164..b8c4a24ca05 100644 --- a/langtools/test/com/sun/javadoc/testHref/TestHref.java +++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4663254 + * @bug 4663254 8016328 * @summary Verify that spaces do not appear in hrefs and anchors. * @author jamieh * @library ../lib/ @@ -46,11 +46,11 @@ public class TestHref extends JavadocTester { private static final String[][] TEST = { //External link. {BUG_ID + FS + "pkg" + FS + "C1.html", - "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\"" + "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\"" }, //Member summary table link. {BUG_ID + FS + "pkg" + FS + "C1.html", - "href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\"" + "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\"" }, //Anchor test. {BUG_ID + FS + "pkg" + FS + "C1.html", @@ -66,11 +66,11 @@ public class TestHref extends JavadocTester { }, //{@link} test. {BUG_ID + FS + "pkg" + FS + "C2.html", - "Link: " + "Link: " }, //@see test. {BUG_ID + FS + "pkg" + FS + "C2.html", - "See Also:" + NL + "
    " + "See Also:" + NL + "
    " }, //Header does not link to the page itself. diff --git a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java index 763566a03ac..28602092110 100644 --- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java +++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4665566 4855876 7025314 8012375 8015997 + * @bug 4665566 4855876 7025314 8012375 8015997 8016328 * @summary Verify that the output has the right javascript. * @author jamieh * @library ../lib/ @@ -56,6 +56,12 @@ public class TestJavascript extends JavadocTester { " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL + " targetPage = \"undefined\";" + NL + " function validURL(url) {" + NL + + " try {" + NL + + " url = decodeURIComponent(url);" + NL + + " }" + NL + + " catch (error) {" + NL + + " return false;" + NL + + " }" + NL + " var pos = url.indexOf(\".html\");" + NL + " if (pos == -1 || pos != url.length - 5)" + NL + " return false;" + NL + @@ -67,7 +73,8 @@ public class TestJavascript extends JavadocTester { " if ('a' <= ch && ch <= 'z' ||" + NL + " 'A' <= ch && ch <= 'Z' ||" + NL + " ch == '$' ||" + NL + - " ch == '_') {" + NL + + " ch == '_' ||" + NL + + " ch.charCodeAt(0) > 127) {" + NL + " allowNumber = true;" + NL + " allowSep = true;" + NL + " } else if ('0' <= ch && ch <= '9'" + NL + diff --git a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java index 4720fe4d2be..ef9dd2bbb9a 100644 --- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java +++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4732864 6280605 7064544 8014636 + * @bug 4732864 6280605 7064544 8014636 8016328 * @summary Make sure that you can link from one member to another using * non-qualified name, furthermore, ensure the right one is linked. * @author jamieh @@ -49,9 +49,9 @@ public class TestLinkTaglet extends JavadocTester { "Qualified Link: C.InnerC.
    " + NL + " Unqualified Link1: C.InnerC.
    " + NL + " Unqualified Link2: C.InnerC.
    " + NL + - " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
    " + NL + - " Unqualified Link: method(C.InnerC, C.InnerC2).
    " + NL + - " Unqualified Link: method(InnerC, InnerC2).
    " + " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
    " + NL + + " Unqualified Link: method(C.InnerC, C.InnerC2).
    " + NL + + " Unqualified Link: method(InnerC, InnerC2).
    " }, {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", "Link to member in outer class: C.MEMBER
    " + NL + diff --git a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java index b6ae263d8a4..b7a9bc73a10 100644 --- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java +++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4780441 4874845 4978816 8014017 + * @bug 4780441 4874845 4978816 8014017 8016328 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * @@ -177,7 +177,7 @@ public class TestPrivateClasses extends JavadocTester { // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", "
    Overrides:
    " + NL + - "
    " + + "
    " + "methodOverridenFromParent in class " + "" + "PrivateParent
    "}, diff --git a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java index 6a61e43f3b1..a1e0e970af0 100644 --- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java +++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4496290 4985072 7006178 7068595 + * @bug 4496290 4985072 7006178 7068595 8016328 * @summary A simple test to determine if -use works. * @author jamieh * @library ../lib/ @@ -60,7 +60,7 @@ public class TestUseOption extends JavadocTester { "UsedInC in <Unnamed>" }, {BUG_ID + "-3" + FS + "package-use.html", "" + - "UsedInC " + "UsedInC " } }; From ddddd1d31f770943fcf2e737a7bf5ac490be27b6 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Wed, 25 Sep 2013 09:47:24 +0200 Subject: [PATCH 225/983] 8025140: TEST_BUG: java/util/logging/Logger/getGlobal tests fail due to timeout Arbitrary timeouts in the tests @run lines where too agressive for some configurations. The tests will now run with default timeout. Reviewed-by: alanb, mchung --- .../Logger/getGlobal/TestGetGlobal.java | 24 +++++++++---------- .../Logger/getGlobal/TestGetGlobalByName.java | 24 +++++++++---------- .../getGlobal/TestGetGlobalConcurrent.java | 24 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java index 4c6b39b0acd..e87e15f81fc 100644 --- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java @@ -29,18 +29,18 @@ import java.util.logging.Logger; * @bug 7184195 * @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration * @build TestGetGlobal testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl - * @run main/othervm/timeout=10 TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobal - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal + * @run main/othervm TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager TestGetGlobal + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal + * @run main/othervm -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal + * @run main/othervm -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal * @author danielfuchs */ public class TestGetGlobal { diff --git a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java index 62580a8bc3b..91968db400b 100644 --- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java @@ -29,18 +29,18 @@ import java.util.logging.Logger; * @bug 7184195 * @summary checks that java.util.logging.Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info() logs without configuration * @build TestGetGlobalByName testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl - * @run main/othervm/timeout=10 TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalByName - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalByName - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName + * @run main/othervm TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager TestGetGlobalByName + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalByName + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName + * @run main/othervm -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName + * @run main/othervm -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName * @author danielfuchs */ public class TestGetGlobalByName { diff --git a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java index e3f9d1d8872..23688e1bca5 100644 --- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java @@ -30,18 +30,18 @@ import java.util.logging.Logger; * @bug 7184195 8021003 * @summary Test that the global logger can log with no configuration when accessed from multiple threads. * @build TestGetGlobalConcurrent testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl - * @run main/othervm/timeout=10 TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalConcurrent - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent - * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent - * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent + * @run main/othervm TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager TestGetGlobalConcurrent + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalConcurrent + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent + * @run main/othervm -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent + * @run main/othervm -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent + * @run main/othervm -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent + * @run main/othervm/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent * @author danielfuchs */ public class TestGetGlobalConcurrent { From 0587e4621540c920b4c4c4579bc46d8cb1dade48 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 25 Sep 2013 14:06:15 +0400 Subject: [PATCH 226/983] 8023310: Thread contention in the method Beans.IsDesignTime() Reviewed-by: art, sfriberg --- .../java/beans/ThreadGroupContext.java | 18 +-- .../classes/java/beans/WeakIdentityMap.java | 139 ++++++++++-------- 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/jdk/src/share/classes/java/beans/ThreadGroupContext.java b/jdk/src/share/classes/java/beans/ThreadGroupContext.java index 6236ec2b38c..d93f1a87217 100644 --- a/jdk/src/share/classes/java/beans/ThreadGroupContext.java +++ b/jdk/src/share/classes/java/beans/ThreadGroupContext.java @@ -41,24 +41,20 @@ import java.util.WeakHashMap; */ final class ThreadGroupContext { - private static final WeakIdentityMap contexts = new WeakIdentityMap<>(); + private static final WeakIdentityMap contexts = new WeakIdentityMap() { + protected ThreadGroupContext create(Object key) { + return new ThreadGroupContext(); + } + }; /** - * Returns the appropriate {@code AppContext} for the caller, + * Returns the appropriate {@code ThreadGroupContext} for the caller, * as determined by its {@code ThreadGroup}. * * @return the application-dependent context */ static ThreadGroupContext getContext() { - ThreadGroup group = Thread.currentThread().getThreadGroup(); - synchronized (contexts) { - ThreadGroupContext context = contexts.get(group); - if (context == null) { - context = new ThreadGroupContext(); - contexts.put(group, context); - } - return context; - } + return contexts.get(Thread.currentThread().getThreadGroup()); } private volatile boolean isDesignTime; diff --git a/jdk/src/share/classes/java/beans/WeakIdentityMap.java b/jdk/src/share/classes/java/beans/WeakIdentityMap.java index 42ac821a392..83d8bfb1b50 100644 --- a/jdk/src/share/classes/java/beans/WeakIdentityMap.java +++ b/jdk/src/share/classes/java/beans/WeakIdentityMap.java @@ -33,18 +33,22 @@ import java.lang.ref.WeakReference; * and reference-equality in place of object-equality to compare them. * An entry will automatically be removed when its key is no longer * in ordinary use. Both null values and the null key are supported. + * This class does not require additional synchronization. + * A thread-safety is provided by a fragile combination + * of synchronized blocks and volatile fields. + * Be very careful during editing! * * @see java.util.IdentityHashMap * @see java.util.WeakHashMap */ -final class WeakIdentityMap { +abstract class WeakIdentityMap { private static final int MAXIMUM_CAPACITY = 1 << 30; // it MUST be a power of two private static final Object NULL = new Object(); // special object for null key private final ReferenceQueue queue = new ReferenceQueue(); - private Entry[] table = newTable(1<<3); // table's length MUST be a power of two + private volatile Entry[] table = newTable(1<<3); // table's length MUST be a power of two private int threshold = 6; // the next size value at which to resize private int size = 0; // the number of key-value mappings @@ -54,78 +58,83 @@ final class WeakIdentityMap { key = NULL; } int hash = key.hashCode(); - int index = getIndex(this.table, hash); - for (Entry entry = this.table[index]; entry != null; entry = entry.next) { + Entry[] table = this.table; + // unsynchronized search improves performance + // the null value does not mean that there are no needed entry + int index = getIndex(table, hash); + for (Entry entry = table[index]; entry != null; entry = entry.next) { if (entry.isMatched(key, hash)) { return entry.value; } } - return null; - } - - public T put(Object key, T value) { - removeStaleEntries(); - if (key == null) { - key = NULL; - } - int hash = key.hashCode(); - int index = getIndex(this.table, hash); - for (Entry entry = this.table[index]; entry != null; entry = entry.next) { - if (entry.isMatched(key, hash)) { - T oldValue = entry.value; - entry.value = value; - return oldValue; + synchronized (NULL) { + // synchronized search improves stability + // we must create and add new value if there are no needed entry + index = getIndex(this.table, hash); + for (Entry entry = this.table[index]; entry != null; entry = entry.next) { + if (entry.isMatched(key, hash)) { + return entry.value; + } } - } - this.table[index] = new Entry(key, hash, value, this.queue, this.table[index]); - if (++this.size >= this.threshold) { - if (this.table.length == MAXIMUM_CAPACITY) { - this.threshold = Integer.MAX_VALUE; - } - else { - removeStaleEntries(); - Entry[] table = newTable(this.table.length * 2); - transfer(this.table, table); - - // If ignoring null elements and processing ref queue caused massive - // shrinkage, then restore old table. This should be rare, but avoids - // unbounded expansion of garbage-filled tables. - if (this.size >= this.threshold / 2) { - this.table = table; - this.threshold *= 2; + T value = create(key); + this.table[index] = new Entry(key, hash, value, this.queue, this.table[index]); + if (++this.size >= this.threshold) { + if (this.table.length == MAXIMUM_CAPACITY) { + this.threshold = Integer.MAX_VALUE; } else { - transfer(table, this.table); - } - } - } - return null; - } - - private void removeStaleEntries() { - for (Object ref = this.queue.poll(); ref != null; ref = this.queue.poll()) { - @SuppressWarnings("unchecked") - Entry entry = (Entry) ref; - int index = getIndex(this.table, entry.hash); - - Entry prev = this.table[index]; - Entry current = prev; - while (current != null) { - Entry next = current.next; - if (current == entry) { - if (prev == entry) { - this.table[index] = next; + removeStaleEntries(); + table = newTable(this.table.length * 2); + transfer(this.table, table); + // If ignoring null elements and processing ref queue caused massive + // shrinkage, then restore old table. This should be rare, but avoids + // unbounded expansion of garbage-filled tables. + if (this.size >= this.threshold / 2) { + this.table = table; + this.threshold *= 2; } else { - prev.next = next; + transfer(table, this.table); } - entry.value = null; // Help GC - entry.next = null; // Help GC - this.size--; - break; } - prev = current; - current = next; + } + return value; + } + } + + protected abstract T create(Object key); + + private void removeStaleEntries() { + Object ref = this.queue.poll(); + if (ref != null) { + synchronized (NULL) { + do { + @SuppressWarnings("unchecked") + Entry entry = (Entry) ref; + int index = getIndex(this.table, entry.hash); + + Entry prev = this.table[index]; + Entry current = prev; + while (current != null) { + Entry next = current.next; + if (current == entry) { + if (prev == entry) { + this.table[index] = next; + } + else { + prev.next = next; + } + entry.value = null; // Help GC + entry.next = null; // Help GC + this.size--; + break; + } + prev = current; + current = next; + } + ref = this.queue.poll(); + } + while (ref != null); } } } @@ -164,8 +173,8 @@ final class WeakIdentityMap { private static class Entry extends WeakReference { private final int hash; - private T value; - private Entry next; + private volatile T value; + private volatile Entry next; Entry(Object key, int hash, T value, ReferenceQueue queue, Entry next) { super(key, queue); From ab5637182c30ed955197bdad674c7bd51f8b2f3a Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 25 Sep 2013 13:25:24 +0200 Subject: [PATCH 227/983] 7163191: G1: introduce a "heap spanning table" abstraction Add G1BiasedArray that is an array where each element represents a fixed-sized subdivision of the heap. Use this abstraction to refactor the HeapRegionSeq class. Reviewed-by: brutisso --- hotspot/make/excludeSrc.make | 2 +- .../vm/gc_implementation/g1/g1BiasedArray.cpp | 141 ++++++++++++++ .../vm/gc_implementation/g1/g1BiasedArray.hpp | 181 ++++++++++++++++++ .../gc_implementation/g1/g1CollectedHeap.cpp | 6 +- .../vm/gc_implementation/g1/heapRegionSeq.cpp | 49 ++--- .../vm/gc_implementation/g1/heapRegionSeq.hpp | 59 +++--- .../g1/heapRegionSeq.inline.hpp | 22 +-- .../vm/gc_implementation/g1/vmStructs_g1.hpp | 12 +- hotspot/src/share/vm/prims/jni.cpp | 4 + 9 files changed, 389 insertions(+), 87 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp diff --git a/hotspot/make/excludeSrc.make b/hotspot/make/excludeSrc.make index c3a9b4dea0e..a95dc1b114c 100644 --- a/hotspot/make/excludeSrc.make +++ b/hotspot/make/excludeSrc.make @@ -88,7 +88,7 @@ ifeq ($(INCLUDE_ALL_GCS), false) g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \ g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp \ g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \ - heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \ + g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \ ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \ adjoiningGenerations.cpp adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp \ cardTableExtension.cpp gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp \ diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp new file mode 100644 index 00000000000..7f5023b422b --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp @@ -0,0 +1,141 @@ +/* + * 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. + * + */ + +#include "precompiled.hpp" +#include "gc_implementation/g1/g1BiasedArray.hpp" + +#ifndef PRODUCT +void G1BiasedMappedArrayBase::verify_index(idx_t index) const { + guarantee(_base != NULL, "Array not initialized"); + guarantee(index < length(), err_msg("Index out of bounds index: "SIZE_FORMAT" length: "SIZE_FORMAT, index, length())); +} + +void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const { + guarantee(_biased_base != NULL, "Array not initialized"); + guarantee(biased_index >= bias() && biased_index < (bias() + length()), + err_msg("Biased index out of bounds, index: "SIZE_FORMAT" bias: "SIZE_FORMAT" length: "SIZE_FORMAT, biased_index, bias(), length())); +} + +void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const { + guarantee(_biased_base != NULL, "Array not initialized"); + guarantee(biased_index >= bias() && biased_index <= (bias() + length()), + err_msg("Biased index out of inclusive bounds, index: "SIZE_FORMAT" bias: "SIZE_FORMAT" length: "SIZE_FORMAT, biased_index, bias(), length())); +} + +class TestMappedArray : public G1BiasedMappedArray { +protected: + virtual int default_value() const { return 0xBAADBABE; } +public: + static void test_biasedarray() { + const size_t REGION_SIZE_IN_WORDS = 512; + const size_t NUM_REGIONS = 20; + HeapWord* fake_heap = (HeapWord*)LP64_ONLY(0xBAAA00000) NOT_LP64(0xBA000000); // Any value that is non-zero + + TestMappedArray array; + array.initialize(fake_heap, fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS, + REGION_SIZE_IN_WORDS * HeapWordSize); + // Check address calculation (bounds) + assert(array.bottom_address_mapped() == fake_heap, + err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped())); + assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be"); + + int* bottom = array.address_mapped_to(fake_heap); + assert((void*)bottom == (void*) array.base(), "must be"); + int* end = array.address_mapped_to(fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS); + assert((void*)end == (void*)(array.base() + array.length()), "must be"); + // The entire array should contain default value elements + for (int* current = bottom; current < end; current++) { + assert(*current == array.default_value(), "must be"); + } + + // Test setting values in the table + + HeapWord* region_start_address = fake_heap + REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2); + HeapWord* region_end_address = fake_heap + (REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2) + REGION_SIZE_IN_WORDS - 1); + + // Set/get by address tests: invert some value; first retrieve one + int actual_value = array.get_by_index(NUM_REGIONS / 2); + array.set_by_index(NUM_REGIONS / 2, ~actual_value); + // Get the same value by address, should correspond to the start of the "region" + int value = array.get_by_address(region_start_address); + assert(value == ~actual_value, "must be"); + // Get the same value by address, at one HeapWord before the start + value = array.get_by_address(region_start_address - 1); + assert(value == array.default_value(), "must be"); + // Get the same value by address, at the end of the "region" + value = array.get_by_address(region_end_address); + assert(value == ~actual_value, "must be"); + // Make sure the next value maps to another index + value = array.get_by_address(region_end_address + 1); + assert(value == array.default_value(), "must be"); + + // Reset the value in the array + array.set_by_address(region_start_address + (region_end_address - region_start_address) / 2, actual_value); + + // The entire array should have the default value again + for (int* current = bottom; current < end; current++) { + assert(*current == array.default_value(), "must be"); + } + + // Set/get by index tests: invert some value + idx_t index = NUM_REGIONS / 2; + actual_value = array.get_by_index(index); + array.set_by_index(index, ~actual_value); + + value = array.get_by_index(index); + assert(value == ~actual_value, "must be"); + + value = array.get_by_index(index - 1); + assert(value == array.default_value(), "must be"); + + value = array.get_by_index(index + 1); + assert(value == array.default_value(), "must be"); + + array.set_by_index(0, 0); + value = array.get_by_index(0); + assert(value == 0, "must be"); + + array.set_by_index(array.length() - 1, 0); + value = array.get_by_index(array.length() - 1); + assert(value == 0, "must be"); + + array.set_by_index(index, 0); + + // The array should have three zeros, and default values otherwise + size_t num_zeros = 0; + for (int* current = bottom; current < end; current++) { + assert(*current == array.default_value() || *current == 0, "must be"); + if (*current == 0) { + num_zeros++; + } + } + assert(num_zeros == 3, "must be"); + } +}; + +void TestG1BiasedArray_test() { + TestMappedArray::test_biasedarray(); +} + +#endif diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp new file mode 100644 index 00000000000..f80c70b4e36 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp @@ -0,0 +1,181 @@ +/* + * 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. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP + +#include "utilities/debug.hpp" +#include "memory/allocation.inline.hpp" + +// Implements the common base functionality for arrays that contain provisions +// for accessing its elements using a biased index. +// The element type is defined by the instantiating the template. +class G1BiasedMappedArrayBase VALUE_OBJ_CLASS_SPEC { + friend class VMStructs; +public: + typedef size_t idx_t; +protected: + address _base; // the real base address + size_t _length; // the length of the array + address _biased_base; // base address biased by "bias" elements + size_t _bias; // the bias, i.e. the offset biased_base is located to the right in elements + uint _shift_by; // the amount of bits to shift right when mapping to an index of the array. + +protected: + + G1BiasedMappedArrayBase() : _base(NULL), _length(0), _biased_base(NULL), + _bias(0), _shift_by(0) { } + + // Allocate a new array, generic version. + static address create_new_base_array(size_t length, size_t elem_size) { + assert(length > 0, "just checking"); + assert(elem_size > 0, "just checking"); + return NEW_C_HEAP_ARRAY(u_char, length * elem_size, mtGC); + } + + // Initialize the members of this class. The biased start address of this array + // is the bias (in elements) multiplied by the element size. + void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { + assert(base != NULL, "just checking"); + assert(length > 0, "just checking"); + assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by)); + _base = base; + _length = length; + _biased_base = base - (bias * elem_size); + _bias = bias; + _shift_by = shift_by; + } + + // Allocate and initialize this array to cover the heap addresses in the range + // of [bottom, end). + void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { + assert(mapping_granularity_in_bytes > 0, "just checking"); + assert(is_power_of_2(mapping_granularity_in_bytes), + err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); + assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, + err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, + mapping_granularity_in_bytes, bottom)); + assert((uintptr_t)end % mapping_granularity_in_bytes == 0, + err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, + mapping_granularity_in_bytes, end)); + size_t num_target_elems = (end - bottom) / (mapping_granularity_in_bytes / HeapWordSize); + idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; + address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); + initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes)); + } + + size_t bias() const { return _bias; } + uint shift_by() const { return _shift_by; } + + void verify_index(idx_t index) const PRODUCT_RETURN; + void verify_biased_index(idx_t biased_index) const PRODUCT_RETURN; + void verify_biased_index_inclusive_end(idx_t biased_index) const PRODUCT_RETURN; + +public: + // Return the length of the array in elements. + size_t length() const { return _length; } +}; + +// Array that provides biased access and mapping from (valid) addresses in the +// heap into this array. +template +class G1BiasedMappedArray : public G1BiasedMappedArrayBase { +public: + typedef G1BiasedMappedArrayBase::idx_t idx_t; + + T* base() const { return (T*)G1BiasedMappedArrayBase::_base; } + // Return the element of the given array at the given index. Assume + // the index is valid. This is a convenience method that does sanity + // checking on the index. + T get_by_index(idx_t index) const { + verify_index(index); + return this->base()[index]; + } + + // Set the element of the given array at the given index to the + // given value. Assume the index is valid. This is a convenience + // method that does sanity checking on the index. + void set_by_index(idx_t index, T value) { + verify_index(index); + this->base()[index] = value; + } + + // The raw biased base pointer. + T* biased_base() const { return (T*)G1BiasedMappedArrayBase::_biased_base; } + + // Return the element of the given array that covers the given word in the + // heap. Assumes the index is valid. + T get_by_address(HeapWord* value) const { + idx_t biased_index = ((uintptr_t)value) >> this->shift_by(); + this->verify_biased_index(biased_index); + return biased_base()[biased_index]; + } + + // Set the value of the array entry that corresponds to the given array. + void set_by_address(HeapWord * address, T value) { + idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); + this->verify_biased_index(biased_index); + biased_base()[biased_index] = value; + } + +protected: + // Returns the address of the element the given address maps to + T* address_mapped_to(HeapWord* address) { + idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); + this->verify_biased_index_inclusive_end(biased_index); + return biased_base() + biased_index; + } + +public: + // Return the smallest address (inclusive) in the heap that this array covers. + HeapWord* bottom_address_mapped() const { + return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by()); + } + + // Return the highest address (exclusive) in the heap that this array covers. + HeapWord* end_address_mapped() const { + return (HeapWord*) ((uintptr_t)(this->bias() + this->length()) << this->shift_by()); + } + +protected: + virtual T default_value() const = 0; + // Set all elements of the given array to the given value. + void clear() { + T value = default_value(); + for (idx_t i = 0; i < length(); i++) { + set_by_index(i, value); + } + } +public: + G1BiasedMappedArray() {} + + // Allocate and initialize this array to cover the heap addresses in the range + // of [bottom, end). + void initialize(HeapWord* bottom, HeapWord* end, size_t mapping_granularity) { + G1BiasedMappedArrayBase::initialize(bottom, end, sizeof(T), mapping_granularity); + this->clear(); + } +}; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 1d8ff8a26dc..0ecfd3ab3bb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2069,8 +2069,10 @@ jint G1CollectedHeap::initialize() { _g1_storage.initialize(g1_rs, 0); _g1_committed = MemRegion((HeapWord*)_g1_storage.low(), (size_t) 0); _hrs.initialize((HeapWord*) _g1_reserved.start(), - (HeapWord*) _g1_reserved.end(), - _expansion_regions); + (HeapWord*) _g1_reserved.end()); + assert(_hrs.max_length() == _expansion_regions, + err_msg("max length: %u expansion regions: %u", + _hrs.max_length(), _expansion_regions)); // Do later initialization work for concurrent refinement. _cg1r->init(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index dade3dfdfcf..eaa8e10f38d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -71,27 +71,16 @@ uint HeapRegionSeq::find_contiguous_from(uint from, uint num) { // Public -void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end, - uint max_length) { +void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end) { assert((uintptr_t) bottom % HeapRegion::GrainBytes == 0, "bottom should be heap region aligned"); assert((uintptr_t) end % HeapRegion::GrainBytes == 0, "end should be heap region aligned"); - _length = 0; - _heap_bottom = bottom; - _heap_end = end; - _region_shift = HeapRegion::LogOfHRGrainBytes; _next_search_index = 0; _allocated_length = 0; - _max_length = max_length; - _regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length, mtGC); - memset(_regions, 0, (size_t) max_length * sizeof(HeapRegion*)); - _regions_biased = _regions - ((uintx) bottom >> _region_shift); - - assert(&_regions[0] == &_regions_biased[addr_to_index_biased(bottom)], - "bottom should be included in the region with index 0"); + _regions.initialize(bottom, end, HeapRegion::GrainBytes); } MemRegion HeapRegionSeq::expand_by(HeapWord* old_end, @@ -101,15 +90,15 @@ MemRegion HeapRegionSeq::expand_by(HeapWord* old_end, G1CollectedHeap* g1h = G1CollectedHeap::heap(); HeapWord* next_bottom = old_end; - assert(_heap_bottom <= next_bottom, "invariant"); + assert(heap_bottom() <= next_bottom, "invariant"); while (next_bottom < new_end) { - assert(next_bottom < _heap_end, "invariant"); + assert(next_bottom < heap_end(), "invariant"); uint index = length(); - assert(index < _max_length, "otherwise we cannot expand further"); + assert(index < max_length(), "otherwise we cannot expand further"); if (index == 0) { // We have not allocated any regions so far - assert(next_bottom == _heap_bottom, "invariant"); + assert(next_bottom == heap_bottom(), "invariant"); } else { // next_bottom should match the end of the last/previous region assert(next_bottom == at(index - 1)->end(), "invariant"); @@ -122,8 +111,8 @@ MemRegion HeapRegionSeq::expand_by(HeapWord* old_end, // allocation failed, we bail out and return what we have done so far return MemRegion(old_end, next_bottom); } - assert(_regions[index] == NULL, "invariant"); - _regions[index] = new_hr; + assert(_regions.get_by_index(index) == NULL, "invariant"); + _regions.set_by_index(index, new_hr); increment_allocated_length(); } // Have to increment the length first, otherwise we will get an @@ -228,26 +217,26 @@ uint HeapRegionSeq::shrink_by(uint num_regions_to_remove) { #ifndef PRODUCT void HeapRegionSeq::verify_optional() { - guarantee(_length <= _allocated_length, + guarantee(length() <= _allocated_length, err_msg("invariant: _length: %u _allocated_length: %u", - _length, _allocated_length)); - guarantee(_allocated_length <= _max_length, + length(), _allocated_length)); + guarantee(_allocated_length <= max_length(), err_msg("invariant: _allocated_length: %u _max_length: %u", - _allocated_length, _max_length)); - guarantee(_next_search_index <= _length, + _allocated_length, max_length())); + guarantee(_next_search_index <= length(), err_msg("invariant: _next_search_index: %u _length: %u", - _next_search_index, _length)); + _next_search_index, length())); - HeapWord* prev_end = _heap_bottom; + HeapWord* prev_end = heap_bottom(); for (uint i = 0; i < _allocated_length; i += 1) { - HeapRegion* hr = _regions[i]; + HeapRegion* hr = _regions.get_by_index(i); guarantee(hr != NULL, err_msg("invariant: i: %u", i)); guarantee(hr->bottom() == prev_end, err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT, i, HR_FORMAT_PARAMS(hr), prev_end)); guarantee(hr->hrs_index() == i, err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index())); - if (i < _length) { + if (i < length()) { // Asserts will fire if i is >= _length HeapWord* addr = hr->bottom(); guarantee(addr_to_region(addr) == hr, "sanity"); @@ -265,8 +254,8 @@ void HeapRegionSeq::verify_optional() { prev_end = hr->end(); } } - for (uint i = _allocated_length; i < _max_length; i += 1) { - guarantee(_regions[i] == NULL, err_msg("invariant i: %u", i)); + for (uint i = _allocated_length; i < max_length(); i += 1) { + guarantee(_regions.get_by_index(i) == NULL, err_msg("invariant i: %u", i)); } } #endif // PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp index b7a58f76a7f..b0c3eb48a0b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @@ -25,10 +25,17 @@ #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP +#include "gc_implementation/g1/g1BiasedArray.hpp" + class HeapRegion; class HeapRegionClosure; class FreeRegionList; +class G1HeapRegionTable : public G1BiasedMappedArray { + protected: + virtual HeapRegion* default_value() const { return NULL; } +}; + // This class keeps track of the region metadata (i.e., HeapRegion // instances). They are kept in the _regions array in address // order. A region's index in the array corresponds to its index in @@ -44,35 +51,21 @@ class FreeRegionList; // // We keep track of three lengths: // -// * _length (returned by length()) is the number of currently +// * _committed_length (returned by length()) is the number of currently // committed regions. // * _allocated_length (not exposed outside this class) is the // number of regions for which we have HeapRegions. -// * _max_length (returned by max_length()) is the maximum number of -// regions the heap can have. +// * max_length() returns the maximum number of regions the heap can have. // -// and maintain that: _length <= _allocated_length <= _max_length +// and maintain that: _committed_length <= _allocated_length <= max_length() class HeapRegionSeq: public CHeapObj { friend class VMStructs; - // The array that holds the HeapRegions. - HeapRegion** _regions; - - // Version of _regions biased to address 0 - HeapRegion** _regions_biased; + G1HeapRegionTable _regions; // The number of regions committed in the heap. - uint _length; - - // The address of the first reserved word in the heap. - HeapWord* _heap_bottom; - - // The address of the last reserved word in the heap - 1. - HeapWord* _heap_end; - - // The log of the region byte size. - uint _region_shift; + uint _committed_length; // A hint for which index to start searching from for humongous // allocations. @@ -81,37 +74,33 @@ class HeapRegionSeq: public CHeapObj { // The number of regions for which we have allocated HeapRegions for. uint _allocated_length; - // The maximum number of regions in the heap. - uint _max_length; - // Find a contiguous set of empty regions of length num, starting // from the given index. uint find_contiguous_from(uint from, uint num); - // Map a heap address to a biased region index. Assume that the - // address is valid. - inline uintx addr_to_index_biased(HeapWord* addr) const; - void increment_allocated_length() { - assert(_allocated_length < _max_length, "pre-condition"); + assert(_allocated_length < max_length(), "pre-condition"); _allocated_length++; } void increment_length() { - assert(_length < _max_length, "pre-condition"); - _length++; + assert(length() < max_length(), "pre-condition"); + _committed_length++; } void decrement_length() { - assert(_length > 0, "pre-condition"); - _length--; + assert(length() > 0, "pre-condition"); + _committed_length--; } + HeapWord* heap_bottom() const { return _regions.bottom_address_mapped(); } + HeapWord* heap_end() const {return _regions.end_address_mapped(); } + public: // Empty contructor, we'll initialize it with the initialize() method. - HeapRegionSeq() { } + HeapRegionSeq() : _regions(), _committed_length(0), _next_search_index(0), _allocated_length(0) { } - void initialize(HeapWord* bottom, HeapWord* end, uint max_length); + void initialize(HeapWord* bottom, HeapWord* end); // Return the HeapRegion at the given index. Assume that the index // is valid. @@ -126,10 +115,10 @@ class HeapRegionSeq: public CHeapObj { inline HeapRegion* addr_to_region_unsafe(HeapWord* addr) const; // Return the number of regions that have been committed in the heap. - uint length() const { return _length; } + uint length() const { return _committed_length; } // Return the maximum number of regions in the heap. - uint max_length() const { return _max_length; } + uint max_length() const { return (uint)_regions.length(); } // Expand the sequence to reflect that the heap has grown from // old_end to new_end. Either create new HeapRegions, or re-use diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp index e840287edc7..96588dea042 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp @@ -28,28 +28,16 @@ #include "gc_implementation/g1/heapRegion.hpp" #include "gc_implementation/g1/heapRegionSeq.hpp" -inline uintx HeapRegionSeq::addr_to_index_biased(HeapWord* addr) const { - assert(_heap_bottom <= addr && addr < _heap_end, - err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT, - addr, _heap_bottom, _heap_end)); - uintx index = (uintx) addr >> _region_shift; - return index; -} - inline HeapRegion* HeapRegionSeq::addr_to_region_unsafe(HeapWord* addr) const { - assert(_heap_bottom <= addr && addr < _heap_end, - err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT, - addr, _heap_bottom, _heap_end)); - uintx index_biased = addr_to_index_biased(addr); - HeapRegion* hr = _regions_biased[index_biased]; + HeapRegion* hr = _regions.get_by_address(addr); assert(hr != NULL, "invariant"); return hr; } inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const { - if (addr != NULL && addr < _heap_end) { - assert(addr >= _heap_bottom, - err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, _heap_bottom)); + if (addr != NULL && addr < heap_end()) { + assert(addr >= heap_bottom(), + err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom())); return addr_to_region_unsafe(addr); } return NULL; @@ -57,7 +45,7 @@ inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const { inline HeapRegion* HeapRegionSeq::at(uint index) const { assert(index < length(), "pre-condition"); - HeapRegion* hr = _regions[index]; + HeapRegion* hr = _regions.get_by_index(index); assert(hr != NULL, "sanity"); assert(hr->hrs_index() == index, "sanity"); return hr; diff --git a/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp index 736c2d75096..9268eb78ef4 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp @@ -34,8 +34,14 @@ static_field(HeapRegion, GrainBytes, size_t) \ static_field(HeapRegion, LogOfHRGrainBytes, int) \ \ - nonstatic_field(HeapRegionSeq, _regions, HeapRegion**) \ - nonstatic_field(HeapRegionSeq, _length, uint) \ + nonstatic_field(G1HeapRegionTable, _base, address) \ + nonstatic_field(G1HeapRegionTable, _length, size_t) \ + nonstatic_field(G1HeapRegionTable, _biased_base, address) \ + nonstatic_field(G1HeapRegionTable, _bias, size_t) \ + nonstatic_field(G1HeapRegionTable, _shift_by, uint) \ + \ + nonstatic_field(HeapRegionSeq, _regions, G1HeapRegionTable) \ + nonstatic_field(HeapRegionSeq, _committed_length, uint) \ \ nonstatic_field(G1CollectedHeap, _hrs, HeapRegionSeq) \ nonstatic_field(G1CollectedHeap, _g1_committed, MemRegion) \ @@ -58,6 +64,8 @@ #define VM_TYPES_G1(declare_type, declare_toplevel_type) \ \ + declare_toplevel_type(G1HeapRegionTable) \ + \ declare_type(G1CollectedHeap, SharedHeap) \ \ declare_type(HeapRegion, ContiguousSpace) \ diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index c7886920b3e..8b3c19c5c2d 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -5047,6 +5047,9 @@ void TestReservedSpace_test(); void TestReserveMemorySpecial_test(); void TestVirtualSpace_test(); void MetaspaceAux_test(); +#if INCLUDE_ALL_GCS +void TestG1BiasedArray_test(); +#endif void execute_internal_vm_tests() { if (ExecuteInternalVMTests) { @@ -5066,6 +5069,7 @@ void execute_internal_vm_tests() { run_unit_test(VMStructs::test()); #endif #if INCLUDE_ALL_GCS + run_unit_test(TestG1BiasedArray_test()); run_unit_test(HeapRegionRemSet::test_prt()); #endif tty->print_cr("All internal VM tests passed"); From d5157be0e8445c4b4acfc787f82144a4ab7cd921 Mon Sep 17 00:00:00 2001 From: David Simms Date: Wed, 25 Sep 2013 13:58:13 +0200 Subject: [PATCH 228/983] 8023956: Provide a work-around to broken Linux 32 bit "Exec Shield" using CS for NX emulation (crashing with SI_KERNEL) Execute some code at a high virtual address value, and keep mapped Reviewed-by: coleenp, zgu --- hotspot/src/os/linux/vm/os_linux.cpp | 4 ++ .../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 43 +++++++++++++++++++ .../src/os_cpu/linux_x86/vm/os_linux_x86.hpp | 13 ++++++ 3 files changed, 60 insertions(+) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 6c794793cfe..95e04681f48 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -4839,6 +4839,10 @@ jint os::init_2(void) Linux::capture_initial_stack(JavaThread::stack_size_at_create()); +#if defined(IA32) + workaround_expand_exec_shield_cs_limit(); +#endif + Linux::libpthread_init(); if (PrintMiscellaneous && (Verbose || WizardMode)) { tty->print_cr("[HotSpot is running with %s, %s(%s)]\n", diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 8878c0ea353..9a7605e696b 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -876,3 +876,46 @@ void os::verify_stack_alignment() { #endif } #endif + + +/* + * IA32 only: execute code at a high address in case buggy NX emulation is present. I.e. avoid CS limit + * updates (JDK-8023956). + */ +void os::workaround_expand_exec_shield_cs_limit() { +#if defined(IA32) + size_t page_size = os::vm_page_size(); + /* + * Take the highest VA the OS will give us and exec + * + * Although using -(pagesz) as mmap hint works on newer kernel as you would + * think, older variants affected by this work-around don't (search forward only). + * + * On the affected distributions, we understand the memory layout to be: + * + * TASK_LIMIT= 3G, main stack base close to TASK_LIMT. + * + * A few pages south main stack will do it. + * + * If we are embedded in an app other than launcher (initial != main stack), + * we don't have much control or understanding of the address space, just let it slide. + */ + char* hint = (char*) (Linux::initial_thread_stack_bottom() - + ((StackYellowPages + StackRedPages + 1) * page_size)); + char* codebuf = os::reserve_memory(page_size, hint); + if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) { + return; // No matter, we tried, best effort. + } + if (PrintMiscellaneous && (Verbose || WizardMode)) { + tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf); + } + + // Some code to exec: the 'ret' instruction + codebuf[0] = 0xC3; + + // Call the code in the codebuf + __asm__ volatile("call *%0" : : "r"(codebuf)); + + // keep the page mapped so CS limit isn't reduced. +#endif +} diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp index 1d3fd350c68..fbca6909bb5 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp @@ -36,4 +36,17 @@ // Note: Currently only used in 64 bit Windows implementations static bool register_code_area(char *low, char *high) { return true; } + /* + * Work-around for broken NX emulation using CS limit, Red Hat patch "Exec-Shield" + * (IA32 only). + * + * Map and execute at a high VA to prevent CS lazy updates race with SMP MM + * invalidation.Further code generation by the JVM will no longer cause CS limit + * updates. + * + * Affects IA32: RHEL 5 & 6, Ubuntu 10.04 (LTS), 10.10, 11.04, 11.10, 12.04. + * @see JDK-8023956 + */ + static void workaround_expand_exec_shield_cs_limit(); + #endif // OS_CPU_LINUX_X86_VM_OS_LINUX_X86_HPP From c0720f17f6a0edf5b88a53af14b4221f11d0b5a8 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Wed, 25 Sep 2013 16:17:42 +0400 Subject: [PATCH 229/983] 8007155: [macosx] Disabled panel takes mouse input in JLayeredPane Reviewed-by: serb, anthony --- .../classes/sun/lwawt/LWCursorManager.java | 5 +- jdk/src/share/classes/java/awt/Container.java | 7 +- .../share/classes/sun/awt/AWTAccessor.java | 8 + .../classes/sun/awt/GlobalCursorManager.java | 10 +- .../sun/awt/X11/XGlobalCursorManager.java | 9 +- .../sun/awt/windows/WGlobalCursorManager.java | 3 +- .../native/sun/windows/awt_Container.cpp | 7 +- .../native/sun/windows/awt_Container.h | 3 +- .../windows/native/sun/windows/awt_Cursor.cpp | 28 +-- .../CursorOverlappedPanelsTest.html | 32 +++ .../CursorOverlappedPanelsTest.java | 226 ++++++++++++++++++ 11 files changed, 286 insertions(+), 52 deletions(-) create mode 100644 jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.html create mode 100644 jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.java diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java index ee9d0dd572e..e17cced7021 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java @@ -106,8 +106,9 @@ public abstract class LWCursorManager { c = peer.getTarget(); if (c instanceof Container) { final Point p = peer.getLocationOnScreen(); - c = ((Container) c).findComponentAt(cursorPos.x - p.x, - cursorPos.y - p.y); + c = AWTAccessor.getContainerAccessor().findComponentAt( + (Container) c, cursorPos.x - p.x, cursorPos.y - p.y, false); + } while (c != null) { final Object p = AWTAccessor.getComponentAccessor().getPeer(c); diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 9029417b2ce..14bd55dae5c 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -258,6 +258,12 @@ public class Container extends Component { public void validateUnconditionally(Container cont) { cont.validateUnconditionally(); } + + @Override + public Component findComponentAt(Container cont, int x, int y, + boolean ignoreEnabled) { + return cont.findComponentAt(x, y, ignoreEnabled); + } }); } @@ -2651,7 +2657,6 @@ public class Container extends Component { * behavior. Setting 'ignoreEnabled' to 'false' bypasses disabled * Components during the search. This behavior is used by the * lightweight cursor support in sun.awt.GlobalCursorManager. - * The cursor code calls this function directly via native code. * * The addition of this feature is temporary, pending the * adoption of new, public API which exports this feature. diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index d604768f5df..8cd84ab3d21 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -252,6 +252,14 @@ public final class AWTAccessor { * Validates the container unconditionally. */ void validateUnconditionally(Container cont); + + /** + * + * Access to the private version of findComponentAt method which has + * a controllable behavior. Setting 'ignoreEnabled' to 'false' + * bypasses disabled Components during the search. + */ + Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled); } /* diff --git a/jdk/src/share/classes/sun/awt/GlobalCursorManager.java b/jdk/src/share/classes/sun/awt/GlobalCursorManager.java index a769fd0c543..5d796f08378 100644 --- a/jdk/src/share/classes/sun/awt/GlobalCursorManager.java +++ b/jdk/src/share/classes/sun/awt/GlobalCursorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, 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 @@ -134,7 +134,6 @@ public abstract class GlobalCursorManager { */ protected abstract void getCursorPos(Point p); - protected abstract Component findComponentAt(Container con, int x, int y); protected abstract Point getLocationOnScreen(Component com); /** @@ -190,9 +189,10 @@ public abstract class GlobalCursorManager { if (p != null) { queryPos = new Point(); getCursorPos(queryPos); - Component c = findComponentAt((Container)comp, - queryPos.x - p.x, - queryPos.y - p.y); + Component c = AWTAccessor.getContainerAccessor(). + findComponentAt((Container) comp, + queryPos.x - p.x, queryPos.y - p.y, false); + // If findComponentAt returns null, then something bad has // happened. For example, the heavyweight Component may // have been hidden or disabled by another thread. In that diff --git a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java index 3034fbc9f63..c309d310e0a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -145,13 +145,8 @@ public final class XGlobalCursorManager extends GlobalCursorManager { } /* - * two native methods to call corresponding methods in Container and - * Component + * native method to call corresponding methods in Component */ - protected Component findComponentAt(Container con, int x, int y) { - return con.findComponentAt(x,y); - } - protected Point getLocationOnScreen(Component c) { return c.getLocationOnScreen(); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java b/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java index c45c05c24d1..b579f15c367 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java +++ b/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,6 @@ public final class WGlobalCursorManager extends GlobalCursorManager { protected native void setCursor(Component comp, Cursor cursor, boolean u); protected native void getCursorPos(Point p); - protected native Component findComponentAt(Container con, int x, int y); /* * two native methods to call corresponding methods in Container and * Component diff --git a/jdk/src/windows/native/sun/windows/awt_Container.cpp b/jdk/src/windows/native/sun/windows/awt_Container.cpp index 5e9788dabd2..c0704fe16a6 100644 --- a/jdk/src/windows/native/sun/windows/awt_Container.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Container.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ */ jfieldID AwtContainer::layoutMgrID; -jmethodID AwtContainer::findComponentAtMID; /************************************************************************ * AwtContainer native methods @@ -46,11 +45,7 @@ Java_java_awt_Container_initIDs(JNIEnv *env, jclass cls) { AwtContainer::layoutMgrID = env->GetFieldID(cls, "layoutMgr", "Ljava/awt/LayoutManager;"); - AwtContainer::findComponentAtMID = - env->GetMethodID(cls, "findComponentAt", "(IIZ)Ljava/awt/Component;"); - DASSERT(AwtContainer::layoutMgrID != NULL); - DASSERT(AwtContainer::findComponentAtMID); CATCH_BAD_ALLOC; } diff --git a/jdk/src/windows/native/sun/windows/awt_Container.h b/jdk/src/windows/native/sun/windows/awt_Container.h index a6753905619..43fe346b3dd 100644 --- a/jdk/src/windows/native/sun/windows/awt_Container.h +++ b/jdk/src/windows/native/sun/windows/awt_Container.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,6 @@ public: /* java.awt.Container field ids */ static jfieldID layoutMgrID; - static jmethodID findComponentAtMID; }; diff --git a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp index 7901601167f..58bceb8544a 100644 --- a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, 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 @@ -552,32 +552,6 @@ Java_sun_awt_windows_WGlobalCursorManager_findHeavyweightUnderCursor( CATCH_BAD_ALLOC_RET(NULL); } -/* - * Class: sun_awt_windows_WGlobalCursorManager - * Method: findComponentAt - * Signature: (L/java/awt/Container;II)L/java/awt/Component - */ -JNIEXPORT jobject JNICALL -Java_sun_awt_windows_WGlobalCursorManager_findComponentAt( - JNIEnv *env, jobject, jobject container, jint x, jint y) -{ - TRY; - - /* - * Call private version of Container.findComponentAt with the following - * flag set -- ignoreEnabled = false (i.e., don't return or recur into - * disabled Components); - * NOTE: it may return a JRootPane's glass pane as the target Component - */ - JNI_CHECK_NULL_RETURN_NULL(container, "null container"); - jobject comp = - env->CallObjectMethod(container, AwtContainer::findComponentAtMID, - x, y, JNI_FALSE); - return comp; - - CATCH_BAD_ALLOC_RET(NULL); -} - /* * Class: sun_awt_windows_WGlobalCursorManager * Method: getLocationOnScreen diff --git a/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.html b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.html new file mode 100644 index 00000000000..d7e6157e927 --- /dev/null +++ b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.html @@ -0,0 +1,32 @@ + + + + + CursorOverlappedPanelsTest, bug ID 8007155 + + + +

    See the dialog box (usually in upper left corner) for instructions

    + + diff --git a/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.java b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.java new file mode 100644 index 00000000000..40f1ae6c499 --- /dev/null +++ b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.java @@ -0,0 +1,226 @@ +/* + * 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.awt.*; +//import java.applet.Applet; +import javax.swing.BorderFactory; +import javax.swing.JApplet; +import javax.swing.JFrame; +import javax.swing.JLayeredPane; +import javax.swing.JPanel; + +/** + * @test + * @bug 8007155 + * @summary [macosx] Disabled panel takes mouse input in JLayeredPane + * @author Alexander Scherbatiy: area=java.awt.Cursor + * @run applet/manual=yesno CursorOverlappedPanelsTest.html + */ +public class CursorOverlappedPanelsTest extends JApplet { + //Declare things used in the test, like buttons and labels here + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + this.setLayout(new BorderLayout()); + + String[] instructions = { + "Verify that the Crosshair cursor from enabled panel" + + " is displayed on the panels intersection", + "1) Move the mosue cursor on the Enabled and Disabled panels" + + " intersection", + "2) Check that the Crosshair cursor is displayed ", + "If so, press PASS, else press FAIL." + }; + Sysout.createDialogWithInstructions(instructions); + + }//End init() + + public void start() { + //Get things going. Request focus, set size, et cetera + setSize(200, 200); + setVisible(true); + validate(); + try { + EventQueue.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + } catch (Exception e) { + throw new RuntimeException(e); + } + }// start() + + //The rest of this class is the actions which perform the test... + //Use Sysout.println to communicate with the user NOT System.out!! + //Sysout.println ("Something Happened!"); + private static JPanel createPanel(Point location, boolean enabled) { + final JPanel panel = new JPanel(); + panel.setOpaque(false); + panel.setEnabled(enabled); + panel.setSize(new Dimension(200, 200)); + panel.setLocation(location); + panel.setBorder(BorderFactory.createTitledBorder( + enabled ? "Enabled" : "Disabled")); + panel.setCursor(Cursor.getPredefinedCursor( + enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); + System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); + return panel; + } + + private static void createAndShowGUI() { + final JFrame frame = new JFrame("Test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JLayeredPane layeredPane = new JLayeredPane(); + layeredPane.setPreferredSize(new Dimension(400, 400)); + JPanel enabledPanel = createPanel(new Point(10, 10), true); + JPanel disabledPanel = createPanel(new Point(100, 100), false); + layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER); + layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER); + + frame.getContentPane().add(layeredPane); + frame.pack(); + frame.setVisible(true); + } +}// class BlockedWindowTest + +/* Place other classes related to the test after this line */ +/** + * ************************************************** + * Standard Test Machinery DO NOT modify anything below -- it's a standard chunk + * of code whose purpose is to make user interaction uniform, and thereby make + * it simpler to read and understand someone else's test. + * ************************************************** + */ +/** + * This is part of the standard test machinery. It creates a dialog (with the + * instructions), and is the interface for sending text messages to the user. To + * print the instructions, send an array of strings to Sysout.createDialog + * WithInstructions method. Put one line of instructions per array entry. To + * display a message for the tester to see, simply call Sysout.println with the + * string to be displayed. This mimics System.out.println but works within the + * test harness as well as standalone. + */ +class Sysout { + + private static TestDialog dialog; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + public static void println(String messageIn) { + dialog.displayMessage(messageIn); + } +}// Sysout class + +/** + * This is part of the standard test machinery. It provides a place for the test + * instructions to be displayed, and a place for interactive messages to the + * user to be displayed. To have the test instructions displayed, see Sysout. To + * have a message to the user be displayed, see Sysout. Do not call anything in + * this dialog directly. + */ +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) { + posOfSpace = maxStringLength - 1; + } + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + System.out.println(messageIn); + } +}// TestDialog class From fe092e9cf3617883e8a9721aa31ba866272f65f6 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 25 Sep 2013 16:12:07 +0400 Subject: [PATCH 230/983] 8024987: Copy/paste regression since JDK8 b86 Reviewed-by: serb, anthony --- .../awt/datatransfer/SystemFlavorMap.java | 154 ++++++++++-------- 1 file changed, 83 insertions(+), 71 deletions(-) diff --git a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java index fe69767dd33..ef154acdc2e 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java +++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java @@ -70,7 +70,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { /** * System singleton which maps a thread's ClassLoader to a SystemFlavorMap. */ - private static final WeakHashMap flavorMaps = new WeakHashMap(); + private static final WeakHashMap flavorMaps = new WeakHashMap<>(); /** * Copied from java.util.Properties. @@ -139,7 +139,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * native Strings. * Do not use the field directly, use getFlavorToNative() instead. */ - private final Map flavorToNative = new HashMap(); + private final Map> flavorToNative = new HashMap<>(); /** * Accessor to flavorToNative map. Since we use lazy initialization we must @@ -148,7 +148,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * * @return flavorToNative */ - private synchronized Map getFlavorToNative() { + private synchronized Map> getFlavorToNative() { if (!isMapInitialized) { initSystemFlavorMap(); } @@ -164,13 +164,13 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * Caches the result of getNativesForFlavor(). Maps DataFlavors to * SoftReferences which reference Lists of String natives. */ - private Map getNativesForFlavorCache = new HashMap(); + private Map>> getNativesForFlavorCache = new HashMap<>(); /** * Caches the result getFlavorsForNative(). Maps String natives to * SoftReferences which reference Lists of DataFlavors. */ - private Map getFlavorsForNativeCache = new HashMap(); + private Map>> getFlavorsForNativeCache = new HashMap<>(); /** * Dynamic mapping generation used for text mappings should not be applied @@ -193,7 +193,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { FlavorMap fm; synchronized(flavorMaps) { - fm = (FlavorMap)flavorMaps.get(contextClassLoader); + fm = flavorMaps.get(contextClassLoader); if (fm == null) { fm = new SystemFlavorMap(); flavorMaps.put(contextClassLoader, fm); @@ -520,10 +520,10 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * the appropriate Map location, but rather will be appended to a List * stored in that location. */ - private void store(Object hashed, Object listed, Map map) { - List list = (List)map.get(hashed); + private void store(H hashed, L listed, Map> map) { + List list = map.get(hashed); if (list == null) { - list = new ArrayList(1); + list = new ArrayList<>(1); map.put(hashed, list); } if (!list.contains(listed)) { @@ -537,17 +537,17 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * case, a new DataFlavor is synthesized, stored, and returned, if and * only if the specified native is encoded as a Java MIME type. */ - private List nativeToFlavorLookup(String nat) { + private List nativeToFlavorLookup(String nat) { List flavors = getNativeToFlavor().get(nat); if (nat != null && !disabledMappingGenerationKeys.contains(nat)) { DataTransferer transferer = DataTransferer.getInstance(); if (transferer != null) { - List platformFlavors = + List platformFlavors = transferer.getPlatformMappingsForNative(nat); if (!platformFlavors.isEmpty()) { if (flavors != null) { - platformFlavors.removeAll(new HashSet(flavors)); + platformFlavors.removeAll(new HashSet<>(flavors)); // Prepending the platform-specific mappings ensures // that the flavors added with // addFlavorForUnencodedNative() are at the end of @@ -573,15 +573,15 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } if (flavor != null) { - flavors = new ArrayList(1); + flavors = new ArrayList<>(1); getNativeToFlavor().put(nat, flavors); flavors.add(flavor); getFlavorsForNativeCache.remove(nat); getFlavorsForNativeCache.remove(null); - List natives = (List)getFlavorToNative().get(flavor); + List natives = getFlavorToNative().get(flavor); if (natives == null) { - natives = new ArrayList(1); + natives = new ArrayList<>(1); getFlavorToNative().put(flavor, natives); } natives.add(nat); @@ -590,7 +590,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } } - return (flavors != null) ? flavors : new ArrayList(0); + return (flavors != null) ? flavors : new ArrayList<>(0); } /** @@ -601,18 +601,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * encoding the DataFlavor's MIME type. Otherwise an empty List is returned * and 'flavorToNative' remains unaffected. */ - private List flavorToNativeLookup(final DataFlavor flav, - final boolean synthesize) { - List natives = (List)getFlavorToNative().get(flav); + private List flavorToNativeLookup(final DataFlavor flav, + final boolean synthesize) { + List natives = getFlavorToNative().get(flav); if (flav != null && !disabledMappingGenerationKeys.contains(flav)) { DataTransferer transferer = DataTransferer.getInstance(); if (transferer != null) { - List platformNatives = + List platformNatives = transferer.getPlatformMappingsForFlavor(flav); if (!platformNatives.isEmpty()) { if (natives != null) { - platformNatives.removeAll(new HashSet(natives)); + platformNatives.removeAll(new HashSet<>(natives)); // Prepend the platform-specific mappings to ensure // that the natives added with // addUnencodedNativeForFlavor() are at the end of @@ -627,7 +627,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { if (natives == null) { if (synthesize) { String encoded = encodeDataFlavor(flav); - natives = new ArrayList(1); + natives = new ArrayList<>(1); getFlavorToNative().put(flav, natives); natives.add(encoded); getNativesForFlavorCache.remove(flav); @@ -635,14 +635,14 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { List flavors = getNativeToFlavor().get(encoded); if (flavors == null) { - flavors = new ArrayList(1); + flavors = new ArrayList<>(1); getNativeToFlavor().put(encoded, flavors); } flavors.add(flav); getFlavorsForNativeCache.remove(encoded); getFlavorsForNativeCache.remove(null); } else { - natives = new ArrayList(0); + natives = new ArrayList<>(0); } } @@ -675,21 +675,21 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * @since 1.4 */ public synchronized List getNativesForFlavor(DataFlavor flav) { - List retval = null; + List retval = null; // Check cache, even for null flav - SoftReference ref = (SoftReference)getNativesForFlavorCache.get(flav); + SoftReference> ref = getNativesForFlavorCache.get(flav); if (ref != null) { - retval = (List)ref.get(); + retval = ref.get(); if (retval != null) { // Create a copy, because client code can modify the returned // list. - return new ArrayList(retval); + return new ArrayList<>(retval); } } if (flav == null) { - retval = new ArrayList(getNativeToFlavor().keySet()); + retval = new ArrayList<>(getNativeToFlavor().keySet()); } else if (disabledMappingGenerationKeys.contains(flav)) { // In this case we shouldn't synthesize a native for this flavor, // since its mappings were explicitly specified. @@ -699,7 +699,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { // For text/* flavors, flavor-to-native mappings specified in // flavormap.properties are stored per flavor's base type. if ("text".equals(flav.getPrimaryType())) { - retval = (List)getFlavorToNative().get(flav.mimeType.getBaseType()); + retval = getAllNativesForType(flav.mimeType.getBaseType()); if (retval != null) { // To prevent the List stored in the map from modification. retval = new ArrayList(retval); @@ -707,15 +707,15 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } // Also include text/plain natives, but don't duplicate Strings - List textPlainList = (List)getFlavorToNative().get(TEXT_PLAIN_BASE_TYPE); + List textPlainList = getAllNativesForType(TEXT_PLAIN_BASE_TYPE); if (textPlainList != null && !textPlainList.isEmpty()) { // To prevent the List stored in the map from modification. // This also guarantees that removeAll() is supported. - textPlainList = new ArrayList(textPlainList); + textPlainList = new ArrayList<>(textPlainList); if (retval != null && !retval.isEmpty()) { // Use HashSet to get constant-time performance for search. - textPlainList.removeAll(new HashSet(retval)); + textPlainList.removeAll(new HashSet<>(retval)); retval.addAll(textPlainList); } else { retval = textPlainList; @@ -728,7 +728,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { // In this branch it is guaranteed that natives explicitly // listed for flav's MIME type were added with // addUnencodedNativeForFlavor(), so they have lower priority. - List explicitList = + List explicitList = flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND); // flavorToNativeLookup() never returns null. @@ -736,14 +736,14 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { if (!explicitList.isEmpty()) { // To prevent the List stored in the map from modification. // This also guarantees that removeAll() is supported. - explicitList = new ArrayList(explicitList); + explicitList = new ArrayList<>(explicitList); // Use HashSet to get constant-time performance for search. - explicitList.removeAll(new HashSet(retval)); + explicitList.removeAll(new HashSet<>(retval)); retval.addAll(explicitList); } } } else if (DataTransferer.isFlavorNoncharsetTextType(flav)) { - retval = (List)getFlavorToNative().get(flav.mimeType.getBaseType()); + retval = getAllNativesForType(flav.mimeType.getBaseType()); if (retval == null || retval.isEmpty()) { retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND); @@ -751,7 +751,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { // In this branch it is guaranteed that natives explicitly // listed for flav's MIME type were added with // addUnencodedNativeForFlavor(), so they have lower priority. - List explicitList = + List explicitList = flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND); // flavorToNativeLookup() never returns null. @@ -759,10 +759,10 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { if (!explicitList.isEmpty()) { // To prevent the List stored in the map from modification. // This also guarantees that add/removeAll() are supported. - retval = new ArrayList(retval); - explicitList = new ArrayList(explicitList); + retval = new ArrayList<>(retval); + explicitList = new ArrayList<>(explicitList); // Use HashSet to get constant-time performance for search. - explicitList.removeAll(new HashSet(retval)); + explicitList.removeAll(new HashSet<>(retval)); retval.addAll(explicitList); } } @@ -770,9 +770,9 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND); } - getNativesForFlavorCache.put(flav, new SoftReference(retval)); + getNativesForFlavorCache.put(flav, new SoftReference<>(retval)); // Create a copy, because client code can modify the returned list. - return new ArrayList(retval); + return new ArrayList<>(retval); } /** @@ -809,11 +809,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { public synchronized List getFlavorsForNative(String nat) { // Check cache, even for null nat - SoftReference ref = (SoftReference)getFlavorsForNativeCache.get(nat); + SoftReference> ref = getFlavorsForNativeCache.get(nat); if (ref != null) { - ArrayList retval = (ArrayList)ref.get(); + List retval = ref.get(); if (retval != null) { - return (List)retval.clone(); + return new ArrayList<>(retval); } } @@ -859,16 +859,15 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } - final ArrayList arrayList = new ArrayList(returnValue); - getFlavorsForNativeCache.put(nat, new SoftReference(arrayList)); - return (List)arrayList.clone(); + final List arrayList = new ArrayList<>(returnValue); + getFlavorsForNativeCache.put(nat, new SoftReference<>(arrayList)); + return new ArrayList<>(arrayList); } - private static LinkedHashSet convertMimeTypeToDataFlavors( + private static Set convertMimeTypeToDataFlavors( final String baseType) { - final LinkedHashSet returnValue = - new LinkedHashSet(); + final Set returnValue = new LinkedHashSet<>(); String subType = null; @@ -1009,11 +1008,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { flavor_list.toArray(flavors); } - HashMap retval = new HashMap(flavors.length, 1.0f); - for (int i = 0; i < flavors.length; i++) { - List natives = getNativesForFlavor(flavors[i]); - String nat = (natives.isEmpty()) ? null : (String)natives.get(0); - retval.put(flavors[i], nat); + Map retval = new HashMap<>(flavors.length, 1.0f); + for (DataFlavor flavor : flavors) { + List natives = getNativesForFlavor(flavor); + String nat = (natives.isEmpty()) ? null : natives.get(0); + retval.put(flavor, nat); } return retval; @@ -1054,12 +1053,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { native_list.toArray(natives); } - HashMap retval = new HashMap(natives.length, 1.0f); - for (int i = 0; i < natives.length; i++) { - List flavors = getFlavorsForNative(natives[i]); - DataFlavor flav = (flavors.isEmpty()) - ? null : (DataFlavor)flavors.get(0); - retval.put(natives[i], flav); + Map retval = new HashMap<>(natives.length, 1.0f); + for (String aNative : natives) { + List flavors = getFlavorsForNative(aNative); + DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0); + retval.put(aNative, flav); } return retval; @@ -1091,9 +1089,9 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { throw new NullPointerException("null arguments not permitted"); } - List natives = (List)getFlavorToNative().get(flav); + List natives = getFlavorToNative().get(flav); if (natives == null) { - natives = new ArrayList(1); + natives = new ArrayList<>(1); getFlavorToNative().put(flav, natives); } else if (natives.contains(nat)) { return; @@ -1138,8 +1136,8 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } getFlavorToNative().remove(flav); - for (int i = 0; i < natives.length; i++) { - addUnencodedNativeForFlavor(flav, natives[i]); + for (String aNative : natives) { + addUnencodedNativeForFlavor(flav, aNative); } disabledMappingGenerationKeys.add(flav); // Clear the cache to handle the case of empty natives. @@ -1171,9 +1169,9 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { throw new NullPointerException("null arguments not permitted"); } - List flavors = (List)getNativeToFlavor().get(nat); + List flavors = getNativeToFlavor().get(nat); if (flavors == null) { - flavors = new ArrayList(1); + flavors = new ArrayList<>(1); getNativeToFlavor().put(nat, flavors); } else if (flavors.contains(flav)) { return; @@ -1217,8 +1215,8 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } getNativeToFlavor().remove(nat); - for (int i = 0; i < flavors.length; i++) { - addFlavorForUnencodedNative(nat, flavors[i]); + for (DataFlavor flavor : flavors) { + addFlavorForUnencodedNative(nat, flavor); } disabledMappingGenerationKeys.add(nat); // Clear the cache to handle the case of empty flavors. @@ -1321,4 +1319,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { ? new DataFlavor(retval_str) : null; } + + private List getAllNativesForType(String type) { + List retval = null; + for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) { + List natives = getFlavorToNative().get(dataFlavor); + if (!natives.isEmpty()) { + if (retval == null) { + retval = new ArrayList<>(); + } + retval.addAll(natives); + } + } + return retval; + } } From c3a64bea844254c53dd1545d201a79dd1f44f1e1 Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Wed, 25 Sep 2013 16:52:46 +0400 Subject: [PATCH 231/983] 8004032: [TEST_BUG] [macosx] There is no effect when double clicking on the Icon, after right clicking on the Icon and the Icon disappear Reviewed-by: anthony, serb --- .../ShowAfterDisposeTest.html | 43 +++ .../ShowAfterDisposeTest.java | 246 ++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html create mode 100644 jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.java diff --git a/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html new file mode 100644 index 00000000000..6ef452485ec --- /dev/null +++ b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html @@ -0,0 +1,43 @@ + + + + + + ShowAfterDisposeTest + + + +

    ShowAfterDisposeTest
    Bug ID: 6384984

    + +

    See the dialog box (usually in upper left corner) for instructions

    + + + + diff --git a/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.java b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.java new file mode 100644 index 00000000000..f107492f9d9 --- /dev/null +++ b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.java @@ -0,0 +1,246 @@ +/* + * 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 6384984 8004032 + @summary TrayIcon try to dispay a tooltip when is not visible + @author Dmitry.Cherepanov@sun.com area=awt.tray + @run applet/manual=yesno ShowAfterDisposeTest.html +*/ + +import java.applet.*; + +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; + +public class ShowAfterDisposeTest extends Applet +{ + boolean traySupported; + + public void init() + { + this.setLayout (new BorderLayout ()); + + String[] instructions; + traySupported = SystemTray.isSupported(); + if (traySupported) + { + String[] s = + { + "1) When the test starts an icon is added to the SystemTray area.", + "2a) If you use Apple OS X,", + " right click on this icon (it's important to click before the tooltip is shown).", + " The icon should disappear.", + "2b) If you use other os (Windows, Linux, Solaris),", + " double click on this icon (it's important to click before the tooltip is shown).", + " The icon should disappear.", + "3) If the bug is reproducible then the test will fail without assistance.", + "4) Just press the 'pass' button." + }; + instructions = s; + } + else + { + String[] s = + { + "The test cannot be run because SystemTray is not supported.", + "Simply press PASS button." + }; + instructions = s; + } + Sysout.createDialogWithInstructions(instructions); + } + + public void start () + { + setSize (200,200); + setVisible(true); + validate(); + + if (!traySupported) + { + return; + } + + BufferedImage img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); + Graphics g = img.createGraphics(); + g.setColor(Color.WHITE); + g.fillRect(0, 0, 32, 32); + g.setColor(Color.RED); + g.fillRect(6, 6, 20, 20); + g.dispose(); + + final SystemTray tray = SystemTray.getSystemTray(); + final TrayIcon icon = new TrayIcon(img); + icon.setImageAutoSize(true); + icon.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent ev) + { + tray.remove(icon); + } + } + ); + + try { + tray.add(icon); + } catch (AWTException e) { + Sysout.println(e.toString()); + Sysout.println("!!! The test coudn't be performed !!!"); + return; + } + icon.setToolTip("tooltip"); + } +} + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout +{ + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } +} + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog +{ + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + pack(); + + setVisible(true); + } + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + } + } + } + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + System.out.println(messageIn); + } +} From 9056e0008cee5ef86deafac5213d420c94c8670f Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Wed, 25 Sep 2013 17:08:31 +0400 Subject: [PATCH 232/983] 8025070: [javadoc] fix some javadoc errors in javax/swing/plaf/synth Reviewed-by: serb, alexsch --- .../javax/swing/plaf/synth/SynthButtonUI.java | 24 +++++------ .../plaf/synth/SynthCheckBoxMenuItemUI.java | 6 +-- .../swing/plaf/synth/SynthCheckBoxUI.java | 6 +-- .../swing/plaf/synth/SynthColorChooserUI.java | 18 ++++----- .../swing/plaf/synth/SynthComboBoxUI.java | 26 ++++++------ .../swing/plaf/synth/SynthDesktopIconUI.java | 16 ++++---- .../swing/plaf/synth/SynthDesktopPaneUI.java | 20 +++++----- .../swing/plaf/synth/SynthEditorPaneUI.java | 12 +++--- .../plaf/synth/SynthFormattedTextFieldUI.java | 6 +-- .../plaf/synth/SynthInternalFrameUI.java | 22 +++++----- .../javax/swing/plaf/synth/SynthLabelUI.java | 20 +++++----- .../javax/swing/plaf/synth/SynthListUI.java | 16 ++++---- .../swing/plaf/synth/SynthMenuBarUI.java | 16 ++++---- .../swing/plaf/synth/SynthMenuItemUI.java | 20 +++++----- .../swing/plaf/synth/SynthMenuLayout.java | 2 +- .../javax/swing/plaf/synth/SynthMenuUI.java | 20 +++++----- .../swing/plaf/synth/SynthOptionPaneUI.java | 22 +++++----- .../javax/swing/plaf/synth/SynthPainter.java | 10 ++--- .../javax/swing/plaf/synth/SynthPanelUI.java | 16 ++++---- .../plaf/synth/SynthPasswordFieldUI.java | 8 ++-- .../swing/plaf/synth/SynthPopupMenuUI.java | 16 ++++---- .../swing/plaf/synth/SynthProgressBarUI.java | 24 +++++------ .../synth/SynthRadioButtonMenuItemUI.java | 6 +-- .../swing/plaf/synth/SynthRadioButtonUI.java | 6 +-- .../swing/plaf/synth/SynthRootPaneUI.java | 10 ++--- .../swing/plaf/synth/SynthScrollBarUI.java | 26 ++++++------ .../swing/plaf/synth/SynthScrollPaneUI.java | 14 +++---- .../swing/plaf/synth/SynthSeparatorUI.java | 16 ++++---- .../javax/swing/plaf/synth/SynthSliderUI.java | 40 +++++++++---------- .../swing/plaf/synth/SynthSpinnerUI.java | 18 ++++----- .../swing/plaf/synth/SynthSplitPaneUI.java | 12 +++--- .../swing/plaf/synth/SynthTabbedPaneUI.java | 40 +++++++++---------- .../swing/plaf/synth/SynthTableHeaderUI.java | 18 ++++----- .../javax/swing/plaf/synth/SynthTableUI.java | 12 +++--- .../swing/plaf/synth/SynthTextAreaUI.java | 10 ++--- .../swing/plaf/synth/SynthTextFieldUI.java | 12 +++--- .../swing/plaf/synth/SynthTextPaneUI.java | 2 +- .../swing/plaf/synth/SynthToggleButtonUI.java | 6 +-- .../swing/plaf/synth/SynthToolBarUI.java | 22 +++++----- .../swing/plaf/synth/SynthToolTipUI.java | 18 ++++----- .../javax/swing/plaf/synth/SynthTreeUI.java | 38 +++++++++--------- .../swing/plaf/synth/SynthViewportUI.java | 10 ++--- 42 files changed, 341 insertions(+), 341 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java index 0f5df434c70..2c6535c7bd9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java @@ -34,7 +34,7 @@ import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JButton}. * * @author Scott Violet @@ -55,7 +55,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(AbstractButton b) { @@ -65,7 +65,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners(AbstractButton b) { @@ -109,7 +109,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners(AbstractButton b) { @@ -118,7 +118,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(AbstractButton b) { @@ -130,7 +130,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -182,7 +182,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getBaseline(JComponent c, int width, int height) { @@ -305,7 +305,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -449,7 +449,7 @@ public class SynthButtonUI extends BasicButtonUI implements // ******************************** /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMinimumSize(JComponent c) { @@ -470,7 +470,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { @@ -491,7 +491,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMaximumSize(JComponent c) { @@ -525,7 +525,7 @@ public class SynthButtonUI extends BasicButtonUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java index d3f50962433..41b2682598c 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java @@ -32,7 +32,7 @@ import javax.swing.plaf.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JCheckBoxMenuItem}. * * @author Leif Samuelsson @@ -54,7 +54,7 @@ public class SynthCheckBoxMenuItemUI extends SynthMenuItemUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected String getPropertyPrefix() { @@ -68,7 +68,7 @@ public class SynthCheckBoxMenuItemUI extends SynthMenuItemUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java index c4d41ca9d07..aabec2bb3a2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java @@ -31,7 +31,7 @@ import javax.swing.plaf.ComponentUI; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JCheckBox}. * * @author Jeff Dinkins @@ -53,7 +53,7 @@ public class SynthCheckBoxUI extends SynthRadioButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected String getPropertyPrefix() { @@ -67,7 +67,7 @@ public class SynthCheckBoxUI extends SynthRadioButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java index b85597e53be..0d0753aeb99 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java @@ -36,7 +36,7 @@ import java.beans.PropertyChangeListener; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JColorChooser}. * * @author Tom Santos @@ -58,7 +58,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected AbstractColorChooserPanel[] createDefaultChoosers() { @@ -74,7 +74,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -89,7 +89,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -102,7 +102,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -111,7 +111,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -120,7 +120,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -188,7 +188,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -197,7 +197,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java index 37f0c85c8a8..165ba8366a1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java @@ -35,7 +35,7 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JComboBox}. * * @author Scott Violet @@ -103,7 +103,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} * * Overridden to ensure that ButtonHandler is created prior to any of * the other installXXX methods, since several of them reference @@ -152,7 +152,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -163,7 +163,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -175,7 +175,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -187,7 +187,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -200,7 +200,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -251,7 +251,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected ComboPopup createPopup() { @@ -261,7 +261,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected ListCellRenderer createRenderer() { @@ -269,7 +269,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected ComboBoxEditor createEditor() { @@ -281,7 +281,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements //====================== /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -291,7 +291,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected JButton createArrowButton() { @@ -360,7 +360,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java index 89a15b95f63..38f8f9fae10 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java @@ -34,7 +34,7 @@ import java.beans.*; /** - * Provides the Synth L&F UI delegate for a minimized internal frame on a desktop. + * Provides the Synth L&F UI delegate for a minimized internal frame on a desktop. * * @author Joshua Outwater * @since 1.7 @@ -55,7 +55,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installComponents() { @@ -82,7 +82,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -96,7 +96,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -109,7 +109,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -123,7 +123,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -134,7 +134,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -202,7 +202,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java index 8548f7ff585..a677bdb5f6d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java @@ -34,7 +34,7 @@ import java.awt.event.*; import java.awt.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JDesktopPane}. * * @author Joshua Outwater @@ -58,7 +58,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -73,7 +73,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -123,7 +123,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -136,7 +136,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -164,7 +164,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDesktopManager() { @@ -180,7 +180,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDesktopManager() { @@ -422,7 +422,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -489,7 +489,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -498,7 +498,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java index dcea1406128..d9b9ae7a0f0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java @@ -33,7 +33,7 @@ import javax.swing.plaf.basic.BasicEditorPaneUI; import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JEditorPane}. * * @author Shannon Hickey @@ -58,7 +58,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -74,7 +74,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -131,7 +131,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -181,7 +181,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintBackground(Graphics g) { @@ -194,7 +194,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java index a3a2fa890a6..776d3f91b86 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java @@ -29,7 +29,7 @@ import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JFormattedTextField}. * * @since 1.7 @@ -58,7 +58,7 @@ public class SynthFormattedTextFieldUI extends SynthTextFieldUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override void paintBackground(SynthContext context, Graphics g, JComponent c) { @@ -67,7 +67,7 @@ public class SynthFormattedTextFieldUI extends SynthTextFieldUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java index 0c69e05dc01..a4dee16a32f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java @@ -34,7 +34,7 @@ import java.beans.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JInternalFrame}. * * @author David Kloba @@ -61,7 +61,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void installDefaults() { @@ -70,7 +70,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -79,7 +79,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallComponents() { @@ -90,7 +90,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -118,7 +118,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -133,7 +133,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -150,7 +150,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected JComponent createNorthPane(JInternalFrame w) { @@ -160,7 +160,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected ComponentListener createComponentListener() { @@ -244,7 +244,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -254,7 +254,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java index e0c50e166cd..d6cae8f1b27 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java @@ -37,7 +37,7 @@ import java.awt.FontMetrics; import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JLabel}. * * @author Scott Violet @@ -57,7 +57,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JLabel c) { @@ -71,7 +71,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(JLabel c){ @@ -83,7 +83,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -105,7 +105,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getBaseline(JComponent c, int width, int height) { @@ -218,7 +218,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -227,7 +227,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { @@ -248,7 +248,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMinimumSize(JComponent c) { @@ -269,7 +269,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMaximumSize(JComponent c) { @@ -290,7 +290,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java index 5166159d1cb..a949f5de22f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java @@ -34,7 +34,7 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JList}. * * @author Scott Violet @@ -80,7 +80,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -89,7 +89,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -98,7 +98,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -108,7 +108,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -117,7 +117,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -166,7 +166,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -180,7 +180,7 @@ public class SynthListUI extends BasicListUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java index fbec6a7e2ba..a87a4ad0fd2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java @@ -32,7 +32,7 @@ import javax.swing.plaf.*; import javax.swing.plaf.basic.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JMenuBar}. * * @author Scott Violet @@ -53,7 +53,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -65,7 +65,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -87,7 +87,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -99,7 +99,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -108,7 +108,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -175,7 +175,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -184,7 +184,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java index 36b6cf192cf..f34b732b58b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java @@ -34,7 +34,7 @@ import sun.swing.MenuItemLayoutHelper; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JMenuItem}. * * @author Georges Saab @@ -59,7 +59,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -73,7 +73,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -81,7 +81,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -134,7 +134,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -153,7 +153,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -162,7 +162,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -206,7 +206,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Dimension getPreferredMenuItemSize(JComponent c, @@ -290,7 +290,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -299,7 +299,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java index 5a52bc3462b..24ca48d8c4d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java @@ -31,7 +31,7 @@ import java.awt.Container; import java.awt.Dimension; /** - * @inheritDoc + * {@inheritDoc} * * @author Georges Saab */ diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java index a55aa715fe3..fb6cca06855 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java @@ -32,7 +32,7 @@ import javax.swing.plaf.basic.*; import sun.swing.MenuItemLayoutHelper; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JMenu}. * * @author Georges Saab @@ -56,7 +56,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -64,7 +64,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -120,7 +120,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -134,7 +134,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -153,7 +153,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -162,7 +162,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -207,7 +207,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Dimension getPreferredMenuItemSize(JComponent c, @@ -286,7 +286,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -295,7 +295,7 @@ public class SynthMenuUI extends BasicMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java index 696e83ae467..51786ba781e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java @@ -33,7 +33,7 @@ import javax.swing.plaf.basic.*; import sun.swing.DefaultLookup; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JOptionPane}. * * @author James Gosling @@ -56,7 +56,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -64,7 +64,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -92,7 +92,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -104,7 +104,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -113,7 +113,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installComponents() { @@ -132,7 +132,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -199,7 +199,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -208,7 +208,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -218,7 +218,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected boolean getSizeButtonsToSameWidth() { @@ -273,7 +273,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Container createSeparator() { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java index 9fcc80da258..3fa960d1d7a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java @@ -41,12 +41,12 @@ import java.awt.*; * example registers a painter for all JButtons that will * render the image myImage.png: *
    - *  <style id="buttonStyle">
    + *  <style id="buttonStyle">
      *    <imagePainter path="myImage.png" sourceInsets="2 2 2 2"
    - *                  paintCenter="true" stretch="true"/>
    - *    <insets top="2" bottom="2" left="2" right="2"/>
    - *  </style>
    - *  <bind style="buttonStyle" type="REGION" key="button"/>
    + *                  paintCenter="true" stretch="true"/>
    + *    <insets top="2" bottom="2" left="2" right="2"/>
    + *  </style>
    + *  <bind style="buttonStyle" type="REGION" key="button"/>
      *
    *

    * SynthPainter is abstract in so far as it does no painting, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java index 6e47dd2c983..ae63c36eb0e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java @@ -32,7 +32,7 @@ import java.awt.*; import java.beans.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JPanel}. * * @author Steve Wilson @@ -53,7 +53,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void installUI(JComponent c) { @@ -64,7 +64,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -93,7 +93,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JPanel p) { @@ -101,7 +101,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(JPanel p) { @@ -119,7 +119,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -187,7 +187,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -196,7 +196,7 @@ public class SynthPanelUI extends BasicPanelUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent pce) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java index 3366dd852a7..6dafaf6284a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java @@ -31,7 +31,7 @@ import javax.swing.text.*; import javax.swing.plaf.ComponentUI; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JPasswordField}. * * @author Shannon Hickey @@ -73,7 +73,7 @@ public class SynthPasswordFieldUI extends SynthTextFieldUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override void paintBackground(SynthContext context, Graphics g, JComponent c) { @@ -82,7 +82,7 @@ public class SynthPasswordFieldUI extends SynthTextFieldUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -91,7 +91,7 @@ public class SynthPasswordFieldUI extends SynthTextFieldUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installKeyboardActions() { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java index cacc4a8e4cd..8879d48abf6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java @@ -33,7 +33,7 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JPopupMenu}. * * @author Georges Saab @@ -56,7 +56,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void installDefaults() { @@ -81,7 +81,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -90,7 +90,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -106,7 +106,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -115,7 +115,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -182,7 +182,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -191,7 +191,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java index 8007ffc1b15..8b09c548e1d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java @@ -35,7 +35,7 @@ import java.beans.PropertyChangeEvent; import sun.swing.SwingUtilities2; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JProgressBar}. * * @author Joshua Outwater @@ -61,7 +61,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -70,7 +70,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -79,7 +79,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -118,7 +118,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -130,7 +130,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -147,7 +147,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getBaseline(JComponent c, int width, int height) { @@ -165,7 +165,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Rectangle getBox(Rectangle r) { @@ -177,7 +177,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void setAnimationIndex(int newValue) { @@ -386,7 +386,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -396,7 +396,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -407,7 +407,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java index 0e201d6826f..c31ba8369b6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java @@ -30,7 +30,7 @@ import java.awt.*; import javax.swing.plaf.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JRadioButtonMenuItem}. * * @author Georges Saab @@ -50,7 +50,7 @@ public class SynthRadioButtonMenuItemUI extends SynthMenuItemUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected String getPropertyPrefix() { @@ -64,7 +64,7 @@ public class SynthRadioButtonMenuItemUI extends SynthMenuItemUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java index 5adc4875da7..c380f363d4d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java @@ -30,7 +30,7 @@ import javax.swing.*; import javax.swing.plaf.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JRadioButton}. * * @author Jeff Dinkins @@ -52,7 +52,7 @@ public class SynthRadioButtonUI extends SynthToggleButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected String getPropertyPrefix() { @@ -75,7 +75,7 @@ public class SynthRadioButtonUI extends SynthToggleButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java index 67a0a88bdc2..ce383522659 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java @@ -32,7 +32,7 @@ import javax.swing.plaf.*; import javax.swing.plaf.basic.BasicRootPaneUI; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JRootPane}. * * @author Scott Violet @@ -52,7 +52,7 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JRootPane c){ @@ -60,7 +60,7 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(JRootPane root) { @@ -72,7 +72,7 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -152,7 +152,7 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java index fa631ed5cb8..8a1b6e782fa 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java @@ -33,7 +33,7 @@ import javax.swing.plaf.basic.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JScrollBar}. * * @author Scott Violet @@ -53,7 +53,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -68,7 +68,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void configureScrollBarColors() { @@ -136,7 +136,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -145,7 +145,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -154,7 +154,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(){ @@ -177,7 +177,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -212,7 +212,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean getSupportsAbsolutePositioning() { @@ -283,7 +283,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -354,7 +354,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Dimension getMinimumThumbSize() { @@ -371,7 +371,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected JButton createDecreaseButton(int orientation) { @@ -400,7 +400,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected JButton createIncreaseButton(int orientation) { @@ -431,7 +431,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void setThumbRollover(boolean active) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java index 1b85204aac2..1e202749977 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java @@ -41,7 +41,7 @@ import java.awt.event.FocusListener; import java.awt.event.FocusEvent; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JScrollPane}. * * @author Scott Violet @@ -119,7 +119,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -128,7 +128,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JScrollPane scrollpane) { @@ -154,7 +154,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners(JScrollPane c) { @@ -171,7 +171,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(JScrollPane c) { @@ -186,7 +186,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners(JComponent c) { @@ -203,7 +203,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java index e7baa23a5ea..b46e69c4f2b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java @@ -36,7 +36,7 @@ import javax.swing.plaf.UIResource; import javax.swing.plaf.DimensionUIResource; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JSeparator}. * * @author Shannon Hickey @@ -58,7 +58,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void installUI(JComponent c) { @@ -67,7 +67,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -191,7 +191,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -202,7 +202,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { @@ -224,7 +224,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMinimumSize(JComponent c) { @@ -232,7 +232,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMaximumSize(JComponent c) { @@ -240,7 +240,7 @@ public class SynthSeparatorUI extends SeparatorUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java index cc18a05eea5..c1ce14631f4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java @@ -42,7 +42,7 @@ import sun.swing.SwingUtilities2; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link JSlider}. * * @author Joshua Outwater @@ -98,7 +98,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JSlider slider) { @@ -127,7 +127,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners(JSlider slider) { @@ -136,7 +136,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners(JSlider slider) { @@ -200,7 +200,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected TrackListener createTrackListener(JSlider s) { @@ -231,7 +231,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getBaseline(JComponent c, int width, int height) { @@ -302,7 +302,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { @@ -320,7 +320,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getMinimumSize(JComponent c) { @@ -335,7 +335,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void calculateGeometry() { @@ -534,7 +534,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void calculateThumbLocation() { @@ -551,7 +551,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void setThumbLocation(int x, int y) { @@ -564,7 +564,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int xPositionForValue(int value) { @@ -593,7 +593,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int yPositionForValue(int value, int trackY, int trackHeight) { @@ -622,7 +622,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int valueForYPosition(int yPos) { @@ -651,7 +651,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int valueForXPosition(int xPos) { @@ -680,7 +680,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Dimension getThumbSize() { @@ -697,7 +697,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void recalculateIfInsetsChanged() { @@ -714,7 +714,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -851,7 +851,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -899,7 +899,7 @@ public class SynthSliderUI extends BasicSliderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java index 9b86cae4beb..2c18b0f5979 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java @@ -32,7 +32,7 @@ import javax.swing.plaf.basic.BasicSpinnerUI; import java.beans.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JSpinner}. * * @author Hans Muller @@ -65,7 +65,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -81,7 +81,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -156,7 +156,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected LayoutManager createLayout() { @@ -165,7 +165,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Component createPreviousButton() { @@ -177,7 +177,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Component createNextButton() { @@ -270,7 +270,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -334,7 +334,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -439,7 +439,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java index 0a22820b7c4..f8cec60d2f1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java @@ -36,7 +36,7 @@ import javax.swing.plaf.basic.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JSplitPane}. * * @author Scott Violet @@ -201,7 +201,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -236,7 +236,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -257,7 +257,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Component createDefaultNonContinuousLayoutDivider() { @@ -322,7 +322,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -343,7 +343,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void finishedPaintingChildren(JSplitPane jc, Graphics g) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java index 0686967412d..5abfd8d9468 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java @@ -37,7 +37,7 @@ import java.beans.PropertyChangeEvent; import sun.swing.SwingUtilities2; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JTabbedPane}. * *

    Looks up the {@code selectedTabPadInsets} property from the Style, @@ -120,7 +120,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -183,7 +183,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -192,7 +192,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -201,7 +201,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -227,7 +227,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -256,7 +256,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected JButton createScrollButton(int direction) { @@ -272,7 +272,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { @@ -282,7 +282,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} * * Overridden to keep track of whether the selected tab is also pressed. */ @@ -333,7 +333,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) { @@ -345,7 +345,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) { @@ -380,7 +380,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int getBaseline(int tab) { @@ -404,7 +404,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -556,7 +556,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void setRolloverTab(int index) { @@ -750,7 +750,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int calculateMaxTabHeight(int tabPlacement) { @@ -766,7 +766,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int calculateTabWidth(int tabPlacement, int tabIndex, @@ -797,7 +797,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int calculateMaxTabWidth(int tabPlacement) { @@ -813,7 +813,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected Insets getTabInsets(int tabPlacement, int tabIndex) { @@ -823,7 +823,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected FontMetrics getFontMetrics() { @@ -867,7 +867,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI } /** - * @inheritDoc + * {@inheritDoc} * * Overridden to create a TabbedPaneLayout subclass which takes into * account tabOverlap. diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java index 201e2330633..716a218d5f8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java @@ -35,7 +35,7 @@ import javax.swing.table.*; import sun.swing.table.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.table.JTableHeader}. * * @author Alan Chung @@ -64,7 +64,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -89,7 +89,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -98,7 +98,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -114,7 +114,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -174,7 +174,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -185,7 +185,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI // SynthUI // /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -198,7 +198,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void rolloverColumnUpdated(int oldColumn, int newColumn) { @@ -207,7 +207,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java index b1e6a092910..384a12076da 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java @@ -54,7 +54,7 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JTable}. * * @author Philip Milne @@ -202,7 +202,7 @@ public class SynthTableUI extends BasicTableUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -225,7 +225,7 @@ public class SynthTableUI extends BasicTableUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -238,7 +238,7 @@ public class SynthTableUI extends BasicTableUI // /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -278,7 +278,7 @@ public class SynthTableUI extends BasicTableUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -696,7 +696,7 @@ public class SynthTableUI extends BasicTableUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent event) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java index 1e34237d72f..f6b77bfd51e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java @@ -66,7 +66,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -77,7 +77,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -110,7 +110,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -157,7 +157,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} * * Overridden to do nothing. */ @@ -167,7 +167,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java index 3d642d72069..d420d2d7264 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java @@ -36,7 +36,7 @@ import java.beans.PropertyChangeEvent; /** - * Provides the Synth L&F UI delegate for {@link javax.swing.JTextField}. + * Provides the Synth L&F UI delegate for {@link javax.swing.JTextField}. *

    * Warning: * Serialized objects of this class will not be compatible with @@ -148,7 +148,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -204,7 +204,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -213,7 +213,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} * Overridden to do nothing. */ @Override @@ -241,7 +241,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -252,7 +252,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java index 5cb588e6c0f..3c5b4c2146b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java @@ -185,7 +185,7 @@ public class SynthTextPaneUI extends SynthEditorPaneUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java index f927490cb97..d308dc615b8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java @@ -31,7 +31,7 @@ import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JToggleButton}. * * @author Jeff Dinkins @@ -53,7 +53,7 @@ public class SynthToggleButtonUI extends SynthButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected String getPropertyPrefix() { @@ -70,7 +70,7 @@ public class SynthToggleButtonUI extends SynthButtonUI { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java index 6fcc5d069cd..3fb941dc214 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java @@ -44,7 +44,7 @@ import javax.swing.plaf.basic.BasicToolBarUI; import sun.swing.plaf.synth.SynthIcon; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JToolBar}. * * @since 1.7 @@ -69,7 +69,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -78,7 +78,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -87,7 +87,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -121,7 +121,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -149,13 +149,13 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installComponents() {} /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallComponents() {} @@ -170,7 +170,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -239,7 +239,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -314,7 +314,7 @@ public class SynthToolBarUI extends BasicToolBarUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintDragWindow(Graphics g) { @@ -337,7 +337,7 @@ public class SynthToolBarUI extends BasicToolBarUI // /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java index 2caf587cbf6..9d206796882 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java @@ -37,7 +37,7 @@ import javax.swing.text.View; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JToolTip}. * * @author Joshua Outwater @@ -58,7 +58,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults(JComponent c) { @@ -72,7 +72,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults(JComponent c) { @@ -83,7 +83,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners(JComponent c) { @@ -91,7 +91,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners(JComponent c) { @@ -99,7 +99,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -144,7 +144,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -196,7 +196,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { @@ -224,7 +224,7 @@ public class SynthToolTipUI extends BasicToolTipUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java index e1af32f73ef..401175cce99 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java @@ -50,7 +50,7 @@ import javax.swing.tree.TreePath; import sun.swing.plaf.synth.SynthIcon; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JTree}. * * @author Scott Violet @@ -85,7 +85,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Icon getExpandedIcon() { @@ -93,7 +93,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installDefaults() { @@ -156,7 +156,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void installListeners() { @@ -165,7 +165,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -193,7 +193,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected TreeCellEditor createDefaultCellEditor() { @@ -211,7 +211,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected TreeCellRenderer createDefaultCellRenderer() { @@ -219,7 +219,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallDefaults() { @@ -241,7 +241,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void uninstallListeners() { @@ -273,7 +273,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void paintBorder(SynthContext context, Graphics g, int x, @@ -472,7 +472,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, @@ -489,7 +489,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintHorizontalLine(Graphics g, JComponent c, int y, @@ -499,7 +499,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintVerticalPartOfLeg(Graphics g, @@ -511,7 +511,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, @@ -586,7 +586,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintExpandControl(Graphics g, Rectangle clipBounds, @@ -607,7 +607,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void drawCentered(Component c, Graphics graphics, Icon icon, @@ -621,7 +621,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent event) { @@ -637,7 +637,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected void paintDropLine(Graphics g) { @@ -677,7 +677,7 @@ public class SynthTreeUI extends BasicTreeUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override protected int getRowX(int row, int depth) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java index dc2886fb6fa..444e4f049c6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java @@ -32,7 +32,7 @@ import java.awt.*; /** - * Provides the Synth L&F UI delegate for + * Provides the Synth L&F UI delegate for * {@link javax.swing.JViewport}. * * @since 1.7 @@ -52,7 +52,7 @@ public class SynthViewportUI extends ViewportUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void installUI(JComponent c) { @@ -62,7 +62,7 @@ public class SynthViewportUI extends ViewportUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void uninstallUI(JComponent c) { @@ -133,7 +133,7 @@ public class SynthViewportUI extends ViewportUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public SynthContext getContext(JComponent c) { @@ -217,7 +217,7 @@ public class SynthViewportUI extends ViewportUI } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent e) { From a9d180056b50038a20b38471ea96e85afe25f692 Mon Sep 17 00:00:00 2001 From: Dmitry Zinkevich Date: Wed, 25 Sep 2013 17:35:22 +0400 Subject: [PATCH 233/983] 8025085: [javadoc] some errors in javax/swing Reviewed-by: alexsch --- .../share/classes/javax/swing/JButton.java | 4 +- .../share/classes/javax/swing/JCheckBox.java | 4 +- .../javax/swing/JCheckBoxMenuItem.java | 2 +- .../classes/javax/swing/JColorChooser.java | 10 ++--- .../share/classes/javax/swing/JComboBox.java | 10 ++--- .../share/classes/javax/swing/JComponent.java | 4 +- .../classes/javax/swing/JDesktopPane.java | 14 +++---- .../share/classes/javax/swing/JMenuItem.java | 4 +- .../classes/javax/swing/JToggleButton.java | 4 +- .../classes/javax/swing/SpinnerDateModel.java | 4 +- .../classes/javax/swing/SpinnerListModel.java | 6 +-- .../javax/swing/SpinnerNumberModel.java | 6 +-- .../classes/javax/swing/SpringLayout.java | 2 +- .../classes/javax/swing/TransferHandler.java | 2 +- .../share/classes/javax/swing/UIDefaults.java | 2 +- .../UnsupportedLookAndFeelException.java | 2 +- .../classes/javax/swing/ViewportLayout.java | 3 +- .../classes/javax/swing/plaf/LayerUI.java | 40 +++++++++---------- .../javax/swing/plaf/basic/BasicBorders.java | 2 +- .../swing/plaf/basic/BasicDesktopIconUI.java | 2 +- .../swing/plaf/basic/BasicDesktopPaneUI.java | 2 +- .../swing/plaf/basic/BasicFileChooserUI.java | 2 +- .../swing/plaf/basic/BasicGraphicsUtils.java | 2 +- .../swing/plaf/basic/BasicIconFactory.java | 2 +- .../basic/BasicInternalFrameTitlePane.java | 18 ++++----- .../plaf/basic/BasicInternalFrameUI.java | 2 +- .../javax/swing/plaf/basic/BasicLabelUI.java | 2 +- .../javax/swing/plaf/basic/BasicListUI.java | 4 +- .../swing/plaf/basic/BasicMenuBarUI.java | 2 +- .../javax/swing/plaf/basic/BasicMenuUI.java | 2 +- .../swing/plaf/basic/BasicOptionPaneUI.java | 6 +-- .../plaf/basic/BasicPopupMenuSeparatorUI.java | 2 +- .../swing/plaf/basic/BasicPopupMenuUI.java | 2 +- .../swing/plaf/basic/BasicProgressBarUI.java | 2 +- .../swing/plaf/basic/BasicScrollPaneUI.java | 2 +- .../swing/plaf/basic/BasicSeparatorUI.java | 2 +- .../javax/swing/plaf/basic/BasicSliderUI.java | 14 +++---- .../swing/plaf/basic/BasicSplitPaneUI.java | 4 +- .../swing/plaf/basic/BasicTabbedPaneUI.java | 4 +- .../plaf/basic/BasicToolBarSeparatorUI.java | 2 +- .../swing/plaf/basic/BasicToolBarUI.java | 2 +- .../swing/plaf/basic/BasicToolTipUI.java | 2 +- .../javax/swing/plaf/basic/BasicTreeUI.java | 2 +- .../swing/plaf/basic/DefaultMenuLayout.java | 2 +- .../javax/swing/plaf/metal/MetalBorders.java | 2 +- .../swing/plaf/metal/MetalFileChooserUI.java | 2 +- .../javax/swing/plaf/metal/MetalLabelUI.java | 2 +- .../swing/plaf/metal/MetalLookAndFeel.java | 3 +- .../plaf/metal/MetalPopupMenuSeparatorUI.java | 2 +- .../swing/plaf/metal/MetalScrollPaneUI.java | 2 +- .../swing/plaf/metal/MetalSeparatorUI.java | 2 +- .../javax/swing/plaf/metal/MetalSliderUI.java | 2 +- .../swing/plaf/metal/MetalTabbedPaneUI.java | 4 +- .../swing/plaf/metal/MetalToolTipUI.java | 2 +- .../plaf/nimbus/AbstractRegionPainter.java | 6 +-- .../swing/plaf/nimbus/NimbusLookAndFeel.java | 6 +-- .../javax/swing/plaf/nimbus/NimbusStyle.java | 16 ++++---- .../javax/swing/plaf/synth/Region.java | 6 +-- .../javax/swing/text/html/HTMLEditorKit.java | 1 - .../javax/swing/text/html/ImageView.java | 4 +- .../javax/swing/text/html/InlineView.java | 10 ++--- .../javax/swing/text/html/StyleSheet.java | 4 +- .../swing/text/html/parser/ContentModel.java | 4 +- .../text/html/parser/DocumentParser.java | 4 +- .../javax/swing/text/html/parser/Parser.java | 8 ++-- .../javax/swing/tree/AbstractLayoutCache.java | 2 +- .../swing/tree/DefaultTreeCellEditor.java | 4 +- .../swing/tree/DefaultTreeCellRenderer.java | 3 +- .../javax/swing/tree/DefaultTreeModel.java | 4 +- .../javax/swing/tree/TreeCellRenderer.java | 4 +- .../classes/javax/swing/tree/TreeModel.java | 4 +- .../classes/javax/swing/undo/UndoManager.java | 16 ++++---- 72 files changed, 170 insertions(+), 172 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/JButton.java b/jdk/src/share/classes/javax/swing/JButton.java index afa1bf0e7de..45e8757315c 100644 --- a/jdk/src/share/classes/javax/swing/JButton.java +++ b/jdk/src/share/classes/javax/swing/JButton.java @@ -149,7 +149,7 @@ public class JButton extends AbstractButton implements Accessible { /** - * Returns a string that specifies the name of the L&F class + * Returns a string that specifies the name of the L&F class * that renders this component. * * @return the string "ButtonUI" @@ -157,7 +157,7 @@ public class JButton extends AbstractButton implements Accessible { * @see UIDefaults#getUI * @beaninfo * expert: true - * description: A string that specifies the name of the L&F class. + * description: A string that specifies the name of the L&F class. */ public String getUIClassID() { return uiClassID; diff --git a/jdk/src/share/classes/javax/swing/JCheckBox.java b/jdk/src/share/classes/javax/swing/JCheckBox.java index 242d95aa0ca..4d80e9549c6 100644 --- a/jdk/src/share/classes/javax/swing/JCheckBox.java +++ b/jdk/src/share/classes/javax/swing/JCheckBox.java @@ -230,7 +230,7 @@ public class JCheckBox extends JToggleButton implements Accessible { /** - * Returns a string that specifies the name of the L&F class + * Returns a string that specifies the name of the L&F class * that renders this component. * * @return the string "CheckBoxUI" @@ -238,7 +238,7 @@ public class JCheckBox extends JToggleButton implements Accessible { * @see UIDefaults#getUI * @beaninfo * expert: true - * description: A string that specifies the name of the L&F class + * description: A string that specifies the name of the L&F class */ public String getUIClassID() { return uiClassID; diff --git a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java index 260ca01b117..8b42b729f14 100644 --- a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java +++ b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java @@ -168,7 +168,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, } /** - * Returns the name of the L&F class + * Returns the name of the L&F class * that renders this component. * * @return "CheckBoxMenuItemUI" diff --git a/jdk/src/share/classes/javax/swing/JColorChooser.java b/jdk/src/share/classes/javax/swing/JColorChooser.java index 07a72791fa5..eb3aff69a5c 100644 --- a/jdk/src/share/classes/javax/swing/JColorChooser.java +++ b/jdk/src/share/classes/javax/swing/JColorChooser.java @@ -216,7 +216,7 @@ public class JColorChooser extends JComponent implements Accessible { } /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the ColorChooserUI object that renders * this component @@ -226,9 +226,9 @@ public class JColorChooser extends JComponent implements Accessible { } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the ColorChooserUI L&F object + * @param ui the ColorChooserUI L&F object * @see UIDefaults#getUI * * @beaninfo @@ -241,7 +241,7 @@ public class JColorChooser extends JComponent implements Accessible { } /** - * Notification from the UIManager that the L&F has changed. + * Notification from the UIManager that the L&F has changed. * Replaces the current UI object with the latest version from the * UIManager. * @@ -252,7 +252,7 @@ public class JColorChooser extends JComponent implements Accessible { } /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "ColorChooserUI" * @see JComponent#getUIClassID diff --git a/jdk/src/share/classes/javax/swing/JComboBox.java b/jdk/src/share/classes/javax/swing/JComboBox.java index 8ac710910a8..ba3bb8abb1d 100644 --- a/jdk/src/share/classes/javax/swing/JComboBox.java +++ b/jdk/src/share/classes/javax/swing/JComboBox.java @@ -242,9 +242,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { } /** - * Sets the L&F object that renders this component. + * Sets the L&F object that renders this component. * - * @param ui the ComboBoxUI L&F object + * @param ui the ComboBoxUI L&F object * @see UIDefaults#getUI * * @beaninfo @@ -273,7 +273,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { /** - * Returns the name of the L&F class that renders this component. + * Returns the name of the L&F class that renders this component. * * @return the string "ComboBoxUI" * @see JComponent#getUIClassID @@ -285,7 +285,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { /** - * Returns the L&F object that renders this component. + * Returns the L&F object that renders this component. * * @return the ComboBoxUI object that renders this component */ @@ -607,7 +607,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param anIndex an integer specifying the list item to select, * where 0 specifies the first item in the list and -1 indicates no selection - * @exception IllegalArgumentException if anIndex < -1 or + * @exception IllegalArgumentException if anIndex < -1 or * anIndex is greater than or equal to size * @beaninfo * preferred: true diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index dac623a37bd..13576590a39 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -86,7 +86,7 @@ import sun.swing.UIClientPropertyKey; *