diff --git a/.hgtags b/.hgtags index 73634a197c734af0ffb96e2dd99ce672701e2447..1d2a3d286ba0bb6648d2d01249fda2f48437c81d 100644 --- a/.hgtags +++ b/.hgtags @@ -42,3 +42,4 @@ a50217eb3ee10b9f9547e0708e5c9625405083ef jdk7-b64 382a27aa78d3236fa123c60577797a887fe93e09 jdk7-b65 bd31b30a5b21f20e42965b1633f18a5c7946d398 jdk7-b66 a952aafd5181af953b0ef3010dbd2fcc28460e8a jdk7-b67 +b23d905cb5d3b382295240d28ab0bfb266b4503c jdk7-b68 diff --git a/make/com/sun/crypto/provider/Makefile b/make/com/sun/crypto/provider/Makefile index 5dccb9f81b3e169ab634dc9dd6d7a30f46888e3e..8cf809dc46964cb809f7eefa72778862db6c5696 100644 --- a/make/com/sun/crypto/provider/Makefile +++ b/make/com/sun/crypto/provider/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -45,54 +45,49 @@ # For OpenJDK, the jar files built here are installed directly into the # OpenJDK. # -# For JDK, the binaries use pre-built/pre-signed/pre-obfuscated binary -# files stored in the closed workspace that are not shipped in the -# OpenJDK workspaces. We still build the JDK files here to verify the -# files compile, and in preparation for possible signing and -# obfuscation. Developers working on JCE in JDK must sign the JCE files -# before testing: obfuscation is optional during development. The JCE -# signing key is kept separate from the JDK workspace to prevent its -# disclosure. The obfuscation tool has not been licensed for general -# usage. -# +# For JDK, the binaries use pre-built/pre-signed binary files stored in +# the closed workspace that are not shipped in the OpenJDK workspaces. +# We still build the JDK files here to verify the files compile, and in +# preparation for possible signing. Developers working on JCE in JDK +# must sign the JCE files before testing. The JCE signing key is kept +# separate from the JDK workspace to prevent its disclosure. +# # SPECIAL NOTE TO JCE/JDK developers: The source files must eventually -# be built, obfuscated, signed, and then the resulting jar files MUST BE -# CHECKED INTO THE CLOSED PART OF THE WORKSPACE*. This separate step -# *MUST NOT BE FORGOTTEN*, otherwise a bug fixed in the source code will -# not be reflected in the shipped binaries. The "release" target should be +# be built and signed, and the resulting jar files MUST BE CHECKED INTO +# THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT BE +# FORGOTTEN*, otherwise a bug fixed in the source code will not be +# reflected in the shipped binaries. The "release" target should be # used to generate the required files. # # There are a number of targets to help both JDK/OpenJDK developers. # # Main Targets (JDK/OPENJDK): # -# all/clobber/clean The usual. -# If OpenJDK, installs sunjce_provider.jar. -# If JDK, installs prebuilt -# sunjce_provider.jar. +# all/clobber/clean The usual. +# If OpenJDK, installs sunjce_provider.jar. +# If JDK, installs prebuilt +# sunjce_provider.jar. # -# jar Builds/installs sunjce_provider.jar -# If OpenJDK, does not sign. -# If JDK, tries to sign. +# jar Builds/installs sunjce_provider.jar +# If OpenJDK, does not sign. +# If JDK, tries to sign. # # Other lesser-used Targets (JDK/OPENJDK): # -# build-jar Builds sunjce_provider.jar -# (does not sign/install) +# build-jar Builds sunjce_provider.jar +# (does not sign/install) # -# install-jar Alias for "jar" above. +# install-jar Alias for "jar" above. # # Other targets (JDK only): # -# sign Alias for sign-jar -# sign-jar Builds/signs sunjce_provider.jar (no install) -# -# obfus Builds/obfuscates/signs sunjce_provider.jar +# sign Alias for sign-jar +# sign-jar Builds/signs sunjce_provider.jar (no install) # -# release Builds all targets in preparation -# for workspace integration. +# release Builds all targets in preparation +# for workspace integration. # -# install-prebuilt Installs the pre-built jar files +# install-prebuilt Installs the pre-built jar files # # This makefile was written to support parallel target execution. # @@ -103,7 +98,7 @@ PRODUCT = sun # # The following is for when we need to do postprocessing -# (signing/obfuscation) against a read-only build. If the OUTPUTDIR +# (signing) against a read-only build. If the OUTPUTDIR # isn't writable, the build currently crashes out. # ifndef OPENJDK @@ -158,8 +153,8 @@ endif # OPENJDK # # We use a variety of subdirectories in the $(TEMPDIR) depending on what # part of the build we're doing. Both OPENJDK/JDK builds are initially -# done in the unsigned area. When files are signed or obfuscated in JDK, -# they will be placed in the appropriate areas. +# done in the unsigned area. When files are signed in JDK, they will be +# placed in the appropriate areas. # UNSIGNED_DIR = $(TEMPDIR)/unsigned @@ -223,62 +218,15 @@ $(SIGNED_DIR)/sunjce_provider.jar: endif $(call sign-file, $(UNSIGNED_DIR)/sunjce_provider.jar) -# ===================================================== -# Obfuscate/sign/install the JDK build. Not needed for OpenJDK. -# - -OBFUS_DIR = $(JCE_BUILD_DIR)/obfus/sunjce - -CLOSED_DIR = $(BUILDDIR)/closed/com/sun/crypto/provider - -obfus: $(OBFUS_DIR)/sunjce_provider.jar - $(release-warning) - -ifndef ALT_JCE_BUILD_DIR -$(OBFUS_DIR)/sunjce_provider.jar: build-jar $(JCE_MANIFEST_FILE) \ - $(OBFUS_DIR)/sunjce.dox -else -$(OBFUS_DIR)/sunjce_provider.jar: $(JCE_MANIFEST_FILE) $(OBFUS_DIR)/sunjce.dox - @if [ ! -d $(CLASSDESTDIR) ] ; then \ - $(ECHO) "Couldn't find $(CLASSDESTDIR)"; \ - exit 1; \ - fi -endif - @$(ECHO) ">>>Obfuscating SunJCE Provider..." - $(presign) - $(preobfus) - $(prep-target) - $(CD) $(OBFUS_DIR); \ - $(OBFUSCATOR) -fv sunjce.dox - @$(CD) $(OBFUS_DIR); $(java-vm-cleanup) - $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ \ - -C $(OBFUS_DIR)/build com \ - $(BOOT_JAR_JFLAGS) - $(sign-target) - @$(java-vm-cleanup) - -$(OBFUS_DIR)/sunjce.dox: $(CLOSED_DIR)/obfus/sunjce.dox - @$(ECHO) ">>>Creating sunjce.dox" - $(prep-target) - $(SED) "s:@@TEMPDIR@@:$(ABS_TEMPDIR):" $< > $@ - -# -# The current obfuscator has a limitation in that it currently only -# supports up to v49 class file format. Force v49 classfiles in our -# builds for now. -# -SOURCE_LANGUAGE_VERSION = 5 -TARGET_CLASS_VERSION = 5 - # ===================================================== -# Create the Release Engineering files. Obfuscated builds, etc. +# Create the Release Engineering files. Signed builds, etc. # -release: $(OBFUS_DIR)/sunjce_provider.jar +release: $(SIGNED_DIR)/sunjce_provider.jar $(RM) $(JCE_BUILD_DIR)/release/sunjce_provider.jar $(MKDIR) -p $(JCE_BUILD_DIR)/release - $(CP) $(OBFUS_DIR)/sunjce_provider.jar $(JCE_BUILD_DIR)/release + $(CP) $(SIGNED_DIR)/sunjce_provider.jar $(JCE_BUILD_DIR)/release $(release-warning) endif # OPENJDK @@ -320,5 +268,5 @@ clobber clean:: .PHONY: build-jar jar install-jar ifndef OPENJDK -.PHONY: sign sign-jar obfus release install-prebuilt +.PHONY: sign sign-jar release install-prebuilt endif diff --git a/make/javax/crypto/Defs-jce.gmk b/make/javax/crypto/Defs-jce.gmk index 46fe1118dcac52774daa8fc986850e168b33ed51..0b75bceb98483f204e90f8422ebc6cc9a7edc037 100644 --- a/make/javax/crypto/Defs-jce.gmk +++ b/make/javax/crypto/Defs-jce.gmk @@ -1,5 +1,5 @@ # -# Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt SIGNING_ALIAS = jce_rsa # -# Defines for signing/obfuscating the various jar files. +# Defines for signing the various jar files. # define presign @@ -100,19 +100,4 @@ define sign-file $(sign-target) endef -# -# Location for the Obfuscation product. JDK currently has -# the requirement that we obfuscate our JCE jars. -# -OBFUSCATOR = /security/tools/bin/obfus -OBFUS_DIR = $(TEMPDIR)/obfus - -define preobfus - @if [ ! -f $(OBFUSCATOR) ]; then \ - $(ECHO) "\n$(OBFUSCATOR): Obfuscator *NOT* available..." \ - $(README-MAKEFILE_WARNING); \ - exit 2; \ - fi -endef - endif # !OPENJDK diff --git a/make/javax/crypto/Makefile b/make/javax/crypto/Makefile index 815a530ce274d53eb91819e9c4f59b6ac07582a4..fe07ed5edf7a33178b4528bf5b095f86d6f3eacc 100644 --- a/make/javax/crypto/Makefile +++ b/make/javax/crypto/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -44,64 +44,65 @@ # For OpenJDK, the jar files built here are installed directly into the # OpenJDK. # -# For JDK, the binaries use pre-built/pre-signed/pre-obfuscated binary -# files stored in the closed workspace that are not shipped in the -# OpenJDK workspaces. We still build the JDK files here to verify the -# files compile, and in preparation for possible signing and -# obfuscation. Developers working on JCE in JDK must sign the JCE files -# before testing: obfuscation is optional during development. The JCE -# signing key is kept separate from the JDK workspace to prevent its -# disclosure. The obfuscation tool has not been licensed for general -# usage. +# For JDK, the binaries use pre-built/pre-signed binary files stored in +# the closed workspace that are not shipped in the OpenJDK workspaces. +# We still build the JDK files here to verify the files compile, and in +# preparation for possible signing. Developers working on JCE in JDK +# must sign the JCE files before testing. The JCE signing key is kept +# separate from the JDK workspace to prevent its disclosure. # # SPECIAL NOTE TO JCE/JDK developers: The source files must eventually -# be built, obfuscated, signed, and the resulting jar files *MUST BE -# CHECKED INTO THE CLOSED PART OF THE WORKSPACE*. This separate step -# *MUST NOT BE FORGOTTEN*, otherwise a bug fixed in the source code will -# not be reflected in the shipped binaries. The "release" target should -# be used to generate the required files. +# be built and signed, and the resulting jar files *MUST BE CHECKED INTO +# THE CLOSED PART OF THE WORKSPACE*. This separate step *MUST NOT BE +# FORGOTTEN*, otherwise a bug fixed in the source code will not be +# reflected in the shipped binaries. The "release" target should be +# used to generate the required files. # # There are a number of targets to help both JDK/OpenJDK developers. # # Main Targets (JDK/OPENJDK): # -# all/clobber/clean The usual. -# If OpenJDK, installs -# jce.jar/limited policy files. -# If JDK, installs prebuilt -# jce.jar/limited policy files. -# -# jar Builds/installs jce.jar -# If OpenJDK, does not sign -# If JDK, tries to sign +# all/clobber/clean The usual. +# If OpenJDK: builds/installs the +# jce.jar/limited policy files. +# If JDK: builds but does not install. +# During full tops-down builds, +# prebuilt/presigned jce.jar & +# limited policy files are copied +# in by make/java/redist/Makefile. +# If you are working in this directory +# and want to install the prebuilts, +# use the "install-prebuilt" target. +# +# jar Builds/installs jce.jar +# If OpenJDK, does not sign +# If JDK, tries to sign # # Other lesser-used Targets (JDK/OPENJDK): # -# build-jar Builds jce.jar (does not sign/install) +# build-jar Builds jce.jar (does not sign/install) # -# build-policy Builds policy files (does not sign/install) +# build-policy Builds policy files (does not sign/install) # -# install-jar Alias for "jar" above +# install-jar Alias for "jar" above # -# install-limited Builds/installs limited policy files -# If OpenJDK, does not sign -# If JDK, tries to sign -# install-unlimited Builds/nstalls unlimited policy files -# If OpenJDK, does not sign -# If JDK, tries to sign +# install-limited Builds/installs limited policy files +# If OpenJDK, does not sign +# If JDK, tries to sign +# install-unlimited Builds/nstalls unlimited policy files +# If OpenJDK, does not sign +# If JDK, tries to sign # # Other targets (JDK only): # -# sign Alias for sign-jar and sign-policy -# sign-jar Builds/signs jce.jar file (no install) -# sign-policy Builds/signs policy files (no install) -# -# obfus Builds/obfuscates/signs jce.jar +# sign Alias for sign-jar and sign-policy +# sign-jar Builds/signs jce.jar file (no install) +# sign-policy Builds/signs policy files (no install) # -# release Builds all targets in preparation -# for workspace integration. +# release Builds all targets in preparation +# for workspace integration. # -# install-prebuilt Installs the pre-built jar files +# install-prebuilt Installs the pre-built jar files # # This makefile was written to support parallel target execution. # @@ -112,7 +113,7 @@ PRODUCT = sun # # The following is for when we need to do postprocessing -# (signing/obfuscation) against a read-only build. If the OUTPUTDIR +# (signing) against a read-only build. If the OUTPUTDIR # isn't writable, the build currently crashes out. # ifndef OPENJDK @@ -169,8 +170,8 @@ endif # OPENJDK # # We use a variety of subdirectories in the $(TEMPDIR) depending on what # part of the build we're doing. Both OPENJDK/JDK builds are initially -# done in the unsigned area. When files are signed or obfuscated in JDK, -# they will be placed in the appropriate areas. +# done in the unsigned area. When files are signed in JDK, they will be +# placed in the appropriate areas. # UNSIGNED_DIR = $(TEMPDIR)/unsigned @@ -178,7 +179,7 @@ include Defs-jce.gmk # ===================================================== -# Build the unsigned jce.jar file. Signing/obfuscation comes later. +# Build the unsigned jce.jar file. Signing comes later. # JAR_DESTFILE = $(LIBDIR)/jce.jar @@ -363,69 +364,13 @@ $(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ # ===================================================== -# Obfuscate/sign/install the JDK build. Not needed for OpenJDK. +# Create the Release Engineering files. Signed builds, +# unlimited policy file distribution, etc. # -OBFUS_DIR = $(JCE_BUILD_DIR)/obfus/jce - CLOSED_DIR = $(BUILDDIR)/closed/javax/crypto -obfus: $(OBFUS_DIR)/jce.jar - $(release-warning) - -ifndef ALT_JCE_BUILD_DIR -$(OBFUS_DIR)/jce.jar: build-jar $(JCE_MANIFEST_FILE) $(OBFUS_DIR)/framework.dox -else -# -# We have to remove the build dependency, otherwise, we'll try to rebuild it -# which we can't do on a read-only filesystem. -# -$(OBFUS_DIR)/jce.jar: $(JCE_MANIFEST_FILE) $(OBFUS_DIR)/framework.dox - @if [ ! -d $(CLASSDESTDIR) ] ; then \ - $(ECHO) "Couldn't find $(CLASSDESTDIR)"; \ - exit 1; \ - fi -endif - @$(ECHO) ">>>Obfuscating JCE framework..." - $(presign) - $(preobfus) - $(prep-target) - $(CD) $(OBFUS_DIR); \ - $(OBFUSCATOR) -fv framework.dox - @$(CD) $(OBFUS_DIR); $(java-vm-cleanup) - @# - @# The sun.security.internal classes are currently not obfuscated - @# due to an obfus problem. Manually copy them to the build directory - @# so that they are included in the jce.jar file. - @# - $(CP) -r $(CLASSDESTDIR)/sun $(OBFUS_DIR)/build - $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ \ - -C $(OBFUS_DIR)/build javax \ - -C $(OBFUS_DIR)/build sun \ - $(BOOT_JAR_JFLAGS) - $(sign-target) - @$(java-vm-cleanup) - -$(OBFUS_DIR)/framework.dox: $(CLOSED_DIR)/obfus/framework.dox - @$(ECHO) ">>>Creating framework.dox" - $(prep-target) - $(SED) "s:@@TEMPDIR@@:$(ABS_TEMPDIR):" $< > $@ - -# -# The current obfuscator has a limitation in that it currently only -# supports up to v49 class file format. Force v49 classfiles in our -# builds for now. -# -SOURCE_LANGUAGE_VERSION = 5 -TARGET_CLASS_VERSION = 5 - - -# ===================================================== -# Create the Release Engineering files. Obfuscated builds, -# unlimited policy file distribution, etc. -# - -release: $(OBFUS_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/COPYRIGHT.html \ +release: $(SIGNED_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/COPYRIGHT.html \ $(CLOSED_DIR)/doc/README.txt $(RM) -r \ $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy \ @@ -434,7 +379,7 @@ release: $(OBFUS_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/COPYRIGHT.html \ $(JCE_BUILD_DIR)/release/local_policy.jar \ $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy.zip $(MKDIR) -p $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy - $(CP) $(OBFUS_DIR)/jce.jar $(JCE_BUILD_DIR)/release + $(CP) $(SIGNED_DIR)/jce.jar $(JCE_BUILD_DIR)/release $(CP) \ $(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar \ $(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar \ @@ -530,5 +475,5 @@ clobber clean:: .PHONY: build-jar jar build-policy unlimited limited install-jar \ install-limited install-unlimited ifndef OPENJDK -.PHONY: sign sign-jar sign-policy obfus release install-prebuilt +.PHONY: sign sign-jar sign-policy release install-prebuilt endif diff --git a/make/sun/security/mscapi/Makefile b/make/sun/security/mscapi/Makefile index 08d6609e166173aacf2cd61bbf3bf1e06994d75b..c16d130504f044c7b0989e2bd5e7847ac40cb124 100644 --- a/make/sun/security/mscapi/Makefile +++ b/make/sun/security/mscapi/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -59,31 +59,31 @@ # # Main Targets (JDK/OPENJDK): # -# all/clobber/clean The usual, plus the native libraries. -# If OpenJDK, installs sunmscapi.jar. -# If JDK, installs prebuilt -# sunmscapi.jar. +# all/clobber/clean The usual, plus the native libraries. +# If OpenJDK, installs sunmscapi.jar. +# If JDK, installs prebuilt +# sunmscapi.jar. # -# jar Builds/installs sunmscapi.jar -# If OpenJDK, does not sign. -# If JDK, tries to sign. +# jar Builds/installs sunmscapi.jar +# If OpenJDK, does not sign. +# If JDK, tries to sign. # # Other lesser-used Targets (JDK/OPENJDK): # -# build-jar Builds sunmscapi.jar -# (does not sign/install) +# build-jar Builds sunmscapi.jar +# (does not sign/install) # -# install-jar Alias for "jar" above. +# install-jar Alias for "jar" above. # # Other targets (JDK only): # -# sign Alias for sign-jar -# sign-jar Builds/signs sunmscapi.jar (no install) +# sign Alias for sign-jar +# sign-jar Builds/signs sunmscapi.jar (no install) # -# release Builds all targets in preparation -# for workspace integration. +# release Builds all targets in preparation +# for workspace integration. # -# install-prebuilt Installs the pre-built jar files +# install-prebuilt Installs the pre-built jar files # # This makefile was written to support parallel target execution. # diff --git a/make/sun/security/pkcs11/Makefile b/make/sun/security/pkcs11/Makefile index f20910b7ed2add513d2c19c6cb02613f01e21226..9a4a4089be4e3a08ce18ade8e1612500ebb8aabe 100644 --- a/make/sun/security/pkcs11/Makefile +++ b/make/sun/security/pkcs11/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -59,31 +59,31 @@ # # Main Targets (JDK/OPENJDK): # -# all/clobber/clean The usual, plus the native libraries. -# If OpenJDK, installs sunpkcs11.jar. -# If JDK, installs prebuilt -# sunpkcs11.jar. +# all/clobber/clean The usual, plus the native libraries. +# If OpenJDK, installs sunpkcs11.jar. +# If JDK, installs prebuilt +# sunpkcs11.jar. # -# jar Builds/installs sunpkcs11.jar -# If OpenJDK, does not sign. -# If JDK, tries to sign. +# jar Builds/installs sunpkcs11.jar +# If OpenJDK, does not sign. +# If JDK, tries to sign. # # Other lesser-used Targets (JDK/OPENJDK): # -# build-jar Builds sunpkcs11.jar -# (does not sign/install) +# build-jar Builds sunpkcs11.jar +# (does not sign/install) # -# install-jar Alias for "jar" above. +# install-jar Alias for "jar" above. # # Other targets (JDK only): # -# sign Alias for sign-jar -# sign-jar Builds/signs sunpkcs11.jar (no install) +# sign Alias for sign-jar +# sign-jar Builds/signs sunpkcs11.jar (no install) # -# release Builds all targets in preparation -# for workspace integration. +# release Builds all targets in preparation +# for workspace integration. # -# install-prebuilt Installs the pre-built jar files +# install-prebuilt Installs the pre-built jar files # # This makefile was written to support parallel target execution. # diff --git a/src/share/classes/com/sun/crypto/provider/AESCipher.java b/src/share/classes/com/sun/crypto/provider/AESCipher.java index 1809f6d82aed8520edb167f3fc0bcdcfedff7788..1d58e21edd0c6b9455e523d98c26665190c2de81 100644 --- a/src/share/classes/com/sun/crypto/provider/AESCipher.java +++ b/src/share/classes/com/sun/crypto/provider/AESCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,12 +56,8 @@ public final class AESCipher extends CipherSpi { /** * Creates an instance of AES cipher with default ECB mode and * PKCS5Padding. - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public AESCipher() { - SunJCE.ensureIntegrity(getClass()); core = new CipherCore(new AESCrypt(), AESConstants.AES_BLOCK_SIZE); } diff --git a/src/share/classes/com/sun/crypto/provider/AESKeyGenerator.java b/src/share/classes/com/sun/crypto/provider/AESKeyGenerator.java index d6a715d8e5566a2fb3016ae8096ae0eed3678966..83cf3223d7563380fee24bac76ed356f5533177b 100644 --- a/src/share/classes/com/sun/crypto/provider/AESKeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/AESKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,16 +48,9 @@ public final class AESKeyGenerator extends KeyGeneratorSpi { private int keySize = 16; // default keysize (in number of bytes) /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor. */ public AESKeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/AESWrapCipher.java b/src/share/classes/com/sun/crypto/provider/AESWrapCipher.java index 5bdcb135442948047f1ac4fb37188ade1481f732..501e2b69936c8df9281e3f0ea229cbecd1021755 100644 --- a/src/share/classes/com/sun/crypto/provider/AESWrapCipher.java +++ b/src/share/classes/com/sun/crypto/provider/AESWrapCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,12 +65,8 @@ public final class AESWrapCipher extends CipherSpi { /** * Creates an instance of AES KeyWrap cipher with default * mode, i.e. "ECB" and padding scheme, i.e. "NoPadding". - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public AESWrapCipher() { - SunJCE.ensureIntegrity(getClass()); cipher = new AESCrypt(); } diff --git a/src/share/classes/com/sun/crypto/provider/ARCFOURCipher.java b/src/share/classes/com/sun/crypto/provider/ARCFOURCipher.java index 5876a45dbb36937a945d961cdec560bcd76c3a24..62affa324b6ff004f9447f0635d8cf1cdc3985a8 100644 --- a/src/share/classes/com/sun/crypto/provider/ARCFOURCipher.java +++ b/src/share/classes/com/sun/crypto/provider/ARCFOURCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,6 @@ public final class ARCFOURCipher extends CipherSpi { // called by the JCE framework public ARCFOURCipher() { - SunJCE.ensureIntegrity(getClass()); S = new int[256]; } diff --git a/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java b/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java index 2b5f0fb73003e90774e0e6853517b524a194491f..14d049f80378ea7dc8d75e910818bf2e91ca3dbd 100644 --- a/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java +++ b/src/share/classes/com/sun/crypto/provider/BlowfishCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,12 +60,8 @@ public final class BlowfishCipher extends CipherSpi { /** * Creates an instance of Blowfish cipher with default ECB mode and * PKCS5Padding. - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public BlowfishCipher() { - SunJCE.ensureIntegrity(getClass()); core = new CipherCore(new BlowfishCrypt(), BlowfishConstants.BLOWFISH_BLOCK_SIZE); } diff --git a/src/share/classes/com/sun/crypto/provider/BlowfishKeyGenerator.java b/src/share/classes/com/sun/crypto/provider/BlowfishKeyGenerator.java index 2d8fb85c420839432eddc9f41778fe51fccf72e3..96a2c7186e3e29fb5b6d609f7f03dc479c1f6d54 100644 --- a/src/share/classes/com/sun/crypto/provider/BlowfishKeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/BlowfishKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,16 +46,9 @@ public final class BlowfishKeyGenerator extends KeyGeneratorSpi { private int keysize = 16; // default keysize (in number of bytes) /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public BlowfishKeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/DESCipher.java b/src/share/classes/com/sun/crypto/provider/DESCipher.java index 07ddf318ff25d169381ce146eff7009866733ab5..30f36f3b982cb64b8781cec34e70d22f2f2ef39a 100644 --- a/src/share/classes/com/sun/crypto/provider/DESCipher.java +++ b/src/share/classes/com/sun/crypto/provider/DESCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,12 +56,8 @@ public final class DESCipher extends CipherSpi { /** * Creates an instance of DES cipher with default ECB mode and * PKCS5Padding. - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public DESCipher() { - SunJCE.ensureIntegrity(getClass()); core = new CipherCore(new DESCrypt(), DESConstants.DES_BLOCK_SIZE); } diff --git a/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java b/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java index 3ffa89d996c419a7ffc36e6fdb9ff8cf3b4ebfc2..968d6f78f430b99e877df731aabe5a3b12a505ab 100644 --- a/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java +++ b/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,17 +42,11 @@ import java.security.spec.InvalidKeySpecException; public final class DESKeyFactory extends SecretKeyFactorySpi { /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DESKeyFactory() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } + /** * Generates a SecretKey object from the provided key * specification (key material). diff --git a/src/share/classes/com/sun/crypto/provider/DESKeyGenerator.java b/src/share/classes/com/sun/crypto/provider/DESKeyGenerator.java index 2a7ac8e0771b413be83ec02f6b2b617a4daad866..cd028d4ac738f554bbff5d133ac10574b21a2408 100644 --- a/src/share/classes/com/sun/crypto/provider/DESKeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/DESKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,16 +46,9 @@ public final class DESKeyGenerator extends KeyGeneratorSpi { private SecureRandom random = null; /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DESKeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/DESedeCipher.java b/src/share/classes/com/sun/crypto/provider/DESedeCipher.java index 1514f44eddb0763a19eda9ba840b575c45bb0fc5..394a784215a4f30315a70732107c0fa31823ade6 100644 --- a/src/share/classes/com/sun/crypto/provider/DESedeCipher.java +++ b/src/share/classes/com/sun/crypto/provider/DESedeCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,12 +53,8 @@ public final class DESedeCipher extends CipherSpi { /** * Creates an instance of DESede cipher with default ECB mode and * PKCS5Padding. - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public DESedeCipher() { - SunJCE.ensureIntegrity(getClass()); core = new CipherCore(new DESedeCrypt(), DESConstants.DES_BLOCK_SIZE); } diff --git a/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java b/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java index 831ca8cd7ad59b8b89b6f25495f53d56597165b4..fcd619b7af6c8b54e43073ed9fe38f0ef6f34b47 100644 --- a/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java +++ b/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,16 +42,9 @@ import java.security.spec.InvalidKeySpecException; public final class DESedeKeyFactory extends SecretKeyFactorySpi { /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DESedeKeyFactory() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have been " + - "tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/DESedeKeyGenerator.java b/src/share/classes/com/sun/crypto/provider/DESedeKeyGenerator.java index 439c8facc91d82010bae98b6376d75735e8f3d39..333375e3edb19437ec89951f2122faea08357b35 100644 --- a/src/share/classes/com/sun/crypto/provider/DESedeKeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/DESedeKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,16 +47,9 @@ public final class DESedeKeyGenerator extends KeyGeneratorSpi { private int keysize = 168; /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DESedeKeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have been " + - "tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java b/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java index 48cbb1edbc3d423df127497dead459be5b21c577..c3a36d1e9ceb9043a0249b59ad63df4c5d317064 100644 --- a/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java +++ b/src/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,12 +74,8 @@ public final class DESedeWrapCipher extends CipherSpi { /** * Creates an instance of CMS DESede KeyWrap cipher with default * mode, i.e. "CBC" and padding scheme, i.e. "NoPadding". - * - * @exception SecurityException if this constructor fails to verify - * its own integrity. */ public DESedeWrapCipher() { - SunJCE.ensureIntegrity(getClass()); cipher = new CipherBlockChaining(new DESedeCrypt()); } diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java b/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java index 30bec7261174a6ee5ea371d2114287f3cbd369e4..e2a3cf08daf2c6330f2ee206beccf7bfc3a28a48 100644 --- a/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java +++ b/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,16 +58,9 @@ extends KeyAgreementSpi { private BigInteger y = BigInteger.ZERO; /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DHKeyAgreement() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have been " + - "tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java b/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java index e7c5f53b4d4291d7517efb9d75748c8c81a2a032..01a449c6a2f8ef6823dfe4a8743cb3212e9b890d 100644 --- a/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java +++ b/src/share/classes/com/sun/crypto/provider/DHKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,16 +49,9 @@ import javax.crypto.spec.DHParameterSpec; public final class DHKeyFactory extends KeyFactorySpi { /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public DHKeyFactory() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/HmacCore.java b/src/share/classes/com/sun/crypto/provider/HmacCore.java index 9950d112ff1369934c9e3ba7e1fed4ed04bcef11..87d9e04bc0e315ed74ef2cacf9afbbd99dc4785c 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacCore.java +++ b/src/share/classes/com/sun/crypto/provider/HmacCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -241,7 +241,6 @@ final class HmacCore implements Cloneable { public static final class HmacSHA256 extends MacSpi implements Cloneable { private final HmacCore core; public HmacSHA256() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(getClass()); core = new HmacCore("SHA-256", 64); } private HmacSHA256(HmacSHA256 base) throws CloneNotSupportedException { @@ -278,7 +277,6 @@ final class HmacCore implements Cloneable { public static final class HmacSHA384 extends MacSpi implements Cloneable { private final HmacCore core; public HmacSHA384() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(getClass()); core = new HmacCore("SHA-384", 128); } private HmacSHA384(HmacSHA384 base) throws CloneNotSupportedException { @@ -315,7 +313,6 @@ final class HmacCore implements Cloneable { public static final class HmacSHA512 extends MacSpi implements Cloneable { private final HmacCore core; public HmacSHA512() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(getClass()); core = new HmacCore("SHA-512", 128); } private HmacSHA512(HmacSHA512 base) throws CloneNotSupportedException { diff --git a/src/share/classes/com/sun/crypto/provider/HmacMD5.java b/src/share/classes/com/sun/crypto/provider/HmacMD5.java index 26e76389d4fa85aad64012c2be90b71a898c9d97..ce3793c917ac12b1a2a397efc2c03f695c1e02c9 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacMD5.java +++ b/src/share/classes/com/sun/crypto/provider/HmacMD5.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,16 +44,8 @@ public final class HmacMD5 extends MacSpi implements Cloneable { /** * Standard constructor, creates a new HmacMD5 instance. - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity */ public HmacMD5() throws NoSuchAlgorithmException { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } hmac = new HmacCore(MessageDigest.getInstance("MD5"), MD5_BLOCK_LENGTH); } diff --git a/src/share/classes/com/sun/crypto/provider/HmacMD5KeyGenerator.java b/src/share/classes/com/sun/crypto/provider/HmacMD5KeyGenerator.java index c1b6526457170dac812a3353056fe7d11052a4c1..1f73f32c7e9951fad55012e554c45fa595310b68 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacMD5KeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/HmacMD5KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,16 +46,9 @@ public final class HmacMD5KeyGenerator extends KeyGeneratorSpi { private int keysize = 64; // default keysize (in number of bytes) /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public HmacMD5KeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java b/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java index 150477c5ea12604c2e07eae4e5a695772aae5dc7..4508c242e967db3fbf37d062cff189badf6730bb 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java +++ b/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,13 +48,8 @@ public final class HmacPKCS12PBESHA1 extends MacSpi implements Cloneable { /** * Standard constructor, creates a new HmacSHA1 instance. - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity */ public HmacPKCS12PBESHA1() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(this.getClass()); this.hmac = new HmacCore(MessageDigest.getInstance("SHA1"), SHA1_BLOCK_LENGTH); } diff --git a/src/share/classes/com/sun/crypto/provider/HmacSHA1.java b/src/share/classes/com/sun/crypto/provider/HmacSHA1.java index 1421e855b9bf14d08b80d052acfd5343746fb938..0b4bea2c7f770bd7322409df70df66202c758cdb 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacSHA1.java +++ b/src/share/classes/com/sun/crypto/provider/HmacSHA1.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,16 +44,8 @@ public final class HmacSHA1 extends MacSpi implements Cloneable { /** * Standard constructor, creates a new HmacSHA1 instance. - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity */ public HmacSHA1() throws NoSuchAlgorithmException { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } this.hmac = new HmacCore(MessageDigest.getInstance("SHA1"), SHA1_BLOCK_LENGTH); } diff --git a/src/share/classes/com/sun/crypto/provider/HmacSHA1KeyGenerator.java b/src/share/classes/com/sun/crypto/provider/HmacSHA1KeyGenerator.java index 561e4f1593c6f850375cce2a76c46a3b5864cce7..2bf214280cef43919b42938f8508e8db3d1b5964 100644 --- a/src/share/classes/com/sun/crypto/provider/HmacSHA1KeyGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/HmacSHA1KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,16 +46,9 @@ public final class HmacSHA1KeyGenerator extends KeyGeneratorSpi { private int keysize = 64; // default keysize (in number of bytes) /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public HmacSHA1KeyGenerator() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/JarVerifier.java b/src/share/classes/com/sun/crypto/provider/JarVerifier.java deleted file mode 100644 index ea5f856955a8d678c84ce4c2ccbf4791e5730ebc..0000000000000000000000000000000000000000 --- a/src/share/classes/com/sun/crypto/provider/JarVerifier.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package com.sun.crypto.provider; - -// NOTE: this class is duplicated amongst SunJCE, SunPKCS11, and SunMSCAPI. -// All files should be kept in sync. - -import java.io.*; -import java.util.*; -import java.util.jar.*; -import java.net.URL; -import java.net.JarURLConnection; -import java.net.MalformedURLException; - -import java.security.*; -import java.security.cert.*; -import java.security.cert.Certificate; - -/** - * This class verifies JAR files (and any supporting JAR files), and - * determines whether they may be used in this implementation. - * - * The JCE in OpenJDK has an open cryptographic interface, meaning it - * does not restrict which providers can be used. Compliance with - * United States export controls and with local law governing the - * import/export of products incorporating the JCE in the OpenJDK is - * the responsibility of the licensee. - * - * @since 1.7 - */ -final class JarVerifier { - - private static final boolean debug = false; - - /** - * Verify the JAR file is signed by an entity which has a certificate - * issued by a trusted CA. - * - * Note: this is a temporary method and will change soon to use the - * exception chaining mechanism, which can provide more details - * as to why the verification failed. - * - * @param c the class to be verified. - * @return true if verification is successful. - */ - static boolean verify(final Class c) { - return true; - } -} diff --git a/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java b/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java index 242db61d83fb6302b37d48d16676e668b9667915..6864dad5f7bb47cef74963920d4b9a327c2b556c 100644 --- a/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java +++ b/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,6 @@ final class KeyGeneratorCore { public static final class HmacSHA256KG extends KeyGeneratorSpi { private final KeyGeneratorCore core; public HmacSHA256KG() { - SunJCE.ensureIntegrity(getClass()); core = new KeyGeneratorCore("HmacSHA256", 256); } protected void engineInit(SecureRandom random) { @@ -131,7 +130,6 @@ final class KeyGeneratorCore { public static final class HmacSHA384KG extends KeyGeneratorSpi { private final KeyGeneratorCore core; public HmacSHA384KG() { - SunJCE.ensureIntegrity(getClass()); core = new KeyGeneratorCore("HmacSHA384", 384); } protected void engineInit(SecureRandom random) { @@ -153,7 +151,6 @@ final class KeyGeneratorCore { public static final class HmacSHA512KG extends KeyGeneratorSpi { private final KeyGeneratorCore core; public HmacSHA512KG() { - SunJCE.ensureIntegrity(getClass()); core = new KeyGeneratorCore("HmacSHA512", 512); } protected void engineInit(SecureRandom random) { @@ -175,7 +172,6 @@ final class KeyGeneratorCore { public static final class RC2KeyGenerator extends KeyGeneratorSpi { private final KeyGeneratorCore core; public RC2KeyGenerator() { - SunJCE.ensureIntegrity(getClass()); core = new KeyGeneratorCore("RC2", 128); } protected void engineInit(SecureRandom random) { @@ -201,7 +197,6 @@ final class KeyGeneratorCore { public static final class ARCFOURKeyGenerator extends KeyGeneratorSpi { private final KeyGeneratorCore core; public ARCFOURKeyGenerator() { - SunJCE.ensureIntegrity(getClass()); core = new KeyGeneratorCore("ARCFOUR", 128); } protected void engineInit(SecureRandom random) { diff --git a/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java b/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java index 23478f8fc0e8ab375d292ef5518dc1d84f5a931f..f86dad561bf0ce63588dfe1bd44d9b0389962feb 100644 --- a/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java +++ b/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,16 +49,9 @@ abstract class PBEKeyFactory extends SecretKeyFactorySpi { private static HashSet validTypes; /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Simple constructor */ private PBEKeyFactory(String keytype) { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } type = keytype; } diff --git a/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java b/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java index 1bf6d6f89e2bab8dcfd89ae2dbdac6b6e6ab068b..8eec23d39981d2f745d928a30b0735d94acceb1b 100644 --- a/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java +++ b/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,16 +55,9 @@ public final class PBEWithMD5AndDESCipher extends CipherSpi { * unavailable * @exception NoSuchPaddingException if the required padding mechanism * (PKCS5Padding) is unavailable - * - * @exception SecurityException if this constructor fails to verify - * its own integrity */ public PBEWithMD5AndDESCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } core = new PBECipherCore("DES"); } diff --git a/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java b/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java index 7af04b6d81046c1011c52e4e1b91f76deffc716f..c121bd12bfc8badb20a93cd5df5d3230a8d401b0 100644 --- a/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java +++ b/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,23 +61,14 @@ public final class PBEWithMD5AndTripleDESCipher extends CipherSpi { * Creates an instance of this cipher, and initializes its mode (CBC) and * padding (PKCS5). * - * Verify the SunJCE provider in the constructor. - * * @exception NoSuchAlgorithmException if the required cipher mode (CBC) is * unavailable * @exception NoSuchPaddingException if the required padding mechanism * (PKCS5Padding) is unavailable - * @exception SecurityException if fails to verify - * its own integrity */ public PBEWithMD5AndTripleDESCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } - // set the encapsulated cipher to do triple DES core = new PBECipherCore("DESede"); } diff --git a/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java b/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java index 9ba53036a5e12cbe5d76192b4b436aabd967b5d9..205e38cf729204bceffd9963534c1fbdfe11546d 100644 --- a/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java +++ b/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,16 +45,9 @@ import javax.crypto.spec.SecretKeySpec; public final class PBKDF2HmacSHA1Factory extends SecretKeyFactorySpi { /** - * Verify the SunJCE provider in the constructor. - * - * @exception SecurityException if fails to verify - * its own integrity + * Empty constructor */ public PBKDF2HmacSHA1Factory() { - if (!SunJCE.verifySelfIntegrity(this.getClass())) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } } /** diff --git a/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java b/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java index 277a7b30045beedff0ecebd62aed3829ebfc2740..ba7e7fec4f25868c326463f0b7a844f651cc995a 100644 --- a/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java +++ b/src/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -370,7 +370,6 @@ final class PKCS12PBECipherCore { public static final class PBEWithSHA1AndDESede extends CipherSpi { private final PKCS12PBECipherCore core; public PBEWithSHA1AndDESede() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(this.getClass()); core = new PKCS12PBECipherCore("DESede", 24); } protected byte[] engineDoFinal(byte[] in, int inOff, int inLen) @@ -446,7 +445,6 @@ final class PKCS12PBECipherCore { public static final class PBEWithSHA1AndRC2_40 extends CipherSpi { private final PKCS12PBECipherCore core; public PBEWithSHA1AndRC2_40() throws NoSuchAlgorithmException { - SunJCE.ensureIntegrity(this.getClass()); core = new PKCS12PBECipherCore("RC2", 5); } protected byte[] engineDoFinal(byte[] in, int inOff, int inLen) diff --git a/src/share/classes/com/sun/crypto/provider/RC2Cipher.java b/src/share/classes/com/sun/crypto/provider/RC2Cipher.java index c96d07f726a78a8c81e7937512740f254153a774..d119a0688cd7cf27f58c5b5571d8199c0c713aaf 100644 --- a/src/share/classes/com/sun/crypto/provider/RC2Cipher.java +++ b/src/share/classes/com/sun/crypto/provider/RC2Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,6 @@ public final class RC2Cipher extends CipherSpi { private final RC2Crypt embeddedCipher; public RC2Cipher() { - SunJCE.ensureIntegrity(getClass()); embeddedCipher = new RC2Crypt(); core = new CipherCore(embeddedCipher, 8); } diff --git a/src/share/classes/com/sun/crypto/provider/RSACipher.java b/src/share/classes/com/sun/crypto/provider/RSACipher.java index e5c6c019e0f64057d38554e4e990d67d4040e75a..9f5179e3325754c40870641f296675345f12d750 100644 --- a/src/share/classes/com/sun/crypto/provider/RSACipher.java +++ b/src/share/classes/com/sun/crypto/provider/RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,6 @@ public final class RSACipher extends CipherSpi { private String oaepHashAlgorithm = "SHA-1"; public RSACipher() { - SunJCE.ensureIntegrity(getClass()); paddingType = PAD_PKCS1; } diff --git a/src/share/classes/com/sun/crypto/provider/SslMacCore.java b/src/share/classes/com/sun/crypto/provider/SslMacCore.java index 7756e73ce77237d1fac1c03eb44d75e9faf6c527..8046a22ed711874f964b56d4903c8691e966c067 100644 --- a/src/share/classes/com/sun/crypto/provider/SslMacCore.java +++ b/src/share/classes/com/sun/crypto/provider/SslMacCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,9 +226,6 @@ final class SslMacCore { static final byte[] md5Pad1 = genPad((byte)0x36, 48); static final byte[] md5Pad2 = genPad((byte)0x5c, 48); - static { - SunJCE.ensureIntegrity(SslMacMD5.class); - } } // nested static class for the SslMacMD5 implementation @@ -262,9 +259,6 @@ final class SslMacCore { static final byte[] shaPad1 = genPad((byte)0x36, 40); static final byte[] shaPad2 = genPad((byte)0x5c, 40); - static { - SunJCE.ensureIntegrity(SslMacSHA1.class); - } } } diff --git a/src/share/classes/com/sun/crypto/provider/SunJCE.java b/src/share/classes/com/sun/crypto/provider/SunJCE.java index 13691b0167b55e8f9d131d7c95380663666d10ff..af46b030a6fd4f4226869f953cc3713137dfa288 100644 --- a/src/share/classes/com/sun/crypto/provider/SunJCE.java +++ b/src/share/classes/com/sun/crypto/provider/SunJCE.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,10 +93,6 @@ public final class SunJCE extends Provider { static final SecureRandom RANDOM = new SecureRandom(); - // After the SunJCE passed self-integrity checking, - // verifiedSelfIntegrity will be set to true. - private static boolean verifiedSelfIntegrity = false; - public SunJCE() { /* We are the "SunJCE" provider */ super("SunJCE", 1.7d, info); @@ -441,21 +437,4 @@ public final class SunJCE extends Provider { } }); } - - // set to true once self verification is complete - private static volatile boolean integrityVerified; - - static void ensureIntegrity(Class c) { - if (verifySelfIntegrity(c) == false) { - throw new SecurityException("The SunJCE provider may have " + - "been tampered."); - } - } - - static final boolean verifySelfIntegrity(Class c) { - if (verifiedSelfIntegrity) { - return true; - } - return (integrityVerified = JarVerifier.verify(c)); - } } diff --git a/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java b/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java index 260fdd8a946ecfca3e174fd7281ffe8847b16be1..8f27f74c6ee449d89ffb8e12e8fdd71fb2d49f4e 100644 --- a/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,6 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi { private int protocolVersion; public TlsKeyMaterialGenerator() { - SunJCE.ensureIntegrity(getClass()); } protected void engineInit(SecureRandom random) { diff --git a/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java b/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java index ad47dda2d324c5e63b746a9e787272fc4876fc9e..d56c3b9afc6cf2850442eeae9ec41f28b7639be9 100644 --- a/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,6 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi { private int protocolVersion; public TlsMasterSecretGenerator() { - SunJCE.ensureIntegrity(getClass()); } protected void engineInit(SecureRandom random) { diff --git a/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java b/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java index 5306a720fc52f2c97822b323b1c5d0df613ee7f4..f2c885f5a3004d2616001a25af8658ca7606dcf2 100644 --- a/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,6 @@ public final class TlsPrfGenerator extends KeyGeneratorSpi { private TlsPrfParameterSpec spec; public TlsPrfGenerator() { - SunJCE.ensureIntegrity(getClass()); } protected void engineInit(SecureRandom random) { diff --git a/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java index 6986dec21ce05bd7bd14dca0ad2036158c8c14bd..742d3e1bdfdefc141f7b6c9186bac5a9db613138 100644 --- a/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java +++ b/src/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,6 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { private SecureRandom random; public TlsRsaPremasterSecretGenerator() { - SunJCE.ensureIntegrity(getClass()); } protected void engineInit(SecureRandom random) { diff --git a/src/share/classes/javax/crypto/JarVerifier.java b/src/share/classes/javax/crypto/JarVerifier.java index 376761012dc592e03d2ec1c7a3baa5c58e976f37..03f80839f905a62720eed36c38cc7a14547a013c 100644 --- a/src/share/classes/javax/crypto/JarVerifier.java +++ b/src/share/classes/javax/crypto/JarVerifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,7 @@ package javax.crypto; import java.io.*; import java.net.*; import java.security.*; -import java.util.*; import java.util.jar.*; -import javax.crypto.CryptoPolicyParser.ParsingException; /** * This class verifies JAR files (and any supporting JAR files), and @@ -134,17 +132,6 @@ final class JarVerifier { } } - /** - * Verify that the provided JarEntry was indeed signed by the - * framework signing certificate. - * - * @param je the URL of the jar entry to be checked. - * @throws Exception if the jar entry was not signed by - * the proper certificate - */ - static void verifyFrameworkSigned(URL je) throws Exception { - } - /** * Verify that the provided certs include the * framework signing certificate. diff --git a/src/share/classes/javax/crypto/JceSecurity.java b/src/share/classes/javax/crypto/JceSecurity.java index 11b124ac00a998574444cb8d74477bc4df194700..b204f384337fde53453a4b2760bbe161c2543bc3 100644 --- a/src/share/classes/javax/crypto/JceSecurity.java +++ b/src/share/classes/javax/crypto/JceSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ package javax.crypto; -import java.lang.ref.*; import java.util.*; import java.util.jar.*; import java.io.*; @@ -256,11 +255,6 @@ final class JceSecurity { ("Cannot locate policy or framework files!"); } - // Enforce the signer restraint, i.e. signer of JCE framework - // jar should also be the signer of the two jurisdiction policy - // jar files. - JarVerifier.verifyFrameworkSigned(jceCipherURL); - // Read jurisdiction policies. CryptoPermissions defaultExport = new CryptoPermissions(); CryptoPermissions exemptExport = new CryptoPermissions(); diff --git a/src/share/classes/javax/swing/JFileChooser.java b/src/share/classes/javax/swing/JFileChooser.java index 82c85fe9faa00f6f9c78c4e38aca4717cc2494d4..8ba9c7c42af7696022dda1c0f36caef6b8615d0a 100644 --- a/src/share/classes/javax/swing/JFileChooser.java +++ b/src/share/classes/javax/swing/JFileChooser.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -739,6 +739,11 @@ public class JFileChooser extends JComponent implements Accessible { dialog.show(); firePropertyChange("JFileChooserDialogIsClosingProperty", dialog, null); + + // Remove all components from dialog. The MetalFileChooserUI.installUI() method (and other LAFs) + // registers AWT listener for dialogs and produces memory leaks. It happens when + // installUI invoked after the showDialog method. + dialog.getContentPane().removeAll(); dialog.dispose(); dialog = null; return returnValue; diff --git a/src/share/classes/javax/swing/JInternalFrame.java b/src/share/classes/javax/swing/JInternalFrame.java index 837ffe49e4f4768359eccc6de58d4b70eba6a3d9..3079a26ebdce235e095ce0378887c5d1c6f0fc27 100644 --- a/src/share/classes/javax/swing/JInternalFrame.java +++ b/src/share/classes/javax/swing/JInternalFrame.java @@ -26,13 +26,10 @@ package javax.swing; import java.awt.*; -import java.awt.event.*; import java.beans.PropertyVetoException; import java.beans.PropertyChangeEvent; -import java.util.EventListener; -import javax.swing.border.Border; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; import javax.swing.plaf.*; @@ -40,7 +37,6 @@ import javax.swing.plaf.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import java.lang.StringBuilder; import java.beans.PropertyChangeListener; @@ -1459,19 +1455,22 @@ public class JInternalFrame extends JComponent implements SwingUtilities2.compositeRequestFocus(getDesktopIcon()); } else { - // FocusPropertyChangeListener will eventually update - // lastFocusOwner. As focus requests are asynchronous - // lastFocusOwner may be accessed before it has been correctly - // updated. To avoid any problems, lastFocusOwner is immediately - // set, assuming the request will succeed. - lastFocusOwner = getMostRecentFocusOwner(); - if (lastFocusOwner == null) { - // Make sure focus is restored somewhere, so that - // we don't leave a focused component in another frame while - // this frame is selected. - lastFocusOwner = getContentPane(); + Component component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); + if ((component == null) || !SwingUtilities.isDescendingFrom(component, this)) { + // FocusPropertyChangeListener will eventually update + // lastFocusOwner. As focus requests are asynchronous + // lastFocusOwner may be accessed before it has been correctly + // updated. To avoid any problems, lastFocusOwner is immediately + // set, assuming the request will succeed. + setLastFocusOwner(getMostRecentFocusOwner()); + if (lastFocusOwner == null) { + // Make sure focus is restored somewhere, so that + // we don't leave a focused component in another frame while + // this frame is selected. + setLastFocusOwner(getContentPane()); + } + lastFocusOwner.requestFocus(); } - lastFocusOwner.requestFocus(); } } diff --git a/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java b/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java index 5ebb6289440702a8a618f008a7d6fe105877d89a..888b95aa02161a2013cc413e113f1dd87585c93c 100644 --- a/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java +++ b/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,9 +32,6 @@ import javax.swing.event.*; import javax.swing.border.*; import javax.swing.plaf.*; import java.beans.*; -import java.util.EventListener; -import java.io.Serializable; - /** * Basic L&F for a minimized window on a desktop. @@ -47,7 +44,6 @@ public class BasicDesktopIconUI extends DesktopIconUI { protected JInternalFrame.JDesktopIcon desktopIcon; protected JInternalFrame frame; - private DesktopIconMover desktopIconMover; /** * The title pane component used in the desktop icon. @@ -128,21 +124,12 @@ public class BasicDesktopIconUI extends DesktopIconUI { mouseInputListener = createMouseInputListener(); desktopIcon.addMouseMotionListener(mouseInputListener); desktopIcon.addMouseListener(mouseInputListener); - getDesktopIconMover().installListeners(); } protected void uninstallListeners() { desktopIcon.removeMouseMotionListener(mouseInputListener); desktopIcon.removeMouseListener(mouseInputListener); mouseInputListener = null; - getDesktopIconMover().uninstallListeners(); - } - - private DesktopIconMover getDesktopIconMover() { - if (desktopIconMover == null) { - desktopIconMover = new DesktopIconMover(desktopIcon); - } - return desktopIconMover; } protected void installDefaults() { diff --git a/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java b/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java index 74f24b6eb7eaaacb3cdcf5677e63b27a39d4b8dc..1e5d80f8ea24bcd48d302437490f7aeab8f1672f 100644 --- a/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java +++ b/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,6 +232,10 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh public void run0() { FileSystemView fileSystem = filechooser.getFileSystemView(); + if (isInterrupted()) { + return; + } + File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled()); if (isInterrupted()) { @@ -268,8 +272,8 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh // To avoid loads of synchronizations with Invoker and improve performance we // execute the whole block on the COM thread - DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable() { - public DoChangeContents call() throws Exception { + DoChangeContents doChangeContents = ShellFolder.invoke(new Callable() { + public DoChangeContents call() { int newSize = newFileCache.size(); int oldSize = fileCache.size(); diff --git a/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java b/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java index 383930533a200d2d8f35b6f28bb748956ef5850a..551ab00d6029dc7d27f9bbffb8a30aff7d5e7650 100644 --- a/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java +++ b/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java @@ -27,16 +27,10 @@ package javax.swing.plaf.basic; import java.awt.*; import java.awt.event.*; -import java.awt.peer.LightweightPeer; - import javax.swing.*; -import javax.swing.border.*; import javax.swing.plaf.*; import javax.swing.event.*; - import java.beans.*; -import java.io.Serializable; - import sun.swing.DefaultLookup; import sun.swing.UIAction; @@ -55,6 +49,7 @@ public class BasicInternalFrameUI extends InternalFrameUI protected MouseInputAdapter borderListener; protected PropertyChangeListener propertyChangeListener; protected LayoutManager internalFrameLayout; + protected ComponentListener componentListener; protected MouseInputListener glassPaneDispatcher; private InternalFrameListener internalFrameListener; @@ -66,9 +61,9 @@ public class BasicInternalFrameUI extends InternalFrameUI protected BasicInternalFrameTitlePane titlePane; // access needs this private static DesktopManager sharedDesktopManager; + private boolean componentListenerAdded = false; private Rectangle parentBounds; - private DesktopIconMover desktopIconMover; private boolean dragging = false; private boolean resizing = false; @@ -209,17 +204,14 @@ public class BasicInternalFrameUI extends InternalFrameUI frame.getGlassPane().addMouseListener(glassPaneDispatcher); frame.getGlassPane().addMouseMotionListener(glassPaneDispatcher); } + componentListener = createComponentListener(); if (frame.getParent() != null) { parentBounds = frame.getParent().getBounds(); } - getDesktopIconMover().installListeners(); - } - - private DesktopIconMover getDesktopIconMover() { - if (desktopIconMover == null) { - desktopIconMover = new DesktopIconMover(frame); + if ((frame.getParent() != null) && !componentListenerAdded) { + frame.getParent().addComponentListener(componentListener); + componentListenerAdded = true; } - return desktopIconMover; } // Provide a FocusListener to listen for a WINDOW_LOST_FOCUS event, @@ -290,7 +282,11 @@ public class BasicInternalFrameUI extends InternalFrameUI * @since 1.3 */ protected void uninstallListeners() { - getDesktopIconMover().uninstallListeners(); + if ((frame.getParent() != null) && componentListenerAdded) { + frame.getParent().removeComponentListener(componentListener); + componentListenerAdded = false; + } + componentListener = null; if (glassPaneDispatcher != null) { frame.getGlassPane().removeMouseListener(glassPaneDispatcher); frame.getGlassPane().removeMouseMotionListener(glassPaneDispatcher); @@ -1228,6 +1224,15 @@ public class BasicInternalFrameUI extends InternalFrameUI } } + // Relocate the icon base on the new parent bounds. + if (icon != null) { + Rectangle iconBounds = icon.getBounds(); + int y = iconBounds.y + + (parentNewBounds.height - parentBounds.height); + icon.setBounds(iconBounds.x, y, + iconBounds.width, iconBounds.height); + } + // Update the new parent bounds for next resize. if (!parentBounds.equals(parentNewBounds)) { parentBounds = parentNewBounds; @@ -1399,6 +1404,9 @@ public class BasicInternalFrameUI extends InternalFrameUI // Cancel a resize in progress if the internal frame // gets a setClosed(true) or dispose(). cancelResize(); + if ((frame.getParent() != null) && componentListenerAdded) { + frame.getParent().removeComponentListener(componentListener); + } closeFrame(f); } } else if (JInternalFrame.IS_MAXIMUM_PROPERTY == prop) { @@ -1431,6 +1439,10 @@ public class BasicInternalFrameUI extends InternalFrameUI } else { parentBounds = null; } + if ((frame.getParent() != null) && !componentListenerAdded) { + f.getParent().addComponentListener(componentListener); + componentListenerAdded = true; + } } else if (JInternalFrame.TITLE_PROPERTY == prop || prop == "closable" || prop == "iconable" || prop == "maximizable") { diff --git a/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java b/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java index af5eaa5df9fe8262f46ae52181bcfb1f1d5d2e4e..ec33129c346271acedfdb3a64aca819ec169f902 100644 --- a/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,17 +37,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.awt.Component; -import java.awt.Container; -import java.awt.LayoutManager; import java.awt.Rectangle; import java.awt.Dimension; import java.awt.Point; import java.awt.Insets; import java.awt.Graphics; import java.awt.event.*; -import java.io.Serializable; -import java.awt.Toolkit; -import java.awt.ComponentOrientation; /** * A default L&F implementation of ScrollPaneUI. @@ -63,6 +58,7 @@ public class BasicScrollPaneUI protected ChangeListener viewportChangeListener; protected PropertyChangeListener spPropertyChangeListener; private MouseWheelListener mouseScrollListener; + private int oldExtent = Integer.MIN_VALUE; /** * PropertyChangeListener installed on the vertical scrollbar. @@ -327,9 +323,13 @@ public class BasicScrollPaneUI * leave it until someone claims. */ value = Math.max(0, Math.min(max - extent, max - extent - viewPosition.x)); + if (oldExtent > extent) { + value -= oldExtent - extent; + } } } } + oldExtent = extent; hsb.setValues(value, extent, 0, max); } @@ -1020,7 +1020,7 @@ public class BasicScrollPaneUI if (viewport != null) { if (e.getSource() == viewport) { - viewportStateChanged(e); + syncScrollPaneWithViewport(); } else { JScrollBar hsb = scrollpane.getHorizontalScrollBar(); @@ -1077,11 +1077,6 @@ public class BasicScrollPaneUI viewport.setViewPosition(p); } - private void viewportStateChanged(ChangeEvent e) { - syncScrollPaneWithViewport(); - } - - // // PropertyChangeListener: This is installed on both the JScrollPane // and the horizontal/vertical scrollbars. diff --git a/src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java b/src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java deleted file mode 100644 index deff4f27a5f9ebb542a68fbc3af211ec99859e16..0000000000000000000000000000000000000000 --- a/src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package javax.swing.plaf.basic; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.beans.*; - -/** - * DesktopIconMover is intended to move desktop icon - * when parent window is resized. - */ -class DesktopIconMover implements ComponentListener, PropertyChangeListener { - private Component parent; - private JInternalFrame frame; // if not null, DesktopIconMover(frame) - // constructor was used - private JInternalFrame.JDesktopIcon icon; - private Rectangle parentBounds; - private boolean componentListenerAdded = false; - - public DesktopIconMover(JInternalFrame frame) { - if (frame == null) { - throw new NullPointerException("Frame cannot be null"); - } - this.frame = frame; - this.icon = frame.getDesktopIcon(); - if (icon == null) { - throw new NullPointerException( - "frame.getDesktopIcon() cannot be null"); - } - this.parent = frame.getParent(); - if (this.parent != null) { - parentBounds = this.parent.getBounds(); - } - } - - public DesktopIconMover(JInternalFrame.JDesktopIcon icon) { - if (icon == null) { - throw new NullPointerException("Icon cannot be null"); - } - this.icon = icon; - this.parent = icon.getParent(); - if (this.parent != null) { - parentBounds = this.parent.getBounds(); - } - } - - public void installListeners() { - if (frame != null) { - frame.addPropertyChangeListener(this); - } else { - icon.addPropertyChangeListener(this); - } - addComponentListener(); - } - - public void uninstallListeners() { - if (frame != null) { - frame.removePropertyChangeListener(this); - } else { - icon.removePropertyChangeListener(this); - } - removeComponentListener(); - } - - public void propertyChange(PropertyChangeEvent evt) { - String propName = evt.getPropertyName(); - if ("ancestor".equals(propName)) { - Component newAncestor = (Component) evt.getNewValue(); - - // Remove component listener if parent is changing - Component probablyNewParent = getCurrentParent(); - if ((probablyNewParent != null) && - (!probablyNewParent.equals(parent))) { - removeComponentListener(); - parent = probablyNewParent; - } - - if (newAncestor == null) { - removeComponentListener(); - } else { - addComponentListener(); - } - - // Update parentBounds - if (parent != null) { - parentBounds = parent.getBounds(); - } else { - parentBounds = null; - } - } else if (JInternalFrame.IS_CLOSED_PROPERTY.equals(propName)) { - removeComponentListener(); - } - } - - private void addComponentListener() { - if (!componentListenerAdded && (parent != null)) { - parent.addComponentListener(this); - componentListenerAdded = true; - } - } - - private void removeComponentListener() { - if ((parent != null) && componentListenerAdded) { - parent.removeComponentListener(this); - componentListenerAdded = false; - } - } - - private Component getCurrentParent() { - if (frame != null) { - return frame.getParent(); - } else { - return icon.getParent(); - } - } - - public void componentResized(ComponentEvent e) { - if ((parent == null) || (parentBounds == null)) { - return; - } - - Rectangle parentNewBounds = parent.getBounds(); - if ((parentNewBounds == null) || parentNewBounds.equals(parentBounds)) { - return; - } - - // Move desktop icon only in up-down direction - int newIconY = icon.getLocation().y + - (parentNewBounds.height - parentBounds.height); - icon.setLocation(icon.getLocation().x, newIconY); - - parentBounds = parentNewBounds; - } - - public void componentMoved(ComponentEvent e) { - } - - public void componentShown(ComponentEvent e) { - } - - public void componentHidden(ComponentEvent e) { - } -} diff --git a/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java b/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java index bf29e15221da3851419c7b99eacd9febae13b851..f5762f0f0ef81a6ec25dcd29cb1753adf06e956e 100644 --- a/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java +++ b/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java @@ -227,10 +227,10 @@ public abstract class AbstractRegionPainter implements Painter { * * @param x an encoded x value (0...1, or 1...2, or 2...3) * @return the decoded x value + * @throws IllegalArgumentException + * if {@code x < 0} or {@code x > 3} */ protected final float decodeX(float x) { - if (ctx.canvasSize == null) return x; - if (x >= 0 && x <= 1) { return x * leftWidth; } else if (x > 1 && x < 2) { @@ -238,7 +238,7 @@ public abstract class AbstractRegionPainter implements Painter { } else if (x >= 2 && x <= 3) { return ((x-2) * rightWidth) + leftWidth + centerWidth; } else { - throw new AssertionError("Invalid x"); + throw new IllegalArgumentException("Invalid x"); } } @@ -248,10 +248,10 @@ public abstract class AbstractRegionPainter implements Painter { * * @param y an encoded y value (0...1, or 1...2, or 2...3) * @return the decoded y value + * @throws IllegalArgumentException + * if {@code y < 0} or {@code y > 3} */ protected final float decodeY(float y) { - if (ctx.canvasSize == null) return y; - if (y >= 0 && y <= 1) { return y * topHeight; } else if (y > 1 && y < 2) { @@ -259,7 +259,7 @@ public abstract class AbstractRegionPainter implements Painter { } else if (y >= 2 && y <= 3) { return ((y-2) * bottomHeight) + topHeight + centerHeight; } else { - throw new AssertionError("Invalid y"); + throw new IllegalArgumentException("Invalid y"); } } @@ -271,10 +271,10 @@ public abstract class AbstractRegionPainter implements Painter { * @param x an encoded x value of the bezier control point (0...1, or 1...2, or 2...3) * @param dx the offset distance to the anchor from the control point x * @return the decoded x location of the control point + * @throws IllegalArgumentException + * if {@code x < 0} or {@code x > 3} */ protected final float decodeAnchorX(float x, float dx) { - if (ctx.canvasSize == null) return x + dx; - if (x >= 0 && x <= 1) { return decodeX(x) + (dx * leftScale); } else if (x > 1 && x < 2) { @@ -282,7 +282,7 @@ public abstract class AbstractRegionPainter implements Painter { } else if (x >= 2 && x <= 3) { return decodeX(x) + (dx * rightScale); } else { - throw new AssertionError("Invalid x"); + throw new IllegalArgumentException("Invalid x"); } } @@ -294,10 +294,10 @@ public abstract class AbstractRegionPainter implements Painter { * @param y an encoded y value of the bezier control point (0...1, or 1...2, or 2...3) * @param dy the offset distance to the anchor from the control point y * @return the decoded y position of the control point + * @throws IllegalArgumentException + * if {@code y < 0} or {@code y > 3} */ protected final float decodeAnchorY(float y, float dy) { - if (ctx.canvasSize == null) return y + dy; - if (y >= 0 && y <= 1) { return decodeY(y) + (dy * topScale); } else if (y > 1 && y < 2) { @@ -305,7 +305,7 @@ public abstract class AbstractRegionPainter implements Painter { } else if (y >= 2 && y <= 3) { return decodeY(y) + (dy * bottomScale); } else { - throw new AssertionError("Invalid y"); + throw new IllegalArgumentException("Invalid y"); } } @@ -363,6 +363,15 @@ public abstract class AbstractRegionPainter implements Painter { * @param midpoints * @param colors * @return a valid LinearGradientPaint. This method never returns null. + * @throws NullPointerException + * if {@code midpoints} array is null, + * or {@code colors} array is null, + * @throws IllegalArgumentException + * if start and end points are the same points, + * or {@code midpoints.length != colors.length}, + * or {@code colors} is less than 2 in size, + * or a {@code midpoints} value is less than 0.0 or greater than 1.0, + * or the {@code midpoints} are not provided in strictly increasing order */ protected final LinearGradientPaint decodeGradient(float x1, float y1, float x2, float y2, float[] midpoints, Color[] colors) { if (x1 == x2 && y1 == y2) { @@ -384,6 +393,15 @@ public abstract class AbstractRegionPainter implements Painter { * @param midpoints * @param colors * @return a valid RadialGradientPaint. This method never returns null. + * @throws NullPointerException + * if {@code midpoints} array is null, + * or {@code colors} array is null + * @throws IllegalArgumentException + * if {@code r} is non-positive, + * or {@code midpoints.length != colors.length}, + * or {@code colors} is less than 2 in size, + * or a {@code midpoints} value is less than 0.0 or greater than 1.0, + * or the {@code midpoints} are not provided in strictly increasing order */ protected final RadialGradientPaint decodeRadialGradient(float x, float y, float r, float[] midpoints, Color[] colors) { if (r == 0f) { @@ -537,10 +555,10 @@ public abstract class AbstractRegionPainter implements Painter { this.maxVerticalScaleFactor = maxV; if (canvasSize != null) { - a = insets.left; - b = canvasSize.width - insets.right; - c = insets.top; - d = canvasSize.height - insets.bottom; + a = stretchingInsets.left; + b = canvasSize.width - stretchingInsets.right; + c = stretchingInsets.top; + d = canvasSize.height - stretchingInsets.bottom; this.canvasSize = canvasSize; this.inverted = inverted; if (inverted) { diff --git a/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java b/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java index 921ca0ea74c385aade8f5ec7dcd1da08d6cbb437..f96a03c90454e1808951d7c44ea3ba6ece5f7554 100644 --- a/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java +++ b/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java @@ -84,6 +84,8 @@ class NimbusIcon extends SynthIcon { translatex = 1; } } + } else if (c instanceof JMenu) { + flip = ! c.getComponentOrientation().isLeftToRight(); } if (g instanceof Graphics2D){ Graphics2D gfx = (Graphics2D)g; diff --git a/src/share/classes/javax/swing/text/GlyphView.java b/src/share/classes/javax/swing/text/GlyphView.java index 364fd69e8eedd2d2a65408fb60a3d5c5faf07f6c..087e9201545612c1782d31028a03a7724abd328c 100644 --- a/src/share/classes/javax/swing/text/GlyphView.java +++ b/src/share/classes/javax/swing/text/GlyphView.java @@ -719,8 +719,9 @@ public class GlyphView extends View implements TabableView, Cloneable { checkPainter(); int p0 = getStartOffset(); int p1 = painter.getBoundedPosition(this, p0, pos, len); - return ((p1 > p0) && (getBreakSpot(p0, p1) != BreakIterator.DONE)) ? - View.ExcellentBreakWeight : View.BadBreakWeight; + return p1 == p0 ? View.BadBreakWeight : + getBreakSpot(p0, p1) != BreakIterator.DONE ? + View.ExcellentBreakWeight : View.GoodBreakWeight; } return super.getBreakWeight(axis, pos, len); } diff --git a/src/share/classes/javax/swing/text/ParagraphView.java b/src/share/classes/javax/swing/text/ParagraphView.java index c7f6bb09c3e134558e586e05be8d92b45be1cf7e..2b5f7826a08bc047b424731a7e0251626a2e0b82 100644 --- a/src/share/classes/javax/swing/text/ParagraphView.java +++ b/src/share/classes/javax/swing/text/ParagraphView.java @@ -174,23 +174,6 @@ public class ParagraphView extends FlowView implements TabExpander { return layoutPool.getView(index); } - /** - * Adjusts the given row if possible to fit within the - * layout span. By default this will try to find the - * highest break weight possible nearest the end of - * the row. If a forced break is encountered, the - * break will be positioned there. - *

