diff --git a/.hgtags b/.hgtags index 39177739d9e7bbd9f270e87427051c6e9cf3d912..77659b823f66c631b1e0e1b5f99083563049ae74 100644 --- a/.hgtags +++ b/.hgtags @@ -107,3 +107,5 @@ f08682e23279d6cccbdcafda1eb0647ba4900874 jdk7-b128 bdc069d3f9101f89ec3f81c2950ee2d68fa846d3 jdk7-b130 8ac52c85f9e91336dc00b52ef90b42eecf3230b3 jdk7-b131 6bbc7a4734952ae7604578f270e1566639fa8752 jdk7-b132 +5e5f68a01d12a4432172f384d5201f3a05254493 jdk7-b133 +554adcfb615e63e62af530b1c10fcf7813a75b26 jdk7-b134 diff --git a/make/Makefile b/make/Makefile index 74651fca20b803e7fef15c98551392eda791f36f..afcdda1ee29ea337f85a67f84de94655ba8d208e 100644 --- a/make/Makefile +++ b/make/Makefile @@ -74,7 +74,6 @@ import -- copy in the pre-built components (e.g. VM) \n\ import_product -- copy in the product components \n\ import_fastdebug -- copy in the fastdebug components \n\ import_debug -- copy in the debug components \n\ -modules -- build the jdk and jre module images (experimental) \n\ create_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\ " @@ -261,7 +260,6 @@ docs:: sanity-docs post-sanity-docs # Release engineering targets. # include $(BUILDDIR)/common/Release.gmk -include $(BUILDDIR)/common/Modules.gmk # # Cscope targets. diff --git a/make/com/sun/crypto/provider/Makefile b/make/com/sun/crypto/provider/Makefile index 3df93501c55ce783cc985f45721b6dabf48280a0..f52fb576fc6a892331c57ae01cf1dc1ef4a60e19 100644 --- a/make/com/sun/crypto/provider/Makefile +++ b/make/com/sun/crypto/provider/Makefile @@ -249,7 +249,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar endif - $(install-non-module-file) + $(install-file) ifndef OPENJDK install-prebuilt: diff --git a/make/com/sun/java/pack/Makefile b/make/com/sun/java/pack/Makefile index e7fe8d44b7627ee774977ba46a5665a217077fd3..0e73e0556214158ee0ebf9c6a587165a817d2e01 100644 --- a/make/com/sun/java/pack/Makefile +++ b/make/com/sun/java/pack/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack LIBRARY = unpack PRODUCT = sun @@ -156,7 +155,6 @@ ifdef MT endif $(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE) @$(call binary_file_verification,$@) - $(install-module-file) ifeq ($(PLATFORM), windows) $(RES):: $(VERSIONINFO_RESOURCE) diff --git a/make/com/sun/java/pack/prop/Makefile b/make/com/sun/java/pack/prop/Makefile index 7f8ac7f76ccdecaf000cd704969c6269856cc825..b023d0505fd4071e4e488151d57d6eb5dcad83fb 100644 --- a/make/com/sun/java/pack/prop/Makefile +++ b/make/com/sun/java/pack/prop/Makefile @@ -29,7 +29,6 @@ # to a collision of rules with Classes.gmk and Library.gmk BUILDDIR = ../../../../.. -MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/cosnaming/Makefile b/make/com/sun/jndi/cosnaming/Makefile index 73a64ecd84611425a7fa2fa1595b6948a3744b82..17425dba5f7d7e294005c61c118ef86110f7a4fa 100644 --- a/make/com/sun/jndi/cosnaming/Makefile +++ b/make/com/sun/jndi/cosnaming/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = jndi-cosnaming PACKAGE = com.sun.jndi.cosnaming PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/dns/Makefile b/make/com/sun/jndi/dns/Makefile index ccb98d8483775ec5f26d248f20a0165191de74fe..4b34bdafaa9169c710e278ff246b856618d16655 100644 --- a/make/com/sun/jndi/dns/Makefile +++ b/make/com/sun/jndi/dns/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = jndi-dns PACKAGE = com.sun.jndi.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/ldap/Makefile b/make/com/sun/jndi/ldap/Makefile index eaf663841c7000af78f14d63cf61c5449517fa90..5b74b9101672dd5106c38aa655a34410a9d06f1d 100644 --- a/make/com/sun/jndi/ldap/Makefile +++ b/make/com/sun/jndi/ldap/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = jndi-ldap PACKAGE = com.sun.jndi.ldap PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/rmi/registry/Makefile b/make/com/sun/jndi/rmi/registry/Makefile index 1138bc94bd850a13cbc70ad33b245c6d9982ff39..d8b3e6b512cdad23153a229a524acfd769ae8703 100644 --- a/make/com/sun/jndi/rmi/registry/Makefile +++ b/make/com/sun/jndi/rmi/registry/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../../.. -MODULE = jndi-rmiregistry PACKAGE = com.sun.jndi.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/nio/sctp/Makefile b/make/com/sun/nio/sctp/Makefile index a3d9d0db4775af247f34b3eeabf3bc7bf48fff16..975776889e8e7f3abad1bc9038037102af058baa 100644 --- a/make/com/sun/nio/sctp/Makefile +++ b/make/com/sun/nio/sctp/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = sctp PACKAGE = com.sun.nio.sctp LIBRARY = sctp PRODUCT = sun diff --git a/make/com/sun/org/apache/xml/Makefile b/make/com/sun/org/apache/xml/Makefile index 195c908930858b432b4395a881740c4d6ecca6de..dc0f48317228d11ed7ed3cb17287875425ca0940 100644 --- a/make/com/sun/org/apache/xml/Makefile +++ b/make/com/sun/org/apache/xml/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../../.. -MODULE = security-xmldsig PACKAGE = com.sun.org.apache.xml PRODUCT = xml include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/rowset/Makefile b/make/com/sun/rowset/Makefile index 3a73d987827ca51828959870af2ba6c0c1ba0e19..672aecef30d45f0af59f98166b1dea48d2f18f67 100644 --- a/make/com/sun/rowset/Makefile +++ b/make/com/sun/rowset/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = jdbc-enterprise PACKAGE = com.sun.rowset PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/script/Makefile b/make/com/sun/script/Makefile index e30127e1b67d05c39ce2998132e5d1d7b7c28170..1554d1f593670207562cd198fafda3d08fc6a2d3 100644 --- a/make/com/sun/script/Makefile +++ b/make/com/sun/script/Makefile @@ -25,7 +25,6 @@ BUILDDIR = ../../.. -MODULE = scripting-rhino PACKAGE = com.sun.script PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/security/auth/module/Makefile b/make/com/sun/security/auth/module/Makefile index 0de24cd7be3bc8a8343ce3b5051aba8ea7fbb9ff..b53e1b307f3c6e91c7263b67faf242cb1b358005 100644 --- a/make/com/sun/security/auth/module/Makefile +++ b/make/com/sun/security/auth/module/Makefile @@ -26,7 +26,6 @@ # Makefile for building auth modules. BUILDDIR = ../../../../.. -MODULE = security-auth PACKAGE = com.sun.security.auth.module PRODUCT = sun diff --git a/make/com/sun/servicetag/Makefile b/make/com/sun/servicetag/Makefile index a0d384d4f90b1a3491a9e1f1771d0878a4d40b6e..d647fc8df90422c113bc5383909217db4e55ca71 100644 --- a/make/com/sun/servicetag/Makefile +++ b/make/com/sun/servicetag/Makefile @@ -22,7 +22,6 @@ # questions. BUILDDIR = ../../.. -MODULE = servicetag PACKAGE = com.sun.servicetag PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/tools/attach/Makefile b/make/com/sun/tools/attach/Makefile index 100562c9363cea4ad0c7a904196a313188452110..0fa41d9d9ca26d87ba1242ef9c85220b6781fe44 100644 --- a/make/com/sun/tools/attach/Makefile +++ b/make/com/sun/tools/attach/Makefile @@ -25,7 +25,6 @@ BUILDDIR = ../../../.. -MODULE = attach PACKAGE = com.sun.tools.attach LIBRARY = attach PRODUCT = sun @@ -66,8 +65,7 @@ $(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/tools/attach/META-INF/services/% @$(MKDIR) -p $(@D) @$(RM) $@ @$(CAT) $< | $(SED) -e "s/^#\[$(PLATFORM)\]//" > $@ - @$(install-module-file) - + .PHONY: copy-files diff --git a/make/common/Defs.gmk b/make/common/Defs.gmk index 6854d4e8708907ebf37882f5fc93da66c3092dfc..ebd619798a954467bf2651245a90e72541700e37 100644 --- a/make/common/Defs.gmk +++ b/make/common/Defs.gmk @@ -224,9 +224,6 @@ INCLUDEDIR = $(OUTPUTDIR)/include # for generated class files CLASSBINDIR = $(OUTPUTDIR)/classes DEMOCLASSDIR = $(OUTPUTDIR)/democlasses -# for modules -MODULES_DIR = $(OUTPUTDIR)/modules -ABS_MODULES_DIR = $(ABS_OUTPUTDIR)/modules # for generated tool class files BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses # for build tool jar files @@ -297,22 +294,6 @@ ifneq ($(LIBRARY),) endif endif -# -# Build units may or may not define MODULE. Default to "other". -# -# MODULE variable defines the lowest-level module name that -# might or might not be the name of the modules created in -# the modules build (see make/modules/modules.config and -# modules.group). -# -MODULES_TEMPDIR = $(OUTPUTDIR)/tmp/modules -ABS_MODULES_TEMPDIR = $(ABS_OUTPUTDIR)/tmp/modules - -ifndef MODULE - MODULE = other -endif -override MODULE_DEST_DIR = $(MODULES_TEMPDIR)/$(MODULE) - # the use of += above makes a space separated list which we need to # remove for filespecs. # @@ -422,52 +403,13 @@ PKGDIR = $(subst .,/,$(PACKAGE)) # include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk -# -# Macros to find the module that $@ belongs to -# - UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH)) -MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \ - -e 's%.*\/$(UNIQUE_PATH_PATTERN)\/%classes\/%' \ - -e 's%.*\/lib\/%lib\/%' \ - -e 's%.*\/bin\/%bin\/%' \ - -e 's%.*\/include\/%include\/%' \ - -e 's%.*\/demo\/%demo\/%' \ - -e 's%.*\/sample\/%sample\/%' - -# Install a file to its module -define install-module-file -dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ -$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ -$(CP) -f $@ $(MODULE_DEST_DIR)/$$dest -endef - -# Install all files from the directory to its module -define install-module-dir -dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ -$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ -$(CP) -rf $(@D)/* $(MODULE_DEST_DIR)/$$dest -endef - -# chmod the file in its module -define chmod-module-file -dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ -$(CHMOD) $1 $(MODULE_DEST_DIR)/$$dest -endef - -# install a sym link in its module -define install-module-sym-link -dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ -$(LN) -sf $1 $(MODULE_DEST_DIR)/$$dest -endef - # Run MAKE $@ for a launcher: # $(call make-launcher, name, mainclass, java-args, main-args) define make-launcher $(CD) $(BUILDDIR)/launchers && \ $(MAKE) -f Makefile.launcher \ - MODULE=$(MODULE) \ PROGRAM=$(strip $1) \ MAIN_CLASS=$(strip $2) \ MAIN_JAVA_ARGS="$(strip $3)" \ @@ -488,28 +430,18 @@ endef define install-file $(prep-target) $(CP) $< $@ -@$(install-module-file) endef define chmod-file $(CHMOD) $1 $@ -@$(call chmod-module-file, $1) endef define install-sym-link $(LN) -s $1 $@ -@$(call install-module-sym-link, $1) -endef - -# -# Marcos for files not belonging to any module -define install-non-module-file -$(prep-target) -$(CP) $< $@ endef define install-manifest-file -$(install-non-module-file) +$(install-file) endef # Cleanup rule for after debug java run (hotspot.log file is left around) @@ -577,7 +509,6 @@ endef define install-import-file $(install-importonly-file) -@$(install-module-file) endef .PHONY: all build clean clobber diff --git a/make/common/Demo.gmk b/make/common/Demo.gmk index 24ee29f0ba55fe439561b0861f6eb76c57c9a245..31c032497872b386fea5d3eabbd5e835e07f819f 100644 --- a/make/common/Demo.gmk +++ b/make/common/Demo.gmk @@ -25,8 +25,6 @@ # JDK Demo building jar file. -MODULE = demos - # Some names are defined with LIBRARY inside the Defs.gmk file LIBRARY=$(DEMONAME) OBJDIR=$(TEMPDIR)/$(DEMONAME) @@ -120,8 +118,11 @@ DEMO_ALL_NATIVE_SOURCES += $(filter %.h,$(DEMO_ALL_FILES)) DEMO_ALL_NATIVE_SOURCES += $(filter %.hpp,$(DEMO_ALL_FILES)) # If we have java sources, then define the jar file we will create +ifndef DEMO_JAR_NAME + DEMO_JAR_NAME = $(DEMONAME).jar +endif ifneq ($(strip $(DEMO_JAVA_SOURCES)),) - DEMO_JAR = $(DEMO_DESTDIR)/$(DEMONAME).jar + DEMO_JAR = $(DEMO_DESTDIR)/$(DEMO_JAR_NAME) endif # If we have native sources, define the native library we will create @@ -254,6 +255,17 @@ $(DEMO_JAR): \ $(MKDIR) -p $(DEMO_JAR_IMAGE) $(JAVAC_CMD) -d $(DEMO_JAR_IMAGE) -sourcepath $(DEMO_BUILD_SRCDIR) \ @$(DEMO_JAVAC_INPUT) + ifeq ($(DEMO_INCL_SRC),true) + $(CP) $(DEMO_JAVA_SOURCES:%=$(DEMO_BUILD_SRCDIR)/%) $(DEMO_JAR_IMAGE) + endif + ifeq ($(DEMO_ONLY_SRC),true) + $(RM) -r $(DEMO_JAR_IMAGE) + $(MKDIR) -p $(DEMO_JAR_IMAGE) + $(CP) -r $(DEMO_BUILD_SRCDIR)/* $(DEMO_JAR_IMAGE) + ifneq ($(DEMO_TOPFILES),) + $(CP) $(DEMO_ROOT)/$(DEMO_TOPFILES) $(DEMO_JAR_IMAGE) + endif + endif $(BOOT_JAR_CMD) -cfm $@ $(DEMO_MANIFEST) \ -C $(DEMO_JAR_IMAGE) . \ $(BOOT_JAR_JFLAGS) @@ -326,9 +338,9 @@ bundles: $(DEMO_BUILD_SRCZIP) ifdef DEMO_IS_APPLET @$(ECHO) "Expanding jar file into demos area at $(DEMO_DESTDIR)" ( $(CD) $(DEMO_DESTDIR) && \ - $(BOOT_JAR_CMD) -xfv $(DEMONAME).jar \ + $(BOOT_JAR_CMD) -xfv $(DEMO_JAR_NAME) \ $(BOOT_JAR_JFLAGS) && \ - $(RM) -r META-INF $(DEMONAME).jar && \ + $(RM) -r META-INF $(DEMO_JAR_NAME) && \ $(java-vm-cleanup) ) @( $(CD) $(DEMO_DESTDIR) && $(java-vm-cleanup) ) @$(ECHO) "Expanding source into demos area at $(DEMO_DESTDIR)" diff --git a/make/common/Library.gmk b/make/common/Library.gmk index 5fbed139ce546637a529b977318ea17a4a975649..e7a24d477ff43a76e6752896c11afd3b1d378f67 100644 --- a/make/common/Library.gmk +++ b/make/common/Library.gmk @@ -168,18 +168,9 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf $(OTHER_LCF) $(JAVALIB) $(LDLIBS) $(CP) $(OBJDIR)/$(@F) $@ @$(call binary_file_verification,$@) - $(install-module-file) $(CP) $(OBJDIR)/$(LIBRARY).map $(@D) $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) -$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb - -$(ACTUAL_LIBRARY_DIR)/%.map: FORCE - $(install-module-file) - -$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE - $(install-module-file) - endif # LIBRARY $(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m) @@ -235,7 +226,6 @@ ifeq ($(LIBRARY), fdlibm) else # LIBRARY $(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) @$(call binary_file_verification,$@) - $(install-module-file) ifeq ($(WRITE_LIBVERSION),true) $(MCS) -d -a "$(FULL_VERSION)" $@ endif # WRITE_LIBVERSION diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk deleted file mode 100644 index 9bf90db293241003f05a3363727d1c4504f3db1e..0000000000000000000000000000000000000000 --- a/make/common/Modules.gmk +++ /dev/null @@ -1,454 +0,0 @@ -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -JDK_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jdk-module-image -JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image - -# -# modules Target to build jdk and jre module image -# -# There is one jar file per module containing classes only. -# All module jars are currently placed under jre/lib directory. -# -# Open issues that need further investigation: -# 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns -# module. META-INF/services file is not installed. -# 2. Signed jars -# For JDK build, signed jars are copied to the build. -# All jars in the module image are unsigned. - -MODULE_IMAGEBINDIR = bin - -# -# Targets. -# -INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre -INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk -ifeq ($(PLATFORM), solaris) - ifeq ($(ARCH_DATA_MODEL), 64) - INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre-sol64 - INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk-sol64 - endif -endif - -modules modules-clobber \ -initial-module-image-jre initial-module-image-jdk \ -initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \ -trim-module-image-jre trim-module-image-jdk \ -process-module-image-jre process-module-image-jdk :: - @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - -# Order is important here, trim jre after jdk image is created -modules:: gen-modules \ - sanity-module-images post-sanity-module-images \ - $(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \ - trim-module-image-jre trim-module-image-jdk \ - process-module-image-jre process-module-image-jdk - -# Don't use these -module-image-jre:: initial-module-image-jre trim-module-image-jre process-module-image-jre -module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module-image-jdk - -# -# Paths to these files we need -JDK_MODULE_DOCFILES = $(IMAGE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%) -JRE_MODULE_DOCFILES = $(IMAGE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%) - -###### RULES - -# JDK files -$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/% - $(process-doc-file) - -# JRE files -$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/% - $(process-doc-file) -ifeq ($(PLATFORM), windows) -$(JRE_MODULE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README - $(process-doc-file) -endif - -###################################################### -# JRE Image -###################################################### - -MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list - -# Modules in the jre/lib/security directory -POLICY_MODULES = US_export_policy local_policy - -# Modules in the modules/ext directory -EXT_MODULES = localedata security-sunec security-sunjce - -# Build PKCS#11 on all platforms except 64-bit Windows. -PKCS11 = security-sunpkcs11 -ifeq ($(ARCH_DATA_MODEL), 64) - ifeq ($(PLATFORM), windows) - PKCS11 = - endif -endif - -EXT_MODULES += $(PKCS11) - -# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. -ifeq ($(PLATFORM), windows) - ifneq ($(ARCH_DATA_MODEL), 64) - EXT_MODULES += security-sunmscapi - endif -endif - -# Modules for JDK only -JDK_MODULES = tools - -gen-modules: - $(CD) modules; $(MAKE) all - -initial-module-image-jre-setup: - $(RM) -r $(JRE_MODULE_IMAGE_DIR) - $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR) - -# 64-bit solaris jre image contains only the 64-bit add-on files. -initial-module-image-jre-sol64:: initial-module-image-jre-setup - @# Use tar instead of cp to preserve the symbolic links - for dir in bin lib ; do \ - ( $(CD) $(OUTPUTDIR) && \ - $(TAR) cf - `$(FIND) $$dir -name '$(ARCH)' -print` | \ - ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \ - done - @# Remove some files from the jre area - for t in $(NOTJRETOOLS) ; do \ - $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \ - done - $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl'` - $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl'` - -# Construct an initial jre image (initial jdk jre) no trimming or stripping -initial-module-image-jre:: initial-module-image-jre-setup \ - $(JRE_MODULE_DOCFILES) \ - $(BUILDMETAINDEX_JARFILE) - @# Copy in bin directory - $(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) - @# CTE plugin security change require new empty directory lib/applet - $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/applet - @# Copy files but not .jar in lib directory - $(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(EGREP) -v ".jar$$" | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) - @# - @# copy modules to jre/lib - @# - for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ - $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \ - done - $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext - for m in $(EXT_MODULES) ; do \ - $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/ext ; \ - done - for m in $(POLICY_MODULES) ; do \ - $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/security; \ - done - @# Remove jdk modules - for m in $(JDK_MODULES) ; do \ - $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar ; \ - done - - @# Make sure all directories are read/execute for everyone - $(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d` - @# Remove some files from the jre area - for t in $(NOTJRETOOLS) ; do \ - $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \ - done - @# Remove orb.idl and ir.idl from jre - $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl' -exec $(RM) \{} \; - $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl' -exec $(RM) \{} \; - @# Generate meta-index to make boot and extension class loaders lazier - $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \ - $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \ - -o meta-index *.jar - @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && $(java-vm-cleanup) - $(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && \ - $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \ - -o meta-index *.jar - @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && $(java-vm-cleanup) -ifeq ($(PLATFORM), windows) - @# Remove certain *.lib files - $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \ - $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \ - awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX) - ifeq ($(ARCH_DATA_MODEL), 32) - @# The Java Kernel JRE image ships with a special VM. It is not included - @# in the full JRE image, so remove it. Also, is it only for 32-bit windows. - $(CD) $(JRE_MODULE_IMAGE_DIR)/bin && $(RM) -r kernel - endif -endif # Windows -ifneq ($(PLATFORM), windows) - $(call copy-man-pages,$(JRE_MODULE_IMAGE_DIR),$(JRE_MAN_PAGES)) -endif # !windows - -# Trim out any extra files not for the jre shipment but wanted in the jdk jre. -# (Note the jdk WILL want the jre image before this trimming) -# Removes server VM on Windows 32bit. -# Remove certain shared libraries that should not be in the jre image -# but should be in the jdk jre image. -trim-module-image-jre:: -ifeq ($(PLATFORM), windows) - ifeq ($(ARCH_DATA_MODEL), 32) - $(RM) -r $(JRE_MODULE_IMAGE_DIR)/bin/server - endif - ifdef NOTJRE_SHARED_LIBS - for l in $(NOTJRE_SHARED_LIBS) ; do \ - $(RM) $(JRE_MODULE_IMAGE_DIR)/bin/$$l ; \ - done ; - endif -else # PLATFORM - ifdef NOTJRE_SHARED_LIBS - for l in $(NOTJRE_SHARED_LIBS) ; do \ - $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$(LIBARCH)/$$l ; \ - done ; - endif -endif # PLATFORM - -# Get list of all Elf files in the jre -JRE_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jre-elf-files.list -$(JRE_MODULE_ELF_LIST): - @$(prep-target) -ifneq ($(PLATFORM), windows) - $(RM) $@ - $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@ - $(FILE) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \ - | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ -endif - -# Post process the image (strips and mcs on Elf files we are shipping) -# (Note the jdk WILL want the jre image before this processing) -process-module-image-jre:: $(JRE_MODULE_ELF_LIST) -ifneq ($(POST_STRIP_PROCESS), ) - for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \ - $(CHMOD) u+w $${f}; \ - $(ECHO) $(POST_STRIP_PROCESS) $${f}; \ - $(POST_STRIP_PROCESS) $${f}; \ - $(CHMOD) go-w $${f}; \ - done -endif -ifneq ($(POST_MCS_PROCESS), ) - for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \ - $(CHMOD) u+w $${f}; \ - $(ECHO) $(POST_MCS_PROCESS) $${f}; \ - $(POST_MCS_PROCESS) $${f}; \ - $(CHMOD) go-w $${f}; \ - done -endif - $(RM) $(JRE_MODULE_ELF_LIST) - -###################################################### -# JDK Image -###################################################### -# Note: cpio ($(CPIO)) sometimes leaves directories without rx access. - -initial-module-image-jdk-setup: - $(RM) -r $(JDK_MODULE_IMAGE_DIR) - $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/jre - ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(FIND) . -depth -print \ - | $(CPIO) -pdum $(JDK_MODULE_IMAGE_DIR)/jre ) - $(RM) -rf $(JDK_MODULE_IMAGE_DIR)/jre/man - $(CHMOD) a+rx `$(FIND) $(JDK_MODULE_IMAGE_DIR) -type d` - -initial-module-image-jdk64-bindemos: - for dir in bin demo ; do \ - ( $(CD) $(OUTPUTDIR) && \ - $(TAR) cf - `$(FIND) $$dir -name '$(LIBARCH)' -print` | \ - ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \ - done - -# Solaris 64 bit image is special -initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \ - initial-module-image-jdk64-bindemos - -# DB files to add -ifeq ($(OPENJDK),true) - -initial-module-image-jdk-db: - -else - -# Create the list of db *.zip files to bundle with jdk -ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db) -DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null) - -initial-module-image-jdk-db: $(DB_ZIP_LIST) - $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/db - for d in $(DB_ZIP_LIST); do \ - ($(CD) $(JDK_MODULE_IMAGE_DIR)/db && $(UNZIP) -o $$d); \ - done - -endif - -# Standard jdk image -initial-module-image-jdk:: initial-module-image-jdk-setup \ - initial-module-image-jdk-db \ - $(JDK_MODULE_DOCFILES) - $(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib - @# - @# copy jdk modules to jdk/lib - @# - $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib - for m in $(JDK_MODULES) ; do \ - $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \ - done - ifeq ($(PLATFORM), windows) - @# - @# lib/ - @# - $(CP) $(LIBDIR)/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib - $(CP) $(LIBDIR)/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib - @# - @# bin/ - @# - @# copy all EXE files and only certain DLL files from BINDIR - $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/bin - $(CP) $(BINDIR)/*$(EXE_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin - $(CP) $(BINDIR)/jli.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin - ifeq ($(COMPILER_VERSION), VS2010) - $(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin - endif - ifeq ($(ARCH_DATA_MODEL), 32) - ifeq ($(COMPILER_VERSION), VS2003) - $(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin - endif - endif - else # PLATFORM - @# - @# bin/ - @# - ($(CD) $(BINDIR)/.. && $(TAR) cf - \ - `$(FIND) bin \( -type f -o -type l \) -print `) | \ - ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) - endif # PLATFORM - @# - @# lib/ct.sym - @# - $(MKDIR) -p $(OUTPUTDIR)/symbols/META-INF/sym - $(JAVAC_CMD) -XDprocess.packages -proc:only \ - -processor com.sun.tools.javac.sym.CreateSymbols \ - -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \ - -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ - $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) - $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \ - -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS) - @$(java-vm-cleanup) - $(CP) $(LIBDIR)/ct.sym $(JDK_MODULE_IMAGE_DIR)/lib/ct.sym - @# - @# CORBA supported orb.idl and ir.idl should be copied to lib - @# - $(CP) $(LIBDIR)/orb.idl $(JDK_MODULE_IMAGE_DIR)/lib/orb.idl - $(CP) $(LIBDIR)/ir.idl $(JDK_MODULE_IMAGE_DIR)/lib/ir.idl - ifeq ($(PLATFORM), linux) - @# - @# on Linux copy jexec from jre/lib to /lib - @# - $(CP) $(LIBDIR)/jexec $(JDK_MODULE_IMAGE_DIR)/lib/jexec - endif # PLATFORM - @# - @# demo, include - @# - $(CP) -r -f $(DEMODIR) $(JDK_MODULE_IMAGE_DIR) - $(CP) -r -f $(SAMPLEDIR) $(JDK_MODULE_IMAGE_DIR) - $(CP) -r $(INCLUDEDIR) $(JDK_MODULE_IMAGE_DIR) - @# - @# Swing BeanInfo generation - @# - $(CD) javax/swing/beaninfo && $(MAKE) JDK_IMAGE_DIR=$(JDK_MODULE_IMAGE_DIR) swing-1.2-beans -ifneq ($(PLATFORM), windows) - $(call copy-man-pages,$(JDK_MODULE_IMAGE_DIR),$(JDK_MAN_PAGES)) -endif # !windows - -# Trim out files we don't want to ship -trim-module-image-jdk:: - @# Remove tools that should not be part of SDK. - for t in $(NOTJDKTOOLS); do \ - $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \ - done - -# Get list of Elf files in the jdk -JDK_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jdk-elf-files.list -$(JDK_MODULE_ELF_LIST): - @$(prep-target) -ifneq ($(PLATFORM), windows) - $(RM) $@ - $(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@ - $(FILE) `$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \ - | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ - file `$(FIND) $(JDK_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \ - | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ -endif - -# Post process the image (strips and mcs on files we are shipping) -process-module-image-jdk:: $(JDK_MODULE_ELF_LIST) -ifneq ($(POST_STRIP_PROCESS), ) - for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \ - $(CHMOD) u+w $${f}; \ - $(ECHO) $(POST_STRIP_PROCESS) $${f}; \ - $(POST_STRIP_PROCESS) $${f}; \ - $(CHMOD) go-w $${f}; \ - done -endif -ifneq ($(POST_MCS_PROCESS), ) - for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \ - $(CHMOD) u+w $${f}; \ - $(ECHO) $(POST_MCS_PROCESS) $${f}; \ - $(POST_MCS_PROCESS) $${f}; \ - $(CHMOD) go-w $${f}; \ - done -endif - $(RM) $(JDK_MODULE_ELF_LIST) - -###################################################### -# clobber -###################################################### -modules-clobber:: - $(RM) -r $(JDK_MODULE_IMAGE_DIR) - $(RM) -r $(JRE_MODULE_IMAGE_DIR) - -# -# TODO - nop for now -sanity-module-images post-sanity-module-images: - -modules modules-clobber:: - @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." - @$(java-vm-cleanup) - -.PHONY: modules module-image-jre module-image-jdk \ - initial-module-image-jre initial-module-image-jdk \ - initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \ - initial-module-image-jdk-setup \ - initial-module-image-jdk-db \ - initial-module-image-jdk64-bindemos \ - initial-module-image-jre-setup \ - trim-module-image-jre trim-module-image-jdk \ - process-module-image-jre process-module-image-jdk \ - install-previous-jre install-previous-jdk \ - modules-clobber - -# Force rule -FRC: - diff --git a/make/common/Program.gmk b/make/common/Program.gmk index 5700e32c89d6cb533e69c5a71d9641e19f1d13df..040bcc50719ad33b1ba326898bbc558db44fe3f0 100644 --- a/make/common/Program.gmk +++ b/make/common/Program.gmk @@ -186,7 +186,6 @@ $(ACTUAL_PROGRAM):: $(FILES_o) $(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \ $(FILES_o) $(THREADLIBS) $(LDLIBS) @$(call binary_file_verification,$@) - $(install-module-file) endif # PLATFORM diff --git a/make/common/Release.gmk b/make/common/Release.gmk index 224dcd1650b38aa8119688f32e26e29965b4841b..b2d105b3f2edcb456daf4eedc538146510c1c4cb 100644 --- a/make/common/Release.gmk +++ b/make/common/Release.gmk @@ -60,9 +60,10 @@ EXCLUDE_PROPWARN_PKGS += sun.dyn # # Include the exported private packages in ct.sym. # This is an interim solution until the ct.sym is replaced -# with a new module system (being discussed for JDK 7). +# with a new module system (being discussed for JDK 8). # -EXPORTED_PRIVATE_PKGS = com.sun.servicetag +EXPORTED_PRIVATE_PKGS = com.sun.servicetag \ + com.oracle.net # 64-bit solaris has a few special cases. We define the variable # SOLARIS64 for use in this Makefile to easily test those cases @@ -86,8 +87,14 @@ ifdef OPENJDK IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README else # Where to find these files - SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk - SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre + ifeq ($(J4B), true) + SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdkfb + SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jrefb + else + SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk + SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre + endif + IMAGE_DOCLIST_JDK = COPYRIGHT README.html THIRDPARTYLICENSEREADME.txt IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt ifeq ($(PLATFORM), windows) @@ -125,10 +132,8 @@ JRE_MAN_PAGES = \ unpack200.1 ifndef OPENJDK -ifeq ($(ARCH_DATA_MODEL),32) JRE_MAN_PAGES += javaws.1 endif -endif JDK_MAN_PAGES = \ $(JRE_MAN_PAGES) \ @@ -1100,7 +1105,7 @@ JRE_INFO_FILE = $(JRE_IMAGE_DIR)/release # Common way to emit a line into the release or info file define info-file-item # name value -$(PRINTF) "%s=\"%s\"\n" $1 $2 >> $@ +$(PRINTF) '%s="%s"\n' $1 $2 >> $@ endef # Values to emit diff --git a/make/common/Sanity.gmk b/make/common/Sanity.gmk index 7a01efbd51d28e7a4d491e5294ba14006b55a4fc..5060b8c12b4d3849e8ca19231373d217a55fe2fa 100644 --- a/make/common/Sanity.gmk +++ b/make/common/Sanity.gmk @@ -71,8 +71,7 @@ sanity-base: pre-sanity \ sane-cacerts \ sane-ant_version \ sane-zip_version \ - sane-msvcrt_path \ - sane-build_modules + sane-msvcrt_path # The rules sanity-* have a one-to-one correspondence with the major targets # Each sanity-* rule should have no body to ensure that the post-sanity-* is the diff --git a/make/common/Subdirs.gmk b/make/common/Subdirs.gmk index 51d0c7f8e97d3f8f6c8995192603a46f70cdae7c..4da8acfca4e576fb09994ec0f406067e330747ae 100644 --- a/make/common/Subdirs.gmk +++ b/make/common/Subdirs.gmk @@ -40,9 +40,6 @@ # # By default, subdirs specified in the SUBDIRS and all SUBDIRS_* # variables will be built. -# -# BUILD_MODULES variable can be used to specify one or more groups -# to be built (BUILD_MODULES=all will build all groups). # # Variables of the currently supported groups are: # SUBDIRS_desktop @@ -53,15 +50,12 @@ # # Change to the above list also need to update # make/common/shared/Sanity.gmk. NOTE: this list is subject -# to change till the JDK 7 SE profiles/modules are finalized. +# to change. # # Eventually we want to restructure the make directory # according to these grouping (e.g. make/desktop/...) and # the SUBDIRS_ variables would not be needed. # -# To build the desktop and tools groups only, you can do: -# gnumake BUILD_MODULES="desktop tools" ... -# # Iterate the subdirectories specified in $1. # - cd into each subdir and make them @@ -96,77 +90,51 @@ endef # # Iterate the list specified in SUBDIRS_ only if -# SUBDIRS_ is set and or "all" is specified -# in the BUILD_MODULES variable +# SUBDIRS_ is set. # ifdef SUBDIRS_desktop - ifneq (,$(findstring desktop, $(BUILD_MODULES))) - define subdirs-desktop-loop - @$(call subdirs-group-loop,SUBDIRS_desktop) - endef - else - define subdirs-desktop-loop - endef - endif + define subdirs-desktop-loop + @$(call subdirs-group-loop,SUBDIRS_desktop) + endef else define subdirs-desktop-loop endef endif # SUBDIRS_desktop ifdef SUBDIRS_enterprise - ifneq (,$(findstring enterprise, $(BUILD_MODULES))) - define subdirs-enterprise-loop - @$(call subdirs-group-loop,SUBDIRS_enterprise) - endef - else - define subdirs-enterprise-loop - endef - endif + define subdirs-enterprise-loop + @$(call subdirs-group-loop,SUBDIRS_enterprise) + endef else define subdirs-enterprise-loop endef endif # SUBDIRS_enterprise ifdef SUBDIRS_management - ifneq (,$(findstring management, $(BUILD_MODULES))) - define subdirs-management-loop - @$(call subdirs-group-loop,SUBDIRS_management) - endef - else - define subdirs-management-loop - endef - endif + define subdirs-management-loop + @$(call subdirs-group-loop,SUBDIRS_management) + endef else -define subdirs-management-loop -endef + define subdirs-management-loop + endef endif # SUBDIRS_management ifdef SUBDIRS_misc - ifneq (,$(findstring misc, $(BUILD_MODULES))) - define subdirs-misc-loop - @$(call subdirs-group-loop,SUBDIRS_misc) - endef - else - define subdirs-misc-loop - endef - endif + define subdirs-misc-loop + @$(call subdirs-group-loop,SUBDIRS_misc) + endef else -define subdirs-misc-loop -endef + define subdirs-misc-loop + endef endif # SUBDIRS_misc ifdef SUBDIRS_tools - ifneq (,$(findstring tools, $(BUILD_MODULES))) - define subdirs-tools-loop - @$(call subdirs-group-loop,SUBDIRS_tools) - endef - else - define subdirs-tools-loop - endef - endif + define subdirs-tools-loop + @$(call subdirs-group-loop,SUBDIRS_tools) + endef else -define subdirs-tools-loop -endef + define subdirs-tools-loop + endef endif # SUBDIRS_tools # @@ -175,30 +143,6 @@ endif # SUBDIRS_tools SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \ $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools) -ifndef BUILD_MODULES -define SUBDIRS-loop - @$(call subdirs-group-loop,SUBDIRS_all) -endef - -else - -ifneq (,$(findstring all, $(BUILD_MODULES))) define SUBDIRS-loop @$(call subdirs-group-loop,SUBDIRS_all) endef - -else # BUILD_MODULES set -# -# Iterate SUBDIRS and the groups specified in BUILD_MODULES -# -define SUBDIRS-loop - @$(call subdirs-group-loop,SUBDIRS) - @$(subdirs-desktop-loop) - @$(subdirs-enterprise-loop) - @$(subdirs-management-loop) - @$(subdirs-misc-loop) - @$(subdirs-tools-loop) -endef - -endif -endif # BUILD_MODULES diff --git a/make/common/shared/Compiler-msvc.gmk b/make/common/shared/Compiler-msvc.gmk index 1b6d38d5f7f2a88c5324e8af57ac6a42b9f99f6b..8be9f79f822b2e0a69f53bf2c60b61013f5e661a 100644 --- a/make/common/shared/Compiler-msvc.gmk +++ b/make/common/shared/Compiler-msvc.gmk @@ -153,6 +153,9 @@ ifeq ($(PLATFORM), windows) ifndef COMPILER_VERSION COMPILER_VERSION := $(error COMPILER_VERSION cannot be empty here) endif + ifneq ($(COMPILER_VERSION),VS2010) + COMPILER_VERSION := $(error COMPILER_VERSION must be VS2010) + endif # Shared library generation flag SHARED_LIBRARY_FLAG = -LD diff --git a/make/common/shared/Defs-java.gmk b/make/common/shared/Defs-java.gmk index 7a586602b23bc176de5ff40760ef2aa3674dcb10..d4a27e3b6c6d472fc85a76810ce29f85b441497d 100644 --- a/make/common/shared/Defs-java.gmk +++ b/make/common/shared/Defs-java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 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 @@ -45,7 +45,7 @@ else JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m endif -# +# # All java tools (javac, javah, and javadoc) run faster with certain java # options, this macro should be used with all these tools. # In particular, the client VM makes these tools run faster when @@ -122,6 +122,17 @@ ifeq ($(JAVAC_WARNINGS_FATAL), true) JAVACFLAGS += -Werror endif +# +# Some licensees do not get the Security Source bundles. We will +# fall back on the prebuilt jce.jar so that we can do a best +# attempt at building. If sources exist, we always want to +# build/use the most recent source instead of an older jce.jar, whether +# built implicitly/explicitly. +# +ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),) + JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar +endif + # Add the source level SOURCE_LANGUAGE_VERSION = 7 LANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION) @@ -132,11 +143,11 @@ TARGET_CLASS_VERSION = 7 CLASS_VERSION = -target $(TARGET_CLASS_VERSION) JAVACFLAGS += $(CLASS_VERSION) JAVACFLAGS += -encoding ascii -JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)" +JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)" JAVACFLAGS += $(OTHER_JAVACFLAGS) # Needed for javah -JAVAHFLAGS += -bootclasspath $(CLASSBINDIR) +JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)" # Needed for javadoc to ensure it builds documentation # against the newly built classes diff --git a/make/common/shared/Defs-javadoc.gmk b/make/common/shared/Defs-javadoc.gmk index a5ffe8e285ed9bb0ba4cada982bbabed08205cd0..f63ec22f5013e42e92217e5cbd2a3a4cfecebe70 100644 --- a/make/common/shared/Defs-javadoc.gmk +++ b/make/common/shared/Defs-javadoc.gmk @@ -61,33 +61,11 @@ COMMA:= , EMPTY:= SPACE:=$(EMPTY) $(EMPTY) COPYRIGHT_SYMBOL = &\#x00a9; -# Macros to handle the optional empty args. +# Macro to construct the copyright line # (The GNU make 3.78.1 "if" conditional is broken, fixed in GNU make 3.81) -define OptionalCopyrightUrl # url -$(shell \ - if [ "$1" != "" ] ; then \ - printf "Copyright" "$1"; \ - else \ - printf "Copyright"; \ - fi) -endef -define OptionalCopyrightFirstYear # year -$(shell \ - if [ "$1" != "" ] ; then \ - printf "%s," "$1";\ - fi) -endef -define OptionalCompanyAddress # address -$(shell \ - if [ "$1" != "" ] ; then \ - printf "%s" "$1";\ - fi) -endef define CopyrightLine # optionalurl optionalfirstyear optionaladdress -$(call OptionalCopyrightUrl,$1) $(COPYRIGHT_SYMBOL)\ -$(call OptionalCopyrightFirstYear,$2) $(COPYRIGHT_YEAR),\ -$(COMPANY_NAME).\ -$(call OptionalCompanyAddress,$3)\ -All rights reserved. +$(if $(strip $1),Copyright,Copyright) \ +$(COPYRIGHT_SYMBOL) $(if $2,$2${COMMA},) $(COPYRIGHT_YEAR),\ +$(FULL_COMPANY_NAME). $3 All rights reserved. endef diff --git a/make/common/shared/Defs-utils.gmk b/make/common/shared/Defs-utils.gmk index bb6aa493cf5b4de957f890b1f89c0dd9f51ea1a7..8672936bae112d1eb4a894feb5778c4bcc3f15be 100644 --- a/make/common/shared/Defs-utils.gmk +++ b/make/common/shared/Defs-utils.gmk @@ -115,7 +115,6 @@ NM = $(UTILS_CCS_BIN_PATH)nm PKGMK = $(UTILS_COMMAND_PATH)pkgmk PRINTF = $(UTILS_USR_BIN_PATH)printf PWD = $(UTILS_COMMAND_PATH)pwd -RC = $(UTILS_COMMAND_PATH)rc READELF = $(UTILS_USR_BIN_PATH)readelf RMDIR = $(UTILS_COMMAND_PATH)rmdir RPM = $(UTILS_COMMAND_PATH)rpm @@ -135,6 +134,7 @@ UNAME = $(UTILS_COMMAND_PATH)uname UNIQ = $(UTILS_USR_BIN_PATH)uniq UNZIP = $(UTILS_USR_BIN_PATH)unzip UNZIPSFX = $(UTILS_DEVTOOL_PATH)unzipsfx +XARGS = $(UTILS_USR_BIN_PATH)xargs WC = $(UTILS_USR_BIN_PATH)wc WHICH = $(UTILS_USR_BIN_PATH)which YACC = $(UTILS_CCS_BIN_PATH)yacc diff --git a/make/common/shared/Defs.gmk b/make/common/shared/Defs.gmk index 587f1ad19118fa49fc00b9ea55f3e69ee9fc2e27..cfc889a01484b12c9e7f75cce4ec06499601ff11 100644 --- a/make/common/shared/Defs.gmk +++ b/make/common/shared/Defs.gmk @@ -218,7 +218,11 @@ ifdef OPENJDK else LAUNCHER_NAME = java PRODUCT_NAME = Java(TM) - PRODUCT_SUFFIX = SE Runtime Environment + ifeq ($(J4B), true) + PRODUCT_SUFFIX = SE Runtime Environment for Business + else + PRODUCT_SUFFIX = SE Runtime Environment + endif JDK_RC_PLATFORM_NAME = Platform SE COMPANY_NAME = Oracle Corporation endif diff --git a/make/common/shared/Platform.gmk b/make/common/shared/Platform.gmk index 91326a9f79484674027e63009ae37c50de9c2e4c..5a4ced18d3bcca971058301bf1de144d9a068bc2 100644 --- a/make/common/shared/Platform.gmk +++ b/make/common/shared/Platform.gmk @@ -148,7 +148,7 @@ ifeq ($(SYSTEM_UNAME), SunOS) # Suffix for file bundles used in previous release BUNDLE_FILE_SUFFIX=.tar # How much RAM does this machine have: - MB_OF_MEMORY=$(shell /etc/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3) + MB_OF_MEMORY=$(shell /usr/sbin/prtconf | fgrep 'Memory size:' | expand | cut -d' ' -f3) endif # Platform settings specific to Linux diff --git a/make/common/shared/Sanity.gmk b/make/common/shared/Sanity.gmk index 6883d9ce7ec99f2e41c7c0e0752a1ad0366ce3a0..f6c9f1e28696983989db5d18af3e6063cb4df276 100644 --- a/make/common/shared/Sanity.gmk +++ b/make/common/shared/Sanity.gmk @@ -113,7 +113,7 @@ ifeq ($(PLATFORM), linux) ALSA_INCLUDE=/usr/include/alsa/version.h ALSA_LIBRARY=/usr/lib/libasound.so _ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \ - $(SED) -e 's@.*\"\(.*\)\".*@\1@' ) + $(SED) -e 's@.*"\(.*\)".*@\1@' ) ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION)) endif @@ -221,8 +221,7 @@ include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk sane-zip_version \ sane-unzip_version \ sane-msvcrt_path \ - sane-freetype \ - sane-build_modules + sane-freetype ###################################################### # check for COPYRIGHT_YEAR variable @@ -334,12 +333,12 @@ sane-locale: ifneq ($(PLATFORM), windows) @if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \ $(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \ - " Try setting LC_ALL to \"C\". \n" \ + " Try setting LC_ALL to 'C'. \n" \ "" >> $(WARNING_FILE) ; \ fi @if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \ $(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \ - " Try setting LANG to \"C\". \n" \ + " Try setting LANG to 'C'. \n" \ "" >> $(WARNING_FILE) ; \ fi endif @@ -831,21 +830,6 @@ else sane-freetype: endif -###################################################### -# if specified, BUILD_MODULES must contain valid values. -###################################################### -MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools" -sane-build_modules: -ifdef BUILD_MODULES - @for m in $(BUILD_MODULES) ; do \ - valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \ - if [ "x$$valid" = "x" ] ; then \ - $(ECHO) "ERROR: $$m set in the BUILD_MODULES variable is invalid.\n" \ - "" >> $(ERROR_FILE); \ - fi \ - done -endif - ###################################################### # CUPS_HEADERS_PATH must be valid ###################################################### @@ -1012,11 +996,6 @@ ifeq ($(PLATFORM), windows) "" >> $(ERROR_FILE) ; \ fi else - ifeq ($(wildcard $(REBASE)),) - @$(ECHO) "ERROR: Cannot find the REBASE utility from path: $(REBASE)\n" \ - " This is normally obtained from the WINDOWSSDKDIR." \ - "" >> $(ERROR_FILE) - endif ifeq ($(wildcard $(RC)),) @$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \ " This is normally obtained from the WINDOWSSDKDIR." \ @@ -1024,7 +1003,7 @@ ifeq ($(PLATFORM), windows) endif ifeq ($(wildcard $(DUMPBIN)),) @$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \ - " This is normally obtained from the WINDOWSSDKDIR." \ + " This is normally obtained from the COMPILER_PATH." \ "" >> $(ERROR_FILE) endif endif @@ -1131,7 +1110,7 @@ TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \ # be checked when this represents a full control build (i.e. the # HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory). $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - @$(install-non-module-file) + @$(install-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \ @@ -1145,7 +1124,7 @@ $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h fi $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h - @$(install-non-module-file) + @$(install-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \ @@ -1348,9 +1327,9 @@ ifdef LINK_VER fi @if [ "$(LINK_CHECK)" != "same" ]; then \ $(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \ - " $(REQUIRED_COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \ + " $(REQUIRED_COMPILER_VERSION) - link.exe version '$(REQUIRED_LINK_VER)' \n" \ " Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \ - " $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \ + " $(YOU_ARE_USING) Linker version '$(LINK_VER)' \n" \ "" >> $(WARNING_FILE) ; \ fi endif diff --git a/make/docs/Makefile b/make/docs/Makefile index 98bf18b76da85b45971e2d10c8676f78b2d3a232..520272b5f5a5a3a0c2d777a5a681bb561471bcc0 100644 --- a/make/docs/Makefile +++ b/make/docs/Makefile @@ -43,7 +43,7 @@ COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION)) BUG_SUBMIT_URL = http://bugs.sun.com/services/bugreport/index.jsp # Common line for how to submit a bug or rfe -BUG_SUBMIT_LINE = Submit a bug or feature +BUG_SUBMIT_LINE = Submit a bug or feature # Url to devdocs page # Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html @@ -166,24 +166,35 @@ JDKJRE2COREAPI = ../../api # Common bottom argument define CommonBottom # year -

$(call CopyrightLine,,$1,) +
$(call CopyrightLine,,$1,)
endef # Common trademark bottom argument (Not sure why this is used sometimes) define CommonTrademarkBottom # year -\ +\ $(BUG_SUBMIT_LINE)
$(JAVA_TRADEMARK_LINE)
\ $(call CopyrightLine,,$1,$(COMPANY_ADDRESS))\
endef +# Common echo of option +define OptionOnly # opt +$(PRINTF) "%s\n" "$1" +endef +define OptionPair # opt arg +$(PRINTF) "%s '%s'\n" "$1" '$2' +endef +define OptionTrip # opt arg arg +$(PRINTF) "%s '%s' '%s'\n" "$1" '$2' '$3' +endef + # Core api bottom argument (with special sauce) -COREAPI_BOTTOM = $(BUG_SUBMIT_LINE)\ +COREAPI_BOTTOM = $(BUG_SUBMIT_LINE)\
For further API reference and developer documentation, \ -see Java SE Documentation. \ +see Java SE Documentation. \ That documentation contains more detailed, developer-targeted descriptions, \ with conceptual overviews, definitions of terms, workarounds, \ -and working code examples.

\ +and working code examples.
\ $(call CopyrightLine,$(COPYRIGHT_URL),$(FIRST_COPYRIGHT_YEAR),)\
@@ -212,11 +223,11 @@ ifeq ($(JDK_IS_FCS),false) DRAFT_WINTITLE = $(BUILD_NUMBER) # Early access top text (not used in FCS releases) COREAPI_TOP_EARLYACCESS = \ -

\ -
\ +
\ +font-weight: normal;"> \ Please note that the specifications and other information \ contained herein are not final and are subject to change. \ The information is being made available to you solely for purpose of \ @@ -281,15 +292,9 @@ COREAPI_WINDOWTITLE = Java Platform SE $(JDK_MINOR_VERSION) COREAPI_HEADER = \ Java$(TRADEMARK) Platform
Standard Ed. $(JDK_MINOR_VERSION)
-# Ignored tags -IGNORED_TAGS = beaninfo revised since.unbundled spec specdefault Note ToDo - # Java language specification cite -JLS3_CITE = \ - The Java Language Specification, Third Edition -TAG_JLS3 = -tag 'jls3:a:See $(JLS3_CITE):' - -TAGS = $(IGNORED_TAGS:%=-tag %:X) $(TAG_JLS3) +TAG_JLS3 = jls3:a:See \ +The Java Language Specification, Third Edition: # Overview file for core apis COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html @@ -314,19 +319,26 @@ $(COREAPI_INDEX_FILE): $(COREAPI_OPTIONS_FILE) $(COREAPI_PACKAGES_FILE) # Create file with javadoc options in it $(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "$(TAGS)" ; \ - $(ECHO) "-encoding ISO-8859-1" ; \ - $(ECHO) "-splitIndex" ; \ - $(ECHO) "-overview $(COREAPI_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(COREAPI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(COREAPI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(COREAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ISO-8859-1) ; \ + $(call OptionPair,-tag,beaninfo:X) ; \ + $(call OptionPair,-tag,revised:X) ; \ + $(call OptionPair,-tag,since.unbundled:X) ; \ + $(call OptionPair,-tag,spec:X) ; \ + $(call OptionPair,-tag,specdefault:X) ; \ + $(call OptionPair,-tag,Note:X) ; \ + $(call OptionPair,-tag,ToDo:X) ; \ + $(call OptionPair,-tag,$(TAG_JLS3)) ; \ + $(call OptionOnly,-splitIndex) ; \ + $(call OptionPair,-overview,$(COREAPI_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)) ;\ + $(call OptionPair,-header,$(COREAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(COREAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ ) >> $@ ifdef COREAPI_TOP_EARLYACCESS - @$(ECHO) "-top '$(COREAPI_TOP_EARLYACCESS)'" >> $@ + @$(call OptionPair,-top,$(COREAPI_TOP_EARLYACCESS)) >> $@ endif # Create a file with the package names in it @@ -375,16 +387,16 @@ $(MIRROR_INDEX_FILE): $(MIRROR_OPTIONS_FILE) $(MIRROR_PACKAGES_FILE) # Create file with javadoc options in it $(MIRROR_OPTIONS_FILE): $(MIRROR_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-overview $(MIRROR_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(MIRROR_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(MIRROR_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-group $(MIRROR_GROUPNAME) $(MIRROR_REGEXP)" ; \ - $(ECHO) "-linkoffline $(MIRROR2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionPair,-overview,$(MIRROR_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(MIRROR_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(MIRROR_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-group,$(MIRROR_GROUPNAME),$(MIRROR_REGEXP)); \ + $(call OptionTrip,-linkoffline,$(MIRROR2COREAPI),$(COREAPI_DOCSDIR)); \ ) >> $@ # Create a file with the package names in it @@ -432,16 +444,16 @@ $(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE) # Create file with javadoc options in it $(DOCLETAPI_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-breakiterator" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-doctitle '$(DOCLETAPI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(DOCLETAPI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-group $(DOCLETAPI_GROUPNAME) $(DOCLETAPI_REGEXP)" ; \ - $(ECHO) "-linkoffline $(DOCLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-breakiterator) ; \ + $(call OptionPair,-doctitle,$(DOCLETAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(DOCLETAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-group,$(DOCLETAPI_GROUPNAME),$(DOCLETAPI_REGEXP)); \ + $(call OptionTrip,-linkoffline,$(DOCLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -492,13 +504,13 @@ $(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE) # Create file with javadoc options in it $(TAGLETAPI_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nonavbar" ; \ - $(ECHO) "-noindex" ; \ - $(ECHO) "-bottom '$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(TAGLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nonavbar) ; \ + $(call OptionOnly,-noindex) ; \ + $(call OptionPair,-bottom,$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(TAGLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -543,16 +555,16 @@ $(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE) # Create file with javadoc options in it $(DOMAPI_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-splitIndex" ; \ - $(ECHO) "-doctitle '$(DOMAPI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(DOMAPI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-group $(DOMAPI_GROUPNAME) $(DOMAPI_REGEXP)" ; \ - $(ECHO) "-linkoffline $(DOMAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-splitIndex) ; \ + $(call OptionPair,-doctitle,$(DOMAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(DOMAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-group,$(DOMAPI_GROUPNAME),$(DOMAPI_REGEXP)); \ + $(call OptionTrip,-linkoffline,$(DOMAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -605,15 +617,15 @@ $(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE) # Create file with javadoc options in it $(JDI_OPTIONS_FILE): $(JDI_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-overview $(JDI_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(JDI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)'" ; \ - $(ECHO) "-header '$(JDI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(JDI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(JDI2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionPair,-overview,$(JDI_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(JDI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)); \ + $(call OptionPair,-header,$(JDI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(JDI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(JDI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -693,15 +705,15 @@ $(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE) # Create file with javadoc options in it $(JAAS_OPTIONS_FILE): $(JAAS_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-overview $(JAAS_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(JAAS_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \ - $(ECHO) "-header '$(JAAS_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(JAAS_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(JAAS2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionPair,-overview,$(JAAS_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(JAAS_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)); \ + $(call OptionPair,-header,$(JAAS_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(JAAS_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(JAAS2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -745,16 +757,16 @@ $(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE) # Create file with javadoc options in it $(JGSS_OPTIONS_FILE): $(JGSS_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-overview $(JGSS_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(JGSS_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \ - $(ECHO) "-header '$(JGSS_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(JGSS_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(JGSS2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-overview,$(JGSS_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(JGSS_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)); \ + $(call OptionPair,-header,$(JGSS_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(JGSS_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(JGSS2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -797,15 +809,15 @@ $(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FI # Create file with javadoc options in it $(SMARTCARDIO_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(SMARTCARDIO_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(SMARTCARDIO2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(SMARTCARDIO_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)); \ + $(call OptionPair,-bottom,$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)); \ + $(call OptionTrip,-linkoffline,$(SMARTCARDIO2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -847,15 +859,15 @@ $(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE) # Create file with javadoc options in it $(HTTPSERVER_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(HTTPSERVER_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(HTTPSERVER_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(HTTPSERVER2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(HTTPSERVER_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(HTTPSERVER_HEADER)$(DRAFT_HEADER)); \ + $(call OptionPair,-bottom,$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)); \ + $(call OptionTrip,-linkoffline,$(HTTPSERVER2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -907,16 +919,16 @@ $(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE) # Create file with javadoc options in it $(MGMT_OPTIONS_FILE): $(MGMT_OVERVIEW) $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-overview $(MGMT_OVERVIEW)" ; \ - $(ECHO) "-doctitle '$(MGMT_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \ - $(ECHO) "-header '$(MGMT_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(MGMT_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(MGMT2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-overview,$(MGMT_OVERVIEW)) ; \ + $(call OptionPair,-doctitle,$(MGMT_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)); \ + $(call OptionPair,-header,$(MGMT_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(MGMT_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(MGMT2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -958,15 +970,15 @@ $(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE) # Create file with javadoc options in it $(ATTACH_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(ATTACH_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(ATTACH_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(ATTACH_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(ATTACH2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(ATTACH_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(ATTACH_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(ATTACH_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(ATTACH2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -1008,15 +1020,15 @@ $(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE) # Create file with javadoc options in it $(JCONSOLE_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(JCONSOLE_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(JCONSOLE_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(JCONSOLE2COREAPI) $(COREAPI_DOCSDIR)/"; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(JCONSOLE_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(JCONSOLE_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(JCONSOLE2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -1063,15 +1075,15 @@ $(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE) # Create file with javadoc options in it $(TREEAPI_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-doctitle '$(TREEAPI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(TREEAPI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-group $(TREEAPI_GROUPNAME) $(TREEAPI_REGEXP)" ; \ - $(ECHO) "-linkoffline $(TREEAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \ + $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -1113,15 +1125,15 @@ $(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE) # Create file with javadoc options in it $(SCTPAPI_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(SCTPAPI_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(SCTPAPI_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(SCTPAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(SCTPAPI_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(SCTPAPI_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(SCTPAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it @@ -1163,15 +1175,15 @@ $(TRACING_INDEX_HTML): $(TRACING_OPTIONS_FILE) $(TRACING_PACKAGES_FILE) # Create file with javadoc options in it $(TRACING_OPTIONS_FILE): $(prep-target) - @($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \ - $(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \ - $(ECHO) "-encoding ascii" ; \ - $(ECHO) "-nodeprecatedlist" ; \ - $(ECHO) "-doctitle '$(TRACING_DOCTITLE)'" ; \ - $(ECHO) "-windowtitle '$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE)'";\ - $(ECHO) "-header '$(TRACING_HEADER)$(DRAFT_HEADER)'" ; \ - $(ECHO) "-bottom '$(TRACING_BOTTOM)$(DRAFT_BOTTOM)'" ; \ - $(ECHO) "-linkoffline $(TRACING2COREAPI) $(COREAPI_DOCSDIR)/" ; \ + @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ + $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ + $(call OptionPair,-encoding,ascii) ; \ + $(call OptionOnly,-nodeprecatedlist) ; \ + $(call OptionPair,-doctitle,$(TRACING_DOCTITLE)) ; \ + $(call OptionPair,-windowtitle,$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE));\ + $(call OptionPair,-header,$(TRACING_HEADER)$(DRAFT_HEADER)) ; \ + $(call OptionPair,-bottom,$(TRACING_BOTTOM)$(DRAFT_BOTTOM)) ; \ + $(call OptionTrip,-linkoffline,$(TRACING2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ # Create a file with the package names in it diff --git a/make/docs/NON_CORE_PKGS.gmk b/make/docs/NON_CORE_PKGS.gmk index 05dca34fff39ef941768ba8101838452aafa8df9..a7f4aaf1dd232f15dcdff09b8c1758c099f706e4 100644 --- a/make/docs/NON_CORE_PKGS.gmk +++ b/make/docs/NON_CORE_PKGS.gmk @@ -91,8 +91,6 @@ SCTPAPI_PKGS = com.sun.nio.sctp TRACING_PKGS = com.sun.tracing \ com.sun.tracing.dtrace -ORACLENET_PKGS = com.oracle.net - # non-core packages in rt.jar NON_CORE_PKGS = $(DOMAPI_PKGS) \ $(MGMT_PKGS) \ @@ -103,6 +101,5 @@ NON_CORE_PKGS = $(DOMAPI_PKGS) \ $(HTTPSERVER_PKGS) \ $(SMARTCARDIO_PKGS) \ $(TRACING_PKGS) \ - $(SCTPAPI_PKGS) \ - $(ORACLENET_PKGS) + $(SCTPAPI_PKGS) diff --git a/make/java/awt/Makefile b/make/java/awt/Makefile index b53d05773a54d9dce87cd715c94661784f173c3a..1da8f498cfc3d97b597705302ae1acf1dc8fded6 100644 --- a/make/java/awt/Makefile +++ b/make/java/awt/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = awt PACKAGE = java.awt PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/fdlibm/Makefile b/make/java/fdlibm/Makefile index c4778af3e93e4da70bb8470f54880383b6406f87..38e4bfd9f55aeda48364faf464ac91e9e8676e02 100644 --- a/make/java/fdlibm/Makefile +++ b/make/java/fdlibm/Makefile @@ -31,7 +31,6 @@ # BUILDDIR = ../.. -MODULE = base LIBRARY = fdlibm PRODUCT = java diff --git a/make/java/instrument/Makefile b/make/java/instrument/Makefile index f63c7ae78afacf29db7b3d2ebaf1dfed8bcc2ce7..a2944e73ea0fe21ece8bf617091d5662de2b84a5 100644 --- a/make/java/instrument/Makefile +++ b/make/java/instrument/Makefile @@ -27,7 +27,6 @@ # agent, supporting java.lang.instrument BUILDDIR = ../.. -MODULE = instrument PACKAGE = sun.instrument LIBRARY = instrument PRODUCT = sun diff --git a/make/java/java/FILES_java.gmk b/make/java/java/FILES_java.gmk index fdd4b5519125df5ae1570dc7c269f8286697f416..06c93db4e5d40b316172505f55346c9e623765a8 100644 --- a/make/java/java/FILES_java.gmk +++ b/make/java/java/FILES_java.gmk @@ -466,7 +466,6 @@ JAVA_JAVA_java = \ java/security/ProtectionDomain.java \ java/net/URLClassLoader.java \ java/net/URLConnection.java \ - sun/misc/BootClassLoaderHook.java \ sun/misc/Launcher.java \ sun/misc/MetaIndex.java \ sun/misc/URLClassPath.java \ diff --git a/make/java/java/Makefile b/make/java/java/Makefile index c8cbb30ec568e5c8264be6fb57a14003d78fdaa9..9a2627096f0690b82946c21943cd4fc5197bb89a 100644 --- a/make/java/java/Makefile +++ b/make/java/java/Makefile @@ -29,7 +29,6 @@ # BUILDDIR = ../.. -MODULE = base PACKAGE = java.lang LIBRARY = java PRODUCT = java @@ -244,7 +243,7 @@ ifneq ($(PLATFORM),windows) $(GENSRCDIR)/java/lang/UNIXProcess.java: \ $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM) - $(install-non-module-file) + $(install-file) clean:: $(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java @@ -318,7 +317,6 @@ $(CURDATA): \ $(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \ < $(SHARE_SRC)/classes/java/util/CurrencyData.properties $(MV) $@.temp $@ - $(install-module-file) $(call chmod-file, 444) clean:: @@ -373,7 +371,7 @@ $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \ -usecharforbyte 11 4 1 $(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template - $(install-non-module-file) + $(install-file) clean:: $(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java diff --git a/make/java/java_crw_demo/Makefile b/make/java/java_crw_demo/Makefile index c1393b97b8f63897fc9dabfa3368c4ac776b13be..6b3732079aa019b37e3868dacb4c55185d5cb654 100644 --- a/make/java/java_crw_demo/Makefile +++ b/make/java/java_crw_demo/Makefile @@ -25,7 +25,6 @@ BUILDDIR = ../.. -MODULE = demos LIBRARY = java_crw_demo PRODUCT = sun LIBRARY_OUTPUT = java_crw_demo diff --git a/make/java/java_hprof_demo/Makefile b/make/java/java_hprof_demo/Makefile index 99421b205a82e9233a3e2184a126fe2e7166ed1a..8ad85dc0c5b3e97109109e842ad4a16cbc563506 100644 --- a/make/java/java_hprof_demo/Makefile +++ b/make/java/java_hprof_demo/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = instrument LIBRARY = hprof PRODUCT = sun LIBRARY_OUTPUT = hprof_jvmti diff --git a/make/java/jli/Makefile b/make/java/jli/Makefile index 928df6405f4521262db5979d628ba3044cd2bf29..3a0e9100adeaf87239d70132b4a420addb630c37 100644 --- a/make/java/jli/Makefile +++ b/make/java/jli/Makefile @@ -30,7 +30,6 @@ # its manifestations (java, javaw, javac, ...). # BUILDDIR = ../.. -MODULE = base LIBRARY = jli PRODUCT = java diff --git a/make/java/jvm/Makefile b/make/java/jvm/Makefile index 9da1ef1e37f2ff7b610d597520fb24f6253c48a8..59a520353a613978bb84c091f873d529f971ce14 100644 --- a/make/java/jvm/Makefile +++ b/make/java/jvm/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = base include $(BUILDDIR)/common/Defs.gmk @@ -39,10 +38,10 @@ FILES_h = $(INCLUDEDIR)/jni.h \ $(INCLUDEDIR)/classfile_constants.h $(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - $(install-non-module-file) + $(install-file) $(PLATFORM_INCLUDE)/%.h: $(PLATFORM_SRC)/javavm/export/%.h - $(install-non-module-file) + $(install-file) JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg diff --git a/make/java/logging/Makefile b/make/java/logging/Makefile index aa5e05c10220c9cb406d6b43b7ca77409cc543ec..5f9153fb7b1275ff2ea1229a934edd0dc58fbf6d 100644 --- a/make/java/logging/Makefile +++ b/make/java/logging/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = logging PACKAGE = java.util.logging PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/main/java/Makefile b/make/java/main/java/Makefile index 7f9e8992ad0ce42e138d8cd2186e8c01e37c2d96..452099f7a916a6a12d5bbb50de5f6257f7fec1da 100644 --- a/make/java/main/java/Makefile +++ b/make/java/main/java/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = base PROGRAM = java PRODUCT = java diff --git a/make/java/main/javaw/Makefile b/make/java/main/javaw/Makefile index 920cbbc7c614e4b8eab470bb0bd0e068eb99cf88..e2fc6161aa7304cf958aa3e0f7e75bc0103dd889 100644 --- a/make/java/main/javaw/Makefile +++ b/make/java/main/javaw/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = base PROGRAM = javaw PRODUCT = java diff --git a/make/java/management/Makefile b/make/java/management/Makefile index 7330307488ae8abaaabd7a9f713476edfb2b7219..ebf3640b812d0bc02b3722fab7bf0ee748e857f4 100644 --- a/make/java/management/Makefile +++ b/make/java/management/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = management PACKAGE = java.lang.management LIBRARY = management PRODUCT = java diff --git a/make/java/net/Makefile b/make/java/net/Makefile index bd8801e5a565fe77a930521051a4c960fd2f385d..6e865fa24ec0b36513e6c6a0eddda36f9562261a 100644 --- a/make/java/net/Makefile +++ b/make/java/net/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = base PACKAGE = java.net LIBRARY = net PRODUCT = sun diff --git a/make/java/nio/Makefile b/make/java/nio/Makefile index af84a82b8ac72daf09ce39c02720dcbbdeb0d8a5..ab5a0bdf1f00583a2152ff1ece16dd8038c41184 100644 --- a/make/java/nio/Makefile +++ b/make/java/nio/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = nio PACKAGE = java.nio LIBRARY = nio PRODUCT = java @@ -304,11 +303,7 @@ endif # PLATFORM # Rules # -SUBDIRS_management = mxbean -include $(BUILDDIR)/common/Subdirs.gmk - build: sources - $(SUBDIRS-loop) clean clobber:: $(RM) -r $(NIO_GEN) $(SNIO_GEN) @@ -821,7 +816,7 @@ SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSOR_SRC) | \ $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') $(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC) - $(install-non-module-file) + $(install-file) $(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC) $(prep-target) diff --git a/make/java/nio/mxbean/Makefile b/make/java/nio/mxbean/Makefile deleted file mode 100644 index b53782662150a42eaf3fdaafd78088894bf83688..0000000000000000000000000000000000000000 --- a/make/java/nio/mxbean/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -BUILDDIR = ../../.. -MODULE = management -PACKAGE = java.nio -PRODUCT = java -include $(BUILDDIR)/common/Defs.gmk - -FILES_java = java/nio/BufferPoolMXBean.java - -include $(BUILDDIR)/common/Classes.gmk diff --git a/make/java/npt/Makefile b/make/java/npt/Makefile index a7a8264b2685d7860786afccadf5e190d54d68c6..53f14aa5148ad8eb209e4d2de17b7ebd984ba2a5 100644 --- a/make/java/npt/Makefile +++ b/make/java/npt/Makefile @@ -26,7 +26,6 @@ BUILDDIR = ../.. # It's currently used by jpda and hprof. Put it in base module for now. -MODULE = base LIBRARY = npt PRODUCT = sun LIBRARY_OUTPUT = npt diff --git a/make/java/redist/Makefile b/make/java/redist/Makefile index ad37a7b3401b4aa3fce4692647ec54e9593714b1..13fe4e191864f4b6745f8d038c050f7ecffba201 100644 --- a/make/java/redist/Makefile +++ b/make/java/redist/Makefile @@ -35,7 +35,6 @@ # BUILDDIR = ../.. -MODULE = base PRODUCT = java include $(BUILDDIR)/common/Defs.gmk @@ -122,32 +121,26 @@ $(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@ - @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME) $@ - @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@ - @$(install-module-file) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@ - @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME) $@ - @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@ - @$(install-module-file) # Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Windows else # PLATFORM @@ -291,7 +284,7 @@ INTERNAL_IMPORT_LIST += \ $(LIBDIR)/jce.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/jce.jar - $(install-non-module-file) + $(install-file) $(LIBDIR)/security/US_export_policy.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar $(install-file) diff --git a/make/java/redist/fonts/Makefile b/make/java/redist/fonts/Makefile index 475e5a7d2ad4faa2ab1a65428474c52974bbbc55..6c4c2f987dfb11909fcd3a5c4c318c9455a4d7e6 100644 --- a/make/java/redist/fonts/Makefile +++ b/make/java/redist/fonts/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = font PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/redist/sajdi/Makefile b/make/java/redist/sajdi/Makefile index 5044fd015920be1edd6c6d1001d05cdd2c2d4229..177c757cd059705f397413d61a80c957aea37405 100644 --- a/make/java/redist/sajdi/Makefile +++ b/make/java/redist/sajdi/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = sajdi PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/security/Makefile b/make/java/security/Makefile index 1d28b60f2ff0dadac2ec6d35f3e2e1ba1070d73b..fa87a586468c1f4036b587f2c5a27a0b5816ccc3 100644 --- a/make/java/security/Makefile +++ b/make/java/security/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = base PACKAGE = java.security PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/sql/Makefile b/make/java/sql/Makefile index 5a4bd4f5a3b94b06648bc197c2a8f217125b41d0..6b71ac1644b2b579bb164bcc78c22783b6e38ae3 100644 --- a/make/java/sql/Makefile +++ b/make/java/sql/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = jdbc-base PACKAGE = java.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/text/base/Makefile b/make/java/text/base/Makefile index 2b754932526e6f209950dd5f2d07553f87f96fcc..d53d21b822c06b0dda7a2b22046d847e881c63a2 100644 --- a/make/java/text/base/Makefile +++ b/make/java/text/base/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = base PACKAGE = java.text PRODUCT = sun diff --git a/make/java/verify/Makefile b/make/java/verify/Makefile index 00f610a6491a0e8bfc06211a622e7e051f787b91..d0399120d81e9f419a59bfb4c90689b44754125d 100644 --- a/make/java/verify/Makefile +++ b/make/java/verify/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = base PRODUCT = java LIBRARY = verify include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/zip/Makefile b/make/java/zip/Makefile index 914609cf7e135e2fe9f496d8c62db8ce8215c8b8..fd83ea3f28292b90397faaf5547f2f2b4a5c58d2 100644 --- a/make/java/zip/Makefile +++ b/make/java/zip/Makefile @@ -25,7 +25,6 @@ BUILDDIR = ../.. -MODULE = base PACKAGE = java.util.zip LIBRARY = zip PRODUCT = sun diff --git a/make/javax/crypto/Defs-jce.gmk b/make/javax/crypto/Defs-jce.gmk index f1a1992a192c0b68d3faf164ed53f795ef3e50a5..cfb70b45c489d5ed824b8344cc6d842014ff52c1 100644 --- a/make/javax/crypto/Defs-jce.gmk +++ b/make/javax/crypto/Defs-jce.gmk @@ -83,7 +83,7 @@ RELEASE_DIR = $(OUTPUTDIR)/jce-release define release-warning @$(ECHO) \ - "\n***The jar files built by the \"release\" target must***" \ + "\n***The jar files built by the 'release' target must***" \ "\n***still be checked into the closed workspace! ***" \ $(README-MAKEFILE_WARNING) endef diff --git a/make/javax/crypto/Makefile b/make/javax/crypto/Makefile index b5ceae0ed677cd2dd657c78fbaa7635b6eefa309..f2f8baed5541e26e17acaf7da57cf555b8f94bc6 100644 --- a/make/javax/crypto/Makefile +++ b/make/javax/crypto/Makefile @@ -108,7 +108,6 @@ # BUILDDIR = ../.. -MODULE = base PACKAGE = javax.crypto PRODUCT = sun @@ -294,7 +293,7 @@ limited: \ $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \ $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar - $(install-non-module-file) + $(install-file) $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ policy/limited/default_local.policy \ @@ -415,7 +414,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/jce.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar endif - $(install-non-module-file) + $(install-file) # # Install the appropriate policy file, depending on the type of build. @@ -435,7 +434,7 @@ install-limited-jars: \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) -install-limited: install-limited-jars install-module-files +install-limited: install-limited-jars ifndef OPENJDK $(release-warning) endif @@ -449,7 +448,7 @@ install-unlimited-jars: \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) -install-unlimited: install-unlimited-jars install-module-files +install-unlimited: install-unlimited-jars ifndef OPENJDK $(release-warning) endif @@ -466,16 +465,9 @@ install-prebuilt-jars: $(PREBUILT_DIR)/jce/local_policy.jar \ $(POLICY_DESTDIR) -install-prebuilt: install-prebuilt-jars install-module-files +install-prebuilt: install-prebuilt-jars endif -install-module-files: \ - $(POLICY_DESTDIR)/US_export_policy.jar \ - $(POLICY_DESTDIR)/local_policy.jar - -$(POLICY_DESTDIR)/%.jar : - $(install-module-file) - # ===================================================== # Support routines. # diff --git a/make/javax/imageio/Makefile b/make/javax/imageio/Makefile index 1768964b09820b886f3e79de796aae3d0920e356..1a64c1038ba16025bdeb8dcea02773dc36d26817 100644 --- a/make/javax/imageio/Makefile +++ b/make/javax/imageio/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = imageio PACKAGE = javax.imageio PRODUCT = jiio include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/print/Makefile b/make/javax/print/Makefile index 863dd6611faa015c3f18899959b62b8b747a4d19..290de0f412630bbcde065bfa42debc62a58c3c6e 100644 --- a/make/javax/print/Makefile +++ b/make/javax/print/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = print PACKAGE = javax.print PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/sound/Makefile b/make/javax/sound/Makefile index 645b9b3a097bd4a978c69d2e1ee654b4cf1f5eb3..9a6659c41b2474d4305bb9494654b1af84720b8e 100644 --- a/make/javax/sound/Makefile +++ b/make/javax/sound/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = sound PACKAGE = javax.sound LIBRARY = jsound PRODUCT = sun diff --git a/make/javax/sound/jsoundalsa/Makefile b/make/javax/sound/jsoundalsa/Makefile index 3fc6232c8b05d229bccddbcb7070d20f55943883..95161cd6b8786f7dba080449d76f962dcb0c9dde 100644 --- a/make/javax/sound/jsoundalsa/Makefile +++ b/make/javax/sound/jsoundalsa/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundalsa PRODUCT = sun diff --git a/make/javax/sound/jsoundds/Makefile b/make/javax/sound/jsoundds/Makefile index e731732a6c23c5398e1763c32e7ef0a2d883ec73..26c59f1ab4bcff3f3478e179649f337c36d93fd7 100644 --- a/make/javax/sound/jsoundds/Makefile +++ b/make/javax/sound/jsoundds/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundds PRODUCT = sun diff --git a/make/javax/sql/Makefile b/make/javax/sql/Makefile index a678c21073b81f961eba654df25040f36f95d6e4..91a8db6cabcff7a0c0dcc16534b9a7733d45597c 100644 --- a/make/javax/sql/Makefile +++ b/make/javax/sql/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = jdbc-enterprise PACKAGE = javax.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/swing/Makefile b/make/javax/swing/Makefile index 200c8f9b9d0134d1b115c1ad64801dfabb22da4c..97c5060f7a20c3c291896427cc7a40337ced01a2 100644 --- a/make/javax/swing/Makefile +++ b/make/javax/swing/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = swing PACKAGE = javax.swing PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/make/javax/swing/plaf/Makefile b/make/javax/swing/plaf/Makefile index 0355f5ed3fb9d7f1a1f3717afe10b3770de88d62..ceb5304a8fa39cb40d2ccb9c45f128bf012405eb 100644 --- a/make/javax/swing/plaf/Makefile +++ b/make/javax/swing/plaf/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = swing PACKAGE = javax.swing.plaf PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/make/jpda/back/Makefile b/make/jpda/back/Makefile index cf94227f3c68ea44fd66a9443350169a705254d9..65d47e922c45252419578bf1b9eb8a661ece74d3 100644 --- a/make/jpda/back/Makefile +++ b/make/jpda/back/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = debugging LIBRARY = jdwp PRODUCT = jpda diff --git a/make/jpda/transport/Makefile b/make/jpda/transport/Makefile index 9f5dbf143289c3407f6b875f46956c45a4f6ed51..a6f18ec29addfccfb11377e318b353d1eebdb4a2 100644 --- a/make/jpda/transport/Makefile +++ b/make/jpda/transport/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = debugging PRODUCT = jpda include $(BUILDDIR)/common/Defs.gmk diff --git a/make/jpda/transport/shmem/Makefile b/make/jpda/transport/shmem/Makefile index caa9eced9123941cbc66c3b9824679c66ff1c703..60e0276a4299723b73b8e0108dfdac2ec8a89ae9 100644 --- a/make/jpda/transport/shmem/Makefile +++ b/make/jpda/transport/shmem/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = debugging LIBRARY = dt_shmem PRODUCT = jbug diff --git a/make/jpda/transport/socket/Makefile b/make/jpda/transport/socket/Makefile index 3c654f57edcb3813cff62e2543cc2dd529c01910..3a742d337b2d1006e2c1e98164f6e6db97bbd445 100644 --- a/make/jpda/transport/socket/Makefile +++ b/make/jpda/transport/socket/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = debugging LIBRARY = dt_socket PRODUCT = jbug diff --git a/make/jpda/tty/Makefile b/make/jpda/tty/Makefile index 3e53414eab3ac899d6094a92b98729b569e75117..07a63fe8731c0ff215621691cc1cee64e0c52527 100644 --- a/make/jpda/tty/Makefile +++ b/make/jpda/tty/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = jdb PACKAGE = com.sun.tools.example.debug.tty PRODUCT = jpda PROGRAM = jdb diff --git a/make/launchers/Makefile b/make/launchers/Makefile index c6564126baf6991d3733032f9a6ff589f07da2db..8d7036be179ea239311b90e0e40d0192659a8976 100644 --- a/make/launchers/Makefile +++ b/make/launchers/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = .. -MODULE = tools PACKAGE = launchers PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -38,7 +37,6 @@ include $(BUILDDIR)/common/Defs.gmk define make-corba-launcher $(CD) $(BUILDDIR)/launchers && \ $(MAKE) -f Makefile.launcher \ - MODULE=corba \ PROGRAM=$(strip $1) \ MAIN_CLASS=$(strip $2) \ MAIN_JAVA_ARGS="$(strip $3)" \ diff --git a/make/mkdemo/jfc/SwingSet2/Makefile b/make/mkdemo/jfc/SwingSet2/Makefile index 3e1509b197c79bdf85b432f50527db69c8a33eca..2a4881c8937c8a9cb3b67894f02262a1102231de 100644 --- a/make/mkdemo/jfc/SwingSet2/Makefile +++ b/make/mkdemo/jfc/SwingSet2/Makefile @@ -37,6 +37,7 @@ DEMO_TOPFILES = ./README.txt DEMO_MAINCLASS = $(DEMONAME) DEMO_MANIFEST_ATTR = SplashScreen-Image: resources/images/splash.png DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME) +DEMO_INCL_SRC = true # # Demo jar building rules. diff --git a/make/mkdemo/jpda/Makefile b/make/mkdemo/jpda/Makefile index 2007df39531a71635f1c30d7245320fe666d8b97..9844a739258d1297772477a53589ade2cf2d53f9 100644 --- a/make/mkdemo/jpda/Makefile +++ b/make/mkdemo/jpda/Makefile @@ -32,6 +32,8 @@ DEMO_ROOT = $(SHARE_SRC)/classes DEMO_PKGDIR = com/sun/tools/example DEMO_TOPFILES = ./com/sun/tools/example/README DEMO_DESTDIR = $(DEMODIR)/jpda +DEMO_JAR_NAME = examples.jar +DEMO_ONLY_SRC = true # # Demo jar building rules. diff --git a/make/mkdemo/jvmti/Makefile b/make/mkdemo/jvmti/Makefile index ccc3731c4eae77f64138bc078cfa1c81e1da3dcf..33bdf6fa106c1718cf6feb22377bd50813aa4b2c 100644 --- a/make/mkdemo/jvmti/Makefile +++ b/make/mkdemo/jvmti/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mkdemo/management/Makefile b/make/mkdemo/management/Makefile index 80b1eee90b6e5ef88eb348b647d831f483661e25..4ddccb7ec9f7e9b4e61ab8a468f8372caa1a8a9d 100644 --- a/make/mkdemo/management/Makefile +++ b/make/mkdemo/management/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/dtrace/Makefile b/make/mksample/dtrace/Makefile index 86914546ec69cdfaf2ffcc65545a4e6232114343..033d4d3ba4c6807933cf2fa85b570f8b1fac8d67 100644 --- a/make/mksample/dtrace/Makefile +++ b/make/mksample/dtrace/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/jmx/jmx-scandir/Makefile b/make/mksample/jmx/jmx-scandir/Makefile index 2dab96070fd54dc985cac973ff94cafbe08e8d0f..3ee0e99ac6bde31a5a0a9a0e32fa43163eaa58bd 100644 --- a/make/mksample/jmx/jmx-scandir/Makefile +++ b/make/mksample/jmx/jmx-scandir/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nbproject/Makefile b/make/mksample/nbproject/Makefile index a77771a8f5ae38fca86fca08acc8cb11329fe8d7..92ef671474693feb8704deec366d8f37d751f49b 100644 --- a/make/mksample/nbproject/Makefile +++ b/make/mksample/nbproject/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/file/Makefile b/make/mksample/nio/file/Makefile index 6632aa0f3364376adabe9cea7e9b2d3249c06229..9462d5063f1209aed6c2f95f62fad2e8addb2078 100644 --- a/make/mksample/nio/file/Makefile +++ b/make/mksample/nio/file/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/multicast/Makefile b/make/mksample/nio/multicast/Makefile index 380b51ef50cb2c3dd3f966bd065c1f61b43aa044..ae3b4e1d816e799cb1d8961dc6af68417d61a8b9 100644 --- a/make/mksample/nio/multicast/Makefile +++ b/make/mksample/nio/multicast/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/server/Makefile b/make/mksample/nio/server/Makefile index e7e246e5db6b97d854aa5ce3ff798c473ed28910..bf97c7270656c00f9a8ecad69e82870d5af5a217 100644 --- a/make/mksample/nio/server/Makefile +++ b/make/mksample/nio/server/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/scripting/scriptpad/Makefile b/make/mksample/scripting/scriptpad/Makefile index 917b3da81b14be5107afada4d3d480ec09affcc0..b60b01deb2290ffe9ae2402f3e3af85a4601162a 100644 --- a/make/mksample/scripting/scriptpad/Makefile +++ b/make/mksample/scripting/scriptpad/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/webservices/EbayClient/Makefile b/make/mksample/webservices/EbayClient/Makefile index 04adedc24106f676ed49964daef5cf41676fe341..d007ff36639c87ffebed20715d80c2f319825aab 100644 --- a/make/mksample/webservices/EbayClient/Makefile +++ b/make/mksample/webservices/EbayClient/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/webservices/EbayServer/Makefile b/make/mksample/webservices/EbayServer/Makefile index 13c01e89702292dcb5d37264daea989e20209ced..e51d34622cac667f7b55157b6a4793b5c1c84c71 100644 --- a/make/mksample/webservices/EbayServer/Makefile +++ b/make/mksample/webservices/EbayServer/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. -MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/modules/Makefile b/make/modules/Makefile deleted file mode 100644 index c31ff5a03ade8987d3c5f1a5b0763a5018833b78..0000000000000000000000000000000000000000 --- a/make/modules/Makefile +++ /dev/null @@ -1,134 +0,0 @@ -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -BUILDDIR = .. -include $(BUILDDIR)/common/Defs.gmk - -# -# Modularizing the JDK -# - Post jdk build process until the source tree is restructured -# for modules build -# - /modules/ will be created for each module. -# -# Steps: -# 0. During jdk build before this makefile is invoked, classes, -# resource files, and other non-class files such as native libraries, -# properties file, images, etc are created. -# -# Non-class files are copied to /tmp/modules/ -# directory in this step to prepare for the post-build modularization. -# -# The MODULE variable defined in other makefiles specifies -# the lowest-level module that the non-class files belong to. -# The name might or might not be the same as the name of the modules -# in the resulting /modules directory. -# -# 1. Unpack all jars in the /lib directory to a temporary -# location (/tmp/modules/classes) to prepare for modules -# creation. -# -# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate -# class list for all modules and also perform dependency analysis. -# -# Input configuration files :- -# -# modules.config : defines the low-level modules and specifies -# what classes and resource files each module includes. -# modules.group : defines the module groups and its members. -# jdk7.depconfig : lists the dynamic dependencies including -# use of reflection Class.forName and JNI FindClass and -# service provider. -# optional.depconfig : lists the optional dependencies -# -# 3. Create one directory for each module (/modules/) -# based on the output files from (2). -# -# modules.list lists the modules to be created for the modules -# build and its members. For each module (m) in modules.list, -# a. create $m/lib/$m.jar with all classes and resource files -# listed in $m.classlist and $m.resources respectively. -# b. copy all non-class files from its members to -# /modules/$m. - - -MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf -MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp - -TMP = $(ABS_MODULES_TEMPDIR) -MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist -MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes -MODULES_LIST = $(MODULE_CLASSLIST)/modules.list - -all:: unpack-jars gen-classlist modularize - -JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) -unpack-jars: - @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - $(RM) -rf $(MODULE_CLASSES) - $(MKDIR) -p $(MODULE_CLASSES) - $(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES) - @for jf in $(JAR_LIST) ; do \ - $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\ - done - @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." - -gen-classlist: - $(CD) tools && $(MAKE) all - -modularize: $(MODULE_JAR_MANIFEST_FILE) - @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - @$(RM) -rf $(MODULES_DIR) - - @# create jar file for modules and - @# copy other files from all members of this module - for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ - $(ECHO) "Creating module $$m" ; \ - $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \ - if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ - $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ - fi ; \ - $(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \ - $(CD) $(MODULE_CLASSES) && \ - $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ - $(ABS_MODULES_DIR)/$$m/lib/$$m.jar \ - @$(TMP)/tmp.cf \ - $(BOOT_JAR_JFLAGS); \ - for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \ - if [ -d $(TMP)/$$s ] ; then \ - $(CP) -rf $(TMP)/$$s/* $(ABS_MODULES_DIR)/$$m; \ - $(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \ - fi \ - done \ - done - @$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup) - @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." - -$(MODULE_JAR_MANIFEST_FILE): - $(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@ - -clean clobber:: - $(RM) -rf $(MODULE_CLASSLIST) - $(RM) -rf $(MODULES_DIR) - $(RM) $(MODULE_JAR_MANIFEST_FILE) diff --git a/make/modules/bootmodule.roots b/make/modules/bootmodule.roots deleted file mode 100644 index a72115d97f14a365b5208abc5bc4b09d799e4869..0000000000000000000000000000000000000000 --- a/make/modules/bootmodule.roots +++ /dev/null @@ -1,199 +0,0 @@ -# -# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# -# List of root classes/methods, each line of the following syntax: -# -# |* -# exclude | - -# The boot module generated based on this rootset does not support -# - security permission check -# - non-standard charset -# - logging output -# - resource bundles -# including error output from the launcher - -# VM preloaded classes -java.lang.Object -java.lang.String -java.lang.Class -java.lang.Cloneable -java.lang.ClassLoader -java.lang.System -java.lang.Throwable -java.lang.Error -java.lang.ThreadDeath -java.lang.Exception -java.lang.RuntimeException -java.security.ProtectionDomain -java.security.AccessControlContext -java.lang.ClassNotFoundException -java.lang.NoClassDefFoundError -java.lang.ClassCastException -java.lang.ArrayStoreException -java.lang.VirtualMachineError -java.lang.OutOfMemoryError -java.lang.StackOverflowError -java.lang.IllegalMonitorStateException -java.lang.ref.Reference -java.lang.ref.SoftReference -java.lang.ref.WeakReference -java.lang.ref.FinalReference -java.lang.ref.PhantomReference -java.lang.ref.Finalizer -java.lang.Runnable -java.lang.Thread -java.lang.ThreadGroup -java.util.Properties -java.lang.reflect.AccessibleObject -java.lang.reflect.Member -java.lang.reflect.Field -java.lang.reflect.Method -java.lang.reflect.Constructor -java.lang.reflect.Type -sun.reflect.MagicAccessorImpl -sun.reflect.MethodAccessorImpl -sun.reflect.ConstructorAccessorImpl -sun.reflect.DelegatingClassLoader -sun.reflect.ConstantPool -sun.reflect.UnsafeStaticFieldAccessorImpl -java.util.Vector -java.lang.StringBuffer -java.lang.StackTraceElement -java.nio.Buffer -java.lang.Boolean -java.lang.Character -java.lang.Float -java.lang.Double -java.lang.Byte -java.lang.Short -java.lang.Integer -java.lang.Long -java.lang.NullPointerException -java.lang.ArithmeticException -java.lang.Compiler - - -# Root methods -java.lang.ClassLoader.getSystemClassLoader ()Ljava/lang/ClassLoader; -java.lang.System.initializeSystemClass ()V -sun.launcher.LauncherHelper.checkAndLoadMain (ZZLjava/lang/String;)Ljava/lang/Object; - -# The tool doesn't automatically find superclasses and parse the method -# if overridden as it tries to reduce unnecessary classes being pulled in. -# The following forces the dependency to be included the result. -sun.net.www.protocol.file.Handler. ()V -sun.net.www.protocol.jar.Handler. ()V -sun.net.www.protocol.file.Handler.openConnection * -sun.net.www.protocol.jar.Handler.openConnection * -sun.misc.URLClassPath$JarLoader. (Ljava/net/URL;Ljava/net/URLStreamHandler;Ljava/util/HashMap;)V -sun.misc.URLClassPath$FileLoader. (Ljava/net/URL;)V -sun.misc.URLClassPath$FileLoader.getClassPath * -sun.misc.URLClassPath$FileLoader.getResource * -sun.misc.URLClassPath$JarLoader.getResource * -sun.misc.URLClassPath$JarLoader.getClassPath * - -# permission collections -java.io.FilePermission.newPermissionCollection ()Ljava/security/PermissionCollection; -java.security.BasicPermission.newPermissionCollection ()Ljava/security/PermissionCollection; - -# native -java.io.UnixFileSystem -java.io.UnixFileSystem. ()V -java.io.UnixFileSystem.canonicalize * -java.io.Win32FileSystem -java.io.Win32FileSystem. ()V -java.io.Win32FileSystem.canonicalize * -java.io.WinNTFileSystem -java.io.WinNTFileSystem. ()V -java.io.WinNTFileSystem.canonicalize * - -# missing -java.util.HashMap. ()V -java.util.HashMap$EntrySet.iterator * - -# Called from native GetStringPlatformChars (jni_util.c) -java.lang.String.getBytes * - -# charset -sun.nio.cs.US_ASCII.newEncoder ()Ljava/nio/charset/CharsetEncoder; -sun.nio.cs.UTF_8.newEncoder ()Ljava/nio/charset/CharsetEncoder; -sun.nio.cs.UTF_8.newDecoder * -sun.nio.cs.UTF_16.newEncoder ()Ljava/nio/charset/CharsetEncoder; -sun.nio.cs.UTF_16.newDecoder * -sun.nio.cs.UTF_32.newEncoder ()Ljava/nio/charset/CharsetEncoder; -sun.nio.cs.UTF_32.newDecoder * - -# hashcode -java.util.jar.Attributes$Name.hashCode * - -# nio -sun.nio.ByteBuffered -sun.nio.ch.DirectBuffer -java.nio.DirectByteBuffer -java.nio.MappedByteBuffer -java.nio.DirectLongBufferU - -# resource files -sun.launcher.resources.launcher - -sun.misc.Launcher$AppClassLoader.getPermissions * -sun.misc.Launcher$AppClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class; -sun.misc.Launcher$AppClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class; -sun.misc.Launcher$ExtClassLoader.getPermissions * -sun.misc.Launcher$ExtClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class; -sun.misc.Launcher$ExtClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class; -java.lang.ClassLoader.checkPackageAccess * -java.lang.ClassLoader.findClass * -java.lang.ClassLoader.defineClass * -java.net.URLClassLoader.getPermissions * -java.net.URLClassLoader.findClass * -java.net.URLClassLoader.defineClass * -java.security.SecureClassLoader.defineClass * -# need to parse superclasses -java.security.SecureClassLoader. ()V - -exclude sun.security.provider.PolicyFile. -exclude java.lang.ClassLoader.compareCerts -exclude java.security.cert.Certificate.equals -# unsigned jars - no verifier -exclude java.util.jar.JarFile.initializeVerifier -exclude java.util.jar.JarVerifier -exclude sun.security.util.SignatureFileVerifier. - - -# what about other charset -exclude sun.misc.Service -exclude java.util.ServiceLoader - -# exclude support for localized messages -exclude java.util.ResourceBundle.getBundle -exclude java.text.MessageFormat -exclude sun.util.logging.PlatformLogger$LoggerProxy.format * - -# exclude nio and miscellaneous classes -exclude java.nio.channels.** -exclude sun.misc.FloatingDecimal -exclude sun.misc.FormattedFloatingDecimal -exclude sun.misc.FDBigInt diff --git a/make/modules/jdk7.depconfig b/make/modules/jdk7.depconfig deleted file mode 100644 index 8c6d85fb09961544c1c66450e275f531577f21c3..0000000000000000000000000000000000000000 --- a/make/modules/jdk7.depconfig +++ /dev/null @@ -1,473 +0,0 @@ -# -# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# private java.lang.Object createInetSocketAddress(java.lang.String, int) -@ClassForName - com.sun.jndi.ldap.Connection -> java.net.InetSocketAddress - com.sun.jndi.ldap.Connection -> java.net.SocketAddress - -# com.sun.jndi.ldap.VersionHelper -@ClassForName(optional) - com.sun.jndi.ldap.VersionHelper -> com.sun.jndi.ldap.VersionHelper* - -# private static void initMethodHandles() -@ClassForName - com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.CORBA.Stub - com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.PortableRemoteObject - -# com.sun.naming.internal.ResourceManager$AppletParameter -@ClassForName(optional) - com.sun.naming.internal.ResourceManager$AppletParameter -> java.applet.Applet - -# private static boolean loadProviderAsService() -@Provider - com.sun.net.httpserver.spi.HttpServerProvider -> META-INF/services/com.sun.net.httpserver.spi.HttpServerProvider - -# com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -@ClassForName - com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -> javax.xml.XMLConstants - -# public static java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class) -@ClassForName - java.beans.MetaData -> java.beans.*_PersistenceDelegate - -# private static java.lang.reflect.Method getNanosMethod() -@ClassForName(optional) - java.beans.java_sql_Timestamp_PersistenceDelegate -> java.sql.Timestamp - -# java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -@ClassForName - java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -> java.util.Collections$CheckedCollection - -# java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -@ClassForName - java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -> java.util.Collections$CheckedMap - -# private static java.lang.Object getType(java.lang.Object) -@ClassForName - java.beans.java_util_EnumMap_PersistenceDelegate -> java.util.EnumMap - -# private java.lang.Integer getAxis(java.lang.Object) -@ClassForName - java.beans.javax_swing_Box_PersistenceDelegate -> javax.swing.BoxLayout - -# java.lang.Double -@Inline - java.lang.Double -> sun.misc.FloatConsts - java.lang.Double -> sun.misc.DoubleConsts - -# java.lang.Float -@Inline - java.lang.Float -> sun.misc.FloatConsts - java.lang.Float -> sun.misc.DoubleConsts - -# java.net.DefaultDatagramSocketImplFactory -@ClassForName(optional) - java.net.DefaultDatagramSocketImplFactory -> java.net.*DatagramSocketImpl - -# private static sun.net.spi.nameservice.NameService createNSProvider(java.lang.String) -@Provider - java.net.InetAddress -> META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor - -# static java.net.InetAddressImpl create() -@ClassForName - java.net.InetAddressImplFactory -> java.net.*Inet[46]AddressImpl - -# private static void init() -@NativeFindClass - java.net.PlainDatagramSocketImpl -> java.io.FileDescriptor - -# java.net.ProxySelector -@ClassForName - java.net.ProxySelector -> sun.net.spi.DefaultProxySelector - -# static java.net.URLStreamHandler getURLStreamHandler(java.lang.String) -@ClassForName(optional) - java.net.URL -> sun.net.www.protocol.*.Handler - -# private java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String) -@ClassForName - java.net.URLConnection -> sun.net.www.content.* - -# private static java.nio.channels.spi.AsynchronousChannelProvider loadProviderAsService() -@Provider - java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder -> META-INF/services/java.nio.channels.spi.AsynchronousChannelProvider - -# private static boolean loadProviderFromProperty() -@ClassForName - java.nio.channels.spi.SelectorProvider -> sun.nio.ch.DefaultSelectorProvider - -# private static boolean loadProviderAsService() -@Provider - java.nio.channels.spi.SelectorProvider -> META-INF/services/java.nio.channels.spi.SelectorProvider - -# private static java.util.Iterator providers() -@Provider - java.nio.charset.Charset -> META-INF/services/java.nio.charset.spi.CharsetProvider - -# private static void probeExtendedProvider() -@ClassForName(optional) - java.nio.charset.Charset -> sun.nio.cs.ext.ExtendedCharsets - -# public static java.nio.file.FileSystem newFileSystem(java.net.URI, java.util.Map, java.lang.ClassLoader) -@Provider - java.nio.file.FileSystems -> META-INF/services/java.nio.file.FileSystemProvider - -# private static java.util.List loadInstalledDetectors() -@Provider - java.nio.file.Files$DefaultFileTypeDetectorHolder -> META-INF/services/java.nio.file.spi.FileTypeDetector - -# public static java.util.List installedProviders() -@Provider - java.nio.file.spi.FileSystemProvider -> META-INF/services/java.nio.file.FileSystemProvider - -# private static java.rmi.server.RMIClassLoaderSpi initializeProvider() -@Provider - java.rmi.server.RMIClassLoader -> META-INF/services/java.rmi.server.RMIClassLoaderSpi - -# private static void initializeSystemScope() -@ClassForName(optional) - java.security.IdentityScope -> sun.security.provider.IdentityDatabase - -# static java.security.Policy getPolicyNoCheck() -@ClassForName - java.security.Policy -> sun.security.provider.PolicyFile - -# private static java.lang.Class getSpiClass(java.lang.String) -@ClassForName - java.security.Security -> java.security.*Spi - -# private static void invalidateSMCache(java.lang.String) -@ClassForName - java.security.Security -> java.lang.SecurityManager - -# private static void loadInitialDrivers() -@Provider - java.sql.DriverManager -> META-INF/services/java.sql.Driver - -# private static java.text.BreakIterator createBreakInstance(java.util.Locale, int, java.lang.String, java.lang.String) -@Provider - java.text.BreakIterator -> META-INF/services/java.util.spi.BreakIteratorProvider - -# public static java.text.Collator getInstance(java.util.Locale) -@Provider - java.text.Collator -> META-INF/services/java.util.spi.CollatorProvider - -# private static java.text.DateFormat get(int, int, int, java.util.Locale) -@Provider - java.text.DateFormat -> META-INF/services/java.util.spi.DateNameProvider - -# public static java.util.Locale[] getAvailableLocales() -@Provider - java.text.DateFormatSymbols -> META-INF/services/java.util.spi.DateFormatSymbolsProvider - -# public static java.util.Locale[] getAvailableLocales() -@Provider - java.text.DecimalFormatSymbols -> META-INF/services/java.util.spi.DecimalFormatSymbolsProvider - -# public static java.util.Locale[] getAvailableLocales() -@Provider - java.text.NumberFormat -> META-INF/services/java.util.spi.NumberFormatProvider - -# public java.lang.String getDisplayName(java.util.Locale) -@Provider - java.util.Currency -> META-INF/services/java.util.spi.CurrencyNameProvider - -# java.util.Formatter -@Inline - java.util.Formatter -> sun.misc.DoubleConsts - -# java.util.Locale -@Inline - java.util.Locale -> java.util.LocaleISOData - -# private java.lang.String getDisplayString(java.lang.String, java.util.Locale, int) -@Provider - java.util.Locale -> META-INF/services/java.util.spi.LocaleNameProvider - -# private static java.util.prefs.PreferencesFactory factory1() -@ClassForName - java.util.prefs.Preferences -> java.util.prefs.WindowsPreferencesFactory - java.util.prefs.Preferences -> java.util.prefs.FileSystemPreferencesFactory - -# private static java.util.prefs.PreferencesFactory factory1() -@Provider - java.util.prefs.Preferences -> META-INF/services/java.util.prefs.PreferencesFactory - -# public void registerApplicationClasspathSpis() -@Provider - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.IIOServiceProvider - -# private void registerInstalledProviders() -@Provider - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderSpi - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageWriterSpi - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderWriterSpi - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageTranscoderSpi - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageInputStreamSpi - javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageOutputStreamSpi - -# public javax.naming.ldap.ExtendedResponse createExtendedResponse(java.lang.String, byte[], int, int) -@Provider - javax.naming.ldap.StartTlsRequest -> META-INF/services/javax.naming.ldap.StartTlsResponse - -# private static java.util.ArrayList getAllLookupServices() -@Provider - javax.print.PrintServiceLookup -> META-INF/services/javax.print.PrintServiceLookup - -# private static java.util.ArrayList getAllFactories() -@Provider - javax.print.StreamPrintServiceFactory -> META-INF/services/javax.print.StreamPrintServiceFactory - -# private void initEngines(java.lang.ClassLoader) -@Provider - javax.script.ScriptEngineManager -> META-INF/services/javax.script.ScriptEngineFactory - -# private void initializeInputMethodLocatorList() -@Provider - sun.awt.im.ExecutableInputMethodManager -> META-INF/services/java.awt.im.spi.InputMethodDescriptor - -# private static java.lang.Class getConverterClass(int, java.lang.String) -@ClassForName(optional) - sun.io.Converters -> sun.io.* - -# public static sun.java2d.cmm.PCMM getModule() -@Provider - sun.java2d.cmm.CMSManager -> META-INF/services/sun.java2d.cmm.PCMM - -# public static sun.java2d.pipe.RenderingEngine getInstance() -@Provider - sun.java2d.pipe.RenderingEngine -> META-INF/services/sun.java2d.pipe.RenderingEngine - -# public static sun.java2d.pipe.RenderingEngine getInstance() -@ClassForName(optional) - sun.java2d.pipe.RenderingEngine -> sun.dc.DuctusRenderingEngine - -# sun.misc.FloatingDecimal -@Inline - sun.misc.FloatingDecimal -> sun.misc.FloatConsts - sun.misc.FloatingDecimal -> sun.misc.DoubleConsts - -# sun.misc.FormattedFloatingDecimal -@Inline - sun.misc.FormattedFloatingDecimal -> sun.misc.FloatConsts - sun.misc.FormattedFloatingDecimal -> sun.misc.DoubleConsts - -# sun.misc.FpUtils -@Inline - sun.misc.FpUtils -> sun.misc.FloatConsts - sun.misc.FpUtils -> sun.misc.DoubleConsts - -# public java.net.URLStreamHandler createURLStreamHandler(java.lang.String) -@ClassForName(optional) - sun.misc.Launcher$Factory -> sun.net.www.protocol.*.Handler - -# private static sun.net.NetHooks$Provider loadProvider(java.lang.String) -@ClassForName(optional) - sun.net.NetHooks -> sun.net.spi.SdpProvider - -# sun.net.idn.StringPrep -@Inline - sun.net.idn.StringPrep -> sun.net.idn.UCharacterDirection - -# private static boolean init() -@NativeFindClass - sun.net.spi.DefaultProxySelector -> java.net.Proxy - sun.net.spi.DefaultProxySelector -> java.net.Proxy$Type - sun.net.spi.DefaultProxySelector -> java.net.InetSocketAddress - -# private static java.nio.channels.Channel createChannel() -@ClassForName - sun.nio.ch.InheritedChannel -> java.io.FileDescriptor - -# private static void initDBBConstructor() -@ClassForName - sun.nio.ch.Util -> java.nio.DirectByteBuffer - -# private static void initDBBRConstructor() -@ClassForName - sun.nio.ch.Util -> java.nio.DirectByteBufferR - -# private java.nio.charset.Charset lookup(java.lang.String) -@ClassForName(optional) - sun.nio.cs.FastCharsetProvider -> sun.nio.cs.* - -# sun.nio.cs.ext.ExtendedCharsets -@ClassForName(optional) - sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.* - -# sun.nio.cs.ext.ExtendedCharsets -@ClassForName(optional) - sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.* - -# public static java.nio.file.spi.FileSystemProvider create() -@ClassForName - sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.SolarisFileSystemProvider - sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.LinuxFileSystemProvider - -# sun.rmi.server.MarshalInputStream -@ClassForName - sun.rmi.server.MarshalInputStream -> sun.rmi.server.Activation$ActivationSystemImpl_Stub - sun.rmi.server.MarshalInputStream -> sun.rmi.registry.RegistryImpl_Stub - -# private java.security.Provider doLoadProvider() -@ClassForName(optional) - sun.security.jca.ProviderConfig -> sun.security.pkcs11.SunPKCS11 - sun.security.jca.ProviderConfig -> sun.security.provider.Sun - sun.security.jca.ProviderConfig -> sun.security.rsa.SunRsaSign - sun.security.jca.ProviderConfig -> sun.security.ec.SunEC - sun.security.jca.ProviderConfig -> com.sun.net.ssl.internal.ssl.Provider - sun.security.jca.ProviderConfig -> com.sun.crypto.provider.SunJCE - sun.security.jca.ProviderConfig -> sun.security.jgss.SunProvider - sun.security.jca.ProviderConfig -> com.sun.security.sasl.Provider - sun.security.jca.ProviderConfig -> org.jcp.xml.dsig.internal.dom.XMLDSigRI - sun.security.jca.ProviderConfig -> sun.security.smartcardio.SunPCSC - sun.security.jca.ProviderConfig -> sun.security.mscapi.SunMSCAPI - -# public static java.security.Provider getSunProvider() -@ClassForName - sun.security.jca.Providers -> sun.security.provider.Sun - sun.security.jca.Providers -> sun.security.provider.VerificationProvider - -# private static sun.security.jgss.spi.MechanismFactory getMechFactoryImpl(java.security.Provider, java.lang.String, org.ietf.jgss.Oid, sun.security.jgss.GSSCaller) -@ClassForName - sun.security.jgss.ProviderList -> sun.security.jgss.spi.MechanismFactory - -# sun.security.jgss.wrapper.SunNativeProvider -@NativeFindClass - sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.Oid - sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.GSSException - sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSNameElement - sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSCredElement - sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.NativeGSSContext - sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.SunNativeProvider - sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.MessageProp - sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.ChannelBinding - sun.security.jgss.wrapper.SunNativeProvider -> java.net.InetAddress - sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSLibStub - -# static void ensureLoaded() -@NativeFindClass - sun.security.krb5.Credentials -> sun.security.krb5.internal.Krb5 - sun.security.krb5.Credentials -> sun.security.krb5.internal.Ticket - sun.security.krb5.Credentials -> sun.security.krb5.PrincipalName - sun.security.krb5.Credentials -> sun.security.util.DerValue - sun.security.krb5.Credentials -> sun.security.krb5.EncryptionKey - sun.security.krb5.Credentials -> sun.security.krb5.internal.TicketFlags - sun.security.krb5.Credentials -> sun.security.krb5.internal.KerberosTime - -# public static java.lang.String getDefaultCacheName() -@ClassForName(optional) - sun.security.krb5.internal.ccache.FileCredentialsCache -> com.sun.security.auth.module.UnixSystem - -# sun.security.pkcs.PKCS9Attribute -@ClassForName - sun.security.pkcs.PKCS9Attribute -> sun.security.util.ObjectIdentifier - sun.security.pkcs.PKCS9Attribute -> java.util.Date - sun.security.pkcs.PKCS9Attribute -> sun.security.pkcs.SignerInfo - sun.security.pkcs.PKCS9Attribute -> sun.security.x509.CertificateExtensions - -# protected T engineGetKeySpec(java.security.Key, java.lang.Class) -@ClassForName - sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPublicKeySpec - sun.security.provider.DSAKeyFactory -> java.security.spec.X509EncodedKeySpec - sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPrivateKeySpec - sun.security.provider.DSAKeyFactory -> java.security.spec.PKCS8EncodedKeySpec - -# protected T engineGetParameterSpec(java.lang.Class) -@ClassForName - sun.security.provider.DSAParameters -> java.security.spec.DSAParameterSpec - -# sun.security.provider.VerificationProvider -@ClassForName(optional) - sun.security.provider.VerificationProvider -> sun.security.provider.Sun - sun.security.provider.VerificationProvider -> sun.security.rsa.SunRsaSign - -# sun.security.provider.certpath.URICertStore$LDAP -@ClassForName(optional) - sun.security.provider.certpath.URICertStore$LDAP -> sun.security.provider.certpath.ldap.LDAPCertStoreHelper - -# sun.security.smartcardio.PCSC -@NativeFindClass - sun.security.smartcardio.PCSC -> sun.security.smartcardio.PCSCException - -# sun.security.ssl.HandshakeMessage -@ClassForName - sun.security.ssl.HandshakeMessage -> java.security.MessageDigest$Delegate - -# sun.security.ssl.JsseJce -@ClassForName(optional) - sun.security.ssl.JsseJce -> sun.security.krb5.PrincipalName - -# sun.security.x509.OIDMap$OIDInfo -@ClassForName - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectKeyIdentifierExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.KeyUsageExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PrivateKeyUsageExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectAlternativeNameExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuerAlternativeNameExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.BasicConstraintsExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLNumberExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLReasonCodeExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NameConstraintsExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyMappingsExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityKeyIdentifierExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyConstraintsExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NetscapeCertTypeExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificatePoliciesExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.ExtendedKeyUsageExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.InhibitAnyPolicyExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLDistributionPointsExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificateIssuerExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectInfoAccessExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityInfoAccessExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuingDistributionPointExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.DeltaCRLIndicatorExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.FreshestCRLExtension - sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.OCSPNoCheckExtension - -# sun.util.LocaleServiceProviderPool$AllAvailableLocales -@Provider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.BreakIteratorProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.CollatorProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatSymbolsProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DecimalFormatSymbolsProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.NumberFormatProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.CurrencyNameProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.LocaleNameProvider - sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.TimeZoneNameProvider - -# private static final java.lang.String[] retrieveDisplayNames(sun.util.resources.OpenListResourceBundle, java.lang.String, java.util.Locale) -@Provider - sun.util.TimeZoneNameUtility -> META-INF/services/java.util.spi.TimeZoneNamePProvider - -# public static sun.util.calendar.CalendarSystem forName(java.lang.String) -@ClassForName - sun.util.calendar.CalendarSystem -> sun.util.calendar.Gregorian - sun.util.calendar.CalendarSystem -> sun.util.calendar.LocalGregorianCalendar - sun.util.calendar.CalendarSystem -> sun.util.calendar.JulianCalendar - -# sun.util.logging.LoggingSupport -@ClassForName(optional) - sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl diff --git a/make/modules/modules.config b/make/modules/modules.config deleted file mode 100644 index 2d5d785bf46bfb30236e57605a611a4a53fd402a..0000000000000000000000000000000000000000 --- a/make/modules/modules.config +++ /dev/null @@ -1,928 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// These classes are not referenced in the JDK but we can't -// remove them for compatibility reason. Define this module -// first so that other modules don't need to exclude these clases -module private-legacy { - include sun.misc.Cache*, - sun.misc.ClassLoaderUtil, - sun.misc.Compare, - sun.misc.ConditionLock, - sun.misc.CRC16, - sun.misc.Lock, - sun.misc.Regexp, - sun.misc.RequestProcessor, - sun.misc.Sort, - sun.misc.Request, - sun.misc.Timeable, - sun.misc.Timer, - sun.misc.TimerThread, - sun.misc.TimerTickThread, - sun.misc.UCDecoder, - sun.misc.UCEncoder, - sun.misc.UUDecoder, - sun.misc.UUEncoder, - com.sun.net.ssl.SSLContext, - sun.net.NetworkServer, - sun.net.URLCanonicalizer, - sun.reflect.misc.ConstructorUtil, - sun.reflect.FieldInfo, - sun.reflect.SignatureIterator, - sun.reflect.generics.reflectiveObjects.NotImplementedException, - sunw.io.Serializable, - sunw.util.EventListener, - sunw.util.EventObject; -} - -// Deprecated classes that aren't referenced/used go here. -module deprecated { - // add deprecated security classes once b78 is promoted -} - -/**************************************************************************/ - -module base { - // core classes - include java.lang.*, - java.lang.annotation.*, - java.lang.ref.*, - java.lang.reflect.*, - java.math.*, - java.net.*, - java.util.*, - java.util.concurrent.**, - java.util.jar.*, - java.util.regex.*, - java.util.spi.*, - java.util.zip.*, - java.text.**; - - exclude java.util.jar.Pack200*, - java.util.XMLUtils, - java.text.Bidi; - - include java.io.*, java.nio.*, java.nio.charset.**; - exclude java.io.TempFileHelper, java.nio.BufferPoolMXBean; - - // security APIs - // javax.crypto and javax.security.auth are included to avoid inconsistent - // spliting of JCA and JAAS. This adds about 85k. Also note that some deprecated - // classes must be included for now (see 6876158, 6876170) - include java.security.*, - java.security.cert.*, - java.security.interfaces.*, - java.security.spec.*, - javax.security.auth.**, - javax.crypto.**; - - // Sun and RSA security providers (except LDAP CertStore) - // roots sun.security.provider.* sun.security.provider.certpath.* sun.security.rsa.* - include com.sun.security.auth.PrincipalComparator, - com.sun.security.auth.SubjectCodeSource, - com.sun.security.auth.login.**, - com.sun.security.auth.Policy*, - sun.security.action.*, - sun.security.ec.*, - sun.security.jca.*, - sun.security.pkcs.*, - sun.security.provider.*, - sun.security.provider.certpath.*, - sun.security.rsa.*, - sun.security.util.*, - sun.security.validator.*, - sun.security.x509.*, - sun.security.timestamp.*; - - // this list is based on the classlist generated from the rootset - // need investigation - exclude sun.security.ec.ECD*, - sun.security.ec.ECKeyPairGenerator, - sun.security.ec.SunEC*, - sun.security.pkcs.PKCS10*, - sun.security.pkcs.EncodingException, - sun.security.util.AuthResources_*, - sun.security.util.Resources_*, - sun.security.util.BigInt, - sun.security.util.HostnameChecker, - sun.security.x509.CertAndKeyGen, - sun.security.util.PathList; - - // Kerberos not needed - exclude javax.security.auth.kerberos.**, - sun.security.jgss.**, - sun.security.krb5.**, - sun.security.ssl.Kerberos*, - org.ietf.jgss.**; - - // property events and annotations - include java.beans.ChangeListenerMap, - java.beans.IndexedPropertyChangeEvent, - java.beans.PropertyChange*, - java.beans.PropertyVetoException, - java.beans.VetoableChange*, - java.beans.ConstructorProperties; - - // mandatory charsets - include sun.nio.cs.*; - - exclude sun.nio.cs.AbstractCharsetProvider, - sun.nio.cs.CharsetMapping, - sun.nio.cs.IBM*, - sun.nio.cs.ISO*, - sun.nio.cs.KOI8_*, - sun.nio.cs.MS125*, - sun.nio.cs.UTF_32*, - sun.nio.cs.SingleByteDecoder, - sun.nio.cs.SingleByteEncoder; - - allow sun.nio.cs.ISO_8859_1, - sun.nio.cs.ISO_8859_15, - sun.nio.cs.MS1252; - - include sun.text.*, - sun.text.normalizer.*; - - // resource files - include sun/text/resources/*.icu; - - exclude sun.text.bidi.*, - sun.text.CharArrayCodePointIterator, - sun.text.CharSequenceCodePointIterator, - sun.text.CharacterIteratorCodePointIterator, - sun.text.CodePointIterator; - - include sun.util.*, - sun.util.calendar.*, - sun.util.logging.*, - sun.util.resources.LocaleData, - sun.util.resources.LocaleNamesBundle, - sun.util.resources.OpenListResourceBundle; - - // US_en locale - include sun.text.resources.BreakIteratorInfo, - sun.text.resources.FormatData, - sun.text.resources.FormatData_en_US, - sun.util.resources.CalendarData, - sun.util.resources.CalendarData_en, - sun.util.resources.TimeZoneNames, - sun.util.resources.TimeZoneNames_en, - sun.util.resources.TimeZoneNamesBundle, - sun.util.resources.LocaleNames, - sun.util.resources.LocaleNames_en, - sun.util.resources.LocalenamesBundles, - sun.util.resources.CurrencyNames, - sun.util.resources.CurrencyNames_en_US, - sun.util.EmptyListResourceBundle; - - // resources file needed by - // - sun.misc.ExtensionInfo - // - sun.security.provider.PolicyFile - // - com.sun.security.auth.PolicyFile - include sun.misc.resources.Messages, - sun.security.util.Resources, - sun.security.util.AuthResources; - - // java.nio.channels and java.nio.file not in base - include sun.nio.ch.Interruptible, - sun.nio.ch.DirectBuffer, - sun.nio.ByteBuffered; - - include sun.reflect.**; - - // protocol handlers - include sun.net.www.protocol.file.*, - sun.net.www.protocol.jar.*, - sun.net.www.protocol.http.*; - - include sun.net.*, - sun.net.spi.*, - sun.net.idn.*, - sun.net.util.*, - sun.net.www.*, - sun.net.www.http.*, - sun.net.spi.nameservice.*; - - // resource file for sun.net.idn - include sun/net/idn/*; - - // classes in net-compat - exclude sun.net.Telnet*, sun.net.TransferProtocolClient; - - // classes in deploy - exclude sun.net.www.protocol.http.AuthCacheBridge; - - // classes in security-jsse - exclude java.net.SecureCacheResponse; - - // launcher - include sun.launcher.LauncherHelper, sun.launcher.resources.launcher; - - include sun.misc.*; - exclude sun.misc.FIFOQueueEnumerator, - sun.misc.LIFOQueueEnumerator, - sun.misc.GC, - sun.misc.PerformanceLogger, - sun.misc.Queue, - sun.misc.QueueElement, - sun.misc.Ref, - sun.misc.VMSupport; - - // On Windows, OSEnvironment dependency - include sun.io.Win32ErrorMode; -} - -/**************************************************************************/ - -module charsets { - include sun.nio.cs.ext.**; - - include sun.nio.cs.AbstractCharsetProvider, - sun.nio.cs.CharsetMapping, - sun.nio.cs.IBM*, - sun.nio.cs.ISO*, - sun.nio.cs.KOI8_*, - sun.nio.cs.MS125*, - sun.nio.cs.SingleByte*, - sun.nio.cs.UTF_32*; - - exclude sun.nio.cs.ISO_8859_1, - sun.nio.cs.MS1252; - - // legacy sun.io converters - include sun.io.*; -} - -/**************************************************************************/ - -// For now, retains the current JRE extensions where localedata.jar in jre/lib/ext -module localedata { - include sun.util.resources.*_ar, - sun.util.resources.*_ar_*, - sun.util.resources.*_hi, - sun.util.resources.*_hi_*, - sun.util.resources.*_iw, - sun.util.resources.*_iw_*, - sun.util.resources.*_ja, - sun.util.resources.*_ja_*, - sun.util.resources.*_ko, - sun.util.resources.*_ko_*, - sun.util.resources.*_th, - sun.util.resources.*_th_*, - sun.util.resources.*_vi, - sun.util.resources.*_vi_*, - sun.util.resources.*_zh, - sun.util.resources.*_zh_*; - include sun.text.resources.*_ar, - sun.text.resources.*_ar_*, - sun.text.resources.*_hi, - sun.text.resources.*_hi_*, - sun.text.resources.*_iw, - sun.text.resources.*_iw_*, - sun.text.resources.*_ja, - sun.text.resources.*_ja_*, - sun.text.resources.*_ko, - sun.text.resources.*_ko_*, - sun.text.resources.*_th, - sun.text.resources.*_th_*, - sun.text.resources.*_vi, - sun.text.resources.*_vi_*, - sun.text.resources.*_zh, - sun.text.resources.*_zh_*; -} - -module resources { - include sun.text.resources.*, sun.util.resources.*, sun.misc.resources.*; -} - -/**************************************************************************/ - -module nio { - include java.nio.channels.**, java.nio.file.**, com.sun.nio.file.**; - - // this is excluded from base - include java.io.TempFileHelper; - - // provider implementations and their dependencies - include sun.nio.ch.*, sun.nio.fs.**; - exclude sun.nio.ch.Sctp*; -} - -/**************************************************************************/ - -module pack200 { - include java.util.jar.Pack200*, com.sun.java.util.jar.pack.**; -} - -/**************************************************************************/ - -module logging { - include java.util.logging.*, sun.util.logging.**; - exclude java.util.logging.PlatformLoggingMXBean; - - // Formatter for HTTP messages - include sun.net.www.protocol.http.logging.*; -} - -/**************************************************************************/ - -module management-snmp { - include com.sun.jmx.snmp.**, sun.management.snmp.**; -} - -module management-iiop { - include com.sun.jmx.remote.protocol.iiop.*; - - // stubs and ties - include javax.management.remote.rmi._*, - org.omg.stub.javax.management.remote.rmi.**; -} - -module management { - include java.lang.management.*, com.sun.management.**, sun.management.**; - include javax.management.**, com.sun.jmx.**; - - // other management interfaces - include java.nio.BufferPoolMXBean; - include java.util.logging.PlatformLoggingMXBean; - - // supporting classes in sun.misc - include sun.misc.VMSupport; -} - -/**************************************************************************/ - -module tracing { - // tracing - include com.sun.tracing.**, sun.tracing.**; -} - -module instrument { - // java.lang.instrument - include java.lang.instrument.*, sun.instrument.*; - - // HPROF support - include com.sun.demo.jvmti.hprof.*; - - include tracing; -} - -/**************************************************************************/ - -module rmi-activation { - include java.rmi.activation.**, - sun.rmi.server.Act*, - sun.rmi.server.InactiveGroupException; -} - -module rmic { - // rmic is included in tools - include sun.rmi.rmic.**; -} - -module rmi { - include java.rmi.**, sun.rmi.**, com.sun.rmi.**; - - // SSL factories are in rmi - include javax.rmi.ssl.**; - - // supporting classes in sun.misc and dependencies - include sun.misc.GC; -} - -/**************************************************************************/ - -module prefs { - include java.util.prefs.*; -} - -/**************************************************************************/ - -module security-jsse { - include javax.net.**, - javax.security.cert.*, - java.net.SecureCacheResponse, - com.sun.net.ssl.**, - com.sun.security.cert.internal.x509.*, - sun.security.ssl.*, - sun.net.www.protocol.https.**, - sun.security.internal.interfaces.Tls*, - sun.security.internal.spec.Tls*, - sun.security.util.HostnameChecker; -} - -module security-sunpkcs11 { - include sun.security.pkcs11.**; -} - -module security-sunjce { - include com.sun.crypto.provider.*; -} - -module security-sunec { - include sun.security.ec.*; -} - -module security-sunmscapi { - include sun.security.mscapi.*; -} - -module security-kerberos { - include javax.security.auth.kerberos.*, - com.sun.security.jgss.**, - com.sun.security.auth.module.Krb5LoginModule, - com.sun.security.sasl.gsskerb.**, // GSSAPI SASL mechanism - sun.security.jgss.**, - sun.security.ssl.krb5.**, - sun.security.krb5.**, - org.ietf.jgss.**, - sun.net.www.protocol.http.spnego.*; -} - -module security-sasl { - include javax.security.sasl.**, - com.sun.security.sasl.**; -} - -module security-xmldsig { - include javax.xml.crypto.**, - org.jcp.xml.dsig.**, - com.sun.org.apache.xml.internal.security.**; -} - -module security-smartcardio { - include javax.smartcardio.**, sun.security.smartcardio.**; -} - -module security-auth { - include com.sun.security.auth.**, sun.security.util.AuthResources_*; -} - -module security-misc { - include security-auth; - - include sun.security.pkcs.*, - sun.security.pkcs12.*; - - // this class is a candidate to be removed. - include sun.security.util.BigInt; -} - -module security-resources { - include sun.security.util.Resources_*; -} - -module security-compat { - include java.security.acl.*, sun.security.acl.*; -} - -/**************************************************************************/ - -module jndi-ldap { - include javax.naming.ldap.**, - com.sun.jndi.ldap.**, - com.sun.jndi.url.ldap.*, - com.sun.jndi.url.ldaps.*, - sun.security.provider.certpath.ldap.**; -} - -module jndi-rmiregistry { - include com.sun.jndi.rmi.**, com.sun.jndi.url.rmi.**; -} - -module jndi-dns { - include net-dns; - include com.sun.jndi.dns.**, com.sun.jndi.url.dns.**; -} - -module jndi-cosnaming { - include com.sun.jndi.cosnaming.**, - com.sun.jndi.toolkit.corba.**, - com.sun.jndi.url.corbaname.**, - com.sun.jndi.url.iiop.**, - com.sun.jndi.url.iiopname.**; -} - -// framework/API and classes used by providers -module jndi { - include javax.naming.**, - com.sun.naming.**, - com.sun.jndi.toolkit.ctx.**, - com.sun.jndi.toolkit.dir.**, - com.sun.jndi.toolkit.url.**; -} - -/**************************************************************************/ - -module jdbc-base { - include java.sql.**, javax.sql.*; - exclude javax.sql.XA*; -} - -module jdbc-enterprise { - include javax.sql.**, com.sun.rowset.**; -} - -module jdbc-odbc { - include sun.jdbc.odbc.**; -} - -/**************************************************************************/ - -module scripting { - include javax.script.**; - - // supporting classes for scripting engines - include com.sun.script.util.**; -} - -module scripting-rhino { - include com.sun.script.javascript.**, sun.org.mozilla.javascript.**; -} - -/**************************************************************************/ - -module httpserver { - include com.sun.net.httpserver.**, sun.net.httpserver.**; -} - -/**************************************************************************/ - -module sctp { - // API and dependencies - include com.sun.nio.sctp.**, sun.nio.ch.Sctp*; -} - -/**************************************************************************/ - -module langtools { - include javax.tools.**, javax.lang.model.**, javax.annotation.processing.**; - - // include mirror API for now - include com.sun.mirror.**; - - // include the JSR292 APIs for now - include java.dyn.**, sun.dyn.**; -} - -/**************************************************************************/ - -module beans { - include java.beans.**, com.sun.beans.**, sun.beans.**; -} - -/**************************************************************************/ - -module jaxp-parsers-api { - include javax.xml.*, javax.xml.parsers.**, - org.w3c.dom.**, org.w3c.sax.**, org.xml.sax.**; -} - -module jaxp-api { - include javax.xml.**; - exclude javax.xml.crypto.**, // XML-DSIG - javax.xml.bind.**, // JAX-WS - javax.xml.soap.**, - javax.xml.ws.**; -} - -module jaxp-xerces-impl { - include com.sun.org.apache.xerces.internal.**; - - // include in xerces-impl due to circular dependencies - include com.sun.org.apache.xml.internal.serialize.**, - com.sun.xml.internal.stream.**; - exclude com.sun.xml.internal.stream.buffer.**; // JAX-WS -} - -// required by Xerces and JAX-WS -module jaxp-xerces-resolver { - include com.sun.org.apache.xml.internal.resolver.**; -} - -module jaxp-xalan { - include com.sun.org.apache.xalan.internal.**, - com.sun.org.apache.xpath.internal.**, - com.sun.org.apache.xml.internal.dtm.**, - com.sun.org.apache.xml.internal.res.**, - com.sun.org.apache.xml.internal.serializer.**, - com.sun.org.apache.xml.internal.utils.**, - com.sun.org.apache.bcel.internal.**, - com.sun.org.apache.regexp.internal.**, - com.sun.java_cup.internal.**; -} - -/**************************************************************************/ - -module jaxws-tools { - include com.sun.codemodel.**, - com.sun.xml.internal.dtdparser.**, - com.sun.xml.internal.rngom.**, - com.sun.xml.internal.xsom.**, - com.sun.istack.internal.tools.**, - com.sun.istack.internal.ws.**, - com.sun.tools.internal.xjc.**, - com.sun.tools.internal.ws.**, - com.sun.tools.internal.jxc.**, - org.relaxng.datatype.**; -} - -module jaxws { - include javax.jws.**, - javax.xml.bind.**, - javax.xml.soap.**, - javax.xml.ws.**, - org.relaxng.**, - com.sun.istack.internal.*, - com.sun.istack.internal.localization.*, - com.sun.xml.internal.**; - - // include JAF in this module - include javax.activation.**, com.sun.activation.**; - - include META-INF/mailcap.default, - META-INF/mimetypes.default; -} - -/**************************************************************************/ -module enterprise-base { - include javax.transaction.**, // JTA - javax.annotation.*; // Common annotations (JSR-250) -} - -/**************************************************************************/ -module corba { - include javax.activity.**, - javax.rmi.*, - javax.rmi.CORBA.*, - javax.transaction.**, - com.sun.corba.**, - com.sun.org.omg.**, - org.omg.**, - sun.corba.**; - - // JMX remote API - exclude org.omg.stub.javax.management.**; -} - -/**************************************************************************/ - -module applet { - include java.applet.**, - sun.applet.**; -} - -module awt { - include java.awt.**, - sun.awt.**, - com.sun.awt.**; -} - -module font { - include sun.font.**; -} - -module imageio { - include javax.imageio.**, - com.sun.imageio.**; -} - -module java2d { - include sun.dc.**, - sun.java2d.**, - com.sun.image.**; -} - -module media { - include com.sun.media.**; -} - -module print { - include javax.print.**, - sun.print.**; -} - -module sound { - include javax.sound.**; -} - -module swing { - include javax.swing.**, - sun.swing.**, - // sajdi also contains classes in subpackages of com.sun.java.swing; - // so use '*' instead of '**' - com.sun.java.swing.*, - com.sun.java.swing.plaf.**, - com.sun.swing.**; -} - -module client { - include applet, - awt, - font, - imageio, - java2d, - media, - print, - sound, - swing; - - include javax.accessibility.*, - sun.audio.**, - com.sun.accessibility.**; - - // Bidi class in client module for now - include java.text.Bidi, sun.text.bidi.*; - - // PerformanceLogger and dependencies - include sun.misc.Ref, sun.misc.PerformanceLogger; - - // misc. dependencies that we need to examine - include sun.text.CodePointIterator, - sun.text.Char*, - sun.misc.Queue*, - sun.misc.FIFOQueueEnumerator, - sun.misc.LIFOQueueEnumerator; - - // content handlers - include sun.net.www.content.audio.**, - sun.net.www.content.image.**; -} - -/**************************************************************************/ - -module deploy { - - // For now, all plugin and JNLP - include com.sun.java.browser.**, - netscape.**, - sun.plugin.**, - sun.plugin2.**,, - com.sun.deploy.**, - com.sun.javaws.**, - javax.jnlp.*, - com.sun.jnlp.*; - - // Hook for http authentication - include sun.net.www.protocol.http.AuthCacheBridge; -} - -/**************************************************************************/ - -module net-dns { - include sun.net.dns.**; // to access DNS config. - include sun.net.spi.nameservice.dns.**; // for DNS-only name service. -} - -module net-compat { - // NTLM authentication support - include sun.net.www.protocol.http.ntlm.*; - - // ftp and mail clients - include sun.net.ftp.**, sun.net.smtp.**; - - // Legacy protocol handlers - include sun.net.www.protocol.**; - - // Legacy content handlers - include sun.net.www.content.**; - - include sun.net.Telnet*, - sun.net.TransferProtocolClient; -} - -/**************************************************************************/ - -// jar-tool and security-tools are JRE tools -module jar-tool { - include sun.tools.jar.**; -} - -module policytool { - include sun.security.tools.policytool.*; -} - -module security-tools { - include sun.security.tools.**; - - // Used by security tools - include sun.security.util.PathList, sun.security.x509.CertAndKeyGen; - - exclude sun.security.tools.JarBASE64Encoder, - sun.security.tools.JarSigner, - sun.security.tools.JarSignerParameters, - sun.security.tools.JarSignerResources*, - sun.security.tools.SignatureFile, - sun.security.tools.TimestampedSigner; -} - -module jconsole { - include sun.tools.jconsole.**, - com.sun.tools.jconsole.*; -} - -module serialver { - include sun.tools.serialver.**; -} - -module gui-tools { - include jconsole, - serialver; - - include com.sun.tools.example.debug.bdi.**, - com.sun.tools.example.debug.gui.**, - com.sun.tools.internal.xjc.**; -} - -module attach { - include com.sun.tools.attach.**, - sun.tools.attach.**; -} - -module debugging { - include com.sun.jdi.**, com.sun.tools.jdi.**; -} - -module jdb { - include com.sun.tools.example.debug.**; -} - -module sajdi { - include sun.jvm.hotspot.**, - com.sun.java.swing.ui.**, - com.sun.java.swing.action.**; - - include toolbarButtonGraphics/**; - include sa.properties; -} - -module tools { - include attach, - debugging, - jaxws-tools, - jdb, - rmic, - sajdi; - - // include gui-tools in tools module unless the tool binaries - // are modified to load the new gui-tools.jar - include gui-tools; - - include com.sun.tools.**, sun.tools.**, sun.security.tools.**, - com.sun.jarsigner.**, - com.sun.javac.**, - com.sun.javadoc.**, com.sun.source.**, - sun.jvmstat.**; -} - -/**************************************************************************/ - -module servicetag { - include com.sun.servicetag.**; -} - -/**************************************************************************/ - -// these classes will be removed from JRE - see 6909002 -module inputmethods-ext { - include com.sun.inputmethods.internal.**; -} - -/**************************************************************************/ - -// Workaround for US export and local policy files -// They are currently in signed jars under the jre/lib/security directory -module US_export_policy { - include default_US_export.policy; -} - -module local_policy { - include default_local.policy, - exempt_local.policy; -} - -/**************************************************************************/ - -module other { - include **; -} diff --git a/make/modules/modules.group b/make/modules/modules.group deleted file mode 100644 index fe5f9a0c0661a32932bae0187a2f196c1ee6f99a..0000000000000000000000000000000000000000 --- a/make/modules/modules.group +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -/* - * Example: - * module jdbc { - * include jdbc-base, jdbc-enterprise, jdbc-odbc; - * } - */ diff --git a/make/modules/optional.depconfig b/make/modules/optional.depconfig deleted file mode 100644 index 65aa09c24e210d5170a14ed09f864892c555c333..0000000000000000000000000000000000000000 --- a/make/modules/optional.depconfig +++ /dev/null @@ -1,149 +0,0 @@ -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -# public final java.nio.channels.SocketChannel getChannel() -@Optional - sun.security.ssl.BaseSSLSocketImpl -> java.nio.channels.SocketChannel - -# public XMLDecoder(java.io.InputStream) -# public XMLDecoder(java.io.InputStream, java.lang.Object) -# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener) -# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader) -# public XMLDecoder(org.xml.sax.InputSource) -@Optional - java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler - java.beans.XMLDecoder -> org.xml.sax.InputSource - -# public static org.xml.sax.helpers.DefaultHandler createHandler(java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader) -@Optional - java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler - java.beans.XMLDecoder -> org.xml.sax.helpers.DefaultHandler - -# public final java.nio.channels.FileChannel getChannel() -@Optional - java.net.SocketInputStream -> java.nio.channels.FileChannel - -# public final java.nio.channels.FileChannel getChannel() -@Optional - java.net.SocketOutputStream -> java.nio.channels.FileChannel - -# public Scanner(java.io.File) -# public Scanner(java.io.File, java.lang.String) -@Optional - java.util.Scanner -> java.nio.channels.ReadableByteChannel - java.util.Scanner -> java.nio.channels.Channels - -# public Scanner(java.nio.file.FileRef) -# public Scanner(java.nio.file.FileRef, java.lang.String) -@Optional - java.util.Scanner -> java.nio.file.FileRef - java.util.Scanner -> java.nio.file.OpenOption - -# public Scanner(java.nio.channels.ReadableByteChannel) -# public Scanner(java.nio.channels.ReadableByteChannel, java.lang.String) -@Optional - java.util.Scanner -> java.nio.channels.ReadableByteChannel - java.util.Scanner -> java.nio.channels.Channels - -# private static void loadSnmpAgent(java.lang.String, java.util.Properties) -@Optional - sun.management.Agent -> sun.management.snmp.AdaptorBootstrap - -# public void connect() -@Optional - sun.net.www.protocol.http.HttpURLConnection -> java.net.SecureCacheResponse - -# private static sun.security.util.PermissionFactory permissionFactory() -@Optional - sun.security.util.SecurityConstants$AWT -> sun.awt.AWTPermissionFactory - -# sun.util.logging.LoggingSupport -@Optional - sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl - -# public java.nio.channels.DatagramChannel getChannel() -@Optional - java.net.DatagramSocket -> java.nio.channels.DatagramChannel - -# public java.nio.channels.SocketChannel getChannel() -@Optional - java.net.Socket -> java.nio.channels.SocketChannel - -# public java.nio.channels.ServerSocketChannel getChannel() -@Optional - java.net.ServerSocket -> java.nio.channels.ServerSocketChannel - -# public final java.nio.channels.FileChannel getChannel() -@Optional - java.io.RandomAccessFile -> java.nio.channels.FileChannel - java.io.RandomAccessFile -> sun.nio.ch.FileChannelImpl - -# public static sun.nio.cs.StreamDecoder forDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int) -@Optional - sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel - -# private static java.nio.channels.FileChannel getChannel(java.io.FileInputStream) -# StreamDecoder(java.io.InputStream, java.lang.Object, java.nio.charset.CharsetDecoder) -@Optional - sun.nio.cs.StreamDecoder -> java.nio.channels.FileChannel - -# StreamDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int) -@Optional - sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel - -# public static java.io.File createTemporaryFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute[]) -@Optional - java.io.File -> java.io.TempFileHelper - java.io.File -> java.nio.file.attribute.FileAttribute - -# public java.nio.file.Path toPath() -@Optional - java.io.File -> java.nio.file.Paths - java.io.File -> java.nio.file.Path - -# public static sun.nio.cs.StreamEncoder forEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int) -# private StreamEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int) -@Optional - sun.nio.cs.StreamEncoder -> java.nio.channels.WritableByteChannel - -# public java.nio.channels.FileChannel getChannel() -@Optional - java.io.FileOutputStream -> java.nio.channels.FileChannel - java.io.FileOutputStream -> sun.nio.ch.FileChannelImpl - -# public java.nio.channels.FileChannel getChannel() -@Optional - java.io.FileInputStream -> java.nio.channels.FileChannel - java.io.FileInputStream -> sun.nio.ch.FileChannelImpl - -# public void loadFromXML(java.io.InputStream) -# public void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String) -@Optional - java.util.Properties -> java.util.XMLUtils - -# public static java.nio.channels.Channel inheritedChannel() -@Optional - java.lang.System -> java.nio.channels.Channel - java.lang.System -> java.nio.channels.spi.SelectorProvider diff --git a/make/modules/tools/Makefile b/make/modules/tools/Makefile deleted file mode 100644 index d630469c9fd12ec8cb0e1999ee4cbda39e7d409d..0000000000000000000000000000000000000000 --- a/make/modules/tools/Makefile +++ /dev/null @@ -1,154 +0,0 @@ -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -# -# Makefile for building the classanalyzer tool -# - -BUILDDIR = ../.. -include $(BUILDDIR)/common/Defs.gmk - -PKGDIR = com/sun/classanalyzer -BUILDTOOL_SOURCE_ROOT = src -BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java -BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%)) - -BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN) -BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/classanalyzer_manifest.mf - -FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \ - && $(FIND) $(PKGDIR) -type f -print) - -FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) - -CLASSANALYZER_JAR_FILE = $(BUILDTOOLJARDIR)/classanalyzer.jar - -# -# ClassAnalyzer depends on the com.sun.tools.classfile API. -# The tool is compiled with the latest version of the classfile -# library in the langtools repo to make sure that synchronized -# change is made if the classfile API is changed. -# -# If langtools repo exists, build its own copy of the -# classfile library and use it for compile time and runtime. -# If not exist (the top level repo is not a forest), use -# the built jdk tools that imports tools.jar from the latest -# promoted build. -# -# If the classfile API is changed but not yet in a promoted build, -# the build might fail and the tool would need the langtools repo -# to build in that case. -# -ifndef LANGTOOLS_TOPDIR - LANGTOOLS_TOPDIR=$(JDK_TOPDIR)/../langtools -endif - -LANGTOOLS_TOPDIR_EXISTS := $(shell \ - if [ -d $(LANGTOOLS_TOPDIR) ] ; then \ - echo true; \ - else \ - echo false; \ - fi) - -CLASSFILE_SRC = $(LANGTOOLS_TOPDIR)/src/share/classes -CLASSFILE_PKGDIR = com/sun/tools/classfile - -ifeq ($(LANGTOOLS_TOPDIR_EXISTS), true) - FILES_classfile_java := $(shell \ - $(CD) $(CLASSFILE_SRC) && \ - $(FIND) $(CLASSFILE_PKGDIR) -name '*.java' -print) - FILES_classfile_class = $(FILES_classfile_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) - CLASSFILE_JAR_FILE = $(BUILDTOOLJARDIR)/classfile.jar - BUILDTOOL_JAVAC = $(BOOT_JAVAC_CMD) $(JAVAC_JVM_FLAGS) \ - $(BOOT_JAVACFLAGS) -classpath $(CLASSFILE_JAR_FILE) - BUILDTOOL_JAVA = $(BOOT_JAVA_CMD) $(JAVA_TOOLS_FLAGS) \ - -Xbootclasspath/p:$(CLASSFILE_JAR_FILE) -else - # if langtools doesn't exist, use tools from the built jdk - BUILDTOOL_JAVAC = $(BINDIR)/javac $(JAVAC_JVM_FLAGS) \ - $(BOOT_JAVACFLAGS) - BUILDTOOL_JAVA = $(BINDIR)/java $(JAVA_TOOLS_FLAGS) -endif - -# Location of the output modules.list, .classlist -# and other output files generated by the class analyzer tool. -# -MODULE_CLASSLIST = $(MODULES_TEMPDIR)/classlist - -all build: classanalyzer gen-classlist - -classanalyzer: $(CLASSFILE_JAR_FILE) $(CLASSANALYZER_JAR_FILE) - -gen-classlist: - @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." - @$(RM) -rf $(MODULE_CLASSLIST) - @$(MKDIR) -p $(MODULE_CLASSLIST) - $(BUILDTOOL_JAVA) \ - -Dclassanalyzer.debug \ - -jar $(CLASSANALYZER_JAR_FILE) \ - -jdkhome $(OUTPUTDIR) \ - -config ../modules.config \ - -config ../modules.group \ - -depconfig ../jdk7.depconfig \ - -depconfig ../optional.depconfig \ - -showdynamic \ - -output $(MODULE_CLASSLIST) - @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." - -$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE) - @$(prep-target) - $(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@ - -$(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)/%.class : $(CLASSFILE_SRC)/$(CLASSFILE_PKGDIR)/%.java - @$(prep-target) - @$(BUILDTOOL_JAVAC) \ - -sourcepath $(CLASSFILE_SRC) \ - -d $(BUILDTOOLCLASSDIR) $< - -$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java - @$(prep-target) - $(BUILDTOOL_JAVAC) \ - -sourcepath $(BUILDTOOL_SOURCE_ROOT) \ - -d $(BUILDTOOLCLASSDIR) $< - -$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class) - @$(prep-target) - $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ - -C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ - @$(java-vm-cleanup) - -$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class) - @$(prep-target) - $(CD) $(BUILDTOOLCLASSDIR) && \ - $(BOOT_JAR_CMD) cf $@ \ - $(CLASSFILE_PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ - @$(java-vm-cleanup) - -clean clobber:: - @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR) - @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR) - @$(RM) $(BUILDTOOL_MANIFEST_FILE) - @$(RM) $(CLASSANALYZER_JAR_FILE) - @$(RM) $(CLASSFILE_JAR_FILE) diff --git a/make/modules/tools/build.xml b/make/modules/tools/build.xml deleted file mode 100644 index f8fe430578e91b6855d72e709f5a466d89c8b377..0000000000000000000000000000000000000000 --- a/make/modules/tools/build.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - diff --git a/make/modules/tools/nbproject/project.properties b/make/modules/tools/nbproject/project.properties deleted file mode 100644 index 4bbbab441102d717fc55bd5c0282479f6b46e22c..0000000000000000000000000000000000000000 --- a/make/modules/tools/nbproject/project.properties +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -application.title=classanalyzer -application.vendor=mchung -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form - -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources - -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results - -cp.extra=${tools.jar} - -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} - -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/classanalyzer.jar -dist.javadoc.dir=${dist.dir}/javadoc - -excludes= - -file.reference.tools.jar=${jdk.home}/lib/tools.jar -file.reference.tools-src=src -includes=** -jar.compress=false -javac.classpath=\ - ${file.reference.tools.jar} -javac.deprecation=false -javac.source=1.5 -javac.target=1.5 -javac.test.classpath= -javadoc.author=false -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=false -javadoc.use=false -javadoc.version=false -main.class=com.sun.classanalyzer.ClassAnalyzer -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -platform.active=JDK_1.6 -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs=-Xmx256m -run.test.classpath= -source.encoding=UTF-8 -src.dir=${file.reference.tools-src} diff --git a/make/modules/tools/nbproject/project.xml b/make/modules/tools/nbproject/project.xml deleted file mode 100644 index 895074bb42c6756c06920b191bb2054ed0e2eb17..0000000000000000000000000000000000000000 --- a/make/modules/tools/nbproject/project.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - org.netbeans.modules.java.j2seproject - - - classanalyzer - - - - - - - - diff --git a/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java b/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java deleted file mode 100644 index a713eb1e54def1f6dbdcdcad284e0d11b0781c95..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.Map; - -import com.sun.classanalyzer.Module.Reference; -import java.util.LinkedList; -import java.util.TreeMap; - -/** - * - * @author Mandy Chung - */ -public abstract class AnnotatedDependency implements Comparable { - - final Klass from; - final List classes; - protected boolean optional; - String description; - Klass.Method method; - private List filters = null; - - public AnnotatedDependency(Klass klass) { - this(klass, false); - } - - public AnnotatedDependency(Klass klass, boolean optional) { - this.from = klass; - this.classes = new ArrayList(); - this.optional = optional; - } - - abstract String getTag(); - - abstract boolean isDynamic(); - - void setMethod(Klass.Method m) { - this.method = m; - } - - void addElement(String element, List value) { - if (element.equals("value")) { - addValue(value); - } else if (element.equals("description")) { - description = value.get(0); - } else if (element.equals("optional")) { - optional = value.get(0).equals("1") || Boolean.parseBoolean(value.get(0)); - } - } - - void addValue(List value) { - for (String s : value) { - if ((s = s.trim()).length() > 0) { - classes.add(s); - } - } - } - - List getValue() { - return classes; - } - - boolean isOptional() { - return optional; - } - - boolean isEmpty() { - return classes.isEmpty(); - } - - boolean matches(String classname) { - synchronized (this) { - // initialize filters - if (filters == null) { - filters = new ArrayList(); - for (String pattern : classes) { - filters.add(new Filter(pattern)); - } - - } - } - - for (Filter f : filters) { - if (f.matches(classname)) { - return true; - } - } - return false; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - for (String v : getValue()) { - if (sb.length() == 0) { - sb.append(getTag()); - sb.append("\n"); - } else { - sb.append("\n"); - } - sb.append(" "); - sb.append(from.getClassName()).append(" -> "); - sb.append(v); - } - return sb.toString(); - } - - @Override - public int compareTo(AnnotatedDependency o) { - if (from == o.from) { - if (this.getClass().getName().equals(o.getClass().getName())) { - String s1 = classes.isEmpty() ? "" : classes.get(0); - String s2 = o.classes.isEmpty() ? "" : o.classes.get(0); - return s1.compareTo(s2); - } else { - return this.getClass().getName().compareTo(o.getClass().getName()); - } - - } else { - return from.compareTo(o.from); - } - } - - @Override - public int hashCode() { - int hashcode = 7 + 73 * from.hashCode(); - for (String s : classes) { - hashcode ^= s.hashCode(); - } - return hashcode; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof AnnotatedDependency)) { - return false; - } - AnnotatedDependency other = (AnnotatedDependency) obj; - boolean ret = this.from.equals(other.from) && this.classes.size() == other.classes.size(); - if (ret == true) { - for (int i = 0; i < this.classes.size(); i++) { - ret = ret && this.classes.get(i).equals(other.classes.get(i)); - } - } - return ret; - } - - static class ClassForName extends AnnotatedDependency { - - public ClassForName(Klass klass, boolean optional) { - super(klass, optional); - } - - @Override - String getTag() { - if (this.optional) { - return TAG + "(optional)"; - } else { - return TAG; - } - } - - @Override - boolean isDynamic() { - return true; - } - static final String TYPE = "sun.annotation.ClassForName"; - static final String TAG = "@ClassForName"; - } - - static class NativeFindClass extends AnnotatedDependency { - - public NativeFindClass(Klass klass, boolean optional) { - super(klass, optional); - } - - @Override - String getTag() { - if (this.optional) { - return TAG + "(optional)"; - } else { - return TAG; - } - } - - @Override - boolean isDynamic() { - return true; - } - static final String TYPE = "sun.annotation.NativeFindClass"; - static final String TAG = "@NativeFindClass"; - } - - static class Provider extends AnnotatedDependency { - - private List services = new ArrayList(); - - Provider(Klass klass) { - super(klass, true); - } - - @Override - boolean isDynamic() { - return true; - } - - public List services() { - return services; - } - - @Override - void addElement(String element, List value) { - if (element.equals("service")) { - List configFiles = new ArrayList(); - for (String s : value) { - if ((s = s.trim()).length() > 0) { - configFiles.add(metaInfPath + s); - } - } - addValue(configFiles); - } - } - - @Override - void addValue(List value) { - for (String s : value) { - if ((s = s.trim()).length() > 0) { - if (s.startsWith("META-INF")) { - services.add(s); - readServiceConfiguration(s, classes); - } else { - throw new RuntimeException("invalid value" + s); - } - } - } - } - - boolean isEmpty() { - return services.isEmpty(); - } - static final String metaInfPath = - "META-INF" + File.separator + "services" + File.separator; - - static void readServiceConfiguration(String config, List names) { - BufferedReader br = null; - try { - InputStream is = ClassPath.open(config); - if (is != null) { - // Properties doesn't perserve the order of the input file - br = new BufferedReader(new InputStreamReader(is, "utf-8")); - int lc = 1; - while ((lc = parseLine(br, lc, names)) >= 0); - } - } catch (IOException ex) { - throw new RuntimeException(ex); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - } - } - - // Parse a single line from the given configuration file, adding the name - // on the line to the names list. - // - private static int parseLine(BufferedReader r, int lc, List names) throws IOException { - String ln = r.readLine(); - if (ln == null) { - return -1; - } - int ci = ln.indexOf('#'); - if (ci >= 0) { - ln = ln.substring(0, ci); - } - ln = ln.trim(); - int n = ln.length(); - if (n != 0) { - if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) { - throw new RuntimeException("Illegal configuration-file syntax"); - } - int cp = ln.codePointAt(0); - if (!Character.isJavaIdentifierStart(cp)) { - throw new RuntimeException("Illegal provider-class name: " + ln); - } - for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { - cp = ln.codePointAt(i); - if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) { - throw new RuntimeException("Illegal provider-class name: " + ln); - } - } - if (!names.contains(ln)) { - names.add(ln); - } - } - return lc + 1; - } - - @Override - String getTag() { - return TAG; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof AnnotatedDependency)) { - return false; - } - Provider other = (Provider) obj; - boolean ret = this.from.equals(other.from) && - this.services.size() == other.services.size(); - if (ret == true) { - for (int i = 0; i < this.services.size(); i++) { - ret = ret && this.services.get(i).equals(other.services.get(i)); - } - } - return ret; - } - - @Override - public int hashCode() { - int hashcode = 7 + 73 * from.hashCode(); - for (String s : services) { - hashcode ^= s.hashCode(); - } - return hashcode; - } - - @Override - public List getValue() { - List result = new ArrayList(); - result.addAll(services); - return result; - } - static final String TYPE = "sun.annotation.Provider"; - static final String TAG = "@Provider"; - } - - static class OptionalDependency extends AnnotatedDependency { - - static boolean isOptional(Klass from, Klass to) { - synchronized (OptionalDependency.class) { - if (optionalDepsMap == null) { - // Build a map of classes to its optional dependencies - initDependencies(); - } - } - for (Reference ref : optionalDepsMap.keySet()) { - if (ref.referrer() == from && ref.referree() == to) { - return true; - } - } - return false; - } - - OptionalDependency(Klass klass) { - super(klass, true); - } - - @Override - boolean isDynamic() { - return false; - } - - @Override - String getTag() { - return TAG; - } - static final String TYPE = "sun.annotation.Optional"; - static final String TAG = "@Optional"; - } - - static class CompilerInline extends AnnotatedDependency { - - public CompilerInline(Klass klass) { - super(klass); - } - - @Override - String getTag() { - return TAG; - } - - @Override - boolean isDynamic() { - return false; - } - static final String TYPE = "sun.annotation.Inline"; - static final String TAG = "@Inline"; - } - - static class Filter { - - final String pattern; - final String regex; - - Filter(String pattern) { - this.pattern = pattern; - - boolean isRegex = false; - for (int i = 0; i < pattern.length(); i++) { - char p = pattern.charAt(i); - if (p == '*' || p == '[' || p == ']') { - isRegex = true; - break; - } - } - - if (isRegex) { - this.regex = convertToRegex(pattern); - } else { - this.regex = null; - } - } - - private String convertToRegex(String pattern) { - StringBuilder sb = new StringBuilder(); - int i = 0; - int index = 0; - int plen = pattern.length(); - while (i < plen) { - char p = pattern.charAt(i); - if (p == '*') { - sb.append("(").append(pattern.substring(index, i)).append(")"); - if (i + 1 < plen && pattern.charAt(i + 1) == '*') { - sb.append(".*"); - index = i + 2; - } else { - sb.append("[^\\.]*"); - index = i + 1; - } - } else if (p == '[') { - int j = i + 1; - while (j < plen) { - if (pattern.charAt(j) == ']') { - break; - } - j++; - } - if (j >= plen || pattern.charAt(j) != ']') { - throw new RuntimeException("Malformed pattern " + pattern); - } - sb.append("(").append(pattern.substring(index, i)).append(")"); - sb.append(pattern.substring(i, j + 1)); - index = j + 1; - i = j; - } - i++; - } - if (index < plen) { - sb.append("(").append(pattern.substring(index, plen)).append(")"); - } - return sb.toString(); - } - - boolean matches(String name) { - if (regex == null) { - // the pattern is not a regex - return name.equals(pattern); - } else { - return name.matches(regex); - } - } - } - - static boolean isValidType(String type) { - if (type.endsWith("(optional)")) { - int len = type.length() - "(optional)".length(); - type = type.substring(0, len); - } - return type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG) || - type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG) || - type.equals(Provider.TYPE) || type.equals(Provider.TAG) || - type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG) || - type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG); - } - - static AnnotatedDependency newAnnotatedDependency(String tag, String value, Klass klass) { - AnnotatedDependency dep = newAnnotatedDependency(tag, klass); - if (dep != null) { - dep.addValue(Collections.singletonList(value)); - } - return dep; - } - static List annotatedDependencies = new LinkedList(); - static List optionalDependencies = new LinkedList(); - - static AnnotatedDependency newAnnotatedDependency(String type, Klass klass) { - boolean optional = false; - if (type.endsWith("(optional)")) { - optional = true; - int len = type.length() - "(optional)".length(); - type = type.substring(0, len); - } - - if (type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG)) { - return newOptionalDependency(klass); - } - - AnnotatedDependency dep; - if (type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG)) { - dep = new ClassForName(klass, optional); - } else if (type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG)) { - dep = new NativeFindClass(klass, optional); - } else if (type.equals(Provider.TYPE) || type.equals(Provider.TAG)) { - dep = new Provider(klass); - } else if (type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG)) { - dep = new CompilerInline(klass); - } else { - return null; - } - klass.addAnnotatedDep(dep); - annotatedDependencies.add(dep); - return dep; - } - - static OptionalDependency newOptionalDependency(Klass klass) { - OptionalDependency dep = new OptionalDependency(klass); - optionalDependencies.add(dep); - return dep; - } - static Map> annotatedDepsMap = null; - static Map> optionalDepsMap = null; - - static Map> getReferences(Module m) { - // ensure it's initialized - initDependencies(); - - Map> result = new TreeMap>(); - for (Reference ref : annotatedDepsMap.keySet()) { - if (m.contains(ref.referrer()) && m.isModuleDependence(ref.referree())) { - result.put(ref, annotatedDepsMap.get(ref)); - } - } - return result; - } - - static Set getDependencies(Module m) { - // ensure it's initialized - initDependencies(); - - Set deps = new TreeSet(); - for (Reference ref : annotatedDepsMap.keySet()) { - if (m.contains(ref.referrer())) { - Module other = m.getModuleDependence(ref.referree()); - if (other != null) { - for (AnnotatedDependency ad : annotatedDepsMap.get(ref)) { - Module.Dependency d = new Module.Dependency(other, ad.isOptional(), ad.isDynamic()); - deps.add(d); - } - } - } - } - return deps; - } - - synchronized static void initDependencies() { - if (annotatedDepsMap != null) { - return; - } - - // Build a map of references to its dependencies - annotatedDepsMap = new TreeMap>(); - optionalDepsMap = new TreeMap>(); - - for (Klass k : Klass.getAllClasses()) { - for (AnnotatedDependency ad : annotatedDependencies) { - if (ad.matches(k.getClassName())) { - Reference ref = new Reference(ad.from, k); - Set set = annotatedDepsMap.get(ref); - if (set == null) { - set = new TreeSet(); - annotatedDepsMap.put(ref, set); - } - set.add(ad); - } - } - - for (AnnotatedDependency ad : optionalDependencies) { - if (ad.matches(k.getClassName())) { - Reference ref = new Reference(ad.from, k); - Set set = optionalDepsMap.get(ref); - if (set == null) { - set = new TreeSet(); - optionalDepsMap.put(ref, set); - } - set.add(ad); - } - } - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java b/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java deleted file mode 100644 index 4d35635f467c266d0e27f31b4f1644286f2cf33d..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.tools.classfile.*; -import com.sun.tools.classfile.Annotation; -import com.sun.tools.classfile.ExtendedAnnotation; -import com.sun.tools.classfile.Annotation.Annotation_element_value; -import com.sun.tools.classfile.Annotation.Array_element_value; -import com.sun.tools.classfile.Annotation.Class_element_value; -import com.sun.tools.classfile.Annotation.Enum_element_value; -import com.sun.tools.classfile.Annotation.Primitive_element_value; -import com.sun.tools.classfile.ConstantPoolException; -import com.sun.tools.classfile.Descriptor; -import com.sun.tools.classfile.Descriptor.InvalidDescriptor; -import java.util.ArrayList; -import java.util.List; - -import com.sun.classanalyzer.AnnotatedDependency.*; -import java.io.File; -import java.io.PrintWriter; -import java.util.Map; -import java.util.Set; - -/** - * - * @author Mandy Chung - */ -public class AnnotationParser { - - static boolean parseAnnotation = false; - static void setParseAnnotation(boolean newValue) { - parseAnnotation = newValue; - } - - private final ClassFileParser cfparser; - public AnnotationParser(ClassFileParser cfparser) { - this.cfparser = cfparser; - } - - private AnnotatedDependency addAnnotation(Annotation annot, Klass.Method method) { - String type = getType(annot.type_index); - AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, cfparser.this_klass); - if (dep != null) { - for (int i = 0; i < annot.num_element_value_pairs; i++) { - Element element = getElement(annot.element_value_pairs[i]); - dep.addElement(element.name, element.value); - } - dep.setMethod(method); - } - return dep; - } - - private AnnotatedDependency addAnnotation(ExtendedAnnotation annot, Klass.Method method) { - return addAnnotation(annot.annotation, method); - } - - class Element { - - String name; - List value; - - Element(String name) { - this.name = name; - this.value = new ArrayList(); - } - - void add(String v) { - value.add(v); - } - } - - Element getElement(Annotation.element_value_pair pair) { - Element element = new Element(getName(pair.element_name_index)); - evp.parse(pair.value, element); - return element; - } - - private String getType(int index) { - try { - Descriptor d = new Descriptor(index); - return d.getFieldType(cfparser.classfile.constant_pool); - } catch (ConstantPoolException ignore) { - } catch (InvalidDescriptor ignore) { - } - return "Unknown"; - } - - private String getName(int index) { - return cfparser.constantPoolParser.stringValue(index); - } - element_value_Parser evp = new element_value_Parser(); - - class element_value_Parser implements Annotation.element_value.Visitor { - - public Void parse(Annotation.element_value value, Element element) { - value.accept(this, element); - return null; - } - - public Void visitPrimitive(Primitive_element_value ev, Element element) { - String value = getName(ev.const_value_index); - element.add(value); - return null; - } - - public Void visitEnum(Enum_element_value ev, Element element) { - String value = getName(ev.type_name_index) + "." + getName(ev.const_name_index); - element.add(value); - return null; - } - - public Void visitClass(Class_element_value ev, Element element) { - String value = getName(ev.class_info_index) + ".class"; - element.add(value); - return null; - } - - public Void visitAnnotation(Annotation_element_value ev, Element element) { - // AnnotationParser.this.addAnnotation(ev.annotation_value); - throw new UnsupportedOperationException("Not supported: " + ev); - } - - public Void visitArray(Array_element_value ev, Element element) { - for (int i = 0; i < ev.num_values; i++) { - parse(ev.values[i], element); - } - return null; - } - } - - void parseAttributes(Attributes attributes, Klass.Method method) { - if (!parseAnnotation) { - return; - } - - visitRuntimeAnnotations((RuntimeVisibleAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleAnnotations), method); - visitRuntimeAnnotations((RuntimeInvisibleAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleAnnotations), method); - visitRuntimeTypeAnnotations((RuntimeVisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleTypeAnnotations), method); - visitRuntimeTypeAnnotations((RuntimeInvisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleTypeAnnotations), method); - visitRuntimeParameterAnnotations((RuntimeVisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleParameterAnnotations), method); - visitRuntimeParameterAnnotations((RuntimeInvisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleParameterAnnotations), method); - } - - public void visitRuntimeAnnotations(RuntimeAnnotations_attribute attr, Klass.Method method) { - if (attr == null) { - return; - } - - for (int i = 0; i < attr.annotations.length; i++) { - addAnnotation(attr.annotations[i], method); - } - } - - public void visitRuntimeTypeAnnotations(RuntimeTypeAnnotations_attribute attr, Klass.Method method) { - if (attr == null) { - return; - } - - for (int i = 0; i < attr.annotations.length; i++) { - addAnnotation(attr.annotations[i], method); - } - } - - public void visitRuntimeParameterAnnotations(RuntimeParameterAnnotations_attribute attr, Klass.Method method) { - if (attr == null) { - return; - } - - for (int param = 0; param < attr.parameter_annotations.length; param++) { - for (int i = 0; i < attr.parameter_annotations[param].length; i++) { - addAnnotation(attr.parameter_annotations[param][i], method); - } - } - } - - void parseAttributes(Attributes attributes) { - parseAttributes(attributes, null); - } - - public static void main(String[] args) throws Exception { - String jdkhome = null; - String output = "."; - - // process arguments - int i = 0; - while (i < args.length) { - String arg = args[i++]; - if (arg.equals("-jdkhome")) { - if (i < args.length) { - jdkhome = args[i++]; - } else { - usage(); - } - } else if (arg.equals("-output")) { - output = args[i++]; - } else { - usage(); - } - } - if (jdkhome == null) { - usage(); - } - - // parse annotation and code attribute to find all references - // to Class.forName etc - CodeAttributeParser.setParseCodeAttribute(true); - AnnotationParser.setParseAnnotation(true); - - ClassPath.setJDKHome(jdkhome); - ClassPath.parseAllClassFiles(); - - PrintWriter writer = new PrintWriter(new File(output, "jdk7.depconfig")); - - try { - for (Klass k : Klass.getAllClasses()) { - for (AnnotatedDependency dep : k.getAnnotatedDeps()) { - if (dep.isEmpty()) { - continue; - } - writer.format("# %s \n", dep.method == null ? dep.from : dep.method); - writer.format("%s\n\n", dep); - } - } - } finally { - writer.close(); - } - - writer = new PrintWriter(new File(output, "optional.depconfig")); - try { - AnnotatedDependency prev = null; - for (AnnotatedDependency dep : AnnotatedDependency.optionalDependencies) { - if (prev != null && !dep.equals(prev)) { - writer.format("%s\n\n", prev); - } - writer.format("# %s \n", dep.method == null ? dep.from : dep.method); - prev = dep; - } - if (prev != null) { - writer.format("%s\n\n", prev); - } - } finally { - writer.close(); - } - - writer = new PrintWriter(new File(output, "runtime.references")); - try { - for (Map.Entry> entry : CodeAttributeParser.runtimeReferences.entrySet()) { - writer.format("References to %s\n", entry.getKey()); - Klass prev = null; - for (Klass.Method m : entry.getValue()) { - if (prev == null || prev != m.getKlass()) { - writer.format(" %-50s # %s\n", m.getKlass(), m); - } else if (prev == m.getKlass()) { - writer.format(" %-50s # %s\n", "", m); - } - prev = m.getKlass(); - } - } - } finally { - writer.close(); - } - } - - private static void usage() { - System.out.println("Usage: AnnotationParser "); - System.out.println("Options: "); - System.out.println("\t-jdkhome where all jars will be parsed"); - System.out.println("\t-depconfig "); - System.out.println("\t-optional "); - System.exit(-1); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java deleted file mode 100644 index 3c7f3591d10ff30a59b084629ebb3213d4e167a7..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.File; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import com.sun.tools.classfile.*; -import com.sun.tools.classfile.ConstantPool.*; -import static com.sun.tools.classfile.ConstantPool.*; -import com.sun.tools.classfile.Instruction.TypeKind; -import com.sun.tools.classfile.Type.*; - -/** - * Generate the module config for the boot module with - * a given set of roots (classes or methods) and exclude list. - * - * This tool does method-level dependency analysis starting - * from the root set and follows references transitively as follows: - *
    - *
  • For a given class, it will parse the ClassFile to - * find its superclass and superinterfaces and also - * its static initializer <clinit>.
  • - *
  • For each method, it will parse its Code attribute - * to look for a Methodref, Fieldref, and InterfaceMethodref. - *
  • - *
  • For each Fieldref, it will include the type of - * the field in the dependency.
  • - *
  • For each MethodRef, it will follow all references in - * that method.
  • - *
  • For each InterfaceMethodref, it will follow all references in - * that method defined its implementation classes in - * the resulting dependency list.
  • - *
- * - * Limitation: - *
    - *
  • For each Methodref, it only parses the method of - * the specified type. It doesn't analyze the class hierarchy - * and follow references of its subclasses since it ends up - * pulls in many unnecessary dependencies. For now, - * the list of subclasses and methods need to be listed in - * the root set.
  • - *
- * - * @author Mandy Chung - */ -public class BootAnalyzer { - - public static void main(String[] args) throws Exception { - String jdkhome = null; - String config = null; - String output = "."; - boolean printClassList = false; - - // process arguments - int i = 0; - while (i < args.length) { - String arg = args[i++]; - if (arg.equals("-jdkhome")) { - if (i < args.length) { - jdkhome = args[i++]; - } else { - usage(); - } - } else if (arg.equals("-config")) { - config = args[i++]; - } else if (arg.equals("-output")) { - output = args[i++]; - } else if (arg.equals("-classlist")) { - printClassList = true; - } else { - usage(); - } - } - - - - if (jdkhome == null || config == null) { - usage(); - } - - File jre = new File(jdkhome, "jre"); - if (jre.exists()) { - ClassPath.setJDKHome(jdkhome); - } else { - File classes = new File(jdkhome, "classes"); - if (classes.exists()) { - ClassPath.setClassPath(classes.getCanonicalPath()); - } else { - throw new RuntimeException("Invalid jdkhome: " + jdkhome); - } - } - - parseConfigFile(config); - followRoots(); - - // create output directory if it doesn't exist - File dir = new File(output); - if (!dir.isDirectory()) { - if (!dir.exists()) { - boolean created = dir.mkdir(); - if (!created) { - throw new RuntimeException("Unable to create `" + dir + "'"); - } - } - } - - String bootmodule = "boot"; - String bootconfig = resolve(dir, bootmodule, "config"); - printBootConfig(bootconfig, bootmodule); - - List list = ModuleConfig.readConfigurationFile(bootconfig); - Module module = Module.addModule(list.get(0)); - for (Klass k : Klass.getAllClasses()) { - module.addKlass(k); - } - module.fixupDependencies(); - - if (printClassList) { - module.printClassListTo(resolve(dir, bootmodule, "classlist")); - module.printSummaryTo(resolve(dir, bootmodule, "summary")); - } - } - - // print boot.config file as an input to the ClassAnalyzer - private static void printBootConfig(String output, String bootmodule) throws IOException { - - File f = new File(output); - PrintWriter writer = new PrintWriter(f); - try { - int count = 0; - writer.format("module %s {%n", bootmodule); - for (Klass k : Klass.getAllClasses()) { - if (count++ == 0) { - writer.format("%4s%7s %s", "", "include", k); - } else { - writer.format(",%n"); - writer.format("%4s%7s %s", "", "", k); - } - } - writer.format(";%n}%n"); - } finally { - writer.close(); - } - } - - private static String resolve(File dir, String mname, String suffix) { - File f = new File(dir, mname + "." + suffix); - return f.toString(); - - } - static List methods = new LinkedList(); - static Deque pending = new ArrayDeque(); - static Deque interfaceMethodRefs = new ArrayDeque(); - static Filter filter = new Filter(); - - private static void followRoots() throws IOException { - MethodDescriptor md = null; - - while ((md = pending.poll()) != null) { - if (!methods.contains(md)) { - methods.add(md); - if (md.classname.isEmpty()) { - trace("Warning: class missing %s%n", md); - continue; - } - - if (filter.isExcluded(md.classname)) { - trace("excluded %s%n", md); - } else { - KlassInfo kinfo = getKlassInfo(md.classname); - if (kinfo.classname.contains("$")) { - int pos = kinfo.classname.lastIndexOf('$'); - String outer = kinfo.classname.substring(0, pos); - if (!cache.containsKey(outer)) { - trace(" include outer class %s%n", outer); - getKlassInfo(outer).ensureParse(); - } - } - - kinfo.ensureParse(); - if (md.methodname.length() > 0) { - if (filter.isExcluded(md.name)) { - trace("excluded %s%n", md); - } else { - if (md.interfaceMethodRef) { - trace("interface methodref %s%n", md); - interfaceMethodRefs.add(md); - } else { - List descriptors = kinfo.parse(md); - if (descriptors.isEmpty()) { - if (kinfo.getSuperclass() != null) { - String sn = kinfo.getSuperclass().classname; - MethodDescriptor superMD = new MethodDescriptor(sn + "." + md.methodname, md.descriptor, false); - if (!methods.contains(superMD) && !pending.contains(superMD)) { - trace(" delegated %s to %s%n", md, superMD); - pending.add(superMD); - } - } else if (kinfo.isClass()) { - trace(" %s (not found)%n", md); - } else { - trace(" %s (interface)%n", md); - } - } else { - if (md.descriptor.equals("*")) { - trace(" parsed %s : ", md.name); - for (String s : descriptors) { - trace(" %s", s); - } - trace("%n"); - } - } - } - } - } - } - } - if (pending.isEmpty()) { - for (Klass k : Klass.getAllClasses()) { - if (k.getFileSize() == 0) { - getKlassInfo(k.getClassName()).ensureParse(); - } - } - while ((md = interfaceMethodRefs.poll()) != null) { - addSubClassMethods(md); - } - } - } - } - - static void addSubClassMethods(MethodDescriptor md) throws IOException { - for (KlassInfo kinfo : getSubClasses(md.classname)) { - String methodname = kinfo.classname + "." + md.methodname; - MethodDescriptor other = new MethodDescriptor(methodname, md.descriptor, false); - if (!methods.contains(other) && !pending.contains(other)) { - trace("Warning: subclass from %s to %s%n", md.classname, other); - pending.add(other); - } - } - } - private final static String privilegedActionInterf = "java.security.PrivilegedAction"; - private final static String privilegedExceptionActionInterf = "java.security.PrivilegedExceptionAction"; - - static boolean isPrivilegedAction(String classname) { - if (classname.isEmpty()) { - return false; - } - KlassInfo kinfo = getKlassInfo(classname); - for (KlassInfo ki : kinfo.getInterfaces()) { - String interf = ki.classname; - if (interf.equals(privilegedActionInterf) || - interf.equals(privilegedExceptionActionInterf)) { - return true; - } - } - return false; - } - static Map cache = new HashMap(); - - static KlassInfo getKlassInfo(String classname) { - classname = classname.replace('/', '.'); - - KlassInfo kinfo = cache.get(classname); - if (kinfo == null) { - kinfo = new KlassInfo(classname); - cache.put(classname, kinfo); - } - return kinfo; - } - - static class KlassInfo { - - final String classname; - private ClassFileParser parser; - private KlassInfo superclass; - private List interfaces = new LinkedList(); - - KlassInfo(String classname) { - this.classname = classname; - } - - boolean isClass() { - ensureParse(); - return parser.classfile.isClass(); - } - - KlassInfo getSuperclass() { - ensureParse(); - return superclass; - } - - List getInterfaces() { - ensureParse(); - return java.util.Collections.unmodifiableList(interfaces); - } - - void ensureParse() { - try { - getClassFileParser(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - synchronized ClassFileParser getClassFileParser() throws IOException { - if (parser == null) { - parser = ClassPath.parserForClass(classname); - if (parser != null) { - parseClassFile(); - List descriptors = parse(new MethodDescriptor(classname + ".", "()V", false)); - } - } - return parser; - } - - List parse(MethodDescriptor md) { - ensureParse(); - try { - List descriptors = new LinkedList(); - for (Method m : parser.classfile.methods) { - String name = m.getName(parser.classfile.constant_pool); - String desc = parser.constantPoolParser.getDescriptor(m.descriptor.index); - if (name.equals(md.methodname)) { - if (md.descriptor.equals("*") || md.descriptor.equals(desc)) { - parseMethod(parser, m); - descriptors.add(desc); - } - } - } - return descriptors; - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - private void parseClassFile() throws IOException { - parser.parseClassInfo(); - - ClassFile classfile = parser.classfile; - try { - if (classfile.super_class > 0) { - superclass = getKlassInfo(classfile.getSuperclassName()); - } - if (classfile.interfaces != null) { - for (int i = 0; i < classfile.interfaces.length; i++) { - interfaces.add(getKlassInfo(classfile.getInterfaceName(i))); - } - } - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - } - - static List getSubClasses(String classname) throws IOException { - List result = new LinkedList(); - List list = new LinkedList(); - list.addAll(cache.values()); - for (KlassInfo kinfo : list) { - if (kinfo.getSuperclass() != null && classname.equals(kinfo.getSuperclass().classname)) { - result.add(kinfo); - } - for (KlassInfo interf : kinfo.getInterfaces()) { - if (classname.equals(interf.classname)) { - result.add(kinfo); - } - } - } - return result; - } - - private static void parseConfigFile(String config) throws IOException { - FileInputStream in = new FileInputStream(config); - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String line; - int lineNumber = 0; - while ((line = reader.readLine()) != null) { - lineNumber++; - if ((line = line.trim()).length() > 0) { - if (line.startsWith("#")) { - continue; - } - - String[] s = line.split("\\s+"); - if ("exclude".equals(s[0])) { - filter.exclude(s[1]); - } else { - String name = s[0].replace('/', '.'); - if (name.length() > 0) { - String classname = name.replace('/', '.'); - if (s.length == 2) { - // method name - int pos = classname.lastIndexOf('.'); - classname = classname.substring(0, pos); - } - - KlassInfo kinfo = getKlassInfo(classname); - if (kinfo.getClassFileParser() != null) { - // class exists - MethodDescriptor md = (s.length == 1) ? new MethodDescriptor(name) : new MethodDescriptor(name, s[1], false); - if (!pending.contains(md)) { - pending.add(md); - } - } else { - // class not found - trace("Class %s not found%n", classname); - } - } - } - } - } - - } finally { - in.close(); - } - } - - private static void parseMethod(ClassFileParser cfparser, Method m) { - Klass.Method kmethod = cfparser.parseMethod(m); - Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code); - if (c_attr != null) { - LineNumberTable_attribute lineNumTable = - (LineNumberTable_attribute) c_attr.attributes.get(Attribute.LineNumberTable); - InstructorVisitor visitor = new InstructorVisitor(cfparser, lineNumTable); - trace("parseMethod %s %s %n", cfparser.this_klass, kmethod); - for (Instruction instr : c_attr.getInstructions()) { - try { - instr.accept(visitor, kmethod); - } catch (ArrayIndexOutOfBoundsException e) { - throw new RuntimeException("error at or after byte " + instr.getPC()); - } - - } - - if (c_attr.exception_table_langth > 0) { - for (int i = 0; i < - c_attr.exception_table.length; i++) { - Code_attribute.Exception_data handler = c_attr.exception_table[i]; - int catch_type = handler.catch_type; - if (catch_type > 0) { - visitor.addConstantPoolRef(catch_type, kmethod, handler.start_pc); - } - - } - } - } - } - - static class MethodDescriptor { - - final String name; - final String classname; - final String methodname; - final String descriptor; - final boolean interfaceMethodRef; - - MethodDescriptor(String classname) { - this.classname = classname.replace('/', '.'); - this.name = this.classname; - this.methodname = ""; - this.descriptor = ""; - this.interfaceMethodRef = false; - if (this.classname.length() == 1) { - throw new RuntimeException("invalid " + this); - } - } - - MethodDescriptor(String name, String descriptor, boolean interfaceMethodRef) { - name = name.replace('/', '.'); - this.name = name; - int pos = name.lastIndexOf('.'); - this.classname = name.substring(0, pos); - this.methodname = name.substring(pos + 1, name.length()); - this.descriptor = descriptor; - this.interfaceMethodRef = interfaceMethodRef; - if (this.classname.length() == 1) { - throw new RuntimeException("invalid " + this); - } - } - - @Override - public boolean equals(Object obj) { - MethodDescriptor m = (MethodDescriptor) obj; - - return this.name.equals(m.name) && - this.descriptor.equals(m.descriptor); - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); - hash = 97 * hash + (this.descriptor != null ? this.descriptor.hashCode() : 0); - return hash; - } - - public String toString() { - if (descriptor.isEmpty()) { - return name; - } else { - return name + " : " + descriptor; - } - } - } - - static class Filter { - - private Set excludes = new TreeSet(); - - Filter exclude(String pattern) { - excludes.add(pattern); - return this; - } - - boolean isExcluded(String klass) { - for (String pattern : excludes) { - if (matches(klass, pattern)) { - return true; - } - } - return false; - } - - private boolean matches(String klass, String pattern) { - int pos = klass.lastIndexOf('.'); - String packageName = pos > 0 ? klass.substring(0, pos) : ""; - if (pattern.endsWith("**")) { - String p = pattern.substring(0, pattern.length() - 2); - return klass.startsWith(p); - } else if (pattern.endsWith("*")) { - pos = pattern.lastIndexOf('.'); - String pkg = pos > 0 ? pattern.substring(0, pos) : ""; - if (packageName.equals(pkg)) { - // package name has to be exact match - String p = pattern.substring(0, pattern.length() - 1); - return klass.startsWith(p); - } else { - return false; - } - } else { - // exact match or inner class - return klass.equals(pattern) || klass.startsWith(pattern + "$"); - } - } - } - - static class InstructorVisitor implements Instruction.KindVisitor { - - private final ClassFileParser parser; - private final LineNumberTable_attribute lineNumTable; - - InstructorVisitor(ClassFileParser parser, LineNumberTable_attribute lineNumTable) { - this.parser = parser; - this.lineNumTable = lineNumTable; - } - - int getLineNumber(int pc) { - if (lineNumTable != null) { - int start_pc = 0; - int lineno = 0; - for (int i = 0; i < lineNumTable.line_number_table_length; i++) { - int cur_start_pc = lineNumTable.line_number_table[i].start_pc; - if (pc == 0 && cur_start_pc == 0) { - return lineNumTable.line_number_table[i].line_number; - } else if (pc >= start_pc && pc < cur_start_pc) { - return lineno; - } - start_pc = cur_start_pc; - lineno = lineNumTable.line_number_table[i].line_number; - } - } - return 0; - } - - void addConstantPoolRef(int index, Klass.Method m, int pc) { - try { - CPInfo cpInfo = parser.classfile.constant_pool.get(index); - String name = cpInfo.accept(typeFinder, null); - if (name != null) { - trace(" %s %s at line %d%n", parser.constantPoolParser.tagName(index), name, getLineNumber(pc)); - } - } catch (InvalidIndex ex) { - throw new RuntimeException(ex); - } - } - - public Void visitNoOperands(Instruction instr, Klass.Method m) { - return null; - } - - public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) { - return null; - } - - public Void visitBranch(Instruction instr, int offset, Klass.Method m) { - return null; - } - - public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) { - addConstantPoolRef(index, m, instr.getPC()); - return null; - } - - public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) { - addConstantPoolRef(index, m, instr.getPC()); - return null; - } - - public Void visitLocal(Instruction instr, int index, Klass.Method m) { - return null; - } - - public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) { - return null; - } - - public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) { - return null; - } - - public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) { - return null; - } - - public Void visitValue(Instruction instr, int value, Klass.Method m) { - return null; - } - - public Void visitUnknown(Instruction instr, Klass.Method m) { - return null; - } - private ConstantPool.Visitor typeFinder = new ConstantPool.Visitor() { - - String getClassName(CPRefInfo info, Void p) { - try { - return parser.checkClassName(info.getClassName()).replace('/', '.'); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - boolean addReferencedClass(String name) { - if (Klass.findKlass(name) == null) { - MethodDescriptor md = new MethodDescriptor(name); - if (!methods.contains(md) && !pending.contains(md)) { - pending.add(md); - } - return true; - } - return false; - } - private String privilegedActionClass = ""; - - void cachePrivilegedAction(String classname) { - trace(" found PrivilegedAction %s%n", classname); - privilegedActionClass = classname; - } - - void doPrivilegedCall(String method) { - if (privilegedActionClass.length() > 0) { - MethodDescriptor md = new MethodDescriptor(privilegedActionClass + ".run", "*", false); - if (!methods.contains(md) && !pending.contains(md)) { - trace(" doPrivileged %s%n", md); - pending.add(md); - } - } - } - - private String addMethodDescriptor(CPRefInfo info, Void p) { - try { - String classname = getClassName(info, null); - String method = classname + "." + info.getNameAndTypeInfo().getName(); - String descriptor = info.getNameAndTypeInfo().getType(); - - if (method.endsWith(".") && isPrivilegedAction(classname)) { - cachePrivilegedAction(classname); - } - if (method.equals("java.security.AccessController.doPrivileged")) { - doPrivilegedCall(method); - return method; - } - - boolean interfaceMethodRef = info instanceof CONSTANT_InterfaceMethodref_info; - MethodDescriptor md = new MethodDescriptor(method, descriptor, interfaceMethodRef); - if (!methods.contains(md) && !pending.contains(md)) { - pending.add(md); - } - return method; - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - public String visitClass(CONSTANT_Class_info info, Void p) { - try { - String classname = parser.checkClassName(info.getName()).replace('/', '.'); - if (classname.length() > 0) { - addReferencedClass(classname); - } - return classname; - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - public String visitDouble(CONSTANT_Double_info info, Void p) { - // skip - return null; - } - - public String visitFieldref(CONSTANT_Fieldref_info info, Void p) { - try { - String classname = getClassName(info, p); - if (classname.length() > 0) { - addReferencedClass(classname); - } - - String type = info.getNameAndTypeInfo().getType(); - String fieldType = parser.checkClassName(type).replace('/', '.'); - if (fieldType.length() > 0) { - addReferencedClass(classname); - } - return parser.constantPoolParser.stringValue(info); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - public String visitFloat(CONSTANT_Float_info info, Void p) { - // skip - return null; - } - - public String visitInteger(CONSTANT_Integer_info info, Void p) { - // skip - return null; - } - - public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { - return addMethodDescriptor(info, p); - } - - public String visitLong(CONSTANT_Long_info info, Void p) { - // skip - return null; - } - - public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) { - // skip - return null; - } - - public String visitMethodref(CONSTANT_Methodref_info info, Void p) { - return addMethodDescriptor(info, p); - } - - public String visitString(CONSTANT_String_info info, Void p) { - // skip - return null; - } - - public String visitUtf8(CONSTANT_Utf8_info info, Void p) { - return null; - } - }; - } - static boolean traceOn = System.getProperty("classanalyzer.debug") != null; - - private static void trace(String format, Object... args) { - if (traceOn) { - System.out.format(format, args); - } - } - - private static void usage() { - System.out.println("Usage: BootAnalyzer "); - System.out.println("Options: "); - System.out.println("\t-jdkhome where all jars will be parsed"); - System.out.println("\t-config "); - System.out.println("\t-output "); - System.out.println("\t-classlist print class list and summary"); - System.exit(-1); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java b/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java deleted file mode 100644 index 4f9239aa60f80ee1c7646de326aeacc51af7409f..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.*; -import java.util.*; - -/** - * A simple tool to check module dependencies against a known list of - * dependencies. The tool fails (by throwing a RuntimeException) is an - * unexpected dependency is detected. - */ - -public class CheckDeps { - - /** - * Represents a dependency from one module to another module. The dependency - * may be optional. - */ - static class Dependency { - private final String module; - private final String other; - private final boolean optional; - - private Dependency(String module, String other, boolean optional) { - this.module = module; - this.other = other; - this.optional = optional; - } - - String module() { return module; } - String other() { return other; } - boolean isOptional() { return optional; } - - /** - * Parses a dependency in one of the following forms: - * a -> b - * [optional] a -> b - */ - static Dependency fromString(String s) { - String[] components = s.split(" "); - int count = components.length; - if (count != 3 && count != 4) - throw new IllegalArgumentException(s); - boolean optional = (count == 4); - if (optional && !components[0].equals("[optional]")) - throw new IllegalArgumentException(s); - String arrow = optional ? components[2] : components[1]; - if (!arrow.equals("->")) - throw new IllegalArgumentException(s); - String module = optional ? components[1] : components[0]; - String other = optional ? components[3] : components[2]; - return new Dependency(module, other, optional); - } - - @Override public String toString() { - StringBuilder sb = new StringBuilder(); - if (optional) - sb.append("[optional] "); - sb.append(module); - sb.append(" -> "); - sb.append(other); - return sb.toString(); - } - } - - /** - * Represents the "tail" - */ - static class DependencyTail { - private final String module; - private final boolean optional; - - DependencyTail(String module, boolean optional) { - this.module = module; - this.optional = optional; - } - String module() { return module; } - boolean isOptional() { return optional; } - } - - static void usage() { - System.out.println("java CheckDeps file1 file2"); - System.out.println(" where file1 is the expected dependencies and file2 is"); - System.out.println(" the actual dependencies. Both files are assumed to be"); - System.out.println(" in modules.summary format (see ClassAnalyzer tool)."); - System.out.println(); - System.out.println("Example usages:"); - System.out.println(" java CheckDeps make/modules/modules.summary " + - "$(OUTPUTDIR)/modules.summary"); - System.exit(-1); - } - - public static void main(String[] args) throws IOException { - if (args.length != 2) - usage(); - - // maps a module to the list of modules that it depends on - Map> expected = - new HashMap>(); - - // parse the expected dependencies file - Scanner s; - s = new Scanner(new FileInputStream(args[0])); - try { - while (s.hasNextLine()) { - Dependency ref = Dependency.fromString(s.nextLine()); - if (ref != null) { - String module = ref.module(); - List list = expected.get(module); - if (list == null) { - list = new ArrayList(); - expected.put(module, list); - } - list.add(new DependencyTail(ref.other(), ref.isOptional())); - } - } - } finally { - s.close(); - } - - // parse the actual dependencies file, checking each dependency - // against the expected list. - boolean fail = false; - s = new Scanner(new FileInputStream(args[1])); - try { - while (s.hasNextLine()) { - Dependency dep = Dependency.fromString(s.nextLine()); - - // check if this dependency is expected - List list = expected.get(dep.module()); - DependencyTail tail = null; - if (list != null) { - for (DependencyTail t: list) { - if (t.module().equals(dep.other())) { - tail = t; - break; - } - } - } - if (tail == null) { - System.err.println("Unexpected dependency: " + dep); - fail = true; - } else { - // hard dependency when optional dependency is expected - if (tail.isOptional() != dep.isOptional()) { - if (tail.isOptional()) { - System.err.println("Unexpected dependency: " + dep); - fail = true; - } - } - } - } - } finally { - s.close(); - } - - if (fail) - throw new RuntimeException("Unexpected dependencies found"); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java deleted file mode 100644 index 4367471d5acdf86cb4bef18c2799c8736f71f0ff..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.classanalyzer.AnnotatedDependency.*; -import com.sun.classanalyzer.Module.Dependency; -import com.sun.classanalyzer.Module.PackageInfo; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.io.File; -import java.io.PrintWriter; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * - * @author Mandy Chung - */ -public class ClassAnalyzer { - - public static void main(String[] args) throws Exception { - String jdkhome = null; - String cpath = null; - List configs = new ArrayList(); - List depconfigs = new ArrayList(); - String output = "."; - boolean mergeModules = true; - boolean showDynamic = false; - - // process arguments - int i = 0; - while (i < args.length) { - String arg = args[i++]; - if (arg.equals("-jdkhome")) { - if (i < args.length) { - jdkhome = args[i++]; - } else { - usage(); - } - } else if (arg.equals("-cpath")) { - if (i < args.length) { - cpath = args[i++]; - } else { - usage(); - } - } else if (arg.equals("-config")) { - if (i < args.length) { - configs.add(args[i++]); - } else { - usage(); - } - } else if (arg.equals("-depconfig")) { - if (i < args.length) { - depconfigs.add(args[i++]); - } else { - usage(); - } - } else if (arg.equals("-output")) { - if (i < args.length) { - output = args[i++]; - } else { - usage(); - } - } else if (arg.equals("-base")) { - ModuleConfig.setBaseModule(args[i++]); - } else if (arg.equals("-nomerge")) { - // analyze the fine-grained module dependencies - mergeModules = false; - } else if (arg.equals("-showdynamic")) { - showDynamic = true; - } else { - System.err.println("Invalid option: " + arg); - usage(); - } - } - - if ((jdkhome == null && cpath == null) || (jdkhome != null && cpath != null)) { - usage(); - } - if (configs.isEmpty()) { - usage(); - } - - if (jdkhome != null) { - ClassPath.setJDKHome(jdkhome); - } else if (cpath != null) { - ClassPath.setClassPath(cpath); - } - - // create output directory if it doesn't exist - File dir = new File(output); - if (!dir.isDirectory()) { - if (!dir.exists()) { - boolean created = dir.mkdir(); - if (!created) { - throw new RuntimeException("Unable to create `" + dir + "'"); - } - } - } - - buildModules(configs, depconfigs, mergeModules); - - // generate output files - for (Module m : modules) { - // only generate reports for top-level modules - if (m.group() == m) { - m.printClassListTo(resolve(dir, m.name(), "classlist")); - m.printResourceListTo(resolve(dir, m.name(), "resources")); - m.printSummaryTo(resolve(dir, m.name(), "summary")); - m.printDependenciesTo(resolve(dir, m.name(), "dependencies"), showDynamic); - } - } - - // Generate other summary reports - printModulesSummary(dir, showDynamic); - printModulesDot(dir, showDynamic); - printModulesList(dir); - printPackagesSummary(dir); - } - private static List modules = new ArrayList(); - - static void buildModules(List configs, - List depconfigs, - boolean mergeModules) throws IOException { - // create modules based on the input config files - for (String file : configs) { - for (ModuleConfig mconfig : ModuleConfig.readConfigurationFile(file)) { - modules.add(Module.addModule(mconfig)); - } - } - - // parse class files - ClassPath.parseAllClassFiles(); - - // Add additional dependencies if specified - if (depconfigs != null && depconfigs.size() > 0) { - DependencyConfig.parse(depconfigs); - } - - // process the roots and dependencies to get the classes for each module - for (Module m : modules) { - m.processRootsAndReferences(); - } - - // update the dependencies for classes that were subsequently allocated - // to modules - for (Module m : modules) { - m.fixupDependencies(); - } - - if (mergeModules) { - Module.buildModuleMembers(); - } - } - - private static void printModulesSummary(File dir, boolean showDynamic) throws IOException { - // print summary of dependencies - PrintWriter writer = new PrintWriter(new File(dir, "modules.summary")); - try { - for (Module m : modules) { - // only show top-level module dependencies - if (m.group() == m) { - for (Dependency dep : m.dependents()) { - if (!showDynamic && dep.dynamic && dep.optional) { - continue; - } - if (dep.module == null || !dep.module.isBase()) { - - String prefix = ""; - if (dep.optional) { - if (dep.dynamic) { - prefix = "[dynamic] "; - } else { - prefix = "[optional] "; - } - } - - Module other = dep != null ? dep.module : null; - writer.format("%s%s -> %s%n", prefix, m, other); - } - } - } - } - } finally { - writer.close(); - } - } - - private static void printModulesDot(File dir, boolean showDynamic) throws IOException { - PrintWriter writer = new PrintWriter(new File(dir, "modules.dot")); - try { - writer.println("digraph jdk {"); - for (Module m : modules) { - if (m.group() == m) { - for (Dependency dep : m.dependents()) { - if (!showDynamic && dep.dynamic && dep.optional) { - continue; - } - if (dep.module == null || !dep.module.isBase()) { - String style = ""; - String color = ""; - String property = ""; - if (dep.optional) { - style = "style=dotted"; - } - if (dep.dynamic) { - color = "color=red"; - } - if (style.length() > 0 || color.length() > 0) { - String comma = ""; - if (style.length() > 0 && color.length() > 0) { - comma = ", "; - } - property = String.format(" [%s%s%s]", style, comma, color); - } - Module other = dep != null ? dep.module : null; - writer.format(" \"%s\" -> \"%s\"%s;%n", m, other, property); - } - } - } - } - writer.println("}"); - } finally { - writer.close(); - } - } - - private static void printMembers(Module m, PrintWriter writer) { - for (Module member : m.members()) { - if (!member.isEmpty()) { - writer.format("%s ", member); - printMembers(member, writer); - } - } - } - - private static void printModulesList(File dir) throws IOException { - // print module group / members relationship - PrintWriter writer = new PrintWriter(new File(dir, "modules.list")); - try { - for (Module m : modules) { - if (m.group() == m && !m.isEmpty()) { - writer.format("%s ", m); - printMembers(m, writer); - writer.println(); - } - } - } finally { - writer.close(); - } - } - - private static void printPackagesSummary(File dir) throws IOException { - // print package / module relationship - PrintWriter writer = new PrintWriter(new File(dir, "modules.pkginfo")); - try { - Map> packages = new TreeMap>(); - Set splitPackages = new TreeSet(); - - for (Module m : modules) { - if (m.group() == m) { - for (PackageInfo info : m.getPackageInfos()) { - Set value = packages.get(info.pkgName); - if (value == null) { - value = new TreeSet(); - packages.put(info.pkgName, value); - } else { - // package in more than one module - splitPackages.add(info.pkgName); - } - value.add(m); - } - } - } - - // packages that are splitted among multiple modules - writer.println("Packages splitted across modules:-\n"); - writer.format("%-60s %s\n", "Package", "Module"); - - for (String pkgname : splitPackages) { - writer.format("%-60s", pkgname); - for (Module m : packages.get(pkgname)) { - writer.format(" %s", m); - } - writer.println(); - } - - writer.println("\nPackage-private dependencies:-"); - for (String pkgname : splitPackages) { - for (Klass k : Klass.getAllClasses()) { - if (k.getPackageName().equals(pkgname)) { - Module m = k.getModule(); - // check if this klass references a package-private - // class that is in a different module - for (Klass other : k.getReferencedClasses()) { - if (other.getModule() != m && - !other.isPublic() && - other.getPackageName().equals(pkgname)) { - String from = k.getClassName() + " (" + m + ")"; - writer.format("%-60s -> %s (%s)\n", from, other, other.getModule()); - } - } - } - } - } - } finally { - writer.close(); - } - - } - - private static String resolve(File dir, String mname, String suffix) { - File f = new File(dir, mname + "." + suffix); - return f.toString(); - - } - - private static void usage() { - System.out.println("Usage: ClassAnalyzer "); - System.out.println("Options: "); - System.out.println("\t-jdkhome where all jars will be parsed"); - System.out.println("\t-cpath where classes and jars will be parsed"); - System.out.println("\t Either -jdkhome or -cpath option can be used."); - System.out.println("\t-config "); - System.out.println("\t This option can be repeated for multiple module config files"); - System.out.println("\t-output "); - System.out.println("\t-nomerge specify not to merge modules"); - System.out.println("\t-showdynamic show dynamic dependencies in the reports"); - System.exit(-1); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java b/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java deleted file mode 100644 index 394f5f3c5a65cc08b58d0565cb33a4e7f345023d..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java +++ /dev/null @@ -1,629 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.tools.classfile.*; -import com.sun.tools.classfile.Type.*; -import com.sun.tools.classfile.Descriptor.InvalidDescriptor; -import static com.sun.tools.classfile.AccessFlags.*; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -/** - * - * @author Mandy Chung - */ -public class ClassFileParser { - - final Klass this_klass; - final ClassFile classfile; - final ConstantPoolParser constantPoolParser; - final AnnotationParser annotationParser; - final CodeAttributeParser codeAttributeParser; - private final boolean buildDeps; - - protected ClassFileParser(InputStream in, long size, boolean buildDeps) throws IOException { - try { - this.classfile = ClassFile.read(in); - this.this_klass = getKlass(this.classfile); - this.buildDeps = buildDeps; - this.constantPoolParser = new ConstantPoolParser(this); - this.annotationParser = new AnnotationParser(this); - this.codeAttributeParser = new CodeAttributeParser(this); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - private Klass getKlass(ClassFile cf) throws ConstantPoolException { - Klass k = Klass.getKlass(cf.getName()); - k.setAccessFlags(cf.access_flags.flags); - k.setFileSize(cf.byteLength()); - return k; - } - - public static ClassFileParser newParser(InputStream in, long size, boolean buildDeps) throws IOException { - return new ClassFileParser(in, size, buildDeps); - } - - public static ClassFileParser newParser(String classPathname, boolean buildDeps) throws IOException { - return newParser(new File(classPathname), buildDeps); - } - - public static ClassFileParser newParser(File f, boolean buildDeps) throws IOException { - BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); - try { - return newParser(in, f.length(), buildDeps); - } finally { - in.close(); - } - } - - public void parseDependency(boolean publicAPIs) throws IOException { - if (publicAPIs && !classfile.access_flags.is(ACC_PUBLIC)) { - // process public APIs only - return; - } - - parseClassInfo(); - if (!publicAPIs) { - // parse all references in the classfile - constantPoolParser.parseDependency(); - } - parseMethods(publicAPIs); - parseFields(publicAPIs); - } - - void parseClassInfo() throws IOException { - ConstantPool cpool = classfile.constant_pool; - try { - Signature_attribute sigAttr = (Signature_attribute) classfile.attributes.get(Attribute.Signature); - if (sigAttr == null) { - // use info from class file header - if (classfile.isClass() && classfile.super_class != 0) { - String sn = classfile.getSuperclassName(); - addExtends(sn); - } - for (int i = 0; i < classfile.interfaces.length; i++) { - String interf = classfile.getInterfaceName(i); - if (classfile.isClass()) { - addImplements(interf); - } else { - addExtends(interf); - } - } - } else { - Type t = sigAttr.getParsedSignature().getType(cpool); - // The signature parser cannot disambiguate between a - // FieldType and a ClassSignatureType that only contains a superclass type. - if (t instanceof Type.ClassSigType) { - Type.ClassSigType cst = Type.ClassSigType.class.cast(t); - if (cst.superclassType != null) { - for (Klass k : getKlass(cst.superclassType)) { - addExtends(k); - } - } - if (cst.superinterfaceTypes != null) { - for (Type t1 : cst.superinterfaceTypes) { - for (Klass k : getKlass(t1)) { - addImplements(k); - } - } - } - } else { - for (Klass k : getKlass(t)) { - addExtends(k); - } - } - } - // parse attributes - annotationParser.parseAttributes(classfile.attributes); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - private void parseFields(boolean publicAPIs) throws IOException { - ConstantPool cpool = classfile.constant_pool; - for (Field f : classfile.fields) { - try { - AccessFlags flags = f.access_flags; - if (publicAPIs && !flags.is(ACC_PUBLIC) && !flags.is(ACC_PROTECTED)) { - continue; - } - String fieldname = f.getName(cpool); - Signature_attribute sigAttr = (Signature_attribute) f.attributes.get(Attribute.Signature); - - if (sigAttr == null) { - Set types = parseDescriptor(f.descriptor); - String info = getFlag(flags) + " " + f.descriptor.getFieldType(cpool) + " " + fieldname; - addFieldTypes(types, info, flags); - } else { - Type t = sigAttr.getParsedSignature().getType(cpool); - String info = getFlag(flags) + " " + t + " " + fieldname; - addFieldTypes(getKlass(t), info, flags); - } - // parse attributes - annotationParser.parseAttributes(f.attributes); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } catch (InvalidDescriptor ex) { - throw new RuntimeException(ex); - } - } - } - - private void parseMethods(boolean publicAPIs) { - for (Method m : classfile.methods) { - if (publicAPIs && !m.access_flags.is(ACC_PUBLIC) && !m.access_flags.is(ACC_PROTECTED)) { - // only interest in the API level - return; - } - - parseMethod(m); - } - } - - String checkClassName(String classname) { - int i = 0; - while (i < classname.length()) { - switch (classname.charAt(i)) { - case 'Z': - case 'B': - case 'C': - case 'S': - case 'I': - case 'J': - case 'F': - case 'D': - return ""; - case 'L': - if (!classname.endsWith(";")) { - throw new RuntimeException("Invalid classname " + classname); - } - return classname.substring(i + 1, classname.length() - 1); - case '[': - i++; - break; - default: - if (classname.endsWith(";")) { - throw new RuntimeException("Invalid classname " + classname); - } - return classname; - - } - } - throw new RuntimeException("Invalid classname " + classname); - } - - private void addExtends(String classname) throws IOException { - if (!buildDeps) { - return; - } - - addExtends(Klass.getKlass(classname)); - } - - private void addExtends(Klass k) { - if (!buildDeps) { - return; - } - - ResolutionInfo resInfo = ResolutionInfo.resolvedExtends(this_klass, k); - resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC)); - this_klass.addDep(k, resInfo); - k.addReferrer(this_klass, resInfo); - } - - private void addImplements(String classname) throws IOException { - if (!buildDeps) { - return; - } - - addImplements(Klass.getKlass(classname)); - } - - private void addImplements(Klass k) { - if (!buildDeps) { - return; - } - - ResolutionInfo resInfo = ResolutionInfo.resolvedImplements(this_klass, k); - resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC)); - - this_klass.addDep(k, resInfo); - - k.addReferrer(this_klass, resInfo); - } - - private Set getKlass(Type type) throws IOException { - Set refTypes = new TreeSet(); - if (!buildDeps) { - return refTypes; - } - - type.accept(typevisitor, refTypes); - return refTypes; - } - private Type.Visitor> typevisitor = new Type.Visitor>() { - - public Void visitSimpleType(SimpleType type, Set klasses) { - // nop - return null; - } - - public Void visitArrayType(ArrayType type, Set klasses) { - try { - klasses.addAll(getKlass(type.elemType)); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - return null; - - } - - public Void visitMethodType(MethodType type, Set klasses) { - throw new InternalError("Unexpected type " + type); - } - - public Void visitClassSigType(ClassSigType type, Set klasses) { - try { - if (type.superclassType != null) { - klasses.addAll(getKlass(type.superclassType)); - } - if (type.superinterfaceTypes != null) { - for (Type t : type.superinterfaceTypes) { - klasses.addAll(getKlass(t)); - } - } - if (type.typeParamTypes != null) { - for (Type t : type.typeParamTypes) { - klasses.addAll(getKlass(t)); - } - } - } catch (IOException ex) { - throw new RuntimeException(ex); - } - return null; - } - - public Void visitClassType(ClassType type, Set klasses) { - klasses.add(Klass.getKlass(type.getBinaryName())); - if (type.typeArgs != null) { - for (Type t : type.typeArgs) { - try { - klasses.addAll(getKlass(t)); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - } - return null; - - } - - public Void visitTypeParamType(TypeParamType type, Set klasses) { - try { - if (type.classBound != null) { - klasses.addAll(getKlass(type.classBound)); - } - if (type.interfaceBounds != null) { - for (Type t : type.interfaceBounds) { - klasses.addAll(getKlass(t)); - } - } - - } catch (IOException ex) { - throw new RuntimeException(ex); - } - - return null; - - } - - public Void visitWildcardType(WildcardType type, Set klasses) { - if (type.boundType != null) { - try { - klasses.addAll(getKlass(type.boundType)); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - return null; - - } - }; - - private void printMethod(Method m) { - try { - System.out.println("parsing " + m.getName(classfile.constant_pool) + "(" + - m.descriptor.getParameterTypes(classfile.constant_pool) + ") return type " + - m.descriptor.getReturnType(classfile.constant_pool)); - - } catch (ConstantPoolException ex) { - } catch (InvalidDescriptor ex) { - } - } - - private static StringBuilder appendWord(StringBuilder sb, String word) { - if (sb.length() > 0) { - sb.append(" "); - } - sb.append(word); - return sb; - } - - private static String getFlag(AccessFlags flags) { - StringBuilder modifier = new StringBuilder(); - if (flags.is(ACC_PUBLIC)) { - modifier.append("public"); - } - if (flags.is(ACC_PRIVATE)) { - modifier.append("private"); - } - if (flags.is(ACC_PROTECTED)) { - modifier.append("protected"); - } - if (flags.is(ACC_STATIC)) { - appendWord(modifier, "static"); - } - if (flags.is(ACC_FINAL)) { - appendWord(modifier, "final"); - } - if (flags.is(ACC_SYNCHRONIZED)) { - // return "synchronized"; - } - if (flags.is(0x80)) { - // return (t == Type.Field ? "transient" : null); - // return "transient"; - } - if (flags.is(ACC_VOLATILE)) { - // return "volatile"; - } - if (flags.is(ACC_NATIVE)) { - // return "native"; - } - if (flags.is(ACC_ABSTRACT)) { - appendWord(modifier, "abstract"); - } - if (flags.is(ACC_STRICT)) { - // return "strictfp"; - } - if (flags.is(ACC_MODULE)) { - appendWord(modifier, "module"); - } - return modifier.toString(); - } - - private Klass.Method toKlassMethod(Method m, Descriptor d) { - try { - ConstantPool cpool = classfile.constant_pool; - String methodname = m.getName(cpool); - StringBuilder sb = new StringBuilder(); - sb.append(getFlag(m.access_flags)); - if (methodname.equals("")) { - String s = this_klass.getBasename() + d.getParameterTypes(cpool); - appendWord(sb, s); - } else if (methodname.equals("")) { - // - appendWord(sb, methodname); - } else { - String s = d.getReturnType(cpool) + " " + methodname + d.getParameterTypes(cpool); - appendWord(sb, s); - } - String signature = sb.toString().replace('/', '.'); - return this_klass.getMethod(methodname, signature); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } catch (InvalidDescriptor ex) { - throw new RuntimeException(ex); - } - } - - Klass.Method parseMethod(Method m) { - AccessFlags flags = m.access_flags; - Descriptor d; - List methodExceptions = null; - try { - ConstantPool cpool = classfile.constant_pool; - Klass.Method kmethod; - Signature_attribute sigAttr = (Signature_attribute) m.attributes.get(Attribute.Signature); - if (sigAttr == null) { - d = m.descriptor; - Set types = parseDescriptor(d); - - kmethod = toKlassMethod(m, d); - addMethodTypes(types, kmethod, flags); - } else { - Type.MethodType methodType; - Signature methodSig = sigAttr.getParsedSignature(); - d = methodSig; - try { - kmethod = toKlassMethod(m, d); - methodType = (Type.MethodType) methodSig.getType(cpool); - addMethodTypes(getKlass(methodType.returnType), kmethod, flags); - if (methodType.paramTypes != null) { - for (Type t : methodType.paramTypes) { - addMethodTypes(getKlass(t), kmethod, flags); - } - } - if (methodType.typeParamTypes != null) { - for (Type t : methodType.typeParamTypes) { - addMethodTypes(getKlass(t), kmethod, flags); - } - } - - methodExceptions = methodType.throwsTypes; - if (methodExceptions != null) { - if (methodExceptions.size() == 0) { - methodExceptions = null; - } else { - for (Type t : methodExceptions) { - addCheckedExceptionTypes(getKlass(t), kmethod, flags); - } - } - } - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - Attribute e_attr = m.attributes.get(Attribute.Exceptions); - if (e_attr != null && methodExceptions == null) { - // if there are generic exceptions, there must be erased exceptions - if (e_attr instanceof Exceptions_attribute) { - Exceptions_attribute exceptions = (Exceptions_attribute) e_attr; - for (int i = 0; i < exceptions.number_of_exceptions; i++) { - String classname = checkClassName(exceptions.getException(i, classfile.constant_pool)); - if (classname.length() > 0 && buildDeps) { - Klass to = Klass.getKlass(classname); - ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, kmethod); - resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); - - this_klass.addDep(to, resInfo); - to.addReferrer(this_klass, resInfo); - } - } - } else { - throw new RuntimeException("Invalid attribute: " + e_attr); - } - } - - Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code); - if (c_attr != null) { - codeAttributeParser.parse(c_attr, kmethod); - } - kmethod.isAbstract = classfile.access_flags.is(ACC_ABSTRACT); - kmethod.setCodeLength(m.byteLength()); - - // parse annotation attributes - annotationParser.parseAttributes(m.attributes, kmethod); - return kmethod; - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private void addFieldTypes(Set types, String info, AccessFlags flags) { - if (types.isEmpty() || !buildDeps) { - return; - } - - for (Klass to : types) { - ResolutionInfo resInfo = ResolutionInfo.resolvedField(this_klass, to, info); - resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); - - this_klass.addDep(to, resInfo); - to.addReferrer(this_klass, resInfo); - } - } - - private void addReferencedTypes(Method m, Descriptor d, AccessFlags flags) { - Set types = parseDescriptor(d); - - Klass.Method method = toKlassMethod(m, d); - addMethodTypes(types, method, flags); - } - - private void addMethodTypes(Set types, Klass.Method method, AccessFlags flags) { - if (types.isEmpty() || !buildDeps) { - return; - } - for (Klass to : types) { - ResolutionInfo resInfo = ResolutionInfo.resolvedMethodSignature(this_klass, to, method); - resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); - - this_klass.addDep(to, resInfo); - to.addReferrer(this_klass, resInfo); - } - } - - private void addCheckedExceptionTypes(Set types, Klass.Method method, AccessFlags flags) { - if (types.isEmpty() || !buildDeps) { - return; - } - for (Klass to : types) { - ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, method); - resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); - - this_klass.addDep(to, resInfo); - to.addReferrer(this_klass, resInfo); - } - } - - private Set parseDescriptor(Descriptor d) { - Set types = new TreeSet(); - try { - String desc = d.getValue(classfile.constant_pool); - int p = 0; - while (p < desc.length()) { - String type; - char ch; - switch (ch = desc.charAt(p++)) { - case '(': - case ')': - case '[': - case 'B': - case 'C': - case 'D': - case 'F': - case 'I': - case 'J': - case 'S': - case 'Z': - case 'V': - continue; - case 'L': - int sep = desc.indexOf(';', p); - if (sep == -1) { - throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc); - } - type = checkClassName(desc.substring(p, sep)); - p = sep + 1; - break; - default: - throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc); - } - - if (!type.isEmpty() && buildDeps) { - Klass to = Klass.getKlass(type); - types.add(to); - - } - } - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - return types; - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java b/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java deleted file mode 100644 index 3f6f0a06bb541015781a740fc9e06e3ec3f83c03..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/** - * - * @author mchung - */ -public class ClassPath { - - public class FileInfo { - - File file; - JarFile jarfile; - int classCount; - long filesize; - - FileInfo(File f) throws IOException { - this.file = f; - this.classCount = 0; - if (file.getName().endsWith(".jar")) { - this.filesize = file.length(); - jarfile = new JarFile(f); - } - } - - File getFile() { - return file; - } - - JarFile getJarFile() { - return jarfile; - } - - String getName() throws IOException { - return file.getCanonicalPath(); - } - } - private List fileList = new ArrayList(); - private static ClassPath instance = new ClassPath(); - - static List getFileInfos() { - return instance.fileList; - } - - static ClassPath setJDKHome(String jdkhome) throws IOException { - List files = new ArrayList(); - File jre = new File(jdkhome, "jre"); - File lib = new File(jdkhome, "lib"); - if (jre.exists() && jre.isDirectory()) { - listFiles(new File(jre, "lib"), ".jar", files); - } else if (lib.exists() && lib.isDirectory()) { - // either a JRE or a jdk build image - listFiles(lib, ".jar", files); - - File classes = new File(jdkhome, "classes"); - if (classes.exists() && classes.isDirectory()) { - // jdk build outputdir - instance.add(classes); - } - } else { - throw new RuntimeException("\"" + jdkhome + "\" not a JDK home"); - } - - for (File f : files) { - instance.add(f); - } - return instance; - } - - static ClassPath setClassPath(String path) throws IOException { - if (path.endsWith(".class")) { - // one class file - File f = new File(path); - if (!f.exists()) { - throw new RuntimeException("Classfile \"" + f + "\" doesn't exist"); - } - - instance.add(f); - } else { - List jarFiles = new ArrayList(); - String[] locs = path.split(File.pathSeparator); - for (String p : locs) { - File f = new File(p); - if (!f.exists()) { - throw new RuntimeException("\"" + f + "\" doesn't exist"); - } - - if (f.isDirectory()) { - instance.add(f); // add the directory to look up .class files - listFiles(f, ".jar", jarFiles); - } else if (p.endsWith(".jar")) { - // jar files - jarFiles.add(f); - } else { - throw new RuntimeException("Invalid file \"" + f); - } - } - // add jarFiles if any - for (File f : jarFiles) { - instance.add(f); - } - } - - return instance; - } - - private void add(File f) throws IOException { - fileList.add(new FileInfo(f)); - } - - public static InputStream open(String pathname) throws IOException { - for (FileInfo fi : instance.fileList) { - if (fi.getName().endsWith(".jar")) { - String path = pathname.replace(File.separatorChar, '/'); - JarEntry e = fi.jarfile.getJarEntry(path); - if (e != null) { - return fi.jarfile.getInputStream(e); - } - } else if (fi.getFile().isDirectory()) { - File f = new File(fi.getFile(), pathname); - if (f.exists()) { - return new FileInputStream(f); - } - } else if (fi.file.isFile()) { - if (fi.getName().endsWith(File.separator + pathname)) { - return new FileInputStream(fi.file); - } - } - } - return null; - } - - static ClassFileParser parserForClass(String classname) throws IOException { - String pathname = classname.replace('.', File.separatorChar) + ".class"; - - ClassFileParser cfparser = null; - for (FileInfo fi : instance.fileList) { - if (fi.getName().endsWith(".class")) { - if (fi.getName().endsWith(File.separator + pathname)) { - cfparser = ClassFileParser.newParser(fi.getFile(), true); - break; - } - } else if (fi.getName().endsWith(".jar")) { - JarEntry e = fi.jarfile.getJarEntry(classname.replace('.', '/') + ".class"); - if (e != null) { - cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true); - break; - } - } else if (fi.getFile().isDirectory()) { - File f = new File(fi.getFile(), pathname); - if (f.exists()) { - cfparser = ClassFileParser.newParser(f, true); - break; - } - } - } - return cfparser; - } - - public static void parseAllClassFiles() throws IOException { - instance.parseFiles(); - } - - private void parseFiles() throws IOException { - Set classes = new HashSet(); - - int count = 0; - for (FileInfo fi : fileList) { - // filter out public generated classes (i.e. not public API) - // javax.management.remote.rmi._RMIConnectionImpl_Tie - // javax.management.remote.rmi._RMIServerImpl_Tie - if (fi.getName().endsWith(".class")) { - parseClass(fi); - } else if (fi.getName().endsWith(".jar")) { - Enumeration entries = fi.jarfile.entries(); - while (entries.hasMoreElements()) { - JarEntry e = entries.nextElement(); - if (e.getName().endsWith(".class")) { - ClassFileParser cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true); - cfparser.parseDependency(false); - fi.classCount++; - } else if (!e.isDirectory() && ResourceFile.isResource(e.getName())) { - ResourceFile.addResource(e.getName(), fi.jarfile.getInputStream(e)); - } - } - } else if (fi.getFile().isDirectory()) { - List files = new ArrayList(); - listFiles(fi.getFile(), "", files); - for (File f : files) { - if (f.getName().endsWith(".class")) { - parseClass(fi, f); - } else if (!f.isDirectory() && ResourceFile.isResource(f.getCanonicalPath())) { - String pathname = f.getCanonicalPath(); - String dir = fi.getName(); - if (!pathname.startsWith(dir)) { - throw new RuntimeException("Incorrect pathname " + pathname); - } - String name = pathname.substring(dir.length() + 1, pathname.length()); - BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); - try { - ResourceFile.addResource(name, in); - } finally { - in.close(); - } - } - } - } else { - // should not reach here - throw new RuntimeException("Unexpected class path: " + fi.getFile()); - } - } - } - - private void parseClass(FileInfo fi) throws IOException { - parseClass(fi, fi.getFile()); - } - - private void parseClass(FileInfo fi, File f) throws IOException { - ClassFileParser cfparser = ClassFileParser.newParser(f, true); - cfparser.parseDependency(false); - fi.classCount++; - // need to update the filesize for this directory - fi.filesize += fi.getFile().length(); - - } - - public static void listFiles(File path, String suffix, List result) { - if (path.isDirectory()) { - File[] children = path.listFiles(); - for (File c : children) { - listFiles(c, suffix, result); - } - - } else { - if (suffix.isEmpty() || path.getName().endsWith(suffix)) { - result.add(path); - } - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java b/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java deleted file mode 100644 index b60fdcf2704edb4b208179cc2417481245a89472..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.classanalyzer.Klass.Method; - -import com.sun.tools.classfile.*; -import com.sun.tools.classfile.Instruction.*; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -/** - * - * @author Mandy Chung - */ -public class CodeAttributeParser { - private final ClassFileParser cfparser; - private final ConstantPool cpool; - private final ConstantPoolParser constantPoolParser; - - - static final Map> runtimeReferences = - new HashMap>(); - - - CodeAttributeParser(ClassFileParser parser) { - this.cfparser = parser; - this.cpool = cfparser.classfile.constant_pool; - this.constantPoolParser = cfparser.constantPoolParser; - } - - static boolean parseCodeAttribute = false; // by default don't parse code attribute - static void setParseCodeAttribute(boolean newValue) { - parseCodeAttribute = newValue; - } - - void parse(Code_attribute attr, Klass.Method method) { - if (!parseCodeAttribute) { - return; - } - - for (Instruction instr : attr.getInstructions()) { - try { - instr.accept(instructionVisitor, method); - } catch (ArrayIndexOutOfBoundsException e) { - throw new RuntimeException("error at or after byte " + instr.getPC()); - } - - } - - if (attr.exception_table_langth > 0) { - for (int i = 0; i < - attr.exception_table.length; i++) { - Code_attribute.Exception_data handler = attr.exception_table[i]; - int catch_type = handler.catch_type; - if (catch_type > 0) { - addMethodReference(catch_type, method); - } - - } - } - - } - - - private void addMethodReference(int index, Klass.Method m) { - String method = constantPoolParser.getMethodName(index); - - if (method != null && - (method.equals("java.lang.Class.forName") || - method.equals("java.lang.Class.loadClass") || - method.startsWith("java.util.ServiceLoader.load") || - method.equals("sun.misc.Service.providers"))) { - Set refs = runtimeReferences.get(method); - if (refs == null) { - refs = new TreeSet(); - runtimeReferences.put(method, refs); - } - refs.add(m); - } - } - - Instruction.KindVisitor instructionVisitor = - new Instruction.KindVisitor() { - - public Void visitNoOperands(Instruction instr, Klass.Method m) { - return null; - } - - public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) { - return null; - } - - public Void visitBranch(Instruction instr, int offset, Klass.Method m) { - return null; - } - - public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) { - addMethodReference(index, m); - return null; - } - - public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) { - addMethodReference(index, m); - return null; - } - - public Void visitLocal(Instruction instr, int index, Klass.Method m) { - return null; - } - - public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) { - return null; - } - - public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) { - return null; - } - - public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) { - return null; - } - - public Void visitValue(Instruction instr, int value, Klass.Method m) { - return null; - } - - public Void visitUnknown(Instruction instr, Klass.Method m) { - return null; - } - }; -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java deleted file mode 100644 index 900ad2e7a79dba4cf64fe79a135c6f55575b96c8..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -/** - * - * @author Mandy Chung - */ -public class ConstantPoolAnalyzer { - public static void main(String[] args) throws Exception { - String jdkhome = null; - - // process arguments - int i = 0; - while (i < args.length) { - String arg = args[i++]; - if (arg.equals("-jdkhome")) { - if (i < args.length) { - jdkhome = args[i++]; - } else { - usage(); - } - } - } - if (jdkhome == null) { - usage(); - } - ClassPath.setJDKHome(jdkhome); - ClassPath.parseAllClassFiles(); - } - - private static void usage() { - System.out.println("Usage: ConstantPoolAnalyzer "); - System.out.println("Options: "); - System.out.println("\t-jdkhome where all jars will be parsed"); - System.out.println("\t-cpath where classes and jars will be parsed"); - System.exit(-1); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java deleted file mode 100644 index afa28a93404c29953b4a0ac33de74b6d8102566e..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.tools.classfile.*; -import com.sun.tools.classfile.ConstantPool.*; -import static com.sun.tools.classfile.ConstantPool.*; - -/** - * - * @author Mandy Chung - */ -public class ConstantPoolParser { - - private final ClassFileParser cfparser; - private final StringValueVisitor visitor; - private final ConstantPool cpool; - - ConstantPoolParser(ClassFileParser parser) { - this.cfparser = parser; - this.cpool = cfparser.classfile.constant_pool; - this.visitor = new StringValueVisitor(); - } - - public String stringValue(CPInfo cpInfo) { - return visitor.visit(cpInfo); - } - - public String stringValue(int constant_pool_index) { - try { - return stringValue(cpool.get(constant_pool_index)); - } catch (ConstantPool.InvalidIndex e) { - throw new RuntimeException(e); - } - } - - public void parseDependency() { - ConstantPool.Visitor v = new ConstantPool.Visitor() { - - public Integer visitClass(CONSTANT_Class_info info, Void p) { - try { - String classname = cfparser.checkClassName(info.getName()); - if (classname.isEmpty()) { - return 1; - } - - Klass from = cfparser.this_klass; - Klass to = Klass.getKlass(classname); - ResolutionInfo resInfo = ResolutionInfo.resolvedConstantPool(from, to, info.name_index); - - from.addDep(to, resInfo); - to.addReferrer(from, resInfo); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - return 1; - } - - public Integer visitDouble(CONSTANT_Double_info info, Void p) { - // skip - return 2; - } - - public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) { - // skip - return 1; - } - - public Integer visitFloat(CONSTANT_Float_info info, Void p) { - // skip - return 1; - } - - public Integer visitInteger(CONSTANT_Integer_info info, Void p) { - // skip - return 1; - } - - public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { - // skip - return 1; - } - - public Integer visitLong(CONSTANT_Long_info info, Void p) { - // skip - return 2; - } - - public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) { - // skip - return 1; - } - - public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) { - // skip - return 1; - } - - public Integer visitString(CONSTANT_String_info info, Void p) { - // skip - return 1; - } - - public Integer visitUtf8(CONSTANT_Utf8_info info, Void p) { - // skip - return 1; - } - }; - int cpx = 1; - while (cpx < cpool.size()) { - try { - CPInfo cpInfo = cpool.get(cpx); - cpx += cpInfo.accept(v, null); - } catch (ConstantPool.InvalidIndex ex) { - throw new RuntimeException(ex); - } - } - } - - int getTag(int index) { - try { - return cpool.get(index).getTag(); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - } - - String getDescriptor(int index) { - CPInfo cpInfo; - try { - cpInfo = cpool.get(index); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - - int tag = cpInfo.getTag(); - switch (tag) { - case CONSTANT_Methodref: - case CONSTANT_InterfaceMethodref: - case CONSTANT_Fieldref: - // simplify references within this class - CPRefInfo ref = (CPRefInfo) cpInfo; - try { - return ref.getNameAndTypeInfo().getType(); - } catch (ConstantPoolException ex) { - } - } - return stringValue(cpInfo); - } - - String getMethodName(int index) { - try { - CPInfo cpInfo = cpool.get(index); - if (cpInfo.getTag() == CONSTANT_Methodref || - cpInfo.getTag() == CONSTANT_InterfaceMethodref) { - - // simplify references within this class - CPRefInfo ref = (CPRefInfo) cpInfo; - String classname; - if (ref.class_index == cfparser.classfile.this_class) { - classname = cfparser.this_klass.getClassName(); - } else { - classname = cfparser.checkClassName(ref.getClassName()).replace('/', '.'); - } - String methodname = ref.getNameAndTypeInfo().getName(); - return classname + "." + methodname; - } else { - return null; - } - } catch (InvalidIndex ex) { - throw new RuntimeException(ex); - } catch (ConstantPoolException ex) { - throw new RuntimeException(ex); - } - - } - - class StringValueVisitor implements ConstantPool.Visitor { - - public StringValueVisitor() { - } - - public String visit(CPInfo info) { - return info.accept(this, null); - } - - public String visitClass(CONSTANT_Class_info info, Void p) { - return getCheckedName(info); - } - - String getCheckedName(CONSTANT_Class_info info) { - try { - return checkName(info.getName()); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - public String visitDouble(CONSTANT_Double_info info, Void p) { - return info.value + "d"; - } - - public String visitFieldref(CONSTANT_Fieldref_info info, Void p) { - return visitRef(info, p); - } - - public String visitFloat(CONSTANT_Float_info info, Void p) { - return info.value + "f"; - } - - public String visitInteger(CONSTANT_Integer_info info, Void p) { - return String.valueOf(info.value); - } - - public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { - return visitRef(info, p); - } - - public String visitLong(CONSTANT_Long_info info, Void p) { - return info.value + "l"; - } - - public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) { - return getCheckedName(info) + ":" + getType(info); - } - - String getCheckedName(CONSTANT_NameAndType_info info) { - try { - return checkName(info.getName()); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - String getType(CONSTANT_NameAndType_info info) { - try { - return info.getType(); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - public String visitMethodref(CONSTANT_Methodref_info info, Void p) { - return visitRef(info, p); - } - - public String visitString(CONSTANT_String_info info, Void p) { - try { - int string_index = info.string_index; - return cpool.getUTF8Info(string_index).accept(this, p); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - - public String visitUtf8(CONSTANT_Utf8_info info, Void p) { - String s = info.value; - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - switch (c) { - case '\t': - sb.append('\\').append('t'); - break; - case '\n': - sb.append('\\').append('n'); - break; - case '\r': - sb.append('\\').append('r'); - break; - case '\"': - sb.append('\\').append('\"'); - break; - default: - sb.append(c); - } - } - return sb.toString(); - } - - String visitRef(CPRefInfo info, Void p) { - String cn = getCheckedClassName(info); - String nat; - try { - nat = info.getNameAndTypeInfo().accept(this, p); - } catch (ConstantPoolException e) { - nat = e.getMessage(); - } - return cn + "." + nat; - } - - String getCheckedClassName(CPRefInfo info) { - try { - return checkName(info.getClassName()); - } catch (ConstantPoolException e) { - throw new RuntimeException(e); - } - } - } - /* If name is a valid binary name, return it; otherwise quote it. */ - - private static String checkName(String name) { - if (name == null) { - return "null"; - } - - int len = name.length(); - if (len == 0) { - return "\"\""; - } - - int cc = '/'; - int cp; - for (int k = 0; k < len; k += Character.charCount(cp)) { - cp = name.codePointAt(k); - if ((cc == '/' && !Character.isJavaIdentifierStart(cp)) || (cp != '/' && !Character.isJavaIdentifierPart(cp))) { - return "\"" + name + "\""; - } - cc = cp; - } - return name; - } - - String tagName(int index) { - try { - int tag = cpool.get(index).getTag(); - switch (tag) { - case CONSTANT_Utf8: - return "Utf8"; - case CONSTANT_Integer: - return "int"; - case CONSTANT_Float: - return "float"; - case CONSTANT_Long: - return "long"; - case CONSTANT_Double: - return "double"; - case CONSTANT_Class: - return "class"; - case CONSTANT_String: - return "String"; - case CONSTANT_Fieldref: - return "Field"; - case CONSTANT_Methodref: - return "Method"; - case CONSTANT_InterfaceMethodref: - return "InterfaceMethod"; - case CONSTANT_NameAndType: - return "NameAndType"; - default: - return "(unknown tag)"; - } - } catch (InvalidIndex e) { - throw new RuntimeException(e); - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java b/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java deleted file mode 100644 index 9ea03012bd87d9d20d39e5586a9d9c009f92aa7c..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.List; - -/** - * Config file specifying additional dependency - * Each line consists of: - * -> - * where can be: - * @ClassForName and is its dependency - * @Provider and is the service name - * @Providers and is the list of the service names - * - * @author Mandy Chung - */ -public class DependencyConfig { - private DependencyConfig() { - } - - static void parse(List configs) throws IOException { - for (String s : configs) { - parse(s); - } - } - - private static void parse(String config) throws IOException { - // parse configuration file - FileInputStream in = new FileInputStream(config); - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String line; - int lineNumber = 0; - String type = null; - while ((line = reader.readLine()) != null) { - lineNumber++; - line = line.trim(); - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - if (line.charAt(0) == '@') { - if (AnnotatedDependency.isValidType(line)) { - type = line; - continue; - } else { - throw new RuntimeException(config + ", line " + - lineNumber + ", invalid annotation type."); - } - } - String[] s = line.split("\\s+"); - if (s.length < 3 || !s[1].equals("->")) { - throw new RuntimeException(config + ", line " + - lineNumber + ", is malformed"); - } - String classname = s[0].trim(); - String value = s[2].trim(); - - Klass k = Klass.findKlass(classname); - if (k == null) { - // System.out.println("Warning: " + classname + " cannot be found"); - continue; - } - AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, value, k); - if (dep == null) { - throw new RuntimeException(config + ", line " + - lineNumber + ", is malformed. Fail to construct the dependency."); - } - } - - } finally { - in.close(); - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/Klass.java b/make/modules/tools/src/com/sun/classanalyzer/Klass.java deleted file mode 100644 index 331a499a6c3fca579b7ac1f8b7d5289f326240dd..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/Klass.java +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.TreeSet; - -import com.sun.tools.classfile.AccessFlags; - -/** - * - * @author Mandy Chung - */ -public class Klass implements Comparable { - private final String classname; - private final String packagename; - private Module module; - private boolean isJavaLangObject; - private String[] paths; - private Map> methods; - private AccessFlags accessFlags; - private long filesize; - - private SortedMap> deps; - private SortedMap> referrers; - private List annotatedDeps; - private Set classForNameRefs; - - private Klass(String classname) { - this.classname = classname; - this.paths = classname.replace('.', '/').split("/"); - this.isJavaLangObject = classname.equals("java.lang.Object"); - this.deps = new TreeMap>(); - this.referrers = new TreeMap>(); - this.methods = new HashMap>(); - this.annotatedDeps = new ArrayList(); - this.classForNameRefs = new TreeSet(); - - int pos = classname.lastIndexOf('.'); - this.packagename = (pos > 0) ? classname.substring(0, pos) : ""; - } - - String getBasename() { - return paths[paths.length - 1]; - } - - String getClassName() { - return classname; - } - - String getPackageName() { - return packagename; - } - - String getClassFilePathname() { - StringBuilder sb = new StringBuilder(paths[0]); - for (int i = 1; i < paths.length; i++) { - String p = paths[i]; - sb.append(File.separator).append(p); - } - return sb.append(".class").toString(); - } - - boolean isPublic() { - return accessFlags == null || accessFlags.is(AccessFlags.ACC_PUBLIC); - } - - Module getModule() { - return module; - } - - void setModule(Module m) { - if (module != null) { - throw new RuntimeException("Module for " + this + " already set"); - } - this.module = m; - } - - Set getReferencedClasses() { - return deps.keySet(); - } - - Set getReferencingClasses() { - return referrers.keySet(); - } - - void setAccessFlags(int flags) { - this.accessFlags = new AccessFlags(flags); - } - - void setFileSize(long size) { - this.filesize = size; - } - - long getFileSize() { - return this.filesize; - } - - boolean exists() { - return filesize > 0; - } - - boolean skip(Klass k) { - // skip if either class is a root or same class - return k.isJavaLangObject || this == k || k.classname.equals(classname); - } - - void addDep(Method callee, ResolutionInfo resInfo) { - addDep(callee.getKlass(), resInfo); - } - - void addDep(Klass ref, ResolutionInfo ri) { - if (skip(ref)) { - return; - } - Set resInfos; - if (!deps.containsKey(ref)) { - resInfos = new TreeSet(); - deps.put(ref, resInfos); - } else { - resInfos = deps.get(ref); - } - resInfos.add(ri); - } - - void addReferrer(Method caller, ResolutionInfo resInfo) { - addReferrer(caller.getKlass(), resInfo); - } - - void addReferrer(Klass k, ResolutionInfo ri) { - if (skip(k)) { - return; - } - Set resInfos; - if (!referrers.containsKey(k)) { - resInfos = new TreeSet(); - referrers.put(k, resInfos); - } else { - resInfos = referrers.get(k); - } - resInfos.add(ri); - } - - Method getMethod(String name) { - return getMethod(name, ""); - } - - Method getMethod(String name, String signature) { - Set set; - if (methods.containsKey(name)) { - set = methods.get(name); - } else { - set = new TreeSet(); - methods.put(name, set); - } - - for (Method m : set) { - if (m.getName().equals(name) && m.getSignature().equals(signature)) { - return m; - } - } - Method m = new Method(this, name, signature); - set.add(m); - return m; - } - - @Override - public String toString() { - return classname; - } - - @Override - public int compareTo(Klass o) { - return classname.compareTo(o.classname); - } - - void addAnnotatedDep(AnnotatedDependency dep) { - annotatedDeps.add(dep); - } - - void addClassForNameReference(String method) { - classForNameRefs.add(method); - } - - List getAnnotatedDeps() { - return annotatedDeps; - } - - private static Map classes = new TreeMap(); - static Set getAllClasses() { - return new TreeSet(classes.values()); - } - - static Klass findKlassFromPathname(String filename) { - String name = filename; - if (filename.endsWith(".class")) { - name = filename.substring(0, filename.length() - 6); - } - - // trim ".class" - name = name.replace('/', '.'); - for (Klass k : classes.values()) { - if (name.endsWith(k.getClassName())) { - return k; - } - } - return null; - } - - static Klass findKlass(String classname) { - return classes.get(classname); - } - - static Klass getKlass(String name) { - Klass k; - String classname = name.replace('/', '.'); - if (classname.charAt(classname.length() - 1) == ';') { - classname = classname.substring(0, classname.length() - 1); - } - if (classes.containsKey(classname)) { - k = classes.get(classname); - } else { - k = new Klass(classname); - classes.put(classname, k); - } - return k; - } - - public class Method implements Comparable { - - private final Klass k; - private final String method; - private final String signature; - private long codeLength; - // non-primitive types only - private final List argTypes; - private final Klass returnType; - boolean isAbstract = false; - boolean marked = false; - - public Method(Klass k, String method, String signature) { - this(k, method, signature, null, null); - } - - public Method(Klass k, String method, String signature, Klass returnType, List argTypes) { - this.k = k; - this.method = method; - this.signature = signature; - this.argTypes = argTypes; - this.returnType = returnType; - this.codeLength = 0; - } - - public Klass getKlass() { - return k; - } - - public String getName() { - return method; - } - - public String getSignature() { - return signature; - } - - public Klass getReturnType() { - return returnType; - } - - public List argTypes() { - return argTypes; - } - - public void setCodeLength(long len) { - this.codeLength = len; - } - - public long getCodeLength() { - return codeLength; - } - - @Override - public boolean equals(Object o) { - if (o instanceof Method) { - return compareTo((Method) o) == 0; - } else { - return false; - } - } - - @Override - public int hashCode() { - int hash = 3; - hash = 71 * hash + (this.k != null ? this.k.hashCode() : 0); - hash = 71 * hash + (this.method != null ? this.method.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - if (signature.isEmpty()) { - return k.classname + "." + method; - } else { - return signature; - } - } - - public String toHtmlString() { - return toString().replace("<", "<").replace(">", ">"); - } - - boolean isClinit() { - return method.equals(""); - } - - public int compareTo(Method m) { - if (k == m.getKlass()) { - if (method.equals(m.method)) { - return signature.compareTo(m.signature); - } else { - return method.compareTo(m.method); - } - } else { - return k.compareTo(m.getKlass()); - } - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/Module.java b/make/modules/tools/src/com/sun/classanalyzer/Module.java deleted file mode 100644 index 1a27834b21688558299151f188101531cb4d1345..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/Module.java +++ /dev/null @@ -1,693 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.classanalyzer; - -import com.sun.classanalyzer.AnnotatedDependency.OptionalDependency; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayDeque; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * - * @author Mandy Chung - */ -public class Module implements Comparable { - - private static Map modules = new LinkedHashMap(); - - public static Module addModule(ModuleConfig config) { - String name = config.module; - if (modules.containsKey(name)) { - throw new RuntimeException("module \"" + name + "\" already exists"); - } - - Module m = new Module(config); - modules.put(name, m); - return m; - } - - public static Module findModule(String name) { - return modules.get(name); - } - - static Collection getAllModules() { - return Collections.unmodifiableCollection(modules.values()); - } - private final String name; - private final ModuleConfig config; - private final Set classes; - private final Set resources; - private final Set unresolved; - private final Set dependents; - private final Map packages; - private final Set members; - private Module group; - private boolean isBaseModule; - - private Module(ModuleConfig config) { - this.name = config.module; - this.isBaseModule = config.isBase; - this.classes = new TreeSet(); - this.resources = new TreeSet(); - this.config = config; - this.unresolved = new HashSet(); - this.dependents = new TreeSet(); - this.packages = new TreeMap(); - this.members = new TreeSet(); - this.group = this; // initialize to itself - } - - String name() { - return name; - } - - Module group() { - return group; - } - - boolean isBase() { - return isBaseModule; - } - - Set members() { - return members; - } - - boolean contains(Klass k) { - return k != null && classes.contains(k); - } - - boolean isEmpty() { - return classes.isEmpty() && resources.isEmpty(); - } - - /** - * Returns an Iterable of Dependency, only one for each dependent - * module of the strongest dependency (i.e. - * hard static > hard dynamic > optional static > optional dynamic - */ - Iterable dependents() { - Map deps = new LinkedHashMap(); - for (Dependency dep : dependents) { - Dependency d = deps.get(dep.module); - if (d == null || dep.compareTo(d) > 0) { - deps.put(dep.module, dep); - } - } - return deps.values(); - } - - @Override - public int compareTo(Module o) { - if (o == null) { - return -1; - } - return name.compareTo(o.name); - } - - @Override - public String toString() { - return name; - } - - void addKlass(Klass k) { - classes.add(k); - k.setModule(this); - - // update package statistics - String pkg = k.getPackageName(); - PackageInfo pkginfo = packages.get(pkg); - if (pkginfo == null) { - pkginfo = new PackageInfo(pkg); - packages.put(pkg, pkginfo); - } - if (k.exists()) { - // only count the class that is parsed - pkginfo.add(k.getFileSize()); - } - } - - void addResource(ResourceFile res) { - resources.add(res); - res.setModule(this); - } - - void processRootsAndReferences() { - // start with the root set - Deque pending = new ArrayDeque(); - for (Klass k : Klass.getAllClasses()) { - if (k.getModule() != null) { - continue; - } - String classname = k.getClassName(); - if (config.matchesRoot(classname) && !config.isExcluded(classname)) { - addKlass(k); - pending.add(k); - } - } - - // follow all references - Klass k; - while ((k = pending.poll()) != null) { - if (!classes.contains(k)) { - addKlass(k); - } - for (Klass other : k.getReferencedClasses()) { - Module otherModule = other.getModule(); - if (otherModule != null && otherModule != this) { - // this module is dependent on otherModule - addDependency(k, other); - continue; - } - - if (!classes.contains(other)) { - if (config.isExcluded(other.getClassName())) { - // reference to an excluded class - unresolved.add(new Reference(k, other)); - } else { - pending.add(other); - } - } - } - } - - // add other matching classes that don't require dependency analysis - for (Klass c : Klass.getAllClasses()) { - if (c.getModule() == null) { - String classname = c.getClassName(); - if (config.matchesIncludes(classname) && !config.isExcluded(classname)) { - addKlass(c); - // dependencies - for (Klass other : c.getReferencedClasses()) { - Module otherModule = other.getModule(); - if (otherModule == null) { - unresolved.add(new Reference(c, other)); - } else { - if (otherModule != this) { - // this module is dependent on otherModule - addDependency(c, other); - } - } - } - } - } - } - - - // add other matching classes that don't require dependency analysis - for (ResourceFile res : ResourceFile.getAllResources()) { - if (res.getModule() == null) { - String name = res.getName(); - if (config.matchesIncludes(name) && !config.isExcluded(name)) { - addResource(res); - } - } - } - } - - void addDependency(Klass from, Klass to) { - Dependency dep = new Dependency(from, to); - dependents.add(dep); - } - - void fixupDependencies() { - // update dependencies for classes that were allocated to modules after - // this module was processed. - for (Reference ref : unresolved) { - Module m = ref.referree().getModule(); - if (m == null || m != this) { - addDependency(ref.referrer, ref.referree); - } - } - - fixupAnnotatedDependencies(); - } - - private void fixupAnnotatedDependencies() { - // add dependencies that this klass may depend on due to the AnnotatedDependency - dependents.addAll(AnnotatedDependency.getDependencies(this)); - } - - boolean isModuleDependence(Klass k) { - Module m = k.getModule(); - return m == null || (!classes.contains(k) && !m.isBase()); - } - - Module getModuleDependence(Klass k) { - if (isModuleDependence(k)) { - Module m = k.getModule(); - if (group == this && m != null) { - // top-level module - return m.group; - } else { - return m; - } - } - return null; - } - -

void visit(Set visited, Visitor

visitor, P p) { - if (!visited.contains(this)) { - visited.add(this); - visitor.preVisit(this, p); - for (Module m : members) { - m.visit(visited, visitor, p); - visitor.postVisit(this, m, p); - } - } else { - throw new RuntimeException("Cycle detected: module " + this.name); - } - } - - void addMember(Module m) { - // merge class list - for (Klass k : m.classes) { - classes.add(k); - } - - // merge resource list - for (ResourceFile res : m.resources) { - resources.add(res); - } - - // merge the package statistics - for (PackageInfo pinfo : m.getPackageInfos()) { - String packageName = pinfo.pkgName; - PackageInfo pkginfo = packages.get(packageName); - if (pkginfo == null) { - pkginfo = new PackageInfo(packageName); - packages.put(packageName, pkginfo); - } - pkginfo.add(pinfo); - } - } - - static void buildModuleMembers() { - // set up module member relationship - for (Module m : modules.values()) { - m.group = m; // initialize to itself - for (String name : m.config.members()) { - Module member = modules.get(name); - if (member == null) { - throw new RuntimeException("module \"" + name + "\" doesn't exist"); - } - m.members.add(member); - } - } - - // set up the top-level module - Visitor groupSetter = new Visitor() { - - public void preVisit(Module m, Module p) { - m.group = p; - if (p.isBaseModule) { - // all members are also base - m.isBaseModule = true; - } - } - - public void postVisit(Module m, Module child, Module p) { - // nop - breadth-first search - } - }; - - // propagate the top-level module to all its members - for (Module p : modules.values()) { - for (Module m : p.members) { - if (m.group == m) { - m.visit(new TreeSet(), groupSetter, p); - } - } - } - - Visitor mergeClassList = new Visitor() { - - public void preVisit(Module m, Module p) { - // nop - depth-first search - } - - public void postVisit(Module m, Module child, Module p) { - m.addMember(child); - } - }; - - Set visited = new TreeSet(); - for (Module m : modules.values()) { - if (m.group() == m) { - if (m.members().size() > 0) { - // merge class list from all its members - m.visit(visited, mergeClassList, m); - } - - // clear the dependencies before fixup - m.dependents.clear(); - - // fixup dependencies - for (Klass k : m.classes) { - for (Klass other : k.getReferencedClasses()) { - if (m.isModuleDependence(other)) { - // this module is dependent on otherModule - m.addDependency(k, other); - } - } - } - - // add dependencies that this klass may depend on due to the AnnotatedDependency - m.fixupAnnotatedDependencies(); - } - } - } - - class PackageInfo implements Comparable { - - final String pkgName; - int count; - long filesize; - - PackageInfo(String name) { - this.pkgName = name; - this.count = 0; - this.filesize = 0; - } - - void add(PackageInfo pkg) { - this.count += pkg.count; - this.filesize += pkg.filesize; - } - - void add(long size) { - count++; - filesize += size; - - } - - @Override - public int compareTo(Object o) { - return pkgName.compareTo(((PackageInfo) o).pkgName); - } - } - - Set getPackageInfos() { - return new TreeSet(packages.values()); - } - - void printSummaryTo(String output) throws IOException { - PrintWriter writer = new PrintWriter(output); - try { - long total = 0L; - int count = 0; - writer.format("%10s\t%10s\t%s\n", "Bytes", "Classes", "Package name"); - for (String pkg : packages.keySet()) { - PackageInfo info = packages.get(pkg); - if (info.count > 0) { - writer.format("%10d\t%10d\t%s\n", info.filesize, info.count, pkg); - total += info.filesize; - count += info.count; - } - } - - writer.format("\nTotal: %d bytes (uncompressed) %d classes\n", total, count); - } finally { - writer.close(); - } - - } - - void printClassListTo(String output) throws IOException { - // no file created if the module doesn't have any class nor resource - if (isEmpty()) { - return; - } - - PrintWriter writer = new PrintWriter(output); - try { - for (Klass c : classes) { - if (c.exists()) { - writer.format("%s\n", c.getClassFilePathname()); - } else { - trace("%s in module %s missing\n", c, this); - } - } - - } finally { - writer.close(); - } - } - - void printResourceListTo(String output) throws IOException { - // no file created if the module doesn't have any resource file - if (resources.isEmpty()) { - return; - } - - PrintWriter writer = new PrintWriter(output); - try { - for (ResourceFile res : resources) { - writer.format("%s\n", res.getPathname()); - } - } finally { - writer.close(); - } - } - - void printDependenciesTo(String output, boolean showDynamic) throws IOException { - // no file created if the module doesn't have any class - if (isEmpty()) { - return; - } - - PrintWriter writer = new PrintWriter(output); - try { - // classes that this klass may depend on due to the AnnotatedDependency - Map> annotatedDeps = AnnotatedDependency.getReferences(this); - - for (Klass klass : classes) { - Set references = klass.getReferencedClasses(); - for (Klass other : references) { - String classname = klass.getClassName(); - boolean optional = OptionalDependency.isOptional(klass, other); - if (optional) { - classname = "[optional] " + classname; - } - - Module m = getModuleDependence(other); - if (m != null || other.getModule() == null) { - writer.format("%-40s -> %s (%s)", classname, other, m); - Reference ref = new Reference(klass, other); - if (annotatedDeps.containsKey(ref)) { - for (AnnotatedDependency ad : annotatedDeps.get(ref)) { - writer.format(" %s", ad.getTag()); - } - // printed; so remove the dependency from the annotated deps list - annotatedDeps.remove(ref); - } - writer.format("\n"); - } - } - } - - - // print remaining dependencies specified in AnnotatedDependency list - if (annotatedDeps.size() > 0) { - for (Map.Entry> entry : annotatedDeps.entrySet()) { - Reference ref = entry.getKey(); - Module m = getModuleDependence(ref.referree); - if (m != null || ref.referree.getModule() == null) { - String classname = ref.referrer.getClassName(); - boolean optional = true; - boolean dynamic = true; - String tag = ""; - for (AnnotatedDependency ad : entry.getValue()) { - if (optional && !ad.isOptional()) { - optional = false; - tag = ad.getTag(); - } - if (!ad.isDynamic()) { - dynamic = false; - } - } - if (!showDynamic && optional && dynamic) { - continue; - } - if (optional) { - if (dynamic) { - classname = "[dynamic] " + classname; - } else { - classname = "[optional] " + classname; - } - } - writer.format("%-40s -> %s (%s) %s%n", classname, ref.referree, m, tag); - } - } - } - - } finally { - writer.close(); - } - } - - static class Dependency implements Comparable { - - final Module module; - final boolean optional; - final boolean dynamic; - - Dependency(Klass from, Klass to) { - // static dependency - this.module = to.getModule() != null ? to.getModule().group() : null; - this.optional = OptionalDependency.isOptional(from, to); - this.dynamic = false; - } - - Dependency(Module m, boolean optional, boolean dynamic) { - this.module = m != null ? m.group() : null; - this.optional = optional; - this.dynamic = dynamic; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Dependency)) { - return false; - } - if (this == obj) { - return true; - } - - Dependency d = (Dependency) obj; - if (this.module != d.module) { - return false; - } else { - return this.optional == d.optional && this.dynamic == d.dynamic; - } - } - - @Override - public int hashCode() { - int hash = 3; - hash = 19 * hash + (this.module != null ? this.module.hashCode() : 0); - hash = 19 * hash + (this.optional ? 1 : 0); - hash = 19 * hash + (this.dynamic ? 1 : 0); - return hash; - } - - @Override - public int compareTo(Dependency d) { - if (this.equals(d)) { - return 0; - } - - // Hard static > hard dynamic > optional static > optional dynamic - if (this.module == d.module) { - if (this.optional == d.optional) { - return this.dynamic ? -1 : 1; - } else { - return this.optional ? -1 : 1; - } - } else if (this.module != null && d.module != null) { - return (this.module.compareTo(d.module)); - } else { - return (this.module == null) ? -1 : 1; - } - } - - @Override - public String toString() { - String s = module.name(); - if (dynamic && optional) { - s += " (dynamic)"; - } else if (optional) { - s += " (optional)"; - } - return s; - } - } - - static class Reference implements Comparable { - - private final Klass referrer, referree; - - Reference(Klass referrer, Klass referree) { - this.referrer = referrer; - this.referree = referree; - } - - Klass referrer() { - return referrer; - } - - Klass referree() { - return referree; - } - - @Override - public int hashCode() { - return referrer.hashCode() ^ referree.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Reference)) { - return false; - } - if (this == obj) { - return true; - } - - Reference r = (Reference) obj; - return (this.referrer.equals(r.referrer) && - this.referree.equals(r.referree)); - } - - @Override - public int compareTo(Reference r) { - int ret = referrer.compareTo(r.referrer); - if (ret == 0) { - ret = referree.compareTo(r.referree); - } - return ret; - } - } - - interface Visitor

{ - - public void preVisit(Module m, P param); - - public void postVisit(Module m, Module child, P param); - } - private static boolean traceOn = System.getProperty("classanalyzer.debug") != null; - - private static void trace(String format, Object... params) { - System.err.format(format, params); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java b/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java deleted file mode 100644 index 785cb506e5cef1b7f668b58bf4585e85dee6215f..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Pattern; - -/** - * - * @author Mandy Chung - */ -public class ModuleConfig { - - private static String baseModuleName = "base"; - private final Set roots; - private final Set includes; - private final Filter filter; - private List members; - final String module; - final boolean isBase; - - private ModuleConfig(String name) throws IOException { - this.roots = new TreeSet(); - this.includes = new TreeSet(); - this.module = name; - this.isBase = name.equals(baseModuleName); - this.filter = new Filter(this); - } - - List members() { - if (members == null) { - members = new LinkedList(); - - for (String s : includes) { - if (!s.contains("*") && Module.findModule(s) != null) { - // module member - members.add(s); - } - } - } - return members; - } - - boolean matchesRoot(String name) { - for (String pattern : roots) { - if (matches(name, pattern)) { - return true; - } - } - return false; - } - - boolean matchesIncludes(String name) { - for (String pattern : includes) { - if (matches(name, pattern)) { - return true; - } - } - return false; - } - - boolean isExcluded(String name) { - return filter.isExcluded(name); - } - - boolean matchesPackage(String packageName, String pattern) { - int pos = pattern.lastIndexOf('.'); - String pkg = pos > 0 ? pattern.substring(0, pos) : ""; - return packageName.equals(pkg); - } - - - boolean matches(String name, String pattern) { - if (pattern.contains("**") && !pattern.endsWith("**")) { - throw new UnsupportedOperationException("Not yet implemented"); - } - - String javaName = name; - - boolean isResourceFile = name.indexOf('/') >= 0; - if (isResourceFile) { - // it's a resource file; convert the name as a java - javaName = name.replace('/', '.'); - } - if (pattern.indexOf('/') < 0) { - // if the pattern doesn't contain '/ - return matchesJavaName(javaName, pattern); - } else { - if (isResourceFile) { - // the pattern is for matching resource file - return matchesNameWithSlash(name, pattern); - } else { - return false; - } - } - } - - boolean matchesJavaName(String name, String pattern) { - int pos = name.lastIndexOf('.'); - String packageName = pos > 0 ? name.substring(0, pos) : ""; - if (pattern.endsWith("**")) { - String p = pattern.substring(0, pattern.length() - 2); - return name.startsWith(p); - } else if (pattern.endsWith("*") && pattern.indexOf('*') == pattern.lastIndexOf('*')) { - if (matchesPackage(packageName, pattern)) { - // package name has to be exact match - String p = pattern.substring(0, pattern.length() - 1); - return name.startsWith(p); - } else { - return false; - } - } else if (pattern.contains("*")) { - String basename = pos > 0 ? name.substring(pos + 1, name.length()) : name; - pos = pattern.indexOf('*'); - String prefix = pattern.substring(0, pos); - String suffix = pattern.substring(pos + 1, pattern.length()); - if (name.startsWith(prefix) && matchesPackage(packageName, prefix)) { - // package name has to be exact match - if (suffix.contains("*")) { - return name.matches(convertToRegex(pattern)); - } else { - return basename.endsWith(suffix); - } - } else { - // we don't support wildcard be used in the package name - return false; - } - } else { - // exact match or inner class - return name.equals(pattern) || name.startsWith(pattern + "$"); - } - } - - boolean matchesNameWithSlash(String name, String pattern) { - if (pattern.endsWith("**")) { - String p = pattern.substring(0, pattern.length() - 2); - return name.startsWith(p); - } else if (pattern.contains("*")) { - int pos = pattern.indexOf('*'); - String prefix = pattern.substring(0, pos); - String suffix = pattern.substring(pos + 1, pattern.length()); - String tail = name.substring(pos, name.length()); - - if (!name.startsWith(prefix)) { - // prefix has to exact match - return false; - } - - if (pattern.indexOf('*') == pattern.lastIndexOf('*')) { - // exact match prefix with no '/' in the tail string - String wildcard = tail.substring(0, tail.length() - suffix.length()); - return tail.indexOf('/') < 0 && tail.endsWith(suffix); - } - - if (suffix.contains("*")) { - return matchesNameWithSlash(tail, suffix); - } else { - // tail ends with the suffix while no '/' in the wildcard matched string - String any = tail.substring(0, tail.length() - suffix.length()); - return tail.endsWith(suffix) && any.indexOf('/') < 0; - } - } else { - // exact match - return name.equals(pattern); - } - } - - private String convertToRegex(String pattern) { - StringBuilder sb = new StringBuilder(); - int i = 0; - int index = 0; - int plen = pattern.length(); - while (i < plen) { - char p = pattern.charAt(i); - if (p == '*') { - sb.append("(").append(pattern.substring(index, i)).append(")"); - if (i + 1 < plen && pattern.charAt(i + 1) == '*') { - sb.append(".*"); - index = i + 2; - } else { - sb.append("[^\\.]*"); - index = i + 1; - } - } - i++; - } - if (index < plen) { - sb.append("(").append(pattern.substring(index, plen)).append(")"); - } - return sb.toString(); - } - - static class Filter { - - final ModuleConfig config; - final Set exclude = new TreeSet(); - final Set allow = new TreeSet(); - - Filter(ModuleConfig config) { - this.config = config; - } - - Filter exclude(String pattern) { - exclude.add(pattern); - return this; - } - - Filter allow(String pattern) { - allow.add(pattern); - return this; - } - - String allowedBy(String name) { - String allowedBy = null; - for (String pattern : allow) { - if (config.matches(name, pattern)) { - if (name.equals(pattern)) { - return pattern; // exact match - } - if (allowedBy == null) { - allowedBy = pattern; - } else { - if (pattern.length() > allowedBy.length()) { - allowedBy = pattern; - } - } - } - } - return allowedBy; - } - - String excludedBy(String name) { - String allowedBy = allowedBy(name); - String excludedBy = null; - - if (allowedBy != null && name.equals(allowedBy)) { - return null; // exact match - } - for (String pattern : exclude) { - if (config.matches(name, pattern)) { - // not matched by allowed rule or exact match - if (allowedBy == null || name.equals(pattern)) { - return pattern; - } - if (excludedBy == null) { - excludedBy = pattern; - } else { - if (pattern.length() > excludedBy.length()) { - excludedBy = pattern; - } - } - } - } - return excludedBy; - } - - boolean isExcluded(String name) { - String allowedBy = allowedBy(name); - String excludedBy = excludedBy(name); - - if (excludedBy == null) { - return false; - } - // not matched by allowed rule or exact match - if (allowedBy == null || name.equals(excludedBy)) { - return true; - } - - if (allowedBy == null) { - return true; - } - if (allowedBy != null && - excludedBy.length() > allowedBy.length()) { - return true; - } - return false; - } - } - - private static String trimComment(String line) { - StringBuilder sb = new StringBuilder(); - - int pos = 0; - while (pos >= 0 && pos < line.length()) { - int c1 = line.indexOf("//", pos); - if (c1 > 0 && !Character.isWhitespace(line.charAt(c1-1))) { - // not a comment - c1 = -1; - } - - int c2 = line.indexOf("/*", pos); - if (c2 > 0 && !Character.isWhitespace(line.charAt(c2-1))) { - // not a comment - c2 = -1; - } - - int c = line.length(); - int n = line.length(); - if (c1 >= 0 || c2 >= 0) { - if (c1 >= 0) { - c = c1; - } - if (c2 >= 0 && c2 < c) { - c = c2; - } - int c3 = line.indexOf("*/", c2 + 2); - if (c == c2 && c3 > c2) { - n = c3 + 2; - } - } - if (c > 0) { - if (sb.length() > 0) { - // add a whitespace if multiple comments on one line - sb.append(" "); - } - sb.append(line.substring(pos, c)); - } - pos = n; - } - return sb.toString(); - } - - private static boolean beginBlockComment(String line) { - int pos = 0; - while (pos >= 0 && pos < line.length()) { - int c = line.indexOf("/*", pos); - if (c < 0) { - return false; - } - - if (c > 0 && !Character.isWhitespace(line.charAt(c-1))) { - return false; - } - - int c1 = line.indexOf("//", pos); - if (c1 >= 0 && c1 < c) { - return false; - } - - int c2 = line.indexOf("*/", c + 2); - if (c2 < 0) { - return true; - } - pos = c + 2; - } - return false; - } - - static void setBaseModule(String name) { - baseModuleName = name; - } - // TODO: we shall remove "-" from the regex once we define - // the naming convention for the module names without dashes - static final Pattern classNamePattern = Pattern.compile("[\\w\\.\\*_$-/]+"); - - static List readConfigurationFile(String file) throws IOException { - List result = new ArrayList(); - // parse configuration file - FileInputStream in = new FileInputStream(file); - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String line; - - int lineNumber = 0; - boolean inRoots = false; - boolean inIncludes = false; - boolean inAllows = false; - boolean inExcludes = false; - boolean inBlockComment = false; - ModuleConfig config = null; - - while ((line = reader.readLine()) != null) { - lineNumber++; - - if (inBlockComment) { - int c = line.indexOf("*/"); - if (c >= 0) { - line = line.substring(c + 2, line.length()); - inBlockComment = false; - } else { - // skip lines until end of comment block - continue; - } - } - - inBlockComment = beginBlockComment(line); - - line = trimComment(line).trim(); - // ignore empty lines - if (line.length() == 0) { - continue; - } - - String values; - if (inRoots || inIncludes || inExcludes || inAllows) { - values = line; - } else { - String[] s = line.split("\\s+"); - String keyword = s[0].trim(); - if (keyword.equals("module")) { - if (s.length != 3 || !s[2].trim().equals("{")) { - throw new RuntimeException(file + ", line " + - lineNumber + ", is malformed"); - } - config = new ModuleConfig(s[1].trim()); - result.add(config); - // switch to a new module; so reset the flags - inRoots = false; - inIncludes = false; - inExcludes = false; - inAllows = false; - continue; - } else if (keyword.equals("roots")) { - inRoots = true; - } else if (keyword.equals("include")) { - inIncludes = true; - } else if (keyword.equals("exclude")) { - inExcludes = true; - } else if (keyword.equals("allow")) { - inAllows = true; - } else if (keyword.equals("}")) { - if (config == null || s.length != 1) { - throw new RuntimeException(file + ", line " + - lineNumber + ", is malformed"); - } else { - // end of a module - config = null; - continue; - } - } else { - throw new RuntimeException(file + ", \"" + keyword + "\" on line " + - lineNumber + ", is not recognized"); - } - values = line.substring(keyword.length(), line.length()).trim(); - } - - if (config == null) { - throw new RuntimeException(file + ", module not specified"); - } - - int len = values.length(); - if (len == 0) { - continue; - } - char lastchar = values.charAt(len - 1); - if (lastchar != ',' && lastchar != ';') { - throw new RuntimeException(file + ", line " + - lineNumber + ", is malformed:" + - " ',' or ';' is missing."); - } - - values = values.substring(0, len - 1); - // parse the values specified for a keyword specified - for (String s : values.split(",")) { - s = s.trim(); - if (s.length() > 0) { - if (!classNamePattern.matcher(s).matches()) { - throw new RuntimeException(file + ", line " + - lineNumber + ", is malformed: \"" + s + "\""); - } - if (inRoots) { - config.roots.add(s); - } else if (inIncludes) { - config.includes.add(s); - } else if (inExcludes) { - config.filter.exclude(s); - } else if (inAllows) { - config.filter.allow(s); - } - - } - } - if (lastchar == ';') { - inRoots = false; - inIncludes = false; - inExcludes = false; - inAllows = false; - } - } - - if (inBlockComment) { - throw new RuntimeException(file + ", line " + - lineNumber + ", missing \"*/\" to end a block comment"); - } - if (config != null) { - throw new RuntimeException(file + ", line " + - lineNumber + ", missing \"}\" to end module definition" + - " for \"" + config.module + "\""); - } - - } finally { - in.close(); - } - - return result; - } - - private String format(String keyword, Collection values) { - if (values.size() == 0) { - return ""; - } - - StringBuilder sb = new StringBuilder(); - String format = "%4s%-9s"; - String spaces = String.format(format, "", ""); - sb.append(String.format(format, "", keyword)); - int count = 0; - for (String s : values) { - if (count > 0) { - sb.append(",\n").append(spaces); - } else if (count++ > 0) { - sb.append(", "); - } - sb.append(s); - } - if (count > 0) { - sb.append(";\n"); - } - return sb.toString(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("module " + module).append(" {\n"); - sb.append(format("include", includes)); - sb.append(format("root", roots)); - sb.append(format("allow", filter.allow)); - sb.append(format("exclude", filter.exclude)); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java b/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java deleted file mode 100644 index f8ccda99a396a4534d1cd43d9caa710308cb4004..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import com.sun.classanalyzer.Klass.Method; - -/** - * - * @author mchung - */ -public class ResolutionInfo implements Comparable { - - enum Type { - - REFLECTION("reflection", true), - NATIVE("native", true), - INTERFACE("interface", false), - SUPER("super", false), - EXPLICIT("explicit", false), - VERIFICATION("verification", false), - METHODTRACE("method trace", true), - CONSTANT_POOL("constant pool", true), - CHECKED_EXCEPTION("throws", true), - METHOD("method", true), - FIELD("field", true), - EXTENDS("extends", true), - IMPLEMENTS("implements", true), - NOINFO("No info", false); - - private final String name; - private final boolean hasInfo; - - private Type(String name, boolean hasInfo) { - this.name = name; - this.hasInfo = hasInfo; - } - - public String getName() { - return name; - } - - public boolean hasInfo() { - return hasInfo; - } - - public static Type getType(String s) { - if (s.isEmpty()) { - return NOINFO; - } - for (Type t : values()) { - if (s.equals(t.name)) { - return t; - } - } - // Need to fix the VM output to add "native" - // throw new IllegalArgumentException("Invalid ResolutionInfo.type \"" + s + "\""); - System.out.println("WARNING: Invalid ResolutionInfo.type \"" + s + "\""); - return null; - } - } - final Klass fromClass; - final Method method; - final Klass toClass; - final int linenumber; - final Type type; - final String info; - private boolean isPublic = false; - - private ResolutionInfo(Klass from, Klass to, int linenumber, Type type, String info) { - this.fromClass = from; - this.method = null; - this.toClass = to; - this.linenumber = linenumber; - this.type = type; - this.info = info; - } - - private ResolutionInfo(Klass from, Method m, Klass to, int linenumber, Type type) { - this.fromClass = from; - this.method = m; - this.toClass = to; - this.linenumber = linenumber; - this.type = type; - this.info = m.toString(); - } - - public boolean isPublic() { - return isPublic; - } - - public void setPublicAccess(boolean value) { - isPublic = value; - } - static ResolutionInfo resolved(Klass from, Klass to) { - return new ResolutionInfo(from, to, 0, Type.NOINFO, ""); - } - - static ResolutionInfo resolved(Klass from, Klass to, int linenumber) { - return new ResolutionInfo(from, to, linenumber, Type.NOINFO, ""); - } - - static ResolutionInfo resolved(Klass from, Klass to, int linenumber, String reason) { - String[] ss = reason.split("\\s+"); - Type type; - String info; - if (linenumber == -1) { - type = Type.NATIVE; - info = ss[0]; // native method name - } else { - info = ss.length == 2 ? ss[1] : ""; - type = Type.getType(ss[0]); - if (type == null) { - if (reason.isEmpty()) { - throw new IllegalArgumentException("Invalid type: " + reason + " (" + ss[0] + ")" + ss.length); - } - // assume it's native - type = Type.NATIVE; - info = reason.isEmpty() ? ss[0] : reason; - } - } - - return new ResolutionInfo(from, to, linenumber, type, info); - } - - static ResolutionInfo resolved(Klass from, Klass to, Method callee) { - return new ResolutionInfo(from, callee, to, 0, Type.METHODTRACE); - } - - static ResolutionInfo resolvedConstantPool(Klass from, Klass to, int index) { - return new ResolutionInfo(from, to, 0, Type.CONSTANT_POOL, "#" + index); - } - - static ResolutionInfo resolvedField(Klass from, Klass to, String fieldname) { - return new ResolutionInfo(from, to, 0, Type.FIELD, fieldname); - } - - static ResolutionInfo resolvedMethodSignature(Klass from, Klass to, Method m) { - return new ResolutionInfo(from, m, to, 0, Type.METHOD); - } - - static ResolutionInfo resolvedCheckedException(Klass from, Klass to, Method m) { - return new ResolutionInfo(from, m, to, 0, Type.CHECKED_EXCEPTION); - } - - static ResolutionInfo resolvedExtends(Klass from, Klass to) { - String info = from.getClassName() + " implements " + to.getClassName(); - return new ResolutionInfo(from, to, 0, Type.EXTENDS, info); - } - - static ResolutionInfo resolvedImplements(Klass from, Klass to) { - String info = from.getClassName() + " implements " + to.getClassName(); - return new ResolutionInfo(from, to, 0, Type.IMPLEMENTS, info); - } - - @Override - public int compareTo(ResolutionInfo ri) { - if (this.fromClass == ri.fromClass && - this.toClass == ri.toClass && - this.linenumber == ri.linenumber && - this.type == ri.type && - this.info.equals(ri.info)) { - return 0; - } else if (this.fromClass == ri.fromClass) { - if (this.linenumber > ri.linenumber) { - return 1; - } else if (this.linenumber < ri.linenumber) { - return -1; - } else if (this.type != ri.type) { - return this.type.getName().compareTo(ri.type.getName()); - } else if (this.toClass != ri.toClass) { - return this.toClass.compareTo(ri.toClass); - } else { - return this.info.compareTo(ri.info); - } - } else { - return this.fromClass.compareTo(ri.fromClass); - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java b/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java deleted file mode 100644 index 76ea464cc79e65e90ca7d9941aa7ab833b7f136d..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -/** - * - * @author Mandy Chung - */ -public class ResourceFile implements Comparable { - - private final String pathname; - private Module module; - - ResourceFile(String pathname) { - this.pathname = pathname.replace(File.separatorChar, '/'); - } - - Module getModule() { - return module; - } - - void setModule(Module m) { - if (module != null) { - throw new RuntimeException("Module for " + this + " already set"); - } - this.module = m; - } - - String getName() { - return pathname; - } - - String getPathname() { - return pathname; - } - - @Override - public String toString() { - return pathname; - } - - @Override - public int compareTo(ResourceFile o) { - return pathname.compareTo(o.pathname); - } - static Set resources = new TreeSet(); - - static boolean isResource(String pathname) { - String name = pathname.replace(File.separatorChar, '/'); - - if (name.endsWith("META-INF/MANIFEST.MF")) { - return false; - } - if (name.contains("META-INF/JCE_RSA.")) { - return false; - } - - return true; - } - - static void addResource(String name, InputStream in) { - ResourceFile res; - name = name.replace(File.separatorChar, '/'); - if (name.startsWith("META-INF/services")) { - res = new ServiceProviderConfigFile(name, in); - } else { - res = new ResourceFile(name); - } - resources.add(res); - } - - static Set getAllResources() { - return Collections.unmodifiableSet(resources); - } - - static class ServiceProviderConfigFile extends ResourceFile { - - private final List providers = new ArrayList(); - private final String service; - ServiceProviderConfigFile(String pathname, InputStream in) { - super(pathname); - readServiceConfiguration(in, providers); - this.service = pathname.substring("META-INF/services".length() + 1, pathname.length()); - } - - @Override - String getName() { - if (providers.isEmpty()) { - return service; - } else { - // just use the first one for matching - return providers.get(0); - } - } - - @SuppressWarnings("empty-statement") - void readServiceConfiguration(InputStream in, List names) { - BufferedReader br = null; - try { - if (in != null) { - // Properties doesn't perserve the order of the input file - br = new BufferedReader(new InputStreamReader(in, "utf-8")); - int lc = 1; - while ((lc = parseLine(br, lc, names)) >= 0); - } - } catch (IOException ex) { - throw new RuntimeException(ex); - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - } - } - - // Parse a single line from the given configuration file, adding the name - // on the line to the names list. - // - private int parseLine(BufferedReader r, int lc, List names) throws IOException { - String ln = r.readLine(); - if (ln == null) { - return -1; - } - int ci = ln.indexOf('#'); - if (ci >= 0) { - ln = ln.substring(0, ci); - } - ln = ln.trim(); - int n = ln.length(); - if (n != 0) { - if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) { - throw new RuntimeException("Illegal configuration-file syntax"); - } - int cp = ln.codePointAt(0); - if (!Character.isJavaIdentifierStart(cp)) { - throw new RuntimeException("Illegal provider-class name: " + ln); - } - for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { - cp = ln.codePointAt(i); - if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) { - throw new RuntimeException("Illegal provider-class name: " + ln); - } - } - if (!names.contains(ln)) { - names.add(ln); - } - } - return lc + 1; - } - } -} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java b/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java deleted file mode 100644 index 59c71b410d6ec5d06794488c905507049511f7b6..0000000000000000000000000000000000000000 --- a/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 com.sun.classanalyzer; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -/** - * A simple tool to print out the static dependencies for a given set of JAR, - * class files, or combinations of. The tools supports an -ignore option to - * ignore references to classes listed in the file (including .classlists - * created by the ClassAnalyzer tool). - */ - -public class ShowDeps { - - static void usage() { - System.out.println("java ShowDeps [-ignore ] file..."); - System.out.println(" where is a class or JAR file, or a directory"); - System.out.println(); - System.out.println("Example usages:"); - System.out.println(" java ShowDeps Foo.jar"); - System.out.println(" java ShowDeps -ignore base.classlist Foo.jar"); - System.out.println(" java ShowDeps -ignore base.classlist -ignore " + - "jaxp-parsers.classlist

"); - System.exit(-1); - } - - public static void main(String[] args) throws IOException { - // process -ignore options - int argi = 0; - Set ignore = new HashSet(); - while (argi < args.length && args[argi].equals("-ignore")) { - argi++; - Scanner s = new Scanner(new File(args[argi++])); - try { - while (s.hasNextLine()) { - String line = s.nextLine(); - if (!line.endsWith(".class")) - continue; - int len = line.length(); - // convert to class names - String clazz = line.replace('\\', '.').replace('/', '.') - .substring(0, len-6); - ignore.add(clazz); - } - } finally { - s.close(); - } - } - - if (argi >= args.length) - usage(); - - // parse all classes - while (argi < args.length) - ClassPath.setClassPath(args[argi++]); - ClassPath.parseAllClassFiles(); - - // find the classes that don't exist - Set unresolved = new TreeSet(); - for (Klass k : Klass.getAllClasses()) { - if (k.getFileSize() == 0) - unresolved.add(k); - } - - // print references to classes that don't exist - for (Klass k: Klass.getAllClasses()) { - for (Klass other : k.getReferencedClasses()) { - if (unresolved.contains(other)) { - String name = other.toString(); - if (!ignore.contains(name)) { - System.out.format("%s -> %s\n", k, other); - } - } - } - } - } -} diff --git a/make/sun/applet/Makefile b/make/sun/applet/Makefile index 79ff5fcb413a65951253d44eef8866e88edaa057..f73763f399b5eb0bf320ba94e5b0f733ca66e959 100644 --- a/make/sun/applet/Makefile +++ b/make/sun/applet/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = applet PACKAGE = sun.applet PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/awt/Makefile b/make/sun/awt/Makefile index 7d8b4b6a6f11fe0b8b1a8a6fbd63ab44b4925e5a..2414c91fd7a3f9f5e18edd37ded3eb8e7b9fc100 100644 --- a/make/sun/awt/Makefile +++ b/make/sun/awt/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = awt PACKAGE = sun.awt LIBRARY = awt PRODUCT = sun @@ -368,7 +367,7 @@ else FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs _FONTCONFIGS = \ fontconfig.properties \ - fontconfig.RedHat.properties \ + fontconfig.RedHat.5.5.properties \ fontconfig.Turbo.properties \ fontconfig.SuSE.10.properties \ fontconfig.SuSE.11.properties @@ -405,7 +404,6 @@ $(LIBDIR)/%.bfc: $(FONTCONFIGS_SRC)/$(FONTCONFIGS_SRC_PREFIX)%.properties \ $(COMPILEFONTCONFIG_JARFILE) $(prep-target) $(BOOT_JAVA_CMD) -jar $(COMPILEFONTCONFIG_JARFILE) $(COMPILEFONTCONFIG_FLAGS) $< $@ - $(install-module-file) $(call chmod-file, 444) @$(java-vm-cleanup) diff --git a/make/sun/awt/mapfile-mawt-vers b/make/sun/awt/mapfile-mawt-vers index f1b7143e94814c5f0eabc3b58ad7601dcea0c83e..05de1fdd5343171d2fa6accf4ef2511a39efcd17 100644 --- a/make/sun/awt/mapfile-mawt-vers +++ b/make/sun/awt/mapfile-mawt-vers @@ -424,6 +424,7 @@ SUNWprivate_1.1 { Java_sun_java2d_xr_XRSurfaceData_initXRPicture; Java_sun_java2d_xr_XRSurfaceData_initIDs; Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; Java_sun_java2d_xr_XRBackendNative_initIDs; Java_sun_java2d_xr_XIDGenerator_bufferXIDs; Java_sun_java2d_xr_XRBackendNative_freeGC; diff --git a/make/sun/cmm/Makefile b/make/sun/cmm/Makefile index 50592142287b78a9a325507fb54e668323798daf..76d6904a52122d2ae3ead070f997a5b505c650b9 100644 --- a/make/sun/cmm/Makefile +++ b/make/sun/cmm/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = java2d PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/cmm/kcms/Makefile b/make/sun/cmm/kcms/Makefile index ac3254461cd3b70f3a608d474375fd3e8e24f85f..b0dd8434ee7256a9bc5fc66a0068ef90740fdc95 100644 --- a/make/sun/cmm/kcms/Makefile +++ b/make/sun/cmm/kcms/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = java2d PACKAGE = sun.java2d.cmm.kcms LIBRARY = kcms PRODUCT = sun diff --git a/make/sun/cmm/lcms/Makefile b/make/sun/cmm/lcms/Makefile index 04a4c3c987e5cb111e03df745bd014106883ef3d..52b550dda106e564636741e0a72313e851a75354 100644 --- a/make/sun/cmm/lcms/Makefile +++ b/make/sun/cmm/lcms/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = java2d PACKAGE = sun.java2d.cmm.lcms LIBRARY = lcms PRODUCT = sun diff --git a/make/sun/dcpr/Makefile b/make/sun/dcpr/Makefile index c401cbde4f8533aba45df25acd8e5a5b2b08b37f..bfeb4636a46be956bb9bbbacb93508a46c299ff2 100644 --- a/make/sun/dcpr/Makefile +++ b/make/sun/dcpr/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = java2d PACKAGE = sun.dc LIBRARY = dcpr PRODUCT = sun diff --git a/make/sun/font/Makefile b/make/sun/font/Makefile index b22d0e7b79341ced4f5e92ee749af34950968808..dc735cb2cd68fd31c8645cc825624e83e787f2f9 100644 --- a/make/sun/font/Makefile +++ b/make/sun/font/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = font PACKAGE = sun.font LIBRARY = fontmanager PRODUCT = sun @@ -136,7 +135,6 @@ library:: $(FREETYPE_LIB) $(FREETYPE_LIB): $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@ - $(install-module-file) endif #ifeq ($(PLATFORM), solaris) diff --git a/make/sun/font/t2k/Makefile b/make/sun/font/t2k/Makefile index a390b96b700f25df21917de97c8dd714bce8d28b..1a4c656826c10e7d319d137b0ccee59f7e14d65e 100644 --- a/make/sun/font/t2k/Makefile +++ b/make/sun/font/t2k/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = font PACKAGE = sun.font LIBRARY = t2k PRODUCT = sun diff --git a/make/sun/headless/Makefile b/make/sun/headless/Makefile index 243c5bdf561cffdf6bb9b78d4f71c7be681c9788..e78761b0a405fe531be705a80b29fa0441535e80 100644 --- a/make/sun/headless/Makefile +++ b/make/sun/headless/Makefile @@ -30,7 +30,6 @@ MOTIF_VERSION = none MOTIF_VERSION_STRING=none LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/headless -MODULE = awt PACKAGE = sun.awt LIBRARY = mawt LIBRARY_OUTPUT = headless diff --git a/make/sun/image/generic/Makefile b/make/sun/image/generic/Makefile index 80d1454eeb3c86d6edd0199f4471670653be5f59..6a55f0e98c8eb89b793245f432b29b6b2179d7c2 100644 --- a/make/sun/image/generic/Makefile +++ b/make/sun/image/generic/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image PRODUCT = sun diff --git a/make/sun/image/vis/Makefile b/make/sun/image/vis/Makefile index 9e1732f293d8f01873bfa5663e14fa09f9c8780e..fdf9c1f9937aef1a0eb8331880b66b368632104a 100644 --- a/make/sun/image/vis/Makefile +++ b/make/sun/image/vis/Makefile @@ -27,7 +27,6 @@ # Makefile for building the VIS (solaris-only) version of medialib # BUILDDIR = ../../.. -MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image_v PRODUCT = sun diff --git a/make/sun/jar/Makefile b/make/sun/jar/Makefile index d544a3fe46a072f2ea0e3dfd7cef04fbccdc5f90..7b4ed870ef34051e059de669ae80f5a9ec466790 100644 --- a/make/sun/jar/Makefile +++ b/make/sun/jar/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = jar-tool PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/javazic/Makefile b/make/sun/javazic/Makefile index 8e5f723f7e6017bf0c56838c87f70a460fa2dbb2..64ccf84647676d55c845e04a21d6ef4c20e8e8c8 100644 --- a/make/sun/javazic/Makefile +++ b/make/sun/javazic/Makefile @@ -27,7 +27,6 @@ BUILDDIR = ../.. -MODULE = base PACKAGE = sun.javazic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -70,7 +69,6 @@ $(INSTALLDIR)/$(MAPFILE): $(WORKDIR)/$(MAPFILE) $(RM) -r $(@D) $(prep-target) $(CP) -r $(WORKDIR)/* $(@D) - $(install-module-dir) clean clobber:: $(RM) -r $(TEMPDIR) $(INSTALLDIR) diff --git a/make/sun/jawt/Makefile b/make/sun/jawt/Makefile index be63ff89ff7de9f1f272d40956cb8b7514f221ad..7741e1b5a83d14d743e52c142ef2006a8ecb337d 100644 --- a/make/sun/jawt/Makefile +++ b/make/sun/jawt/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = awt PACKAGE = sun.awt LIBRARY = jawt PRODUCT = sun diff --git a/make/sun/jconsole/Makefile b/make/sun/jconsole/Makefile index 997bd2b6d429fb703e2112d86ea5052d9598f9c0..7ce349bc811a2d05c77f2febee4146382ac5e3f6 100644 --- a/make/sun/jconsole/Makefile +++ b/make/sun/jconsole/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = jconsole PACKAGE = sun.tools.jconsole PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/jdbc/Makefile b/make/sun/jdbc/Makefile index 5425aaec1e2aef0d0d5637c22ed7a5ee95f07b44..f3d9fea8eb14ae331f2d03552e3ea3b0008c2a75 100644 --- a/make/sun/jdbc/Makefile +++ b/make/sun/jdbc/Makefile @@ -33,7 +33,6 @@ # BUILDDIR = ../.. -MODULE = jdbc-odbc PACKAGE = sun.jdbc.odbc LIBRARY = JdbcOdbc PRODUCT = sun diff --git a/make/sun/jdga/Makefile b/make/sun/jdga/Makefile index f916be787e87adb6c8595a0f181fb777a6573f7e..98b5c0dd9a588b2e57a2387b99c2d4dbacb022ec 100644 --- a/make/sun/jdga/Makefile +++ b/make/sun/jdga/Makefile @@ -25,7 +25,6 @@ BUILDDIR = ../.. -MODULE = java2d PACKAGE = sun.jdga LIBRARY = sunwjdga PRODUCT = sun diff --git a/make/sun/jpeg/Makefile b/make/sun/jpeg/Makefile index b16ebea9f0f5710b39212a426ffe70c73a817a26..78c53c461a1a29b41986f07b8c24321b44fe9135 100644 --- a/make/sun/jpeg/Makefile +++ b/make/sun/jpeg/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = java2d PACKAGE = sun.awt LIBRARY = jpeg PRODUCT = sun diff --git a/make/sun/launcher/Makefile b/make/sun/launcher/Makefile index 706d01577824815fd579f2164b85b50a5bc6aaa0..0d01091978068c2ebedb3d71f4be1a2c3843118b 100644 --- a/make/sun/launcher/Makefile +++ b/make/sun/launcher/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = base PACKAGE = sun.launcher PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/management/Makefile b/make/sun/management/Makefile index fad6979222acf26649400119c21efc18adae1e25..e9d9ae53eb73b05fa49b44bff94175330a639655 100644 --- a/make/sun/management/Makefile +++ b/make/sun/management/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = management include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/native2ascii/Makefile b/make/sun/native2ascii/Makefile index 6e03ddf6ccfbdd1666d72230b97a891e059485a4..8504c408020409bc97c6cfa2c4c2d1624ee30b1e 100644 --- a/make/sun/native2ascii/Makefile +++ b/make/sun/native2ascii/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = tools PACKAGE = sun.tools.native2ascii PRODUCT = sun OTHER_JAVACFLAGS += -Xlint:serial -Werror diff --git a/make/sun/net/others/Makefile b/make/sun/net/others/Makefile index 3b69440c41b80ec3ed2db9280bca1a691bd0070b..9e26bd7002a287db04a5dc553a113e25384924d0 100644 --- a/make/sun/net/others/Makefile +++ b/make/sun/net/others/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = base PACKAGE = sun.net PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/net/spi/nameservice/dns/Makefile b/make/sun/net/spi/nameservice/dns/Makefile index 06f2f8b764e8ead503b74f6c631054cbd90bd2a2..dddb18571e0d5dbf91e6b186a93abdc09990c73e 100644 --- a/make/sun/net/spi/nameservice/dns/Makefile +++ b/make/sun/net/spi/nameservice/dns/Makefile @@ -30,7 +30,6 @@ BUILDDIR = ../../../../.. # dns should probably be its own module -MODULE = net-dns PACKAGE = sun.net.spi.nameservice.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/nio/cs/Makefile b/make/sun/nio/cs/Makefile index f1eee0e34f6ac09ef1f8799be95782b161ef9139..eeddbb03120fabf48ecff6bc838d48b19415eea5 100644 --- a/make/sun/nio/cs/Makefile +++ b/make/sun/nio/cs/Makefile @@ -30,7 +30,6 @@ BUILDDIR = ../../.. # charsets should be separated from nio module -MODULE = charsets PACKAGE = sun.nio PRODUCT = sun diff --git a/make/sun/org/mozilla/javascript/Makefile b/make/sun/org/mozilla/javascript/Makefile index 99880d089762def49f47a08a7188b8c0cbdc7a9b..5ea19a7a47b97d78b3d420c1fdb90c5884cf9987 100644 --- a/make/sun/org/mozilla/javascript/Makefile +++ b/make/sun/org/mozilla/javascript/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../../.. -MODULE = scripting-rhino PACKAGE = sun.org.mozilla.javascript.internal PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/pisces/Makefile b/make/sun/pisces/Makefile index f6c298c0afa6fbd0a89399fb7bbde2091ad1e625..61b50d2d4795d42a2c2a0694618342f791b68a60 100644 --- a/make/sun/pisces/Makefile +++ b/make/sun/pisces/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = java2d PACKAGE = sun.pisces PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/cgi/Makefile b/make/sun/rmi/cgi/Makefile index 04a68473e357987ac221381623aa09afa6dec223..588c72a87eb21624bbc2b20fcee9ac77cfc8956b 100644 --- a/make/sun/rmi/cgi/Makefile +++ b/make/sun/rmi/cgi/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../../.. # java-rmi.cgi is a JDK tool -MODULE = tools PACKAGE = sun.rmi PRODUCT = sun PROGRAM = java-rmi diff --git a/make/sun/rmi/oldtools/Makefile b/make/sun/rmi/oldtools/Makefile index 9e7f051fbdda111c7614ece8ea61fd6ae579d75e..e0afea2dd9c3876034cc43d970a16ce250060760 100644 --- a/make/sun/rmi/oldtools/Makefile +++ b/make/sun/rmi/oldtools/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = oldjavac PRODUCT = oldjavac include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/registry/Makefile b/make/sun/rmi/registry/Makefile index 3f3e0c18a21e0409be4dff856ca996fc55a8ef93..69f37a04da9d60204d4dc9895a6f48188b67a045 100644 --- a/make/sun/rmi/registry/Makefile +++ b/make/sun/rmi/registry/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = rmi PACKAGE = sun.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/rmi/Makefile b/make/sun/rmi/rmi/Makefile index 67be5f1feb8ee03dd2a1d2f6bb5d2eb228c3a016..a0ace2be48c0016289b2225eadb6315c859a75c8 100644 --- a/make/sun/rmi/rmi/Makefile +++ b/make/sun/rmi/rmi/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = rmi PACKAGE = sun.rmi PRODUCT = sun LIBRARY = rmi diff --git a/make/sun/rmi/rmic/Makefile b/make/sun/rmi/rmic/Makefile index bca860ee8ad83d02aa6709776fde1fef9e583926..b6ec52b6849459ee2761f874fe5051a63a42f8bd 100644 --- a/make/sun/rmi/rmic/Makefile +++ b/make/sun/rmi/rmic/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../../.. -MODULE = rmic PACKAGE = sun.rmi.rmic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/rmid/Makefile b/make/sun/rmi/rmid/Makefile index 1ab9d8c5084460a62fdc50d0e5be8df467a49a6c..118b7af9bce910e6c221016204aabec5d1718a15 100644 --- a/make/sun/rmi/rmid/Makefile +++ b/make/sun/rmi/rmid/Makefile @@ -29,7 +29,6 @@ # BUILDDIR = ../../.. -MODULE = rmi-activation PACKAGE = sun.rmi.activation PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/security/ec/Makefile b/make/sun/security/ec/Makefile index 8f3f75dc3b321fe19e8e70161238bb911f793626..26190f10a71fdff0c3c59f6e4408ff5ac3cc454d 100644 --- a/make/sun/security/ec/Makefile +++ b/make/sun/security/ec/Makefile @@ -89,7 +89,6 @@ # BUILDDIR = ../../.. -MODULE = security-sunec PACKAGE = sun.security.ec PRODUCT = sun @@ -309,7 +308,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunec.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunec.jar endif - $(install-non-module-file) + $(install-file) ifndef OPENJDK install-prebuilt: diff --git a/make/sun/security/jgss/wrapper/Makefile b/make/sun/security/jgss/wrapper/Makefile index 052cbf354c27f4486b32ee5fa13f1016894fad05..89df5e98e07d5b64cead648d4b1947678f6e9a88 100644 --- a/make/sun/security/jgss/wrapper/Makefile +++ b/make/sun/security/jgss/wrapper/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../../.. -MODULE = security-kerberos PACKAGE = sun.security.jgss.wrapper PRODUCT = sun diff --git a/make/sun/security/krb5/Makefile b/make/sun/security/krb5/Makefile index 8c8e5a88b72fa163cad0a87512af7d31f22576df..16561e5bcee21017449a4014b52aea7b7d773cff 100644 --- a/make/sun/security/krb5/Makefile +++ b/make/sun/security/krb5/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = security-kerberos PACKAGE = sun.security.krb5 PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/security/mscapi/Makefile b/make/sun/security/mscapi/Makefile index d4b940980ca456fd54dcaf19cd5e10a79c771450..930ef7b078da6cb4cc559a100d9ac7cefa3e2521 100644 --- a/make/sun/security/mscapi/Makefile +++ b/make/sun/security/mscapi/Makefile @@ -89,7 +89,6 @@ # BUILDDIR = ../../.. -MODULE = security-sunmscapi PACKAGE = sun.security.mscapi LIBRARY = sunmscapi PRODUCT = sun @@ -273,7 +272,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunmscapi.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunmscapi.jar endif - $(install-non-module-file) + $(install-file) ifndef OPENJDK install-prebuilt: diff --git a/make/sun/security/pkcs11/Makefile b/make/sun/security/pkcs11/Makefile index 9e8102651e1bd61ae753931cba303fa21b1e7668..5e01ffead68b9dae33476bf4b584be3af9e797cd 100644 --- a/make/sun/security/pkcs11/Makefile +++ b/make/sun/security/pkcs11/Makefile @@ -89,7 +89,6 @@ # BUILDDIR = ../../.. -MODULE = security-sunpkcs11 PACKAGE = sun.security.pkcs11 LIBRARY = j2pkcs11 PRODUCT = sun @@ -288,7 +287,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar endif - $(install-non-module-file) + $(install-file) ifndef OPENJDK install-prebuilt: diff --git a/make/sun/security/smartcardio/Makefile b/make/sun/security/smartcardio/Makefile index 73cbe72dd538b7eff6d2f32cfbe0e192ff011f1c..e6a6f2cc7970f042ce196a71ba1cba948d12a52e 100644 --- a/make/sun/security/smartcardio/Makefile +++ b/make/sun/security/smartcardio/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = security-smartcardio PACKAGE = sun.security.smartcardio LIBRARY = j2pcsc PRODUCT = sun diff --git a/make/sun/security/tools/Makefile b/make/sun/security/tools/Makefile index 6b44e8178fec0e977aaed2df2b1d77537d636a25..bfdb261f6baf09bf61b1e420c2019e67e44c7f49 100644 --- a/make/sun/security/tools/Makefile +++ b/make/sun/security/tools/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../../.. -MODULE = security-tools PACKAGE = sun.security.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/serialver/Makefile b/make/sun/serialver/Makefile index d2e8211f11cefc97309e874796023464b3ecd88f..d7e2a193096129f9588c82201f498022a69045e2 100644 --- a/make/sun/serialver/Makefile +++ b/make/sun/serialver/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = serialver PACKAGE = sun.tools.serialver PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/splashscreen/Makefile b/make/sun/splashscreen/Makefile index 322ebf0cab17870bfb8da73ad3866c8e352ad770..74487d8c2c7f693ba9e35d866d6b98ce01c60fd5 100644 --- a/make/sun/splashscreen/Makefile +++ b/make/sun/splashscreen/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = awt PACKAGE = sun.awt LIBRARY = splashscreen PRODUCT = sun diff --git a/make/sun/text/Makefile b/make/sun/text/Makefile index e8ac3047d174a3c0a76b520658776399ab7d5b65..ac4dd9d45cd7601ec4910b31757afd73949d25a9 100644 --- a/make/sun/text/Makefile +++ b/make/sun/text/Makefile @@ -29,7 +29,6 @@ BUILDDIR = ../.. -MODULE = localedata PACKAGE = sun.text PRODUCT = sun diff --git a/make/sun/tools/Makefile b/make/sun/tools/Makefile index c5d71cb4edf0c56c6de8bfc465a393e7fb6ace7a..f5cd405f61297a9be8599339388aeb6969838ba6 100644 --- a/make/sun/tools/Makefile +++ b/make/sun/tools/Makefile @@ -28,7 +28,6 @@ # BUILDDIR = ../.. -MODULE = tools PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/tracing/dtrace/Makefile b/make/sun/tracing/dtrace/Makefile index 55c896b0a9cd7080e77ad58e88b09482eff0888f..83d475d534336a962bc3e1367b70772af0c90e48 100644 --- a/make/sun/tracing/dtrace/Makefile +++ b/make/sun/tracing/dtrace/Makefile @@ -27,7 +27,6 @@ # Makefile for building dtrace extension # BUILDDIR = ../../.. -MODULE = tracing PACKAGE = sun.tracing.dtrace LIBRARY = jsdt PRODUCT = sun diff --git a/make/sun/xawt/Makefile b/make/sun/xawt/Makefile index f1297ef192f6703edd8dba05644c6fc1a96627c8..afe16f5737db1ea3a2f6fdd7ce1e5997966d1f42 100644 --- a/make/sun/xawt/Makefile +++ b/make/sun/xawt/Makefile @@ -24,7 +24,6 @@ # BUILDDIR = ../.. -MODULE = awt PACKAGE = sun.awt.X11 LIBRARY = mawt LIBRARY_OUTPUT = xawt diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers index 90ce5d8589dd57e1c34b919f19e39fa4471b7853..3aa1ca49fc6f9ecf3883088df8a923aa3fa849bb 100644 --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -374,6 +374,7 @@ SUNWprivate_1.1 { Java_sun_java2d_xr_XRSurfaceData_initXRPicture; Java_sun_java2d_xr_XRSurfaceData_initIDs; Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; Java_sun_java2d_xr_XRBackendNative_initIDs; Java_sun_java2d_xr_XRBackendNative_freeGC; Java_sun_java2d_xr_XRBackendNative_createGC; diff --git a/make/tools/manifest.mf b/make/tools/manifest.mf index 3b3b37efe45cb578cd2bb9486c3ef4306206b547..5e631b7bb41daf86319c6be180197b5ed12cb98d 100644 --- a/make/tools/manifest.mf +++ b/make/tools/manifest.mf @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Specification-Title: Java Platform API Specification -Specification-Version: 1.6 +Specification-Version: 1.7 Specification-Vendor: Oracle Implementation-Title: Java Runtime Environment Implementation-Version: @@RELEASE@@ diff --git a/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java b/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java index 25ae52a4ed1507847bb998d156a4a75a94817d1f..fe48bc51739fad1235f0bcec30ad664b54d72030 100644 --- a/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java +++ b/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -26,9 +26,7 @@ package com.sun.jarsigner; import java.net.URI; -import java.security.cert.X509CRL; import java.security.cert.X509Certificate; -import java.util.Set; import java.util.zip.ZipFile; /** @@ -82,13 +80,6 @@ public interface ContentSignerParameters { */ public X509Certificate[] getSignerCertificateChain(); - /** - * Retrieves the signer's X.509 CRLs. - * - * @return An unmodifiable set of X.509 CRLs (never null) - */ - public Set getCRLs(); - /** * Retrieves the content that was signed. * The content is the JAR file's signature file. diff --git a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java index 41436e7b3b48dd5d96e814549b4cbfa3b5dac347..d676ee8e6fb27f27adb4e89124e67d373de56703 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -1011,7 +1011,7 @@ class PackageReader extends BandStructure { return -1; } - Comparator entryOutputOrder = new Comparator<>() { + Comparator entryOutputOrder = new Comparator() { public int compare(Entry e0, Entry e1) { int k0 = getOutputIndex(e0); int k1 = getOutputIndex(e1); diff --git a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java index 8220e115663056457b0b21a7209c2b9a8f7ff108..f531fb7d999fe62dcb0288da284f98dab25cb23d 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -785,7 +785,7 @@ class PackageWriter extends BandStructure { defMap.entrySet().toArray(layoutsAndCounts); // Sort by count, most frequent first. // Predefs. participate in this sort, though it does not matter. - Arrays.sort(layoutsAndCounts, new Comparator<>() { + Arrays.sort(layoutsAndCounts, new Comparator() { public int compare(Object o0, Object o1) { Map.Entry e0 = (Map.Entry) o0; Map.Entry e1 = (Map.Entry) o1; diff --git a/src/share/classes/com/sun/jndi/ldap/Connection.java b/src/share/classes/com/sun/jndi/ldap/Connection.java index 94067617ae1e85faa388c4da5a117e8a34a44728..6ca3ae1d85a112c9e2178b15aa3bebf4394f3476 100644 --- a/src/share/classes/com/sun/jndi/ldap/Connection.java +++ b/src/share/classes/com/sun/jndi/ldap/Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -380,13 +380,19 @@ public final class Connection implements Runnable { } LdapRequest writeRequest(BerEncoder ber, int msgId) throws IOException { - return writeRequest(ber, msgId, false /* pauseAfterReceipt */); + return writeRequest(ber, msgId, false /* pauseAfterReceipt */, -1); } - LdapRequest writeRequest(BerEncoder ber, int msgId, boolean pauseAfterReceipt) - throws IOException { + LdapRequest writeRequest(BerEncoder ber, int msgId, + boolean pauseAfterReceipt) throws IOException { + return writeRequest(ber, msgId, pauseAfterReceipt, -1); + } + + LdapRequest writeRequest(BerEncoder ber, int msgId, + boolean pauseAfterReceipt, int replyQueueCapacity) throws IOException { - LdapRequest req = new LdapRequest(msgId, pauseAfterReceipt); + LdapRequest req = + new LdapRequest(msgId, pauseAfterReceipt, replyQueueCapacity); addRequest(req); if (traceFile != null) { diff --git a/src/share/classes/com/sun/jndi/ldap/LdapClient.java b/src/share/classes/com/sun/jndi/ldap/LdapClient.java index 99f84c0adb346031ed1fe3e64bb19b62a6536b49..41a3dfba14b55c35910da88cf07498aaa5cf1d72 100644 --- a/src/share/classes/com/sun/jndi/ldap/LdapClient.java +++ b/src/share/classes/com/sun/jndi/ldap/LdapClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -516,7 +516,8 @@ public final class LdapClient implements PooledConnection { LdapResult search(String dn, int scope, int deref, int sizeLimit, int timeLimit, boolean attrsOnly, String attrs[], String filter, int batchSize, Control[] reqCtls, - Hashtable binaryAttrs, boolean waitFirstReply) + Hashtable binaryAttrs, boolean waitFirstReply, + int replyQueueCapacity) throws IOException, NamingException { ensureOpen(); @@ -543,7 +544,8 @@ public final class LdapClient implements PooledConnection { if (isLdapv3) encodeControls(ber, reqCtls); ber.endSeq(); - LdapRequest req = conn.writeRequest(ber, curMsgId); + LdapRequest req = + conn.writeRequest(ber, curMsgId, false, replyQueueCapacity); res.msgId = curMsgId; res.status = LdapClient.LDAP_SUCCESS; //optimistic diff --git a/src/share/classes/com/sun/jndi/ldap/LdapCtx.java b/src/share/classes/com/sun/jndi/ldap/LdapCtx.java index e50ebc0d17aa8800662b34cd462f480db62ab7b4..68b272e10e538dbba5e03fc9741c95e71eac5e41 100644 --- a/src/share/classes/com/sun/jndi/ldap/LdapCtx.java +++ b/src/share/classes/com/sun/jndi/ldap/LdapCtx.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -191,6 +191,14 @@ final public class LdapCtx extends ComponentDirContext // Environment property for the domain name (derived from this context's DN) private static final String DOMAIN_NAME = "com.sun.jndi.ldap.domainname"; + // Block until the first search reply is received + private static final String WAIT_FOR_REPLY = + "com.sun.jndi.ldap.search.waitForReply"; + + // Size of the queue of unprocessed search replies + private static final String REPLY_QUEUE_SIZE = + "com.sun.jndi.ldap.search.replyQueueSize"; + // ----------------- Fields that don't change ----------------------- private static final NameParser parser = new LdapNameParser(); @@ -246,6 +254,8 @@ final public class LdapCtx extends ComponentDirContext private Hashtable binaryAttrs = null; // attr values returned as byte[] private int connectTimeout = -1; // no timeout value private int readTimeout = -1; // no timeout value + private boolean waitForReply = true; // wait for search response + private int replyQueueSize = -1; // unlimited queue size private boolean useSsl = false; // true if SSL protocol is active private boolean useDefaultPortNumber = false; // no port number was supplied @@ -1759,8 +1769,8 @@ final public class LdapCtx extends ComponentDirContext SearchControls cons, Continuation cont) throws NamingException { - return searchAux(name, filter, cloneSearchControls(cons), true, true, - cont); + return searchAux(name, filter, cloneSearchControls(cons), true, + waitForReply, cont); } protected NamingEnumeration c_search(Name name, @@ -1928,7 +1938,7 @@ final public class LdapCtx extends ComponentDirContext } private LdapResult doSearch(Name name, String filter, SearchControls cons, - boolean relative, boolean waitFirstReply) throws NamingException { + boolean relative, boolean waitForReply) throws NamingException { ensureOpen(); try { int scope; @@ -1984,7 +1994,8 @@ final public class LdapCtx extends ComponentDirContext batchSize, reqCtls, binaryAttrs, - waitFirstReply); + waitForReply, + replyQueueSize); respCtls = answer.resControls; // retrieve response controls return answer; @@ -2170,6 +2181,10 @@ final public class LdapCtx extends ComponentDirContext connectTimeout = -1; } else if (propName.equals(READ_TIMEOUT)) { readTimeout = -1; + } else if (propName.equals(WAIT_FOR_REPLY)) { + waitForReply = true; + } else if (propName.equals(REPLY_QUEUE_SIZE)) { + replyQueueSize = -1; // The following properties affect the connection @@ -2225,6 +2240,11 @@ final public class LdapCtx extends ComponentDirContext setConnectTimeout((String)propVal); } else if (propName.equals(READ_TIMEOUT)) { setReadTimeout((String)propVal); + } else if (propName.equals(WAIT_FOR_REPLY)) { + setWaitForReply((String)propVal); + } else if (propName.equals(REPLY_QUEUE_SIZE)) { + setReplyQueueSize((String)propVal); + // The following properties affect the connection } else if (propName.equals(Context.SECURITY_PROTOCOL)) { @@ -2312,6 +2332,13 @@ final public class LdapCtx extends ComponentDirContext // Set the read timeout setReadTimeout((String)envprops.get(READ_TIMEOUT)); + // Set the flag that controls whether to block until the first reply + // is received + setWaitForReply((String)envprops.get(WAIT_FOR_REPLY)); + + // Set the size of the queue of unprocessed search replies + setReplyQueueSize((String)envprops.get(REPLY_QUEUE_SIZE)); + // When connection is created, it will use these and other // properties from the environment } @@ -2441,6 +2468,34 @@ final public class LdapCtx extends ComponentDirContext } } + /** + * Sets the size of the queue of unprocessed search replies + */ + private void setReplyQueueSize(String replyQueueSizeProp) { + if (replyQueueSizeProp != null) { + replyQueueSize = Integer.parseInt(replyQueueSizeProp); + // disallow an empty queue + if (replyQueueSize <= 0) { + replyQueueSize = -1; // unlimited + } + } else { + replyQueueSize = -1; // unlimited + } + } + + /** + * Sets the flag that controls whether to block until the first search + * reply is received + */ + private void setWaitForReply(String waitForReplyProp) { + if (waitForReplyProp != null && + (waitForReplyProp.equalsIgnoreCase("false"))) { + waitForReply = false; + } else { + waitForReply = true; + } + } + /** * Sets the read timeout value */ diff --git a/src/share/classes/com/sun/jndi/ldap/LdapRequest.java b/src/share/classes/com/sun/jndi/ldap/LdapRequest.java index 2f8e39e572474f8aee6fab1041ddecd305ad7444..23347ac5dc89cfc74e07e15696b01eff6a9aa7ae 100644 --- a/src/share/classes/com/sun/jndi/ldap/LdapRequest.java +++ b/src/share/classes/com/sun/jndi/ldap/LdapRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -26,7 +26,8 @@ package com.sun.jndi.ldap; import java.io.IOException; -import java.util.Vector; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; import javax.naming.CommunicationException; final class LdapRequest { @@ -35,14 +36,26 @@ final class LdapRequest { int msgId; // read-only private int gotten = 0; - private Vector replies = new Vector(3); + private BlockingQueue replies; + private int highWatermark = -1; private boolean cancelled = false; private boolean pauseAfterReceipt = false; private boolean completed = false; LdapRequest(int msgId, boolean pause) { + this(msgId, pause, -1); + } + + LdapRequest(int msgId, boolean pause, int replyQueueCapacity) { this.msgId = msgId; this.pauseAfterReceipt = pause; + if (replyQueueCapacity == -1) { + this.replies = new LinkedBlockingQueue(); + } else { + this.replies = + new LinkedBlockingQueue(replyQueueCapacity); + highWatermark = (replyQueueCapacity * 80) / 100; // 80% capacity + } } synchronized void cancel() { @@ -57,7 +70,13 @@ final class LdapRequest { if (cancelled) { return false; } - replies.addElement(ber); + + // Add a new reply to the queue of unprocessed replies. + try { + replies.put(ber); + } catch (InterruptedException e) { + // ignore + } // peek at the BER buffer to check if it is a SearchResultDone PDU try { @@ -70,6 +89,14 @@ final class LdapRequest { ber.reset(); notify(); // notify anyone waiting for reply + /* + * If a queue capacity has been set then trigger a pause when the + * queue has filled to 80% capacity. Later, when the queue has drained + * then the reader gets unpaused. + */ + if (highWatermark != -1 && replies.size() >= highWatermark) { + return true; // trigger the pause + } return pauseAfterReceipt; } @@ -79,14 +106,12 @@ final class LdapRequest { " cancelled"); } - if (gotten < replies.size()) { - BerDecoder answer = (BerDecoder)replies.elementAt(gotten); - replies.setElementAt(null, gotten); // remove reference - ++gotten; // skip to next - return answer; - } else { - return null; - } + /* + * Remove a reply if the queue is not empty. + * poll returns null if queue is empty. + */ + BerDecoder reply = replies.poll(); + return reply; } synchronized boolean hasSearchCompleted() { diff --git a/src/share/classes/com/sun/media/sound/AiffFileWriter.java b/src/share/classes/com/sun/media/sound/AiffFileWriter.java index 1e9a3a91282e4ee72e451cedc891b9a74868be45..0a87bc3a1f111d753bff1d2a6d44f7eec3116e4a 100644 --- a/src/share/classes/com/sun/media/sound/AiffFileWriter.java +++ b/src/share/classes/com/sun/media/sound/AiffFileWriter.java @@ -25,12 +25,10 @@ package com.sun.media.sound; -import java.util.Vector; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; -import java.io.DataInputStream; import java.io.BufferedOutputStream; import java.io.DataOutputStream; @@ -398,7 +396,8 @@ public class AiffFileWriter extends SunFileWriter { header = baos.toByteArray(); headerStream = new ByteArrayInputStream( header ); - aiffStream = new SequenceInputStream(headerStream,codedAudioStream); + aiffStream = new SequenceInputStream(headerStream, + new NoCloseInputStream(codedAudioStream)); return aiffStream; diff --git a/src/share/classes/com/sun/media/sound/AlawCodec.java b/src/share/classes/com/sun/media/sound/AlawCodec.java index 72c71e8daee52f9cabc67a2cad6b5993e0697edb..bac6b9304df4dafce6ead1274cd10f9a632d29cb 100644 --- a/src/share/classes/com/sun/media/sound/AlawCodec.java +++ b/src/share/classes/com/sun/media/sound/AlawCodec.java @@ -52,9 +52,6 @@ public class AlawCodec extends SunCodec { private static final short seg_end [] = {0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF}; - private static final int tempBufferSize = 64; - private byte tempBuffer [] = null; - /** * Initializes the decode tables */ @@ -199,12 +196,9 @@ public class AlawCodec extends SunCodec { AudioFormat inputFormat = stream.getFormat(); if( inputFormat.matches(outputFormat) ) { - cs = stream; } else { - cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat)); - tempBuffer = new byte[tempBufferSize]; } return cs; @@ -264,6 +258,10 @@ public class AlawCodec extends SunCodec { class AlawCodecStream extends AudioInputStream { + // tempBuffer required only for encoding (when encode is true) + private static final int tempBufferSize = 64; + private byte tempBuffer [] = null; + /** * True to encode to a-law, false to decode to linear */ @@ -303,6 +301,7 @@ public class AlawCodec extends SunCodec { encodeFormat = outputFormat; decodeFormat = inputFormat; PCMIsBigEndian = inputFormat.isBigEndian(); + tempBuffer = new byte[tempBufferSize]; } if (PCMIsBigEndian) { diff --git a/src/share/classes/com/sun/media/sound/AuFileWriter.java b/src/share/classes/com/sun/media/sound/AuFileWriter.java index 013f4c1d0ccb03829f8dbff101d9b6f5280ecf89..04c65d11a6e0053add03543fdae23e68608daa94 100644 --- a/src/share/classes/com/sun/media/sound/AuFileWriter.java +++ b/src/share/classes/com/sun/media/sound/AuFileWriter.java @@ -25,12 +25,10 @@ package com.sun.media.sound; -import java.util.Vector; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; -import java.lang.IllegalArgumentException; import java.io.BufferedOutputStream; import java.io.DataOutputStream; @@ -131,10 +129,10 @@ public class AuFileWriter extends SunFileWriter { // $$fb: 2001-07-13: done. Fixes Bug 4479981 RandomAccessFile raf=new RandomAccessFile(out, "rw"); if (raf.length()<=0x7FFFFFFFl) { - // skip AU magic and data offset field + // skip AU magic and data offset field raf.skipBytes(8); raf.writeInt(bytesWritten-AuFileFormat.AU_HEADERSIZE); - // that's all + // that's all } raf.close(); } @@ -303,7 +301,8 @@ public class AuFileWriter extends SunFileWriter { dos.close(); header = baos.toByteArray(); headerStream = new ByteArrayInputStream( header ); - auStream = new SequenceInputStream(headerStream,codedAudioStream); + auStream = new SequenceInputStream(headerStream, + new NoCloseInputStream(codedAudioStream)); return auStream; } diff --git a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java index 57c80856f0311891f6e1894c54283a3984c0da61..fc3b5e705647bf314c76615096a2045764580aa7 100644 --- a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java +++ b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java @@ -395,11 +395,7 @@ class DirectAudioDevice extends AbstractMixer { protected volatile boolean noService = false; // do not run the nService method // Guards all native calls. - protected Object lockNative = new Object(); - // Guards the lastOpened static variable in implOpen and implClose. - protected static Object lockLast = new Object(); - // Keeps track of last opened line, see implOpen "trick". - protected static DirectDL lastOpened; + protected final Object lockNative = new Object(); // CONSTRUCTOR protected DirectDL(DataLine.Info info, @@ -501,48 +497,21 @@ class DirectAudioDevice extends AbstractMixer { // align buffer to full frames bufferSize = ((int) bufferSize / format.getFrameSize()) * format.getFrameSize(); - synchronized(lockLast) { - id = nOpen(mixerIndex, deviceID, isSource, - encoding, - hardwareFormat.getSampleRate(), - hardwareFormat.getSampleSizeInBits(), - hardwareFormat.getFrameSize(), - hardwareFormat.getChannels(), - hardwareFormat.getEncoding().equals( - AudioFormat.Encoding.PCM_SIGNED), - hardwareFormat.isBigEndian(), - bufferSize); - - if (id == 0) { - // Bah... Dirty trick. The most likely cause is an application - // already having a line open for this particular hardware - // format and forgetting about it. If so, silently close that - // implementation and try again. Unfortuantely we can only - // open one line per hardware format currently. - if (lastOpened != null - && hardwareFormat.matches(lastOpened.hardwareFormat)) { - lastOpened.implClose(); - lastOpened = null; - - id = nOpen(mixerIndex, deviceID, isSource, - encoding, - hardwareFormat.getSampleRate(), - hardwareFormat.getSampleSizeInBits(), - hardwareFormat.getFrameSize(), - hardwareFormat.getChannels(), - hardwareFormat.getEncoding().equals( - AudioFormat.Encoding.PCM_SIGNED), - hardwareFormat.isBigEndian(), - bufferSize); - } + id = nOpen(mixerIndex, deviceID, isSource, + encoding, + hardwareFormat.getSampleRate(), + hardwareFormat.getSampleSizeInBits(), + hardwareFormat.getFrameSize(), + hardwareFormat.getChannels(), + hardwareFormat.getEncoding().equals( + AudioFormat.Encoding.PCM_SIGNED), + hardwareFormat.isBigEndian(), + bufferSize); - if (id == 0) { - // TODO: nicer error messages... - throw new LineUnavailableException( - "line with format "+format+" not supported."); - } - } - lastOpened = this; + if (id == 0) { + // TODO: nicer error messages... + throw new LineUnavailableException( + "line with format "+format+" not supported."); } this.bufferSize = nGetBufferSize(id, isSource); @@ -615,14 +584,13 @@ class DirectAudioDevice extends AbstractMixer { } synchronized (lockNative) { nStop(id, isSource); - + } + // wake up any waiting threads + synchronized(lock) { // need to set doIO to false before notifying the // read/write thread, that's why isStartedRunning() // cannot be used doIO = false; - } - // wake up any waiting threads - synchronized(lock) { lock.notifyAll(); } setActive(false); @@ -649,12 +617,8 @@ class DirectAudioDevice extends AbstractMixer { doIO = false; long oldID = id; id = 0; - synchronized (lockLast) { - synchronized (lockNative) { - nClose(oldID, isSource); - if (lastOpened == this) - lastOpened = null; - } + synchronized (lockNative) { + nClose(oldID, isSource); } bytePosition = 0; softwareConversionSize = 0; @@ -667,10 +631,9 @@ class DirectAudioDevice extends AbstractMixer { if (id == 0) { return 0; } - int a = 0; + int a; synchronized (lockNative) { - if (doIO) - a = nAvailable(id, isSource); + a = nAvailable(id, isSource); } return a; } @@ -726,7 +689,7 @@ class DirectAudioDevice extends AbstractMixer { lock.notifyAll(); } synchronized (lockNative) { - if (id != 0 && doIO) { + if (id != 0) { // then flush native buffers nFlush(id, isSource); } @@ -737,10 +700,9 @@ class DirectAudioDevice extends AbstractMixer { // replacement for getFramePosition (see AbstractDataLine) public long getLongFramePosition() { - long pos = 0; + long pos; synchronized (lockNative) { - if (doIO) - pos = nGetBytePosition(id, isSource, bytePosition); + pos = nGetBytePosition(id, isSource, bytePosition); } // hack because ALSA sometimes reports wrong framepos if (pos < 0) { @@ -786,12 +748,11 @@ class DirectAudioDevice extends AbstractMixer { } int written = 0; while (!flushing) { - int thisWritten = 0; + int thisWritten; synchronized (lockNative) { - if (doIO) - thisWritten = nWrite(id, b, off, len, - softwareConversionSize, - leftGain, rightGain); + thisWritten = nWrite(id, b, off, len, + softwareConversionSize, + leftGain, rightGain); if (thisWritten < 0) { // error in native layer break; @@ -1014,10 +975,9 @@ class DirectAudioDevice extends AbstractMixer { } int read = 0; while (doIO && !flushing) { - int thisRead = 0; + int thisRead; synchronized (lockNative) { - if (doIO) - thisRead = nRead(id, b, off, len, softwareConversionSize); + thisRead = nRead(id, b, off, len, softwareConversionSize); if (thisRead < 0) { // error in native layer break; @@ -1252,8 +1212,7 @@ class DirectAudioDevice extends AbstractMixer { // set new native position (if necessary) // this must come after the flush! synchronized (lockNative) { - if (doIO) - nSetBytePosition(id, isSource, frames * frameSize); + nSetBytePosition(id, isSource, frames * frameSize); } if (Printer.debug) Printer.debug(" DirectClip.setFramePosition: " diff --git a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java index 96ea4775fe42fc5f0d9069c7977b5ceba2c74a6e..0fc6406648aa188c92f832cff63efec3788d5829 100644 --- a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java +++ b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java @@ -775,15 +775,22 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon Receiver rec = null; // first try to connect to the default synthesizer // IMPORTANT: this code needs to be synch'ed with - // MidiSystem.getReceiver(boolean), because the same + // MidiSystem.getSequencer(boolean), because the same // algorithm needs to be used! try { Synthesizer synth = MidiSystem.getSynthesizer(); - synth.open(); if (synth instanceof ReferenceCountingDevice) { rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); } else { - rec = synth.getReceiver(); + synth.open(); + try { + rec = synth.getReceiver(); + } finally { + // make sure that the synth is properly closed + if (rec == null) { + synth.close(); + } + } } } catch (Exception e) { // something went wrong with synth diff --git a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java index 70cf8c7fac1bbe7d4d878ab9225c89d6fede6c17..2c332a0b2f46871692558063555f05951169325a 100644 --- a/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java +++ b/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java @@ -127,7 +127,7 @@ public class StandardMidiFileReader extends MidiFileReader { resolution = timing; } else { // SMPTE based timing. first decipher the frame code. - int frameCode = (-1 * timing) >> 8; + int frameCode = -1 * (timing >> 8); switch(frameCode) { case 24: divisionType = Sequence.SMPTE_24; diff --git a/src/share/classes/com/sun/media/sound/SunFileWriter.java b/src/share/classes/com/sun/media/sound/SunFileWriter.java index 0eb45a7d2a4b8d471d113c66c94e509fe8b5ae6e..f0d143e445032a173ccff4372205435f94762fb8 100644 --- a/src/share/classes/com/sun/media/sound/SunFileWriter.java +++ b/src/share/classes/com/sun/media/sound/SunFileWriter.java @@ -30,14 +30,9 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.DataInputStream; -import java.io.RandomAccessFile; -import java.net.URL; -import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.UnsupportedAudioFileException; import javax.sound.sampled.spi.AudioFileWriter; @@ -177,4 +172,62 @@ abstract class SunFileWriter extends AudioFileWriter { return i; } + /** + * InputStream wrapper class which prevent source stream from being closed. + * The class is usefull for use with SequenceInputStream to prevent + * closing of the source input streams. + */ + protected class NoCloseInputStream extends InputStream { + private final InputStream in; + + public NoCloseInputStream(InputStream in) { + this.in = in; + } + + @Override + public int read() throws IOException { + return in.read(); + } + + @Override + public int read(byte b[]) throws IOException { + return in.read(b); + } + + @Override + public int read(byte b[], int off, int len) throws IOException { + return in.read(b, off, len); + } + + @Override + public long skip(long n) throws IOException { + return in.skip(n); + } + + @Override + public int available() throws IOException { + return in.available(); + } + + @Override + public void close() throws IOException { + // don't propagate the call + } + + @Override + public void mark(int readlimit) { + in.mark(readlimit); + } + + @Override + public void reset() throws IOException { + in.reset(); + } + + @Override + public boolean markSupported() { + return in.markSupported(); + } + + } } diff --git a/src/share/classes/com/sun/media/sound/WaveFileWriter.java b/src/share/classes/com/sun/media/sound/WaveFileWriter.java index 3d56f9de222a85ba98eafeb6a8b6bae1bb70a942..00b0f173a9d81080195349b2c6f6a8f0f38721bd 100644 --- a/src/share/classes/com/sun/media/sound/WaveFileWriter.java +++ b/src/share/classes/com/sun/media/sound/WaveFileWriter.java @@ -25,12 +25,10 @@ package com.sun.media.sound; -import java.util.Vector; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; -import java.lang.IllegalArgumentException; import java.io.BufferedOutputStream; import java.io.DataOutputStream; @@ -371,7 +369,8 @@ public class WaveFileWriter extends SunFileWriter { dos.close(); header = baos.toByteArray(); headerStream = new ByteArrayInputStream( header ); - waveStream = new SequenceInputStream(headerStream,codedAudioStream); + waveStream = new SequenceInputStream(headerStream, + new NoCloseInputStream(codedAudioStream)); return (InputStream)waveStream; } diff --git a/src/share/classes/java/awt/Font.java b/src/share/classes/java/awt/Font.java index 051ec7fa578bc7815a374b74d392d62007968b4a..73585e46f9f4014198fdbd6ccfefc9627caaf62d 100644 --- a/src/share/classes/java/awt/Font.java +++ b/src/share/classes/java/awt/Font.java @@ -1985,8 +1985,22 @@ public class Font implements java.io.Serializable * @since 1.2 */ public int canDisplayUpTo(String str) { - return canDisplayUpTo(new StringCharacterIterator(str), 0, - str.length()); + Font2D font2d = getFont2D(); + int len = str.length(); + for (int i = 0; i < len; i++) { + char c = str.charAt(i); + if (font2d.canDisplay(c)) { + continue; + } + if (!Character.isHighSurrogate(c)) { + return i; + } + if (!font2d.canDisplay(str.codePointAt(i))) { + return i; + } + i++; + } + return -1; } /** @@ -2009,11 +2023,21 @@ public class Font implements java.io.Serializable * @since 1.2 */ public int canDisplayUpTo(char[] text, int start, int limit) { - while (start < limit && canDisplay(text[start])) { - ++start; + Font2D font2d = getFont2D(); + for (int i = start; i < limit; i++) { + char c = text[i]; + if (font2d.canDisplay(c)) { + continue; + } + if (!Character.isHighSurrogate(c)) { + return i; + } + if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) { + return i; + } + i++; } - - return start == limit ? -1 : start; + return -1; } /** @@ -2034,13 +2058,26 @@ public class Font implements java.io.Serializable * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { - for (char c = iter.setIndex(start); - iter.getIndex() < limit && canDisplay(c); - c = iter.next()) { + Font2D font2d = getFont2D(); + char c = iter.setIndex(start); + for (int i = start; i < limit; i++, c = iter.next()) { + if (font2d.canDisplay(c)) { + continue; + } + if (!Character.isHighSurrogate(c)) { + return i; + } + char c2 = iter.next(); + // c2 could be CharacterIterator.DONE which is not a low surrogate. + if (!Character.isLowSurrogate(c2)) { + return i; + } + if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { + return i; + } + i++; } - - int result = iter.getIndex(); - return result == limit ? -1 : result; + return -1; } /** diff --git a/src/share/classes/java/awt/color/ICC_Profile.java b/src/share/classes/java/awt/color/ICC_Profile.java index e7076203adcaf2c2edd3629f8b8e8667ee4b5dc7..8573694b9e7c26a22f913b308f9e8da253384d3b 100644 --- a/src/share/classes/java/awt/color/ICC_Profile.java +++ b/src/share/classes/java/awt/color/ICC_Profile.java @@ -58,7 +58,6 @@ import java.util.StringTokenizer; import java.security.AccessController; import java.security.PrivilegedAction; -import sun.misc.BootClassLoaderHook; /** * A representation of color profile data for device independent and @@ -865,8 +864,7 @@ public class ICC_Profile implements Serializable { case ColorSpace.CS_PYCC: synchronized(ICC_Profile.class) { if (PYCCprofile == null) { - if (BootClassLoaderHook.getHook() != null || - standardProfileExists("PYCC.pf")) + if (standardProfileExists("PYCC.pf")) { ProfileDeferralInfo pInfo = new ProfileDeferralInfo("PYCC.pf", diff --git a/src/share/classes/java/io/File.java b/src/share/classes/java/io/File.java index cde70d0b977019b77b32350b2129509b73dbe1de..af198a5ed486a58ce3462d7aaf175b23ee41e5ae 100644 --- a/src/share/classes/java/io/File.java +++ b/src/share/classes/java/io/File.java @@ -2055,7 +2055,7 @@ public class File * * @return a {@code Path} constructed from this abstract path * - * @throws InvalidPathException + * @throws java.nio.file.InvalidPathException * if a {@code Path} object cannot be constructed from the abstract * path (see {@link java.nio.file.FileSystem#getPath FileSystem.getPath}) * diff --git a/src/share/classes/java/lang/ClassLoader.java b/src/share/classes/java/lang/ClassLoader.java index 0e3cc28f4b478936706edfca9ce7a103bec5b3c8..37d7a30b583656893764c872d7b2b2be9aa30bbd 100644 --- a/src/share/classes/java/lang/ClassLoader.java +++ b/src/share/classes/java/lang/ClassLoader.java @@ -51,7 +51,6 @@ import java.util.Vector; import java.util.Hashtable; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; -import sun.misc.BootClassLoaderHook; import sun.misc.ClassFileTransformer; import sun.misc.CompoundEnumeration; import sun.misc.Resource; @@ -1300,7 +1299,6 @@ public abstract class ClassLoader { * Find resources from the VM's built-in classloader. */ private static URL getBootstrapResource(String name) { - BootClassLoaderHook.preLoadResource(name); URLClassPath ucp = getBootstrapClassPath(); Resource res = ucp.getResource(name); return res != null ? res.getURL() : null; @@ -1814,7 +1812,6 @@ public abstract class ClassLoader { // Invoked in the java.lang.Runtime class to implement load and loadLibrary. static void loadLibrary(Class fromClass, String name, boolean isAbsolute) { - BootClassLoaderHook.preLoadLibrary(name); ClassLoader loader = (fromClass == null) ? null : fromClass.getClassLoader(); if (sys_paths == null) { diff --git a/src/share/classes/java/lang/Package.java b/src/share/classes/java/lang/Package.java index 99db6944c92dba5d07e76729626f54b38e8caaea..75bb658af44e236b7429daf3308a50fa298337c9 100644 --- a/src/share/classes/java/lang/Package.java +++ b/src/share/classes/java/lang/Package.java @@ -576,12 +576,10 @@ public class Package implements java.lang.reflect.AnnotatedElement { * Returns the Manifest for the specified JAR file name. */ private static Manifest loadManifest(String fn) { - try { - FileInputStream fis = new FileInputStream(fn); - JarInputStream jis = new JarInputStream(fis, false); - Manifest man = jis.getManifest(); - jis.close(); - return man; + try (FileInputStream fis = new FileInputStream(fn); + JarInputStream jis = new JarInputStream(fis, false)) + { + return jis.getManifest(); } catch (IOException e) { return null; } diff --git a/src/share/classes/java/net/HttpURLConnection.java b/src/share/classes/java/net/HttpURLConnection.java index db4fc05d905d0d62960e50ab4f14cd6be5f64507..3b74394f6cd5fc13539085b6999fa2126e667ec1 100644 --- a/src/share/classes/java/net/HttpURLConnection.java +++ b/src/share/classes/java/net/HttpURLConnection.java @@ -400,7 +400,8 @@ abstract public class HttpURLConnection extends URLConnection { * @exception ProtocolException if the method cannot be reset or if * the requested method isn't valid for HTTP. * @exception SecurityException if a security manager is set and the - * "allowHttpTrace" NetPermission is not granted. + * method is "TRACE", but the "allowHttpTrace" + * NetPermission is not granted. * @see #getRequestMethod() */ public void setRequestMethod(String method) throws ProtocolException { diff --git a/src/share/classes/java/net/NetPermission.java b/src/share/classes/java/net/NetPermission.java index 0c459c3d5ab7c61af92631b2b9f3c8fc33e7af4c..2e1a2c93bba9d675a1befba306fbb949ef48fefb 100644 --- a/src/share/classes/java/net/NetPermission.java +++ b/src/share/classes/java/net/NetPermission.java @@ -73,6 +73,13 @@ import java.util.StringTokenizer; * * * + * getNetworkInformation + * The ability to retrieve all information about local network interfaces. + * Malicious code can read information about network hardware such as + * MAC addresses, which could be used to construct local IPv6 addresses. + * + * + * * getProxySelector * The ability to get the proxy selector used to make decisions * on which proxies to use when making network connections. diff --git a/src/share/classes/java/net/URI.java b/src/share/classes/java/net/URI.java index 111269d8b93ac8d1ea60eccd35c8bdb601f8fbb5..3465e1ab8794ce64725975608b9f71537b230181 100644 --- a/src/share/classes/java/net/URI.java +++ b/src/share/classes/java/net/URI.java @@ -991,7 +991,7 @@ public final class URI * authority and path are taken from the given URI.

* *
  • Otherwise the new URI's authority component is copied from - * this URI, and its path is computed as follows:

  • + * this URI, and its path is computed as follows:

    * *
      * @@ -1005,7 +1005,7 @@ public final class URI * path and then normalizing the result as if by invoking the {@link * #normalize() normalize} method.

      * - *
    + * * * * @@ -1511,7 +1511,7 @@ public final class URI * fragments.

    * *
  • Two hierarchical URIs with identical schemes are ordered - * according to the ordering of their authority components:

  • + * according to the ordering of their authority components:

    * *
      * @@ -1526,7 +1526,7 @@ public final class URI * the URIs are ordered according to the ordering of their authority * components.

      * - *
    + * * *
  • Finally, two hierarchical URIs with identical schemes and * authority components are ordered according to the ordering of their diff --git a/src/share/classes/java/net/package.html b/src/share/classes/java/net/package.html index 7c7058d7b1c28da5421a1839dccf0c86e74b2d94..12dfe9803d0a6c7c700a2a6e576c7a720a668158 100644 --- a/src/share/classes/java/net/package.html +++ b/src/share/classes/java/net/package.html @@ -31,18 +31,18 @@ Provides the classes for implementing networking applications.

    The java.net package can be roughly divided in two sections:

      -
    • A Low Level API, which deals with the following abstractions:

    • +
    • A Low Level API, which deals with the following abstractions:

      • Addresses, which are networking identifiers, like IP addresses.

      • Sockets, which are basic bidirectional data communication mechanisms.

      • Interfaces, which describe network interfaces.

      • -
      -
    • A High Level API, which deals with the following abstractions:

    • +
  • +
  • A High Level API, which deals with the following abstractions:

    • URIs, which represent Universal Resource Identifiers.

    • URLs, which represent Universal Resource Locators.

    • Connections, which represents connections to the resource pointed to by URLs.

    • -
    +
  • Addresses

    Addresses are used throughout the java.net APIs as either host identifiers, or socket endpoint identifiers.

    diff --git a/src/share/classes/java/nio/channels/AsynchronousFileChannel.java b/src/share/classes/java/nio/channels/AsynchronousFileChannel.java index 1ca3417cce22786677e56bfd4a1c2c0a844b8917..3e90769d329258c1c06787233d554a462361b515 100644 --- a/src/share/classes/java/nio/channels/AsynchronousFileChannel.java +++ b/src/share/classes/java/nio/channels/AsynchronousFileChannel.java @@ -48,12 +48,12 @@ import java.util.Collections; * *

    An asynchronous file channel does not have a current position * within the file. Instead, the file position is specified to each read and - * write methd that initiate asynchronous operations. A {@link CompletionHandler} + * write method that initiates asynchronous operations. A {@link CompletionHandler} * is specified as a parameter and is invoked to consume the result of the I/O * operation. This class also defines read and write methods that initiate * asynchronous operations, returning a {@link Future} to represent the pending * result of the operation. The {@code Future} may be used to check if the - * operation has completed, to wait for its completion. + * operation has completed, wait for its completion, and retrieve the result. * *

    In addition to read and write operations, this class defines the * following operations:

    @@ -73,13 +73,13 @@ import java.util.Collections; * which tasks are submitted to handle I/O events and dispatch to completion * handlers that consume the results of I/O operations on the channel. The * completion handler for an I/O operation initiated on a channel is guaranteed - * to be invoked by one threads in the thread pool (This ensures that the + * to be invoked by one of the threads in the thread pool (This ensures that the * completion handler is run by a thread with the expected identity). * Where an I/O operation completes immediately, and the initiating thread is * itself a thread in the thread pool, then the completion handler may be invoked * directly by the initiating thread. When an {@code AsynchronousFileChannel} is * created without specifying a thread pool then the channel is associated with - * a system-dependent and default thread pool that may be shared with other + * a system-dependent default thread pool that may be shared with other * channels. The default thread pool is configured by the system properties * defined by the {@link AsynchronousChannelGroup} class. * diff --git a/src/share/classes/java/nio/channels/SocketChannel.java b/src/share/classes/java/nio/channels/SocketChannel.java index fe044c4741da16d97975a20cd75b81920d29b353..b582c6d656a6710b89be0443c213cece0a710f78 100644 --- a/src/share/classes/java/nio/channels/SocketChannel.java +++ b/src/share/classes/java/nio/channels/SocketChannel.java @@ -182,10 +182,13 @@ public abstract class SocketChannel SocketChannel sc = open(); try { sc.connect(remote); - } finally { - if (!sc.isConnected()) { - try { sc.close(); } catch (IOException x) { } + } catch (Throwable x) { + try { + sc.close(); + } catch (Throwable suppressed) { + x.addSuppressed(suppressed); } + throw x; } assert sc.isConnected(); return sc; diff --git a/src/share/classes/java/nio/file/CopyMoveHelper.java b/src/share/classes/java/nio/file/CopyMoveHelper.java index 70ca6ee50ad3ec5a5491151924461572048d7e16..54bfe085962c218f99d215199d2d3b569d9f51e7 100644 --- a/src/share/classes/java/nio/file/CopyMoveHelper.java +++ b/src/share/classes/java/nio/file/CopyMoveHelper.java @@ -135,11 +135,13 @@ class CopyMoveHelper { view.setTimes(attrs.lastModifiedTime(), attrs.lastAccessTime(), attrs.creationTime()); - } catch (IOException x) { + } catch (Throwable x) { // rollback try { Files.delete(target); - } catch (IOException ignore) { } + } catch (Throwable suppressed) { + x.addSuppressed(suppressed); + } throw x; } } diff --git a/src/share/classes/java/nio/file/Files.java b/src/share/classes/java/nio/file/Files.java index 357529ac9cf065deaa7301b2d11a167702874537..3e19ca3e515dac1ad4ed8fcb7fe64ad53b628402 100644 --- a/src/share/classes/java/nio/file/Files.java +++ b/src/share/classes/java/nio/file/Files.java @@ -129,17 +129,18 @@ public final class Files { *
          *     Path path = ...
          *
    -     *     // replace an existing file or create the file if it doesn't initially exist
    +     *     // truncate and overwrite an existing file, or create the file if
    +     *     // it doesn't initially exist
          *     OutputStream out = Files.newOutputStream(path);
          *
          *     // append to an existing file, fail if the file does not exist
          *     out = Files.newOutputStream(path, APPEND);
          *
          *     // append to an existing file, create file if it doesn't initially exist
    -     *     out = Files.newOutputStream(CREATE, APPEND);
    +     *     out = Files.newOutputStream(path, CREATE, APPEND);
          *
          *     // always create new file, failing if it already exists
    -     *     out = Files.newOutputStream(CREATE_NEW);
    +     *     out = Files.newOutputStream(path, CREATE_NEW);
          * 
    * * @param path @@ -793,7 +794,8 @@ public final class Files { FileAttribute... attrs) throws IOException { - return TempFileHelper.createTempFile(dir, prefix, suffix, attrs); + return TempFileHelper.createTempFile(Objects.requireNonNull(dir), + prefix, suffix, attrs); } /** @@ -890,13 +892,14 @@ public final class Files { FileAttribute... attrs) throws IOException { - return TempFileHelper.createTempDirectory(dir, prefix, attrs); + return TempFileHelper.createTempDirectory(Objects.requireNonNull(dir), + prefix, attrs); } /** * Creates a new directory in the default temporary-file directory, using - * the given prefix and suffix to generate its name. The resulting {@code - * Path} is associated with the default {@code FileSystem}. + * the given prefix to generate its name. The resulting {@code Path} is + * associated with the default {@code FileSystem}. * *

    This method works in exactly the manner specified by {@link * #createTempDirectory(Path,String,FileAttribute[])} method for the case @@ -2583,7 +2586,7 @@ public final class Files { * walkFileTree(start, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, visitor) * * In other words, it does not follow symbolic links, and visits all levels - * of the file level. + * of the file tree. * * @param start * the starting file @@ -3005,7 +3008,7 @@ public final class Files { * or after some bytes have been written to the file. * *

    Usage example: By default the method creates a new file or - * overrides an existing file. Suppose you instead want to append bytes + * overwrites an existing file. Suppose you instead want to append bytes * to an existing file: *

          *     Path path = ...
    diff --git a/src/share/classes/java/security/CodeSigner.java b/src/share/classes/java/security/CodeSigner.java
    index 75a9df9d24ba1844ebf7d9e6abb3939b09d76f73..0b233d321faf2ecff57c41a7af3108503d3aa15b 100644
    --- a/src/share/classes/java/security/CodeSigner.java
    +++ b/src/share/classes/java/security/CodeSigner.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2003, 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
    @@ -26,10 +26,7 @@
     package java.security;
     
     import java.io.*;
    -import java.security.cert.CRL;
     import java.security.cert.CertPath;
    -import sun.misc.JavaSecurityCodeSignerAccess;
    -import sun.misc.SharedSecrets;
     
     /**
      * This class encapsulates information about a code signer.
    @@ -167,44 +164,6 @@ public final class CodeSigner implements Serializable {
             return sb.toString();
         }
     
    -    // A private attribute attached to this CodeSigner object. Can be accessed
    -    // through SharedSecrets.getJavaSecurityCodeSignerAccess().[g|s]etCRLs
    -    //
    -    // Currently called in SignatureFileVerifier.getSigners
    -    private transient CRL[] crls;
    -
    -    /**
    -     * Sets the CRLs attached
    -     * @param crls, null to clear
    -     */
    -    void setCRLs(CRL[] crls) {
    -        this.crls = crls;
    -    }
    -
    -    /**
    -     * Returns the CRLs attached
    -     * @return the crls, initially null
    -     */
    -    CRL[] getCRLs() {
    -        return crls;
    -    }
    -
    -    // Set up JavaSecurityCodeSignerAccess in SharedSecrets
    -    static {
    -        SharedSecrets.setJavaSecurityCodeSignerAccess(
    -                new JavaSecurityCodeSignerAccess() {
    -            @Override
    -            public void setCRLs(CodeSigner signer, CRL[] crls) {
    -                signer.setCRLs(crls);
    -            }
    -
    -            @Override
    -            public CRL[] getCRLs(CodeSigner signer) {
    -                return signer.getCRLs();
    -            }
    -        });
    -    }
    -
         // Explicitly reset hash code value to -1
         private void readObject(ObjectInputStream ois)
             throws IOException, ClassNotFoundException {
    diff --git a/src/share/classes/java/util/Calendar.java b/src/share/classes/java/util/Calendar.java
    index 70460eaec0790743d868e9fbe8579000807dced2..897a891cbe85f9bca7c0240e17babc5287353193 100644
    --- a/src/share/classes/java/util/Calendar.java
    +++ b/src/share/classes/java/util/Calendar.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1996, 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
    @@ -554,7 +554,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparableget and set indicating the
    -     * daylight savings offset in milliseconds.
    +     * daylight saving offset in milliseconds.
          * 

    * This field reflects the correct daylight saving offset value of * the time zone of this Calendar if the diff --git a/src/share/classes/java/util/Currency.java b/src/share/classes/java/util/Currency.java index b3058053afad05dacc424cb9eb536b2b7de7d480..e9ce7005df60f25875bdecdab0d8a49a305861d0 100644 --- a/src/share/classes/java/util/Currency.java +++ b/src/share/classes/java/util/Currency.java @@ -233,7 +233,9 @@ public final class Currency implements Serializable { "currency.properties"); if (propFile.exists()) { Properties props = new Properties(); - props.load(new FileReader(propFile)); + try (FileReader fr = new FileReader(propFile)) { + props.load(fr); + } Set keys = props.stringPropertyNames(); Pattern propertiesPattern = Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])"); diff --git a/src/share/classes/java/util/GregorianCalendar.java b/src/share/classes/java/util/GregorianCalendar.java index 75402f0ff65f5b4f4129fcdb2ac14ed381ecc136..3a6d203256a46fda0cda837d6538c60253cea959 100644 --- a/src/share/classes/java/util/GregorianCalendar.java +++ b/src/share/classes/java/util/GregorianCalendar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -260,7 +260,7 @@ import sun.util.calendar.ZoneInfo; * // create a Pacific Standard Time time zone * SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]); * - * // set up rules for daylight savings time + * // set up rules for Daylight Saving Time * pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); * pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); * diff --git a/src/share/classes/java/util/TimeZone.java b/src/share/classes/java/util/TimeZone.java index 9799be601fef0f5beb862be0d0051e0210516b7e..266f627d7e208e025371dd70c0a025e1862875fb 100644 --- a/src/share/classes/java/util/TimeZone.java +++ b/src/share/classes/java/util/TimeZone.java @@ -339,8 +339,9 @@ abstract public class TimeZone implements Serializable, Cloneable { /** * Returns a name in the specified {@code style} of this {@code TimeZone} * suitable for presentation to the user in the default locale. If the - * specified {@code daylight} is {@code true}, a daylight saving time name - * is returned. Otherwise, a standard time name is returned. + * specified {@code daylight} is {@code true}, a Daylight Saving Time name + * is returned (even if this {@code TimeZone} doesn't observe Daylight Saving + * Time). Otherwise, a Standard Time name is returned. * *

    This method is equivalent to: *

    @@ -348,7 +349,8 @@ abstract public class TimeZone implements Serializable, Cloneable { * Locale.getDefault({@link Locale.Category#DISPLAY})) *
    * - * @param daylight if {@code true}, return the daylight saving time name. + * @param daylight {@code true} specifying a Daylight Saving Time name, or + * {@code false} specifying a Standard Time name * @param style either {@link #LONG} or {@link #SHORT} * @return the human-readable name of this time zone in the default locale. * @exception IllegalArgumentException if {@code style} is invalid. @@ -356,6 +358,7 @@ abstract public class TimeZone implements Serializable, Cloneable { * @see #getDisplayName(boolean, int, Locale) * @see Locale#getDefault(Locale.Category) * @see Locale.Category + * @see java.text.DateFormatSymbols#getZoneStrings() */ public final String getDisplayName(boolean daylight, int style) { return getDisplayName(daylight, style, @@ -365,8 +368,9 @@ abstract public class TimeZone implements Serializable, Cloneable { /** * Returns a name in the specified {@code style} of this {@code TimeZone} * suitable for presentation to the user in the specified {@code - * locale}. If the specified {@code daylight} is {@code true}, a daylight - * saving time name is returned. Otherwise, a standard time name is + * locale}. If the specified {@code daylight} is {@code true}, a Daylight + * Saving Time name is returned (even if this {@code TimeZone} doesn't + * observe Daylight Saving Time). Otherwise, a Standard Time name is * returned. * *

    When looking up a time zone name, the {@linkplain @@ -379,13 +383,15 @@ abstract public class TimeZone implements Serializable, Cloneable { * found, the name is returned. Otherwise, a string in the * normalized custom ID format is returned. * - * @param daylight if {@code true}, return the daylight saving time name. + * @param daylight {@code true} specifying a Daylight Saving Time name, or + * {@code false} specifying a Standard Time name * @param style either {@link #LONG} or {@link #SHORT} - * @param locale the locale in which to supply the display name. + * @param locale the locale in which to supply the display name. * @return the human-readable name of this time zone in the given locale. * @exception IllegalArgumentException if {@code style} is invalid. * @exception NullPointerException if {@code locale} is {@code null}. * @since 1.2 + * @see java.text.DateFormatSymbols#getZoneStrings() */ public String getDisplayName(boolean daylight, int style, Locale locale) { if (style != SHORT && style != LONG) { @@ -526,10 +532,10 @@ abstract public class TimeZone implements Serializable, Cloneable { /** * Queries if the given {@code date} is in Daylight Saving Time in - * this {@code TimeZone}. + * this time zone. * - * @param date the given {@code Date}. - * @return {@code true} if the given {@code date} is in Daylight Saving Time, + * @param date the given Date. + * @return {@code true} if the given date is in Daylight Saving Time, * {@code false}, otherwise. */ abstract public boolean inDaylightTime(Date date); @@ -566,7 +572,7 @@ abstract public class TimeZone implements Serializable, Cloneable { * @param rawOffset the given time zone GMT offset in milliseconds. * @return an array of IDs, where the time zone for that ID has * the specified GMT offset. For example, "America/Phoenix" and "America/Denver" - * both have GMT-07:00, but differ in daylight savings behavior. + * both have GMT-07:00, but differ in daylight saving behavior. * @see #getRawOffset() */ public static synchronized String[] getAvailableIDs(int rawOffset) { diff --git a/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java b/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java index 2158084f9f9c1053b3068e6cbfd7cac01b92b2cf..1030fac04235359f3f82bfc8c9ee4562b757f284 100644 --- a/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java +++ b/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java @@ -272,13 +272,6 @@ public class ConcurrentLinkedDeque private static final Node PREV_TERMINATOR, NEXT_TERMINATOR; - static { - PREV_TERMINATOR = new Node(null); - PREV_TERMINATOR.next = PREV_TERMINATOR; - NEXT_TERMINATOR = new Node(null); - NEXT_TERMINATOR.prev = NEXT_TERMINATOR; - } - @SuppressWarnings("unchecked") Node prevTerminator() { return (Node) PREV_TERMINATOR; @@ -294,6 +287,9 @@ public class ConcurrentLinkedDeque volatile E item; volatile Node next; + Node() { // default constructor for NEXT_TERMINATOR, PREV_TERMINATOR + } + /** * Constructs a new node. Uses relaxed write because item can * only be seen after publication via casNext or casPrev. @@ -324,14 +320,25 @@ public class ConcurrentLinkedDeque // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = - sun.misc.Unsafe.getUnsafe(); - private static final long prevOffset = - objectFieldOffset(UNSAFE, "prev", Node.class); - private static final long itemOffset = - objectFieldOffset(UNSAFE, "item", Node.class); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", Node.class); + private static final sun.misc.Unsafe UNSAFE; + private static final long prevOffset; + private static final long itemOffset; + private static final long nextOffset; + + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Node.class; + prevOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("prev")); + itemOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("item")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } } /** @@ -1422,14 +1429,6 @@ public class ConcurrentLinkedDeque initHeadTail(h, t); } - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = - sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", ConcurrentLinkedDeque.class); - private static final long tailOffset = - objectFieldOffset(UNSAFE, "tail", ConcurrentLinkedDeque.class); private boolean casHead(Node cmp, Node val) { return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val); @@ -1439,15 +1438,25 @@ public class ConcurrentLinkedDeque return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val); } - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { + // Unsafe mechanics + + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + private static final long tailOffset; + static { + PREV_TERMINATOR = new Node(); + PREV_TERMINATOR.next = PREV_TERMINATOR; + NEXT_TERMINATOR = new Node(); + NEXT_TERMINATOR.prev = NEXT_TERMINATOR; try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = ConcurrentLinkedDeque.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + tailOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("tail")); + } catch (Exception e) { + throw new Error(e); } } } diff --git a/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java b/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java index b7beda274daec21bfe78a2e8042e144569477f57..54bd8cbfff5f0c803edbb4d18b557a28e3dc2cb6 100644 --- a/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java +++ b/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java @@ -194,12 +194,22 @@ public class ConcurrentLinkedQueue extends AbstractQueue // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = - sun.misc.Unsafe.getUnsafe(); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", Node.class); - private static final long itemOffset = - objectFieldOffset(UNSAFE, "item", Node.class); + private static final sun.misc.Unsafe UNSAFE; + private static final long itemOffset; + private static final long nextOffset; + + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Node.class; + itemOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("item")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } } /** @@ -790,14 +800,6 @@ public class ConcurrentLinkedQueue extends AbstractQueue throw new NullPointerException(); } - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", ConcurrentLinkedQueue.class); - private static final long tailOffset = - objectFieldOffset(UNSAFE, "tail", ConcurrentLinkedQueue.class); - private boolean casTail(Node cmp, Node val) { return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val); } @@ -806,15 +808,21 @@ public class ConcurrentLinkedQueue extends AbstractQueue return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val); } - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { + // Unsafe mechanics + + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + private static final long tailOffset; + static { try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = ConcurrentLinkedQueue.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + tailOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("tail")); + } catch (Exception e) { + throw new Error(e); } } } diff --git a/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java b/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java index 64d28cf60408f36f59e1f1bdc8c3ef6fcb7d025c..f1b11140291a8dfbd0376c2a97a9c7b15af47306 100644 --- a/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java +++ b/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java @@ -507,13 +507,24 @@ public class ConcurrentSkipListMap extends AbstractMap return new AbstractMap.SimpleImmutableEntry(key, v); } - // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long valueOffset = - objectFieldOffset(UNSAFE, "value", Node.class); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", Node.class); + // UNSAFE mechanics + + private static final sun.misc.Unsafe UNSAFE; + private static final long valueOffset; + private static final long nextOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Node.class; + valueOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("value")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } } /* ---------------- Indexing -------------- */ @@ -580,10 +591,18 @@ public class ConcurrentSkipListMap extends AbstractMap } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long rightOffset = - objectFieldOffset(UNSAFE, "right", Index.class); - + private static final sun.misc.Unsafe UNSAFE; + private static final long rightOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Index.class; + rightOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("right")); + } catch (Exception e) { + throw new Error(e); + } + } } /* ---------------- Head nodes -------------- */ @@ -3082,20 +3101,16 @@ public class ConcurrentSkipListMap extends AbstractMap } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", ConcurrentSkipListMap.class); - - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + static { try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = ConcurrentSkipListMap.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + } catch (Exception e) { + throw new Error(e); } } - } diff --git a/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java b/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java index 09f8dc6f5b2309bfb10f62bbc2c9bc5c829dd7e6..04b845c3f8736c339d9df4ea989c5c9f5104fa4d 100644 --- a/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java +++ b/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java @@ -470,16 +470,20 @@ public class ConcurrentSkipListSet } // Support for resetting map in clone - private static final Unsafe unsafe = Unsafe.getUnsafe(); + private void setMap(ConcurrentNavigableMap map) { + UNSAFE.putObjectVolatile(this, mapOffset, map); + } + + private static final sun.misc.Unsafe UNSAFE; private static final long mapOffset; static { try { - mapOffset = unsafe.objectFieldOffset - (ConcurrentSkipListSet.class.getDeclaredField("m")); - } catch (Exception ex) { throw new Error(ex); } - } - private void setMap(ConcurrentNavigableMap map) { - unsafe.putObjectVolatile(this, mapOffset, map); + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = ConcurrentSkipListSet.class; + mapOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("m")); + } catch (Exception e) { + throw new Error(e); + } } - } diff --git a/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java b/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java index 8c5193538fae26b24131730f74c3f7b6d20ad503..e39cbeeb2d7041ce2509a01ec5066915dfe24a05 100644 --- a/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java +++ b/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java @@ -1318,16 +1318,19 @@ public class CopyOnWriteArrayList } // Support for resetting lock while deserializing - private static final Unsafe unsafe = Unsafe.getUnsafe(); + private void resetLock() { + UNSAFE.putObjectVolatile(this, lockOffset, new ReentrantLock()); + } + private static final sun.misc.Unsafe UNSAFE; private static final long lockOffset; static { try { - lockOffset = unsafe.objectFieldOffset - (CopyOnWriteArrayList.class.getDeclaredField("lock")); - } catch (Exception ex) { throw new Error(ex); } - } - private void resetLock() { - unsafe.putObjectVolatile(this, lockOffset, new ReentrantLock()); + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = CopyOnWriteArrayList.class; + lockOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("lock")); + } catch (Exception e) { + throw new Error(e); + } } - } diff --git a/src/share/classes/java/util/concurrent/LinkedTransferQueue.java b/src/share/classes/java/util/concurrent/LinkedTransferQueue.java index fec92a8b189477406ab7800a2c14ca7ff5b88b03..7571978169be81d7eb74c4cfd2a10f0587e89165 100644 --- a/src/share/classes/java/util/concurrent/LinkedTransferQueue.java +++ b/src/share/classes/java/util/concurrent/LinkedTransferQueue.java @@ -525,16 +525,27 @@ public class LinkedTransferQueue extends AbstractQueue return false; } - // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", Node.class); - private static final long itemOffset = - objectFieldOffset(UNSAFE, "item", Node.class); - private static final long waiterOffset = - objectFieldOffset(UNSAFE, "waiter", Node.class); - private static final long serialVersionUID = -3375979862319811754L; + + // Unsafe mechanics + private static final sun.misc.Unsafe UNSAFE; + private static final long itemOffset; + private static final long nextOffset; + private static final long waiterOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Node.class; + itemOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("item")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + waiterOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("waiter")); + } catch (Exception e) { + throw new Error(e); + } + } } /** head of the queue; null until first enqueue */ @@ -1312,23 +1323,22 @@ public class LinkedTransferQueue extends AbstractQueue // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", LinkedTransferQueue.class); - private static final long tailOffset = - objectFieldOffset(UNSAFE, "tail", LinkedTransferQueue.class); - private static final long sweepVotesOffset = - objectFieldOffset(UNSAFE, "sweepVotes", LinkedTransferQueue.class); - - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + private static final long tailOffset; + private static final long sweepVotesOffset; + static { try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = LinkedTransferQueue.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + tailOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("tail")); + sweepVotesOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("sweepVotes")); + } catch (Exception e) { + throw new Error(e); } } } diff --git a/src/share/classes/java/util/concurrent/Phaser.java b/src/share/classes/java/util/concurrent/Phaser.java index d5725b3e1a2dc1570fb6f5396f7f090c3b5c6c66..7e3622191797e4b7937151f04e65be11b0b6334a 100644 --- a/src/share/classes/java/util/concurrent/Phaser.java +++ b/src/share/classes/java/util/concurrent/Phaser.java @@ -1137,18 +1137,16 @@ public class Phaser { // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long stateOffset = - objectFieldOffset("state", Phaser.class); - - private static long objectFieldOffset(String field, Class klazz) { + private static final sun.misc.Unsafe UNSAFE; + private static final long stateOffset; + static { try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = Phaser.class; + stateOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("state")); + } catch (Exception e) { + throw new Error(e); } } } diff --git a/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java b/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java index 60928ac8a74304e623f4d79542184c48a6adad33..5ad7fa71d71b9aecd61fd04566ccccf2908e3fa3 100644 --- a/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java +++ b/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java @@ -963,21 +963,16 @@ public class PriorityBlockingQueue extends AbstractQueue } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long allocationSpinLockOffset = - objectFieldOffset(UNSAFE, "allocationSpinLock", - PriorityBlockingQueue.class); - - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { + private static final sun.misc.Unsafe UNSAFE; + private static final long allocationSpinLockOffset; + static { try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = PriorityBlockingQueue.class; + allocationSpinLockOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("allocationSpinLock")); + } catch (Exception e) { + throw new Error(e); } } - } diff --git a/src/share/classes/java/util/concurrent/SynchronousQueue.java b/src/share/classes/java/util/concurrent/SynchronousQueue.java index 47b352f9e355034410804c307b1c6278f1575003..d02f56d9b72d8e7985a63cbc31831fdeb0310082 100644 --- a/src/share/classes/java/util/concurrent/SynchronousQueue.java +++ b/src/share/classes/java/util/concurrent/SynchronousQueue.java @@ -279,12 +279,22 @@ public class SynchronousQueue extends AbstractQueue } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", SNode.class); - private static final long matchOffset = - objectFieldOffset(UNSAFE, "match", SNode.class); - + private static final sun.misc.Unsafe UNSAFE; + private static final long matchOffset; + private static final long nextOffset; + + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = SNode.class; + matchOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("match")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } } /** The head (top) of the stack */ @@ -498,10 +508,18 @@ public class SynchronousQueue extends AbstractQueue } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", TransferStack.class); - + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = TransferStack.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + } catch (Exception e) { + throw new Error(e); + } + } } /** Dual Queue */ @@ -558,11 +576,22 @@ public class SynchronousQueue extends AbstractQueue } // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", QNode.class); - private static final long itemOffset = - objectFieldOffset(UNSAFE, "item", QNode.class); + private static final sun.misc.Unsafe UNSAFE; + private static final long itemOffset; + private static final long nextOffset; + + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = QNode.class; + itemOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("item")); + nextOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("next")); + } catch (Exception e) { + throw new Error(e); + } + } } /** Head of queue */ @@ -791,15 +820,24 @@ public class SynchronousQueue extends AbstractQueue } } - // unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", TransferQueue.class); - private static final long tailOffset = - objectFieldOffset(UNSAFE, "tail", TransferQueue.class); - private static final long cleanMeOffset = - objectFieldOffset(UNSAFE, "cleanMe", TransferQueue.class); - + private static final sun.misc.Unsafe UNSAFE; + private static final long headOffset; + private static final long tailOffset; + private static final long cleanMeOffset; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class k = TransferQueue.class; + headOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("head")); + tailOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("tail")); + cleanMeOffset = UNSAFE.objectFieldOffset + (k.getDeclaredField("cleanMe")); + } catch (Exception e) { + throw new Error(e); + } + } } /** diff --git a/src/share/classes/java/util/jar/JarFile.java b/src/share/classes/java/util/jar/JarFile.java index a5795c72763c81e820034b4429548c736028062a..79d0f84b7e17cbb9f861576d13f77b23ac12125d 100644 --- a/src/share/classes/java/util/jar/JarFile.java +++ b/src/share/classes/java/util/jar/JarFile.java @@ -376,9 +376,9 @@ class JarFile extends ZipFile { */ private byte[] getBytes(ZipEntry ze) throws IOException { byte[] b = new byte[(int)ze.getSize()]; - DataInputStream is = new DataInputStream(super.getInputStream(ze)); - is.readFully(b, 0, b.length); - is.close(); + try (DataInputStream is = new DataInputStream(super.getInputStream(ze))) { + is.readFully(b, 0, b.length); + } return b; } @@ -480,10 +480,10 @@ class JarFile extends ZipFile { JarEntry manEntry = getManEntry(); if (manEntry != null) { byte[] b = new byte[(int)manEntry.getSize()]; - DataInputStream dis = new DataInputStream( - super.getInputStream(manEntry)); - dis.readFully(b, 0, b.length); - dis.close(); + try (DataInputStream dis = new DataInputStream( + super.getInputStream(manEntry))) { + dis.readFully(b, 0, b.length); + } int last = b.length - src.length; int i = 0; diff --git a/src/share/classes/java/util/zip/ZipEntry.java b/src/share/classes/java/util/zip/ZipEntry.java index 0a86f2d447d8ee657812f5c322f06e5bc0e25829..7d05c9dd63284ea0e97db7b9dbd9d0c9fa1e2f82 100644 --- a/src/share/classes/java/util/zip/ZipEntry.java +++ b/src/share/classes/java/util/zip/ZipEntry.java @@ -26,7 +26,6 @@ package java.util.zip; import java.util.Date; -import sun.misc.BootClassLoaderHook; /** * This class is used to represent a ZIP file entry. diff --git a/src/share/classes/javax/crypto/SecretKeyFactory.java b/src/share/classes/javax/crypto/SecretKeyFactory.java index 1d00db7badb09cd62f769080bdad1b7d748a4489..bf32bae08c5a14e6bede465a53a38d4d64e278ff 100644 --- a/src/share/classes/javax/crypto/SecretKeyFactory.java +++ b/src/share/classes/javax/crypto/SecretKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -61,7 +61,6 @@ import sun.security.jca.GetInstance.Instance; *

    Every implementation of the Java platform is required to support the * following standard SecretKeyFactory algorithms: *

      - *
    • AES
    • *
    • DES
    • *
    • DESede
    • *
    diff --git a/src/share/classes/javax/sound/midi/MidiSystem.java b/src/share/classes/javax/sound/midi/MidiSystem.java index b2a47dc96540cbf76878015be43f5a941706e9f5..a03c91e086c67b6b3c92c326deee8d12fe998aeb 100644 --- a/src/share/classes/javax/sound/midi/MidiSystem.java +++ b/src/share/classes/javax/sound/midi/MidiSystem.java @@ -441,13 +441,6 @@ public class MidiSystem { Synthesizer synth = getSynthesizer(); if (synth instanceof ReferenceCountingDevice) { rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); - // only use MixerSynth if it could successfully load a soundbank - if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth") - && (synth.getDefaultSoundbank() == null)) { - // don't use this receiver if no soundbank available - rec = null; - synth.close(); - } } else { synth.open(); try { diff --git a/src/share/classes/javax/swing/DefaultDesktopManager.java b/src/share/classes/javax/swing/DefaultDesktopManager.java index 8ab24e56dd755345d7d01c176e035c969a567be0..df3d6eb2ab5d7c8ef90cfcea0c5ecf8991ac862a 100644 --- a/src/share/classes/javax/swing/DefaultDesktopManager.java +++ b/src/share/classes/javax/swing/DefaultDesktopManager.java @@ -174,6 +174,8 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab if(!wasIcon(f)) { Rectangle r = getBoundsForIconOf(f); desktopIcon.setBounds(r.x, r.y, r.width, r.height); + // we must validate the hierarchy to not break the hw/lw mixing + desktopIcon.revalidate(); setWasIcon(f, Boolean.TRUE); } @@ -453,11 +455,9 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab /** This moves the JComponent and repaints the damaged areas. */ public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) { - boolean didResize = (f.getWidth() != newWidth || f.getHeight() != newHeight); f.setBounds(newX, newY, newWidth, newHeight); - if(didResize) { - f.validate(); - } + // we must validate the hierarchy to not break the hw/lw mixing + f.revalidate(); } /** Convenience method to remove the desktopIcon of f is necessary. */ diff --git a/src/share/classes/javax/swing/JComponent.java b/src/share/classes/javax/swing/JComponent.java index eff194ca21265f10bfbba8207be57e02cbae391d..c07276df4f83a055731fe96d88d7e34d0863e568 100644 --- a/src/share/classes/javax/swing/JComponent.java +++ b/src/share/classes/javax/swing/JComponent.java @@ -5158,31 +5158,30 @@ public abstract class JComponent extends Container implements Serializable, } } } - try { - g = safelyGetGraphics(paintingComponent, c); - try { - if (hasBuffer) { - RepaintManager rm = RepaintManager.currentManager( - bufferedComponent); - rm.beginPaint(); - try { - rm.paint(paintingComponent, bufferedComponent, g, - paintImmediatelyClip.x, - paintImmediatelyClip.y, - paintImmediatelyClip.width, - paintImmediatelyClip.height); - } finally { - rm.endPaint(); + if ((g = safelyGetGraphics(paintingComponent, c)) != null) { + try { + if (hasBuffer) { + RepaintManager rm = RepaintManager.currentManager( + bufferedComponent); + rm.beginPaint(); + try { + rm.paint(paintingComponent, bufferedComponent, g, + paintImmediatelyClip.x, + paintImmediatelyClip.y, + paintImmediatelyClip.width, + paintImmediatelyClip.height); + } finally { + rm.endPaint(); + } + } else { + g.setClip(paintImmediatelyClip.x, paintImmediatelyClip.y, + paintImmediatelyClip.width, paintImmediatelyClip.height); + paintingComponent.paint(g); } + } finally { + g.dispose(); } - else { - g.setClip(paintImmediatelyClip.x,paintImmediatelyClip.y, - paintImmediatelyClip.width,paintImmediatelyClip.height); - paintingComponent.paint(g); - } - } finally { - g.dispose(); } } finally { diff --git a/src/share/classes/javax/swing/JViewport.java b/src/share/classes/javax/swing/JViewport.java index 80a124a41dc72afd57db85af1d6084d51982f577..85f39b373870dd47b586615ac6333e63b4664d6d 100644 --- a/src/share/classes/javax/swing/JViewport.java +++ b/src/share/classes/javax/swing/JViewport.java @@ -1111,6 +1111,8 @@ public class JViewport extends JComponent implements Accessible view.setLocation(newX, newY); repaintAll = false; } + // we must validate the hierarchy to not break the hw/lw mixing + revalidate(); fireStateChanged(); } } diff --git a/src/share/classes/javax/swing/text/Utilities.java b/src/share/classes/javax/swing/text/Utilities.java index 704cfa02c84c7c3a17ef05eff1bde3d6dc35f109..e3ef4940d5a89a1951715cae259bc30d454a53c1 100644 --- a/src/share/classes/javax/swing/text/Utilities.java +++ b/src/share/classes/javax/swing/text/Utilities.java @@ -390,11 +390,15 @@ public class Utilities { } if ((x >= currX) && (x < nextX)) { // found the hit position... return the appropriate side - if ((round == false) || ((x - currX) < (nextX - x))) { - return i - txtOffset; - } else { - return i + 1 - txtOffset; + int offset = ((round == false) || ((x - currX) < (nextX - x))) ? + (i - txtOffset) : (i + 1 - txtOffset); + // the length of the string measured as a whole may differ from + // the sum of individual character lengths, for example if + // fractional metrics are enabled; and we must guard from this. + while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) { + offset--; } + return (offset < 0 ? 0 : offset); } currX = nextX; } @@ -403,24 +407,6 @@ public class Utilities { return txtCount; } - /** - * Adjust text offset so that the length of a resulting string as a whole - * fits into the specified width. - */ - static int adjustOffsetForFractionalMetrics( - Segment s, FontMetrics fm, int offset, int width) { - // Sometimes the offset returned by getTabbedTextOffset is beyond the - // available area, when fractional metrics are enabled. We should - // guard against this. - if (offset < s.count) { - while (offset > 0 && - fm.charsWidth(s.array, s.offset, offset + 1) > width) { - offset--; - } - } - return offset; - } - /** * Determine where to break the given text to fit * within the given span. This tries to find a word boundary. @@ -443,7 +429,6 @@ public class Utilities { int txtCount = s.count; int index = Utilities.getTabbedTextOffset(s, metrics, x0, x, e, startOffset, false); - index = adjustOffsetForFractionalMetrics(s, metrics, index, x - x0); if (index >= txtCount - 1) { return txtCount; diff --git a/src/share/classes/javax/swing/text/WrappedPlainView.java b/src/share/classes/javax/swing/text/WrappedPlainView.java index 2f02a7ca956f200cecce87857abcc66b3fd07303..90d11659c2c6673c19b32b62b3819d7ed4f43e30 100644 --- a/src/share/classes/javax/swing/text/WrappedPlainView.java +++ b/src/share/classes/javax/swing/text/WrappedPlainView.java @@ -239,11 +239,9 @@ public class WrappedPlainView extends BoxView implements TabExpander { tabBase, tabBase + currentWidth, this, p0); } else { - int offset = Utilities.getTabbedTextOffset(segment, metrics, - tabBase, tabBase + currentWidth, this, p0, false); - offset = Utilities.adjustOffsetForFractionalMetrics( - segment, metrics, offset, currentWidth); - p = p0 + offset; + p = p0 + Utilities.getTabbedTextOffset(segment, metrics, + tabBase, tabBase + currentWidth, + this, p0, false); } SegmentCache.releaseSharedSegment(segment); return p; diff --git a/src/share/classes/javax/swing/text/html/CSSBorder.java b/src/share/classes/javax/swing/text/html/CSSBorder.java index 5424f97ac824c6254668e7c41866cf0f1e1c0451..f533ca4ad36c922574b10f95ec156de0056573ef 100644 --- a/src/share/classes/javax/swing/text/html/CSSBorder.java +++ b/src/share/classes/javax/swing/text/html/CSSBorder.java @@ -203,10 +203,11 @@ class CSSBorder extends AbstractBorder { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - assert (g instanceof Graphics2D) : "need Graphics2D instanse"; - Graphics2D g2 = (Graphics2D) g; - Color savedColor = g2.getColor(); - Shape savedClip = g2.getClip(); + if (!(g instanceof Graphics2D)) { + return; + } + + Graphics2D g2 = (Graphics2D) g.create(); int[] widths = getWidths(); @@ -238,16 +239,16 @@ class CSSBorder extends AbstractBorder { BorderPainter painter = getBorderPainter(i); double angle = i * Math.PI / 2; + g2.setClip(g.getClip()); // Restore initial clip g2.translate(intCorners[i][0], intCorners[i][1]); g2.rotate(angle); - g2.setClip(shape); - painter.paint(shape, g, color, i); + g2.clip(shape); + painter.paint(shape, g2, color, i); g2.rotate(-angle); g2.translate(-intCorners[i][0], -intCorners[i][1]); } } - g2.setColor(savedColor); - g2.setClip(savedClip); + g2.dispose(); } diff --git a/src/share/classes/sun/font/StrikeCache.java b/src/share/classes/sun/font/StrikeCache.java index a7aa1f5846ccc4a10205907f7e48a566dc07b74f..46c7b7a9a9e5543a0df4a376d9c66479ec24d67c 100644 --- a/src/share/classes/sun/font/StrikeCache.java +++ b/src/share/classes/sun/font/StrikeCache.java @@ -319,8 +319,7 @@ public final class StrikeCache { ArrayList gids = null; for (int i = 0; i < glyphPtrs.length; i++) { - if (glyphPtrs[i] != 0 && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0 - && unsafe.getInt(glyphPtrs[i] + cacheCellOffset) != 0) { + if (glyphPtrs[i] != 0 && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0) { if (gids == null) { gids = new ArrayList(); @@ -330,6 +329,8 @@ public final class StrikeCache { } if (gids != null) { + // Any reference by the disposers to the native glyph ptrs + // must be done before this returns. notifyDisposeListeners(gids); } } @@ -345,8 +346,7 @@ public final class StrikeCache { for (int i=0; i < glyphPtrs.length; i++) { if (glyphPtrs[i] != 0 - && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0 - && unsafe.getInt(glyphPtrs[i] + cacheCellOffset) != 0) { + && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0) { if (gids == null) { gids = new ArrayList(); @@ -356,6 +356,8 @@ public final class StrikeCache { } if (gids != null) { + // Any reference by the disposers to the native glyph ptrs + // must be done before this returns. notifyDisposeListeners(gids); } } diff --git a/src/share/classes/sun/java2d/pipe/AAShapePipe.java b/src/share/classes/sun/java2d/pipe/AAShapePipe.java index 8654bede25c0089b933f6a1b6bc6b85b48ccb04f..4cba5a0b2a15477d383b0d3fc48999a5f0516efc 100644 --- a/src/share/classes/sun/java2d/pipe/AAShapePipe.java +++ b/src/share/classes/sun/java2d/pipe/AAShapePipe.java @@ -109,7 +109,7 @@ public class AAShapePipe Region clip = sg.getCompClip(); int abox[] = new int[4]; AATileGenerator aatg = - renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0, + renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1, lw2, clip, abox); if (aatg == null) { // Nothing to render diff --git a/src/share/classes/sun/misc/BootClassLoaderHook.java b/src/share/classes/sun/misc/BootClassLoaderHook.java deleted file mode 100644 index 0df465c3e66dac9b14e017cb911c8bd409655b5b..0000000000000000000000000000000000000000 --- a/src/share/classes/sun/misc/BootClassLoaderHook.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. 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.misc; - -import java.io.File; -import java.io.IOException; -import java.net.URLStreamHandlerFactory; -import sun.misc.URLClassPath; - -/** - * BootClassLoaderHook defines an interface for a hook to inject - * into the bootstrap class loader. - * - * With jkernel now removed, no hook is set - */ -public abstract class BootClassLoaderHook { - private static BootClassLoaderHook bootLoaderHook = null; - public static synchronized BootClassLoaderHook getHook() { - return bootLoaderHook; - } - - public static synchronized void setHook(BootClassLoaderHook hook) { - if (!VM.isBooted()) { - throw new InternalError("hook can only be set after VM is booted"); - } - if (bootLoaderHook != null) { - throw new InternalError("hook should not be reinitialized"); - } - bootLoaderHook = hook; - } - - protected BootClassLoaderHook() { - } - - /** - * A method to be invoked before a class loader loads - * a bootstrap class. - * - * @param classname the binary name of the class - */ - public static void preLoadClass(String classname) { - BootClassLoaderHook hook = getHook(); - if (hook != null) { - hook.loadBootstrapClass(classname); - } - } - - /** - * A method to be invoked before a class loader loads - * a resource. - * - * @param resourcename the resource name - */ - public static void preLoadResource(String resourcename) { - BootClassLoaderHook hook = getHook(); - if (hook != null) { - hook.getBootstrapResource(resourcename); - } - } - - /** - * A method to be invoked before a library is loaded. - * - * @param libname the name of the library - */ - public static void preLoadLibrary(String libname) { - BootClassLoaderHook hook = getHook(); - if (hook != null) { - hook.loadLibrary(libname); - } - } - - /** - * Returns a pathname of a JAR or class that the hook loads - * per this loadClass request; or null. - * - * @param classname the binary name of the class - */ - public abstract String loadBootstrapClass(String className); - - /** - * Returns a pathname of a resource file that the hook loads - * per this getResource request; or null. - * - * @param resourceName the resource name - */ - public abstract String getBootstrapResource(String resourceName); - - /** - * Returns true if the hook successfully performs an operation per - * this loadLibrary request; or false if it fails. - * - * @param libname the name of the library - */ - public abstract boolean loadLibrary(String libname); - - /** - * Returns a bootstrap class path constructed by the hook. - * - * @param bcp VM's bootstrap class path - * @param factory Launcher's URL stream handler - */ - public abstract URLClassPath getBootstrapClassPath(URLClassPath bcp, - URLStreamHandlerFactory factory); - - /** - * Returns true if the current thread is in the process of doing - * a prefetching operation. - */ - public abstract boolean isCurrentThreadPrefetching(); - - /** - * Returns true if the hook successfully prefetches the specified file. - * - * @param name a platform independent pathname - */ - public abstract boolean prefetchFile(String name); -} diff --git a/src/share/classes/sun/misc/Launcher.java b/src/share/classes/sun/misc/Launcher.java index 93a6b168f33e56b79516f7d3e28e3799b1cfdc0e..81da69490febaf9786494ce0d5e625dbd3d804b8 100644 --- a/src/share/classes/sun/misc/Launcher.java +++ b/src/share/classes/sun/misc/Launcher.java @@ -38,7 +38,6 @@ import java.util.StringTokenizer; import java.util.Set; import java.util.Vector; import java.security.AccessController; -import java.security.AllPermission; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.AccessControlContext; @@ -117,18 +116,6 @@ public class Launcher { return loader; } - public static void addURLToAppClassLoader(URL u) { - AccessController.checkPermission(new AllPermission()); - ClassLoader loader = Launcher.getLauncher().getClassLoader(); - ((Launcher.AppClassLoader) loader).addAppURL(u); - } - - public static void addURLToExtClassLoader(URL u) { - AccessController.checkPermission(new AllPermission()); - ClassLoader loader = Launcher.getLauncher().getClassLoader(); - ((Launcher.ExtClassLoader) loader.getParent()).addExtURL(u); - } - /* * The class loader used for loading installed extensions. */ @@ -247,11 +234,6 @@ public class Launcher { return null; } - protected Class findClass(String name) throws ClassNotFoundException { - BootClassLoaderHook.preLoadClass(name); - return super.findClass(name); - } - private static AccessControlContext getContext(File[] dirs) throws IOException { @@ -316,7 +298,6 @@ public class Launcher { public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - BootClassLoaderHook.preLoadClass(name); int i = name.lastIndexOf('.'); if (i != -1) { SecurityManager sm = System.getSecurityManager(); @@ -373,10 +354,6 @@ public class Launcher { return acc; } - - void addAppURL(URL url) { - super.addURL(url); - } } private static class BootClassPathHolder { @@ -413,11 +390,7 @@ public class Launcher { } public static URLClassPath getBootstrapClassPath() { - URLClassPath bcp = BootClassPathHolder.bcp; - // if DownloadManager is installed, return the bootstrap class path - // maintained by the Java kernel - BootClassLoaderHook hook = BootClassLoaderHook.getHook(); - return hook == null ? bcp : hook.getBootstrapClassPath(bcp, factory); + return BootClassPathHolder.bcp; } private static URL[] pathToURLs(File[] path) { diff --git a/src/share/classes/sun/misc/SharedSecrets.java b/src/share/classes/sun/misc/SharedSecrets.java index 77c0aa8a09541a29fa2e8b0b6868054b744aa652..2335b2d68b58b97e12734d4971e4b07f6d9055c3 100644 --- a/src/share/classes/sun/misc/SharedSecrets.java +++ b/src/share/classes/sun/misc/SharedSecrets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -28,7 +28,6 @@ package sun.misc; import java.util.jar.JarFile; import java.io.Console; import java.io.FileDescriptor; -import java.security.CodeSigner; import java.security.ProtectionDomain; /** A repository of "shared secrets", which are a mechanism for @@ -49,7 +48,6 @@ public class SharedSecrets { private static JavaNioAccess javaNioAccess; private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; - private static JavaSecurityCodeSignerAccess javaSecurityCodeSignerAccess; public static JavaUtilJarAccess javaUtilJarAccess() { if (javaUtilJarAccess == null) { @@ -127,16 +125,4 @@ public class SharedSecrets { unsafe.ensureClassInitialized(ProtectionDomain.class); return javaSecurityProtectionDomainAccess; } - - public static void setJavaSecurityCodeSignerAccess - (JavaSecurityCodeSignerAccess jscsa) { - javaSecurityCodeSignerAccess = jscsa; - } - - public static JavaSecurityCodeSignerAccess - getJavaSecurityCodeSignerAccess() { - if (javaSecurityCodeSignerAccess == null) - unsafe.ensureClassInitialized(CodeSigner.class); - return javaSecurityCodeSignerAccess; - } } diff --git a/src/share/classes/sun/net/httpserver/ChunkedInputStream.java b/src/share/classes/sun/net/httpserver/ChunkedInputStream.java index 97b8242a9fafdb2292b567b7d132374d36ac8a93..95e0101898639bb096a7ca63d72ee1181d7d2ed1 100644 --- a/src/share/classes/sun/net/httpserver/ChunkedInputStream.java +++ b/src/share/classes/sun/net/httpserver/ChunkedInputStream.java @@ -69,32 +69,33 @@ class ChunkedInputStream extends LeftOverInputStream { */ private int readChunkHeader () throws IOException { boolean gotCR = false; - char c; + int c; char[] len_arr = new char [16]; int len_size = 0; boolean end_of_len = false; - while ((c=(char)in.read())!= -1) { + while ((c=in.read())!= -1) { + char ch = (char) c; if (len_size == len_arr.length -1) { throw new IOException ("invalid chunk header"); } if (gotCR) { - if (c == LF) { + if (ch == LF) { int l = numeric (len_arr, len_size); return l; } else { gotCR = false; } if (!end_of_len) { - len_arr[len_size++] = c; + len_arr[len_size++] = ch; } } else { - if (c == CR) { + if (ch == CR) { gotCR = true; - } else if (c == ';') { + } else if (ch == ';') { end_of_len = true; } else if (!end_of_len) { - len_arr[len_size++] = c; + len_arr[len_size++] = ch; } } } diff --git a/src/share/classes/sun/nio/ch/FileChannelImpl.java b/src/share/classes/sun/nio/ch/FileChannelImpl.java index b15086eab12282ee663d15d143ba04fb91597c92..c52fff788e9d5d244002e71e1b67ceb0d5ad0254 100644 --- a/src/share/classes/sun/nio/ch/FileChannelImpl.java +++ b/src/share/classes/sun/nio/ch/FileChannelImpl.java @@ -475,8 +475,8 @@ public class FileChannelImpl assert !target.isOpen(); try { close(); - } catch (IOException ignore) { - // nothing we can do + } catch (Throwable suppressed) { + e.addSuppressed(suppressed); } throw e; } catch (IOException ioe) { diff --git a/src/share/classes/sun/security/pkcs11/P11Cipher.java b/src/share/classes/sun/security/pkcs11/P11Cipher.java index 3d2525f3f07e0cbc934b1de8b54d4302cd580f92..5257859e30efb48dc1faaff266543477542e2f60 100644 --- a/src/share/classes/sun/security/pkcs11/P11Cipher.java +++ b/src/share/classes/sun/security/pkcs11/P11Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -42,14 +42,12 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*; * Cipher implementation class. This class currently supports * DES, DESede, AES, ARCFOUR, and Blowfish. * - * This class is designed to support ECB and CBC with NoPadding and - * PKCS5Padding for both. It will use its own padding impl if the - * native mechanism does not support padding. + * This class is designed to support ECB, CBC, CTR with NoPadding + * and ECB, CBC with PKCS5Padding. It will use its own padding impl + * if the native mechanism does not support padding. * - * Note that PKCS#11 current only supports ECB and CBC. There are no - * provisions for other modes such as CFB, OFB, PCBC, or CTR mode. - * However, CTR could be implemented relatively easily (and efficiently) - * on top of ECB mode in this class, if need be. + * Note that PKCS#11 currently only supports ECB, CBC, and CTR. + * There are no provisions for other modes such as CFB, OFB, and PCBC. * * @author Andreas Sterbenz * @since 1.5 @@ -60,6 +58,8 @@ final class P11Cipher extends CipherSpi { private final static int MODE_ECB = 3; // mode constant for CBC mode private final static int MODE_CBC = 4; + // mode constant for CTR mode + private final static int MODE_CTR = 5; // padding constant for NoPadding private final static int PAD_NONE = 5; @@ -157,7 +157,7 @@ final class P11Cipher extends CipherSpi { private byte[] padBuffer; private int padBufferLen; - // original IV, if in MODE_CBC + // original IV, if in MODE_CBC or MODE_CTR private byte[] iv; // number of bytes buffered internally by the native mechanism and padBuffer @@ -213,6 +213,8 @@ final class P11Cipher extends CipherSpi { ("CBC mode not supported with stream ciphers"); } result = MODE_CBC; + } else if (mode.equals("CTR")) { + result = MODE_CTR; } else { throw new NoSuchAlgorithmException("Unsupported mode " + mode); } @@ -228,6 +230,10 @@ final class P11Cipher extends CipherSpi { if (padding.equals("NOPADDING")) { paddingType = PAD_NONE; } else if (padding.equals("PKCS5PADDING")) { + if (this.blockMode == MODE_CTR) { + throw new NoSuchPaddingException + ("PKCS#5 padding not supported with CTR mode"); + } paddingType = PAD_PKCS5; if (mechanism != CKM_DES_CBC_PAD && mechanism != CKM_DES3_CBC_PAD && mechanism != CKM_AES_CBC_PAD) { @@ -348,11 +354,14 @@ final class P11Cipher extends CipherSpi { ("IV not used in ECB mode"); } } - } else { // MODE_CBC + } else { // MODE_CBC or MODE_CTR if (iv == null) { if (encrypt == false) { - throw new InvalidAlgorithmParameterException - ("IV must be specified for decryption in CBC mode"); + String exMsg = + (blockMode == MODE_CBC ? + "IV must be specified for decryption in CBC mode" : + "IV must be specified for decryption in CTR mode"); + throw new InvalidAlgorithmParameterException(exMsg); } // generate random IV if (random == null) { @@ -410,13 +419,15 @@ final class P11Cipher extends CipherSpi { if (session == null) { session = token.getOpSession(); } + CK_MECHANISM mechParams = (blockMode == MODE_CTR? + new CK_MECHANISM(mechanism, new CK_AES_CTR_PARAMS(iv)) : + new CK_MECHANISM(mechanism, iv)); + try { if (encrypt) { - token.p11.C_EncryptInit(session.id(), - new CK_MECHANISM(mechanism, iv), p11Key.keyID); + token.p11.C_EncryptInit(session.id(), mechParams, p11Key.keyID); } else { - token.p11.C_DecryptInit(session.id(), - new CK_MECHANISM(mechanism, iv), p11Key.keyID); + token.p11.C_DecryptInit(session.id(), mechParams, p11Key.keyID); } } catch (PKCS11Exception ex) { // release session when initialization failed diff --git a/src/share/classes/sun/security/pkcs11/P11RSACipher.java b/src/share/classes/sun/security/pkcs11/P11RSACipher.java index 18f3ab450efd0d70e0c7748bc0975e4158147d24..d9dc4e77ef7d76ee70fb22328269a8b70c113634 100644 --- a/src/share/classes/sun/security/pkcs11/P11RSACipher.java +++ b/src/share/classes/sun/security/pkcs11/P11RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -62,6 +62,11 @@ final class P11RSACipher extends CipherSpi { // mode constant for public key decryption (verifying) private final static int MODE_VERIFY = 4; + // padding type constant for NoPadding + private final static int PAD_NONE = 1; + // padding type constant for PKCS1Padding + private final static int PAD_PKCS1 = 2; + // token instance private final Token token; @@ -77,6 +82,9 @@ final class P11RSACipher extends CipherSpi { // mode, one of MODE_* above private int mode; + // padding, one of PAD_* above + private int padType; + private byte[] buffer; private int bufOfs; @@ -113,8 +121,10 @@ final class P11RSACipher extends CipherSpi { protected void engineSetPadding(String padding) throws NoSuchPaddingException { String lowerPadding = padding.toLowerCase(Locale.ENGLISH); - if (lowerPadding.equals("pkcs1Padding")) { - // empty + if (lowerPadding.equals("pkcs1padding")) { + padType = PAD_PKCS1; + } else if (lowerPadding.equals("nopadding")) { + padType = PAD_NONE; } else { throw new NoSuchPaddingException("Unsupported padding " + padding); } @@ -209,7 +219,8 @@ final class P11RSACipher extends CipherSpi { int n = (p11Key.keyLength() + 7) >> 3; outputSize = n; buffer = new byte[n]; - maxInputSize = encrypt ? (n - PKCS1_MIN_PADDING_LENGTH) : n; + maxInputSize = ((padType == PAD_PKCS1 && encrypt) ? + (n - PKCS1_MIN_PADDING_LENGTH) : n); try { initialize(); } catch (PKCS11Exception e) { diff --git a/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/src/share/classes/sun/security/pkcs11/SunPKCS11.java index 55843b95c583b319cebf8c3fafe4a00dcf451a3d..d54c5617309506b62d65de5a38889fe5785a66e8 100644 --- a/src/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/src/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -621,12 +621,16 @@ public final class SunPKCS11 extends AuthProvider { m(CKM_AES_CBC_PAD, CKM_AES_CBC)); d(CIP, "AES/ECB", P11Cipher, s("AES"), m(CKM_AES_ECB)); + d(CIP, "AES/CTR/NoPadding", P11Cipher, + m(CKM_AES_CTR)); d(CIP, "Blowfish/CBC", P11Cipher, m(CKM_BLOWFISH_CBC)); // XXX RSA_X_509, RSA_OAEP not yet supported - d(CIP, "RSA/ECB/PKCS1Padding", P11RSACipher, + d(CIP, "RSA/ECB/PKCS1Padding", P11RSACipher, s("RSA"), m(CKM_RSA_PKCS)); + d(CIP, "RSA/ECB/NoPadding", P11RSACipher, + m(CKM_RSA_X_509)); d(SIG, "RawDSA", P11Signature, s("NONEwithDSA"), m(CKM_DSA)); diff --git a/src/share/classes/sun/misc/JavaSecurityCodeSignerAccess.java b/src/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java similarity index 51% rename from src/share/classes/sun/misc/JavaSecurityCodeSignerAccess.java rename to src/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java index 67305d3baaf8112e5b0759678b02a5a6cf8c8745..7208f481c2a460ff0d49683e05f4d15e1d0ca0bf 100644 --- a/src/share/classes/sun/misc/JavaSecurityCodeSignerAccess.java +++ b/src/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -22,12 +22,45 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package sun.misc; -import java.security.CodeSigner; -import java.security.cert.CRL; +package sun.security.pkcs11.wrapper; -public interface JavaSecurityCodeSignerAccess { - void setCRLs(CodeSigner signer, CRL[] crls); - CRL[] getCRLs(CodeSigner signer); +/** + * This class represents the necessary parameters required by + * the CKM_AES_CTR mechanism as defined in CK_AES_CTR_PARAMS structure.

    + * PKCS#11 structure: + *

    + * typedef struct CK_AES_CTR_PARAMS {
    + *   CK_ULONG ulCounterBits;
    + *   CK_BYTE cb[16];
    + * } CK_AES_CTR_PARAMS;
    + * 
    + * + * @author Yu-Ching Valerie Peng + * @since 1.7 + */ +public class CK_AES_CTR_PARAMS { + + private final long ulCounterBits; + private final byte cb[]; + + public CK_AES_CTR_PARAMS(byte[] cb) { + ulCounterBits = 128; + this.cb = cb.clone(); + } + + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append(Constants.INDENT); + buffer.append("ulCounterBits: "); + buffer.append(ulCounterBits); + buffer.append(Constants.NEWLINE); + + buffer.append(Constants.INDENT); + buffer.append("cb: "); + buffer.append(Functions.toHexString(cb)); + + return buffer.toString(); + } } diff --git a/src/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java b/src/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java index b84c5e99c159e0a803aebd9e5e81f0f21544d615..3322d19b00cb8f9634076c43d086543bd6f88c91 100644 --- a/src/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java +++ b/src/share/classes/sun/security/pkcs11/wrapper/CK_MECHANISM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -48,6 +48,7 @@ package sun.security.pkcs11.wrapper; import java.math.BigInteger; +import static sun.security.pkcs11.wrapper.PKCS11Constants.*; /** * class CK_MECHANISM specifies a particular mechanism and any parameters it @@ -127,6 +128,10 @@ public class CK_MECHANISM { init(mechanism, params); } + public CK_MECHANISM(long mechanism, CK_AES_CTR_PARAMS params) { + init(mechanism, params); + } + private void init(long mechanism, Object pParameter) { this.mechanism = mechanism; this.pParameter = pParameter; diff --git a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java index f5bf7f1034d9cb71498dc765d2ac264ec74e299a..98e9fe0651b278835d82276b80da5133bea2e384 100644 --- a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java +++ b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -47,8 +47,6 @@ package sun.security.pkcs11.wrapper; - - /** * This interface holds constants of the PKCS#11 v2.11 standard. * This is mainly the content of the 'pkcs11t.h' header file. @@ -306,6 +304,10 @@ public interface PKCS11Constants { public static final long CKK_VENDOR_DEFINED = 0x80000000L; + // new for v2.20 amendment 3 + //public static final long CKK_CAMELLIA = 0x00000025L; + //public static final long CKK_ARIA = 0x00000026L; + // pseudo key type ANY (for template manager) public static final long PCKK_ANY = 0x7FFFFF22L; @@ -690,6 +692,34 @@ public interface PKCS11Constants { public static final long CKM_VENDOR_DEFINED = 0x80000000L; + // new for v2.20 amendment 3 + public static final long CKM_SHA224 = 0x00000255L; + public static final long CKM_SHA224_HMAC = 0x00000256L; + public static final long CKM_SHA224_HMAC_GENERAL = 0x00000257L; + public static final long CKM_SHA224_KEY_DERIVATION = 0x00000396L; + public static final long CKM_SHA224_RSA_PKCS = 0x00000046L; + public static final long CKM_SHA224_RSA_PKCS_PSS = 0x00000047L; + public static final long CKM_AES_CTR = 0x00001086L; + /* + public static final long CKM_CAMELLIA_KEY_GEN = 0x00000550L; + public static final long CKM_CAMELLIA_ECB = 0x00000551L; + public static final long CKM_CAMELLIA_CBC = 0x00000552L; + public static final long CKM_CAMELLIA_MAC = 0x00000553L; + public static final long CKM_CAMELLIA_MAC_GENERAL = 0x00000554L; + public static final long CKM_CAMELLIA_CBC_PAD = 0x00000555L; + public static final long CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556L; + public static final long CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557L; + public static final long CKM_CAMELLIA_CTR = 0x00000558L; + public static final long CKM_ARIA_KEY_GEN = 0x00000560L; + public static final long CKM_ARIA_ECB = 0x00000561L; + public static final long CKM_ARIA_CBC = 0x00000562L; + public static final long CKM_ARIA_MAC = 0x00000563L; + public static final long CKM_ARIA_MAC_GENERAL = 0x00000564L; + public static final long CKM_ARIA_CBC_PAD = 0x00000565L; + public static final long CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566L; + public static final long CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567L; + */ + // NSS private public static final long CKM_NSS_TLS_PRF_GENERAL = 0x80000373L; @@ -881,7 +911,8 @@ public interface PKCS11Constants { /* The following MGFs are defined */ public static final long CKG_MGF1_SHA1 = 0x00000001L; - + // new for v2.20 amendment 3 + public static final long CKG_MGF1_SHA224 = 0x00000005L; /* The following encoding parameter sources are defined */ public static final long CKZ_DATA_SPECIFIED = 0x00000001L; diff --git a/src/share/classes/sun/security/tools/JarSigner.java b/src/share/classes/sun/security/tools/JarSigner.java index 42d3bf57fd8d04b63e19affa053fcb4b2f527d81..4d0e032819e8b59c107c64bab7dccb2a600bb0bb 100644 --- a/src/share/classes/sun/security/tools/JarSigner.java +++ b/src/share/classes/sun/security/tools/JarSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -26,7 +26,6 @@ package sun.security.tools; import java.io.*; -import java.security.cert.X509CRL; import java.util.*; import java.util.zip.*; import java.util.jar.*; @@ -36,7 +35,6 @@ import java.net.URISyntaxException; import java.text.Collator; import java.text.MessageFormat; import java.security.cert.Certificate; -import java.security.cert.CRL; import java.security.cert.X509Certificate; import java.security.cert.CertificateException; import java.security.*; @@ -58,7 +56,6 @@ import java.util.Map.Entry; import sun.security.x509.*; import sun.security.util.*; import sun.misc.BASE64Encoder; -import sun.misc.SharedSecrets; /** @@ -117,13 +114,11 @@ public class JarSigner { static final int SIGNED_BY_ALIAS = 0x08; // signer is in alias list X509Certificate[] certChain; // signer's cert chain (when composing) - Set crls; // signer provided CRLs PrivateKey privateKey; // private key KeyStore store; // the keystore specified by -keystore // or the default keystore, never null String keystore; // key store file - List crlfiles = new ArrayList<>(); // CRL files to add boolean nullStream = false; // null keystore input stream (NONE) boolean token = false; // token-based keystore String jarfile; // jar files to sign or verify @@ -151,7 +146,6 @@ public class JarSigner { boolean signManifest = true; // "sign" the whole manifest boolean externalSF = true; // leave the .SF out of the PKCS7 block boolean strict = false; // treat warnings as error - boolean autoCRL = false; // Automatcially add CRL defined in cert // read zip entry raw bytes private ByteArrayOutputStream baos = new ByteArrayOutputStream(2048); @@ -232,29 +226,6 @@ public class JarSigner { } else { loadKeyStore(keystore, true); getAliasInfo(alias); - crls = new HashSet(); - if (crlfiles.size() > 0 || autoCRL) { - CertificateFactory fac = - CertificateFactory.getInstance("X509"); - List list = new ArrayList<>(); - for (String file: crlfiles) { - Collection tmp = KeyTool.loadCRLs(file); - for (CRL crl: tmp) { - if (crl instanceof X509CRL) { - crls.add((X509CRL)crl); - } - } - } - if (autoCRL) { - List crlsFromCert = - KeyTool.readCRLsFromCert(certChain[0]); - for (CRL crl: crlsFromCert) { - if (crl instanceof X509CRL) { - crls.add((X509CRL)crl); - } - } - } - } // load the alternative signing mechanism if (altSignerClass != null) { @@ -396,13 +367,6 @@ public class JarSigner { } else if (collator.compare(flags, "-digestalg") ==0) { if (++n == args.length) usageNoArg(); digestalg = args[n]; - } else if (collator.compare(flags, "-crl") ==0) { - if ("auto".equals(modifier)) { - autoCRL = true; - } else { - if (++n == args.length) usageNoArg(); - crlfiles.add(args[n]); - } } else if (collator.compare(flags, "-certs") ==0) { showcerts = true; } else if (collator.compare(flags, "-strict") ==0) { @@ -548,9 +512,6 @@ public class JarSigner { System.out.println(rb.getString (".sigalg.algorithm.name.of.signature.algorithm")); System.out.println(); - System.out.println(rb.getString - (".crl.auto.file.include.CRL.in.signed.jar")); - System.out.println(); System.out.println(rb.getString (".verify.verify.a.signed.JAR.file")); System.out.println(); @@ -691,20 +652,6 @@ public class JarSigner { if (showcerts) { sb.append(si); sb.append('\n'); - CRL[] crls = SharedSecrets - .getJavaSecurityCodeSignerAccess() - .getCRLs(signer); - if (crls != null) { - for (CRL crl: crls) { - if (crl instanceof X509CRLImpl) { - sb.append(tab).append("["); - sb.append(String.format( - rb.getString("with.a.CRL.including.d.entries"), - ((X509CRLImpl)crl).getRevokedCertificates().size())) - .append("]\n"); - } - } - } } } } else if (showcerts && !verbose.equals("all")) { @@ -1284,7 +1231,7 @@ public class JarSigner { try { block = - sf.generateBlock(privateKey, sigalg, certChain, crls, + sf.generateBlock(privateKey, sigalg, certChain, externalSF, tsaUrl, tsaCert, signingMechanism, args, zipFile); } catch (SocketTimeoutException e) { @@ -2249,7 +2196,6 @@ class SignatureFile { public Block generateBlock(PrivateKey privateKey, String sigalg, X509Certificate[] certChain, - Set crls, boolean externalSF, String tsaUrl, X509Certificate tsaCert, ContentSigner signingMechanism, @@ -2257,7 +2203,7 @@ class SignatureFile { throws NoSuchAlgorithmException, InvalidKeyException, IOException, SignatureException, CertificateException { - return new Block(this, privateKey, sigalg, certChain, crls, externalSF, + return new Block(this, privateKey, sigalg, certChain, externalSF, tsaUrl, tsaCert, signingMechanism, args, zipFile); } @@ -2271,8 +2217,7 @@ class SignatureFile { * Construct a new signature block. */ Block(SignatureFile sfg, PrivateKey privateKey, String sigalg, - X509Certificate[] certChain, Set crls, - boolean externalSF, String tsaUrl, + X509Certificate[] certChain, boolean externalSF, String tsaUrl, X509Certificate tsaCert, ContentSigner signingMechanism, String[] args, ZipFile zipFile) throws NoSuchAlgorithmException, InvalidKeyException, IOException, @@ -2359,7 +2304,7 @@ class SignatureFile { // Assemble parameters for the signing mechanism ContentSignerParameters params = new JarSignerParameters(args, tsaUri, tsaCert, signature, - signatureAlgorithm, certChain, crls, content, zipFile); + signatureAlgorithm, certChain, content, zipFile); // Generate the signature block block = signingMechanism.generateSignedData( @@ -2400,7 +2345,6 @@ class JarSignerParameters implements ContentSignerParameters { private byte[] signature; private String signatureAlgorithm; private X509Certificate[] signerCertificateChain; - private Set crls; private byte[] content; private ZipFile source; @@ -2409,8 +2353,7 @@ class JarSignerParameters implements ContentSignerParameters { */ JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate, byte[] signature, String signatureAlgorithm, - X509Certificate[] signerCertificateChain, Set crls, - byte[] content, + X509Certificate[] signerCertificateChain, byte[] content, ZipFile source) { if (signature == null || signatureAlgorithm == null || @@ -2423,7 +2366,6 @@ class JarSignerParameters implements ContentSignerParameters { this.signature = signature; this.signatureAlgorithm = signatureAlgorithm; this.signerCertificateChain = signerCertificateChain; - this.crls = crls; this.content = content; this.source = source; } @@ -2499,13 +2441,4 @@ class JarSignerParameters implements ContentSignerParameters { public ZipFile getSource() { return source; } - - @Override - public Set getCRLs() { - if (crls == null) { - return Collections.emptySet(); - } else { - return Collections.unmodifiableSet(crls); - } - } } diff --git a/src/share/classes/sun/security/tools/JarSignerResources.java b/src/share/classes/sun/security/tools/JarSignerResources.java index 9eb14cce3c6c8cbc92a9180b341a43724b39a6be..c3d8a6e38ec0ad0e99c0936edde23864fb0d2b45 100644 --- a/src/share/classes/sun/security/tools/JarSignerResources.java +++ b/src/share/classes/sun/security/tools/JarSignerResources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -74,8 +74,6 @@ public class JarSignerResources extends java.util.ListResourceBundle { "[-digestalg ] name of digest algorithm"}, {".sigalg.algorithm.name.of.signature.algorithm", "[-sigalg ] name of signature algorithm"}, - {".crl.auto.file.include.CRL.in.signed.jar", - "[-crl[:auto| ] include CRL in signed jar"}, {".verify.verify.a.signed.JAR.file", "[-verify] verify a signed JAR file"}, {".verbose.suboptions.verbose.output.when.signing.verifying.", @@ -193,7 +191,6 @@ public class JarSignerResources extends java.util.ListResourceBundle { {"using.an.alternative.signing.mechanism", "using an alternative signing mechanism"}, {"entry.was.signed.on", "entry was signed on {0}"}, - {"with.a.CRL.including.d.entries", "with a CRL including %d entries"}, {"Warning.", "Warning: "}, {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.", "This jar contains unsigned entries which have not been integrity-checked. "}, diff --git a/src/share/classes/sun/security/tools/KeyTool.java b/src/share/classes/sun/security/tools/KeyTool.java index 897d407a1c2039bc26e4540282cb864839aa74e5..50349173a4166e08e3c4f2de2652ceb1534aaeab 100644 --- a/src/share/classes/sun/security/tools/KeyTool.java +++ b/src/share/classes/sun/security/tools/KeyTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -25,7 +25,6 @@ package sun.security.tools; -import sun.misc.SharedSecrets; import java.io.*; import java.security.CodeSigner; import java.security.KeyStore; @@ -2311,16 +2310,6 @@ public final class KeyTool { out.println(); } } - CRL[] crls = SharedSecrets - .getJavaSecurityCodeSignerAccess() - .getCRLs(signer); - if (crls != null) { - out.println(rb.getString("CRLs.")); - out.println(); - for (CRL crl: crls) { - printCRL(crl, out); - } - } } } } diff --git a/src/share/classes/sun/security/tools/TimestampedSigner.java b/src/share/classes/sun/security/tools/TimestampedSigner.java index f0a75836972c74122cec8ca6c8a19f6efed198a8..6d5eb63b7fddec4d94c832042723967ec45f3e59 100644 --- a/src/share/classes/sun/security/tools/TimestampedSigner.java +++ b/src/share/classes/sun/security/tools/TimestampedSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -38,7 +38,6 @@ import java.security.cert.X509Certificate; import java.util.List; import com.sun.jarsigner.*; -import java.security.cert.X509CRL; import java.util.Arrays; import sun.security.pkcs.*; import sun.security.timestamp.*; @@ -238,9 +237,8 @@ public final class TimestampedSigner extends ContentSigner { AlgorithmId[] algorithms = {digestAlgorithmId}; // Create the PKCS #7 signed data message - PKCS7 p7 = - new PKCS7(algorithms, contentInfo, signerCertificateChain, - parameters.getCRLs().toArray(new X509CRL[parameters.getCRLs().size()]), signerInfos); + PKCS7 p7 = new PKCS7(algorithms, contentInfo, signerCertificateChain, + null, signerInfos); ByteArrayOutputStream p7out = new ByteArrayOutputStream(); p7.encodeSignedData(p7out); diff --git a/src/share/classes/sun/security/util/SignatureFileVerifier.java b/src/share/classes/sun/security/util/SignatureFileVerifier.java index f60fcb75f8b0e97374d163dc2e0770e54023ceaf..96f425a46b5d5f4c81be2999dda93c90c4bcbf83 100644 --- a/src/share/classes/sun/security/util/SignatureFileVerifier.java +++ b/src/share/classes/sun/security/util/SignatureFileVerifier.java @@ -37,7 +37,6 @@ import java.util.jar.*; import sun.security.pkcs.*; import sun.security.timestamp.TimestampToken; import sun.misc.BASE64Decoder; -import sun.misc.SharedSecrets; import sun.security.jca.Providers; @@ -486,12 +485,7 @@ public class SignatureFileVerifier { signers = new ArrayList(); } // Append the new code signer - CodeSigner signer = new CodeSigner(certChain, getTimestamp(info)); - if (block.getCRLs() != null) { - SharedSecrets.getJavaSecurityCodeSignerAccess().setCRLs( - signer, block.getCRLs()); - } - signers.add(signer); + signers.add(new CodeSigner(certChain, getTimestamp(info))); if (debug != null) { debug.println("Signature Block Certificate: " + diff --git a/src/share/classes/sun/tools/native2ascii/Main.java b/src/share/classes/sun/tools/native2ascii/Main.java index 2d127344b1a921fc7114e6c88263c028d599dbfd..d19d27a64069936bc9e40c2f0442a9eefc9efa82 100644 --- a/src/share/classes/sun/tools/native2ascii/Main.java +++ b/src/share/classes/sun/tools/native2ascii/Main.java @@ -94,7 +94,7 @@ public class Main { * Run the converter */ public synchronized boolean convert(String argv[]){ - Vector v = new Vector(2); + List v = new ArrayList<>(2); File outputFile = null; boolean createOutputFile = false; @@ -115,7 +115,7 @@ public class Main { usage(); return false; } - v.addElement(argv[i]); + v.add(argv[i]); } } if (encodingString == null) @@ -126,11 +126,11 @@ public class Main { initializeConverter(); if (v.size() == 1) - inputFileName = (String)v.elementAt(0); + inputFileName = v.get(0); if (v.size() == 2) { - inputFileName = (String)v.elementAt(0); - outputFileName = (String)v.elementAt(1); + inputFileName = v.get(0); + outputFileName = v.get(1); createOutputFile = true; } @@ -363,9 +363,7 @@ public class Main { private String formatMsg(String key, String arg) { String msg = getMsg(key); - String[] args = new String[1]; - args[0] = arg; - return MessageFormat.format(msg, (Object)args); + return MessageFormat.format(msg, arg); } diff --git a/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java b/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java index 6710dbae3bc8ef236027e734ba1f3b66178de880..de5f749608ccca42b39afbf37cc60bc82b6e3bd7 100644 --- a/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java +++ b/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java @@ -127,7 +127,9 @@ public class LocalGregorianCalendar extends BaseCalendar { calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { Properties props = new Properties(); - props.load(new FileInputStream(fname)); + try (FileInputStream fis = new FileInputStream(fname)) { + props.load(fis); + } return props; } }); diff --git a/src/share/classes/sun/util/calendar/ZoneInfo.java b/src/share/classes/sun/util/calendar/ZoneInfo.java index 8bcf82ce760fb5308391f96d859e2caf2a0ecc19..b79e7cc390121b7d43ac1d853e614fcbaa8fd14e 100644 --- a/src/share/classes/sun/util/calendar/ZoneInfo.java +++ b/src/share/classes/sun/util/calendar/ZoneInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -266,7 +266,7 @@ public class ZoneInfo extends TimeZone { int index = getTransitionIndex(date, type); // prior to the transition table, returns the raw offset. - // should support LMT. + // FIXME: should support LMT. if (index < 0) { int offset = getLastRawOffset(); if (offsets != null) { @@ -297,7 +297,13 @@ public class ZoneInfo extends TimeZone { if (type != UTC_TIME) { msec -= rawOffset; } - int dstoffset = tz.inDaylightTime(new Date(msec)) ? tz.getDSTSavings() : 0; + int dstoffset = tz.getOffset(msec) - rawOffset; + + // Check if it's in a standard-to-daylight transition. + if (dstoffset > 0 && tz.getOffset(msec - dstoffset) == rawoffset) { + dstoffset = 0; + } + if (offsets != null) { offsets[0] = rawoffset; offsets[1] = dstoffset; @@ -452,6 +458,36 @@ public class ZoneInfo extends TimeZone { return (simpleTimeZoneParams != null); } + @Override + public boolean observesDaylightTime() { + if (simpleTimeZoneParams != null) { + return true; + } + if (transitions == null) { + return false; + } + + // Look up the transition table to see if it's in DST right + // now or if there's any standard-to-daylight transition at + // any future. + long utc = System.currentTimeMillis() - rawOffsetDiff; + int index = getTransitionIndex(utc, UTC_TIME); + + // before transitions in the transition table + if (index < 0) { + return false; + } + + // the time is in the table range. + for (int i = index; i < transitions.length; i++) { + if ((transitions[i] & DST_MASK) != 0) { + return true; + } + } + // No further DST is observed. + return false; + } + /** * Queries if the specified date is in Daylight Saving Time. */ diff --git a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java index 10f6bd477a9d66c8aa38cc14dccbd7da25a20310..543220fc63ae51f27b17376c6ebfe1c1740b4b6c 100644 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -76,7 +76,7 @@ public class ZipDirectoryStream implements DirectoryStream { } catch (IOException e) { throw new IllegalStateException(e); } - return new Iterator<>() { + return new Iterator() { private Path next; @Override public boolean hasNext() { diff --git a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java index 40afd8afb843764a51d84f038457365f58d256fe..fc43fd87ccf8b030b64045d96e23418eedc0c10a 100644 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java @@ -112,11 +112,8 @@ public class ZipFileSystem extends FileSystem { } // sm and existence check zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.READ); - try { - zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.WRITE); - } catch (AccessDeniedException x) { + if (!Files.isWritable(zfpath)) this.readOnly = true; - } this.zc = ZipCoder.get(nameEncoding); this.defaultdir = new ZipPath(this, getBytes(defaultDir)); this.ch = Files.newByteChannel(zfpath, READ); diff --git a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java index b03ba2929eb65a81d7e2a3e2f4848ad06fa1da13..1232a27ff1f0b2c1f0d1cb9d6307854a5e22e630 100644 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -590,7 +590,7 @@ public class ZipPath implements Path { @Override public Iterator iterator() { - return new Iterator<>() { + return new Iterator() { private int i = 0; @Override diff --git a/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c b/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c index 4abc15073881c8f3ffc4feb5464b8a2ffb8d0659..c32a278b585af95335db28efe2ac94497b25f328 100644 --- a/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c +++ b/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -694,6 +694,46 @@ CK_SSL3_KEY_MAT_PARAMS jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject return ckParam ; } +/* + * converts the Java CK_AES_CTR_PARAMS object to a CK_AES_CTR_PARAMS structure + * + * @param env - used to call JNI funktions to get the Java classes and objects + * @param jParam - the Java CK_AES_CTR_PARAMS object to convert + * @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure + */ +void jAesCtrParamsToCKAesCtrParam(JNIEnv *env, jobject jParam, + CK_AES_CTR_PARAMS_PTR ckpParam) { + jclass jAesCtrParamsClass; + jfieldID fieldID; + jlong jCounterBits; + jobject jCb; + CK_BYTE_PTR ckBytes; + CK_ULONG ckTemp; + + /* get ulCounterBits */ + jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS); + if (jAesCtrParamsClass == NULL) { return; } + fieldID = (*env)->GetFieldID(env, jAesCtrParamsClass, "ulCounterBits", "J"); + if (fieldID == NULL) { return; } + jCounterBits = (*env)->GetLongField(env, jParam, fieldID); + + /* get cb */ + fieldID = (*env)->GetFieldID(env, jAesCtrParamsClass, "cb", "[B"); + if (fieldID == NULL) { return; } + jCb = (*env)->GetObjectField(env, jParam, fieldID); + + /* populate java values */ + ckpParam->ulCounterBits = jLongToCKULong(jCounterBits); + jByteArrayToCKByteArray(env, jCb, &ckBytes, &ckTemp); + if ((*env)->ExceptionCheck(env)) { return; } + if (ckTemp != 16) { + TRACE1("ERROR: WRONG CTR IV LENGTH %d", ckTemp); + } else { + memcpy(ckpParam->cb, ckBytes, ckTemp); + free(ckBytes); + } +} + /* * converts a Java CK_MECHANISM object into a CK_MECHANISM structure * @@ -937,12 +977,10 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, { /* get all Java mechanism parameter classes */ jclass jVersionClass, jSsl3MasterKeyDeriveParamsClass, jSsl3KeyMatParamsClass; - jclass jTlsPrfParamsClass, jRsaPkcsOaepParamsClass, jPbeParamsClass; - jclass jPkcs5Pbkd2ParamsClass, jRsaPkcsPssParamsClass; + jclass jTlsPrfParamsClass, jAesCtrParamsClass, jRsaPkcsOaepParamsClass; + jclass jPbeParamsClass, jPkcs5Pbkd2ParamsClass, jRsaPkcsPssParamsClass; jclass jEcdh1DeriveParamsClass, jEcdh2DeriveParamsClass; jclass jX942Dh1DeriveParamsClass, jX942Dh2DeriveParamsClass; - - /* get all Java mechanism parameter classes */ TRACE0("\nDEBUG: jMechanismParameterToCKMechanismParameter"); /* most common cases, i.e. NULL/byte[]/long, are already handled by @@ -1046,6 +1084,33 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, return; } + jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS); + if (jAesCtrParamsClass == NULL) { return; } + if ((*env)->IsInstanceOf(env, jParam, jAesCtrParamsClass)) { + /* + * CK_AES_CTR_PARAMS + */ + CK_AES_CTR_PARAMS_PTR ckpParam; + + ckpParam = (CK_AES_CTR_PARAMS_PTR) malloc(sizeof(CK_AES_CTR_PARAMS)); + if (ckpParam == NULL) { + JNU_ThrowOutOfMemoryError(env, 0); + return; + } + + /* convert jParameter to CKParameter */ + jAesCtrParamsToCKAesCtrParam(env, jParam, ckpParam); + if ((*env)->ExceptionCheck(env)) { + free(ckpParam); + return; + } + + /* get length and pointer of parameter */ + *ckpLength = sizeof(CK_AES_CTR_PARAMS); + *ckpParamPtr = ckpParam; + return; + } + jRsaPkcsOaepParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_OAEP_PARAMS); if (jRsaPkcsOaepParamsClass == NULL) { return; } if ((*env)->IsInstanceOf(env, jParam, jRsaPkcsOaepParamsClass)) { diff --git a/src/share/native/sun/security/pkcs11/wrapper/pkcs-11v2-20a3.h b/src/share/native/sun/security/pkcs11/wrapper/pkcs-11v2-20a3.h new file mode 100644 index 0000000000000000000000000000000000000000..0486fdf6a63d47dfe0299f10701baafbb94b79a4 --- /dev/null +++ b/src/share/native/sun/security/pkcs11/wrapper/pkcs-11v2-20a3.h @@ -0,0 +1,124 @@ +/* pkcs-11v2-20a3.h include file for the PKCS #11 Version 2.20 Amendment 3 + document. */ + +/* $Revision: 1.4 $ */ + +/* License to copy and use this software is granted provided that it is + * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface + * (Cryptoki) Version 2.20 Amendment 3" in all material mentioning or + * referencing this software. + + * RSA Security Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + */ + +/* This file is preferably included after inclusion of pkcs11.h */ + +#ifndef _PKCS_11V2_20A3_H_ +#define _PKCS_11V2_20A3_H_ 1 + +/* Are the definitions of this file already included in pkcs11t.h ? */ +#ifndef CKK_CAMELLIA + +#ifdef __cplusplus +extern "C" { +#endif + +/* Key types */ + +/* Camellia is new for PKCS #11 v2.20 amendment 3 */ +#define CKK_CAMELLIA 0x00000025 +/* ARIA is new for PKCS #11 v2.20 amendment 3 */ +#define CKK_ARIA 0x00000026 + + +/* Mask-generating functions */ + +/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */ +#define CKG_MGF1_SHA224 0x00000005 + + +/* Mechanism Identifiers */ + +/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */ +#define CKM_SHA224 0x00000255 +#define CKM_SHA224_HMAC 0x00000256 +#define CKM_SHA224_HMAC_GENERAL 0x00000257 + +/* SHA-224 key derivation is new for PKCS #11 v2.20 amendment 3 */ +#define CKM_SHA224_KEY_DERIVATION 0x00000396 + +/* SHA-224 RSA mechanisms are new for PKCS #11 v2.20 amendment 3 */ +#define CKM_SHA224_RSA_PKCS 0x00000046 +#define CKM_SHA224_RSA_PKCS_PSS 0x00000047 + +/* AES counter mode is new for PKCS #11 v2.20 amendment 3 */ +#define CKM_AES_CTR 0x00001086 + +/* Camellia is new for PKCS #11 v2.20 amendment 3 */ +#define CKM_CAMELLIA_KEY_GEN 0x00000550 +#define CKM_CAMELLIA_ECB 0x00000551 +#define CKM_CAMELLIA_CBC 0x00000552 +#define CKM_CAMELLIA_MAC 0x00000553 +#define CKM_CAMELLIA_MAC_GENERAL 0x00000554 +#define CKM_CAMELLIA_CBC_PAD 0x00000555 +#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556 +#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557 +#define CKM_CAMELLIA_CTR 0x00000558 + +/* ARIA is new for PKCS #11 v2.20 amendment 3 */ +#define CKM_ARIA_KEY_GEN 0x00000560 +#define CKM_ARIA_ECB 0x00000561 +#define CKM_ARIA_CBC 0x00000562 +#define CKM_ARIA_MAC 0x00000563 +#define CKM_ARIA_MAC_GENERAL 0x00000564 +#define CKM_ARIA_CBC_PAD 0x00000565 +#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566 +#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567 + + +/* Mechanism parameters */ + +/* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */ +typedef struct CK_AES_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_AES_CTR_PARAMS; + +typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR; + +/* CK_CAMELLIA_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */ +typedef struct CK_CAMELLIA_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_CAMELLIA_CTR_PARAMS; + +typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR; + +/* CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */ +typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +/* CK_ARIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */ +typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +#ifdef __cplusplus +} +#endif + +#endif + +#endif diff --git a/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h b/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h index 98598d807f5f605d46ff92cf615a43f10956383f..ff6d550d5236241496326ec68a0781a7f7ecb22c 100644 --- a/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h +++ b/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -153,6 +153,7 @@ #include "p11_md.h" #include "pkcs11.h" +#include "pkcs-11v2-20a3.h" #include #include @@ -272,6 +273,7 @@ #define CLASS_SSL3_MASTER_KEY_DERIVE_PARAMS "sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS" #define CLASS_SSL3_KEY_MAT_PARAMS "sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS" #define CLASS_TLS_PRF_PARAMS "sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS" +#define CLASS_AES_CTR_PARAMS "sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS" /* function to convert a PKCS#11 return value other than CK_OK into a Java Exception * or to throw a PKCS11RuntimeException diff --git a/src/solaris/classes/java/util/prefs/FileSystemPreferences.java b/src/solaris/classes/java/util/prefs/FileSystemPreferences.java index 32e4b032929912f80668f4523ce1afebf51980ed..53a19b5f5bd28bd681f16d78b61753f0bbb5cbd6 100644 --- a/src/solaris/classes/java/util/prefs/FileSystemPreferences.java +++ b/src/solaris/classes/java/util/prefs/FileSystemPreferences.java @@ -571,9 +571,9 @@ class FileSystemPreferences extends AbstractPreferences { long newLastSyncTime = 0; try { newLastSyncTime = prefsFile.lastModified(); - FileInputStream fis = new FileInputStream(prefsFile); - XmlSupport.importMap(fis, m); - fis.close(); + try (FileInputStream fis = new FileInputStream(prefsFile)) { + XmlSupport.importMap(fis, m); + } } catch(Exception e) { if (e instanceof InvalidPreferencesFormatException) { getLogger().warning("Invalid preferences format in " @@ -618,9 +618,9 @@ class FileSystemPreferences extends AbstractPreferences { if (!dir.exists() && !dir.mkdirs()) throw new BackingStoreException(dir + " create failed."); - FileOutputStream fos = new FileOutputStream(tmpFile); - XmlSupport.exportMap(fos, prefsCache); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(tmpFile)) { + XmlSupport.exportMap(fos, prefsCache); + } if (!tmpFile.renameTo(prefsFile)) throw new BackingStoreException("Can't rename " + tmpFile + " to " + prefsFile); diff --git a/src/solaris/classes/sun/font/XRGlyphCache.java b/src/solaris/classes/sun/font/XRGlyphCache.java index 9e767242b9fedc3cfae5fe4d81fb504abcea87d7..7dbb23a774f89add0b2c681e7251ad04efa7e6b0 100644 --- a/src/solaris/classes/sun/font/XRGlyphCache.java +++ b/src/solaris/classes/sun/font/XRGlyphCache.java @@ -70,9 +70,14 @@ public class XRGlyphCache implements GlyphDisposedListener { try { SunToolkit.awtLock(); - ArrayList glyphIDList = new ArrayList(glyphPtrList.size()); + GrowableIntArray glyphIDList = new GrowableIntArray(1, glyphPtrList.size()); for (long glyphPtr : glyphPtrList) { - glyphIDList.add(XRGlyphCacheEntry.getGlyphID(glyphPtr)); + int glyphID = XRGlyphCacheEntry.getGlyphID(glyphPtr); + + //Check if glyph hasn't been freed already + if (glyphID != 0) { + glyphIDList.addInt(glyphID); + } } freeGlyphs(glyphIDList); } finally { @@ -83,7 +88,6 @@ public class XRGlyphCache implements GlyphDisposedListener { protected int getFreeGlyphID() { if (freeGlyphIDs.size() > 0) { int newID = freeGlyphIDs.remove(freeGlyphIDs.size() - 1); - ; return newID; } return nextID++; @@ -246,7 +250,7 @@ public class XRGlyphCache implements GlyphDisposedListener { glyph.setPinned(); } - ArrayList deleteGlyphList = new ArrayList(); + GrowableIntArray deleteGlyphList = new GrowableIntArray(1, 10); int pixelsToRelease = cachedPixels - MAX_CACHED_PIXELS; for (int i = cacheList.size() - 1; i >= 0 && pixelsToRelease > 0; i--) { @@ -254,7 +258,7 @@ public class XRGlyphCache implements GlyphDisposedListener { if (!entry.isPinned()) { pixelsToRelease -= entry.getPixelCnt(); - deleteGlyphList.add(new Integer(entry.getGlyphID())); + deleteGlyphList.addInt(entry.getGlyphID()); } } @@ -265,26 +269,23 @@ public class XRGlyphCache implements GlyphDisposedListener { freeGlyphs(deleteGlyphList); } - private void freeGlyphs(List glyphIdList) { + private void freeGlyphs(GrowableIntArray glyphIdList) { + GrowableIntArray removedLCDGlyphs = new GrowableIntArray(1, 10); + GrowableIntArray removedGrayscaleGlyphs = new GrowableIntArray(1, 10); - freeGlyphIDs.addAll(glyphIdList); + for (int i=0; i < glyphIdList.getSize(); i++) { + int glyphId = glyphIdList.getInt(i); + freeGlyphIDs.add(glyphId); - GrowableIntArray removedLCDGlyphs = new GrowableIntArray(1, 1); - GrowableIntArray removedGrayscaleGlyphs = new GrowableIntArray(1, 1); - - for (Integer glyphId : glyphIdList) { - tmp.setValue(glyphId.intValue()); + tmp.setValue(glyphId); XRGlyphCacheEntry entry = cacheMap.get(tmp); cachedPixels -= entry.getPixelCnt(); - - int removedGlyphID = entry.getGlyphID(); - tmp.setValue(removedGlyphID); cacheMap.remove(tmp); if (entry.getGlyphSet() == grayGlyphSet) { - removedGrayscaleGlyphs.addInt(removedGlyphID); + removedGrayscaleGlyphs.addInt(glyphId); } else { - removedLCDGlyphs.addInt(removedGlyphID); + removedLCDGlyphs.addInt(glyphId); } entry.setGlyphID(0); diff --git a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java index f09d0f3de4f8d213850e8f020866597e58cf2c1d..d8790b2cb5999e6aceda912a8b377e31f0926df1 100644 --- a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java +++ b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java @@ -55,6 +55,8 @@ public abstract class XRSurfaceData extends XSurfaceData { native void initXRPicture(long xsdo, int pictForm); + native void freeXSDOPicture(long xsdo); + public static final String DESC_BYTE_A8_X11 = "Byte A8 Pixmap"; public static final String DESC_INT_RGB_X11 = "Integer RGB Pixmap"; public static final String DESC_INT_ARGB_X11 = "Integer ARGB-Pre Pixmap"; @@ -531,6 +533,17 @@ public abstract class XRSurfaceData extends XSurfaceData { public Object getDestination() { return peer.getTarget(); } + + public void invalidate() { + try { + SunToolkit.awtLock(); + freeXSDOPicture(getNativeOps()); + }finally { + SunToolkit.awtUnlock(); + } + + super.invalidate(); + } } public static class XRInternalSurfaceData extends XRSurfaceData { diff --git a/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java b/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java index 119146b68f43ea23e91f22518acfee41a0e61bfd..ee3731a0c2e29a022b1ae108bea6d990915ff2ea 100644 --- a/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java +++ b/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java @@ -236,7 +236,9 @@ class UnixAsynchronousServerSocketChannelImpl } catch (SecurityException x) { try { ch.close(); - } catch (IOException ignore) { } + } catch (Throwable suppressed) { + x.addSuppressed(suppressed); + } throw x; } return ch; diff --git a/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java b/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java index 4d887890ccd9241813f426236a6ec15cc6f4fe30..37caeeb9bcebed4bc199e28d0350a5621a68befe 100644 --- a/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java +++ b/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java @@ -137,7 +137,7 @@ class UnixAsynchronousSocketChannelImpl return port; } - // register for events if there are outstanding I/O operations + // register events for outstanding I/O operations, caller already owns updateLock private void updateEvents() { assert Thread.holdsLock(updateLock); int events = 0; @@ -149,6 +149,13 @@ class UnixAsynchronousSocketChannelImpl port.startPoll(fdVal, events); } + // register events for outstanding I/O operations + private void lockAndUpdateEvents() { + synchronized (updateLock) { + updateEvents(); + } + } + // invoke to finish read and/or write operations private void finish(boolean mayInvokeDirect, boolean readable, @@ -255,10 +262,11 @@ class UnixAsynchronousSocketChannelImpl // close channel if connection cannot be established try { close(); - } catch (IOException ignore) { } + } catch (Throwable suppressed) { + e.addSuppressed(suppressed); + } } - // invoke handler and set result CompletionHandler handler = connectHandler; Object att = connectAttachment; @@ -345,7 +353,9 @@ class UnixAsynchronousSocketChannelImpl if (e != null) { try { close(); - } catch (IOException ignore) { } + } catch (Throwable suppressed) { + e.addSuppressed(suppressed); + } } if (handler == null) { return CompletedFuture.withResult(null, e); @@ -399,9 +409,8 @@ class UnixAsynchronousSocketChannelImpl exc = x; } finally { // restart poll in case of concurrent write - synchronized (updateLock) { - updateEvents(); - } + if (!(exc instanceof AsynchronousCloseException)) + lockAndUpdateEvents(); end(); } @@ -595,9 +604,8 @@ class UnixAsynchronousSocketChannelImpl exc = x; } finally { // restart poll in case of concurrent write - synchronized (updateLock) { - updateEvents(); - } + if (!(exc instanceof AsynchronousCloseException)) + lockAndUpdateEvents(); end(); } diff --git a/src/solaris/native/java/net/Inet4AddressImpl.c b/src/solaris/native/java/net/Inet4AddressImpl.c index 8514eef39ac9cd923708518dc0b167bdfd26aa03..e6eaa0aa2f57136fcee2a2604400bbdcb6acaa72 100644 --- a/src/solaris/native/java/net/Inet4AddressImpl.c +++ b/src/solaris/native/java/net/Inet4AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -77,22 +77,24 @@ Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) { */ #endif /* __linux__ */ struct hostent res, res2, *hp; - char buf[HENT_BUF_SIZE]; - char buf2[HENT_BUF_SIZE]; + // these buffers must be pointer-aligned so they are declared + // with pointer type + char *buf[HENT_BUF_SIZE/(sizeof (char *))]; + char *buf2[HENT_BUF_SIZE/(sizeof (char *))]; int h_error=0; #ifdef __GLIBC__ - gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error); + gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp, &h_error); #else - hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error); + hp = gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &h_error); #endif if (hp) { #ifdef __GLIBC__ gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET, - &res2, buf2, sizeof(buf2), &hp, &h_error); + &res2, (char*)buf2, sizeof(buf2), &hp, &h_error); #else hp = gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET, - &res2, buf2, sizeof(buf2), &h_error); + &res2, (char*)buf2, sizeof(buf2), &h_error); #endif if (hp) { /* @@ -136,7 +138,9 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, const char *hostname; jobjectArray ret = 0; struct hostent res, *hp = 0; - char buf[HENT_BUF_SIZE]; + // this buffer must be pointer-aligned so is declared + // with pointer type + char *buf[HENT_BUF_SIZE/(sizeof (char *))]; /* temporary buffer, on the off chance we need to expand */ char *tmp = NULL; @@ -176,9 +180,9 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, /* Try once, with our static buffer. */ #ifdef __GLIBC__ - gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error); + gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp, &h_error); #else - hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error); + hp = gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &h_error); #endif /* With the re-entrant system calls, it's possible that the buffer @@ -251,7 +255,9 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, jstring ret = NULL; jint addr; struct hostent hent, *hp = 0; - char buf[HENT_BUF_SIZE]; + // this buffer must be pointer-aligned so is declared + // with pointer type + char *buf[HENT_BUF_SIZE/(sizeof (char *))]; int h_error = 0; char *tmp = NULL; @@ -273,10 +279,10 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, addr = htonl(addr); #ifdef __GLIBC__ gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent, - buf, sizeof(buf), &hp, &h_error); + (char*)buf, sizeof(buf), &hp, &h_error); #else hp = gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent, - buf, sizeof(buf), &h_error); + (char*)buf, sizeof(buf), &h_error); #endif /* With the re-entrant system calls, it's possible that the buffer * we pass to it is not large enough to hold an exceptionally diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c index d85ca799d4ebeec3cff9d70d89b02a83313c145d..ba1c3c7aa8e81ec4a93d887c4312d486df693175 100644 --- a/src/solaris/native/java/net/NetworkInterface.c +++ b/src/solaris/native/java/net/NetworkInterface.c @@ -45,7 +45,6 @@ #ifdef __linux__ #include #include -#include #include #include #endif @@ -1100,7 +1099,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { #ifdef AF_INET6 static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { FILE *f; - char addr6[40], devname[20]; + char addr6[40], devname[21]; char addr6p[8][5]; int plen, scope, dad_status, if_idx; uint8_t ipv6addr[16]; diff --git a/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/src/solaris/native/java/net/PlainDatagramSocketImpl.c index 03e3a64c0c8fb67ee1535281267faf16c210d87c..0eb2a9be890f44c4a0d0702e78db94602394100e 100644 --- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c +++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c @@ -34,8 +34,8 @@ #include #endif #ifdef __linux__ -#include -#include +#include +#include #include #include diff --git a/src/solaris/native/java/net/PlainSocketImpl.c b/src/solaris/native/java/net/PlainSocketImpl.c index 018e264ef7e070579e1f5156d565eb9541463ace..9aca806096228c368e20077bf4e5201b59cb5051 100644 --- a/src/solaris/native/java/net/PlainSocketImpl.c +++ b/src/solaris/native/java/net/PlainSocketImpl.c @@ -42,8 +42,8 @@ #include #endif #ifdef __linux__ -#include -#include +#include +#include #endif #include "jvm.h" diff --git a/src/solaris/native/java/net/linux_close.c b/src/solaris/native/java/net/linux_close.c index 02d4fe5883d3a4ebea7155c96f63b0740a184fdc..1385519ef6065cd2b8c29c895805f88694cc2739 100644 --- a/src/solaris/native/java/net/linux_close.c +++ b/src/solaris/native/java/net/linux_close.c @@ -112,7 +112,7 @@ static void __attribute((constructor)) init() { */ static inline fdEntry_t *getFdEntry(int fd) { - if (fd < 0 || fd > fdCount) { + if (fd < 0 || fd >= fdCount) { return NULL; } return &fdTable[fd]; diff --git a/src/solaris/native/java/net/net_util_md.c b/src/solaris/native/java/net/net_util_md.c index 8367f05470b88f86eb6148adc986c4e388c680b6..8e035b368f145eae891f13bd4eaa63c0623acd2e 100644 --- a/src/solaris/native/java/net/net_util_md.c +++ b/src/solaris/native/java/net/net_util_md.c @@ -608,7 +608,7 @@ static void initLoopbackRoutes() { { /* now find the scope_id for "lo" */ - char devname[20]; + char devname[21]; char addr6p[8][5]; int plen, scope, dad_status, if_idx; @@ -651,7 +651,7 @@ static int nifs = 0; /* number of entries used in array */ static void initLocalIfs () { FILE *f; unsigned char staddr [16]; - char ifname [32]; + char ifname [33]; struct localinterface *lif=0; int index, x1, x2, x3; unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf; @@ -660,7 +660,7 @@ static void initLocalIfs () { return ; } while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x " - "%d %x %x %x %s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7, + "%d %x %x %x %32s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7, &u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf, &index, &x1, &x2, &x3, ifname) == 21) { staddr[0] = (unsigned char)u0; @@ -1102,7 +1102,7 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr) { * index. */ if (match) { - char devname[20]; + char devname[21]; char addr6p[8][5]; int plen, scope, dad_status, if_idx; diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 1a715ca1369ada17b7e4c36b264a9707252a97d5..db16fdc524abed1158bd23108c0d389feec19ae1 100644 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -375,6 +375,12 @@ X11SD_Dispose(JNIEnv *env, SurfaceDataOps *ops) AWT_LOCK(); xsdo->invalid = JNI_TRUE; + + if (xsdo->xrPic != None) { + XRenderFreePicture(awt_display, xsdo->xrPic); + xsdo->xrPic = None; + } + if (xsdo->isPixmap == JNI_TRUE && xsdo->drawable != 0) { #ifdef MITSHM if (xsdo->shmPMData.shmSegInfo != NULL) { diff --git a/src/solaris/native/sun/java2d/x11/XRBackendNative.c b/src/solaris/native/sun/java2d/x11/XRBackendNative.c index 1ce26c601075451aa0900b9418319f06912c8da2..f56e904a669ed3ab072decd782fd962b5e5522a1 100644 --- a/src/solaris/native/sun/java2d/x11/XRBackendNative.c +++ b/src/solaris/native/sun/java2d/x11/XRBackendNative.c @@ -304,23 +304,27 @@ Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative color.blue = blue; if (rectCnt <= 256) { - xRects = &sRects[0]; + xRects = &sRects[0]; } else { - xRects = (XRectangle *) malloc(sizeof(XRectangle) * rectCnt); - if (xRects == NULL) { - return; - } + xRects = (XRectangle *) malloc(sizeof(XRectangle) * rectCnt); + if (xRects == NULL) { + return; + } } - if ((rects = (jint *) (*env)->GetPrimitiveArrayCritical(env, rectArray, NULL)) == NULL) { - return; + if ((rects = (jint *) + (*env)->GetPrimitiveArrayCritical(env, rectArray, NULL)) == NULL) { + if (xRects != &sRects[0]) { + free(xRects); + } + return; } for (i=0; i < rectCnt; i++) { - xRects[i].x = rects[i*4 + 0]; - xRects[i].y = rects[i*4 + 1]; - xRects[i].width = rects[i*4 + 2]; - xRects[i].height = rects[i*4 + 3]; + xRects[i].x = rects[i*4 + 0]; + xRects[i].y = rects[i*4 + 1]; + xRects[i].width = rects[i*4 + 2]; + xRects[i].height = rects[i*4 + 3]; } XRenderFillRectangles(awt_display, op, @@ -328,7 +332,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative (*env)->ReleasePrimitiveArrayCritical(env, rectArray, rects, JNI_ABORT); if (xRects != &sRects[0]) { - free(xRects); + free(xRects); } } @@ -610,17 +614,30 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative Glyph *gid = (Glyph *) malloc(sizeof(Glyph) * glyphCnt); if (xginfo == NULL || gid == NULL) { - return; + if (xginfo != NULL) { + free(xginfo); + } + if (gid != NULL) { + free(gid); + } + return; } - if ((glyphInfoPtrs = (jlong *) (*env)->GetPrimitiveArrayCritical(env, glyphInfoPtrsArray, NULL)) == NULL) { + if ((glyphInfoPtrs = (jlong *)(*env)-> + GetPrimitiveArrayCritical(env, glyphInfoPtrsArray, NULL)) == NULL) + { + free(xginfo); + free(gid); return; } if ((pixelData = (unsigned char *) - (*env)->GetPrimitiveArrayCritical(env, pixelDataArray, NULL)) == NULL) { + (*env)->GetPrimitiveArrayCritical(env, pixelDataArray, NULL)) == NULL) + { (*env)->ReleasePrimitiveArrayCritical(env, - glyphInfoPtrsArray, glyphInfoPtrs, JNI_ABORT); + glyphInfoPtrsArray, glyphInfoPtrs, JNI_ABORT); + free(xginfo); + free(gid); return; } @@ -637,7 +654,7 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative } XRenderAddGlyphs(awt_display, glyphSet, &gid[0], &xginfo[0], glyphCnt, - pixelData, pixelDataLength); + (const char*)pixelData, pixelDataLength); (*env)->ReleasePrimitiveArrayCritical(env, glyphInfoPtrsArray, glyphInfoPtrs, JNI_ABORT); (*env)->ReleasePrimitiveArrayCritical(env, pixelDataArray, pixelData, JNI_ABORT); @@ -684,22 +701,44 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative xelts = &selts[0]; }else { xelts = (XGlyphElt32 *) malloc(sizeof(XGlyphElt32) * eltCnt); + if (xelts == NULL) { + return; + } } if (glyphCnt <= 256) { xids = &sids[0]; - }else { + } else { xids = (Glyph *) malloc(sizeof(Glyph) * glyphCnt); + if (xids == NULL) { + if (xelts != &selts[0]) { + free(xelts); + } + return; + } } - if ((ids = (jint *) (*env)->GetPrimitiveArrayCritical(env, glyphIDArray, NULL)) == NULL) { - return; + if ((ids = (jint *) + (*env)->GetPrimitiveArrayCritical(env, glyphIDArray, NULL)) == NULL) { + if (xelts != &selts[0]) { + free(xelts); + } + if (xids != &sids[0]) { + free(xids); + } + return; } if ((elts = (jint *) (*env)->GetPrimitiveArrayCritical(env, eltArray, NULL)) == NULL) { (*env)->ReleasePrimitiveArrayCritical(env, glyphIDArray, ids, JNI_ABORT); - return; + if (xelts != &selts[0]) { + free(xelts); + } + if (xids != &sids[0]) { + free(xids); + } + return; } for (i=0; i < glyphCnt; i++) { @@ -724,11 +763,11 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative (*env)->ReleasePrimitiveArrayCritical(env, eltArray, elts, JNI_ABORT); if (xelts != &selts[0]) { - free(xelts); + free(xelts); } if (xids != &sids[0]) { - free(xids); + free(xids); } } @@ -762,8 +801,12 @@ Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative } } - if ((rects = (jint *) (*env)->GetPrimitiveArrayCritical(env, rectArray, NULL)) == NULL) { - return; + if ((rects = (jint*) + (*env)->GetPrimitiveArrayCritical(env, rectArray, NULL)) == NULL) { + if (xRects != &sRects[0]) { + free(xRects); + } + return; } for (i=0; i < rectCnt; i++) { diff --git a/src/solaris/native/sun/java2d/x11/XRSurfaceData.c b/src/solaris/native/sun/java2d/x11/XRSurfaceData.c index 83fbec0c3363a73e963035d322974867acae0ed4..620f90f7618c93ad105c2561912c264050a04a44 100644 --- a/src/solaris/native/sun/java2d/x11/XRSurfaceData.c +++ b/src/solaris/native/sun/java2d/x11/XRSurfaceData.c @@ -114,3 +114,26 @@ Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd, XShared_initSurface(env, xsdo, depth, width, height, drawable); #endif /* !HEADLESS */ } + + + +JNIEXPORT void JNICALL +Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd, + jlong pXSData) +{ +#ifndef HEADLESS + X11SDOps *xsdo; + + J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture"); + + xsdo = X11SurfaceData_GetOps(env, xsd); + if (xsdo == NULL) { + return; + } + + if(xsdo->xrPic != None) { + XRenderFreePicture(awt_display, xsdo->xrPic); + xsdo->xrPic = None; + } +#endif /* !HEADLESS */ +} diff --git a/src/windows/classes/sun/nio/ch/PendingIoCache.java b/src/windows/classes/sun/nio/ch/PendingIoCache.java index 3d78a733c8c6028b4ce2f845dd39353f1a379792..7a4b1e3e31944f260af92b8c53a5076f645b2f74 100644 --- a/src/windows/classes/sun/nio/ch/PendingIoCache.java +++ b/src/windows/classes/sun/nio/ch/PendingIoCache.java @@ -110,8 +110,7 @@ class PendingIoCache { if (closed) return; - // handle the case that where there are I/O operations that have - // not completed. + // handle case where I/O operations that have not completed. if (!pendingIoMap.isEmpty()) clearPendingIoMap(); @@ -132,7 +131,9 @@ class PendingIoCache { closePending = true; try { this.wait(50); - } catch (InterruptedException x) { } + } catch (InterruptedException x) { + Thread.currentThread().interrupt(); + } closePending = false; if (pendingIoMap.isEmpty()) return; diff --git a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java index 694b23a34a9043db5b9f43dbf3fbff34884f986e..8240587592807a42f7920e3918610619c3a7b717 100644 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java @@ -439,6 +439,7 @@ public class WindowsAsynchronousFileChannelImpl address = ((DirectBuffer)buf).address(); } + boolean pending = false; try { begin(); @@ -449,6 +450,7 @@ public class WindowsAsynchronousFileChannelImpl n = readFile(handle, address, rem, position, overlapped); if (n == IOStatus.UNAVAILABLE) { // I/O is pending + pending = true; return; } else if (n == IOStatus.EOF) { result.setResult(n); @@ -460,14 +462,15 @@ public class WindowsAsynchronousFileChannelImpl // failed to initiate read result.setFailure(toIOException(x)); } finally { + if (!pending) { + // release resources + if (overlapped != 0L) + ioCache.remove(overlapped); + releaseBufferIfSubstituted(); + } end(); } - // release resources - if (overlapped != 0L) - ioCache.remove(overlapped); - releaseBufferIfSubstituted(); - // invoke completion handler Invoker.invoke(result); } diff --git a/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java b/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java index 28d3c07454944d80433418e6146e2d3fc38f9286..2cc9cf026af0c4c216e8fe46250d509004e1c59d 100644 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java @@ -239,14 +239,14 @@ class WindowsAsynchronousSocketChannelImpl result.setResult(null); } } catch (Throwable x) { + if (overlapped != 0L) + ioCache.remove(overlapped); exc = x; } finally { end(); } if (exc != null) { - if (overlapped != 0L) - ioCache.remove(overlapped); closeChannel(); result.setFailure(toIOException(exc)); } diff --git a/src/windows/classes/sun/nio/fs/WindowsFileStore.java b/src/windows/classes/sun/nio/fs/WindowsFileStore.java index 8b3c2fb4b19af4e4cb8268b0bbd76d82868ae8f9..07eb73231ce13d86a0099268112b53ddf362a2d4 100644 --- a/src/windows/classes/sun/nio/fs/WindowsFileStore.java +++ b/src/windows/classes/sun/nio/fs/WindowsFileStore.java @@ -201,13 +201,12 @@ class WindowsFileStore if (!(ob instanceof WindowsFileStore)) return false; WindowsFileStore other = (WindowsFileStore)ob; - return this.volInfo.volumeSerialNumber() == other.volInfo.volumeSerialNumber(); + return root.equals(other.root); } @Override public int hashCode() { - // reveals VSN without permission check - okay? - return volInfo.volumeSerialNumber(); + return root.hashCode(); } @Override diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 46b8cc1e8554a2cfcdca575bb95de0347eebf27e..27518785b070b0fa0887c82c86838aed19560e01 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -380,30 +380,9 @@ java/io/File/MaxPathLength.java windows-all # jdk_nio -# 6944810 -java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all - # 6963118 java/nio/channels/Selector/Wakeup.java windows-all -# The asynchronous I/O implementation on Windows requires Windows XP or newer. -# We can remove the following once all Windows 2000 machines have been -# decommissioned. -java/nio/channels/AsynchronousChannelGroup/Basic.java windows-5.0 -java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java windows-5.0 -java/nio/channels/AsynchronousChannelGroup/Identity.java windows-5.0 -java/nio/channels/AsynchronousChannelGroup/Restart.java windows-5.0 -java/nio/channels/AsynchronousChannelGroup/Unbounded.java windows-5.0 -java/nio/channels/AsynchronousDatagramChannel/Basic.java windows-5.0 -java/nio/channels/AsynchronousFileChannel/Lock.java windows-5.0 -java/nio/channels/AsynchronousServerSocketChannel/Basic.java windows-5.0 -java/nio/channels/AsynchronousServerSocketChannel/WithSecurityManager.java windows-5.0 -java/nio/channels/AsynchronousSocketChannel/Basic.java windows-5.0 -java/nio/channels/AsynchronousSocketChannel/DieBeforeComplete.java windows-5.0 -java/nio/channels/AsynchronousSocketChannel/Leaky.java windows-5.0 -java/nio/channels/AsynchronousSocketChannel/StressLoopback.java windows-5.0 -java/nio/channels/Channels/Basic2.java windows-5.0 - # 6959891 com/sun/nio/sctp/SctpChannel/SocketOptionTests.java @@ -625,9 +604,6 @@ sun/security/tools/keytool/emptysubject.sh generic-all # Timeout on solaris-sparcv9 or exception thrown com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java solaris-all -# File 6535697.test input stream left open? windows samevm -java/security/cert/CertificateFactory/openssl/OpenSSLCert.java generic-all - # Leaving file open: SerialVersion.current, windows samevm java/security/BasicPermission/SerialVersion.java generic-all @@ -717,6 +693,7 @@ sun/tools/jconsole/ResourceCheckTest.sh generic-all # Filed 6933803 java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all +# Filed 7022325 # Fails with assertion error on windows # 11 separate stacktraces created... file reuse problem? java/util/zip/ZipFile/ReadLongZipFileName.java generic-all diff --git a/test/com/sun/jndi/ldap/NoWaitForReplyTest.java b/test/com/sun/jndi/ldap/NoWaitForReplyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bb772c09bc580d6de4f6a66b946e35bbb6a191f3 --- /dev/null +++ b/test/com/sun/jndi/ldap/NoWaitForReplyTest.java @@ -0,0 +1,131 @@ +/* + * 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. + */ + +/** + * @test + * @bug 6748156 + * @summary add an new JNDI property to control the boolean flag WaitForReply + */ + +import java.net.Socket; +import java.net.ServerSocket; +import java.io.*; +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; + +public class NoWaitForReplyTest { + + public static void main(String[] args) throws Exception { + + boolean passed = false; + + // start the LDAP server + DummyServer ldapServer = new DummyServer(); + ldapServer.start(); + + // Set up the environment for creating the initial context + Hashtable env = new Hashtable(11); + env.put(Context.PROVIDER_URL, "ldap://localhost:" + + ldapServer.getPortNumber()); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "com.sun.jndi.ldap.LdapCtxFactory"); + + // Wait up to 10 seconds for a response from the LDAP server + env.put("com.sun.jndi.ldap.read.timeout", "10000"); + + // Don't wait until the first search reply is received + env.put("com.sun.jndi.ldap.search.waitForReply", "false"); + + // Send the LDAP search request without first authenticating (no bind) + env.put("java.naming.ldap.version", "3"); + + + try { + + // Create initial context + System.out.println("Client: connecting to the server"); + DirContext ctx = new InitialDirContext(env); + + SearchControls scl = new SearchControls(); + scl.setSearchScope(SearchControls.SUBTREE_SCOPE); + System.out.println("Client: performing search"); + NamingEnumeration answer = + ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); + + // Server will never reply: either we waited in the call above until + // the timeout (fail) or we did not wait and reached here (pass). + passed = true; + System.out.println("Client: did not wait until first reply"); + + // Close the context when we're done + ctx.close(); + + } catch (NamingException e) { + // timeout (ignore) + } + ldapServer.interrupt(); + + if (!passed) { + throw new Exception( + "Test FAILED: should not have waited until first search reply"); + } + System.out.println("Test PASSED"); + } + + static class DummyServer extends Thread { + + private final ServerSocket serverSocket; + + DummyServer() throws IOException { + this.serverSocket = new ServerSocket(0); + System.out.println("Server: listening on port " + serverSocket.getLocalPort()); + } + + public int getPortNumber() { + return serverSocket.getLocalPort(); + } + + public void run() { + try (Socket socket = serverSocket.accept()) { + System.out.println("Server: accepted a connection"); + InputStream in = socket.getInputStream(); + + while (!isInterrupted()) { + in.skip(in.available()); + } + + } catch (Exception e) { + // ignore + + } finally { + System.out.println("Server: shutting down"); + try { + serverSocket.close(); + } catch (IOException e) { + // ignore + } + } + } + } +} diff --git a/test/java/awt/FontClass/SurrogateTest/SupplementaryCanDisplayUpToTest.java b/test/java/awt/FontClass/SurrogateTest/SupplementaryCanDisplayUpToTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1fd09e4b068775e06c61c6c9120a668e8955d7b6 --- /dev/null +++ b/test/java/awt/FontClass/SurrogateTest/SupplementaryCanDisplayUpToTest.java @@ -0,0 +1,105 @@ +/* + * 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. + */ + +/* + * @test + * @bug 6623219 + * @summary Test canDisplayUpTo with supplementary characters. + */ + +import java.awt.*; +import java.text.*; + +public class SupplementaryCanDisplayUpToTest { + // Lists consisting of a font name, test text, and its expected + // return value. Test text uses private area code point U+F0000 + // (\udb80\udc00). + private static String[][] DATA = { + // Windows + { "Meiryo", "\ud87e\udd45\ud87e\udd47\udb80\udc00", "4" }, + { "Meiryo", "\ud87e\udd45\ud87e\udd47\udb80Z", "4" }, + { "Meiryo", "\ud87e\udd45\ud87e\udd47\udb80", "4" }, + { "Meiryo", "\ud87e\udd45\ud87e\udd47\udc00", "4" }, + { "Meiryo", "\ud87e\udd45\ud87e\udd47", "-1" }, + + // Linux + { "AR PL UMing TW", "\ud87e\udc25\ud87e\udc3b\udb80\udc00", "4" }, + { "AR PL UMing TW", "\ud87e\udc25\ud87e\udc3b\udb80Z", "4" }, + { "AR PL UMing TW", "\ud87e\udc25\ud87e\udc3b\udb80", "4" }, + { "AR PL UMing TW", "\ud87e\udc25\ud87e\udc3b\udc00", "4" }, + { "AR PL UMing TW", "\ud87e\udc25\ud87e\udc3b", "-1" }, + + // Solaris + { "FZMingTi", "\ud87e\udc25\ud87e\udc3b\udb80\udc00", "4" }, + { "FZMingTi", "\ud87e\udc25\ud87e\udc3b\udb80Z", "4" }, + { "FZMingTi", "\ud87e\udc25\ud87e\udc3b\udb80", "4" }, + { "FZMingTi", "\ud87e\udc25\ud87e\udc3b\udc00", "4" }, + { "FZMingTi", "\ud87e\udc25\ud87e\udc3b", "-1" }, + }; + private static int errorcount = 0; + + public static void main(String[] args) { + for (String[] data : DATA) { + String fontname = data[0]; + Font font = new Font(fontname, Font.PLAIN, 16); + if (font.getFamily().equals(Font.DIALOG)) { + // Skip any unavailable fonts. + continue; + } + + System.out.printf("Testing with font '%s'... ", fontname); + int errors = 0; + String text = data[1]; + int expected = Integer.parseInt(data[2]); + + int result = font.canDisplayUpTo(text); + if (result != expected) { + System.err.println("canDisplayUpTo(String) returns " + result); + errors++; + } + + result = font.canDisplayUpTo(text.toCharArray(), 0, text.length()); + if (result != expected) { + System.err.println("canDisplayUpTo(char[], int, int) returns " + result); + errors++; + } + + CharacterIterator iter = new StringCharacterIterator(text); + result = font.canDisplayUpTo(iter, iter.getBeginIndex(), iter.getEndIndex()); + if (result != expected) { + System.err.println("canDisplayUpTo(CharacterIterator, int, int) returns " + result); + errors++; + } + + if (errors == 0) { + System.out.println("passed"); + } else { + System.out.println("failed"); + errorcount += errors; + } + } + if (errorcount > 0) { + throw new RuntimeException("SupplementaryCanDisplayUpToTest: failed"); + } + } +} diff --git a/test/java/io/File/SetLastModified.java b/test/java/io/File/SetLastModified.java index 3ca72c9d5168a23ba194be7070c55303551d4448..fada781a202ec7cc43b441450eaccd23c2ef1896 100644 --- a/test/java/io/File/SetLastModified.java +++ b/test/java/io/File/SetLastModified.java @@ -105,9 +105,9 @@ public class SetLastModified { System.getProperty("os.name").startsWith("Windows") ? 0L : 3L*G; long pos = 0L; while (pos <= MAX_POSITION) { - FileChannel fc = new FileOutputStream(f).getChannel(); - fc.position(pos).write(ByteBuffer.wrap("x".getBytes())); - fc.close(); + try (FileChannel fc = new FileOutputStream(f).getChannel()) { + fc.position(pos).write(ByteBuffer.wrap("x".getBytes())); + } ot = f.lastModified(); System.out.format("check with file size: %d\n", f.length()); if (!f.setLastModified(nt)) diff --git a/test/java/io/FileOutputStream/AtomicAppend.java b/test/java/io/FileOutputStream/AtomicAppend.java index 627c944004019924981e420168be6935a9db25fb..c5f18e6cd9844a6e52ed92a574e6bfc16e754edd 100644 --- a/test/java/io/FileOutputStream/AtomicAppend.java +++ b/test/java/io/FileOutputStream/AtomicAppend.java @@ -47,12 +47,12 @@ public class AtomicAppend { for (int i = 0; i < nThreads; i++) es.execute(new Runnable() { public void run() { try { - FileOutputStream s = new FileOutputStream(file, true); - for (int j = 0; j < 1000; j++) { - s.write((int) 'x'); - s.flush(); + try (FileOutputStream s = new FileOutputStream(file, true)) { + for (int j = 0; j < 1000; j++) { + s.write((int) 'x'); + s.flush(); + } } - s.close(); } catch (Throwable t) { unexpected(t); }}}); es.shutdown(); es.awaitTermination(10L, TimeUnit.MINUTES); diff --git a/test/java/io/OutputStreamWriter/Encode.java b/test/java/io/OutputStreamWriter/Encode.java index 07897607af0eec7ebc6fda6da6b8daa4463d0d57..fda2d03cc54f4853e0a5d7b40dffc239bfee0d73 100644 --- a/test/java/io/OutputStreamWriter/Encode.java +++ b/test/java/io/OutputStreamWriter/Encode.java @@ -35,8 +35,9 @@ public class Encode implements Runnable { new Encode(); } + final ServerSocket ss = new ServerSocket(0); + Encode() throws Exception { - ss = new ServerSocket(0); (new Thread(this)).start(); String toEncode = "\uD800\uDC00 \uD801\uDC01 "; String enc1 = URLEncoder.encode(toEncode, "UTF-8"); @@ -47,27 +48,31 @@ public class Encode implements Runnable { "/missing.nothtml"; HttpURLConnection uc = (HttpURLConnection)new URL(url).openConnection(); uc.connect(); - String enc2 = URLEncoder.encode(toEncode, "UTF-8"); - if (!enc1.equals(enc2)) - throw new RuntimeException("test failed"); - uc.disconnect(); + try { + String enc2 = URLEncoder.encode(toEncode, "UTF-8"); + if (!enc1.equals(enc2)) { + System.out.println("test failed"); + throw new RuntimeException("test failed"); + } + } finally { + uc.disconnect(); + } } - ServerSocket ss; - public void run() { - try { - Socket s = ss.accept(); - BufferedReader in = new BufferedReader( - new InputStreamReader(s.getInputStream())); + try (ServerSocket serv = ss; + Socket s = serv.accept(); + BufferedReader in = + new BufferedReader(new InputStreamReader(s.getInputStream()))) + { String req = in.readLine(); - PrintStream out = new PrintStream(new BufferedOutputStream( - s.getOutputStream())); - out.print("HTTP/1.1 403 Forbidden\r\n"); - out.print("\r\n"); - out.flush(); - s.close(); - ss.close(); + try (OutputStream os = s.getOutputStream(); + BufferedOutputStream bos = new BufferedOutputStream(os); + PrintStream out = new PrintStream(bos)) + { + out.print("HTTP/1.1 403 Forbidden\r\n"); + out.print("\r\n"); + } } catch (Exception e) { e.printStackTrace(); } diff --git a/test/java/io/PrintStream/EncodingConstructor.java b/test/java/io/PrintStream/EncodingConstructor.java index d4c36889877996c84b18ac6a7fc53bd29a1492e6..a4b9c88429523cbb9071e8e75bba36a00d0ea4f1 100644 --- a/test/java/io/PrintStream/EncodingConstructor.java +++ b/test/java/io/PrintStream/EncodingConstructor.java @@ -34,11 +34,11 @@ public class EncodingConstructor { public static void main(String args[]) throws Exception { ByteArrayOutputStream bo = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(bo, false, "UTF-8"); String s = "xyzzy"; int n = s.length(); - ps.print(s); - ps.close(); + try (PrintStream ps = new PrintStream(bo, false, "UTF-8")) { + ps.print(s); + } byte[] ba = bo.toByteArray(); if (ba.length != n) throw new Exception("Length mismatch: " + n + " " + ba.length); diff --git a/test/java/io/PrintStream/FailingConstructors.java b/test/java/io/PrintStream/FailingConstructors.java index 1022bb9d311e39c17632d2451ba4f36f8de2a441..70f04b2ec14e9f532849f3c7150cedc4b3a30f0d 100644 --- a/test/java/io/PrintStream/FailingConstructors.java +++ b/test/java/io/PrintStream/FailingConstructors.java @@ -35,6 +35,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Path; public class FailingConstructors { static final String fileName = "FailingConstructorsTest"; @@ -45,14 +47,13 @@ public class FailingConstructors { test(false, new File(fileName)); /* create the file and write its contents */ - File file = File.createTempFile(fileName, null); - file.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(file); - fos.write(FILE_CONTENTS.getBytes()); - fos.close(); - - test(true, file); - file.delete(); + Path path = Files.createTempFile(fileName, null); + try { + Files.write(path, FILE_CONTENTS.getBytes()); + test(true, path.toFile()); + } finally { + Files.delete(path); + } } private static void test(boolean exists, File file) throws Throwable { diff --git a/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java b/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java index 073caf7ffd760cc6ab99b02d613fc17eec0929f5..47f79ea713d37dcb27324bff88a2018c188b9c1c 100644 --- a/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java +++ b/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java @@ -27,7 +27,7 @@ * @build install/SerialDriver.java test/SerialDriver.java extension/ExtendedObjectInputStream.java * @summary Enable resolveClass() to accommodate package renaming. * This fix enables one to implement a resolveClass method that maps a - * Serialiazable class within a serialization stream to the same class + * Serializable class within a serialization stream to the same class * in a different package within the JVM runtime. See run shell script * for instructions on how to run this test. */ @@ -86,16 +86,15 @@ public class SerialDriver implements Serializable { File f = new File("stream.ser"); if (serialize) { // Serialize the subclass - try { - FileOutputStream fo = new FileOutputStream(f); - ObjectOutputStream so = new ObjectOutputStream(fo); + try (FileOutputStream fo = new FileOutputStream(f); + ObjectOutputStream so = new ObjectOutputStream(fo)) + { so.writeObject(obj); /* Skip arrays since they do not work with rename yet. The serialVersionUID changes due to the name change and there is no way to set the serialVersionUID for an array. */ so.writeObject(array); - so.flush(); } catch (Exception e) { System.out.println(e); throw e; @@ -103,16 +102,14 @@ public class SerialDriver implements Serializable { } if (deserialize) { // Deserialize the subclass - try { - FileInputStream fi = new FileInputStream(f); - ExtendedObjectInputStream si = - new ExtendedObjectInputStream(fi); + try (FileInputStream fi = new FileInputStream(f); + ExtendedObjectInputStream si = new ExtendedObjectInputStream(fi)) + { si.addRenamedClassName("test.SerialDriver", "install.SerialDriver"); si.addRenamedClassName("[Ltest.SerialDriver;", "[Linstall.SerialDriver"); obj = (SerialDriver) si.readObject(); array = (SerialDriver[]) si.readObject(); - si.close(); } catch (Exception e) { System.out.println(e); throw e; diff --git a/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java b/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java index 44e2392aa9c11d04f164cf3a0b0cf260eefde101..533df16511d2f0483e5fa180b127c2932ad050ca 100644 --- a/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java +++ b/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java @@ -27,7 +27,7 @@ * @build install/SerialDriver.java test/SerialDriver.java extension/ExtendedObjectInputStream.java * @summary Enable resolveClass() to accommodate package renaming. * This fix enables one to implement a resolveClass method that maps a - * Serialiazable class within a serialization stream to the same class + * Serializable class within a serialization stream to the same class * in a different package within the JVM runtime. See run shell script * for instructions on how to run this test. */ @@ -83,14 +83,13 @@ public class SerialDriver implements Serializable { File f = new File("stream.ser"); if (serialize) { // Serialize the subclass - try { - FileOutputStream fo = new FileOutputStream(f); - ObjectOutputStream so = new ObjectOutputStream(fo); + try (FileOutputStream fo = new FileOutputStream(f); + ObjectOutputStream so = new ObjectOutputStream(fo)) + { so.writeObject(obj); /* Comment out since renaming arrays does not work since it changes the serialVersionUID. */ so.writeObject(array); - so.flush(); } catch (Exception e) { System.out.println(e); throw e; @@ -98,16 +97,15 @@ public class SerialDriver implements Serializable { } if (deserialize) { // Deserialize the subclass - try { - FileInputStream fi = new FileInputStream(f); - ExtendedObjectInputStream si = new ExtendedObjectInputStream(fi); + try (FileInputStream fi = new FileInputStream(f); + ExtendedObjectInputStream si = new ExtendedObjectInputStream(fi)) + { si.addRenamedClassName("install.SerialDriver", "test.SerialDriver"); si.addRenamedClassName("[Linstall.SerialDriver;", "[Ltest.SerialDriver"); obj = (SerialDriver) si.readObject(); array = (SerialDriver[]) si.readObject(); - si.close(); } catch (Exception e) { System.out.println(e); throw e; diff --git a/test/java/lang/Character/CheckScript.java b/test/java/lang/Character/CheckScript.java index a286643c8cff5aa556992b0cb5320cf583372c6e..6d0f650d16983a5f9cc89b2d2edc8ad956dc4d25 100644 --- a/test/java/lang/Character/CheckScript.java +++ b/test/java/lang/Character/CheckScript.java @@ -12,40 +12,43 @@ import java.lang.Character.UnicodeScript; public class CheckScript { - public static void main(String[] args) throws Exception { - - BufferedReader sbfr = null; + static BufferedReader open(String[] args) throws FileNotFoundException { if (args.length == 0) { - sbfr = new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt"))); + return new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt"))); } else if (args.length == 1) { - sbfr = new BufferedReader(new FileReader(args[0])); + return new BufferedReader(new FileReader(args[0])); } else { System.out.println("java CharacterScript Scripts.txt"); throw new RuntimeException("Datafile name should be specified."); } + } + + public static void main(String[] args) throws Exception { + Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher(""); String line = null; HashMap> scripts = new HashMap<>(); - while ((line = sbfr.readLine()) != null) { - if (line.length() <= 1 || line.charAt(0) == '#') { - continue; - } - m.reset(line); - if (m.matches()) { - int start = Integer.parseInt(m.group(1), 16); - int end = (m.group(2)==null)?start - :Integer.parseInt(m.group(2), 16); - String name = m.group(3).toLowerCase(Locale.ENGLISH); - ArrayList ranges = scripts.get(name); - if (ranges == null) { - ranges = new ArrayList(); - scripts.put(name, ranges); + try (BufferedReader sbfr = open(args)) { + while ((line = sbfr.readLine()) != null) { + if (line.length() <= 1 || line.charAt(0) == '#') { + continue; + } + m.reset(line); + if (m.matches()) { + int start = Integer.parseInt(m.group(1), 16); + int end = (m.group(2)==null)?start + :Integer.parseInt(m.group(2), 16); + String name = m.group(3).toLowerCase(Locale.ENGLISH); + ArrayList ranges = scripts.get(name); + if (ranges == null) { + ranges = new ArrayList(); + scripts.put(name, ranges); + } + ranges.add(start); + ranges.add(end); } - ranges.add(start); - ranges.add(end); } } - sbfr.close(); // check all defined ranges Integer[] ZEROSIZEARRAY = new Integer[0]; for (String name : scripts.keySet()) { diff --git a/test/java/lang/ProcessBuilder/Basic.java b/test/java/lang/ProcessBuilder/Basic.java index ebe65fb5bad6e68ebb408c41fc7ca3409cfc7e0f..7ba90e8e8a2726499ad03322c36b3615b8a2d7d7 100644 --- a/test/java/lang/ProcessBuilder/Basic.java +++ b/test/java/lang/ProcessBuilder/Basic.java @@ -26,7 +26,7 @@ * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689 * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313 * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958 - * 4947220 + * 4947220 7018606 * @summary Basic tests for Process and Environment Variable code * @run main/othervm/timeout=300 Basic * @author Martin Buchholz @@ -47,6 +47,9 @@ import static java.util.AbstractMap.SimpleImmutableEntry; public class Basic { + /* used for Windows only */ + static final String systemRoot = System.getenv("SystemRoot"); + private static String commandOutput(Reader r) throws Throwable { StringBuilder sb = new StringBuilder(); int c; @@ -1073,7 +1076,11 @@ public class Basic { try { ProcessBuilder pb = new ProcessBuilder(); pb.environment().clear(); - equal(getenvInChild(pb), ""); + String expected = Windows.is() ? "SystemRoot="+systemRoot+",": ""; + if (Windows.is()) { + pb.environment().put("SystemRoot", systemRoot); + } + equal(getenvInChild(pb), expected); } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- @@ -1561,13 +1568,21 @@ public class Basic { List childArgs = new ArrayList(javaChildArgs); childArgs.add("System.getenv()"); String[] cmdp = childArgs.toArray(new String[childArgs.size()]); - String[] envp = {"=ExitValue=3", "=C:=\\"}; + String[] envp; + String[] envpWin = {"=ExitValue=3", "=C:=\\", "SystemRoot="+systemRoot}; + String[] envpOth = {"=ExitValue=3", "=C:=\\"}; + if (Windows.is()) { + envp = envpWin; + } else { + envp = envpOth; + } Process p = Runtime.getRuntime().exec(cmdp, envp); - String expected = Windows.is() ? "=C:=\\,=ExitValue=3," : "=C:=\\,"; + String expected = Windows.is() ? "=C:=\\,SystemRoot="+systemRoot+",=ExitValue=3," : "=C:=\\,"; equal(commandOutput(p), expected); if (Windows.is()) { ProcessBuilder pb = new ProcessBuilder(childArgs); pb.environment().clear(); + pb.environment().put("SystemRoot", systemRoot); pb.environment().put("=ExitValue", "3"); pb.environment().put("=C:", "\\"); equal(commandOutput(pb), expected); @@ -1591,10 +1606,18 @@ public class Basic { List childArgs = new ArrayList(javaChildArgs); childArgs.add("System.getenv()"); String[] cmdp = childArgs.toArray(new String[childArgs.size()]); - String[] envp = {"LC_ALL=C\u0000\u0000", // Yuck! + String[] envpWin = {"SystemRoot="+systemRoot, "LC_ALL=C\u0000\u0000", // Yuck! "FO\u0000=B\u0000R"}; + String[] envpOth = {"LC_ALL=C\u0000\u0000", // Yuck! + "FO\u0000=B\u0000R"}; + String[] envp; + if (Windows.is()) { + envp = envpWin; + } else { + envp = envpOth; + } Process p = Runtime.getRuntime().exec(cmdp, envp); - check(commandOutput(p).equals("LC_ALL=C,"), + check(commandOutput(p).equals(Windows.is() ? "SystemRoot="+systemRoot+",LC_ALL=C," : "LC_ALL=C,"), "Incorrect handling of envstrings containing NULs"); } catch (Throwable t) { unexpected(t); } @@ -2144,6 +2167,7 @@ public class Basic { static void equal(Object x, Object y) { if (x == null ? y == null : x.equals(y)) pass(); else fail(x + " not equal to " + y);} + public static void main(String[] args) throws Throwable { try {realMain(args);} catch (Throwable t) {unexpected(t);} System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); diff --git a/test/java/lang/Runtime/shutdown/ShutdownHooks.java b/test/java/lang/Runtime/shutdown/ShutdownHooks.java index a198d98b8727b7a0251f995a2f7d8801d6cb2358..bfe2b60e3eee14d5a4c03724391e372d03885fb0 100644 --- a/test/java/lang/Runtime/shutdown/ShutdownHooks.java +++ b/test/java/lang/Runtime/shutdown/ShutdownHooks.java @@ -43,9 +43,9 @@ public class ShutdownHooks { file = new File(dir, args[1]); // write to file System.out.println("writing to "+ file); - PrintWriter pw = new PrintWriter(file); - pw.println("Shutdown begins"); - pw.close(); + try (PrintWriter pw = new PrintWriter(file)) { + pw.println("Shutdown begins"); + } } public static class Cleaner extends Thread { @@ -56,10 +56,8 @@ public class ShutdownHooks { // register the DeleteOnExitHook while the application // shutdown hook is running file.deleteOnExit(); - try { - PrintWriter pw = new PrintWriter(file); + try (PrintWriter pw = new PrintWriter(file)) { pw.println("file is being deleted"); - pw.close(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } diff --git a/test/java/lang/Thread/StartOOMTest.java b/test/java/lang/Thread/StartOOMTest.java index fd6c070baef47d767fb1d39426d64861e652d44c..57edd723c31ae97d44430ea14fb263395d3eacd9 100644 --- a/test/java/lang/Thread/StartOOMTest.java +++ b/test/java/lang/Thread/StartOOMTest.java @@ -22,11 +22,14 @@ */ /* - * @test - * @bug 6379235 - * @ignore until 6721694 is fixed - * @run main/othervm -server -Xmx32m -Xms32m -Xss256m StartOOMTest - * @summary ThreadGroup accounting mistake possible with failure of Thread.start() + * This test is relatively useful for verifying 6379235, but + * is too resource intensive, especially on 64 bit systems, + * to be run automatically, see 6721694. + * + * When run it should be typically be run with the server vm + * and a relatively small java heap, and a large stack size + * ( to provoke the OOM quicker ). + * java -server -Xmx32m -Xms32m -Xss256m StartOOMTest */ import java.util.*; diff --git a/test/java/lang/instrument/BootClassPath/Setup.java b/test/java/lang/instrument/BootClassPath/Setup.java index 90beff135eaf68a575008605792a6a26da5bc2e1..3ef40f1321722442e7f3e622cb8f3908c6dbc921 100644 --- a/test/java/lang/instrument/BootClassPath/Setup.java +++ b/test/java/lang/instrument/BootClassPath/Setup.java @@ -62,31 +62,33 @@ public class Setup { * Create manifest file with Boot-Class-Path encoding the * sub-directory name. */ - FileOutputStream out = new FileOutputStream(manifestFile); - out.write("Manifest-Version: 1.0\n".getBytes("UTF-8")); - - byte[] premainBytes = ("Premain-Class: " + premainClass + "\n").getBytes("UTF-8"); - out.write(premainBytes); - - out.write( "Boot-Class-Path: ".getBytes("UTF-8") ); - - byte[] value = bootClassPath.getBytes("UTF-8"); - for (int i=0; i it = infoList.iterator(); it.hasNext(); ) { - Info info = it.next(); - if (!info.className.equals(currentClassName)) { - dataOut.writeInt(123456); // class name marker - currentClassName = info.className; - dataOut.writeUTF(currentClassName); + try (FileOutputStream fileOut = + new FileOutputStream(new File(outDir, filename)); + DataOutputStream dataOut = new DataOutputStream(fileOut)) + { + String currentClassName = null; + + dataOut.writeInt(infoList.size()); + for (Iterator it = infoList.iterator(); it.hasNext(); ) { + Info info = it.next(); + if (!info.className.equals(currentClassName)) { + dataOut.writeInt(123456); // class name marker + currentClassName = info.className; + dataOut.writeUTF(currentClassName); + } + dataOut.writeInt(info.location); + dataOut.writeUTF(info.methodName); } - dataOut.writeInt(info.location); - dataOut.writeUTF(info.methodName); } - dataOut.close(); } public byte[] bytecodes(String className, String methodName, int location) { diff --git a/test/java/math/BigInteger/BigIntegerTest.java b/test/java/math/BigInteger/BigIntegerTest.java index ba35c7bbdbec08b9a19ad3db72f770281af3c87d..c23563f2208d083e8dd44c7f92cc84b073bad909 100644 --- a/test/java/math/BigInteger/BigIntegerTest.java +++ b/test/java/math/BigInteger/BigIntegerTest.java @@ -645,26 +645,17 @@ public class BigIntegerTest { BigInteger b2 = null; File f = new File("serialtest"); - FileOutputStream fos = new FileOutputStream(f); - try { - ObjectOutputStream oos = new ObjectOutputStream(fos); - try { + + try (FileOutputStream fos = new FileOutputStream(f)) { + try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(b1); oos.flush(); - } finally { - oos.close(); } - FileInputStream fis = new FileInputStream(f); - try { - ObjectInputStream ois = new ObjectInputStream(fis); - try { - b2 = (BigInteger)ois.readObject(); - } finally { - ois.close(); - } - } finally { - fis.close(); + try (FileInputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis)) + { + b2 = (BigInteger)ois.readObject(); } if (!b1.equals(b2) || @@ -673,8 +664,6 @@ public class BigIntegerTest { System.err.println("Serialized failed for hex " + b1.toString(16)); } - } finally { - fos.close(); } f.delete(); } @@ -683,29 +672,17 @@ public class BigIntegerTest { BigInteger b1 = fetchNumber(rnd.nextInt(100)); BigInteger b2 = null; File f = new File("serialtest"); - FileOutputStream fos = new FileOutputStream(f); - try { - ObjectOutputStream oos = new ObjectOutputStream(fos); - try { + try (FileOutputStream fos = new FileOutputStream(f)) { + try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(b1); oos.flush(); - } finally { - oos.close(); } - FileInputStream fis = new FileInputStream(f); - try { - ObjectInputStream ois = new ObjectInputStream(fis); - try { - b2 = (BigInteger)ois.readObject(); - } finally { - ois.close(); - } - } finally { - fis.close(); + try (FileInputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis)) + { + b2 = (BigInteger)ois.readObject(); } - } finally { - fos.close(); } if (!b1.equals(b2) || diff --git a/test/java/net/URLConnection/RedirectLimit.java b/test/java/net/URLConnection/RedirectLimit.java index 1df973f8bc0738d8936c7e929dedfc836246919e..5fe65a1a9144d96f8401a72a2999d15aa7da6354 100644 --- a/test/java/net/URLConnection/RedirectLimit.java +++ b/test/java/net/URLConnection/RedirectLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -36,105 +36,81 @@ import java.io.*; import java.net.*; class RedirLimitServer extends Thread { + static final int TIMEOUT = 10 * 1000; + static final int NUM_REDIRECTS = 9; - ServerSocket s; - Socket s1; - InputStream is; - OutputStream os; - int port; - int nredirects = 9; - - String reply1 = "HTTP/1.1 307 Temporary Redirect\r\n" + + static final String reply1 = "HTTP/1.1 307 Temporary Redirect\r\n" + "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + "Server: Apache/1.3.14 (Unix)\r\n" + "Location: http://localhost:"; - String reply2 = ".html\r\n" + + static final String reply2 = ".html\r\n" + "Connection: close\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n\r\n" + "Hello"; - - RedirLimitServer (ServerSocket y) { - s = y; - port = s.getLocalPort(); - } - - String reply3 = "HTTP/1.1 200 Ok\r\n" + + static final String reply3 = "HTTP/1.1 200 Ok\r\n" + "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + "Server: Apache/1.3.14 (Unix)\r\n" + "Connection: close\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n\r\n" + "World"; - public void run () { + final ServerSocket ss; + final int port; + + RedirLimitServer(ServerSocket ss) { + this.ss = ss; + port = ss.getLocalPort(); + } + + public void run() { try { - s.setSoTimeout (2000); - for (int i=0; i filter = new DirectoryStream.Filter<>() { + DirectoryStream.Filter filter = new DirectoryStream.Filter() { private PathMatcher matcher = dir.getFileSystem().getPathMatcher("glob:f*"); public boolean accept(Path file) { diff --git a/test/java/nio/file/FileStore/Basic.java b/test/java/nio/file/FileStore/Basic.java index f49bc6552bb83da3fbec66c6dad96219c7916540..8a53ca4a47dbcbf3f2f5ed2cd9ddf9eea10476f5 100644 --- a/test/java/nio/file/FileStore/Basic.java +++ b/test/java/nio/file/FileStore/Basic.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6873621 6979526 7006126 + * @bug 4313887 6873621 6979526 7006126 7020517 * @summary Unit test for java.nio.file.FileStore * @library .. */ diff --git a/test/java/nio/file/Files/TemporaryFiles.java b/test/java/nio/file/Files/TemporaryFiles.java index 3c1087e4e530ad2956629f4ffe9fff1e6c932643..254f874175addbe346b871f6dc6e9aa5601bc449 100644 --- a/test/java/nio/file/Files/TemporaryFiles.java +++ b/test/java/nio/file/Files/TemporaryFiles.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 7006126 + * @bug 4313887 6838333 7006126 7023034 * @summary Unit test for Files.createTempXXX * @library .. */ @@ -167,5 +167,31 @@ public class TemporaryFiles { testInvalidFileTemp("../blah", null); testInvalidFileTemp("dir/blah", null); testInvalidFileTemp("blah", ".dat/foo"); + + // nulls + try { + Files.createTempFile("blah", ".tmp", (FileAttribute[])null); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + try { + Files.createTempFile("blah", ".tmp", new FileAttribute[] { null }); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + try { + Files.createTempDirectory("blah", (FileAttribute[])null); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + try { + Files.createTempDirectory("blah", new FileAttribute[] { null }); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + try { + Files.createTempFile((Path)null, "blah", ".tmp"); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + try { + Files.createTempDirectory((Path)null, "blah"); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } } } diff --git a/test/java/security/cert/CertificateFactory/openssl/OpenSSLCert.java b/test/java/security/cert/CertificateFactory/openssl/OpenSSLCert.java index 92fbef6b98a03ac5ab855882bba5c687e027ab67..1f19292da3332712253c11d15a2c5357a5744482 100644 --- a/test/java/security/cert/CertificateFactory/openssl/OpenSSLCert.java +++ b/test/java/security/cert/CertificateFactory/openssl/OpenSSLCert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -28,6 +28,8 @@ */ import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.Arrays; import java.security.cert.CertificateFactory; @@ -46,24 +48,20 @@ public class OpenSSLCert { } static void test(String... files) throws Exception { - FileOutputStream fout = new FileOutputStream(OUTFILE); - for (String file: files) { - FileInputStream fin = new FileInputStream( - new File(System.getProperty("test.src", "."), file)); - byte[] buffer = new byte[4096]; - while (true) { - int len = fin.read(buffer); - if (len < 0) break; - fout.write(buffer, 0, len); + try (FileOutputStream fout = new FileOutputStream(OUTFILE)) { + String here = System.getProperty("test.src", ""); + for (String file: files) { + Files.copy(Paths.get(here, file), fout); } - fin.close(); } - fout.close(); - System.out.println("Testing " + Arrays.toString(files) + "..."); - if (CertificateFactory.getInstance("X509") - .generateCertificates(new FileInputStream(OUTFILE)) - .size() != files.length) { - throw new Exception("Not same number"); + try (FileInputStream fin = new FileInputStream(OUTFILE)) { + System.out.println("Testing " + Arrays.toString(files) + "..."); + if (CertificateFactory.getInstance("X509") + .generateCertificates(fin) + .size() != files.length) { + throw new Exception("Not same number"); + } } + Files.delete(Paths.get(OUTFILE)); } } diff --git a/test/java/util/Collection/MOAT.java b/test/java/util/Collection/MOAT.java index a85afa3c8d233b19e5782cdf3cc57b1bce309622..ce7975635a861fbe76684238b451e71b4733ceaa 100644 --- a/test/java/util/Collection/MOAT.java +++ b/test/java/util/Collection/MOAT.java @@ -28,6 +28,8 @@ * 6431845 4802633 6570566 6570575 6570631 6570924 6691185 6691215 * @summary Run many tests on many Collection and Map implementations * @author Martin Buchholz + * @run main MOAT + * @run main/othervm -XX:+AggressiveOpts MOAT */ /* Mother Of All (Collection) Tests diff --git a/test/java/util/Currency/ValidateISO4217.java b/test/java/util/Currency/ValidateISO4217.java index c92b06226fe1d4bbe00750408149cf458531a847..486741fdd2c9473dab09df3b4dcf9a47ba5439bc 100644 --- a/test/java/util/Currency/ValidateISO4217.java +++ b/test/java/util/Currency/ValidateISO4217.java @@ -111,57 +111,58 @@ public class ValidateISO4217 { static void test1() throws Exception { - FileReader fr = new FileReader(new File(System.getProperty("test.src", "."), datafile)); - BufferedReader in = new BufferedReader(fr); - String line; - SimpleDateFormat format = null; - - while ((line = in.readLine()) != null) { - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } + try (FileReader fr = new FileReader(new File(System.getProperty("test.src", "."), datafile)); + BufferedReader in = new BufferedReader(fr)) + { + String line; + SimpleDateFormat format = null; + + while ((line = in.readLine()) != null) { + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } - StringTokenizer tokens = new StringTokenizer(line, "\t"); - String country = tokens.nextToken(); - if (country.length() != 2) { - continue; - } + StringTokenizer tokens = new StringTokenizer(line, "\t"); + String country = tokens.nextToken(); + if (country.length() != 2) { + continue; + } - String currency; - String numeric; - String minorUnit; - int tokensCount = tokens.countTokens(); - if (tokensCount < 3) { - currency = ""; - numeric = "0"; - minorUnit = "0"; - } else { - currency = tokens.nextToken(); - numeric = tokens.nextToken(); - minorUnit = tokens.nextToken(); - testCurrencies.add(Currency.getInstance(currency)); - - // check for the cutover - if (tokensCount > 3) { - if (format == null) { - format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US); - format.setTimeZone(TimeZone.getTimeZone("GMT")); - format.setLenient(false); - } - if (format.parse(tokens.nextToken()).getTime() < - System.currentTimeMillis()) { - currency = tokens.nextToken(); - numeric = tokens.nextToken(); - minorUnit = tokens.nextToken(); - testCurrencies.add(Currency.getInstance(currency)); + String currency; + String numeric; + String minorUnit; + int tokensCount = tokens.countTokens(); + if (tokensCount < 3) { + currency = ""; + numeric = "0"; + minorUnit = "0"; + } else { + currency = tokens.nextToken(); + numeric = tokens.nextToken(); + minorUnit = tokens.nextToken(); + testCurrencies.add(Currency.getInstance(currency)); + + // check for the cutover + if (tokensCount > 3) { + if (format == null) { + format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + format.setLenient(false); + } + if (format.parse(tokens.nextToken()).getTime() < + System.currentTimeMillis()) { + currency = tokens.nextToken(); + numeric = tokens.nextToken(); + minorUnit = tokens.nextToken(); + testCurrencies.add(Currency.getInstance(currency)); + } } } + int index = toIndex(country); + testCountryCurrency(country, currency, Integer.parseInt(numeric), + Integer.parseInt(minorUnit), index); } - int index = toIndex(country); - testCountryCurrency(country, currency, Integer.parseInt(numeric), - Integer.parseInt(minorUnit), index); } - in.close(); for (int i = 0; i < additionalCodes.length; i++) { int index = toIndex(additionalCodes[i][0]); diff --git a/test/java/util/Formatter/FailingConstructors.java b/test/java/util/Formatter/FailingConstructors.java index 8ef99f146a40ad5299b19f55fe772f6bdb69faec..29e34bc179e182579be7ea0f6aa9dd4a8860c1a4 100644 --- a/test/java/util/Formatter/FailingConstructors.java +++ b/test/java/util/Formatter/FailingConstructors.java @@ -34,6 +34,7 @@ import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.nio.file.Files; import java.util.Formatter; public class FailingConstructors { @@ -47,9 +48,7 @@ public class FailingConstructors { /* create the file and write its contents */ File file = File.createTempFile(fileName, null); file.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(file); - fos.write(FILE_CONTENTS.getBytes()); - fos.close(); + Files.write(file.toPath(), FILE_CONTENTS.getBytes()); test(true, file); file.delete(); diff --git a/test/java/util/Locale/LocaleEnhanceTest.java b/test/java/util/Locale/LocaleEnhanceTest.java index 5d816bc2eee9b8e7473a44e4b5d5d3eae6b93ee8..0ee6ed24dcae345e8b34aa7fb8a3ba08c6e8c10c 100644 --- a/test/java/util/Locale/LocaleEnhanceTest.java +++ b/test/java/util/Locale/LocaleEnhanceTest.java @@ -1204,14 +1204,12 @@ public class LocaleEnhanceTest extends LocaleTestFmwk { locale = new Locale(lang, country, variant); } - // desrialize - try { - FileInputStream fis = new FileInputStream(testfile); - ObjectInputStream ois = new ObjectInputStream(fis); - + // deserialize + try (FileInputStream fis = new FileInputStream(testfile); + ObjectInputStream ois = new ObjectInputStream(fis)) + { Object o = ois.readObject(); assertEquals("Deserialize Java 6 Locale " + locale, o, locale); - ois.close(); } catch (Exception e) { errln("Exception while reading " + testfile.getAbsolutePath() + " - " + e.getMessage()); } diff --git a/test/java/util/PriorityQueue/NoNulls.java b/test/java/util/PriorityQueue/NoNulls.java index a56259a8ae0e1124ba8daf30c3ab8f2d3df316b0..21f76876b4cfca8513a9cdf3aae162f4b93349a2 100644 --- a/test/java/util/PriorityQueue/NoNulls.java +++ b/test/java/util/PriorityQueue/NoNulls.java @@ -53,7 +53,7 @@ import java.util.concurrent.PriorityBlockingQueue; public class NoNulls { void test(String[] args) throws Throwable { final Comparator nullTolerantComparator - = new Comparator<>() { + = new Comparator() { public int compare(String x, String y) { return (x == null ? -1 : y == null ? 1 : @@ -65,7 +65,7 @@ public class NoNulls { nullSortedSet.add(null); final PriorityQueue nullPriorityQueue - = new PriorityQueue<>() { + = new PriorityQueue() { public Object[] toArray() { return new Object[] { null };}}; final Collection nullCollection = new ArrayList<>(); diff --git a/test/java/util/ResourceBundle/Bug6204853.java b/test/java/util/ResourceBundle/Bug6204853.java index ca13fa65015b8641ffa6f93ce3d7e0334a336224..4ba5386c8e58ff4b6e2a521852525ad86702991a 100644 --- a/test/java/util/ResourceBundle/Bug6204853.java +++ b/test/java/util/ResourceBundle/Bug6204853.java @@ -39,24 +39,19 @@ import java.util.PropertyResourceBundle; public final class Bug6204853 { public Bug6204853() { - try { - String srcDir = System.getProperty("test.src", "."); - FileInputStream fis8859_1 = - new FileInputStream(new File(srcDir, "Bug6204853.properties")); - FileInputStream fisUtf8 = - new FileInputStream(new File(srcDir, "Bug6204853_Utf8.properties")); - InputStreamReader isrUtf8 = new InputStreamReader(fisUtf8, "UTF-8"); - + String srcDir = System.getProperty("test.src", "."); + try (FileInputStream fis8859_1 = + new FileInputStream(new File(srcDir, "Bug6204853.properties")); + FileInputStream fisUtf8 = + new FileInputStream(new File(srcDir, "Bug6204853_Utf8.properties")); + InputStreamReader isrUtf8 = new InputStreamReader(fisUtf8, "UTF-8")) + { PropertyResourceBundle bundleUtf8 = new PropertyResourceBundle(isrUtf8); PropertyResourceBundle bundle = new PropertyResourceBundle(fis8859_1); String[] arrayUtf8 = createKeyValueArray(bundleUtf8); String[] array = createKeyValueArray(bundle); - isrUtf8.close(); - fisUtf8.close(); - fis8859_1.close(); - if (!Arrays.equals(arrayUtf8, array)) { throw new RuntimeException("PropertyResourceBundle constructed from a UTF-8 encoded property file is not equal to the one constructed from ISO-8859-1 encoded property file."); } diff --git a/test/java/util/Scanner/FailingConstructors.java b/test/java/util/Scanner/FailingConstructors.java index 476c000ae1a536def6ba62a6f0d4df51516a16a6..d74f5c79cc4b6ef709c1c7b482738e7888a71aa8 100644 --- a/test/java/util/Scanner/FailingConstructors.java +++ b/test/java/util/Scanner/FailingConstructors.java @@ -33,6 +33,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.file.Files; import java.util.Scanner; public class FailingConstructors { @@ -46,9 +47,7 @@ public class FailingConstructors { /* create the file and write its contents */ File file = File.createTempFile(fileName, null); file.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(file); - fos.write(FILE_CONTENTS.getBytes()); - fos.close(); + Files.write(file.toPath(), FILE_CONTENTS.getBytes()); test(true, file); file.delete(); diff --git a/test/java/util/TimeZone/Bug6772689.java b/test/java/util/TimeZone/Bug6772689.java new file mode 100644 index 0000000000000000000000000000000000000000..f730567013d35e7d29f4ef8554eb080796443fdd --- /dev/null +++ b/test/java/util/TimeZone/Bug6772689.java @@ -0,0 +1,91 @@ +/* + * 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. + */ + +/* + * @test + * @bug 6772689 + * @summary Test for standard-to-daylight transitions at midnight: + * date stays on the given day. + */ + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import static java.util.GregorianCalendar.*; + +public class Bug6772689 { + private static final int BEGIN_YEAR = 2035; + private static final int END_YEAR = BEGIN_YEAR + 28; + + public static void main(String[] args) { + TimeZone defaultTimeZone = TimeZone.getDefault(); + int errors = 0; + + Calendar cal = new GregorianCalendar(BEGIN_YEAR, MARCH, 1); + String[] tzids = TimeZone.getAvailableIDs(); + try { + for (String id : tzids) { + TimeZone tz = TimeZone.getTimeZone(id); + if (!tz.useDaylightTime()) { + continue; + } + TimeZone.setDefault(tz); + + dateloop: + // Use future dates because sun.util.calendar.ZoneInfo + // delegates offset transition calculations to a SimpleTimeZone + // (after 2038 as of JDK7). + for (int year = BEGIN_YEAR; year < END_YEAR; year++) { + for (int month = MARCH; month <= NOVEMBER; month++) { + cal.set(year, month, 1, 15, 0, 0); + int maxDom = cal.getActualMaximum(DAY_OF_MONTH); + for (int dom = 1; dom <= maxDom; dom++) { + Date date = new Date(year - 1900, month, dom); + if (date.getYear()+1900 != year + || date.getMonth() != month + || date.getDate() != dom) { + System.err.printf("%s: got %04d-%02d-%02d, expected %04d-%02d-%02d%n", + id, + date.getYear() + 1900, + date.getMonth() + 1, + date.getDate(), + year, + month + 1, + dom); + errors++; + break dateloop; + } + } + } + } + } + } finally { + // Restore the default TimeZone. + TimeZone.setDefault(defaultTimeZone); + } + if (errors > 0) { + throw new RuntimeException("Transition test failed"); + } + } +} diff --git a/test/java/util/jar/JarEntry/GetMethodsReturnClones.java b/test/java/util/jar/JarEntry/GetMethodsReturnClones.java index ea9accf763dc34d37459f24562fe4a0c4ff70593..dfbeeee0a806ae5da20bc35b436f5a751e65ea0a 100644 --- a/test/java/util/jar/JarEntry/GetMethodsReturnClones.java +++ b/test/java/util/jar/JarEntry/GetMethodsReturnClones.java @@ -40,22 +40,21 @@ public class GetMethodsReturnClones { System.getProperty("file.separator"); public static void main(String[] args) throws Exception { - JarFile jf = new JarFile(BASE + "test.jar", true); - - byte[] buffer = new byte[8192]; - Enumeration e = jf.entries(); - List entries = new ArrayList(); - while (e.hasMoreElements()) { - JarEntry je = e.nextElement(); - entries.add(je); - InputStream is = jf.getInputStream(je); - while (is.read(buffer, 0, buffer.length) != -1) { - // we just read. this will throw a SecurityException - // if a signature/digest check fails. + List entries = new ArrayList<>(); + try (JarFile jf = new JarFile(BASE + "test.jar", true)) { + byte[] buffer = new byte[8192]; + Enumeration e = jf.entries(); + while (e.hasMoreElements()) { + JarEntry je = e.nextElement(); + entries.add(je); + try (InputStream is = jf.getInputStream(je)) { + while (is.read(buffer, 0, buffer.length) != -1) { + // we just read. this will throw a SecurityException + // if a signature/digest check fails. + } + } } - is.close(); } - jf.close(); for (JarEntry je : entries) { Certificate[] certs = je.getCertificates(); diff --git a/test/java/util/jar/JarFile/ScanSignedJar.java b/test/java/util/jar/JarFile/ScanSignedJar.java index 63576a1392474b955736d4b1de5d310028f906f9..b13a2313418e93ceb1eaf9abc926cf2eb84c5dc7 100644 --- a/test/java/util/jar/JarFile/ScanSignedJar.java +++ b/test/java/util/jar/JarFile/ScanSignedJar.java @@ -37,25 +37,25 @@ import java.util.jar.*; public class ScanSignedJar { public static void main(String[] args) throws Exception { - JarFile file = new JarFile(new File(System.getProperty("test.src","."), - "bogus-signerinfo-attr.jar")); - byte[] buffer = new byte[8192]; boolean isSigned = false; + try (JarFile file = new JarFile(new File(System.getProperty("test.src","."), + "bogus-signerinfo-attr.jar"))) { + byte[] buffer = new byte[8192]; - for (Enumeration entries = file.entries(); entries.hasMoreElements();) { - JarEntry entry = (JarEntry) entries.nextElement(); - InputStream jis = file.getInputStream(entry); - while (jis.read(buffer, 0, buffer.length) != -1) { - // read the jar entry + for (Enumeration entries = file.entries(); entries.hasMoreElements();) { + JarEntry entry = (JarEntry) entries.nextElement(); + try (InputStream jis = file.getInputStream(entry)) { + while (jis.read(buffer, 0, buffer.length) != -1) { + // read the jar entry + } + } + if (entry.getCertificates() != null) { + isSigned = true; + } + System.out.println((isSigned ? "[signed] " : "\t ") + + entry.getName()); } - jis.close(); - if (entry.getCertificates() != null) { - isSigned = true; - } - System.out.println((isSigned ? "[signed] " : "\t ") + - entry.getName()); } - file.close(); if (isSigned) { System.out.println("\nJAR file has signed entries"); diff --git a/test/java/util/zip/Available.java b/test/java/util/zip/Available.java index 836d139fad785032fd09d2eba696028de8937a8a..2a78bd0d8e84f57684652ac874605154e07876fa 100644 --- a/test/java/util/zip/Available.java +++ b/test/java/util/zip/Available.java @@ -44,14 +44,17 @@ public class Available { File f = new File(System.getProperty("test.src", "."), "input.jar"); // test ZipInputStream - ZipInputStream z = new ZipInputStream(new FileInputStream(f)); - z.getNextEntry(); - tryAvail(z); + try (FileInputStream fis = new FileInputStream(f); + ZipInputStream z = new ZipInputStream(fis)) + { + z.getNextEntry(); + tryAvail(z); + } // test InflaterInputStream - ZipFile zfile = new ZipFile(f); - tryAvail(zfile.getInputStream(zfile.getEntry("Available.java"))); - z.close(); + try (ZipFile zfile = new ZipFile(f)) { + tryAvail(zfile.getInputStream(zfile.getEntry("Available.java"))); + } } static void tryAvail(InputStream in) throws Exception { @@ -67,20 +70,21 @@ public class Available { // To reproduce 4401122 private static void test2() throws Exception { File f = new File(System.getProperty("test.src", "."), "input.jar"); - ZipFile zf = new ZipFile(f); - InputStream in = zf.getInputStream(zf.getEntry("Available.java")); + try (ZipFile zf = new ZipFile(f)) { + InputStream in = zf.getInputStream(zf.getEntry("Available.java")); - int initialAvailable = in.available(); - in.read(); - if (in.available() != initialAvailable - 1) - throw new RuntimeException("Available not decremented."); - for(int j=0; j entries = zf.entries(); ze = entries.nextElement(); check(! entries.hasMoreElements()); checkZipEntry(ze, contents(zf, ze)); - } finally { - zf.close(); } - ZipInputStream is = new ZipInputStream(new FileInputStream(f)); - try { + try (FileInputStream fis = new FileInputStream(f); + ZipInputStream is = new ZipInputStream(fis)) + { ze = is.getNextEntry(); checkZipEntry(ze, contents(is)); check(is.getNextEntry() == null); - } finally { - is.close(); } f.delete(); System.out.printf("passed = %d, failed = %d%n", passed, failed); diff --git a/test/java/util/zip/LargeZip.java b/test/java/util/zip/LargeZip.java index a7754e3a98fef74bbd82c09b57b07c261bbe495f..a4f00d23a4128bbb0f509a50e683e98f714a1e94 100644 --- a/test/java/util/zip/LargeZip.java +++ b/test/java/util/zip/LargeZip.java @@ -98,19 +98,21 @@ public class LargeZip { } data = baos.toByteArray(); - ZipOutputStream zos = new ZipOutputStream( - new BufferedOutputStream(new FileOutputStream(largeFile))); - long length = 0; - while (length < fileSize) { - ZipEntry ze = new ZipEntry("entry-" + length); - lastEntryName = ze.getName(); - zos.putNextEntry(ze); - zos.write(data, 0, data.length); - zos.closeEntry(); - length = largeFile.length(); + try (FileOutputStream fos = new FileOutputStream(largeFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + ZipOutputStream zos = new ZipOutputStream(bos)) + { + long length = 0; + while (length < fileSize) { + ZipEntry ze = new ZipEntry("entry-" + length); + lastEntryName = ze.getName(); + zos.putNextEntry(ze); + zos.write(data, 0, data.length); + zos.closeEntry(); + length = largeFile.length(); + } + System.out.println("Last entry written is " + lastEntryName); } - System.out.println("Last entry written is " + lastEntryName); - zos.close(); } static void readLargeZip1() throws Throwable { @@ -143,33 +145,35 @@ public class LargeZip { static void readLargeZip2() throws Throwable { - ZipInputStream zis = new ZipInputStream( - new BufferedInputStream(new FileInputStream(largeFile))); - ZipEntry entry = null; - String entryName = null; - int count = 0; - while ((entry = zis.getNextEntry()) != null) { - entryName = entry.getName(); - if (entryName.equals(lastEntryName)) { - break; + try (FileInputStream fis = new FileInputStream(largeFile); + BufferedInputStream bis = new BufferedInputStream(fis); + ZipInputStream zis = new ZipInputStream(bis)) + { + ZipEntry entry = null; + String entryName = null; + int count = 0; + while ((entry = zis.getNextEntry()) != null) { + entryName = entry.getName(); + if (entryName.equals(lastEntryName)) { + break; + } + count++; } - count++; - } - System.out.println("Number of entries read: " + count); - System.out.println("Last entry read is " + entryName); - check(!entry.isDirectory()); + System.out.println("Number of entries read: " + count); + System.out.println("Last entry read is " + entryName); + check(!entry.isDirectory()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte buf[] = new byte[4096]; - int len; - while ((len = zis.read(buf)) >= 0) { - baos.write(buf, 0, len); + byte buf[] = new byte[4096]; + int len; + while ((len = zis.read(buf)) >= 0) { + baos.write(buf, 0, len); + } + baos.close(); + check(Arrays.equals(data, baos.toByteArray())); + check(zis.getNextEntry() == null); } - baos.close(); - check(Arrays.equals(data, baos.toByteArray())); - check(zis.getNextEntry() == null); - zis.close(); } diff --git a/test/java/util/zip/TestEmptyZip.java b/test/java/util/zip/TestEmptyZip.java index 44cf59cad6b8e7759cac3049ef751440c304cc4c..ff4406c976ce2c98db21b0d683718b6808ffdfa9 100644 --- a/test/java/util/zip/TestEmptyZip.java +++ b/test/java/util/zip/TestEmptyZip.java @@ -78,67 +78,49 @@ public class TestEmptyZip { pass(); } } - ZipInputStream zis = null; - try { - zis = new ZipInputStream(new FileInputStream(f)); + try (FileInputStream fis = new FileInputStream(f); + ZipInputStream zis = new ZipInputStream(fis)) + { ZipEntry ze = zis.getNextEntry(); check(ze == null); } catch (IOException ex) { unexpected(ex); - } finally { - if (zis != null) zis.close(); } } static void write(File f) throws Exception { - ZipOutputStream zos = null; - try { - zos = new ZipOutputStream(new FileOutputStream(f)); + try (FileOutputStream fis = new FileOutputStream(f); + ZipOutputStream zos = new ZipOutputStream(fis)) + { zos.finish(); - zos.close(); pass(); } catch (Exception ex) { unexpected(ex); - } finally { - if (zos != null) { - zos.close(); - } } } static void readFile(File f) throws Exception { - ZipFile zf = null; - try { - zf = new ZipFile(f); + try (ZipFile zf = new ZipFile(f)) { Enumeration e = zf.entries(); while (e.hasMoreElements()) { ZipEntry entry = (ZipEntry) e.nextElement(); fail(); } - zf.close(); pass(); } catch (Exception ex) { unexpected(ex); - } finally { - if (zf != null) { - zf.close(); - } } } static void readStream(File f) throws Exception { - ZipInputStream zis = null; - try { - zis = new ZipInputStream(new FileInputStream(f)); + try (FileInputStream fis = new FileInputStream(f); + ZipInputStream zis = new ZipInputStream(fis)) + { ZipEntry ze = zis.getNextEntry(); check(ze == null); byte[] buf = new byte[1024]; check(zis.read(buf, 0, 1024) == -1); - } finally { - if (zis != null) { - zis.close(); - } } } diff --git a/test/java/util/zip/ZipCoding.java b/test/java/util/zip/ZipCoding.java index c65d1ac333cc7d01693be2de9052ad52a1aad166..a21a8f2b31fffb615cb4af27c1837a45d68731ac 100644 --- a/test/java/util/zip/ZipCoding.java +++ b/test/java/util/zip/ZipCoding.java @@ -57,59 +57,58 @@ public class ZipCoding { String name, String comment, byte[] bb) throws Exception { - ZipInputStream zis = new ZipInputStream(is, cs); - ZipEntry e = zis.getNextEntry(); - if (e == null || ! name.equals(e.getName())) - throw new RuntimeException("ZipIS name doesn't match!"); - byte[] bBuf = new byte[bb.length << 1]; - int n = zis.read(bBuf, 0, bBuf.length); - if (n != bb.length || - !Arrays.equals(bb, Arrays.copyOf(bBuf, n))) { - throw new RuntimeException("ZipIS content doesn't match!"); + try (ZipInputStream zis = new ZipInputStream(is, cs)) { + ZipEntry e = zis.getNextEntry(); + if (e == null || ! name.equals(e.getName())) + throw new RuntimeException("ZipIS name doesn't match!"); + byte[] bBuf = new byte[bb.length << 1]; + int n = zis.read(bBuf, 0, bBuf.length); + if (n != bb.length || + !Arrays.equals(bb, Arrays.copyOf(bBuf, n))) { + throw new RuntimeException("ZipIS content doesn't match!"); + } } - zis.close(); } static void testZipFile(File f, Charset cs, String name, String comment, byte[] bb) throws Exception { - ZipFile zf = new ZipFile(f, cs); - Enumeration zes = zf.entries(); - ZipEntry e = (ZipEntry)zes.nextElement(); - if (! name.equals(e.getName()) || - ! comment.equals(e.getComment())) - throw new RuntimeException("ZipFile: name/comment doesn't match!"); - InputStream is = zf.getInputStream(e); - if (is == null) - throw new RuntimeException("ZipFile: getIS failed!"); - byte[] bBuf = new byte[bb.length << 1]; - int n = 0; - int nn =0; - while ((nn = is.read(bBuf, n, bBuf.length-n)) != -1) { - n += nn; + try (ZipFile zf = new ZipFile(f, cs)) { + Enumeration zes = zf.entries(); + ZipEntry e = (ZipEntry)zes.nextElement(); + if (! name.equals(e.getName()) || + ! comment.equals(e.getComment())) + throw new RuntimeException("ZipFile: name/comment doesn't match!"); + InputStream is = zf.getInputStream(e); + if (is == null) + throw new RuntimeException("ZipFile: getIS failed!"); + byte[] bBuf = new byte[bb.length << 1]; + int n = 0; + int nn =0; + while ((nn = is.read(bBuf, n, bBuf.length-n)) != -1) { + n += nn; + } + if (n != bb.length || + !Arrays.equals(bb, Arrays.copyOf(bBuf, n))) { + throw new RuntimeException("ZipFile content doesn't match!"); + } } - if (n != bb.length || - !Arrays.equals(bb, Arrays.copyOf(bBuf, n))) { - throw new RuntimeException("ZipFile content doesn't match!"); - } - zf.close(); } static void test(String csn, String name, String comment) throws Exception { - byte[] bb = "This is the conent of the zipfile".getBytes("ISO-8859-1"); + byte[] bb = "This is the content of the zipfile".getBytes("ISO-8859-1"); Charset cs = Charset.forName(csn); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ZipOutputStream zos = new ZipOutputStream(baos, cs); - - ZipEntry e = new ZipEntry(name); - e.setComment(comment); - zos.putNextEntry(e); - zos.write(bb, 0, bb.length); - zos.closeEntry(); - zos.close(); + try (ZipOutputStream zos = new ZipOutputStream(baos, cs)) { + ZipEntry e = new ZipEntry(name); + e.setComment(comment); + zos.putNextEntry(e); + zos.write(bb, 0, bb.length); + zos.closeEntry(); + } ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray()); testZipInputStream(bis, cs, name, comment, bb); @@ -121,9 +120,9 @@ public class ZipCoding { File f = new File(new File(System.getProperty("test.dir", ".")), "zfcoding.zip"); - FileOutputStream fos = new FileOutputStream(f); - baos.writeTo(fos); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(f)) { + baos.writeTo(fos); + } testZipFile(f, cs, name, comment, bb); if ("utf-8".equals(csn)) { testZipFile(f, Charset.forName("MS932"), name, comment, bb); diff --git a/test/java/util/zip/ZipFile/Assortment.java b/test/java/util/zip/ZipFile/Assortment.java index 0605e2e3e13d6643a44098e0a3d1bf8769c697e4..bb0d9fa8eb487168251437e6ee59459aa4ba9f7e 100644 --- a/test/java/util/zip/ZipFile/Assortment.java +++ b/test/java/util/zip/ZipFile/Assortment.java @@ -201,13 +201,12 @@ public class Assortment { //---------------------------------------------------------------- // Write zip file using ZipOutputStream //---------------------------------------------------------------- - ZipOutputStream zos = new ZipOutputStream( - new FileOutputStream(zipName)); - - for (Entry e : entries) - e.write(zos); - - zos.close(); + try (FileOutputStream fos = new FileOutputStream(zipName); + ZipOutputStream zos = new ZipOutputStream(fos)) + { + for (Entry e : entries) + e.write(zos); + } //---------------------------------------------------------------- // Verify zip file contents using JarFile class diff --git a/test/java/util/zip/ZipFile/Comment.java b/test/java/util/zip/ZipFile/Comment.java index d48cef20856f40f4e9bed21208737a169094675a..61a02521caa1d2621a3f1e434ccd21f7fcd72f79 100644 --- a/test/java/util/zip/ZipFile/Comment.java +++ b/test/java/util/zip/ZipFile/Comment.java @@ -57,16 +57,15 @@ public class Comment { private static void writeZipFile(String name, String comment) throws IOException { - ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(name)); - try { + try (FileOutputStream fos = new FileOutputStream(name); + ZipOutputStream zos = new ZipOutputStream(fos)) + { zos.setComment(comment); ZipEntry ze = new ZipEntry(entryName); ze.setMethod(ZipEntry.DEFLATED); zos.putNextEntry(ze); new DataOutputStream(zos).writeUTF(entryContents); zos.closeEntry(); - } finally { - zos.close(); } } @@ -74,30 +73,30 @@ public class Comment { throws Exception { // Check that Zip entry was correctly written. - ZipFile zipFile = new ZipFile(name); - ZipEntry zipEntry = zipFile.getEntry(entryName); - InputStream is = zipFile.getInputStream(zipEntry); - String result = new DataInputStream(is).readUTF(); - if (!result.equals(entryContents)) - throw new Exception("Entry contents corrupted"); + try (ZipFile zipFile = new ZipFile(name)) { + ZipEntry zipEntry = zipFile.getEntry(entryName); + InputStream is = zipFile.getInputStream(zipEntry); + String result = new DataInputStream(is).readUTF(); + if (!result.equals(entryContents)) + throw new Exception("Entry contents corrupted"); + } - // Check that comment length was correctly written. - RandomAccessFile file = new RandomAccessFile(name, "r"); - file.seek(file.length() - comment.length() - - ZipFile.ENDHDR + ZipFile.ENDCOM); - int b1 = file.readUnsignedByte(); - int b2 = file.readUnsignedByte(); - if (b1 + (b2 << 8) != comment.length()) - throw new Exception("Zip file comment length corrupted"); + try (RandomAccessFile file = new RandomAccessFile(name, "r")) { + // Check that comment length was correctly written. + file.seek(file.length() - comment.length() + - ZipFile.ENDHDR + ZipFile.ENDCOM); + int b1 = file.readUnsignedByte(); + int b2 = file.readUnsignedByte(); + if (b1 + (b2 << 8) != comment.length()) + throw new Exception("Zip file comment length corrupted"); - // Check that comment was correctly written. - file.seek(file.length() - comment.length()); - byte [] bytes = new byte [comment.length()]; - file.readFully(bytes); - zipFile.close(); - file.close(); - if (! comment.equals(new String(bytes, "UTF8"))) - throw new Exception("Zip file comment corrupted"); + // Check that comment was correctly written. + file.seek(file.length() - comment.length()); + byte [] bytes = new byte [comment.length()]; + file.readFully(bytes); + if (! comment.equals(new String(bytes, "UTF8"))) + throw new Exception("Zip file comment corrupted"); + } } private static String buildComment(int length) { diff --git a/test/java/util/zip/ZipFile/CopyJar.java b/test/java/util/zip/ZipFile/CopyJar.java index be88b3dd366e463bd4a63c75433c7678881a1fff..217fd730531f61c739bd025c5c1d3a5e0a3ffff3 100644 --- a/test/java/util/zip/ZipFile/CopyJar.java +++ b/test/java/util/zip/ZipFile/CopyJar.java @@ -31,18 +31,18 @@ import java.util.zip.*; public class CopyJar { public static void main(String args[]) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), - "input.jar")); - ZipEntry ze = zf.getEntry("ReleaseInflater.java"); - ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream()); - InputStream in = zf.getInputStream(ze); - byte[] b = new byte[128]; - int n; - zos.putNextEntry(ze); - while((n = in.read(b)) != -1) { - zos.write(b, 0, n); + try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), + "input.jar"))) { + ZipEntry ze = zf.getEntry("ReleaseInflater.java"); + ZipOutputStream zos = new ZipOutputStream(new ByteArrayOutputStream()); + InputStream in = zf.getInputStream(ze); + byte[] b = new byte[128]; + int n; + zos.putNextEntry(ze); + while((n = in.read(b)) != -1) { + zos.write(b, 0, n); + } + zos.close(); } - zos.close(); - zf.close(); } } diff --git a/test/java/util/zip/ZipFile/CorruptedZipFiles.java b/test/java/util/zip/ZipFile/CorruptedZipFiles.java index a53fdbee9e9f4a08ac25ab83ca254f91936bae86..51d17508fb8c1b0b37d55c3255ff367f581843a1 100644 --- a/test/java/util/zip/ZipFile/CorruptedZipFiles.java +++ b/test/java/util/zip/ZipFile/CorruptedZipFiles.java @@ -47,21 +47,19 @@ public class CorruptedZipFiles { } public static void main(String[] args) throws Exception { - ZipOutputStream zos = new ZipOutputStream(new FileOutputStream("x.zip")); - try { + try (FileOutputStream fos = new FileOutputStream("x.zip"); + ZipOutputStream zos = new ZipOutputStream(fos)) + { ZipEntry e = new ZipEntry("x"); zos.putNextEntry(e); zos.write((int)'x'); - } finally { - zos.close(); } int len = (int)(new File("x.zip").length()); byte[] good = new byte[len]; - FileInputStream fis = new FileInputStream("x.zip"); - fis.read(good); - fis.close(); - fis = null; + try (FileInputStream fis = new FileInputStream("x.zip")) { + fis.read(good); + } new File("x.zip").delete(); int endpos = len - ENDHDR; @@ -150,17 +148,14 @@ public class CorruptedZipFiles { boolean getInputStream) { String zipName = "bad" + (uniquifier++) + ".zip"; try { - FileOutputStream fos = new FileOutputStream(zipName); - fos.write(data); - fos.close(); - ZipFile zf = new ZipFile(zipName); - try { + try (FileOutputStream fos = new FileOutputStream(zipName)) { + fos.write(data); + } + try (ZipFile zf = new ZipFile(zipName)) { if (getInputStream) { InputStream is = zf.getInputStream(new ZipEntry("x")); is.read(); } - } finally { - zf.close(); } fail("Failed to throw expected ZipException"); } catch (ZipException e) { @@ -170,8 +165,7 @@ public class CorruptedZipFiles { unexpected(e); } catch (Throwable t) { unexpected(t); - } - finally { + } finally { new File(zipName).delete(); } } diff --git a/test/java/util/zip/ZipFile/DeleteTempJar.java b/test/java/util/zip/ZipFile/DeleteTempJar.java index f5e79b30bf7c5c20691b15c76bd5e8dd60552a9d..9d504cb7e92410c37bc934b621d789b7a18290f2 100644 --- a/test/java/util/zip/ZipFile/DeleteTempJar.java +++ b/test/java/util/zip/ZipFile/DeleteTempJar.java @@ -53,34 +53,34 @@ public class DeleteTempJar { final File zf = File.createTempFile("deletetemp", ".jar"); zf.deleteOnExit(); - JarOutputStream jos = new JarOutputStream( - new FileOutputStream(zf)); - JarEntry je = new JarEntry("entry"); - jos.putNextEntry(je); - jos.write("hello, world".getBytes("ASCII")); - jos.close(); + try (FileOutputStream fos = new FileOutputStream(zf); + JarOutputStream jos = new JarOutputStream(fos)) + { + JarEntry je = new JarEntry("entry"); + jos.putNextEntry(je); + jos.write("hello, world".getBytes("ASCII")); + } HttpServer server = HttpServer.create( new InetSocketAddress((InetAddress) null, 0), 0); HttpContext context = server.createContext("/", new HttpHandler() { public void handle(HttpExchange e) { - try { - FileInputStream fis = new FileInputStream(zf); - e.sendResponseHeaders(200, zf.length()); - OutputStream os = e.getResponseBody(); - byte[] buf = new byte[1024]; - int count = 0; - while ((count = fis.read(buf)) != -1) { - os.write(buf, 0, count); + try (FileInputStream fis = new FileInputStream(zf)) { + e.sendResponseHeaders(200, zf.length()); + OutputStream os = e.getResponseBody(); + byte[] buf = new byte[1024]; + int count = 0; + while ((count = fis.read(buf)) != -1) { + os.write(buf, 0, count); + } + } catch (Exception ex) { + unexpected(ex); + } finally { + e.close(); } - fis.close(); - e.close(); - } catch (Exception ex) { - unexpected(ex); } - } - }); + }); server.start(); URL url = new URL("jar:http://localhost:" diff --git a/test/java/util/zip/ZipFile/EnumAfterClose.java b/test/java/util/zip/ZipFile/EnumAfterClose.java index 6f4d3d09a9e2fb17ce380903d66b05b4f5ae51ff..5d112dea12e874e38d82ef1b2afb6681a606108f 100644 --- a/test/java/util/zip/ZipFile/EnumAfterClose.java +++ b/test/java/util/zip/ZipFile/EnumAfterClose.java @@ -33,10 +33,12 @@ import java.util.Enumeration; public class EnumAfterClose { public static void main(String args[]) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), - "input.zip")); - Enumeration e = zf.entries(); - zf.close(); + Enumeration e; + try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), + "input.zip"))) { + e = zf.entries(); + } + // ensure that the ZipFile is closed before checking the Enumeration try { if (e.hasMoreElements()) { ZipEntry ze = (ZipEntry)e.nextElement(); diff --git a/test/java/util/zip/ZipFile/GetDirEntry.java b/test/java/util/zip/ZipFile/GetDirEntry.java index 7d87f9dbbc5c8441c4e581e2263288a8a951ed71..0b2af4ffe284ad8f4f2f377487c10a1ba3c3e07c 100644 --- a/test/java/util/zip/ZipFile/GetDirEntry.java +++ b/test/java/util/zip/ZipFile/GetDirEntry.java @@ -32,12 +32,12 @@ import java.util.zip.*; public class GetDirEntry { public static void main(String args[]) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), - "input.jar")); - ZipEntry ze = zf.getEntry("META-INF"); - if (ze == null) { - throw new Exception("failed to find a directory entry"); + try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), + "input.jar"))) { + ZipEntry ze = zf.getEntry("META-INF"); + if (ze == null) { + throw new Exception("failed to find a directory entry"); + } } - zf.close(); } } diff --git a/test/java/util/zip/ZipFile/LargeZipFile.java b/test/java/util/zip/ZipFile/LargeZipFile.java index 6e1b54456bb288fd001546e84b2629c09c1cc685..2df4ca75486a632a0550bd9d02c9031298de17bb 100644 --- a/test/java/util/zip/ZipFile/LargeZipFile.java +++ b/test/java/util/zip/ZipFile/LargeZipFile.java @@ -93,51 +93,50 @@ public class LargeZipFile { baos.write(bb.array(), 0, DATA_SIZE); } data = baos.toByteArray(); - - ZipOutputStream zos = new ZipOutputStream( - new BufferedOutputStream(new FileOutputStream(largeFile))); - long length = 0; - while (length < fileSize) { - ZipEntry ze = new ZipEntry("entry-" + length); - lastEntryName = ze.getName(); - zos.putNextEntry(ze); - zos.write(data, 0, data.length); - zos.closeEntry(); - length = largeFile.length(); + try (FileOutputStream fos = new FileOutputStream(largeFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + ZipOutputStream zos = new ZipOutputStream(bos)) + { + long length = 0; + while (length < fileSize) { + ZipEntry ze = new ZipEntry("entry-" + length); + lastEntryName = ze.getName(); + zos.putNextEntry(ze); + zos.write(data, 0, data.length); + zos.closeEntry(); + length = largeFile.length(); + } + System.out.println("Last entry written is " + lastEntryName); } - System.out.println("Last entry written is " + lastEntryName); - zos.close(); } static void readLargeZip() throws Throwable { - ZipFile zipFile = new ZipFile(largeFile); - ZipEntry entry = null; - String entryName = null; - int count = 0; - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - entry = entries.nextElement(); - entryName = entry.getName(); - count++; - } - System.out.println("Number of entries read: " + count); - System.out.println("Last entry read is " + entryName); - check(!entry.isDirectory()); - if (check(entryName.equals(lastEntryName))) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - InputStream is = zipFile.getInputStream(entry); - byte buf[] = new byte[4096]; - int len; - while ((len = is.read(buf)) >= 0) { - baos.write(buf, 0, len); + try (ZipFile zipFile = new ZipFile(largeFile)) { + ZipEntry entry = null; + String entryName = null; + int count = 0; + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + entry = entries.nextElement(); + entryName = entry.getName(); + count++; + } + System.out.println("Number of entries read: " + count); + System.out.println("Last entry read is " + entryName); + check(!entry.isDirectory()); + if (check(entryName.equals(lastEntryName))) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + InputStream is = zipFile.getInputStream(entry); + byte buf[] = new byte[4096]; + int len; + while ((len = is.read(buf)) >= 0) { + baos.write(buf, 0, len); + } + baos.close(); + is.close(); + check(Arrays.equals(data, baos.toByteArray())); } - baos.close(); - is.close(); - check(Arrays.equals(data, baos.toByteArray())); } - try { - zipFile.close(); - } catch (IOException ioe) {/* what can you do */ } } //--------------------- Infrastructure --------------------------- diff --git a/test/java/util/zip/ZipFile/ManyEntries.java b/test/java/util/zip/ZipFile/ManyEntries.java index 4d36e7ac6217cb49a07415afaa903b5b3bfc1a98..df741ad0dce5c351abad82668dfb72a3a9a72ae2 100644 --- a/test/java/util/zip/ZipFile/ManyEntries.java +++ b/test/java/util/zip/ZipFile/ManyEntries.java @@ -55,10 +55,10 @@ public class ManyEntries { File zipFile = new File(++uniquifier + ".zip"); try { zipFile.delete(); - ZipOutputStream zos = new ZipOutputStream( - new BufferedOutputStream( - new FileOutputStream(zipFile))); - try { + try (FileOutputStream fos = new FileOutputStream(zipFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + ZipOutputStream zos = new ZipOutputStream(bos)) + { for (int i = 0; i < N; i++) { ZipEntry e = new ZipEntry("DIR/"+i); e.setMethod(method); @@ -75,13 +75,9 @@ public class ManyEntries { zos.putNextEntry(e); zos.write(i); } - } finally { - zos.close(); - zos = null; } - ZipFile zip = zip = new ZipFile(zipFile); - try { + try (ZipFile zip = new ZipFile(zipFile)) { if (! (zip.size() == N)) throw new Exception("Bad ZipFile size: " + zip.size()); Enumeration entries = zip.entries(); @@ -104,11 +100,8 @@ public class ManyEntries { } if (entries.hasMoreElements()) throw new Exception("too many elements"); - } finally { - zip.close(); } - } - finally { + } finally { zipFile.delete(); } } diff --git a/test/java/util/zip/ZipFile/ManyZipFiles.java b/test/java/util/zip/ZipFile/ManyZipFiles.java index 1052f6998bd19c2980f4827afd47179c3cd2330b..27f35b77368ca74c7cdfd5adeadffb4803c7b630 100644 --- a/test/java/util/zip/ZipFile/ManyZipFiles.java +++ b/test/java/util/zip/ZipFile/ManyZipFiles.java @@ -51,14 +51,14 @@ public class ManyZipFiles { // Create some zip data ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ZipOutputStream zos = new ZipOutputStream(baos); - ZipEntry ze = new ZipEntry("test"); - zos.putNextEntry(ze); - byte[] hello = "hello, world".getBytes("ASCII"); - zos.write(hello, 0, hello.length); - zos.closeEntry(); - zos.finish(); - zos.close(); + try (ZipOutputStream zos = new ZipOutputStream(baos)) { + ZipEntry ze = new ZipEntry("test"); + zos.putNextEntry(ze); + byte[] hello = "hello, world".getBytes("ASCII"); + zos.write(hello, 0, hello.length); + zos.closeEntry(); + zos.finish(); + } byte[] data = baos.toByteArray(); ZipFile zips[] = new ZipFile[numFiles]; @@ -90,9 +90,9 @@ public class ManyZipFiles { for (int i = 0; i < numFiles; i++) { File f = File.createTempFile("test", ".zip", tmpdir); f.deleteOnExit(); - FileOutputStream fos = new FileOutputStream(f); - fos.write(data, 0, data.length); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(f)) { + fos.write(data, 0, data.length); + } try { zips[i] = new ZipFile(f); } catch (Throwable t) { @@ -102,11 +102,12 @@ public class ManyZipFiles { } } } finally { - // This finally block is due to bug 4171239. On windows, if the + // This finally block is due to bug 4171239. On Windows, if the // file is still open at the end of the VM, deleteOnExit won't // take place. "new ZipFile(...)" opens the zip file, so we have - // to explicity close those opened above. This finally block can - // be removed when 4171239 is fixed. + // to explicitly close those opened above. This finally block can + // be removed when 4171239 is fixed. See also 6357433, against which + // 4171239 was closed as a duplicate. for (int i = 0; i < numFiles; i++) { if (zips[i] != null) { try { diff --git a/test/java/util/zip/ZipFile/ReadAfterClose.java b/test/java/util/zip/ZipFile/ReadAfterClose.java index 035f8f8c69c261fbca8d24e919db68c819e4d22c..4391db7e9e2ba99eac7e329a5925c2afa06dcb61 100644 --- a/test/java/util/zip/ZipFile/ReadAfterClose.java +++ b/test/java/util/zip/ZipFile/ReadAfterClose.java @@ -34,10 +34,13 @@ import java.util.*; public class ReadAfterClose { public static void main(String[] argv) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src","."),"crash.jar")); - ZipEntry zent = zf.getEntry("Test.java"); - InputStream in = zf.getInputStream(zent); - zf.close(); + InputStream in; + try (ZipFile zf = new ZipFile( + new File(System.getProperty("test.src","."),"crash.jar"))) { + ZipEntry zent = zf.getEntry("Test.java"); + in = zf.getInputStream(zent); + } + // ensure zf is closed at this point try { in.read(); } catch (IOException e) { diff --git a/test/java/util/zip/ZipFile/ReadZip.java b/test/java/util/zip/ZipFile/ReadZip.java index 9f525c876001311cb179c9435984335b2474ff93..9ee4cccfc75457ab563259e3ae74a891223c36d9 100644 --- a/test/java/util/zip/ZipFile/ReadZip.java +++ b/test/java/util/zip/ZipFile/ReadZip.java @@ -27,6 +27,10 @@ */ import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.nio.file.StandardOpenOption; import java.util.zip.*; public class ReadZip { @@ -38,71 +42,62 @@ public class ReadZip { } public static void main(String args[]) throws Exception { - ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), - "input.zip")); + try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), + "input.zip"))) { + // Make sure we throw NPE on null objects + try { unreached (zf.getEntry(null)); } + catch (NullPointerException e) {} - // Make sure we throw NPE on null objects - try { unreached (zf.getEntry(null)); } - catch (NullPointerException e) {} + try { unreached (zf.getInputStream(null)); } + catch (NullPointerException e) {} - try { unreached (zf.getInputStream(null)); } - catch (NullPointerException e) {} - - ZipEntry ze = zf.getEntry("ReadZip.java"); - if (ze == null) { - throw new Exception("cannot read from zip file"); + ZipEntry ze = zf.getEntry("ReadZip.java"); + if (ze == null) { + throw new Exception("cannot read from zip file"); + } } - zf.close(); // Make sure we can read the zip file that has some garbage // bytes padded at the end. - FileInputStream fis = new FileInputStream( - new File(System.getProperty("test.src", "."), - "input.zip")); - File newZip = new File(System.getProperty("test.dir", "."), - "input2.zip"); - FileOutputStream fos = new FileOutputStream(newZip); + File newZip = new File(System.getProperty("test.dir", "."), "input2.zip"); + Files.copy(Paths.get(System.getProperty("test.src", ""), "input.zip"), + newZip.toPath(), StandardCopyOption.REPLACE_EXISTING); - byte[] buf = new byte[1024]; - int n = 0; - while ((n = fis.read(buf)) != -1) { - fos.write(buf, 0, n); - } - fis.close(); // pad some bytes - fos.write(1); fos.write(3); fos.write(5); fos.write(7); - fos.close(); - try { - zf = new ZipFile(newZip); - ze = zf.getEntry("ReadZip.java"); + try (OutputStream os = Files.newOutputStream(newZip.toPath(), + StandardOpenOption.APPEND)) { + os.write(1); os.write(3); os.write(5); os.write(7); + } + + try (ZipFile zf = new ZipFile(newZip)) { + ZipEntry ze = zf.getEntry("ReadZip.java"); if (ze == null) { throw new Exception("cannot read from zip file"); } } finally { - zf.close(); newZip.delete(); } // Read zip file comment try { + try (FileOutputStream fos = new FileOutputStream(newZip); + ZipOutputStream zos = new ZipOutputStream(fos)) + { + ZipEntry ze = new ZipEntry("ZipEntry"); + zos.putNextEntry(ze); + zos.write(1); zos.write(2); zos.write(3); zos.write(4); + zos.closeEntry(); + zos.setComment("This is the comment for testing"); + } - ZipOutputStream zos = new ZipOutputStream( - new FileOutputStream(newZip)); - ze = new ZipEntry("ZipEntry"); - zos.putNextEntry(ze); - zos.write(1); zos.write(2); zos.write(3); zos.write(4); - zos.closeEntry(); - zos.setComment("This is the comment for testing"); - zos.close(); - - zf = new ZipFile(newZip); - ze = zf.getEntry("ZipEntry"); - if (ze == null) - throw new Exception("cannot read entry from zip file"); - if (!"This is the comment for testing".equals(zf.getComment())) - throw new Exception("cannot read comment from zip file"); + try (ZipFile zf = new ZipFile(newZip)) { + ZipEntry ze = zf.getEntry("ZipEntry"); + if (ze == null) + throw new Exception("cannot read entry from zip file"); + if (!"This is the comment for testing".equals(zf.getComment())) + throw new Exception("cannot read comment from zip file"); + } } finally { - zf.close(); newZip.delete(); } diff --git a/test/java/util/zip/ZipFile/ShortRead.java b/test/java/util/zip/ZipFile/ShortRead.java index b365b9e50b6fd47ff1c741dcd83816a8b4187b49..e857f7f552a9a45f66d671774f1cc9feebd931cf 100644 --- a/test/java/util/zip/ZipFile/ShortRead.java +++ b/test/java/util/zip/ZipFile/ShortRead.java @@ -38,27 +38,29 @@ public class ShortRead { try { final String entryName = "abc"; final String data = "Data disponible"; - final ZipOutputStream zos = - new ZipOutputStream(new FileOutputStream(zFile)); - zos.putNextEntry(new ZipEntry(entryName)); - zos.write(data.getBytes("ASCII")); - zos.closeEntry(); - zos.close(); + try (FileOutputStream fos = new FileOutputStream(zFile); + ZipOutputStream zos = new ZipOutputStream(fos)) + { + zos.putNextEntry(new ZipEntry(entryName)); + zos.write(data.getBytes("ASCII")); + zos.closeEntry(); + } - final ZipFile zipFile = new ZipFile(zFile); - final ZipEntry zentry = zipFile.getEntry(entryName); - final InputStream inputStream = zipFile.getInputStream(zentry); - System.out.printf("size=%d csize=%d available=%d%n", - zentry.getSize(), - zentry.getCompressedSize(), - inputStream.available()); - byte[] buf = new byte[data.length()]; - final int count = inputStream.read(buf); - if (! new String(buf, "ASCII").equals(data) || - count != data.length()) - throw new Exception("short read?"); - zipFile.close(); + try (ZipFile zipFile = new ZipFile(zFile)) { + final ZipEntry zentry = zipFile.getEntry(entryName); + final InputStream inputStream = zipFile.getInputStream(zentry); + System.out.printf("size=%d csize=%d available=%d%n", + zentry.getSize(), + zentry.getCompressedSize(), + inputStream.available()); + byte[] buf = new byte[data.length()]; + final int count = inputStream.read(buf); + if (! new String(buf, "ASCII").equals(data) || + count != data.length()) + throw new Exception("short read?"); + } + } finally { + zFile.delete(); } - finally { zFile.delete(); } } } diff --git a/test/java/util/zip/zip.java b/test/java/util/zip/zip.java index 0ac91c5c130d0045751a4d314ea031596199898f..62fb71398a7a11587b9c125d5824f815c4a05aa2 100644 --- a/test/java/util/zip/zip.java +++ b/test/java/util/zip/zip.java @@ -322,57 +322,57 @@ public class zip { void create(OutputStream out) throws IOException { - ZipOutputStream zos = new ZipOutputStream(out, cs); - if (flag0) { - zos.setMethod(ZipOutputStream.STORED); - } - for (File file: entries) { - addFile(zos, file); + try (ZipOutputStream zos = new ZipOutputStream(out, cs)) { + if (flag0) { + zos.setMethod(ZipOutputStream.STORED); + } + for (File file: entries) { + addFile(zos, file); + } } - zos.close(); } boolean update(InputStream in, OutputStream out) throws IOException { - ZipInputStream zis = new ZipInputStream(in, cs); - ZipOutputStream zos = new ZipOutputStream(out, cs); - ZipEntry e = null; - byte[] buf = new byte[1024]; - int n = 0; - boolean updateOk = true; - - // put the old entries first, replace if necessary - while ((e = zis.getNextEntry()) != null) { - String name = e.getName(); - if (!entryMap.containsKey(name)) { // copy the old stuff - // do our own compression - ZipEntry e2 = new ZipEntry(name); - e2.setMethod(e.getMethod()); - e2.setTime(e.getTime()); - e2.setComment(e.getComment()); - e2.setExtra(e.getExtra()); - if (e.getMethod() == ZipEntry.STORED) { - e2.setSize(e.getSize()); - e2.setCrc(e.getCrc()); - } - zos.putNextEntry(e2); - while ((n = zis.read(buf, 0, buf.length)) != -1) { - zos.write(buf, 0, n); + try (ZipInputStream zis = new ZipInputStream(in, cs); + ZipOutputStream zos = new ZipOutputStream(out, cs)) + { + ZipEntry e = null; + byte[] buf = new byte[1024]; + int n = 0; + boolean updateOk = true; + + // put the old entries first, replace if necessary + while ((e = zis.getNextEntry()) != null) { + String name = e.getName(); + if (!entryMap.containsKey(name)) { // copy the old stuff + // do our own compression + ZipEntry e2 = new ZipEntry(name); + e2.setMethod(e.getMethod()); + e2.setTime(e.getTime()); + e2.setComment(e.getComment()); + e2.setExtra(e.getExtra()); + if (e.getMethod() == ZipEntry.STORED) { + e2.setSize(e.getSize()); + e2.setCrc(e.getCrc()); + } + zos.putNextEntry(e2); + while ((n = zis.read(buf, 0, buf.length)) != -1) { + zos.write(buf, 0, n); + } + } else { // replace with the new files + File f = entryMap.get(name); + addFile(zos, f); + entryMap.remove(name); + entries.remove(f); } - } else { // replace with the new files - File f = entryMap.get(name); - addFile(zos, f); - entryMap.remove(name); - entries.remove(f); } - } - // add the remaining new files - for (File f: entries) { - addFile(zos, f); + // add the remaining new files + for (File f: entries) { + addFile(zos, f); + } } - zis.close(); - zos.close(); return updateOk; } @@ -517,25 +517,25 @@ public class zip { } void extract(String fname, String files[]) throws IOException { - ZipFile zf = new ZipFile(fname, cs); - Set dirs = newDirSet(); - Enumeration zes = zf.entries(); - while (zes.hasMoreElements()) { - ZipEntry e = zes.nextElement(); - InputStream is; - if (files == null) { - dirs.add(extractFile(zf.getInputStream(e), e)); - } else { - String name = e.getName(); - for (String file : files) { - if (name.startsWith(file)) { - dirs.add(extractFile(zf.getInputStream(e), e)); - break; + try (ZipFile zf = new ZipFile(fname, cs)) { + Set dirs = newDirSet(); + Enumeration zes = zf.entries(); + while (zes.hasMoreElements()) { + ZipEntry e = zes.nextElement(); + InputStream is; + if (files == null) { + dirs.add(extractFile(zf.getInputStream(e), e)); + } else { + String name = e.getName(); + for (String file : files) { + if (name.startsWith(file)) { + dirs.add(extractFile(zf.getInputStream(e), e)); + break; + } } } } } - zf.close(); updateLastModifiedTime(dirs); } @@ -607,12 +607,12 @@ public class zip { } void list(String fname, String files[]) throws IOException { - ZipFile zf = new ZipFile(fname, cs); - Enumeration zes = zf.entries(); - while (zes.hasMoreElements()) { - printEntry(zes.nextElement(), files); + try (ZipFile zf = new ZipFile(fname, cs)) { + Enumeration zes = zf.entries(); + while (zes.hasMoreElements()) { + printEntry(zes.nextElement(), files); + } } - zf.close(); } void printEntry(ZipEntry e, String[] files) throws IOException { diff --git a/test/javax/sound/midi/File/SMPTESequence.java b/test/javax/sound/midi/File/SMPTESequence.java new file mode 100644 index 0000000000000000000000000000000000000000..729c7ec06188d1fd96a4b6f8f3c746c913a1a3cb --- /dev/null +++ b/test/javax/sound/midi/File/SMPTESequence.java @@ -0,0 +1,75 @@ +/** + * @test + * @bug 6835393 + * @summary Tests that MidiFileReader correctly reads sequences with different division types + * @author Alex Menkov + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import javax.sound.midi.InvalidMidiDataException; +import javax.sound.midi.MidiSystem; +import javax.sound.midi.Sequence; + +public class SMPTESequence { + + static int failed = 0; + + public static void main(String[] args) { + test(Sequence.PPQ); + test(Sequence.SMPTE_24); + test(Sequence.SMPTE_25); + test(Sequence.SMPTE_30); + test(Sequence.SMPTE_30DROP); + + if (failed > 0) { + throw new RuntimeException("" + failed + " tests failed"); + } + } + + static boolean test(float divisionType) { + boolean result = false; + try { + log("Testing divisionType == " + divisionType); + Sequence sequence = new Sequence(divisionType, 16, 1); + float div1 = sequence.getDivisionType(); + + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + MidiSystem.write(sequence, 1, outStream); + + InputStream inStream = new ByteArrayInputStream(outStream.toByteArray()); + + sequence = MidiSystem.getSequence(inStream); + float div2 = sequence.getDivisionType(); + + log("After write/read got divisionType == " + div2); + if (Math.abs(div2 - div1) < 0.001f) { + result = true; + } + } catch (InvalidMidiDataException ex) { + log(ex); + } catch (IOException ex) { + log(ex); + } catch (IllegalArgumentException ex) { + log(ex); + } + if (result) { + log("OK"); + } else { + log("FAIL"); + failed++; + } + return result; + } + + static void log(String s) { + System.out.println(s); + } + + static void log(Exception ex) { + log("got exception (" + ex.getClass().getSimpleName() + "): " + ex.getMessage()); + } + +} diff --git a/test/javax/sound/midi/Sequencer/SequencerImplicitSynthOpen.java b/test/javax/sound/midi/Sequencer/SequencerImplicitSynthOpen.java new file mode 100644 index 0000000000000000000000000000000000000000..f305d331bbc116c23b4bd583489774833e79e4d8 --- /dev/null +++ b/test/javax/sound/midi/Sequencer/SequencerImplicitSynthOpen.java @@ -0,0 +1,110 @@ +/** + * @test + * @bug 6660470 + * @summary Tests that sequencer correctly opens/closes (implicitly) devices + * @author Alex Menkov + */ + +import java.util.List; +import javax.sound.midi.MidiDevice; +import javax.sound.midi.MidiDeviceReceiver; +import javax.sound.midi.MidiSystem; +import javax.sound.midi.MidiUnavailableException; +import javax.sound.midi.Receiver; +import javax.sound.midi.Sequencer; +import javax.sound.midi.Transmitter; + +public class SequencerImplicitSynthOpen { + + static int TEST_COUNT = 5; + + public static void main(String[] args) { + try { + log("getting sequencer..."); + Sequencer sequencer = MidiSystem.getSequencer(); + log(" - got " + getDeviceStr(sequencer)); + + // obtain connected device (usually synthesizer) + MidiDevice synth = getConnectedDevice(sequencer); + if (synth == null) { + log("could not get connected device, returning"); + return; + } + + log("connected device: " + getDeviceStr(synth)); + + int success = 0; + for (int i=0; i trans = sequencer.getTransmitters(); + log(" sequencer has " + trans.size() + " opened transmitters:"); + for (Transmitter tr: trans) { + Receiver r = tr.getReceiver(); + log(" " + getClassStr(tr) + " connected to " + getClassStr(r)); + if (r instanceof MidiDeviceReceiver) { + MidiDeviceReceiver recv = (MidiDeviceReceiver)r; + MidiDevice dev = recv.getMidiDevice(); + log(" - receiver of " + getClassStr(dev)); + return dev; + } else { + log(" - does NOT implement MidiDeviceReceiver"); + } + } + return null; + } + + static String getClassStr(Object o) { + if (o == null) { + return ""; + } + return o.getClass().getName(); + } + + static String getDeviceStr(MidiDevice dev) { + if (dev == null) { + return "NULL"; + } + return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); + } + + static void log(String s) { + System.out.println(s); + } + +} diff --git a/test/javax/sound/sampled/Clip/ClipSetPos.java b/test/javax/sound/sampled/Clip/ClipSetPos.java new file mode 100644 index 0000000000000000000000000000000000000000..2968c9b735f6c13e4873b189a464aaf2645dcfd8 --- /dev/null +++ b/test/javax/sound/sampled/Clip/ClipSetPos.java @@ -0,0 +1,90 @@ +/* + * 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. + */ + +/** + * @test + * @bug 6801206 + * @summary Tests that Clip sets frame position + * @author Alex Menkov + */ + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.sound.sampled.LineUnavailableException; + +public class ClipSetPos { + + final static AudioFormat audioFormat = new AudioFormat(44100f, 16, 2, true, true); + final static int frameLength = 44100 * 2; // 2 seconds + final static byte[] dataBuffer + = new byte[frameLength * (audioFormat.getSampleSizeInBits()/8) + * audioFormat.getChannels()]; + final static int MAX_FRAME_DELTA = 20; + + public static void main(String[] args) { + boolean testPassed = true; + Clip clip = null; + try { + clip = AudioSystem.getClip(); + clip.open(audioFormat, dataBuffer, 0, dataBuffer.length); + } catch (LineUnavailableException ex) { + log(ex); + log("Cannot test (this is not failure)"); + return; + } + + log("clip: " + clip.getClass().getName()); + + int len = clip.getFrameLength(); + for (int pos=0; pos < len; pos += (len /100)) { + clip.setFramePosition(pos); + int curPos = clip.getFramePosition(); + if (Math.abs(pos - curPos) > MAX_FRAME_DELTA) { + log("Tried to set pos to " + pos + ", but got back " + curPos); + testPassed = false; + } else { + log("Sucessfully set pos to " + pos); + } + } + clip.close(); + + if (testPassed) { + log("Test PASSED."); + } else { + log("Test FAILED."); + throw new RuntimeException("Test FAILED (see log)"); + } + } + + static void log(String s) { + System.out.println(s); + } + + static void log(Exception ex) { + ex.printStackTrace(System.out); + } + +} diff --git a/test/javax/sound/sampled/FileWriter/AlawEncoderSync.java b/test/javax/sound/sampled/FileWriter/AlawEncoderSync.java new file mode 100644 index 0000000000000000000000000000000000000000..8d378a52283ff05e42d320121c9c103408356a49 --- /dev/null +++ b/test/javax/sound/sampled/FileWriter/AlawEncoderSync.java @@ -0,0 +1,113 @@ +/** + * @test + * @bug 6938426 + * @summary Tests that Alaw encoder works properly in multithreaded environment + * @author Alex Menkov + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.util.Arrays; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + +public class AlawEncoderSync { + + static final int THREAD_COUNT = 20; + + static final AudioFormat pcmFormat = new AudioFormat(8000f, 16, 2, true, false); + static final int STREAM_LENGTH = 10; // in seconds + static byte[] pcmBuffer; + static final AudioFormat alawFormat + = new AudioFormat(AudioFormat.Encoding.ALAW, 8000f, 8, 2, 2, 8000f, false); + + static final ConversionThread[] threads = new ConversionThread[THREAD_COUNT]; + + public static void main(String[] args) { + preparePCMBuffer(); + log("pcmStream size: " + pcmBuffer.length); + + for (int i=0; i 0) { + throw new RuntimeException("test FAILED"); + } + log("test PASSED."); + } + + + static void preparePCMBuffer() { + pcmBuffer = new byte[STREAM_LENGTH * (int)pcmFormat.getSampleRate() + * (pcmFormat.getSampleSizeInBits() / 8) * pcmFormat.getChannels()]; + for (int i=0; i= 0 ? length : "unspecified") + + ", output: " + (isFile ? "File" : "OutputStream")); + AudioInputStream inStream = new ThrowAfterCloseStream( + new ByteArrayInputStream(dataBuffer), audioFormat, length); + + AudioSystem.isFileTypeSupported(fileType, inStream); + + try { + if (isFile) { + File f = File.createTempFile("WriterCloseInput" + testTotal, "tmp"); + AudioSystem.write(inStream, fileType, f); + f.delete(); + } else { + OutputStream outStream = new NullOutputStream(); + AudioSystem.write(inStream, fileType, outStream); + } + } catch (Exception ex) { + // this is not failure + out("SKIPPED (AudioSystem.write exception): " + ex.getMessage()); + //out(ex); + inStream = null; + } + + if (inStream != null) { + try { + // test if the stream is closed + inStream.available(); + out("PASSED"); + } catch (IOException ex) { + testFailed++; + out("FAILED: " + ex.getMessage()); + //out(ex); + } + } + out(""); + } + + static class ThrowAfterCloseStream extends AudioInputStream { + private boolean closed = false; + public ThrowAfterCloseStream(InputStream in, AudioFormat format, long length) { + super(in, format, length); + } + @Override + public void close() { + closed = true; + } + @Override + public int available() throws IOException { + if (closed) { + throw new IOException("The stream has been closed"); + } + return 1; + } + } + + static class NullOutputStream extends OutputStream { + @Override + public void write(int b) throws IOException { + // nop + } + } + + static void out(String s) { + System.out.println(s); + } + + static void out(Exception ex) { + ex.printStackTrace(System.out); + } +} diff --git a/test/javax/swing/regtesthelpers/Util.java b/test/javax/swing/regtesthelpers/Util.java new file mode 100644 index 0000000000000000000000000000000000000000..5da14b9396a6d26faf997ea25e7dd0b557e268bb --- /dev/null +++ b/test/javax/swing/regtesthelpers/Util.java @@ -0,0 +1,75 @@ +/* + * 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 javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +/** + *

    This class contains utilities useful for regression testing. + *

    When using jtreg you would include this class via something like: + *

    + *
    + * @library ../../regtesthelpers
    + * @build Util
    + * 
    + */ + +public class Util { + /** + * Convert a rectangle from coordinate system of Component c to + * screen coordinate system. + * + * @param r a non-null Rectangle + * @param c a Component whose coordinate system is used for conversion + */ + public static void convertRectToScreen(Rectangle r, Component c) { + Point p = new Point(r.x, r.y); + SwingUtilities.convertPointToScreen(p, c); + r.x = p.x; + r.y = p.y; + } + + /** + * Compares two bufferedImages pixel-by-pixel. + * return true if all pixels in the two areas are identical + */ + public static boolean compareBufferedImages(BufferedImage bufferedImage0, BufferedImage bufferedImage1) { + int width = bufferedImage0.getWidth(); + int height = bufferedImage0.getHeight(); + + if (width != bufferedImage1.getWidth() || height != bufferedImage1.getHeight()) { + return false; + } + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + if (bufferedImage0.getRGB(x, y) != bufferedImage1.getRGB(x, y)) { + return false; + } + } + } + + return true; + } +} diff --git a/test/javax/swing/text/CSSBorder/6796710/bug6796710.java b/test/javax/swing/text/CSSBorder/6796710/bug6796710.java new file mode 100644 index 0000000000000000000000000000000000000000..1ff87aad4d1406942795b0e8cf5d2e019d4ced55 --- /dev/null +++ b/test/javax/swing/text/CSSBorder/6796710/bug6796710.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +/* + * @test + * @bug 6796710 + * @summary Html content in JEditorPane is overlapping on swing components while resizing the application. + * @library ../../../regtesthelpers + * @build Util + * @author Pavel Porvatov + @run main bug6796710 + */ + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class bug6796710 { + // The page is inlined because we want to be sure that the JEditorPane filled synchronously + public static final String TEXT = "" + + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + "
    Col1Col2Col3
    1. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.2. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.3. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.
    " + + "" + + ""; + + private static Robot robot; + + private static JFrame frame; + + private static JPanel pnBottom; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + + pnBottom = new JPanel(); + pnBottom.add(new JLabel("Some label")); + pnBottom.add(new JButton("A button")); + + JEditorPane editorPane = new JEditorPane(); + + editorPane.setContentType("text/html"); + editorPane.setText(TEXT); + editorPane.setEditable(false); + + JPanel pnContent = new JPanel(new BorderLayout()); + + pnContent.add(new JScrollPane(editorPane), BorderLayout.CENTER); + pnContent.add(pnBottom, BorderLayout.SOUTH); + + frame.setContentPane(pnContent); + frame.setSize(400, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } + }); + + robot.waitForIdle(); + + BufferedImage bufferedImage = getPnBottomImage(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setSize(400, 150); + } + }); + + robot.waitForIdle(); + + if (!Util.compareBufferedImages(bufferedImage, getPnBottomImage())) { + throw new RuntimeException("The test failed"); + } + + System.out.println("The test bug6796710 passed."); + } + + private static BufferedImage getPnBottomImage() { + Rectangle rect = pnBottom.getBounds(); + + Util.convertRectToScreen(rect, pnBottom.getParent()); + + return robot.createScreenCapture(rect); + } +} diff --git a/test/sun/misc/BootClassLoaderHook/TestHook.java b/test/sun/misc/BootClassLoaderHook/TestHook.java deleted file mode 100644 index da5f505d843bfff1a97ec6f5c6ec9af42a144226..0000000000000000000000000000000000000000 --- a/test/sun/misc/BootClassLoaderHook/TestHook.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.util.TreeSet; -import java.util.Set; -import java.net.URLStreamHandlerFactory; -import sun.misc.BootClassLoaderHook; -import sun.misc.URLClassPath; - - -/* @test - * @bug 6888802 - * @summary Sanity test of BootClassLoaderHook interface - * - * @build TestHook - * @run main TestHook - */ - -public class TestHook extends BootClassLoaderHook { - - private static final TestHook hook = new TestHook(); - private static Set names = new TreeSet(); - private static final String LOGRECORD_CLASS = - "java.util.logging.LogRecord"; - private static final String NONEXIST_RESOURCE = - "non.exist.resource"; - private static final String LIBHELLO = "hello"; - - public static void main(String[] args) throws Exception { - BootClassLoaderHook.setHook(hook); - if (BootClassLoaderHook.getHook() == null) { - throw new RuntimeException("Null boot classloader hook "); - } - - testHook(); - - if (!names.contains(LOGRECORD_CLASS)) { - throw new RuntimeException("loadBootstrapClass for " + LOGRECORD_CLASS + " not called"); - } - - if (!names.contains(NONEXIST_RESOURCE)) { - throw new RuntimeException("getBootstrapResource for " + NONEXIST_RESOURCE + " not called"); - } - if (!names.contains(LIBHELLO)) { - throw new RuntimeException("loadLibrary for " + LIBHELLO + " not called"); - } - - Set copy = new TreeSet(); - copy.addAll(names); - for (String s : copy) { - System.out.println(" Loaded " + s); - } - } - - private static void testHook() throws Exception { - Class.forName(LOGRECORD_CLASS); - ClassLoader.getSystemResource(NONEXIST_RESOURCE); - try { - System.loadLibrary(LIBHELLO); - } catch (UnsatisfiedLinkError e) { - } - } - - public String loadBootstrapClass(String className) { - names.add(className); - return null; - } - - public String getBootstrapResource(String resourceName) { - names.add(resourceName); - return null; - } - - public boolean loadLibrary(String libname) { - names.add(libname); - return false; - } - - public URLClassPath getBootstrapClassPath(URLClassPath bcp, - URLStreamHandlerFactory factory) { - return bcp; - } - - public boolean isCurrentThreadPrefetching() { - return false; - } - - public boolean prefetchFile(String name) { - return false; - } -} diff --git a/test/sun/security/pkcs11/Cipher/TestRSACipher.java b/test/sun/security/pkcs11/Cipher/TestRSACipher.java index f1adba35d2331f927ef4c4e04704392657c09a2c..4f27ff5de0c13d8dde3180a4c7a8126459621983 100644 --- a/test/sun/security/pkcs11/Cipher/TestRSACipher.java +++ b/test/sun/security/pkcs11/Cipher/TestRSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 4898468 + * @bug 4898468 6994008 * @summary basic test for RSA cipher * @author Andreas Sterbenz * @library .. @@ -38,9 +38,12 @@ import javax.crypto.*; public class TestRSACipher extends PKCS11Test { + private static final String[] RSA_ALGOS = + { "RSA/ECB/PKCS1Padding", "RSA" }; + public void main(Provider p) throws Exception { try { - Cipher.getInstance("RSA/ECB/PKCS1Padding", p); + Cipher.getInstance(RSA_ALGOS[0], p); } catch (GeneralSecurityException e) { System.out.println("Not supported by provider, skipping"); return; @@ -55,57 +58,58 @@ public class TestRSACipher extends PKCS11Test { b = new byte[16]; random.nextBytes(b); - Cipher c1 = Cipher.getInstance("RSA/ECB/PKCS1Padding", p); - Cipher c2 = Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunJCE"); - - c1.init(Cipher.ENCRYPT_MODE, publicKey); - e = c1.doFinal(b); - c1.init(Cipher.DECRYPT_MODE, privateKey); - d = c1.doFinal(e); - match(b, d); - c2.init(Cipher.DECRYPT_MODE, privateKey); - d = c2.doFinal(e); - match(b, d); + for (String rsaAlgo: RSA_ALGOS) { + Cipher c1 = Cipher.getInstance(rsaAlgo, p); + Cipher c2 = Cipher.getInstance(rsaAlgo, "SunJCE"); - // invalid data - c1.init(Cipher.DECRYPT_MODE, publicKey); - try { + c1.init(Cipher.ENCRYPT_MODE, publicKey); + e = c1.doFinal(b); + c1.init(Cipher.DECRYPT_MODE, privateKey); d = c1.doFinal(e); - throw new Exception("completed call"); - } catch (BadPaddingException ee) { - ee.printStackTrace(); - } - - c1.init(Cipher.ENCRYPT_MODE, privateKey); - e = c1.doFinal(b); - c1.init(Cipher.DECRYPT_MODE, publicKey); - d = c1.doFinal(e); - match(b, d); - c2.init(Cipher.DECRYPT_MODE, publicKey); - d = c2.doFinal(e); - match(b, d); - - // reinit tests - c1.init(Cipher.ENCRYPT_MODE, privateKey); - c1.init(Cipher.ENCRYPT_MODE, privateKey); - e = c1.doFinal(b); - e = c1.doFinal(b); - c1.update(b); - c1.update(b); - c1.init(Cipher.ENCRYPT_MODE, privateKey); - e = c1.doFinal(); - e = c1.doFinal(); - c1.update(b); - e = c1.doFinal(); - - c1.update(new byte[256]); - try { + match(b, d); + c2.init(Cipher.DECRYPT_MODE, privateKey); + d = c2.doFinal(e); + match(b, d); + + // invalid data + c1.init(Cipher.DECRYPT_MODE, publicKey); + try { + d = c1.doFinal(e); + throw new Exception("completed call"); + } catch (BadPaddingException ee) { + ee.printStackTrace(); + } + + c1.init(Cipher.ENCRYPT_MODE, privateKey); + e = c1.doFinal(b); + c1.init(Cipher.DECRYPT_MODE, publicKey); + d = c1.doFinal(e); + match(b, d); + c2.init(Cipher.DECRYPT_MODE, publicKey); + d = c2.doFinal(e); + match(b, d); + + // reinit tests + c1.init(Cipher.ENCRYPT_MODE, privateKey); + c1.init(Cipher.ENCRYPT_MODE, privateKey); + e = c1.doFinal(b); + e = c1.doFinal(b); + c1.update(b); + c1.update(b); + c1.init(Cipher.ENCRYPT_MODE, privateKey); + e = c1.doFinal(); + e = c1.doFinal(); + c1.update(b); e = c1.doFinal(); - throw new Exception("completed call"); - } catch (IllegalBlockSizeException ee) { - System.out.println(ee); - } + c1.update(new byte[256]); + try { + e = c1.doFinal(); + throw new Exception("completed call"); + } catch (IllegalBlockSizeException ee) { + System.out.println(ee); + } + } } private static void match(byte[] b1, byte[] b2) throws Exception { diff --git a/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java b/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java index 159bb50a029b8350a71949b647f354a633d83e23..c00b39942cc803e0973b4de83a04ff9cbbec91bf 100644 --- a/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java +++ b/test/sun/security/pkcs11/Cipher/TestRSACipherWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 6572331 + * @bug 6572331 6994008 * @summary basic test for RSA cipher key wrapping functionality * @author Valerie Peng * @library .. @@ -38,47 +38,48 @@ import javax.crypto.spec.SecretKeySpec; public class TestRSACipherWrap extends PKCS11Test { - private static final String RSA_ALGO = "RSA/ECB/PKCS1Padding"; + private static final String[] RSA_ALGOS = + { "RSA/ECB/PKCS1Padding", "RSA" }; public void main(Provider p) throws Exception { try { - Cipher.getInstance(RSA_ALGO, p); + Cipher.getInstance(RSA_ALGOS[0], p); } catch (GeneralSecurityException e) { - System.out.println("Not supported by provider, skipping"); + System.out.println(RSA_ALGOS[0] + " unsupported, skipping"); return; } KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); kpg.initialize(1024); KeyPair kp = kpg.generateKeyPair(); - PublicKey publicKey = kp.getPublic(); - PrivateKey privateKey = kp.getPrivate(); - Cipher cipherPKCS11 = Cipher.getInstance(RSA_ALGO, p); - Cipher cipherJce = Cipher.getInstance(RSA_ALGO, "SunJCE"); + for (String rsaAlgo: RSA_ALGOS) { + Cipher cipherPKCS11 = Cipher.getInstance(rsaAlgo, p); + Cipher cipherJce = Cipher.getInstance(rsaAlgo, "SunJCE"); - String algos[] = {"AES", "RC2", "Blowfish"}; - int keySizes[] = {128, 256}; + String algos[] = {"AES", "RC2", "Blowfish"}; + int keySizes[] = {128, 256}; - for (int j = 0; j < algos.length; j++) { - String algorithm = algos[j]; - KeyGenerator keygen = + for (int j = 0; j < algos.length; j++) { + String algorithm = algos[j]; + KeyGenerator keygen = KeyGenerator.getInstance(algorithm); - for (int i = 0; i < keySizes.length; i++) { - SecretKey secretKey = null; - System.out.print("Generate " + keySizes[i] + "-bit " + + for (int i = 0; i < keySizes.length; i++) { + SecretKey secretKey = null; + System.out.print("Generate " + keySizes[i] + "-bit " + algorithm + " key using "); - try { - keygen.init(keySizes[i]); - secretKey = keygen.generateKey(); - System.out.println(keygen.getProvider().getName()); - } catch (InvalidParameterException ipe) { - secretKey = new SecretKeySpec(new byte[32], algorithm); - System.out.println("SecretKeySpec class"); + try { + keygen.init(keySizes[i]); + secretKey = keygen.generateKey(); + System.out.println(keygen.getProvider().getName()); + } catch (InvalidParameterException ipe) { + secretKey = new SecretKeySpec(new byte[32], algorithm); + System.out.println("SecretKeySpec class"); + } + test(kp, secretKey, cipherPKCS11, cipherJce); + test(kp, secretKey, cipherPKCS11, cipherPKCS11); + test(kp, secretKey, cipherJce, cipherPKCS11); } - test(kp, secretKey, cipherPKCS11, cipherJce); - test(kp, secretKey, cipherPKCS11, cipherPKCS11); - test(kp, secretKey, cipherJce, cipherPKCS11); } } } diff --git a/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java new file mode 100644 index 0000000000000000000000000000000000000000..d1dd0206031bf72d6f5f67a516618c33f3b0fed5 --- /dev/null +++ b/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/** + * @test + * @bug 6994008 + * @summary basic test for RSA/ECB/NoPadding cipher + * @author Valerie Peng + * @library .. + */ + +import javax.crypto.*; +import java.io.*; +import javax.crypto.spec.SecretKeySpec; +import java.security.*; +import java.util.*; + +public class TestRawRSACipher extends PKCS11Test { + + public void main(Provider p) throws Exception { + try { + Cipher.getInstance("RSA/ECB/NoPadding", p); + } catch (GeneralSecurityException e) { + System.out.println("Not supported by provider, skipping"); + return; + } + + final int KEY_LEN = 1024; + KeyPairGenerator kpGen = KeyPairGenerator.getInstance("RSA", p); + kpGen.initialize(KEY_LEN); + KeyPair kp = kpGen.generateKeyPair(); + Random random = new Random(); + byte[] plainText, cipherText, recoveredText; + plainText = new byte[KEY_LEN/8]; + random.nextBytes(plainText); + plainText[0] = 0; // to ensure that it's less than modulus + + Cipher c1 = Cipher.getInstance("RSA/ECB/NoPadding", p); + Cipher c2 = Cipher.getInstance("RSA/ECB/NoPadding", "SunJCE"); + + c1.init(Cipher.ENCRYPT_MODE, kp.getPublic()); + c2.init(Cipher.DECRYPT_MODE, kp.getPrivate()); + + cipherText = c1.doFinal(plainText); + recoveredText = c2.doFinal(cipherText); + if (!Arrays.equals(plainText, recoveredText)) { + throw new RuntimeException("E/D Test against SunJCE Failed!"); + } + + c2.init(Cipher.ENCRYPT_MODE, kp.getPublic()); + c1.init(Cipher.DECRYPT_MODE, kp.getPrivate()); + cipherText = c2.doFinal(plainText); + recoveredText = c1.doFinal(cipherText); + if (!Arrays.equals(plainText, recoveredText)) { + throw new RuntimeException("D/E Test against SunJCE Failed!"); + } + + System.out.println("Test Passed"); + } + + public static void main(String[] args) throws Exception { + main(new TestRawRSACipher()); + } +} diff --git a/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java index b8a6dcced6688ad0a27114adb7f2aa54f125dd0a..14e41cdddd2a55cc280e664a55f39ca281585fa5 100644 --- a/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java +++ b/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -23,7 +23,7 @@ /** * @test %I% %E% - * @bug 4898461 + * @bug 4898461 6604496 * @summary basic test for symmetric ciphers with padding * @author Valerie Peng * @library .. @@ -70,9 +70,13 @@ public class TestSymmCiphers extends PKCS11Test { new CI("DES/ECB/PKCS5Padding", "DES", 6400), new CI("DESede/ECB/PKCS5Padding", "DESede", 400), new CI("AES/ECB/PKCS5Padding", "AES", 64), + new CI("DES", "DES", 6400), new CI("DESede", "DESede", 408), - new CI("AES", "AES", 128) + new CI("AES", "AES", 128), + + new CI("AES/CTR/NoPadding", "AES", 3200) + }; private static StringBuffer debugBuf = new StringBuffer(); diff --git a/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java index 5c2e939e8bd01ace9d62c4ee1b26697c2d1ac320..5f94ea48f57eeec9830c5571db6b163e70db8450 100644 --- a/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java +++ b/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 4898484 + * @bug 4898484 6604496 * @summary basic test for symmetric ciphers with no padding * @author Valerie Peng * @library .. @@ -59,7 +59,8 @@ public class TestSymmCiphersNoPad extends PKCS11Test { new CI("DES/CBC/NoPadding", "DES", 400), new CI("DESede/CBC/NoPadding", "DESede", 160), new CI("AES/CBC/NoPadding", "AES", 4800), - new CI("Blowfish/CBC/NoPadding", "Blowfish", 24) + new CI("Blowfish/CBC/NoPadding", "Blowfish", 24), + new CI("AES/CTR/NoPadding", "AES", 1600) }; private static StringBuffer debugBuf; diff --git a/test/sun/security/tools/jarsigner/crl.sh b/test/sun/security/tools/jarsigner/crl.sh index b563c523cc4eb5130492816e3768756199abc0f4..2d7f5237ba3cd5a76e1d539da92b0b2da062bb23 100644 --- a/test/sun/security/tools/jarsigner/crl.sh +++ b/test/sun/security/tools/jarsigner/crl.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 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 @@ -32,9 +32,6 @@ if [ "${TESTJAVA}" = "" ] ; then fi # set platform-dependent variables -# PF: platform name, say, solaris-sparc - -PF="" OS=`uname -s` case "$OS" in @@ -47,54 +44,28 @@ case "$OS" in esac KS=crl.jks -JFILE=crl.jar KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS" -JAR=$TESTJAVA${FS}bin${FS}jar -JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner -rm $KS $JFILE 2> /dev/null +rm $KS 2> /dev/null -# Generates some crl files, each containing two entries +# Test keytool -gencrl $KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300 -$KT -alias a -gencrl -id 1:1 -id 2:2 -file crl1 -$KT -alias a -gencrl -id 3:3 -id 4:4 -file crl2 -$KT -alias b -dname CN=b -keyalg rsa -genkey -validity 300 -$KT -alias b -gencrl -id 5:1 -id 6:2 -file crl3 - -cat > ToURI.java < uri -$KT -alias c -dname CN=c -keyalg rsa -genkey -validity 300 \ - -ext crl=uri:`cat uri` +$KT -alias a -gencrl -id 1:1 -id 2:2 -file crl1 || exit 1 +$KT -alias a -gencrl -id 3:3 -id 4:4 -file crl2 || exit 2 +$KT -alias a -gencrl -id 5:1 -id 6:2 -file crl3 || exit 4 -echo A > A +# Test keytool -printcrl -# Test -crl:auto, cRLDistributionPoints is a local file +$KT -printcrl -file crl1 || exit 5 +$KT -printcrl -file crl2 || exit 6 +$KT -printcrl -file crl3 || exit 7 -$JAR cvf $JFILE A -$JARSIGNER -keystore $KS -storepass changeit $JFILE c \ - -crl:auto || exit 1 -$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 6 -$KT -printcert -jarfile $JFILE | grep CRLs || exit 7 -# Test -crl +# Test keytool -ext crl -$JAR cvf $JFILE A -$JARSIGNER -keystore $KS -storepass changeit $JFILE a \ - -crl crl1 -crl crl2 || exit 2 -$JARSIGNER -keystore $KS -storepass changeit $JFILE b \ - -crl crl3 -crl crl2 || exit 3 -$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 3 -$KT -printcert -jarfile $JFILE | grep CRLs || exit 4 -CRLCOUNT=`$KT -printcert -jarfile $JFILE | grep SerialNumber | wc -l` -if [ $CRLCOUNT != 8 ]; then exit 5; fi +$KT -alias b -dname CN=c -keyalg rsa -genkey -validity 300 \ + -ext crl=uri:http://www.example.com/crl || exit 10 exit 0 diff --git a/test/sun/security/tools/keytool/NewSize7.java b/test/sun/security/tools/keytool/NewSize7.java index d9ff1f5540279435cda66e2005bfd9886e7229e4..ab8ef5cb59a01fedb176fceed82f8133074013d7 100644 --- a/test/sun/security/tools/keytool/NewSize7.java +++ b/test/sun/security/tools/keytool/NewSize7.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -29,6 +29,8 @@ import java.io.File; import java.io.FileInputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.security.KeyStore; import java.security.cert.X509Certificate; import java.security.interfaces.RSAPublicKey; @@ -42,8 +44,10 @@ public class NewSize7 { " -alias a -dname cn=c -storepass changeit" + " -keypass changeit -keyalg rsa").split(" ")); KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(FILE), null); - new File(FILE).delete(); + try (FileInputStream fin = new FileInputStream(FILE)) { + ks.load(fin, null); + } + Files.delete(Paths.get(FILE)); RSAPublicKey r = (RSAPublicKey)ks.getCertificate("a").getPublicKey(); if (r.getModulus().bitLength() != 2048) { throw new Exception("Bad keysize"); diff --git a/test/sun/tools/native2ascii/Native2AsciiTests.sh b/test/sun/tools/native2ascii/Native2AsciiTests.sh index 8c32cf8423dfa5a73a161e62a8a48b81d0a8ac36..82ee282bda3f72f4f6e5bf8bb8fc5268eef32c1e 100644 --- a/test/sun/tools/native2ascii/Native2AsciiTests.sh +++ b/test/sun/tools/native2ascii/Native2AsciiTests.sh @@ -24,7 +24,7 @@ # # @test -# @bug 4630463 4630971 4636448 4701617 4721296 4710890 6247817 +# @bug 4630463 4630971 4636448 4701617 4721296 4710890 6247817 7021987 # @summary Tests miscellaneous native2ascii bugfixes and regressions @@ -100,6 +100,15 @@ rm -f x.* $N2A -reverse -encoding MS932 $TESTSRC/A2N_4701617 x.out check 4701617 $TESTSRC/A2N_4701617.expected x.out +# Check that the inputfile appears in the error message when not found + +badin="DoesNotExist" +$N2A $badin x.out | grep "$badin" > /dev/null +if [ $? != 0 ]; then + echo "\"$badin\" expected to appear in error message" + exit 1 +fi + # for win32 only ensure when output file pre-exists that # native2ascii tool will simply overwrite with the expected # output file (fixed bugID 4710890)