- * This is meant for internal usage, and should not be used directly. - * - * @param r the row to adjust to the current layout - * span - * @param desiredSpan the current layout span >= 0 - * @param x the location r starts at - */ - protected void adjustRow(Row r, int desiredSpan, int x) { - } - /** * Returns the next visual position for the cursor, in * either the east or west direction. diff --git a/src/share/classes/sun/awt/shell/ShellFolder.java b/src/share/classes/sun/awt/shell/ShellFolder.java index d38fd98e030722f8a55ba208cce23beac7f2bab3..cf3c78933849048a44d5ba1506b25ed32d37c337 100644 --- a/src/share/classes/sun/awt/shell/ShellFolder.java +++ b/src/share/classes/sun/awt/shell/ShellFolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -289,8 +289,8 @@ public abstract class ShellFolder extends File { // To avoid loads of synchronizations with Invoker and improve performance we // synchronize the whole code of the sort method once - getInvoker().invoke(new Callable() { - public Void call() throws Exception { + invoke(new Callable() { + public Void call() { // Check that we can use the ShellFolder.sortChildren() method: // 1. All files have the same non-null parent // 2. All files is ShellFolders @@ -330,8 +330,8 @@ public abstract class ShellFolder extends File { public void sortChildren(final List files) { // To avoid loads of synchronizations with Invoker and improve performance we // synchronize the whole code of the sort method once - getInvoker().invoke(new Callable() { - public Void call() throws Exception { + invoke(new Callable() { + public Void call() { Collections.sort(files, FILE_COMPARATOR); return null; @@ -501,18 +501,62 @@ public abstract class ShellFolder extends File { return invoker; } + /** + * Invokes the {@code task} which doesn't throw checked exceptions + * from its {@code call} method. If invokation is interrupted then Thread.currentThread().isInterrupted() will + * be set and result will be {@code null} + */ + public static T invoke(Callable task) { + try { + return invoke(task, RuntimeException.class); + } catch (InterruptedException e) { + return null; + } + } + + /** + * Invokes the {@code task} which throws checked exceptions from its {@code call} method. + * If invokation is interrupted then Thread.currentThread().isInterrupted() will + * be set and InterruptedException will be thrown as well. + */ + public static T invoke(Callable task, Class exceptionClass) + throws InterruptedException, E { + try { + return getInvoker().invoke(task); + } catch (Exception e) { + if (e instanceof RuntimeException) { + // Rethrow unchecked exceptions + throw (RuntimeException) e; + } + + if (e instanceof InterruptedException) { + // Set isInterrupted flag for current thread + Thread.currentThread().interrupt(); + + // Rethrow InterruptedException + throw (InterruptedException) e; + } + + if (exceptionClass.isInstance(e)) { + throw exceptionClass.cast(e); + } + + throw new RuntimeException("Unexpected error", e); + } + } + /** * Interface allowing to invoke tasks in different environments on different platforms. */ public static interface Invoker { /** - * Invokes a callable task. If the {@code task} throws a checked exception, - * it will be wrapped into a {@link RuntimeException} + * Invokes a callable task. * * @param task a task to invoke + * @throws Exception {@code InterruptedException} or an exception that was thrown from the {@code task} * @return the result of {@code task}'s invokation */ - T invoke(Callable task); + T invoke(Callable task) throws Exception; } /** diff --git a/src/share/classes/sun/awt/shell/ShellFolderManager.java b/src/share/classes/sun/awt/shell/ShellFolderManager.java index dc8901f7bc5aebc4fb185d661b0c4bd40a06d118..fe00063ffbb96819415056a38ae29a3d60105fbd 100644 --- a/src/share/classes/sun/awt/shell/ShellFolderManager.java +++ b/src/share/classes/sun/awt/shell/ShellFolderManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,12 +108,8 @@ class ShellFolderManager { } private static class DirectInvoker implements ShellFolder.Invoker { - public T invoke(Callable task) { - try { - return task.call(); - } catch (Exception e) { - throw new RuntimeException(e); - } + public T invoke(Callable task) throws Exception { + return task.call(); } } } diff --git a/src/share/classes/sun/dyn/FilterGeneric.java b/src/share/classes/sun/dyn/FilterGeneric.java index a99eb26c9eef9d1d8c7479069bc3479390129c26..a746ad21b95e8f5cfcb9e7e81cf88bd38b8c0d5c 100644 --- a/src/share/classes/sun/dyn/FilterGeneric.java +++ b/src/share/classes/sun/dyn/FilterGeneric.java @@ -16,7 +16,7 @@ * * 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 Sf, tifth Floor, Boston, MA 02110-1301 USA. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or diff --git a/src/share/classes/sun/security/pkcs11/JarVerifier.java b/src/share/classes/sun/security/pkcs11/JarVerifier.java deleted file mode 100644 index 092c5725dba54d698f334ae080dc74b5a15cb757..0000000000000000000000000000000000000000 --- a/src/share/classes/sun/security/pkcs11/JarVerifier.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package sun.security.pkcs11; - -// NOTE: this class is duplicated amongst SunJCE, SunPKCS11, and SunMSCAPI. -// All files should be kept in sync. - -import java.io.*; -import java.util.*; -import java.util.jar.*; -import java.net.URL; -import java.net.JarURLConnection; -import java.net.MalformedURLException; - -import java.security.*; -import java.security.cert.*; -import java.security.cert.Certificate; - -/** - * This class verifies JAR files (and any supporting JAR files), and - * determines whether they may be used in this implementation. - * - * The JCE in OpenJDK has an open cryptographic interface, meaning it - * does not restrict which providers can be used. Compliance with - * United States export controls and with local law governing the - * import/export of products incorporating the JCE in the OpenJDK is - * the responsibility of the licensee. - * - * @since 1.7 - */ -final class JarVerifier { - - private static final boolean debug = false; - - /** - * Verify the JAR file is signed by an entity which has a certificate - * issued by a trusted CA. - * - * Note: this is a temporary method and will change soon to use the - * exception chaining mechanism, which can provide more details - * as to why the verification failed. - * - * @param c the class to be verified. - * @return true if verification is successful. - */ - static boolean verify(final Class c) { - return true; - } -} diff --git a/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/src/share/classes/sun/security/pkcs11/SunPKCS11.java index 6d0e045f2ee811256082a798714ce4ec67b3af71..674092e16178b15c10a2b0f66a6307d656c85871 100644 --- a/src/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/src/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -390,24 +390,6 @@ public final class SunPKCS11 extends AuthProvider { return sb.toString(); } - // set to true once self verification is complete - private static volatile boolean integrityVerified; - - static void verifySelfIntegrity(Class c) { - if (integrityVerified) { - return; - } - doVerifySelfIntegrity(c); - } - - private static synchronized void doVerifySelfIntegrity(Class c) { - integrityVerified = JarVerifier.verify(c); - if (integrityVerified == false) { - throw new ProviderException - ("The SunPKCS11 provider may have been tampered with."); - } - } - public boolean equals(Object obj) { return this == obj; } @@ -923,7 +905,6 @@ public final class SunPKCS11 extends AuthProvider { if (type == MD) { return new P11Digest(token, algorithm, mechanism); } else if (type == CIP) { - verifySelfIntegrity(getClass()); if (algorithm.startsWith("RSA")) { return new P11RSACipher(token, algorithm, mechanism); } else { @@ -932,12 +913,10 @@ public final class SunPKCS11 extends AuthProvider { } else if (type == SIG) { return new P11Signature(token, algorithm, mechanism); } else if (type == MAC) { - verifySelfIntegrity(getClass()); return new P11Mac(token, algorithm, mechanism); } else if (type == KPG) { return new P11KeyPairGenerator(token, algorithm, mechanism); } else if (type == KA) { - verifySelfIntegrity(getClass()); if (algorithm.equals("ECDH")) { return new P11ECDHKeyAgreement(token, algorithm, mechanism); } else { @@ -946,11 +925,8 @@ public final class SunPKCS11 extends AuthProvider { } else if (type == KF) { return token.getKeyFactory(algorithm); } else if (type == SKF) { - verifySelfIntegrity(getClass()); return new P11SecretKeyFactory(token, algorithm); } else if (type == KG) { - verifySelfIntegrity(getClass()); - // reference equality if (algorithm == "SunTlsRsaPremasterSecret") { return new P11TlsRsaPremasterSecretGenerator( diff --git a/src/share/classes/sun/swing/FilePane.java b/src/share/classes/sun/swing/FilePane.java index eae3d5a0d602be71b2d79ed0a1fd84001d43adf8..4aa80522216b667ea513ba7cd270933e7674368f 100644 --- a/src/share/classes/sun/swing/FilePane.java +++ b/src/share/classes/sun/swing/FilePane.java @@ -1,6 +1,5 @@ - /* - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -905,8 +904,8 @@ public class FilePane extends JPanel implements PropertyChangeListener { @Override public void sort() { - ShellFolder.getInvoker().invoke(new Callable() { - public Void call() throws Exception { + ShellFolder.invoke(new Callable() { + public Void call() { DetailsTableRowSorter.super.sort(); return null; } diff --git a/src/share/classes/sun/swing/MenuItemLayoutHelper.java b/src/share/classes/sun/swing/MenuItemLayoutHelper.java index 109d0c4022c5a814309d3dc097d27acfc429832d..1f0281e9be3a1ba34f8b27c18ebec3fca9fba2e1 100644 --- a/src/share/classes/sun/swing/MenuItemLayoutHelper.java +++ b/src/share/classes/sun/swing/MenuItemLayoutHelper.java @@ -718,10 +718,10 @@ public class MenuItemLayoutHelper { } private void alignRect(Rectangle rect, int alignment, int origWidth) { - if (alignment != SwingUtilities.LEFT) { + if (alignment == SwingConstants.RIGHT) { rect.x = rect.x + rect.width - origWidth; - rect.width = origWidth; } + rect.width = origWidth; } protected void layoutIconAndTextInLabelRect(LayoutResult lr) { diff --git a/src/solaris/classes/sun/awt/X11/XRobotPeer.java b/src/solaris/classes/sun/awt/X11/XRobotPeer.java index 663c0ed8a04e82f56b35a1a2a5120cea1cb97fef..82e226363b9e3ae59f3efe17cbae8ad5cf3759a1 100644 --- a/src/solaris/classes/sun/awt/X11/XRobotPeer.java +++ b/src/solaris/classes/sun/awt/X11/XRobotPeer.java @@ -27,6 +27,7 @@ package sun.awt.X11; import java.awt.*; import java.awt.peer.*; import sun.awt.X11GraphicsConfig; +import sun.awt.SunToolkit; class XRobotPeer implements RobotPeer { private X11GraphicsConfig xgc = null; @@ -38,7 +39,8 @@ class XRobotPeer implements RobotPeer { XRobotPeer(GraphicsConfiguration gc) { this.xgc = (X11GraphicsConfig)gc; - setup(); + SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); + setup(tk.getNumberOfButtons()); } public void dispose() { @@ -81,7 +83,7 @@ class XRobotPeer implements RobotPeer { return pixelArray; } - private static native synchronized void setup(); + private static native synchronized void setup(int numberOfButtons); private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y); private static native synchronized void mousePressImpl(int buttons); diff --git a/src/solaris/native/sun/awt/awt_Robot.c b/src/solaris/native/sun/awt/awt_Robot.c index 18aa1554b9824a8658fd35694db626ac7602a7a7..dbeebfe44fb34531858e6f38895cccc2ea281212 100644 --- a/src/solaris/native/sun/awt/awt_Robot.c +++ b/src/solaris/native/sun/awt/awt_Robot.c @@ -51,9 +51,8 @@ extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs; -extern int32_t getNumButtons(); - static jint * masks; +static jint num_buttons; static int32_t isXTestAvailable() { int32_t major_opcode, first_event, first_error; @@ -164,34 +163,34 @@ static XImage *getWindowImage(Display * display, Window window, /*********************************************************************************************/ +// this should be called from XRobotPeer constructor JNIEXPORT void JNICALL -Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls) { +Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons) { int32_t xtestAvailable; -// this should be called from XRobotPeer constructor + DTRACE_PRINTLN("RobotPeer: setup()"); + + num_buttons = numberOfButtons; + jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent"); jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I"); jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID); - jsize len = (*env)->GetArrayLength(env, obj); jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE); - masks = (jint *)malloc(sizeof(jint)*len); + masks = (jint *)malloc(sizeof(jint) * num_buttons); if (masks == (jint *) NULL) { JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL); goto finally; } int i; - for (i = 0; i < len; i++) { + for (i = 0; i < num_buttons; i++) { masks[i] = tmp[i]; } (*env)->ReleaseIntArrayElements(env, obj, tmp, 0); (*env)->DeleteLocalRef(env, obj); - DTRACE_PRINTLN("RobotPeer: setup()"); - AWT_LOCK(); - xtestAvailable = isXTestAvailable(); DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable); if (!xtestAvailable) { @@ -338,8 +337,6 @@ void mouseAction(JNIEnv *env, { AWT_LOCK(); - int32_t num_buttons = getNumButtons(); //from XToolkit.c - DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask); DTRACE_PRINTLN1("RobotPeer: mouseAction, press = %d", isMousePress); diff --git a/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java index 716b56238cf07b0fd46e83489ae4463d86ece275..1b81007fe8e95d6048727ed0d4a53dde037ab2a6 100644 --- a/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import java.awt.Image; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.*; import java.util.concurrent.*; @@ -185,8 +184,8 @@ final class Win32ShellFolder2 extends ShellFolder { boolean disposed; public void dispose() { if (disposed) return; - ShellFolder.getInvoker().invoke(new Callable() { - public Void call() throws Exception { + invoke(new Callable() { + public Void call() { if (relativePIDL != 0) { releasePIDL(relativePIDL); } @@ -224,7 +223,7 @@ final class Win32ShellFolder2 extends ShellFolder { */ private boolean isPersonal; - private static String composePathForCsidl(int csidl) throws IOException { + private static String composePathForCsidl(int csidl) throws IOException, InterruptedException { String path = getFileSystemPath(csidl); return path == null ? ("ShellFolder: 0x" + Integer.toHexString(csidl)) @@ -235,12 +234,13 @@ final class Win32ShellFolder2 extends ShellFolder { * Create a system special shell folder, such as the * desktop or Network Neighborhood. */ - Win32ShellFolder2(final int csidl) throws IOException { + Win32ShellFolder2(final int csidl) throws IOException, InterruptedException { // Desktop is parent of DRIVES and NETWORK, not necessarily // other special shell folders. super(null, composePathForCsidl(csidl)); - ShellFolder.getInvoker().invoke(new Callable() { - public Void call() throws Exception { + + invoke(new Callable() { + public Void call() throws InterruptedException { if (csidl == DESKTOP) { initDesktop(); } else { @@ -276,7 +276,7 @@ final class Win32ShellFolder2 extends ShellFolder { } return null; } - }); + }, InterruptedException.class); sun.java2d.Disposer.addRecord(this, disposer); } @@ -296,13 +296,13 @@ final class Win32ShellFolder2 extends ShellFolder { /** * Creates a shell folder with a parent and relative PIDL */ - Win32ShellFolder2(final Win32ShellFolder2 parent, final long relativePIDL) { + Win32ShellFolder2(final Win32ShellFolder2 parent, final long relativePIDL) throws InterruptedException { super(parent, - ShellFolder.getInvoker().invoke(new Callable() { - public String call() throws Exception { + invoke(new Callable() { + public String call() { return getFileSystemPath(parent.getIShellFolder(), relativePIDL); } - }) + }, RuntimeException.class) ); this.disposer.relativePIDL = relativePIDL; getAbsolutePath(); @@ -335,8 +335,8 @@ final class Win32ShellFolder2 extends ShellFolder { * drive (normally "C:\"). */ protected Object writeReplace() throws java.io.ObjectStreamException { - return ShellFolder.getInvoker().invoke(new Callable() { - public File call() throws Exception { + return invoke(new Callable() { + public File call() { if (isFileSystem()) { return new File(getPath()); } else { @@ -398,11 +398,11 @@ final class Win32ShellFolder2 extends ShellFolder { /** * Accessor for IShellFolder */ - public long getIShellFolder() { + private long getIShellFolder() { if (disposer.pIShellFolder == 0) { - disposer.pIShellFolder = - ShellFolder.getInvoker().invoke(new Callable() { - public Long call() throws Exception { + try { + disposer.pIShellFolder = invoke(new Callable() { + public Long call() { assert(isDirectory()); assert(parent != null); long parentIShellFolder = getParentIShellFolder(); @@ -421,7 +421,10 @@ final class Win32ShellFolder2 extends ShellFolder { } return pIShellFolder; } - }); + }, RuntimeException.class); + } catch (InterruptedException e) { + // Ignore error + } } return disposer.pIShellFolder; } @@ -505,18 +508,23 @@ final class Win32ShellFolder2 extends ShellFolder { } if (parent == rhs.parent || parent.equals(rhs.parent)) { - return pidlsEqual(getParentIShellFolder(), disposer.relativePIDL, rhs.disposer.relativePIDL); + try { + return pidlsEqual(getParentIShellFolder(), disposer.relativePIDL, rhs.disposer.relativePIDL); + } catch (InterruptedException e) { + return false; + } } return false; } - private static boolean pidlsEqual(final long pIShellFolder, final long pidl1, final long pidl2) { - return ShellFolder.getInvoker().invoke(new Callable() { - public Boolean call() throws Exception { - return (compareIDs(pIShellFolder, pidl1, pidl2) == 0); + private static boolean pidlsEqual(final long pIShellFolder, final long pidl1, final long pidl2) + throws InterruptedException { + return invoke(new Callable() { + public Boolean call() { + return compareIDs(pIShellFolder, pidl1, pidl2) == 0; } - }); + }, RuntimeException.class); } // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details @@ -539,14 +547,16 @@ final class Win32ShellFolder2 extends ShellFolder { * Return whether the given attribute flag is set for this object */ public boolean hasAttribute(final int attribute) { - return ShellFolder.getInvoker().invoke(new Callable() { - public Boolean call() throws Exception { + Boolean result = invoke(new Callable() { + public Boolean call() { // Caching at this point doesn't seem to be cost efficient return (getAttributes0(getParentIShellFolder(), getRelativePIDL(), attribute) & attribute) != 0; } }); + + return result != null && result; } /** @@ -561,32 +571,29 @@ final class Win32ShellFolder2 extends ShellFolder { private static native int getAttributes0(long pParentIShellFolder, long pIDL, int attrsMask); // Return the path to the underlying file system object + // Should be called from the COM thread private static String getFileSystemPath(final long parentIShellFolder, final long relativePIDL) { - return ShellFolder.getInvoker().invoke(new Callable() { - public String call() throws Exception { - int linkedFolder = ATTRIB_LINK | ATTRIB_FOLDER; - if (parentIShellFolder == Win32ShellFolderManager2.getNetwork().getIShellFolder() && - getAttributes0(parentIShellFolder, relativePIDL, linkedFolder) == linkedFolder) { - - String s = - getFileSystemPath(Win32ShellFolderManager2.getDesktop().getIShellFolder(), - getLinkLocation(parentIShellFolder, relativePIDL, false)); - if (s != null && s.startsWith("\\\\")) { - return s; - } - } - return getDisplayNameOf(parentIShellFolder, relativePIDL, SHGDN_FORPARSING); + int linkedFolder = ATTRIB_LINK | ATTRIB_FOLDER; + if (parentIShellFolder == Win32ShellFolderManager2.getNetwork().getIShellFolder() && + getAttributes0(parentIShellFolder, relativePIDL, linkedFolder) == linkedFolder) { + + String s = + getFileSystemPath(Win32ShellFolderManager2.getDesktop().getIShellFolder(), + getLinkLocation(parentIShellFolder, relativePIDL, false)); + if (s != null && s.startsWith("\\\\")) { + return s; } - }); + } + return getDisplayNameOf(parentIShellFolder, relativePIDL, SHGDN_FORPARSING); } // Needs to be accessible to Win32ShellFolderManager2 - static String getFileSystemPath(final int csidl) throws IOException { - return ShellFolder.getInvoker().invoke(new Callable() { - public String call() throws Exception { + static String getFileSystemPath(final int csidl) throws IOException, InterruptedException { + return invoke(new Callable() { + public String call() throws IOException { return getFileSystemPath0(csidl); } - }); + }, IOException.class); } // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details @@ -630,13 +637,14 @@ final class Win32ShellFolder2 extends ShellFolder { */ // Returns an IEnumIDList interface for an IShellFolder. The value // returned must be released using releaseEnumObjects(). - private long getEnumObjects(long pIShellFolder, final boolean includeHiddenFiles) { - final boolean isDesktop = (disposer.pIShellFolder == getDesktopIShellFolder()); - return ShellFolder.getInvoker().invoke(new Callable() { - public Long call() throws Exception { + private long getEnumObjects(final boolean includeHiddenFiles) throws InterruptedException { + return invoke(new Callable() { + public Long call() { + boolean isDesktop = disposer.pIShellFolder == getDesktopIShellFolder(); + return getEnumObjects(disposer.pIShellFolder, isDesktop, includeHiddenFiles); } - }); + }, RuntimeException.class); } // Returns an IEnumIDList interface for an IShellFolder. The value @@ -670,58 +678,62 @@ final class Win32ShellFolder2 extends ShellFolder { security.checkRead(getPath()); } - return ShellFolder.getInvoker().invoke(new Callable() { - public File[] call() throws Exception { - if (!isDirectory()) { - return null; - } - // Links to directories are not directories and cannot be parents. - // This does not apply to folders in My Network Places (NetHood) - // because they are both links and real directories! - if (isLink() && !hasAttribute(ATTRIB_FOLDER)) { - return new File[0]; - } - - Win32ShellFolder2 desktop = Win32ShellFolderManager2.getDesktop(); - Win32ShellFolder2 personal = Win32ShellFolderManager2.getPersonal(); + try { + return invoke(new Callable() { + public File[] call() throws InterruptedException { + if (!isDirectory()) { + return null; + } + // Links to directories are not directories and cannot be parents. + // This does not apply to folders in My Network Places (NetHood) + // because they are both links and real directories! + if (isLink() && !hasAttribute(ATTRIB_FOLDER)) { + return new File[0]; + } - // If we are a directory, we have a parent and (at least) a - // relative PIDL. We must first ensure we are bound to the - // parent so we have an IShellFolder to query. - long pIShellFolder = getIShellFolder(); - // Now we can enumerate the objects in this folder. - ArrayList list = new ArrayList(); - long pEnumObjects = getEnumObjects(pIShellFolder, includeHiddenFiles); - if (pEnumObjects != 0) { - long childPIDL; - int testedAttrs = ATTRIB_FILESYSTEM | ATTRIB_FILESYSANCESTOR; - do { - childPIDL = getNextChild(pEnumObjects); - boolean releasePIDL = true; - if (childPIDL != 0 && - (getAttributes0(pIShellFolder, childPIDL, testedAttrs) & testedAttrs) != 0) { - Win32ShellFolder2 childFolder; - if (Win32ShellFolder2.this.equals(desktop) - && personal != null - && pidlsEqual(pIShellFolder, childPIDL, personal.disposer.relativePIDL)) { - childFolder = personal; - } else { - childFolder = new Win32ShellFolder2(Win32ShellFolder2.this, childPIDL); - releasePIDL = false; + Win32ShellFolder2 desktop = Win32ShellFolderManager2.getDesktop(); + Win32ShellFolder2 personal = Win32ShellFolderManager2.getPersonal(); + + // If we are a directory, we have a parent and (at least) a + // relative PIDL. We must first ensure we are bound to the + // parent so we have an IShellFolder to query. + long pIShellFolder = getIShellFolder(); + // Now we can enumerate the objects in this folder. + ArrayList list = new ArrayList(); + long pEnumObjects = getEnumObjects(includeHiddenFiles); + if (pEnumObjects != 0) { + long childPIDL; + int testedAttrs = ATTRIB_FILESYSTEM | ATTRIB_FILESYSANCESTOR; + do { + childPIDL = getNextChild(pEnumObjects); + boolean releasePIDL = true; + if (childPIDL != 0 && + (getAttributes0(pIShellFolder, childPIDL, testedAttrs) & testedAttrs) != 0) { + Win32ShellFolder2 childFolder; + if (Win32ShellFolder2.this.equals(desktop) + && personal != null + && pidlsEqual(pIShellFolder, childPIDL, personal.disposer.relativePIDL)) { + childFolder = personal; + } else { + childFolder = new Win32ShellFolder2(Win32ShellFolder2.this, childPIDL); + releasePIDL = false; + } + list.add(childFolder); } - list.add(childFolder); - } - if (releasePIDL) { - releasePIDL(childPIDL); - } - } while (childPIDL != 0 && !Thread.currentThread().isInterrupted()); - releaseEnumObjects(pEnumObjects); + if (releasePIDL) { + releasePIDL(childPIDL); + } + } while (childPIDL != 0 && !Thread.currentThread().isInterrupted()); + releaseEnumObjects(pEnumObjects); + } + return Thread.currentThread().isInterrupted() + ? new File[0] + : list.toArray(new ShellFolder[list.size()]); } - return Thread.currentThread().isInterrupted() - ? new File[0] - : list.toArray(new ShellFolder[list.size()]); - } - }); + }, InterruptedException.class); + } catch (InterruptedException e) { + return new File[0]; + } } @@ -730,13 +742,13 @@ final class Win32ShellFolder2 extends ShellFolder { * * @return The child shellfolder, or null if not found. */ - Win32ShellFolder2 getChildByPath(final String filePath) { - return ShellFolder.getInvoker().invoke(new Callable() { - public Win32ShellFolder2 call() throws Exception { + Win32ShellFolder2 getChildByPath(final String filePath) throws InterruptedException { + return invoke(new Callable() { + public Win32ShellFolder2 call() throws InterruptedException { long pIShellFolder = getIShellFolder(); - long pEnumObjects = getEnumObjects(pIShellFolder, true); + long pEnumObjects = getEnumObjects(true); Win32ShellFolder2 child = null; - long childPIDL = 0; + long childPIDL; while ((childPIDL = getNextChild(pEnumObjects)) != 0) { if (getAttributes0(pIShellFolder, childPIDL, ATTRIB_FILESYSTEM) != 0) { @@ -753,7 +765,7 @@ final class Win32ShellFolder2 extends ShellFolder { releaseEnumObjects(pEnumObjects); return child; } - }); + }, InterruptedException.class); } private Boolean cachedIsLink; @@ -791,8 +803,8 @@ final class Win32ShellFolder2 extends ShellFolder { } private ShellFolder getLinkLocation(final boolean resolve) { - return ShellFolder.getInvoker().invoke(new Callable() { - public ShellFolder call() throws Exception { + return invoke(new Callable() { + public ShellFolder call() { if (!isLink()) { return null; } @@ -805,6 +817,8 @@ final class Win32ShellFolder2 extends ShellFolder { location = Win32ShellFolderManager2.createShellFolderFromRelativePIDL(getDesktop(), linkLocationPIDL); + } catch (InterruptedException e) { + // Return null } catch (InternalError e) { // Could be a link to a non-bindable object, such as a network connection // TODO: getIShellFolder() should throw FileNotFoundException instead @@ -816,19 +830,12 @@ final class Win32ShellFolder2 extends ShellFolder { } // Parse a display name into a PIDL relative to the current IShellFolder. - long parseDisplayName(final String name) throws FileNotFoundException { - try { - return ShellFolder.getInvoker().invoke(new Callable() { - public Long call() throws Exception { - return parseDisplayName0(getIShellFolder(), name); - } - }); - } catch (RuntimeException e) { - if (e.getCause() instanceof IOException) { - throw new FileNotFoundException("Could not find file " + name); + long parseDisplayName(final String name) throws IOException, InterruptedException { + return invoke(new Callable() { + public Long call() throws IOException { + return parseDisplayName0(getIShellFolder(), name); } - throw e; - } + }, IOException.class); } // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details @@ -846,8 +853,8 @@ final class Win32ShellFolder2 extends ShellFolder { public String getDisplayName() { if (displayName == null) { displayName = - ShellFolder.getInvoker().invoke(new Callable() { - public String call() throws Exception { + invoke(new Callable() { + public String call() { return getDisplayNameOf(getParentIShellFolder(), getRelativePIDL(), SHGDN_NORMAL); } @@ -867,8 +874,8 @@ final class Win32ShellFolder2 extends ShellFolder { if (folderType == null) { final long absolutePIDL = getAbsolutePIDL(); folderType = - ShellFolder.getInvoker().invoke(new Callable() { - public String call() throws Exception { + invoke(new Callable() { + public String call() { return getFolderType(absolutePIDL); } }); @@ -926,15 +933,12 @@ final class Win32ShellFolder2 extends ShellFolder { public static native int[] getFileChooserBitmapBits(); + // Should be called from the COM thread private long getIShellIcon() { if (pIShellIcon == -1L) { - pIShellIcon = - ShellFolder.getInvoker().invoke(new Callable() { - public Long call() throws Exception { - return getIShellIcon(getIShellFolder()); - } - }); + pIShellIcon = getIShellIcon(getIShellFolder()); } + return pIShellIcon; } @@ -988,8 +992,8 @@ final class Win32ShellFolder2 extends ShellFolder { Image icon = getLargeIcon ? largeIcon : smallIcon; if (icon == null) { icon = - ShellFolder.getInvoker().invoke(new Callable() { - public Image call() throws Exception { + invoke(new Callable() { + public Image call() { Image newIcon = null; if (isFileSystem()) { long parentIShellIcon = (parent != null) @@ -1113,8 +1117,8 @@ final class Win32ShellFolder2 extends ShellFolder { private static final int LVCFMT_CENTER = 2; public ShellFolderColumnInfo[] getFolderColumns() { - return ShellFolder.getInvoker().invoke(new Callable() { - public ShellFolderColumnInfo[] call() throws Exception { + return invoke(new Callable() { + public ShellFolderColumnInfo[] call() { ShellFolderColumnInfo[] columns = doGetColumnInfo(getIShellFolder()); if (columns != null) { @@ -1143,8 +1147,8 @@ final class Win32ShellFolder2 extends ShellFolder { } public Object getFolderColumnValue(final int column) { - return ShellFolder.getInvoker().invoke(new Callable() { - public Object call() throws Exception { + return invoke(new Callable() { + public Object call() { return doGetColumnValue(getParentIShellFolder(), getRelativePIDL(), column); } }); @@ -1163,8 +1167,8 @@ final class Win32ShellFolder2 extends ShellFolder { public void sortChildren(final List files) { // To avoid loads of synchronizations with Invoker and improve performance we // synchronize the whole code of the sort method once - getInvoker().invoke(new Callable() { - public Void call() throws Exception { + invoke(new Callable() { + public Void call() { Collections.sort(files, new ColumnComparator(getIShellFolder(), 0)); return null; @@ -1184,19 +1188,21 @@ final class Win32ShellFolder2 extends ShellFolder { // compares 2 objects within this folder by the specified column public int compare(final File o, final File o1) { - return ShellFolder.getInvoker().invoke(new Callable() { - public Integer call() throws Exception { + Integer result = invoke(new Callable() { + public Integer call() { if (o instanceof Win32ShellFolder2 - && o1 instanceof Win32ShellFolder2) { + && o1 instanceof Win32ShellFolder2) { // delegates comparison to native method return compareIDsByColumn(parentIShellFolder, - ((Win32ShellFolder2) o).getRelativePIDL(), - ((Win32ShellFolder2) o1).getRelativePIDL(), - columnIdx); + ((Win32ShellFolder2) o).getRelativePIDL(), + ((Win32ShellFolder2) o1).getRelativePIDL(), + columnIdx); } return 0; } }); + + return result == null ? 0 : result; } } } diff --git a/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java index 1586846357e91ebaf8ba23d6fbec1e3d238ec8dd..4471a3ec0daf3515cd0575b6aca0de766f6caea9 100644 --- a/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java +++ b/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,10 +58,15 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { } public ShellFolder createShellFolder(File file) throws FileNotFoundException { - return createShellFolder(getDesktop(), file); + try { + return createShellFolder(getDesktop(), file); + } catch (InterruptedException e) { + throw new FileNotFoundException("Execution was interrupted"); + } } - static Win32ShellFolder2 createShellFolder(Win32ShellFolder2 parent, File file) throws FileNotFoundException { + static Win32ShellFolder2 createShellFolder(Win32ShellFolder2 parent, File file) + throws FileNotFoundException, InterruptedException { long pIDL; try { pIDL = parent.parseDisplayName(file.getCanonicalPath()); @@ -77,7 +82,8 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { return folder; } - static Win32ShellFolder2 createShellFolderFromRelativePIDL(Win32ShellFolder2 parent, long pIDL) { + static Win32ShellFolder2 createShellFolderFromRelativePIDL(Win32ShellFolder2 parent, long pIDL) + throws InterruptedException { // Walk down this relative pIDL, creating new nodes for each of the entries while (pIDL != 0) { long curPIDL = Win32ShellFolder2.copyFirstPIDLEntry(pIDL); @@ -108,7 +114,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { try { desktop = new Win32ShellFolder2(DESKTOP); } catch (IOException e) { - desktop = null; + // Ignore error + } catch (InterruptedException e) { + // Ignore error } } return desktop; @@ -119,7 +127,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { try { drives = new Win32ShellFolder2(DRIVES); } catch (IOException e) { - drives = null; + // Ignore error + } catch (InterruptedException e) { + // Ignore error } } return drives; @@ -132,8 +142,10 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { if (path != null) { recent = createShellFolder(getDesktop(), new File(path)); } + } catch (InterruptedException e) { + // Ignore error } catch (IOException e) { - recent = null; + // Ignore error } } return recent; @@ -144,7 +156,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { try { network = new Win32ShellFolder2(NETWORK); } catch (IOException e) { - network = null; + // Ignore error + } catch (InterruptedException e) { + // Ignore error } } return network; @@ -164,8 +178,10 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { personal.setIsPersonal(); } } + } catch (InterruptedException e) { + // Ignore error } catch (IOException e) { - personal = null; + // Ignore error } } return personal; @@ -267,6 +283,9 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { } } catch (IOException e) { // Skip this value + } catch (InterruptedException e) { + // Return empty result + return new File[0]; } } while (value != null); @@ -476,33 +495,39 @@ public class Win32ShellFolderManager2 extends ShellFolderManager { return comThread; } - public T invoke(Callable task) { - try { - if (Thread.currentThread() == comThread) { - // if it's already called from the COM - // thread, we don't need to delegate the task - return task.call(); - } else { - while (true) { - Future future = submit(task); - - try { - return future.get(); - } catch (InterruptedException e) { - // Repeat the attempt - future.cancel(true); - } - } - } - } catch (Exception e) { - Throwable cause = (e instanceof ExecutionException) ? e.getCause() : e; - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; + public T invoke(Callable task) throws Exception { + if (Thread.currentThread() == comThread) { + // if it's already called from the COM + // thread, we don't need to delegate the task + return task.call(); + } else { + Future future; + + try { + future = submit(task); + } catch (RejectedExecutionException e) { + throw new InterruptedException(e.getMessage()); } - if (cause instanceof Error) { - throw (Error) cause; + + try { + return future.get(); + } catch (InterruptedException e) { + future.cancel(true); + + throw e; + } catch (ExecutionException e) { + Throwable cause = e.getCause(); + + if (cause instanceof Exception) { + throw (Exception) cause; + } + + if (cause instanceof Error) { + throw (Error) cause; + } + + throw new RuntimeException("Unexpected error", cause); } - throw new RuntimeException(cause); } } } diff --git a/src/windows/classes/sun/security/mscapi/JarVerifier.java b/src/windows/classes/sun/security/mscapi/JarVerifier.java deleted file mode 100644 index 1fcd6c997aeca9fe7473f59f08416ef59e2b5609..0000000000000000000000000000000000000000 --- a/src/windows/classes/sun/security/mscapi/JarVerifier.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -package sun.security.mscapi; - -// NOTE: this class is duplicated amongst SunJCE, SunPKCS11, and SunMSCAPI. -// All files should be kept in sync. - -import java.io.*; -import java.util.*; -import java.util.jar.*; -import java.net.URL; -import java.net.JarURLConnection; -import java.net.MalformedURLException; - -import java.security.*; -import java.security.cert.*; -import java.security.cert.Certificate; - -/** - * This class verifies JAR files (and any supporting JAR files), and - * determines whether they may be used in this implementation. - * - * The JCE in OpenJDK has an open cryptographic interface, meaning it - * does not restrict which providers can be used. Compliance with - * United States export controls and with local law governing the - * import/export of products incorporating the JCE in the OpenJDK is - * the responsibility of the licensee. - * - * @since 1.7 - */ -final class JarVerifier { - - private static final boolean debug = false; - - /** - * Verify the JAR file is signed by an entity which has a certificate - * issued by a trusted CA. - * - * Note: this is a temporary method and will change soon to use the - * exception chaining mechanism, which can provide more details - * as to why the verification failed. - * - * @param c the class to be verified. - * @return true if verification is successful. - */ - static boolean verify(final Class c) { - return true; - } -} diff --git a/src/windows/classes/sun/security/mscapi/RSACipher.java b/src/windows/classes/sun/security/mscapi/RSACipher.java index 06a82c5cdde8b88e4ded6f83effa2a4d01afc4a0..9a4a01c7cd6f877a72f131886d75246eaee1cdb0 100644 --- a/src/windows/classes/sun/security/mscapi/RSACipher.java +++ b/src/windows/classes/sun/security/mscapi/RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,6 @@ public final class RSACipher extends CipherSpi { private sun.security.mscapi.Key privateKey; public RSACipher() { - SunMSCAPI.verifySelfIntegrity(getClass()); paddingType = PAD_PKCS1; } diff --git a/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/src/windows/classes/sun/security/mscapi/SunMSCAPI.java index 4dcf217117d0c57c769ca56a1784d5fc1a9495e3..009406c60c9b5e5df1ce56fd7be69495ffbdae46 100644 --- a/src/windows/classes/sun/security/mscapi/SunMSCAPI.java +++ b/src/windows/classes/sun/security/mscapi/SunMSCAPI.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,22 +117,4 @@ public final class SunMSCAPI extends Provider { AccessController.doPrivileged(new PutAllAction(this, map)); } } - - // set to true once self verification is complete - private static volatile boolean integrityVerified; - - static void verifySelfIntegrity(Class c) { - if (integrityVerified) { - return; - } - doVerifySelfIntegrity(c); - } - - private static synchronized void doVerifySelfIntegrity(Class c) { - integrityVerified = JarVerifier.verify(c); - if (integrityVerified == false) { - throw new ProviderException - ("The SunMSCAPI provider may have been tampered with."); - } - } } diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index 1da71d1fd4ece7950a1f27eeb021cc85934daedb..b2767bac72c2a00af6ee385625ccd7a197bb4278 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -3739,11 +3739,12 @@ void AwtComponent::SetCandidateWindow(int iCandType, int x, int y) MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam) { - // This message causes native status window shown even it is disabled. So don't - // let DefWindowProc process this message if this IMC is disabled. + // If the Windows input context is disabled, do not let Windows + // display any UIs. HIMC hIMC = ImmGetContext(); if (hIMC == NULL) { - return mrConsume; + *lplParam = 0; + return mrDoDefault; } if (fSet) { diff --git a/test/java/awt/EventQueue/6638195/bug6638195.java b/test/java/awt/EventQueue/6638195/bug6638195.java index 9dc3b50b973c673d7cb8516043ffba19d4268bc0..c461239154746ec8680a6c9888efa5c1d0a3f026 100644 --- a/test/java/awt/EventQueue/6638195/bug6638195.java +++ b/test/java/awt/EventQueue/6638195/bug6638195.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* @test * - * @bug 6638195 + * @bug 6638195 6844297 * @author Igor Kushnirskiy * @summary tests if EventQueueDelegate.Delegate is invoked. */ @@ -47,11 +47,22 @@ public class bug6638195 { } private static void runTest(MyEventQueueDelegate delegate) throws Exception { + // We need an empty runnable here, so the next event is + // processed with a new EventQueueDelegate. See 6844297 + // for details EventQueue.invokeLater( new Runnable() { public void run() { } }); + // The following event is expected to be processed by + // the EventQueueDelegate instance + EventQueue.invokeLater( + new Runnable() { + public void run() { + } + }); + // Finally, proceed on the main thread final CountDownLatch latch = new CountDownLatch(1); EventQueue.invokeLater( new Runnable() { @@ -60,7 +71,7 @@ public class bug6638195 { } }); latch.await(); - if (! delegate.allInvoked()) { + if (!delegate.allInvoked()) { throw new RuntimeException("failed"); } } @@ -125,6 +136,7 @@ public class bug6638195 { return objectMap; } + static class MyEventQueueDelegate implements EventQueueDelegate.Delegate { private volatile boolean getNextEventInvoked = false; private volatile boolean beforeDispatchInvoked = false; diff --git a/test/java/awt/Frame/FrameSize/TestFrameSize.java b/test/java/awt/Frame/FrameSize/TestFrameSize.java index b220ec5cc010f9e8d60594eec6634f633c3457c9..29a4399a60973d7b1166268e905fb1489c0e01b5 100644 --- a/test/java/awt/Frame/FrameSize/TestFrameSize.java +++ b/test/java/awt/Frame/FrameSize/TestFrameSize.java @@ -1,5 +1,6 @@ /* * Copyright 2009 Red Hat, Inc. All Rights Reserved. + * Portions Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,35 +38,62 @@ * Test fails if size of window is wrong */ -import java.awt.Dimension; -import java.awt.Frame; +import java.awt.*; public class TestFrameSize { - static Dimension desiredDimensions = new Dimension(200, 200); - static int ERROR_MARGIN = 15; - static Frame mainWindow; - - public static void drawGui() { - mainWindow = new Frame(""); - mainWindow.setPreferredSize(desiredDimensions); - mainWindow.pack(); - - Dimension actualDimensions = mainWindow.getSize(); - System.out.println("Desired dimensions: " + desiredDimensions.toString()); - System.out.println("Actual dimensions: " + actualDimensions.toString()); - if (Math.abs(actualDimensions.height - desiredDimensions.height) > ERROR_MARGIN) { - throw new RuntimeException("Incorrect widow size"); - } + static Dimension desiredDimensions = new Dimension(200, 200); + static Frame mainWindow; + + private static Dimension getClientSize(Frame window) { + Dimension size = window.getSize(); + Insets insets = window.getInsets(); + + System.out.println("getClientSize() for " + window); + System.out.println(" size: " + size); + System.out.println(" insets: " + insets); + + return new Dimension( + size.width - insets.left - insets.right, + size.height - insets.top - insets.bottom); + } + + public static void drawGui() { + mainWindow = new Frame(""); + mainWindow.setPreferredSize(desiredDimensions); + mainWindow.pack(); + + Dimension actualDimensions = mainWindow.getSize(); + System.out.println("Desired dimensions: " + desiredDimensions.toString()); + System.out.println("Actual dimensions: " + actualDimensions.toString()); + if (!actualDimensions.equals(desiredDimensions)) { + throw new RuntimeException("Incorrect widow size"); + } + + // pack() guarantees to preserve the size of the client area after + // showing the window. + Dimension clientSize1 = getClientSize(mainWindow); + System.out.println("Client size before showing: " + clientSize1); + + mainWindow.setVisible(true); + + ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + + Dimension clientSize2 = getClientSize(mainWindow); + System.out.println("Client size after showing: " + clientSize2); + + if (!clientSize2.equals(clientSize1)) { + throw new RuntimeException("Incorrect client area size."); } + } - public static void main(String[] args) { - try { - drawGui(); - } finally { - if (mainWindow != null) { - mainWindow.dispose(); - } - } + public static void main(String[] args) { + try { + drawGui(); + } finally { + if (mainWindow != null) { + mainWindow.dispose(); + } } + } } diff --git a/test/java/net/Authenticator/B4933582.sh b/test/java/net/Authenticator/B4933582.sh index b103592f42d455ad289a320e2355e88072b5e257..0826063a8050487217b4ce6ac4968ea9cd04f628 100644 --- a/test/java/net/Authenticator/B4933582.sh +++ b/test/java/net/Authenticator/B4933582.sh @@ -30,6 +30,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" @@ -39,7 +43,7 @@ case "$OS" in exit 1; ;; esac -${TESTJAVA}${FS}bin${FS}javac -d . -classpath ${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest ${TESTSRC}${FS}B4933582.java +${TESTJAVA}${FS}bin${FS}javac -d . -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest" ${TESTSRC}${FS}B4933582.java rm -f cache.ser auth.save -${TESTJAVA}${FS}bin${FS}java -classpath ${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}. B4933582 first -${TESTJAVA}${FS}bin${FS}java -classpath ${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}. B4933582 second +${TESTJAVA}${FS}bin${FS}java -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 first +${TESTJAVA}${FS}bin${FS}java -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 second diff --git a/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh b/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh index ba8b7cb5184d304b437b1323a711fb01b81d3a65..18f7c0ea94cdf0799830641adef9dd767c8db062 100644 --- a/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh +++ b/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh @@ -35,6 +35,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" diff --git a/test/java/net/Socket/OldSocketImpl.sh b/test/java/net/Socket/OldSocketImpl.sh index 85845464f2bcf7bb927a38b318bf9b39fed09a95..50692f8e04553c6437f63a5e903f34b90799d313 100644 --- a/test/java/net/Socket/OldSocketImpl.sh +++ b/test/java/net/Socket/OldSocketImpl.sh @@ -32,6 +32,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/java/net/URL/B5086147.sh b/test/java/net/URL/B5086147.sh index 53034443a80bd7edddc58494c853c9d5fe731250..aaa9eadf31c9d0b7c0c2ab8df9fd0f9825f2a1d7 100644 --- a/test/java/net/URL/B5086147.sh +++ b/test/java/net/URL/B5086147.sh @@ -29,6 +29,10 @@ case "$OS" in SunOS | Linux ) exit 0 ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/java/net/URL/runconstructor.sh b/test/java/net/URL/runconstructor.sh index 93a80de4b3cb2b8e03193a36ba3401328363144e..30ae96a3c109f278289fbfa1e33a4ed76fcaf52c 100644 --- a/test/java/net/URL/runconstructor.sh +++ b/test/java/net/URL/runconstructor.sh @@ -31,6 +31,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/java/net/URLClassLoader/B5077773.sh b/test/java/net/URLClassLoader/B5077773.sh index 6dcba9c39a9fd0f19ac13a762322acf106a5c3c0..43bff5ad4a1cbb09dcfb3e30b614943ddcd9b298 100644 --- a/test/java/net/URLClassLoader/B5077773.sh +++ b/test/java/net/URLClassLoader/B5077773.sh @@ -42,6 +42,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/java/net/URLClassLoader/sealing/checksealed.sh b/test/java/net/URLClassLoader/sealing/checksealed.sh index e46ac2915ce0f846e72183a9184bfee9b168f697..191ff6f47500c30ce970ed7ebf89b99001a66d5a 100644 --- a/test/java/net/URLClassLoader/sealing/checksealed.sh +++ b/test/java/net/URLClassLoader/sealing/checksealed.sh @@ -35,6 +35,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" @@ -49,10 +53,10 @@ esac if [ x"$TESTJAVA" = x ]; then TESTJAVA=$1; fi if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi -CLASSPATH=.${PS}${TESTSRC}${FS}a${PS}${TESTSRC}${FS}b.jar +CLASSPATH=".${PS}${TESTSRC}${FS}a${PS}${TESTSRC}${FS}b.jar" -${TESTJAVA}${FS}bin${FS}javac -classpath ${CLASSPATH} -d . ${TESTSRC}${FS}CheckSealed.java -${TESTJAVA}${FS}bin${FS}java -cp ${CLASSPATH} CheckSealed 1 +${TESTJAVA}${FS}bin${FS}javac -classpath "${CLASSPATH}" -d . ${TESTSRC}${FS}CheckSealed.java +${TESTJAVA}${FS}bin${FS}java -cp "${CLASSPATH}" CheckSealed 1 if [ $? != 0 ]; then exit 1; fi -${TESTJAVA}${FS}bin${FS}java -cp ${CLASSPATH} CheckSealed 2 +${TESTJAVA}${FS}bin${FS}java -cp "${CLASSPATH}" CheckSealed 2 if [ $? != 0 ]; then exit 1; fi diff --git a/test/java/net/URLConnection/6212146/test.sh b/test/java/net/URLConnection/6212146/test.sh index 29b187ab307e7171480bbc9e22555b8cfdf7167e..cdf970db41e954e1443d1cc0567dbf2c0bb2f31d 100644 --- a/test/java/net/URLConnection/6212146/test.sh +++ b/test/java/net/URLConnection/6212146/test.sh @@ -41,6 +41,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh index 02ab6fcfd50565c2c6500fbc04f7a8887580ec93..a1c1d80d696da7f4ee75a6b2d20559b63215574f 100644 --- a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh +++ b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh @@ -54,6 +54,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" @@ -81,7 +85,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ # run the test ${TESTJAVA}${FILESEP}bin${FILESEP}java \ - -classpath ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar \ + -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \ ClassLoaderDeadlock exit $? diff --git a/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh b/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh index 4ed9b785e5fbd2d86ac89480ae2fe64784bc1c65..e631389f023c295d5c1fbf93ac8f18218ea081de 100644 --- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh +++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh @@ -42,6 +42,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" @@ -54,5 +58,5 @@ esac JAVA="${TESTJAVA}${FILESEP}bin${FILESEP}java" -${JAVA} -cp ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar Deadlock +${JAVA} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock diff --git a/test/java/security/Security/signedfirst/Dyn.sh b/test/java/security/Security/signedfirst/Dyn.sh index b64a6b6621bea1a5f9347e2b773089e730aac9fe..b897d5900a90a73b4ae797892d72cbdcaffc6532 100644 --- a/test/java/security/Security/signedfirst/Dyn.sh +++ b/test/java/security/Security/signedfirst/Dyn.sh @@ -54,6 +54,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" @@ -76,7 +80,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ # run the test ${TESTJAVA}${FILESEP}bin${FILESEP}java \ - -classpath ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar \ + -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ DynSignedProvFirst exit $? diff --git a/test/java/security/Security/signedfirst/Static.sh b/test/java/security/Security/signedfirst/Static.sh index cec9df72279effab1823e1146633ce11126a55d5..519766f9d6087be57485a91d7bf97d7e23a66ccb 100644 --- a/test/java/security/Security/signedfirst/Static.sh +++ b/test/java/security/Security/signedfirst/Static.sh @@ -54,6 +54,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" @@ -70,14 +74,14 @@ rm StaticSignedProvFirst.class # compile the test program ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ - -classpath ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar \ + -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ -d ${TESTCLASSES}${FILESEP} \ ${TESTSRC}${FILESEP}StaticSignedProvFirst.java # run the test cd ${TESTSRC}${FILESEP} ${TESTJAVA}${FILESEP}bin${FILESEP}java \ - -classpath ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar \ + -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ -Djava.security.properties=file:${TESTSRC}${FILESEP}Static.props \ StaticSignedProvFirst diff --git a/test/javax/crypto/SecretKeyFactory/FailOverTest.sh b/test/javax/crypto/SecretKeyFactory/FailOverTest.sh index b433dedb2219bbfd4e560552c090937f362cdc51..6eef3944d9f81bbde620eb86ca329f76fd6aa3d3 100644 --- a/test/javax/crypto/SecretKeyFactory/FailOverTest.sh +++ b/test/javax/crypto/SecretKeyFactory/FailOverTest.sh @@ -56,6 +56,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" @@ -69,7 +74,7 @@ esac ${TESTJAVA}${FS}bin${FS}javac \ -d . \ - -classpath ${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar \ + -classpath "${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar" \ ${TESTSRC}${FS}FailOverTest.java if [ $? -ne 0 ]; then @@ -77,7 +82,7 @@ if [ $? -ne 0 ]; then fi ${TESTJAVA}${FS}bin${FS}java \ - -classpath ${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar${PS}. \ + -classpath "${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar${PS}." \ FailOverTest result=$? diff --git a/test/javax/security/auth/Subject/doAs/Test.sh b/test/javax/security/auth/Subject/doAs/Test.sh index 9844c994968c0daeabe42f94d2f04e8f84fc631c..61c4d7cd6cfb5446f2d3fc3f813b8f27badc46f5 100644 --- a/test/javax/security/auth/Subject/doAs/Test.sh +++ b/test/javax/security/auth/Subject/doAs/Test.sh @@ -43,6 +43,11 @@ case "$OS" in FS="/" RM="/bin/rm -f" ;; + CYGWIN* ) + PS=";" + FS="/" + RM="rm" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/javax/swing/JInternalFrame/Test6505027.java b/test/javax/swing/JInternalFrame/Test6505027.java new file mode 100644 index 0000000000000000000000000000000000000000..218769003cb478267c37e7ce34594fd9d098606c --- /dev/null +++ b/test/javax/swing/JInternalFrame/Test6505027.java @@ -0,0 +1,136 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6505027 + * @summary Tests focus problem inside internal frame + * @author Sergey Malenkov + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.KeyboardFocusManager; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +public class Test6505027 implements Runnable { + + private static final boolean INTERNAL = true; + private static final boolean TERMINATE = true; + + private static final int WIDTH = 450; + private static final int HEIGHT = 200; + private static final int OFFSET = 10; + private static final long PAUSE = 2048L; + + private static final String[] COLUMNS = { "Size", "Shape" }; // NON-NLS + private static final String[] ITEMS = { "a", "b", "c", "d" }; // NON-NLS + private static final String KEY = "terminateEditOnFocusLost"; // NON-NLS + + public static void main(String[] args) { + SwingUtilities.invokeLater(new Test6505027()); + + Component component = null; + while (component == null) { + try { + Thread.sleep(PAUSE); + } + catch (InterruptedException exception) { + // ignore interrupted exception + } + component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); + } + if (!component.getClass().equals(JComboBox.class)) { + throw new Error("unexpected focus owner: " + component); + } + SwingUtilities.getWindowAncestor(component).dispose(); + } + + private JTable table; + private Point point; + + public void run() { + if (this.table == null) { + JFrame main = new JFrame(); + main.setSize(WIDTH + OFFSET * 3, HEIGHT + OFFSET * 5); + main.setLocationRelativeTo(null); + main.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + main.setVisible(true); + + Container container = main; + if (INTERNAL) { + JInternalFrame frame = new JInternalFrame(); + frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); + frame.setVisible(true); + + JDesktopPane desktop = new JDesktopPane(); + desktop.add(frame, new Integer(1)); + + container.add(desktop); + container = frame; + } + this.table = new JTable(new DefaultTableModel(COLUMNS, 2)); + if (TERMINATE) { + this.table.putClientProperty(KEY, Boolean.TRUE); + } + TableColumn column = this.table.getColumn(COLUMNS[1]); + column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); + + container.add(BorderLayout.NORTH, new JTextField()); + container.add(BorderLayout.CENTER, new JScrollPane(this.table)); + + SwingUtilities.invokeLater(this); + } + else if (this.point == null) { + this.point = this.table.getCellRect(1, 1, false).getLocation(); + SwingUtilities.convertPointToScreen(this.point, this.table); + SwingUtilities.invokeLater(this); + } + else { + try { + Robot robot = new Robot(); + robot.mouseMove(this.point.x + 1, this.point.y + 1); + robot.mousePress(InputEvent.BUTTON1_MASK); + } + catch (AWTException exception) { + throw new Error("unexpected exception", exception); + } + } + } +} diff --git a/test/javax/swing/JInternalFrame/Test6802868.java b/test/javax/swing/JInternalFrame/Test6802868.java new file mode 100644 index 0000000000000000000000000000000000000000..74410df81fd1b96342f0efae8e3cc2985e3ecf0d --- /dev/null +++ b/test/javax/swing/JInternalFrame/Test6802868.java @@ -0,0 +1,108 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6802868 + * @summary JInternalFrame is not maximized when maximized parent frame + * @author Alexander Potochkin + */ + +import sun.awt.SunToolkit; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.beans.PropertyVetoException; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; + +public class Test6802868 { + static JInternalFrame jif; + static JFrame frame; + static Dimension size; + static Point location; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(20); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JDesktopPane jdp = new JDesktopPane(); + frame.getContentPane().add(jdp); + + jif = new JInternalFrame("Title", true, true, true, true); + jdp.add(jif); + jif.setVisible(true); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + + try { + jif.setMaximum(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + size = jif.getSize(); + frame.setSize(300, 300); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (jif.getSize().equals(size)) { + throw new RuntimeException("InternalFrame hasn't changed its size"); + } + try { + jif.setIcon(true); + } catch (PropertyVetoException e) { + e.printStackTrace(); + } + location = jif.getDesktopIcon().getLocation(); + frame.setSize(400, 400); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (jif.getDesktopIcon().getLocation().equals(location)) { + throw new RuntimeException("JDesktopIcon hasn't moved"); + } + } + }); + } +} diff --git a/test/javax/swing/JScrollPane/Test6526631.java b/test/javax/swing/JScrollPane/Test6526631.java new file mode 100644 index 0000000000000000000000000000000000000000..ec324623ee531b348e8ccfae15d9098df10d17f9 --- /dev/null +++ b/test/javax/swing/JScrollPane/Test6526631.java @@ -0,0 +1,102 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6526631 + * @summary Resizes right-oriented scroll pane + * @author Sergey Malenkov + * @library .. + * @build SwingTest + * @run main Test6526631 + */ + +import java.awt.Dimension; +import javax.swing.JFrame; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JViewport; + +import static java.awt.ComponentOrientation.RIGHT_TO_LEFT; + +public class Test6526631 { + + private static final int COLS = 90; + private static final int ROWS = 50; + private static final int OFFSET = 10; + + public static void main(String[] args) { + SwingTest.start(Test6526631.class); + } + + private final JScrollPane pane; + private final JFrame frame; + + public Test6526631(JFrame frame) { + this.pane = new JScrollPane(new JTextArea(ROWS, COLS)); + this.pane.setComponentOrientation(RIGHT_TO_LEFT); + this.frame = frame; + this.frame.add(this.pane); + } + + private void update(int offset) { + Dimension size = this.frame.getSize(); + size.width += offset; + this.frame.setSize(size); + } + + public void validateFirst() { + validateThird(); + update(OFFSET); + } + + public void validateSecond() { + validateThird(); + update(-OFFSET); + } + + public void validateThird() { + JViewport viewport = this.pane.getViewport(); + JScrollBar scroller = this.pane.getHorizontalScrollBar(); + if (!scroller.getComponentOrientation().equals(RIGHT_TO_LEFT)) { + throw new IllegalStateException("unexpected component orientation"); + } + int value = scroller.getValue(); + if (value != 0) { + throw new IllegalStateException("unexpected scroll value"); + } + int extent = viewport.getExtentSize().width; + if (extent != scroller.getVisibleAmount()) { + throw new IllegalStateException("unexpected visible amount"); + } + int size = viewport.getViewSize().width; + if (size != scroller.getMaximum()) { + throw new IllegalStateException("unexpected maximum"); + } + int pos = size - extent - value; + if (pos != viewport.getViewPosition().x) { + throw new IllegalStateException("unexpected position"); + } + } +} diff --git a/test/javax/swing/SwingTest.java b/test/javax/swing/SwingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7f486122e8ca49a3fed32e72c747efac455ebdd7 --- /dev/null +++ b/test/javax/swing/SwingTest.java @@ -0,0 +1,160 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; +import javax.swing.JFrame; + +import static javax.swing.SwingUtilities.invokeLater; + +/** + * SwingTestHelper is a utility class for writing regression tests + * that require interacting with the UI. + * + * @author Sergey A. Malenkov + */ +final class SwingTest implements Runnable { + + private static final int WIDTH = 640; + private static final int HEIGHT = 480; + + public static void start(Class type) { + new SwingTest(type).start(); + } + + private final PrintWriter writer = new PrintWriter(System.out, true); + + private Class type; + private JFrame frame; + private Iterator methods; + private Object object; + private Method method; + private Throwable error; + + private SwingTest(Class type) { + this.type = type; + } + + public void run() { + synchronized (this.writer) { + if (this.error != null) { + this.frame.dispose(); + this.frame = null; + } + else if (this.object == null) { + invoke(); + Set methods = new TreeSet(new Comparator() { + public int compare(Method first, Method second) { + return first.getName().compareTo(second.getName()); + } + }); + for (Method method : this.type.getMethods()) { + if (method.getDeclaringClass().equals(this.type)) { + if (method.getReturnType().equals(void.class)) { + if (0 == method.getParameterTypes().length) { + methods.add(method); + } + } + } + } + this.methods = methods.iterator(); + } + else if (this.method != null) { + invoke(); + } + else if (this.methods.hasNext()) { + this.method = this.methods.next(); + } + else { + this.frame.dispose(); + this.frame = null; + this.type = null; + } + this.writer.notifyAll(); + } + } + + private void start() { + synchronized (this.writer) { + while (this.type != null) { + if ((this.method != null) && Modifier.isStatic(this.method.getModifiers())) { + invoke(); + } + else { + invokeLater(this); + try { + this.writer.wait(); + } + catch (InterruptedException exception) { + exception.printStackTrace(this.writer); + } + } + if ((this.frame == null) && (this.error != null)) { + throw new Error("unexpected error", this.error); + } + } + } + } + + private void invoke() { + try { + if (this.method != null) { + this.writer.println(this.method); + this.method.invoke(this.object); + this.method = null; + } + else { + this.writer.println(this.type); + this.frame = new JFrame(this.type.getSimpleName()); + this.frame.setSize(WIDTH, HEIGHT); + this.frame.setLocationRelativeTo(null); + this.object = this.type.getConstructor(JFrame.class).newInstance(this.frame); + this.frame.setVisible(true); + } + } + catch (NoSuchMethodException exception) { + this.error = exception; + } + catch (SecurityException exception) { + this.error = exception; + } + catch (IllegalAccessException exception) { + this.error = exception; + } + catch (IllegalArgumentException exception) { + this.error = exception; + } + catch (InstantiationException exception) { + this.error = exception; + } + catch (InvocationTargetException exception) { + this.error = exception.getTargetException(); + } + } +} diff --git a/test/lib/security/java.policy/Ext_AllPolicy.sh b/test/lib/security/java.policy/Ext_AllPolicy.sh index 357a586b443a44435de5826f9bee073ebafc934d..288dedf15fa27c4991a203f9ad7d6a38dc81bc55 100644 --- a/test/lib/security/java.policy/Ext_AllPolicy.sh +++ b/test/lib/security/java.policy/Ext_AllPolicy.sh @@ -56,6 +56,12 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + TMP=/tmp + ;; Windows_95 | Windows_98 | Windows_NT ) NULL=NUL PS=";" diff --git a/test/sun/net/www/MarkResetTest.sh b/test/sun/net/www/MarkResetTest.sh index 61e73344b0ae77edc7d706bcb37bf95584fa4dc8..bf0b0ceb3c13f3bf0de6c38b3ab06545833af61e 100644 --- a/test/sun/net/www/MarkResetTest.sh +++ b/test/sun/net/www/MarkResetTest.sh @@ -32,6 +32,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/sun/net/www/http/ChunkedInputStream/ChunkedCharEncoding.sh b/test/sun/net/www/http/ChunkedInputStream/ChunkedCharEncoding.sh index 615d1e5a293182f45d8a00f2b4030812397b1c80..06d10520ebb94f3ffdef6f9885bb40cb616a8e9d 100644 --- a/test/sun/net/www/http/ChunkedInputStream/ChunkedCharEncoding.sh +++ b/test/sun/net/www/http/ChunkedInputStream/ChunkedCharEncoding.sh @@ -32,6 +32,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/sun/net/www/http/HttpClient/RetryPost.sh b/test/sun/net/www/http/HttpClient/RetryPost.sh index b72b168c2086a81d154dfe149fa004367787d14b..677a13cc69a9907f86604ed7cc0e0d1674eedc7a 100644 --- a/test/sun/net/www/http/HttpClient/RetryPost.sh +++ b/test/sun/net/www/http/HttpClient/RetryPost.sh @@ -32,6 +32,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/sun/net/www/protocol/jar/B5105410.sh b/test/sun/net/www/protocol/jar/B5105410.sh index 3250ecba807b8e267793c776e8eaca11bf76a1d6..7b1d33ea4fb82067b97d255ccbcc941706f5864d 100644 --- a/test/sun/net/www/protocol/jar/B5105410.sh +++ b/test/sun/net/www/protocol/jar/B5105410.sh @@ -39,6 +39,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/sun/net/www/protocol/jar/jarbug/run.sh b/test/sun/net/www/protocol/jar/jarbug/run.sh index 7db91d988625ef1cb954ae001eb9fccb3040945d..351614dde3d78a59b6d0d0802ed4abba13fda1c3 100644 --- a/test/sun/net/www/protocol/jar/jarbug/run.sh +++ b/test/sun/net/www/protocol/jar/jarbug/run.sh @@ -28,23 +28,54 @@ # @summary various resource and classloading bugs related to jar files #set -x DEST=`pwd` + +OS=`uname -s` +case "$OS" in + SunOS ) + PS=":" + FS="/" + ;; + Linux ) + PS=":" + FS="/" + ;; + Windows* ) + PS=";" + FS="\\" + ;; + CYGWIN* ) + PS=";" + FS="/" + # + # javac does not like /cygdrive produced by `pwd`. + # + DEST=`cygpath -d ${DEST}` + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + # # build jar1 # -mkdir ${DEST}/jar1 -cd ${TESTSRC}/etc/jar1 -cp -r . ${DEST}/jar1 -${TESTJAVA}/bin/javac -d ${DEST}/jar1 ${TESTSRC}/src/jar1/LoadResourceBundle.java -${TESTJAVA}/bin/javac -d ${DEST}/jar1 ${TESTSRC}/src/jar1/GetResource.java -cd ${DEST}/jar1 -${TESTJAVA}/bin/jar cfM jar1.jar jar1 res1.txt +mkdir -p ${DEST}${FS}jar1 +cd ${TESTSRC}${FS}etc${FS}jar1 +cp -r . ${DEST}${FS}jar1 +${TESTJAVA}${FS}bin${FS}javac -d ${DEST}${FS}jar1 \ + ${TESTSRC}${FS}src${FS}jar1${FS}LoadResourceBundle.java +${TESTJAVA}${FS}bin${FS}javac -d ${DEST}${FS}jar1 \ + ${TESTSRC}${FS}src${FS}jar1${FS}GetResource.java +cd ${DEST}${FS}jar1 +${TESTJAVA}${FS}bin${FS}jar cfM jar1.jar jar1 res1.txt mv jar1.jar .. # # build the test sources and run them # -${TESTJAVA}/bin/javac -d ${DEST} ${TESTSRC}/src/test/*.java +${TESTJAVA}${FS}bin${FS}javac -d ${DEST} ${TESTSRC}${FS}src${FS}test${FS}*.java cd ${DEST} -${TESTJAVA}/bin/java RunAllTests +${TESTJAVA}${FS}bin${FS}java RunAllTests result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh b/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh index 4711e7e3cd3ccdd6e90a8e04d7aceba47bc60358..8974fe62d45387a04e508d1b5bf96fa73a19aac0 100644 --- a/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh +++ b/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh @@ -68,6 +68,20 @@ case "$OS" in CP="cp" CHMOD="chmod" ;; + CYGWIN* ) + FS="/" + PS=";" + CP="cp" + CHMOD="chmod" + # + # javac does not like /cygdrive produced by `pwd` + # + TESTSRC=`cygpath -d ${TESTSRC}` + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; esac # compile test diff --git a/test/sun/security/pkcs11/Provider/Login.sh b/test/sun/security/pkcs11/Provider/Login.sh index a41720b63dee647e3741b1593f30c1476d961ccd..6b285adb82d4967ea7b6731beae8b2ae8e814875 100644 --- a/test/sun/security/pkcs11/Provider/Login.sh +++ b/test/sun/security/pkcs11/Provider/Login.sh @@ -69,6 +69,20 @@ case "$OS" in CP="cp" CHMOD="chmod" ;; + CYGWIN* ) + FS="/" + PS=";" + CP="cp" + CHMOD="chmod" + # + # javac does not like /cygdrive produced by `pwd` + # + TESTSRC=`cygpath -d ${TESTSRC}` + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; esac # first make cert/key DBs writable diff --git a/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh b/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh index cb4325b464b25774109004218432e6a7a60498e9..9cb9d04de954aa96703a78fe3f534834b1f4ee10 100644 --- a/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh +++ b/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh @@ -55,6 +55,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" diff --git a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh index 9ebf5ee3f64d7dd4344c293b032ca0e4883c48b2..1f49a952fb36522d0ed73abeb2a277e235fcd10a 100644 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh @@ -43,10 +43,17 @@ fi OS=`uname -s` case "$OS" in SunOS | Linux ) + FILESEP="/" PATHSEP=":" ;; + CYGWIN* ) + FILESEP="/" + PATHSEP=";" + ;; + Windows* ) + FILESEP="\\" PATHSEP=";" ;; esac @@ -56,11 +63,13 @@ set -ex # # Compile the tests, package into their respective jars # -${TESTJAVA}/bin/javac -d . \ - ${TESTSRC}/NotifyHandshakeTest.java \ - ${TESTSRC}/NotifyHandshakeTestHeyYou.java -${TESTJAVA}/bin/jar -cvf com.jar com/NotifyHandshakeTest*.class -${TESTJAVA}/bin/jar -cvf edu.jar edu/NotifyHandshakeTestHeyYou.class +${TESTJAVA}${FILESEP}bin${FILESEP}javac -d . \ + ${TESTSRC}${FILESEP}NotifyHandshakeTest.java \ + ${TESTSRC}${FILESEP}NotifyHandshakeTestHeyYou.java +${TESTJAVA}${FILESEP}bin${FILESEP}jar -cvf com.jar \ + com${FILESEP}NotifyHandshakeTest*.class +${TESTJAVA}${FILESEP}bin${FILESEP}jar -cvf edu.jar \ + edu${FILESEP}NotifyHandshakeTestHeyYou.class # # Don't want the original class files to be used, because @@ -73,11 +82,11 @@ rm -rf com edu # This is the only thing we really care about as far as # test status goes. # -${TESTJAVA}/bin/java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java \ -Dtest.src=${TESTSRC} \ -classpath "com.jar${PATHSEP}edu.jar" \ -Djava.security.manager \ - -Djava.security.policy=${TESTSRC}/NotifyHandshakeTest.policy \ + -Djava.security.policy=${TESTSRC}${FILESEP}NotifyHandshakeTest.policy \ com.NotifyHandshakeTest retval=$? diff --git a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh index 3e66175cf668ba8c4f53d961d02ea62cf099d049..de5f0318e8b3e41385d3668f8495ad14571ebdfc 100644 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh @@ -36,6 +36,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" @@ -46,6 +50,7 @@ case "$OS" in ;; esac -${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java ${TESTSRC}${FS}ProxyTunnelServer.java ${TESTSRC}${FS}PostThruProxy.java +${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ + ${TESTSRC}${FS}ProxyTunnelServer.java ${TESTSRC}${FS}PostThruProxy.java ${TESTJAVA}${FS}bin${FS}java PostThruProxy ${HOSTNAME} ${TESTSRC} exit diff --git a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh index 2a40eb790ce3601ba2eef123151d453499097b86..e9e20336222209e0cbea2112509ed9db00476dbc 100644 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh @@ -36,6 +36,10 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + PS=";" + FS="/" + ;; Windows* ) PS=";" FS="\\" @@ -46,6 +50,8 @@ case "$OS" in ;; esac -${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java ${TESTSRC}${FS}ProxyTunnelServer.java ${TESTSRC}${FS}PostThruProxyWithAuth.java +${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ + ${TESTSRC}${FS}ProxyTunnelServer.java \ + ${TESTSRC}${FS}PostThruProxyWithAuth.java ${TESTJAVA}${FS}bin${FS}java PostThruProxyWithAuth ${HOSTNAME} ${TESTSRC} exit diff --git a/test/sun/security/tools/jarsigner/AlgOptions.sh b/test/sun/security/tools/jarsigner/AlgOptions.sh index 5501116b9c954f1a0902c9b254de9101e028484b..3dda55f30c2c7bb6511d57f68026fc2d797513bc 100644 --- a/test/sun/security/tools/jarsigner/AlgOptions.sh +++ b/test/sun/security/tools/jarsigner/AlgOptions.sh @@ -53,6 +53,13 @@ case "$OS" in CP="${FS}bin${FS}cp -f" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/jarsigner/PercentSign.sh b/test/sun/security/tools/jarsigner/PercentSign.sh index a07011f0a2ac28a9ce8a7fba65474a05e4511731..3a9f315d01544ba16959b9d6b11f96f0333d7365 100644 --- a/test/sun/security/tools/jarsigner/PercentSign.sh +++ b/test/sun/security/tools/jarsigner/PercentSign.sh @@ -53,6 +53,13 @@ case "$OS" in CP="${FS}bin${FS}cp -f" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/jarsigner/oldsig.sh b/test/sun/security/tools/jarsigner/oldsig.sh index 14668810446242fee4803e3bd05b72246301a710..d7420dc4f3e76487e1a4f54d1048216621b7cca5 100644 --- a/test/sun/security/tools/jarsigner/oldsig.sh +++ b/test/sun/security/tools/jarsigner/oldsig.sh @@ -49,6 +49,13 @@ case "$OS" in CP="${FS}bin${FS}cp -f" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/keytool/AltProviderPath.sh b/test/sun/security/tools/keytool/AltProviderPath.sh index 7deb733c0958179ac287c30aeedc6a9d988e97be..8f253a76c9b47367d6f9c5bcd165f3fcbaf30263 100644 --- a/test/sun/security/tools/keytool/AltProviderPath.sh +++ b/test/sun/security/tools/keytool/AltProviderPath.sh @@ -52,6 +52,12 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" @@ -66,14 +72,21 @@ esac # the test code #genkey -${TESTJAVA}${FS}bin${FS}keytool -genkey -v -alias dummyTestCA -keyalg "RSA" -keysize 1024 -sigalg "ShA1WithRSA" -dname "cn=Dummy Test CA, ou=JSN, o=JavaSoft, c=US" -validity 3650 -keypass storepass -keystore keystoreCA.dks -storepass storepass -storetype "dks" -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} +${TESTJAVA}${FS}bin${FS}keytool -genkey -v -alias dummyTestCA \ + -keyalg "RSA" -keysize 1024 -sigalg "ShA1WithRSA" \ + -dname "cn=Dummy Test CA, ou=JSN, o=JavaSoft, c=US" -validity 3650 \ + -keypass storepass -keystore keystoreCA.dks -storepass storepass \ + -storetype "dks" -provider "org.test.dummy.DummyProvider" \ + -providerPath ${TESTCLASSES} if [ $? -ne 0 ]; then exit 1 fi #Change keystore password -${TESTJAVA}${FS}bin${FS}keytool -storepasswd -new storepass2 -keystore keystoreCA.dks -storetype "dks" -storepass storepass -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} +${TESTJAVA}${FS}bin${FS}keytool -storepasswd -new storepass2 \ + -keystore keystoreCA.dks -storetype "dks" -storepass storepass \ + -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} if [ $? -ne 0 ]; then exit 1 @@ -81,21 +94,29 @@ fi #Change keystore key password -${TESTJAVA}${FS}bin${FS}keytool -keypasswd -alias "dummyTestCA" -keypass storepass -new keypass -keystore keystoreCA.dks -storetype "dks" -storepass storepass2 -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} +${TESTJAVA}${FS}bin${FS}keytool -keypasswd -alias "dummyTestCA" \ + -keypass storepass -new keypass -keystore keystoreCA.dks \ + -storetype "dks" -storepass storepass2 \ + -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} if [ $? -ne 0 ]; then exit 1 fi #Export certificate -${TESTJAVA}${FS}bin${FS}keytool -v -export -rfc -alias "dummyTestCA" -file "dummyTestCA.der" -keystore keystoreCA.dks -storetype "dks" -storepass storepass2 -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} +${TESTJAVA}${FS}bin${FS}keytool -v -export -rfc -alias "dummyTestCA" \ + -file "dummyTestCA.der" -keystore keystoreCA.dks -storetype "dks" \ + -storepass storepass2 -provider "org.test.dummy.DummyProvider" \ + -providerPath ${TESTCLASSES} if [ $? -ne 0 ]; then exit 1 fi #list keystore -${TESTJAVA}${FS}bin${FS}keytool -v -list -keystore keystoreCA.dks -storetype "dks" -storepass storepass2 -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} +${TESTJAVA}${FS}bin${FS}keytool -v -list -keystore keystoreCA.dks \ + -storetype "dks" -storepass storepass2 \ + -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES} if [ $? -ne 0 ]; then exit 1 diff --git a/test/sun/security/tools/keytool/CloneKeyAskPassword.sh b/test/sun/security/tools/keytool/CloneKeyAskPassword.sh index c5bbca9786c1daba5b3e90e6b01e782be049cb30..4934fc7b6ce3293ffff9610e1a7e11907e4823df 100644 --- a/test/sun/security/tools/keytool/CloneKeyAskPassword.sh +++ b/test/sun/security/tools/keytool/CloneKeyAskPassword.sh @@ -55,6 +55,10 @@ case "$OS" in PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Windows* ) PATHSEP=";" FILESEP="\\" diff --git a/test/sun/security/tools/keytool/NoExtNPE.sh b/test/sun/security/tools/keytool/NoExtNPE.sh index 3e929b5354f8040c008ca88e56151171ea13d1e6..80cc3c85aea40bd7eaae7b0ead766eeff4d7574f 100644 --- a/test/sun/security/tools/keytool/NoExtNPE.sh +++ b/test/sun/security/tools/keytool/NoExtNPE.sh @@ -48,6 +48,9 @@ case "$OS" in Linux ) FILESEP="/" ;; + CYGWIN* ) + FILESEP="/" + ;; Windows* ) FILESEP="\\" ;; diff --git a/test/sun/security/tools/keytool/SecretKeyKS.sh b/test/sun/security/tools/keytool/SecretKeyKS.sh index 96a1885db9f378052ef84932937563f0ae8308a3..787e37e04a5d3886e05fc0530c595dc919ee1beb 100644 --- a/test/sun/security/tools/keytool/SecretKeyKS.sh +++ b/test/sun/security/tools/keytool/SecretKeyKS.sh @@ -51,6 +51,12 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/keytool/StandardAlgName.sh b/test/sun/security/tools/keytool/StandardAlgName.sh index 77e9a98ef9379b78debe0346288ad6588b05ed1b..82e9e208e101c29d7905d01034c24f02bd3c2f5f 100644 --- a/test/sun/security/tools/keytool/StandardAlgName.sh +++ b/test/sun/security/tools/keytool/StandardAlgName.sh @@ -52,6 +52,12 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + TMP=/tmp + ;; Windows_* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/keytool/i18n.sh b/test/sun/security/tools/keytool/i18n.sh index 2d37ae976648e3257a83c6d6ae6d839e0dbb3426..33abf76f62ea0167b9a906e9633493b619e36d19 100644 --- a/test/sun/security/tools/keytool/i18n.sh +++ b/test/sun/security/tools/keytool/i18n.sh @@ -52,6 +52,12 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + TMP=/tmp + ;; Windows* ) NULL=NUL PS=";" diff --git a/test/sun/security/tools/keytool/printssl.sh b/test/sun/security/tools/keytool/printssl.sh index 9fc19cd9b209749c0250b88e0dace3366d36a35d..73bd21cb83bdfe437f9d6400ff93da19a49a7048 100644 --- a/test/sun/security/tools/keytool/printssl.sh +++ b/test/sun/security/tools/keytool/printssl.sh @@ -40,6 +40,9 @@ case "$OS" in SunOS | Linux ) FS="/" ;; + CYGWIN* ) + FS="/" + ;; Windows_* ) FS="\\" ;; diff --git a/test/sun/security/tools/keytool/resource.sh b/test/sun/security/tools/keytool/resource.sh index ab8e95205557a8fbf6685a177b9ec459673a06d4..1fc515217ae63e81a2fa9189b94c9ef721574490 100644 --- a/test/sun/security/tools/keytool/resource.sh +++ b/test/sun/security/tools/keytool/resource.sh @@ -48,6 +48,11 @@ case "$OS" in FS="/" TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + FS="/" + TMP=/tmp + ;; Windows_* ) NULL=NUL FS="\\" diff --git a/test/sun/security/tools/keytool/standard.sh b/test/sun/security/tools/keytool/standard.sh index f3e052ed510424e0ebfe3982587252acda702b75..4328c6814540fe9028a4c254c22a1ff23f40d731 100644 --- a/test/sun/security/tools/keytool/standard.sh +++ b/test/sun/security/tools/keytool/standard.sh @@ -44,11 +44,15 @@ fi # set platform-dependent variables OS=`uname -s` case "$OS" in + SunOS | Linux | CYGWIN* ) + FS="/" + ;; Windows_* ) FS="\\" ;; * ) - FS="/" + echo "Unrecognized system!" + exit 1; ;; esac