diff --git a/.github/actions/get-bootjdk/action.yml b/.github/actions/get-bootjdk/action.yml index 19c3a0128f4..1e569dd47c5 100644 --- a/.github/actions/get-bootjdk/action.yml +++ b/.github/actions/get-bootjdk/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -104,6 +104,6 @@ runs: - name: 'Export path to where BootJDK is installed' id: path-name run: | - # Export the path - echo 'path=bootjdk/jdk' >> $GITHUB_OUTPUT + # Export the absolute path + echo "path=`pwd`/bootjdk/jdk" >> $GITHUB_OUTPUT shell: bash diff --git a/.github/actions/get-jtreg/action.yml b/.github/actions/get-jtreg/action.yml index 7c49b1054ec..1a6ffeb126b 100644 --- a/.github/actions/get-jtreg/action.yml +++ b/.github/actions/get-jtreg/action.yml @@ -47,7 +47,7 @@ runs: key: jtreg-${{ steps.version.outputs.value }} - name: 'Checkout the JTReg source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: openjdk/jtreg ref: jtreg-${{ steps.version.outputs.value }} diff --git a/.github/actions/get-msys2/action.yml b/.github/actions/get-msys2/action.yml index 3e6c3417a31..f6de676a327 100644 --- a/.github/actions/get-msys2/action.yml +++ b/.github/actions/get-msys2/action.yml @@ -34,11 +34,11 @@ runs: with: install: 'autoconf tar unzip zip make' path-type: minimal - location: msys2 + location: ${{ runner.tool_cache }}/msys2 # We can't run bash until this is completed, so stick with pwsh - name: 'Set MSYS2 path' run: | # Prepend msys2/msys64/usr/bin to the PATH - echo "$env:GITHUB_WORKSPACE/msys2/msys64/usr/bin" >> $env:GITHUB_PATH + echo "$env:RUNNER_TOOL_CACHE/msys2/msys64/usr/bin" >> $env:GITHUB_PATH shell: pwsh diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index 742f27a4ff8..88251fded11 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -29,14 +29,22 @@ on: workflow_call: inputs: gcc-major-version: + required: true + type: string + extra-conf-options: + required: false + type: string + configure-arguments: + required: false + type: string + make-arguments: required: false type: string - default: '10' jobs: build-cross-compile: name: build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -48,22 +56,30 @@ jobs: - ppc64le include: - target-cpu: aarch64 - debian-arch: arm64 gnu-arch: aarch64 + debian-arch: arm64 + debian-repository: https://httpredir.debian.org/debian/ + debian-version: bullseye - target-cpu: arm - debian-arch: armhf gnu-arch: arm + debian-arch: armhf + debian-repository: https://httpredir.debian.org/debian/ + debian-version: bullseye gnu-abi: eabihf - target-cpu: s390x - debian-arch: s390x gnu-arch: s390x + debian-arch: s390x + debian-repository: https://httpredir.debian.org/debian/ + debian-version: bullseye - target-cpu: ppc64le - debian-arch: ppc64el gnu-arch: powerpc64le + debian-arch: ppc64el + debian-repository: https://httpredir.debian.org/debian/ + debian-version: bullseye steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Get the BootJDK' id: bootjdk @@ -105,14 +121,15 @@ jobs: - name: 'Create sysroot' run: > - sudo qemu-debootstrap + sudo debootstrap --arch=${{ matrix.debian-arch }} --verbose - --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev + --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype-dev,libpng-dev --resolve-deps - buster + --variant=minbase + ${{ matrix.debian-version }} sysroot - https://httpredir.debian.org/debian/ + ${{ matrix.debian-repository }} if: steps.get-cached-sysroot.outputs.cache-hit != 'true' - name: 'Prepare sysroot' @@ -120,7 +137,10 @@ jobs: # Prepare sysroot and remove unused files to minimize cache sudo chroot sysroot symlinks -cr . sudo chown ${USER} -R sysroot - rm -rf sysroot/{dev,proc,run,sys} + rm -rf sysroot/{dev,proc,run,sys,var} + rm -rf sysroot/usr/{sbin,bin,share} + rm -rf sysroot/usr/lib/{apt,gcc,udev,systemd} + rm -rf sysroot/usr/libexec/gcc if: steps.get-cached-sysroot.outputs.cache-hit != 'true' - name: 'Configure' @@ -135,12 +155,16 @@ jobs: --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} --with-sysroot=sysroot --with-build-jdk=${{ steps.buildjdk.outputs.jdk-path }} - CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-10 - CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-10 + CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }} + CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }} + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) - name: 'Build' id: build uses: ./.github/actions/do-build with: - make-target: 'hotspot' + make-target: 'hotspot ${{ inputs.make-arguments }}' platform: linux-${{ matrix.target-cpu }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 7f981118e23..646ac5ed3a6 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -42,20 +42,30 @@ on: required: false type: string default: '[ "debug", "release" ]' - apt-gcc-version: + gcc-major-version: required: true type: string + gcc-package-suffix: + required: false + type: string + default: '' apt-architecture: required: false type: string apt-extra-packages: required: false type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string jobs: build-linux: name: build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -68,7 +78,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Get the BootJDK' id: bootjdk @@ -97,8 +107,8 @@ jobs: fi sudo apt-get update sudo apt-get install --only-upgrade apt - sudo apt-get install gcc-${{ inputs.apt-gcc-version }} g++-${{ inputs.apt-gcc-version }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 + sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} - name: 'Configure' run: > @@ -110,13 +120,16 @@ jobs: --with-jtreg=${{ steps.jtreg.outputs.path }} --enable-jtreg-failure-handler --with-zlib=system - ${{ inputs.extra-conf-options }} + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) - name: 'Build' id: build uses: ./.github/actions/do-build with: - make-target: '${{ inputs.make-target }}' + make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}' platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index b00f7e091dd..414c07a8080 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -45,6 +45,12 @@ on: xcode-toolset-version: required: true type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string jobs: build-macos: @@ -62,7 +68,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Get the BootJDK' id: bootjdk @@ -92,13 +98,16 @@ jobs: --with-jtreg=${{ steps.jtreg.outputs.path }} --enable-jtreg-failure-handler --with-zlib=system - ${{ inputs.extra-conf-options }} + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) - name: 'Build' id: build uses: ./.github/actions/do-build with: - make-target: '${{ inputs.make-target }}' + make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}' platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 090c1451a8e..b85feef030a 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -48,6 +48,12 @@ on: msvc-toolset-architecture: required: true type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string env: # These are needed to make the MSYS2 bash work properly @@ -73,7 +79,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Get MSYS2' uses: ./.github/actions/get-msys2 @@ -119,17 +125,21 @@ jobs: --with-jtreg=${{ steps.jtreg.outputs.path }} --enable-jtreg-failure-handler --with-msvc-toolset-version=${{ inputs.msvc-toolset-version }} - ${{ inputs.extra-conf-options }} + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) env: # We need a minimal PATH on Windows # Set PATH to "", so just GITHUB_PATH is included PATH: '' + shell: env /usr/bin/bash --login -eo pipefail {0} - name: 'Build' id: build uses: ./.github/actions/do-build with: - make-target: '${{ inputs.make-target }}' + make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}' platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b59bc48b805..8d011e4d39d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,6 +36,12 @@ on: description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")' required: true default: 'linux-x64, linux-x86, linux-x64-variants, linux-cross-compile, macos-x64, macos-aarch64, windows-x64, windows-aarch64' + configure-arguments: + description: 'Additional configure arguments' + required: false + make-arguments: + description: 'Additional make arguments' + required: false concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -49,7 +55,7 @@ jobs: select: name: 'Select platforms' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: linux-x64: ${{ steps.include.outputs.linux-x64 }} linux-x86: ${{ steps.include.outputs.linux-x86 }} @@ -121,7 +127,9 @@ jobs: uses: ./.github/workflows/build-linux.yml with: platform: linux-x64 - apt-gcc-version: '10' + gcc-major-version: '10' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} # The linux-x64 jdk bundle is used as buildjdk for the cross-compile job if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true' @@ -131,12 +139,15 @@ jobs: uses: ./.github/workflows/build-linux.yml with: platform: linux-x86 - apt-gcc-version: '10-multilib' + gcc-major-version: '10' + gcc-package-suffix: '-multilib' apt-architecture: 'i386' # Some multilib libraries do not have proper inter-dependencies, so we have to # install their dependencies manually. - apt-extra-packages: 'libfreetype6-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386' + apt-extra-packages: 'libfreetype-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386' extra-conf-options: '--with-target-bits=32' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x86 == 'true' build-linux-x64-hs-nopch: @@ -147,8 +158,10 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10' + gcc-major-version: '10' extra-conf-options: '--disable-precompiled-headers' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x64-variants == 'true' build-linux-x64-hs-zero: @@ -159,8 +172,10 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10' + gcc-major-version: '10' extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x64-variants == 'true' build-linux-x64-hs-minimal: @@ -171,8 +186,10 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10' + gcc-major-version: '10' extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x64-variants == 'true' build-linux-x64-hs-optimized: @@ -184,8 +201,10 @@ jobs: make-target: 'hotspot' # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job debug-levels: '[ "debug" ]' - apt-gcc-version: '10' + gcc-major-version: '10' extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-x64-variants == 'true' build-linux-cross-compile: @@ -194,6 +213,10 @@ jobs: - select - build-linux-x64 uses: ./.github/workflows/build-cross-compile.yml + with: + gcc-major-version: '10' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-cross-compile == 'true' build-macos-x64: @@ -203,6 +226,8 @@ jobs: with: platform: macos-x64 xcode-toolset-version: '11.7' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.macos-x64 == 'true' build-macos-aarch64: @@ -213,6 +238,8 @@ jobs: platform: macos-aarch64 xcode-toolset-version: '12.4' extra-conf-options: '--openjdk-target=aarch64-apple-darwin' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.macos-aarch64 == 'true' build-windows-x64: @@ -223,6 +250,8 @@ jobs: platform: windows-x64 msvc-toolset-version: '14.29' msvc-toolset-architecture: 'x86.x64' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.windows-x64 == 'true' build-windows-aarch64: @@ -235,6 +264,8 @@ jobs: msvc-toolset-architecture: 'arm64' make-target: 'hotspot' extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.windows-aarch64 == 'true' ### @@ -249,7 +280,7 @@ jobs: with: platform: linux-x64 bootjdk-platform: linux-x64 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 test-linux-x86: name: linux-x86 @@ -259,7 +290,7 @@ jobs: with: platform: linux-x86 bootjdk-platform: linux-x64 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 test-macos-x64: name: macos-x64 @@ -284,7 +315,7 @@ jobs: # Remove bundles so they are not misconstrued as binary distributions from the JDK project remove-bundles: name: 'Remove bundle artifacts' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 if: always() needs: - build-linux-x64 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ac6708f9e0..351eb1f6605 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,7 +100,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Get MSYS2' uses: ./.github/actions/get-msys2 diff --git a/.jcheck/conf b/.jcheck/conf index 5b8b093c86f..57ef1f63d39 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=11.0.21 +version=11.0.22 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace diff --git a/closed/openjdk-tag.gmk b/closed/openjdk-tag.gmk index fea6834c184..33c2bc9dc5f 100644 --- a/closed/openjdk-tag.gmk +++ b/closed/openjdk-tag.gmk @@ -1 +1 @@ -OPENJDK_TAG := jdk-11.0.21+9 +OPENJDK_TAG := jdk-11.0.22+1 diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4 index 26a58eb2ee8..5d1d9efa399 100644 --- a/make/autoconf/platform.m4 +++ b/make/autoconf/platform.m4 @@ -566,6 +566,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], HOTSPOT_$1_CPU_DEFINE=S390 elif test "x$OPENJDK_$1_CPU" = xriscv64; then HOTSPOT_$1_CPU_DEFINE=RISCV + elif test "x$OPENJDK_$1_CPU" = xloongarch64; then + HOTSPOT_$1_CPU_DEFINE=LOONGARCH64 elif test "x$OPENJDK_$1_CPU" != x; then HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z) fi diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers index e6d1afbbc53..819d28cf637 100644 --- a/make/autoconf/version-numbers +++ b/make/autoconf/version-numbers @@ -28,12 +28,12 @@ DEFAULT_VERSION_FEATURE=11 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=21 +DEFAULT_VERSION_UPDATE=22 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2023-10-17 +DEFAULT_VERSION_DATE=2024-01-16 DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11" diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 6189810888e..0710bf5bf97 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -359,10 +359,15 @@ define SetupCompileNativeFileBody endif endif + ifneq ($(DISABLE_WARNING_PREFIX), ) + $1_WARNINGS_FLAGS := $$(addprefix $(DISABLE_WARNING_PREFIX), \ + $$($$($1_BASE)_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)_$$($1_FILENAME))) + endif + $1_BASE_CFLAGS := $$($$($1_BASE)_CFLAGS) $$($$($1_BASE)_EXTRA_CFLAGS) \ - $$($$($1_BASE)_SYSROOT_CFLAGS) + $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_WARNINGS_FLAGS) $1_BASE_CXXFLAGS := $$($$($1_BASE)_CXXFLAGS) $$($$($1_BASE)_EXTRA_CXXFLAGS) \ - $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_EXTRA_CXXFLAGS) + $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_WARNINGS_FLAGS) $1_BASE_ASFLAGS := $$($$($1_BASE)_ASFLAGS) $$($$($1_BASE)_EXTRA_ASFLAGS) ifneq ($$(filter %.c, $$($1_FILENAME)), ) diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index 74d20585b71..41124e1846c 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -62,7 +62,11 @@ define SetupTestFilesCompilationBody $1_OUTPUT_SUBDIR := lib $1_BASE_CFLAGS := $(CFLAGS_JDKLIB) $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB) - $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN) + ifeq ($(call isTargetOs, windows), false) + $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN) -pthread + else + $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN) + endif $1_COMPILATION_TYPE := LIBRARY else ifeq ($$($1_TYPE), PROGRAM) $1_PREFIX = exe diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk index fecbb248a7c..3db2dd9b150 100644 --- a/make/lib/Awt2dLibraries.gmk +++ b/make/lib/Awt2dLibraries.gmk @@ -516,6 +516,7 @@ else LIBFREETYPE_LIBS := -lfreetype endif + # gcc_ftobjs.c := maybe-uninitialized required for GCC 7 builds. $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \ NAME := freetype, \ OPTIMIZATION := HIGHEST, \ @@ -528,6 +529,7 @@ else DISABLED_WARNINGS_microsoft := 4018 4267 4244 4312 4819, \ DISABLED_WARNINGS_gcc := implicit-fallthrough cast-function-type bad-function-cast, \ DISABLED_WARNINGS_clang := missing-declarations, \ + DISABLED_WARNINGS_gcc_ftobjs.c := maybe-uninitialized, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ )) diff --git a/src/java.base/aix/native/libnet/aix_close.c b/src/java.base/aix/native/libnet/aix_close.c index 1abe7710547..dfd3beab69f 100644 --- a/src/java.base/aix/native/libnet/aix_close.c +++ b/src/java.base/aix/native/libnet/aix_close.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2019, SAP SE and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -388,50 +388,50 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT(s, recv(s, buf, len, MSG_NONBLOCK)); + BLOCKING_IO_RETURN_INT(s, recv(s, buf, len, MSG_NONBLOCK), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t *fromlen) { - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen), JNI_TRUE ); } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) { - BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen), JNI_TRUE); } int NET_Connect(int s, struct sockaddr *addr, int addrlen) { @@ -489,7 +489,7 @@ int NET_Connect(int s, struct sockaddr *addr, int addrlen) { } int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } /* @@ -531,12 +531,16 @@ int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) { * has expired return 0 (indicating timeout expired). */ if (rv < 0 && errno == EINTR) { - jlong newNanoTime = JVM_NanoTime(env, 0); - nanoTimeout -= newNanoTime - prevNanoTime; - if (nanoTimeout < NET_NSEC_PER_MSEC) { - return 0; + if (timeout > 0) { + jlong newNanoTime = JVM_NanoTime(env, 0); + nanoTimeout -= newNanoTime - prevNanoTime; + if (nanoTimeout < NET_NSEC_PER_MSEC) { + return 0; + } + prevNanoTime = newNanoTime; + } else { + continue; // timeout is -1, so loop again. } - prevNanoTime = newNanoTime; } else { return rv; } diff --git a/src/java.base/linux/native/libnet/linux_close.c b/src/java.base/linux/native/libnet/linux_close.c index fdfe7bf5c21..aabdaad4e92 100644 --- a/src/java.base/linux/native/libnet/linux_close.c +++ b/src/java.base/linux/native/libnet/linux_close.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -345,58 +345,58 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t *fromlen) { - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen), JNI_TRUE ); } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) { - BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen), JNI_TRUE ); } int NET_Connect(int s, struct sockaddr *addr, int addrlen) { - BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen), JNI_TRUE ); } int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } /* @@ -437,12 +437,16 @@ int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) { * has expired return 0 (indicating timeout expired). */ if (rv < 0 && errno == EINTR) { - jlong newNanoTime = JVM_NanoTime(env, 0); - nanoTimeout -= newNanoTime - prevNanoTime; - if (nanoTimeout < NET_NSEC_PER_MSEC) { - return 0; + if (timeout > 0) { + jlong newNanoTime = JVM_NanoTime(env, 0); + nanoTimeout -= newNanoTime - prevNanoTime; + if (nanoTimeout < NET_NSEC_PER_MSEC) { + return 0; + } + prevNanoTime = newNanoTime; + } else { + continue; // timeout is -1, so loop again. } - prevNanoTime = newNanoTime; } else { return rv; } diff --git a/src/java.base/macosx/native/libnet/bsd_close.c b/src/java.base/macosx/native/libnet/bsd_close.c index 4869fa58ca2..43b6b491be4 100644 --- a/src/java.base/macosx/native/libnet/bsd_close.c +++ b/src/java.base/macosx/native/libnet/bsd_close.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -349,58 +349,58 @@ int NET_SocketClose(int fd) { /************** Basic I/O operations here ***************/ /* - * Macro to perform a blocking IO operation. Restarts - * automatically if interrupted by signal (other than - * our wakeup signal) + * Macro to perform a blocking IO operation. + * If interrupted by signal (other than our wakeup signal), and if RETRY is true, + * then restarts automatically */ -#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \ - int ret; \ - threadEntry_t self; \ - fdEntry_t *fdEntry = getFdEntry(FD); \ - if (fdEntry == NULL) { \ - errno = EBADF; \ - return -1; \ - } \ - do { \ - startOp(fdEntry, &self); \ - ret = FUNC; \ - endOp(fdEntry, &self); \ - } while (ret == -1 && errno == EINTR); \ - return ret; \ +#define BLOCKING_IO_RETURN_INT(FD, FUNC, RETRY) { \ + int ret; \ + threadEntry_t self; \ + fdEntry_t *fdEntry = getFdEntry(FD); \ + if (fdEntry == NULL) { \ + errno = EBADF; \ + return -1; \ + } \ + do { \ + startOp(fdEntry, &self); \ + ret = FUNC; \ + endOp(fdEntry, &self); \ + } while ((RETRY) && ret == -1 && errno == EINTR); \ + return ret; \ } int NET_Read(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) ); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0), JNI_TRUE ); } int NET_NonBlockingRead(int s, void* buf, size_t len) { - BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT)); + BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, MSG_DONTWAIT), JNI_TRUE ); } int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t *fromlen) { - BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) ); + BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen), JNI_TRUE ); } int NET_Send(int s, void *msg, int len, unsigned int flags) { - BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) ); + BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags), JNI_TRUE ); } int NET_SendTo(int s, const void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen) { - BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) ); + BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen), JNI_TRUE ); } int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) { - BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen), JNI_TRUE ); } int NET_Connect(int s, struct sockaddr *addr, int addrlen) { - BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) ); + BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen), JNI_TRUE ); } int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { - BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) ); + BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout), JNI_FALSE ); } /* @@ -472,17 +472,20 @@ int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) { * has expired return 0 (indicating timeout expired). */ if (rv < 0 && errno == EINTR) { - jlong newNanoTime = JVM_NanoTime(env, 0); - nanoTimeout -= newNanoTime - prevNanoTime; - if (nanoTimeout < NET_NSEC_PER_MSEC) { - if (allocated != 0) - free(fdsp); - return 0; + if (timeout > 0) { + jlong newNanoTime = JVM_NanoTime(env, 0); + nanoTimeout -= newNanoTime - prevNanoTime; + if (nanoTimeout < NET_NSEC_PER_MSEC) { + if (allocated != 0) + free(fdsp); + return 0; + } + prevNanoTime = newNanoTime; + t.tv_sec = nanoTimeout / NET_NSEC_PER_SEC; + t.tv_usec = (nanoTimeout % NET_NSEC_PER_SEC) / NET_NSEC_PER_USEC; + } else { + continue; // timeout is -1, so loop again. } - prevNanoTime = newNanoTime; - t.tv_sec = nanoTimeout / NET_NSEC_PER_SEC; - t.tv_usec = (nanoTimeout % NET_NSEC_PER_SEC) / NET_NSEC_PER_USEC; - } else { if (allocated != 0) free(fdsp); diff --git a/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m b/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m index b4e19a27995..b4f13a80d96 100644 --- a/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m +++ b/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m @@ -363,7 +363,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore) // Call back to the Java object to create Java objects corresponding to this security object. jlong nativeKeyRef = ptr_to_jlong(privateKeyRef); (*env)->CallVoidMethod(env, keyStore, jm_createKeyEntry, alias, creationDate, nativeKeyRef, certRefArray, javaCertArray); - JNU_CHECK_EXCEPTION(env); + if ((*env)->ExceptionCheck(env)) { + goto errOut; + } } } while (searchResult == noErr); @@ -505,7 +507,9 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore) // Call back to the Java object to create Java objects corresponding to this security object. jlong nativeRef = ptr_to_jlong(certRef); (*env)->CallVoidMethod(env, keyStore, jm_createTrustedCertEntry, alias, inputTrust, nativeRef, creationDate, certData); - JNU_CHECK_EXCEPTION(env); + if ((*env)->ExceptionCheck(env)) { + goto errOut; + } } } while (searchResult == noErr); diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 258594be396..f07aa720e10 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -22,6 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +/* + * =========================================================================== + * (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved + * =========================================================================== + */ package java.lang.invoke; @@ -4896,7 +4901,7 @@ public static MethodHandle loop(MethodHandle[]... clauses) { pred.set(i, dropArguments0(constant(boolean.class, true), 0, commonParameterSequence)); } if (fini.get(i) == null) { - fini.set(i, empty(methodType(t, commonParameterSequence))); + fini.set(i, empty(methodType(loopReturnType, commonParameterSequence))); } } diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index 06aa6d1395f..6f755347102 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -31,6 +31,8 @@ package java.security; +import jdk.internal.event.SecurityProviderServiceEvent; + import java.io.*; import java.util.*; import static java.util.Locale.ENGLISH; @@ -1286,19 +1288,28 @@ public Service getService(String type, String algorithm) { key = new ServiceKey(type, algorithm, false); previousKey = key; } + Service s = null; if (!serviceMap.isEmpty()) { - Service s = serviceMap.get(key); - if (s != null) { - return s; - } + s = serviceMap.get(key); } - synchronized (this) { - ensureLegacyParsed(); - if (legacyMap != null && !legacyMap.isEmpty()) { - return legacyMap.get(key); + if (s == null) { + synchronized (this) { + ensureLegacyParsed(); + if (legacyMap != null && !legacyMap.isEmpty()) { + s = legacyMap.get(key); + } } } - return null; + + if (s != null && SecurityProviderServiceEvent.isTurnedOn()) { + var e = new SecurityProviderServiceEvent(); + e.provider = getName(); + e.type = type; + e.algorithm = algorithm; + e.commit(); + } + + return s; } // ServiceKey from previous getService() call diff --git a/src/java.base/share/classes/java/util/Timer.java b/src/java.base/share/classes/java/util/Timer.java index b6ce7635482..f36a76d51af 100644 --- a/src/java.base/share/classes/java/util/Timer.java +++ b/src/java.base/share/classes/java/util/Timer.java @@ -578,7 +578,9 @@ private void mainLoop() { // A zero checkpointRestoreTimeDelta value indicates no Checkpoint performed yet, // it can't be negative, otherwise a RestoreException already was thrown. if (checkpointRestoreTimeDelta > 0) { + // Ensure the time compensation in milliseconds is not less than the checkpoint restore time delta. task.nextExecutionTime += (checkpointRestoreTimeDelta / 1000000); + task.nextExecutionTime += ((checkpointRestoreTimeDelta % 1000000 == 0) ? 0 : 1); // clear the flag - only one time adjustment required task.criuAdjustRequired = false; } diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index cb7e308e0d7..cce897c0d31 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -809,7 +809,9 @@ private byte[] getBytes(ZipEntry ze) throws IOException { throw new IOException("Unsupported size: " + uncompressedSize + " for JarEntry " + ze.getName() + ". Allowed max size: " + - SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes"); + SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " + + "You can use the jdk.jar.maxSignatureFileSize " + + "system property to increase the default value."); } int len = (int)uncompressedSize; int bytesRead; diff --git a/src/java.base/share/classes/jdk/internal/event/SecurityProviderServiceEvent.java b/src/java.base/share/classes/jdk/internal/event/SecurityProviderServiceEvent.java new file mode 100644 index 00000000000..2c2c487849b --- /dev/null +++ b/src/java.base/share/classes/jdk/internal/event/SecurityProviderServiceEvent.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.event; + +/** + * Event recording details of Provider.getService(String type, String algorithm) calls + */ + +public final class SecurityProviderServiceEvent extends Event { + private final static SecurityProviderServiceEvent EVENT = new SecurityProviderServiceEvent(); + + /** + * Returns {@code true} if event is enabled, {@code false} otherwise. + */ + public static boolean isTurnedOn() { + return EVENT.isEnabled(); + } + + public String type; + public String algorithm; + public String provider; +} diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index a7fdd3dae4b..6805f533c45 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -248,8 +248,9 @@ jdk.naming.dns; exports sun.net.util to java.desktop, + java.net.http, jdk.jconsole, - java.net.http; + jdk.sctp; exports sun.net.www to java.desktop, java.net.http, diff --git a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java index cb477fc1340..a766b8249fb 100644 --- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java +++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java @@ -852,16 +852,16 @@ private static int initializeMaxSigFileSize() { * the maximum allowed number of bytes for the signature-related files * in a JAR file. */ - Integer tmp = GetIntegerAction.privilegedGetProperty( - "jdk.jar.maxSignatureFileSize", 8000000); + int tmp = GetIntegerAction.privilegedGetProperty( + "jdk.jar.maxSignatureFileSize", 16000000); if (tmp < 0 || tmp > MAX_ARRAY_SIZE) { if (debug != null) { - debug.println("Default signature file size 8000000 bytes " + - "is used as the specified size for the " + - "jdk.jar.maxSignatureFileSize system property " + + debug.println("The default signature file size of 16000000 bytes " + + "will be used for the jdk.jar.maxSignatureFileSize " + + "system property since the specified value " + "is out of range: " + tmp); } - tmp = 8000000; + tmp = 16000000; } return tmp; } diff --git a/src/java.base/unix/native/libjsig/jsig.c b/src/java.base/unix/native/libjsig/jsig.c index f59012c34f9..a7479b2227e 100644 --- a/src/java.base/unix/native/libjsig/jsig.c +++ b/src/java.base/unix/native/libjsig/jsig.c @@ -278,17 +278,28 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { signal_unlock(); return 0; } else if (jvm_signal_installing) { - /* jvm is installing its signal handlers. Install the new - * handlers and save the old ones. */ + /* jvm is installing its signal handlers. + * - if this is a modifying sigaction call, we install a new signal handler and store the old one + * as chained signal handler. + * - if this is a non-modifying sigaction call, we don't change any state; we just return the existing + * signal handler in the system (not the stored one). + * This works under the assumption that there is only one modifying sigaction call for a specific signal + * within the JVM_begin_signal_setting-JVM_end_signal_setting-window. There can be any number of non-modifying + * calls, but they will only return the expected preexisting handler if executed before the modifying call. + */ res = call_os_sigaction(sig, act, &oldAct); - sact[sig] = oldAct; - if (oact != NULL) { - *oact = oldAct; + if (res == 0) { + if (act != NULL) { + /* store pre-existing handler as chained handler */ + sact[sig] = oldAct; + /* Record the signals used by jvm. */ + sigaddset(&jvmsigs, sig); + } + if (oact != NULL) { + *oact = oldAct; + } } - /* Record the signals used by jvm. */ - sigaddset(&jvmsigs, sig); - signal_unlock(); return res; } else { diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java index 8aea5e0dd92..ef9c5243704 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java @@ -556,6 +556,7 @@ public SpinPainter(final AbstractButton top, final AbstractButton bottom) { if (bottom != null) { fBottomModel = bottom.getModel(); } + setFocusable(false); } @Override diff --git a/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java b/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java index 16749e99b89..f64c9a2327c 100644 --- a/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java +++ b/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import java.io.InputStreamReader; import java.net.URL; import java.net.URLClassLoader; +import java.security.AccessController; import java.util.ArrayList; import java.util.Objects; @@ -40,6 +41,7 @@ import javax.sound.midi.spi.SoundbankReader; import sun.reflect.misc.ReflectUtil; +import sun.security.action.GetBooleanAction; /** * JarSoundbankReader is used to read soundbank object from jar files. @@ -48,12 +50,15 @@ */ public final class JARSoundbankReader extends SoundbankReader { - /* - * Name of the system property that enables the Jar soundbank loading - * true if jar sound bank is allowed to be loaded - * default is false + /** + * Value of the system property that enables the Jar soundbank loading + * {@code true} if jar sound bank is allowed to be loaded default is + * {@code false}. */ - private final static String JAR_SOUNDBANK_ENABLED = "jdk.sound.jarsoundbank"; + @SuppressWarnings("removal") + private static final boolean JAR_SOUNDBANK_ENABLED = + AccessController.doPrivileged( + new GetBooleanAction("jdk.sound.jarsoundbank")); private static boolean isZIP(URL url) { boolean ok = false; @@ -81,7 +86,7 @@ private static boolean isZIP(URL url) { public Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException { Objects.requireNonNull(url); - if (!Boolean.getBoolean(JAR_SOUNDBANK_ENABLED) || !isZIP(url)) + if (!JAR_SOUNDBANK_ENABLED || !isZIP(url)) return null; ArrayList soundbanks = new ArrayList<>(); diff --git a/src/java.desktop/share/classes/javax/swing/colorchooser/ColorPanel.java b/src/java.desktop/share/classes/javax/swing/colorchooser/ColorPanel.java index 07616ac2c0a..ffe0fc43c04 100644 --- a/src/java.desktop/share/classes/javax/swing/colorchooser/ColorPanel.java +++ b/src/java.desktop/share/classes/javax/swing/colorchooser/ColorPanel.java @@ -99,8 +99,6 @@ final class ColorPanel extends JPanel implements ActionListener { add(spinner.getSpinner(), gbc); gbc.insets.top = 5; } - setFocusTraversalPolicy(new ContainerOrderFocusTraversalPolicy()); - setFocusTraversalPolicyProvider(true); setFocusable(false); this.model = model; diff --git a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c index 20ccde96693..83a2182ca03 100644 --- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c +++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c @@ -443,10 +443,10 @@ Java_sun_font_FreetypeFontScaler_createScalerContextNative( ptsz = 1.0; } context->ptsz = (int)(ptsz * 64); - context->transform.xx = FloatToFTFixed((float)dmat[0]/ptsz); - context->transform.yx = -FloatToFTFixed((float)dmat[1]/ptsz); - context->transform.xy = -FloatToFTFixed((float)dmat[2]/ptsz); - context->transform.yy = FloatToFTFixed((float)dmat[3]/ptsz); + context->transform.xx = FloatToFTFixed((float)(dmat[0]/ptsz)); + context->transform.yx = -FloatToFTFixed((float)(dmat[1]/ptsz)); + context->transform.xy = -FloatToFTFixed((float)(dmat[2]/ptsz)); + context->transform.yy = FloatToFTFixed((float)(dmat[3]/ptsz)); context->aaType = aa; context->fmType = fm; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp index dbca3d778c8..8da38d9c798 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp @@ -24,7 +24,6 @@ */ #include "awt.h" - #include #include "awt_Component.h" @@ -1394,7 +1393,9 @@ BOOL AwtWindow::UpdateInsets(jobject insets) */ RECT outside; RECT inside; - int extraBottomInsets = 0; + + // extra padded border for captioned windows + int extraPaddedBorderInsets = ::GetSystemMetrics(SM_CXPADDEDBORDER); ::GetClientRect(GetHWnd(), &inside); ::GetWindowRect(GetHWnd(), &outside); @@ -1403,12 +1404,13 @@ BOOL AwtWindow::UpdateInsets(jobject insets) if (outside.right - outside.left > 0 && outside.bottom - outside.top > 0) { ::MapWindowPoints(GetHWnd(), 0, (LPPOINT)&inside, 2); m_insets.top = inside.top - outside.top; - m_insets.bottom = outside.bottom - inside.bottom + extraBottomInsets; + m_insets.bottom = outside.bottom - inside.bottom; m_insets.left = inside.left - outside.left; m_insets.right = outside.right - inside.right; } else { m_insets.top = -1; } + if (m_insets.left < 0 || m_insets.top < 0 || m_insets.right < 0 || m_insets.bottom < 0) { @@ -1416,20 +1418,11 @@ BOOL AwtWindow::UpdateInsets(jobject insets) jobject target = GetTarget(env); if (IsUndecorated() == FALSE) { /* Get outer frame sizes. */ - LONG style = GetStyle(); - if (style & WS_THICKFRAME) { - m_insets.left = m_insets.right = - ::GetSystemMetrics(SM_CXSIZEFRAME); - m_insets.top = m_insets.bottom = - ::GetSystemMetrics(SM_CYSIZEFRAME); - } else { - m_insets.left = m_insets.right = - ::GetSystemMetrics(SM_CXDLGFRAME); - m_insets.top = m_insets.bottom = - ::GetSystemMetrics(SM_CYDLGFRAME); - } - - + // System metrics are same for resizable & non-resizable frame. + m_insets.left = m_insets.right = + ::GetSystemMetrics(SM_CXFRAME) + extraPaddedBorderInsets; + m_insets.top = m_insets.bottom = + ::GetSystemMetrics(SM_CYFRAME) + extraPaddedBorderInsets; /* Add in title. */ m_insets.top += ::GetSystemMetrics(SM_CYCAPTION); } @@ -1437,7 +1430,7 @@ BOOL AwtWindow::UpdateInsets(jobject insets) /* fix for 4418125: Undecorated frames are off by one */ /* undo the -1 set above */ /* Additional fix for 5059656 */ - /* Also, 5089312: Window insets should be 0. */ + /* Also, 5089312: Window insets should be 0. */ ::memset(&m_insets, 0, sizeof(m_insets)); } @@ -1450,7 +1443,6 @@ BOOL AwtWindow::UpdateInsets(jobject insets) env->DeleteLocalRef(target); return FALSE; } - m_insets.bottom += extraBottomInsets; env->DeleteLocalRef(target); } diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java index 73f0cb26a2b..f591b3567cc 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -638,14 +638,12 @@ void cleanup(Control[] reqCtls, boolean notifyParent) { ldapUnbind(reqCtls); } } finally { - try { - outStream.flush(); - sock.close(); - unpauseReader(); - } catch (IOException ie) { - if (debug) - System.err.println("Connection: problem closing socket: " + ie); - } + + flushAndCloseOutputStream(); + // 8313657 socket is not closed until GC is run + closeOpenedSocket(); + tryUnpauseReader(); + if (!notifyParent) { LdapRequest ldr = pendingRequests; while (ldr != null) { @@ -679,6 +677,43 @@ void cleanup(Control[] reqCtls, boolean notifyParent) { } } + // flush and close output stream + private void flushAndCloseOutputStream() { + try { + outStream.flush(); + } catch (IOException ioEx) { + if (debug) + System.err.println("Connection.flushOutputStream: OutputStream flush problem " + ioEx); + } + try { + outStream.close(); + } catch (IOException ioEx) { + if (debug) + System.err.println("Connection.closeOutputStream: OutputStream close problem " + ioEx); + } + } + + // close socket + private void closeOpenedSocket() { + try { + sock.close(); + } catch (IOException ioEx) { + if (debug) { + System.err.println("Connection.closeConnectionSocket: Socket close problem: " + ioEx); + System.err.println("Socket isClosed: " + sock.isClosed()); + } + } + } + + // unpause reader + private void tryUnpauseReader() { + try { + unpauseReader(); + } catch (IOException ioEx) { + if (debug) + System.err.println("Connection.tryUnpauseReader: unpauseReader problem " + ioEx); + } + } // Assume everything is "quiet" // "synchronize" might lead to deadlock so don't synchronize method diff --git a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java index e0cc4c65ab2..10554ad0eb5 100644 --- a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java +++ b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java @@ -355,7 +355,7 @@ int readInt(InputStream in) throws IOException { String readErrorMessage(InputStream in) throws IOException { String s; StringBuilder message = new StringBuilder(); - BufferedReader br = new BufferedReader(new InputStreamReader(in)); + BufferedReader br = new BufferedReader(new InputStreamReader(in,"UTF-8")); while ((s = br.readLine()) != null) { message.append(s); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java index da9128d0a39..dacecbbc66d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java @@ -337,6 +337,17 @@ InferenceContext min(List roots, boolean shouldSolve, Warner warn) { if (roots.length() == inferencevars.length()) { return this; } + /* if any of the inference vars is a captured variable bail out, this is because + * we could end up generating more than necessary captured variables in an outer + * inference context and then when we need to propagate back to an inner inference + * context that has been minimized it could be that some bounds constraints doesn't + * hold like subtyping constraints between bonds etc. + */ + for (Type iv : inferencevars) { + if (iv.hasTag(TypeTag.TYPEVAR) && ((TypeVar)iv).isCaptured()) { + return this; + } + } ReachabilityVisitor rv = new ReachabilityVisitor(); rv.scan(roots); if (rv.min.size() == inferencevars.length()) { diff --git a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp index 9059b9160c0..684588cac26 100644 --- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp +++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp @@ -502,7 +502,11 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_CKeyStore_loadKeysOrCertificateC else { if (bCallerFreeProv == TRUE) { - ::CryptReleaseContext(hCryptProv, NULL); // deprecated + if ((dwKeySpec & CERT_NCRYPT_KEY_SPEC) == CERT_NCRYPT_KEY_SPEC) { + NCryptFreeObject(hCryptProv); + } else { + ::CryptReleaseContext(hCryptProv, NULL); // deprecated + } bCallerFreeProv = FALSE; } diff --git a/src/jdk.internal.le/share/legal/jline.md b/src/jdk.internal.le/share/legal/jline.md index 4e5d344b4d1..6840c69cfc0 100644 --- a/src/jdk.internal.le/share/legal/jline.md +++ b/src/jdk.internal.le/share/legal/jline.md @@ -38,257 +38,4 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -4th Party Dependency -============= -org.fusesource.jansi version 2.4.0 -org.apache.sshd 2.9.2 -org.apache.felix.gogo.runtime 1.1.6 -org.apache.felix.gogo.jline 1.1.8 -============= -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -============= -juniversalchardet - -The library is subject to the Mozilla Public License Version 1.1. - -Alternatively, the library may be used under the terms of either the GNU General Public License Version 2 or later, or the GNU Lesser General Public License 2.1 or later. - -================ - -slf4j - -SLF4J source code and binaries are distributed under the MIT license. - - -Copyright (c) 2004-2023 QOS.ch -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -These terms are identical to those of the MIT License, also called the X License -or the X11 License, which is a simple, permissive non-copyleft free software license. -It is deemed compatible with virtually all types of licenses, commercial or otherwise. -In particular, the Free Software Foundation has declared it compatible with GNU GPL. -It is also known to be approved by the Apache Software Foundation as compatible with -Apache Software License. - diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/VMConnection.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/VMConnection.java index de355ba5d82..8ff830eecf9 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/VMConnection.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/VMConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -474,11 +474,10 @@ private void dumpStream(InputStream stream) throws IOException { // printDirect() } } catch (IOException ex) { - String s = ex.getMessage(); - if (!s.startsWith("Bad file number")) { + if (!ex.getMessage().equalsIgnoreCase("stream closed")) { throw ex; } - // else we got a Bad file number IOException which just means + // else we got a "Stream closed" IOException which just means // that the debuggee has gone away. We'll just treat it the // same as if we got an EOF. } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/events/SecurityProviderServiceEvent.java b/src/jdk.jfr/share/classes/jdk/jfr/events/SecurityProviderServiceEvent.java new file mode 100644 index 00000000000..97a5150561c --- /dev/null +++ b/src/jdk.jfr/share/classes/jdk/jfr/events/SecurityProviderServiceEvent.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jfr.events; + +import jdk.jfr.Category; +import jdk.jfr.Description; +import jdk.jfr.Label; +import jdk.jfr.Name; +import jdk.jfr.internal.MirrorEvent; + +@Category({"Java Development Kit", "Security"}) +@Label("Security Provider Instance Request") +@Name("jdk.SecurityProviderService") +@Description("Details of Provider.getInstance(String type, String algorithm) calls") +@MirrorEvent(className = "jdk.internal.event.SecurityProviderServiceEvent") +public final class SecurityProviderServiceEvent extends AbstractJDKEvent { + @Label("Type of Service") + public String type; + + @Label("Algorithm Name") + public String algorithm; + + @Label("Security Provider") + public String provider; +} diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java index d2536efa571..7db639b33fc 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java @@ -38,11 +38,17 @@ public final class JVM { private static final JVM jvm = new JVM(); - // JVM signals file changes by doing Object#notifu on this object - static final Object FILE_DELTA_CHANGE = new Object(); - static final long RESERVED_CLASS_ID_LIMIT = 400; + private static class ChunkRotationMonitor {} + + /* + * The JVM uses the chunk rotation monitor to notify Java that a rotation is warranted. + * The monitor type is used to exclude jdk.JavaMonitorWait events from being generated + * when Object.wait() is called on this monitor. + */ + static final Object CHUNK_ROTATION_MONITOR = new ChunkRotationMonitor(); + private volatile boolean recording; private volatile boolean nativeOK; diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java index 5ec29d1015b..079005910a6 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java @@ -444,8 +444,8 @@ private void periodicTask() { private void takeNap(long duration) { try { - synchronized (JVM.FILE_DELTA_CHANGE) { - JVM.FILE_DELTA_CHANGE.wait(duration < 10 ? 10 : duration); + synchronized (JVM.CHUNK_ROTATION_MONITOR) { + JVM.CHUNK_ROTATION_MONITOR.wait(duration < 10 ? 10 : duration); } } catch (InterruptedException e) { e.printStackTrace(); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/JDKEvents.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/JDKEvents.java index c8c9af10888..cf64f554e13 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/JDKEvents.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/instrument/JDKEvents.java @@ -39,6 +39,7 @@ import jdk.jfr.events.FileWriteEvent; import jdk.jfr.events.DeserializationEvent; import jdk.jfr.events.SecurityPropertyModificationEvent; +import jdk.jfr.events.SecurityProviderServiceEvent; import jdk.jfr.events.SocketReadEvent; import jdk.jfr.events.SocketWriteEvent; import jdk.jfr.events.TLSHandshakeEvent; @@ -57,6 +58,7 @@ public final class JDKEvents { private static final Class[] mirrorEventClasses = { DeserializationEvent.class, SecurityPropertyModificationEvent.class, + SecurityProviderServiceEvent.class, TLSHandshakeEvent.class, X509CertificateEvent.class, X509ValidationEvent.class @@ -75,6 +77,7 @@ public final class JDKEvents { ActiveRecordingEvent.class, jdk.internal.event.DeserializationEvent.class, jdk.internal.event.SecurityPropertyModificationEvent.class, + jdk.internal.event.SecurityProviderServiceEvent.class, jdk.internal.event.TLSHandshakeEvent.class, jdk.internal.event.X509CertificateEvent.class, jdk.internal.event.X509ValidationEvent.class diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index 0a2838d90de..ed63b678777 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -613,6 +613,11 @@ true + + false + true + + false true diff --git a/src/jdk.jfr/share/conf/jfr/profile.jfc b/src/jdk.jfr/share/conf/jfr/profile.jfc index 140aeda7040..b8dc6506846 100644 --- a/src/jdk.jfr/share/conf/jfr/profile.jfc +++ b/src/jdk.jfr/share/conf/jfr/profile.jfc @@ -613,6 +613,11 @@ true + + false + true + + false true diff --git a/src/jdk.sctp/share/classes/com/sun/nio/sctp/HandlerResult.java b/src/jdk.sctp/share/classes/com/sun/nio/sctp/HandlerResult.java index c4ca0a3de0d..a037264d056 100644 --- a/src/jdk.sctp/share/classes/com/sun/nio/sctp/HandlerResult.java +++ b/src/jdk.sctp/share/classes/com/sun/nio/sctp/HandlerResult.java @@ -29,7 +29,7 @@ * *

The {@code HandlerResult} is used to determine the behavior of the * channel after it handles a notification from the SCTP stack. Essentially its - * value determines if the channel should try to receive another notificaiton or + * value determines if the channel should try to receive another notification or * a message before returning. * * @since 1.7 diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java index f33d105dc69..c214ee06789 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java @@ -53,6 +53,7 @@ import com.sun.nio.sctp.NotificationHandler; import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpSocketOption; +import sun.net.util.IPAddressUtil; import sun.nio.ch.DirectBuffer; import sun.nio.ch.IOStatus; import sun.nio.ch.IOUtil; @@ -1033,6 +1034,9 @@ private int sendFromNativeBuffer(int fd, if (target != null) { InetSocketAddress isa = Net.checkAddress(target); addr = isa.getAddress(); + if (addr.isLinkLocalAddress()) { + addr = IPAddressUtil.toScopedAddress(addr); + } port = isa.getPort(); } diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java index 084e5e36859..d62469bfd49 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java @@ -53,6 +53,7 @@ import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpMultiChannel; import com.sun.nio.sctp.SctpSocketOption; +import sun.net.util.IPAddressUtil; import sun.nio.ch.DirectBuffer; import sun.nio.ch.NativeThread; import sun.nio.ch.IOStatus; @@ -892,6 +893,9 @@ private int sendFromNativeBuffer(int fd, if (target != null) { InetSocketAddress isa = Net.checkAddress(target); addr = isa.getAddress(); + if (addr.isLinkLocalAddress()) { + addr = IPAddressUtil.toScopedAddress(addr); + } port = isa.getPort(); } int pos = bb.position(); diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java index 367ab1f1e4d..7539a37f280 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java @@ -34,6 +34,7 @@ import java.util.HashSet; import java.security.AccessController; import java.security.PrivilegedAction; +import sun.net.util.IPAddressUtil; import sun.nio.ch.IOUtil; import sun.nio.ch.Net; import com.sun.nio.sctp.SctpSocketOption; @@ -169,9 +170,13 @@ static void setSocketOption(int fd, InetSocketAddress netAddr = (InetSocketAddress)addr; if (name.equals(SCTP_PRIMARY_ADDR)) { + InetAddress inetAddress = netAddr.getAddress(); + if (inetAddress.isLinkLocalAddress()) { + inetAddress = IPAddressUtil.toScopedAddress(inetAddress); + } setPrimAddrOption0(fd, assocId, - netAddr.getAddress(), + inetAddress, netAddr.getPort()); } else { setPeerPrimAddrOption0(fd, diff --git a/test/hotspot/jtreg/compiler/compilercontrol/parser/TestCompileOnly.java b/test/hotspot/jtreg/compiler/compilercontrol/parser/TestCompileOnly.java new file mode 100644 index 00000000000..e129bf7ab48 --- /dev/null +++ b/test/hotspot/jtreg/compiler/compilercontrol/parser/TestCompileOnly.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8312573 + * @summary Test -XX:CompileOnly= with invalid arguments + * @library /test/lib / + * @run driver compiler.compilercontrol.parser.TestCompileOnly + */ + +package compiler.compilercontrol.parser; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestCompileOnly { + + public static void main(String[] args) throws Exception { + test(","); + test(" "); + test(", "); + test(" ,"); + test(",,"); + test(" "); + } + + public static void test(String compileOnlyCommand) throws Exception { + OutputAnalyzer output = ProcessTools.executeTestJvm("-XX:CompileOnly=" + compileOnlyCommand, "-version"); + output.shouldHaveExitValue(0); + } +} diff --git a/test/hotspot/jtreg/compiler/parsing/MissingSafepointOnTryCatch.jasm b/test/hotspot/jtreg/compiler/parsing/MissingSafepointOnTryCatch.jasm new file mode 100644 index 00000000000..5d5fced0cb3 --- /dev/null +++ b/test/hotspot/jtreg/compiler/parsing/MissingSafepointOnTryCatch.jasm @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +public class MissingSafepointOnTryCatch version 52:0 { + + static Method m:"()V" { + return; + } + + static Method test1:"()V" stack 1 { + try t; + invokestatic m:"()V"; + return; + + catch t java/lang/Throwable; + stack_map class java/lang/Throwable; + athrow; + endtry t; + } + + static Method test2:"()V" stack 1 { + try t0; + try t1; + invokestatic m:"()V"; + endtry t1; + return; + + catch t1 java/lang/Exception; + stack_map class java/lang/Exception; + return; + + catch t0 java/lang/Throwable; + stack_map class java/lang/Throwable; + athrow; + endtry t0; + } + + public static Method th:"()V" + throws java/lang/Exception + stack 2 locals 0 + { + new class java/lang/Exception; + dup; + invokespecial Method java/lang/Exception."":"()V"; + athrow; + } + + static Method test3:"()V" stack 1 locals 2 { + try t; + invokestatic m:"()V"; + iconst_1; + istore_0; + iconst_0; + istore_1; + return; + catch t java/lang/Throwable; + stack_map class java/lang/Throwable; + invokestatic th:"()V"; + return; + endtry t; + } + + static Method test4:"()V" stack 2 locals 2 { + try t; + invokestatic m:"()V"; + iconst_1; + istore_0; + iconst_0; + istore_1; + return; + catch t java/lang/Throwable; + stack_map class java/lang/Throwable; + iconst_1; + istore_0; + invokestatic th:"()V"; + return; + endtry t; + } + + static Method testInfinite:"()V" stack 1 { + try t; + invokestatic th:"()V"; + return; + + catch t java/lang/Throwable; + stack_map class java/lang/Throwable; + athrow; + endtry t; + } + +} // end Class MissingSafepointOnTryCatch diff --git a/test/hotspot/jtreg/compiler/parsing/TestMissingSafepointOnTryCatch.java b/test/hotspot/jtreg/compiler/parsing/TestMissingSafepointOnTryCatch.java new file mode 100644 index 00000000000..9a8a3135794 --- /dev/null +++ b/test/hotspot/jtreg/compiler/parsing/TestMissingSafepointOnTryCatch.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8313626 + * @summary assert(false) failed: malformed control flow to missing safepoint on backedge of a try-catch + * @library /test/lib + * @compile MissingSafepointOnTryCatch.jasm + * @run main/othervm -XX:CompileCommand=quiet + * -XX:CompileCommand=compileonly,MissingSafepointOnTryCatch::test* + * -XX:CompileCommand=dontinline,MissingSafepointOnTryCatch::m + * -XX:CompileCommand=inline,MissingSafepointOnTryCatch::th + * -XX:-TieredCompilation -Xcomp TestMissingSafepointOnTryCatch + */ + +import jdk.test.lib.Utils; + +public class TestMissingSafepointOnTryCatch { + + public static void infiniteLoop() { + try { + Thread thread = new Thread() { + public void run() { + MissingSafepointOnTryCatch.testInfinite(); + } + }; + thread.setDaemon(true); + thread.start(); + Thread.sleep(Utils.adjustTimeout(500)); + } catch (Exception e) {} + } + + public static void main(String[] args) { + try { + // to make sure java/lang/Exception class is resolved + MissingSafepointOnTryCatch.th(); + } catch (Exception e) {} + MissingSafepointOnTryCatch.test1(); + MissingSafepointOnTryCatch.test2(); + MissingSafepointOnTryCatch.test3(); + MissingSafepointOnTryCatch.test4(); + infiniteLoop(); + } +} diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java index b3fa7c49a8d..98f638abe2d 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestBoolean { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestBoolean { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static boolean static_v; boolean v; @@ -211,6 +228,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetBooleanPlain(base, offset, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = UNSAFE.getBoolean(base, offset); @@ -228,6 +246,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetBooleanAcquire(base, offset, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = UNSAFE.getBoolean(base, offset); @@ -245,6 +264,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetBooleanRelease(base, offset, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = UNSAFE.getBoolean(base, offset); @@ -262,6 +282,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetBoolean(base, offset, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = UNSAFE.getBoolean(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java index 0ce54ce877e..e149f6bd07b 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestByte { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestByte { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static byte static_v; byte v; @@ -240,6 +257,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetBytePlain(base, offset, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = UNSAFE.getByte(base, offset); @@ -257,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetByteAcquire(base, offset, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = UNSAFE.getByte(base, offset); @@ -274,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetByteRelease(base, offset, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = UNSAFE.getByte(base, offset); @@ -291,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetByte(base, offset, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = UNSAFE.getByte(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java index bcc8a481800..62d926b66a1 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestChar { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestChar { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static char static_v; char v; @@ -258,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetCharPlain(base, offset, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = UNSAFE.getChar(base, offset); @@ -275,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetCharAcquire(base, offset, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = UNSAFE.getChar(base, offset); @@ -292,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetCharRelease(base, offset, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = UNSAFE.getChar(base, offset); @@ -309,6 +329,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetChar(base, offset, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = UNSAFE.getChar(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java index ec68b3a52b9..2f90f0d7c7b 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestDouble { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestDouble { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static double static_v; double v; @@ -240,6 +257,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetDoublePlain(base, offset, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = UNSAFE.getDouble(base, offset); @@ -257,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetDoubleAcquire(base, offset, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = UNSAFE.getDouble(base, offset); @@ -274,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetDoubleRelease(base, offset, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = UNSAFE.getDouble(base, offset); @@ -291,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetDouble(base, offset, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = UNSAFE.getDouble(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java index 73da36c8355..f0256e7815d 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestFloat { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestFloat { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static float static_v; float v; @@ -240,6 +257,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetFloatPlain(base, offset, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = UNSAFE.getFloat(base, offset); @@ -257,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetFloatAcquire(base, offset, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = UNSAFE.getFloat(base, offset); @@ -274,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetFloatRelease(base, offset, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = UNSAFE.getFloat(base, offset); @@ -291,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetFloat(base, offset, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = UNSAFE.getFloat(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java index a62fede83d7..038cd2151b1 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestInt { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestInt { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static int static_v; int v; @@ -258,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetIntPlain(base, offset, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = UNSAFE.getInt(base, offset); @@ -275,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetIntAcquire(base, offset, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = UNSAFE.getInt(base, offset); @@ -292,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetIntRelease(base, offset, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = UNSAFE.getInt(base, offset); @@ -309,6 +329,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetInt(base, offset, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = UNSAFE.getInt(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java index f7ab52cb04e..cffec14ad72 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestLong { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestLong { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static long static_v; long v; @@ -258,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetLongPlain(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = UNSAFE.getLong(base, offset); @@ -275,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = UNSAFE.getLong(base, offset); @@ -292,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = UNSAFE.getLong(base, offset); @@ -309,6 +329,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = UNSAFE.getLong(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java index 04797707ff8..5daa5467aed 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestObject { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestObject { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static Object static_v; Object v; @@ -211,6 +228,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain Object"); Object x = UNSAFE.getObject(base, offset); @@ -228,6 +246,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire Object"); Object x = UNSAFE.getObject(base, offset); @@ -245,6 +264,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease Object"); Object x = UNSAFE.getObject(base, offset); @@ -262,6 +282,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet Object"); Object x = UNSAFE.getObject(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java index 5b3b006308b..770677a98d3 100644 --- a/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java +++ b/test/hotspot/jtreg/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java @@ -43,7 +43,14 @@ public class JdkInternalMiscUnsafeAccessTestShort { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final jdk.internal.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class JdkInternalMiscUnsafeAccessTestShort { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static short static_v; short v; @@ -258,6 +275,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetShortPlain(base, offset, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = UNSAFE.getShort(base, offset); @@ -275,6 +293,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetShortAcquire(base, offset, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = UNSAFE.getShort(base, offset); @@ -292,6 +311,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetShortRelease(base, offset, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = UNSAFE.getShort(base, offset); @@ -309,6 +329,7 @@ static void testAccess(Object base, long offset) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSetShort(base, offset, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = UNSAFE.getShort(base, offset); diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java index 6de29f5b39c..c176277d2ba 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestBoolean { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestBoolean { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static boolean static_v; boolean v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestByte.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestByte.java index 87aa8c66a57..b205b1d3376 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestByte.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestByte.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestByte { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestByte { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static byte static_v; byte v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestChar.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestChar.java index 8e10d4334e4..114ed7e9b5a 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestChar.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestChar.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestChar { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestChar { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static char static_v; char v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java index 878336db8a1..d813ea73e70 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestDouble { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestDouble { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static double static_v; double v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java index 616919f09f4..f0482c82637 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestFloat { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestFloat { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static float static_v; float v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestInt.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestInt.java index 05e9a467a89..9326539f4ef 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestInt.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestInt.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestInt { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestInt { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static int static_v; int v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestLong.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestLong.java index 38b0a83296a..30bc9551dd5 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestLong.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestLong.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestLong { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestLong { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static long static_v; long v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestObject.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestObject.java index 8782995957b..add15ff77fd 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestObject.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestObject.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestObject { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestObject { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static Object static_v; Object v; diff --git a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestShort.java b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestShort.java index c16761daaac..4ea81f026e7 100644 --- a/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestShort.java +++ b/test/hotspot/jtreg/compiler/unsafe/SunMiscUnsafeAccessTestShort.java @@ -43,7 +43,14 @@ public class SunMiscUnsafeAccessTestShort { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final sun.misc.Unsafe UNSAFE; @@ -86,6 +93,16 @@ public class SunMiscUnsafeAccessTestShort { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static short static_v; short v; diff --git a/test/hotspot/jtreg/compiler/unsafe/X-UnsafeAccessTest.java.template b/test/hotspot/jtreg/compiler/unsafe/X-UnsafeAccessTest.java.template index 8e1da7f63c8..3e74019635a 100644 --- a/test/hotspot/jtreg/compiler/unsafe/X-UnsafeAccessTest.java.template +++ b/test/hotspot/jtreg/compiler/unsafe/X-UnsafeAccessTest.java.template @@ -47,7 +47,14 @@ import static org.testng.Assert.*; public class $Qualifier$UnsafeAccessTest$Type$ { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); static final $package$.Unsafe UNSAFE; @@ -90,6 +97,16 @@ public class $Qualifier$UnsafeAccessTest$Type$ { ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale); } + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } + static $type$ static_v; $type$ v; @@ -302,6 +319,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSet$Type$Plain(base, offset, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = UNSAFE.get$Type$(base, offset); @@ -319,6 +337,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSet$Type$Acquire(base, offset, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = UNSAFE.get$Type$(base, offset); @@ -336,6 +355,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSet$Type$Release(base, offset, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = UNSAFE.get$Type$(base, offset); @@ -353,6 +373,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = UNSAFE.weakCompareAndSet$Type$(base, offset, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = UNSAFE.get$Type$(base, offset); diff --git a/test/hotspot/jtreg/gc/TestAgeOutput.java b/test/hotspot/jtreg/gc/TestAgeOutput.java index 6de4ec02b51..5189a5c5c79 100644 --- a/test/hotspot/jtreg/gc/TestAgeOutput.java +++ b/test/hotspot/jtreg/gc/TestAgeOutput.java @@ -66,12 +66,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import static jdk.test.lib.Asserts.*; - public class TestAgeOutput { public static void checkPattern(String pattern, String what) throws Exception { diff --git a/test/hotspot/jtreg/gc/TestCardTablePageCommits.java b/test/hotspot/jtreg/gc/TestCardTablePageCommits.java index f67daa8cce7..cf9769067ba 100644 --- a/test/hotspot/jtreg/gc/TestCardTablePageCommits.java +++ b/test/hotspot/jtreg/gc/TestCardTablePageCommits.java @@ -23,7 +23,6 @@ package gc; -import jdk.test.lib.JDKToolFinder; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; diff --git a/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java b/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java index ea646401bb9..33b32983f8b 100644 --- a/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java +++ b/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java @@ -24,7 +24,6 @@ package gc; import static jdk.test.lib.Asserts.*; -import gc.testlibrary.PerfCounter; import gc.testlibrary.PerfCounters; diff --git a/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java b/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java index 45a0546d6b0..61f8b32ddff 100644 --- a/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java +++ b/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java @@ -24,7 +24,6 @@ package gc; import java.util.List; -import java.util.ArrayList; import java.lang.management.*; import static jdk.test.lib.Asserts.*; import java.util.stream.*; diff --git a/test/hotspot/jtreg/gc/TestNumWorkerOutput.java b/test/hotspot/jtreg/gc/TestNumWorkerOutput.java index 7889319f6db..9842aad6dd6 100644 --- a/test/hotspot/jtreg/gc/TestNumWorkerOutput.java +++ b/test/hotspot/jtreg/gc/TestNumWorkerOutput.java @@ -54,12 +54,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import static jdk.test.lib.Asserts.*; - public class TestNumWorkerOutput { public static void checkPatternOnce(String pattern, String what) throws Exception { diff --git a/test/hotspot/jtreg/gc/TestObjectAlignment.java b/test/hotspot/jtreg/gc/TestObjectAlignment.java index f795236ef97..4760d0c9afa 100644 --- a/test/hotspot/jtreg/gc/TestObjectAlignment.java +++ b/test/hotspot/jtreg/gc/TestObjectAlignment.java @@ -44,9 +44,6 @@ * @run main/othervm gc.TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256 */ -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; - public class TestObjectAlignment { public static byte[] garbage; diff --git a/test/hotspot/jtreg/gc/TestPolicyNamePerfCounter.java b/test/hotspot/jtreg/gc/TestPolicyNamePerfCounter.java index 8dae167cd9b..1d2a602d672 100644 --- a/test/hotspot/jtreg/gc/TestPolicyNamePerfCounter.java +++ b/test/hotspot/jtreg/gc/TestPolicyNamePerfCounter.java @@ -24,7 +24,6 @@ package gc; import static jdk.test.lib.Asserts.*; -import gc.testlibrary.PerfCounter; import gc.testlibrary.PerfCounters; diff --git a/test/hotspot/jtreg/gc/arguments/AllocationHelper.java b/test/hotspot/jtreg/gc/arguments/AllocationHelper.java index 3a8f2360d5d..2ba79d017de 100644 --- a/test/hotspot/jtreg/gc/arguments/AllocationHelper.java +++ b/test/hotspot/jtreg/gc/arguments/AllocationHelper.java @@ -23,7 +23,6 @@ package gc.arguments; -import java.util.LinkedList; import java.util.concurrent.Callable; /** diff --git a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java index 226b938a3ce..4f0ec1cda3c 100644 --- a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java +++ b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java @@ -36,12 +36,9 @@ * @run driver gc.arguments.TestSelectDefaultGC */ -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import java.util.regex.*; - public class TestSelectDefaultGC { public static void assertVMOption(OutputAnalyzer output, String option, boolean value) { output.shouldMatch(" " + option + " .*=.* " + value + " "); diff --git a/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java b/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java index ce97139c407..1727bf688ce 100644 --- a/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java +++ b/test/hotspot/jtreg/gc/arguments/TestShrinkHeapInSteps.java @@ -37,7 +37,6 @@ import java.util.LinkedList; import java.util.Arrays; -import java.util.Collections; import jdk.test.lib.Utils; public class TestShrinkHeapInSteps { diff --git a/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java b/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java index d4ca56aa53d..8c58871d5d2 100644 --- a/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java +++ b/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java @@ -42,8 +42,6 @@ import jdk.test.lib.process.ProcessTools; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; -import java.util.ArrayList; -import java.util.Arrays; import sun.hotspot.WhiteBox; public class TestCMSClassUnloadingEnabledHWM { diff --git a/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java b/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java index b0f7a4bb204..4d96f45a39f 100644 --- a/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java +++ b/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java @@ -40,8 +40,6 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import java.util.ArrayList; -import java.util.Arrays; import sun.hotspot.WhiteBox; public class TestG1ClassUnloadingHWM { diff --git a/test/hotspot/jtreg/gc/concurrent_phase_control/CheckControl.java b/test/hotspot/jtreg/gc/concurrent_phase_control/CheckControl.java index 002f42405d7..51cc6ac792e 100644 --- a/test/hotspot/jtreg/gc/concurrent_phase_control/CheckControl.java +++ b/test/hotspot/jtreg/gc/concurrent_phase_control/CheckControl.java @@ -51,7 +51,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java b/test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java index e6223a3312e..a641fa13580 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java +++ b/test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java @@ -51,8 +51,6 @@ * gc.epsilon.TestArraycopyCheckcast */ -import java.util.Random; - public class TestArraycopyCheckcast { static int COUNT = Integer.getInteger("count", 1000); diff --git a/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java b/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java index eaeb98c7dac..a3c3af64cf6 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java +++ b/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java @@ -35,7 +35,6 @@ * gc.epsilon.TestEpsilonEnabled */ -import jdk.test.lib.Platform; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; diff --git a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java index 541d0fcee52..13bae9f4fd2 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java +++ b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java @@ -49,7 +49,6 @@ */ import java.lang.management.*; -import java.util.*; public class TestMemoryMXBeans { diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java index 98eeebc4495..0bd0bf4d5bb 100644 --- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java +++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java @@ -39,12 +39,8 @@ import sun.hotspot.WhiteBox; import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import jdk.test.lib.Asserts; -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java b/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java index b9dd97715f0..8c56a29175f 100644 --- a/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java +++ b/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java @@ -38,9 +38,6 @@ */ import java.lang.Math; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Asserts; diff --git a/test/hotspot/jtreg/gc/g1/TestPLABOutput.java b/test/hotspot/jtreg/gc/g1/TestPLABOutput.java index f6fd29fba96..48858a1865a 100644 --- a/test/hotspot/jtreg/gc/g1/TestPLABOutput.java +++ b/test/hotspot/jtreg/gc/g1/TestPLABOutput.java @@ -41,7 +41,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java index 80680ddc9d0..14b378444dd 100644 --- a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java +++ b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java @@ -27,13 +27,10 @@ * Common helpers for TestRemsetLogging* tests */ -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; import sun.hotspot.WhiteBox; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import java.lang.management.ManagementFactory; import java.util.ArrayList; import java.util.Arrays; diff --git a/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java b/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java index c52cd0a4f62..ac9db0afaa2 100644 --- a/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java +++ b/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java @@ -28,7 +28,6 @@ import jdk.test.lib.Utils; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.Utils; import jtreg.SkippedException; import java.io.IOException; @@ -37,7 +36,6 @@ import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; diff --git a/test/hotspot/jtreg/gc/g1/TestStringDeduplicationTools.java b/test/hotspot/jtreg/gc/g1/TestStringDeduplicationTools.java index 79a21e49d88..81b143ce3f7 100644 --- a/test/hotspot/jtreg/gc/g1/TestStringDeduplicationTools.java +++ b/test/hotspot/jtreg/gc/g1/TestStringDeduplicationTools.java @@ -27,9 +27,7 @@ * Common code for string deduplication tests */ -import java.lang.management.*; import java.lang.reflect.*; -import java.security.*; import java.util.*; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; diff --git a/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java b/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java index 04aab62169c..ca00d63ce5f 100644 --- a/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java +++ b/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java @@ -38,7 +38,6 @@ import java.util.Collections; import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; diff --git a/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java b/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java index de691a4c5c2..40b041d9a9c 100644 --- a/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java +++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java @@ -42,8 +42,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Collections; - import java.lang.management.*; // 8195115 says that for the "G1 Old Gen" MemoryPool, CollectionUsage.used diff --git a/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java b/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java index 3237c67635f..0c8588c895a 100644 --- a/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java +++ b/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java @@ -36,10 +36,8 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.List; import java.util.stream.Collectors; public class TestDeprecatedPrintFlags { diff --git a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java index 06b449cd1af..c47c589e87a 100644 --- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java +++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java @@ -37,8 +37,6 @@ import java.lang.ref.SoftReference; import java.math.BigDecimal; -import java.util.ArrayList; - import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import java.util.regex.Pattern; diff --git a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceMemoryPool.java b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceMemoryPool.java index 026f79af52c..2caf4f77a71 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceMemoryPool.java +++ b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceMemoryPool.java @@ -26,8 +26,6 @@ import java.util.List; import java.lang.management.*; import jdk.test.lib.Platform; -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; import static jdk.test.lib.Asserts.*; /* @test TestMetaspaceMemoryPool diff --git a/test/hotspot/jtreg/gc/metaspace/TestPerfCountersAndMemoryPools.java b/test/hotspot/jtreg/gc/metaspace/TestPerfCountersAndMemoryPools.java index d3d17c81701..1dd929afebd 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestPerfCountersAndMemoryPools.java +++ b/test/hotspot/jtreg/gc/metaspace/TestPerfCountersAndMemoryPools.java @@ -28,7 +28,6 @@ import jdk.test.lib.Platform; import static jdk.test.lib.Asserts.*; -import gc.testlibrary.PerfCounter; import gc.testlibrary.PerfCounters; /* @test TestPerfCountersAndMemoryPools diff --git a/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java b/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java index 16eb328d52f..2e7d9d15358 100644 --- a/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java +++ b/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package gc.stress; /* - * @test TestStressIHOPMultiThread + * @test * @bug 8148397 * @key stress * @summary Stress test for IHOP @@ -34,21 +34,41 @@ * -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread1.log * -Dtimeout=2 -DheapUsageMinBound=30 -DheapUsageMaxBound=80 * -Dthreads=2 gc.stress.TestStressIHOPMultiThread + */ + +/* + * @test + * @requires vm.gc.G1 * @run main/othervm/timeout=200 -Xmx256m -XX:G1HeapWastePercent=0 -XX:G1MixedGCCountTarget=1 * -XX:+UseG1GC -XX:G1HeapRegionSize=2m -XX:+G1UseAdaptiveIHOP * -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread2.log * -Dtimeout=2 -DheapUsageMinBound=60 -DheapUsageMaxBound=90 * -Dthreads=3 gc.stress.TestStressIHOPMultiThread + */ + +/* + * @test + * @requires vm.gc.G1 * @run main/othervm/timeout=200 -Xmx256m -XX:G1HeapWastePercent=0 -XX:G1MixedGCCountTarget=1 * -XX:+UseG1GC -XX:G1HeapRegionSize=4m -XX:-G1UseAdaptiveIHOP * -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread3.log * -Dtimeout=2 -DheapUsageMinBound=40 -DheapUsageMaxBound=90 * -Dthreads=5 gc.stress.TestStressIHOPMultiThread + */ + +/* + * @test + * @requires vm.gc.G1 * @run main/othervm/timeout=200 -Xmx128m -XX:G1HeapWastePercent=0 -XX:G1MixedGCCountTarget=1 * -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+G1UseAdaptiveIHOP * -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread4.log * -Dtimeout=2 -DheapUsageMinBound=20 -DheapUsageMaxBound=90 * -Dthreads=10 gc.stress.TestStressIHOPMultiThread + */ + +/* + * @test + * @requires vm.gc.G1 * @run main/othervm/timeout=200 -Xmx512m -XX:G1HeapWastePercent=0 -XX:G1MixedGCCountTarget=1 * -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:+G1UseAdaptiveIHOP * -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread5.log diff --git a/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java b/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java index 60aeb71cfe8..5d1b7315074 100644 --- a/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java +++ b/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java @@ -30,7 +30,6 @@ import java.lang.management.MemoryPoolMXBean; import java.lang.management.ManagementFactory; import java.lang.management.MemoryUsage; -import java.nio.ByteBuffer; import java.util.ArrayDeque; import java.util.HashMap; import java.util.List; diff --git a/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java b/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java index 9244b0f2482..8b89efb7940 100644 --- a/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java +++ b/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java @@ -26,7 +26,6 @@ // A test that stresses a full GC by allocating objects of different lifetimes // and concurrently calling System.gc(). -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; diff --git a/test/hotspot/jtreg/gc/whitebox/TestConcMarkCycleWB.java b/test/hotspot/jtreg/gc/whitebox/TestConcMarkCycleWB.java index d4b44784765..65ce2da9278 100644 --- a/test/hotspot/jtreg/gc/whitebox/TestConcMarkCycleWB.java +++ b/test/hotspot/jtreg/gc/whitebox/TestConcMarkCycleWB.java @@ -38,7 +38,6 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC gc.whitebox.TestConcMarkCycleWB * @summary Verifies that ConcurrentMarking-related WB works properly */ -import static jdk.test.lib.Asserts.assertFalse; import static jdk.test.lib.Asserts.assertTrue; import sun.hotspot.WhiteBox; diff --git a/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c b/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c index c8b9c9a999e..4087e874c93 100644 --- a/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c +++ b/test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,6 +85,13 @@ static void * thread_start(void* unused) { (*env)->ExceptionDescribe(env); exit(1); } + + res = (*jvm)->DetachCurrentThread(jvm); + if (res != JNI_OK) { + fprintf(stderr, "Test ERROR. Can't detach current thread: %d\n", res); + exit(1); + } + printf("Native thread terminating\n"); return NULL; diff --git a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java index 717c0e98a15..fdd0d044d2d 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java @@ -88,6 +88,9 @@ static boolean useDefaultUlimit() { static void test(String type) throws Throwable { ProcessBuilder pb = ProcessTools.createTestJvm("-XX:+CreateCoredumpOnCrash", "-Xmx512m", "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError", "-XX:-TransmitErrorReport", + // The test loads lots of small classes to exhaust Metaspace, skip method + // dependency verification to improve performance in debug builds. + Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "--show-version", TestJmapCore.class.getName(), type); boolean useDefaultUlimit = useDefaultUlimit(); diff --git a/test/hotspot/jtreg/serviceability/sa/TestUniverse.java b/test/hotspot/jtreg/serviceability/sa/TestUniverse.java index d925cdcbce5..5bb818be6df 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestUniverse.java +++ b/test/hotspot/jtreg/serviceability/sa/TestUniverse.java @@ -29,99 +29,107 @@ import java.util.HashMap; import jdk.test.lib.apps.LingeredApp; import jtreg.SkippedException; +import sun.hotspot.gc.GC; /** * @test * @summary Test the 'universe' command of jhsdb clhsdb. - * @requires vm.hasSA & vm.gc != "Z" + * @requires vm.hasSA * @bug 8190307 * @library /test/lib * @build jdk.test.lib.apps.* * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withoutZ - */ - -/** - * @test - * @summary Test the 'universe' command of jhsdb clhsdb. - * @requires vm.hasSA & vm.gc == "Z" - * @bug 8190307 - * @library /test/lib - * @build jdk.test.lib.apps.* - * @build sun.hotspot.WhiteBox - * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withZ + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse */ public class TestUniverse { - private static void testClhsdbForUniverse(long lingeredAppPid, - String gc) throws Exception { - + private static void testClhsdbForUniverse(long lingeredAppPid, GC gc) throws Exception { ClhsdbLauncher launcher = new ClhsdbLauncher(); List cmds = List.of("universe"); Map> expStrMap = new HashMap<>(); List expStrings = new ArrayList(); expStrings.add("Heap Parameters"); - if (gc.contains("UseZGC")) { - expStrings.add("ZHeap"); - } - if (gc.contains("G1GC")) { - expStrings.add("garbage-first heap"); - expStrings.add("region size"); - expStrings.add("G1 Young Generation:"); - expStrings.add("regions ="); - } - if (gc.contains("UseConcMarkSweepGC")) { - expStrings.add("Gen 1: concurrent mark-sweep generation"); - } - if (gc.contains("UseSerialGC")) { + switch (gc) { + case Serial: expStrings.add("Gen 1: old"); - } - if (gc.contains("UseParallelGC")) { + break; + + case Parallel: expStrings.add("ParallelScavengeHeap"); expStrings.add("PSYoungGen"); expStrings.add("eden"); - } - if (gc.contains("UseEpsilonGC")) { + break; + + case ConcMarkSweep: + expStrings.add("Gen 1: concurrent mark-sweep generation"); + break; + + case G1: + expStrings.add("garbage-first heap"); + expStrings.add("region size"); + expStrings.add("G1 Young Generation:"); + expStrings.add("regions ="); + break; + + case Epsilon: expStrings.add("Epsilon heap"); expStrings.add("reserved"); expStrings.add("committed"); expStrings.add("used"); + break; + + case Z: + expStrings.add("ZHeap"); + break; + + case Shenandoah: + expStrings.add("Shenandoah heap"); + break; } + expStrMap.put("universe", expStrings); launcher.run(lingeredAppPid, cmds, expStrMap, null); } - public static void test(String gc) throws Exception { + private static void test(GC gc) throws Exception { LingeredApp app = null; try { - List vmArgs = new ArrayList(); - vmArgs.add("-XX:+UnlockExperimentalVMOptions"); // unlock experimental GCs - vmArgs.add(gc); - app = LingeredApp.startApp(vmArgs); - System.out.println ("Started LingeredApp with the GC option " + gc + - " and pid " + app.getPid()); + app = LingeredApp.startApp(List.of("-XX:+UnlockExperimentalVMOptions", "-XX:+Use" + gc + "GC")); + System.out.println ("Started LingeredApp with " + gc + "GC and pid " + app.getPid()); testClhsdbForUniverse(app.getPid(), gc); } finally { LingeredApp.stopApp(app); } } + private static boolean isSelectedAndSupported(GC gc) { + if (!gc.isSelected()) { + // Not selected + return false; + } + + if (Compiler.isGraalEnabled()) { + if (gc == GC.ConcMarkSweep || gc == GC.Epsilon || gc == GC.Z || gc == GC.Shenandoah) { + // Not supported + System.out.println ("Skipped testing of " + gc + "GC, not supported by Graal"); + return false; + } + } + + // Selected and supported + return true; + } + public static void main (String... args) throws Exception { - System.out.println("Starting TestUniverse test"); + System.out.println("Starting TestUniverse"); try { - test("-XX:+UseG1GC"); - test("-XX:+UseParallelGC"); - test("-XX:+UseSerialGC"); - if (!Compiler.isGraalEnabled()) { // Graal does not support all GCs - test("-XX:+UseConcMarkSweepGC"); - if (args[0].equals("withZ")) { - test("-XX:+UseZGC"); + for (GC gc: GC.values()) { + if (isSelectedAndSupported(gc)) { + test(gc); } - test("-XX:+UseEpsilonGC"); } } catch (SkippedException se) { throw se; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java index 45cad0aaef4..1a6697271c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java @@ -50,9 +50,9 @@ * To check up on the method, a debugger, * upon getting new set for ClassPrepareEvent, * suspends VM with the method VirtualMachine.suspend(), - * gets the List of geduggee's threads calling VM.allThreads(), + * gets the List of debuggee's threads calling VM.allThreads(), * invokes the method EventSet.resume(), and - * gets another List of geduggee's threads. + * gets another List of debuggee's threads. * The debugger then compares values of * each thread's suspendCount from first and second Lists. * @@ -63,6 +63,13 @@ * making special clases loaded and prepared to create the Events * - Upon getting the Events, * the debugger performs the check required. + * - The debugger informs the debuggee when it completes + * each test case, so it will wait before hitting + * communication breakpoints. + * This prevents the breakpoint SUSPEND_ALL policy + * disrupting the first test case check for + * SUSPEND_NONE, if the debuggee gets ahead of + * the debugger processing. */ public class resume001 extends TestDebuggerType1 { @@ -233,6 +240,7 @@ protected void testRun() { default: throw new Failure("** default case 1 **"); } + informDebuggeeTestCase(i); } display("......--> vm.resume()"); @@ -261,5 +269,22 @@ private ClassPrepareRequest settingClassPrepareRequest ( String testedClass, throw new Failure("** FAILURE to set up ClassPrepareRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java index da96c913ec3..f0b118a4034 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java @@ -33,7 +33,7 @@ public class resume001a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -57,6 +57,7 @@ private static void logErr(String message) { static int exitCode = PASSED; + static int testCase = -1; static int instruction = 1; static int end = 0; // static int quit = 0; @@ -100,6 +101,10 @@ public static void main (String argv[]) { case 0: TestClass2 obj2 = new TestClass2(); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); + break; case 1: @@ -119,6 +124,16 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class TestClass2 { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java index fe456247eca..808c6a0c8c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume002 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume002 ", sHeader2 = "--> debugger: ", @@ -503,6 +503,7 @@ private void testRun() log2("......--> vm.resume()"); vm.resume(); + informDebuggeeTestCase(i); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } log1(" TESTING ENDS"); @@ -642,5 +643,22 @@ private AccessWatchpointRequest settingAccessWatchpointRequest ( throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java index fe219b453a7..b2d06cc2f3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java @@ -33,7 +33,7 @@ public class resume002a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -41,6 +41,7 @@ public class resume002a { static ArgumentHandler argHandler; static Log log; + static int testCase = -1; //-------------------------------------------------- log procedures @@ -98,8 +99,12 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume002aTestClass.method(); - break; + case 0: + resume002aTestClass.method(); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); + break; case 1: resume002aTestClass.method(); break; @@ -118,6 +123,17 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } + } class resume002aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java index 0b985421c6f..45e470f5359 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume003 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume003 ", sHeader2 = "--> debugger: ", @@ -503,6 +503,8 @@ private void testRun() log2("......--> vm.resume()"); vm.resume(); + informDebuggeeTestCase(i); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } log1(" TESTING ENDS"); @@ -642,5 +644,22 @@ private ModificationWatchpointRequest settingModificationWatchpointRequest ( throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java index 2bb0df34fc1..11b0f07dd41 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java @@ -33,7 +33,8 @@ public class resume003a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section + static int testCase = -1; static final int PASSED = 0; static final int FAILED = 2; @@ -98,8 +99,12 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume003aTestClass.method(); - break; + case 0: + resume003aTestClass.method(); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); + break; case 1: resume003aTestClass.method(); break; @@ -118,6 +123,16 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume003aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java index 3f185107ea7..4ebfb3ff30f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume004 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume004 ", sHeader2 = "--> debugger: ", @@ -493,6 +493,7 @@ private void testRun() default: throw new JDITestRuntimeException("** default case 1 **"); } + informDebuggeeTestCase(i); } log2("......--> vm.resume()"); @@ -638,5 +639,22 @@ private BreakpointRequest settingBreakpointRequest ( ThreadReference thread, throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java index 56712b489b7..bb32b5bf6ed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java @@ -33,7 +33,8 @@ public class resume004a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section + static int testCase = -1; static final int PASSED = 0; static final int FAILED = 2; @@ -98,8 +99,10 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume004aTestClass.method(); - break; + case 0: + resume004aTestClass.method(); + waitForTestCase(0); + break; case 1: resume004aTestClass.method(); break; @@ -118,6 +121,16 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume004aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java index 0705c3929ae..11b0ab2561b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume005 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume005 ", sHeader2 = "--> debugger: ", @@ -493,6 +493,7 @@ private void testRun() default: throw new JDITestRuntimeException("** default case 1 **"); } + informDebuggeeTestCase(i); } log2("......--> vm.resume()"); @@ -634,5 +635,22 @@ private ExceptionRequest settingExceptionRequest ( ThreadReference thread, throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java index bdd8b54d1b7..37a0b213bf7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java @@ -33,7 +33,8 @@ public class resume005a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section + static int testCase = -1; static final int PASSED = 0; static final int FAILED = 2; @@ -98,8 +99,10 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume005aTestClass.method(); - break; + case 0: + resume005aTestClass.method(); + waitForTestCase(0); + break; case 1: resume005aTestClass.method(); break; @@ -122,7 +125,16 @@ public static void main (String argv[]) { public static void nullMethod() { throw new NullPointerException("test"); } - + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume005aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java index ba2b22abaa0..50df1acfedb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume006 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume006 ", sHeader2 = "--> debugger: ", @@ -495,6 +495,7 @@ private void testRun() log2("......--> vm.resume()"); vm.resume(); + informDebuggeeTestCase(i); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } log1(" TESTING ENDS"); @@ -632,5 +633,22 @@ private MethodEntryRequest settingMethodEntryRequest ( ThreadReference thread, throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java index ab7677e13fc..3b2332bb8a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java @@ -33,7 +33,7 @@ public class resume006a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -41,6 +41,7 @@ public class resume006a { static ArgumentHandler argHandler; static Log log; + static int testCase = -1; //-------------------------------------------------- log procedures @@ -98,8 +99,12 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume006aTestClass.method(); - break; + case 0: + resume006aTestClass.method(); + // Wait for debugger to complete the first test case + // before advancing to the next breakpoint + waitForTestCase(0); + break; case 1: resume006aTestClass.method(); break; @@ -118,7 +123,16 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } - + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume006aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java index ced07a24a09..cc0a3e4b256 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume007 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = Consts.TEST_PASSED; static final int FAILED = Consts.TEST_FAILED; static final int PASS_BASE = Consts.JCK_STATUS_BASE; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ", sHeader2 = "--> debugger: ", @@ -490,6 +490,7 @@ private void testRun() default: throw new JDITestRuntimeException("** default case 1 **"); } + informDebuggeeTestCase(i); } log2("......--> vm.resume()"); @@ -631,5 +632,22 @@ private MethodExitRequest settingMethodExitRequest ( ThreadReference thread, throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java index a70a4e80246..912a97aa4aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java @@ -33,7 +33,8 @@ public class resume007a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section + static int testCase = -1; static final int PASSED = 0; static final int FAILED = 2; @@ -98,8 +99,10 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume007aTestClass.method(); - break; + case 0: + resume007aTestClass.method(); + waitForTestCase(0); + break; case 1: resume007aTestClass.method(); break; @@ -118,7 +121,16 @@ public static void main (String argv[]) { log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } - + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume007aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java index c011dcd7974..a745f0e40f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java @@ -50,9 +50,9 @@ * To check up on the method, a debugger, * upon getting new set for the EventSet, * suspends VM with the method VirtualMachine.suspend(), - * gets the List of geduggee's threads calling VM.allThreads(), + * gets the List of debuggee's threads calling VM.allThreads(), * invokes the method EventSet.resume(), and - * gets another List of geduggee's threads. + * gets another List of debuggee's threads. * The debugger then compares values of * each thread's suspendCount from first and second Lists. * @@ -63,6 +63,13 @@ * to be resulting in the event. * - Upon getting new event, the debugger * performs the check corresponding to the event. + * - The debugger informs the debuggee when it completes + * each test case, so it will wait before hitting + * communication breakpoints. + * This prevents the breakpoint SUSPEND_ALL policy + * disrupting the first test case check for + * SUSPEND_NONE, if the debuggee gets ahead of + * the debugger processing. */ public class resume008 extends TestDebuggerType1 { @@ -124,7 +131,9 @@ protected void testRun() { } display("......waiting for new ThreadStartEvent : " + i); - EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true); + EventSet eventSet = eventHandler + .waitForRequestedEventSet(new EventRequest[]{eventRequest}, + waitTime, true); EventIterator eventIterator = eventSet.eventIterator(); Event newEvent = eventIterator.nextEvent(); @@ -134,7 +143,8 @@ protected void testRun() { } else { String property = (String) newEvent.request().getProperty("number"); - display(" got new ThreadStartEvent with propety 'number' == " + property); + display(" got new ThreadStartEvent with propety 'number' == " + + property); display("......checking up on EventSet.resume()"); display("......--> vm.suspend();"); @@ -144,7 +154,8 @@ protected void testRun() { Map suspendsCounts1 = new HashMap(); for (ThreadReference threadReference : vm.allThreads()) { - suspendsCounts1.put(threadReference.name(), threadReference.suspendCount()); + suspendsCounts1.put(threadReference.name(), + threadReference.suspendCount()); } display(suspendsCounts1.toString()); @@ -154,7 +165,8 @@ protected void testRun() { display(" getting : Map suspendsCounts2"); Map suspendsCounts2 = new HashMap(); for (ThreadReference threadReference : vm.allThreads()) { - suspendsCounts2.put(threadReference.name(), threadReference.suspendCount()); + suspendsCounts2.put(threadReference.name(), + threadReference.suspendCount()); } display(suspendsCounts2.toString()); @@ -163,85 +175,90 @@ protected void testRun() { switch (policy) { - case SUSPEND_NONE : - display(" case SUSPEND_NONE"); - for (String threadName : suspendsCounts1.keySet()) { - display(" checking " + threadName); - if (!suspendsCounts2.containsKey(threadName)) { - complain("ERROR: couldn't get ThreadReference for " + threadName); - testExitCode = TEST_FAILED; - break; - } - int count1 = suspendsCounts1.get(threadName); - int count2 = suspendsCounts2.get(threadName); - if (count1 != count2) { - complain("ERROR: suspendCounts don't match for : " + threadName); - complain("before resuming : " + count1); - complain("after resuming : " + count2); - testExitCode = TEST_FAILED; - break; - } - } - break; - - case SUSPEND_THREAD : - display(" case SUSPEND_THREAD"); - for (String threadName : suspendsCounts1.keySet()) { - display("checking " + threadName); - if (!suspendsCounts2.containsKey(threadName)) { - complain("ERROR: couldn't get ThreadReference for " + threadName); - testExitCode = TEST_FAILED; - break; - } - int count1 = suspendsCounts1.get(threadName); - int count2 = suspendsCounts2.get(threadName); - String eventThreadName = ((ThreadStartEvent)newEvent).thread().name(); - int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0); - if (count1 != expectedValue) { - complain("ERROR: suspendCounts don't match for : " + threadName); - complain("before resuming : " + count1); - complain("after resuming : " + count2); - testExitCode = TEST_FAILED; - break; - } - } - break; - - case SUSPEND_ALL : - - display(" case SUSPEND_ALL"); - for (String threadName : suspendsCounts1.keySet()) { - display("checking " + threadName); - - if (!newEvent.request().equals(eventRequest)) - break; - if (!suspendsCounts2.containsKey(threadName)) { - complain("ERROR: couldn't get ThreadReference for " + threadName); - testExitCode = TEST_FAILED; - break; - } - int count1 = suspendsCounts1.get(threadName); - int count2 = suspendsCounts2.get(threadName); - if (count1 != count2 + 1) { - complain("ERROR: suspendCounts don't match for : " + threadName); - complain("before resuming : " + count1); - complain("after resuming : " + count2); - testExitCode = TEST_FAILED; - break; - } + case SUSPEND_NONE : + display(" case SUSPEND_NONE"); + for (String threadName : suspendsCounts1.keySet()) { + display(" checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + + threadName); + testExitCode = TEST_FAILED; + break; } - break; - - default: throw new Failure("** default case 1 **"); + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2) { + complain("ERROR: suspendCounts don't match for : " + + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_THREAD : + display(" case SUSPEND_THREAD"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + String eventThreadName = ((ThreadStartEvent)newEvent) + .thread().name(); + int expectedValue = count2 + + (eventThreadName.equals(threadName) ? 1 : 0); + if (count1 != expectedValue) { + complain("ERROR: suspendCounts don't match for : " + + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + + case SUSPEND_ALL : + display(" case SUSPEND_ALL"); + for (String threadName : suspendsCounts1.keySet()) { + display("checking " + threadName); + if (!newEvent.request().equals(eventRequest)) + break; + if (!suspendsCounts2.containsKey(threadName)) { + complain("ERROR: couldn't get ThreadReference for " + + threadName); + testExitCode = TEST_FAILED; + break; + } + int count1 = suspendsCounts1.get(threadName); + int count2 = suspendsCounts2.get(threadName); + if (count1 != count2 + 1) { + complain("ERROR: suspendCounts don't match for : " + + threadName); + complain("before resuming : " + count1); + complain("after resuming : " + count2); + testExitCode = TEST_FAILED; + break; + } + } + break; + default: throw new Failure("** default case 1 **"); } - } + informDebuggeeTestCase(i); + } display("......--> vm.resume()"); vm.resume(); } return; } - private ThreadStartRequest settingThreadStartRequest(int suspendPolicy, String property) { try { @@ -254,5 +271,22 @@ private ThreadStartRequest settingThreadStartRequest(int suspendPolicy, throw new Failure("** FAILURE to set up ThreadStartRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java index 8f0790dfef7..fb3c6ca6df0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java @@ -33,7 +33,7 @@ public class resume008a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -62,6 +62,7 @@ private static void logErr(String message) { static int exitCode = PASSED; + static int testCase = -1; static int instruction = 1; static int end = 0; // static int quit = 0; @@ -70,6 +71,7 @@ private static void logErr(String message) { static int lineForComm = 2; + // Debugger sets a breakpoint here to track debuggee private static void methodForCommunication() { int i1 = instruction; int i2 = i1; @@ -85,47 +87,38 @@ public static void main (String argv[]) { log1("debuggee started!"); label0: - for (int i = 0; ; i++) { - - if (instruction > maxInstr) { - logErr("ERROR: unexpected instruction: " + instruction); - exitCode = FAILED; - break ; - } - - switch (i) { - + for (int i = 0; ; i++) { + if (instruction > maxInstr) { + logErr("ERROR: unexpected instruction: " + instruction); + exitCode = FAILED; + break ; + } + switch (i) { //------------------------------------------------------ section tested - - case 0: - thread0 = new Threadresume008a("thread0"); - methodForCommunication(); - - threadStart(thread0); - - thread1 = new Threadresume008a("thread1"); - methodForCommunication(); - break; - - case 1: - threadStart(thread1); - - thread2 = new Threadresume008a("thread2"); - methodForCommunication(); - break; - - case 2: - threadStart(thread2); - - //------------------------------------------------- standard end section - - default: - instruction = end; - methodForCommunication(); - break label0; - } + case 0: + thread0 = new Threadresume008a("thread0"); + methodForCommunication(); + threadStart(thread0); + thread1 = new Threadresume008a("thread1"); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); + methodForCommunication(); + break; + case 1: + threadStart(thread1); + thread2 = new Threadresume008a("thread2"); + methodForCommunication(); + break; + case 2: + threadStart(thread2); + //------------------------------------------------- standard end section + default: + instruction = end; + methodForCommunication(); + break label0; } - + } log1("debuggee exits"); System.exit(exitCode + PASS_BASE); } @@ -145,24 +138,29 @@ static int threadStart(Thread t) { } return PASSED; } - + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } static class Threadresume008a extends Thread { - String tName = null; - public Threadresume008a(String threadName) { super(threadName); tName = threadName; } - public void run() { log1(" 'run': enter :: threadName == " + tName); synchronized (waitnotifyObj) { - waitnotifyObj.notify(); + waitnotifyObj.notify(); } log1(" 'run': exit :: threadName == " + tName); return; } } - } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java index 5fbee4c1a35..5ab5c979474 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java @@ -50,9 +50,9 @@ * To check up on the method, a debugger, * upon getting new set for the EventSet, * suspends VM with the method VirtualMachine.suspend(), - * gets the List of geduggee's threads calling VM.allThreads(), + * gets the List of debuggee's threads calling VM.allThreads(), * invokes the method EventSet.resume(), and - * gets another List of geduggee's threads. + * gets another List of debuggee's threads. * The debugger then compares values of * each thread's suspendCount from first and second Lists. * @@ -63,6 +63,13 @@ * to be resulting in the event. * - Upon getting new event, the debugger * performs the check corresponding to the event. + * - The debugger informs the debuggee when it completes + * each test case, so it will wait before hitting + * communication breakpoints. + * This prevents the breakpoint SUSPEND_ALL policy + * disrupting the first test case check for + * SUSPEND_NONE, if the debuggee gets ahead of + * the debugger processing. */ public class resume009 extends TestDebuggerType1 { @@ -233,6 +240,7 @@ protected void testRun() { default: throw new Failure("** default case 1 **"); } + informDebuggeeTestCase(i); } display("......--> vm.resume()"); @@ -253,5 +261,22 @@ private ThreadDeathRequest settingThreadDeathRequest(int suspendPolicy, throw new Failure("** FAILURE to set up ThreadDeathRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java index 8b93e8a079f..4fbf8d0d2f5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java @@ -33,7 +33,7 @@ public class resume009a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -62,6 +62,7 @@ private static void logErr(String message) { static int exitCode = PASSED; + static int testCase = -1; static int instruction = 1; static int end = 0; // static int quit = 0; @@ -104,6 +105,9 @@ public static void main (String argv[]) { threadRun(thread0); thread1 = new Threadresume009a("thread1"); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); methodForCommunication(); break; @@ -152,6 +156,16 @@ static int threadRun(Thread t) { } return PASSED; } + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } static class Threadresume009a extends Thread { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java index 5940e5e9a4e..8e6aa77a4e5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java @@ -48,9 +48,9 @@ * To check up on the method, a debugger,
* upon getting new set for the EventSet,
* suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
* invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
* The debugger then compares values of
* each thread's suspendCount from first and second Lists.
*
@@ -87,12 +87,12 @@ public class resume010 { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; static final int PASS_BASE = 95; - //----------------------------------------------------- templete parameters + //----------------------------------------------------- template parameters static final String sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume010 ", sHeader2 = "--> debugger: ", @@ -488,6 +488,7 @@ private void testRun() default: throw new JDITestRuntimeException("** default case 1 **"); } + informDebuggeeTestCase(i); } log2("......--> vm.resume()"); @@ -627,5 +628,22 @@ private StepRequest settingStepRequest ( ThreadReference thread, throw new JDITestRuntimeException("** FAILURE to set up StepRequest **"); } } - + /** + * Inform debuggee which thread test the debugger has completed. + * Used for synchronization, so the debuggee does not move too quickly. + * @param testCase index of just completed test + */ + void informDebuggeeTestCase(int testCase) { + try { + ((ClassType)debuggeeClass) + .setValue(debuggeeClass.fieldByName("testCase"), + vm.mirrorOf(testCase)); + } catch (InvalidTypeException ite) { + throw new Failure("** FAILURE setting testCase **"); + } catch (ClassNotLoadedException cnle) { + throw new Failure("** FAILURE notifying debuggee **"); + } catch (VMDisconnectedException e) { + throw new Failure("** FAILURE debuggee connection **"); + } + } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java index d3a6a084fee..1e59c76fa49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java @@ -33,7 +33,7 @@ public class resume010a { - //----------------------------------------------------- templete section + //----------------------------------------------------- template section static final int PASSED = 0; static final int FAILED = 2; @@ -60,6 +60,7 @@ private static void logErr(String message) { static int exitCode = PASSED; + static int testCase = -1; static int instruction = 1; static int end = 0; // static int quit = 0; @@ -98,8 +99,12 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested - case 0: resume010aTestClass.method(); - break; + case 0: + resume010aTestClass.method(); + // Wait for debugger to complete the first test case + // before advancing to the first breakpoint + waitForTestCase(0); + break; case 1: resume010aTestClass.method(); break; @@ -117,7 +122,16 @@ public static void main (String argv[]) { System.exit(exitCode + PASS_BASE); } - + // Synchronize with debugger progression. + static void waitForTestCase(int t) { + while (testCase < t) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignored + } + } + } } class resume010aTestClass { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/numeric/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/stress/numeric/TEST.properties deleted file mode 100644 index 8b51b2a9115..00000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/numeric/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java index bd2fb7957a1..56e2b590570 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java @@ -24,6 +24,7 @@ /* * @test + * @key stress * * @summary converted from VM Testbase vm/mlvm/meth/stress/compiler/deoptimize. * VM Testbase keywords: [feature_mlvm, nonconcurrent, quarantine] diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index df9002b1a43..c6c5fe24606 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -128,7 +128,6 @@ java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java 8164464 linux-all,macosx-all java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510 macosx-all -javax/swing/dnd/7171812/bug7171812.java 8041447 macosx-all java/awt/Focus/ChoiceFocus/ChoiceFocus.java 8169103 windows-all,macosx-all java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java 8198618 macosx-all java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest/ConsumeNextKeyTypedOnModalShowTest.java 6986252 macosx-all @@ -170,7 +169,6 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java 8129778 generic-all java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java 8129778 generic-all -java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java 8252713 linux-all java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java 8129778 generic-all java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java 8194947 generic-all @@ -372,7 +370,6 @@ java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java 8198665 macosx-all java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java 8198665 macosx-all java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java 8198665 macosx-all java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java 8177326 macosx-all -java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Standard.java 7124407 macosx-all @@ -441,6 +438,7 @@ java/awt/Modal/OnTop/OnTopTKModal6Test.java 8198666 macosx-all java/awt/List/SingleModeDeselect/SingleModeDeselect.java 8196367 windows-all java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java 8061235 macosx-all javax/print/PrintSEUmlauts/PrintSEUmlauts.java 8135174 generic-all +java/awt/font/Rotate/RotatedTextTest.java 8219641 linux-all java/awt/font/TextLayout/LigatureCaretTest.java 8197821 generic-all java/awt/Graphics2D/DrawString/RotTransText.java 8197797 generic-all java/awt/image/VolatileImage/CustomCompositeTest.java 8199002 windows-all,linux-all @@ -464,7 +462,7 @@ java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676 linux-all java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersInKeyEvent.java 8157147 linux-all,solaris-all,windows-all,macosx-all java/awt/Mouse/TitleBarDoubleClick/TitleBarDoubleClick.java 8148041 linux-all java/awt/Toolkit/DesktopProperties/rfe4758438.java 8193547 linux-all -java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java 6847163 +java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java 6847163 linux-all java/awt/xembed/server/RunTestXEmbed.java 7034201 linux-all java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java 8164473 linux-all java/awt/im/memoryleak/InputContextMemoryLeakTest.java 8023814 linux-all,solaris-all @@ -484,7 +482,7 @@ java/awt/TrayIcon/RightClickWhenBalloonDisplayed/RightClickWhenBalloonDisplayed. java/awt/PopupMenu/PopupMenuLocation.java 8238720 windows-all java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java 8238720 windows-all java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java 8238720 windows-all -java/awt/event/MouseEvent/FrameMouseEventAbsoluteCoordsTest/FrameMouseEventAbsoluteCoordsTest.java +java/awt/event/MouseEvent/FrameMouseEventAbsoluteCoordsTest/FrameMouseEventAbsoluteCoordsTest.java 8238720 windows-all # Several tests which fail sometimes on macos11 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64 @@ -590,6 +588,7 @@ java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGr java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java 8170562 generic-all java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all +java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all java/nio/channels/DatagramChannel/ManySourcesAndTargets.java 8264385 macosx-aarch64 @@ -686,7 +685,6 @@ javax/swing/JWindow/ShapedAndTranslucentWindows/SetShapeAndClickSwing.java 80134 javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 8024627 macosx-all # The next test below is an intermittent failure javax/swing/JComboBox/8033069/bug8033069ScrollBar.java 8163367 generic-all -javax/swing/JColorChooser/Test6827032.java 8197825 windows-all javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all @@ -823,7 +821,6 @@ javax/swing/SwingUtilities/TestTextPosInPrint.java 8227025 windows-all java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all java/awt/print/bug8023392/bug8023392.html 8231231 generic-all java/awt/font/TextLayout/TestJustification.html 8250791 macosx-all -javax/swing/JTabbedPane/4209065/bug4209065.java 8251177 macosx-all java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html 7187728 macosx-all,linux-all diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 4073eec2012..c5327e56195 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -376,6 +376,8 @@ jdk_sound = \ jdk_imageio = \ javax/imageio +jdk_accessibility = + jfc_demo = \ demo/jfc @@ -383,14 +385,33 @@ jdk_editpad = \ jdk/editpad jdk_desktop = \ - :jdk_awt \ - :jdk_2d \ - :jdk_beans \ + :jdk_desktop_part1 \ + :jdk_desktop_part2 \ + :jdk_desktop_part3 + +jdk_desktop_part1 = \ + :jdk_client_sanity \ :jdk_swing \ + :jdk_2d \ :jdk_sound \ :jdk_imageio \ + :jdk_editpad \ :jfc_demo \ - :jdk_editpad + :jdk_accessibility \ + :jdk_beans + +jdk_desktop_part2 = \ + :jdk_awt \ + -java/awt/Component \ + -java/awt/Modal \ + -java/awt/datatransfer \ + -java/awt/Window + +jdk_desktop_part3 = \ + java/awt/Component \ + java/awt/Modal \ + java/awt/datatransfer \ + java/awt/Window # SwingSet3 tests. jdk_client_sanity = \ diff --git a/test/jdk/com/sun/jdi/JdbOptions.java b/test/jdk/com/sun/jdi/JdbOptions.java index b6fb965e319..114aa3ddd50 100644 --- a/test/jdk/com/sun/jdi/JdbOptions.java +++ b/test/jdk/com/sun/jdi/JdbOptions.java @@ -34,9 +34,17 @@ import lib.jdb.JdbCommand; import jdk.test.lib.process.OutputAnalyzer; +import java.io.IOException; +import java.io.PrintStream; import java.lang.management.ManagementFactory; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Arrays; import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; class JbdOptionsTarg { static final String OK_MSG = "JbdOptionsTarg: OK"; @@ -49,47 +57,62 @@ static String propString(String name, String value) { return "prop[" + name + "] = >" + value + "<"; } - public static void main(String[] args) { - System.out.println(OK_MSG); - // print all args - List vmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments(); - for (String s: vmArgs) { - System.out.println(argString(s)); - } - // print requested sys.props - for (String p: args) { - System.out.println(propString(p, System.getProperty(p))); + /** + * 1st argument is a filename to redirect application output, + * the rest are names of the properties to dump. + */ + public static void main(String[] args) throws IOException { + String outFile = args[0]; + try (PrintStream out = new PrintStream(outFile, StandardCharsets.UTF_8)) { + out.println(OK_MSG); + // print all args + List vmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments(); + for (String s : vmArgs) { + out.println(argString(s)); + } + // print requested sys.props (skip 1st arg which is output filename) + for (int i=1; i < args.length; i++) { + String p = args[i]; + out.println(propString(p, System.getProperty(p))); + } } } } public class JdbOptions { + private static final String outFilename = UUID.randomUUID().toString() + ".out"; + private static final Path outPath = Paths.get(outFilename); private static final String targ = JbdOptionsTarg.class.getName(); public static void main(String[] args) throws Exception { // the simplest case test("-connect", - "com.sun.jdi.CommandLineLaunch:vmexec=java,options=-client -XX:+PrintVMOptions,main=" + targ) + "com.sun.jdi.CommandLineLaunch:vmexec=java,options=-client -XX:+PrintVMOptions" + + ",main=" + targ + " " + outFilename) .expectedArg("-XX:+PrintVMOptions"); // pass property through 'options' test("-connect", - "com.sun.jdi.CommandLineLaunch:vmexec=java,options='-Dboo=foo',main=" + targ + " boo") + "com.sun.jdi.CommandLineLaunch:vmexec=java,options='-Dboo=foo'" + + ",main=" + targ + " " + outFilename + " boo") .expectedProp("boo", "foo"); // property with spaces test("-connect", - "com.sun.jdi.CommandLineLaunch:vmexec=java,options=\"-Dboo=foo 2\",main=" + targ + " boo") + "com.sun.jdi.CommandLineLaunch:vmexec=java,options=\"-Dboo=foo 2\"" + + ",main=" + targ + " " + outFilename + " boo") .expectedProp("boo", "foo 2"); // property with spaces (with single quotes) test("-connect", - "com.sun.jdi.CommandLineLaunch:vmexec=java,options='-Dboo=foo 2',main=" + targ + " boo") + "com.sun.jdi.CommandLineLaunch:vmexec=java,options='-Dboo=foo 2'" + + ",main=" + targ + " " + outFilename + " boo") .expectedProp("boo", "foo 2"); // properties with spaces (with single quotes) test("-connect", - "com.sun.jdi.CommandLineLaunch:vmexec=java,options=-Dboo=foo '-Dboo2=foo 2',main=" + targ + " boo boo2") + "com.sun.jdi.CommandLineLaunch:vmexec=java,options=-Dboo=foo '-Dboo2=foo 2'" + + ",main=" + targ + " " + outFilename + " boo boo2") .expectedProp("boo", "foo") .expectedProp("boo2", "foo 2"); @@ -98,7 +121,7 @@ public static void main(String[] args) throws Exception { "com.sun.jdi.CommandLineLaunch:vmexec=java,options=\"-client\" \"-XX:+PrintVMOptions\"" + " -XX:+IgnoreUnrecognizedVMOptions" + " \"-XX:StartFlightRecording=dumponexit=true,maxsize=500M\" \"-XX:FlightRecorderOptions=repository=jfrrep\"" - + ",main=" + targ) + + ",main=" + targ + " " + outFilename) .expectedArg("-XX:StartFlightRecording=dumponexit=true,maxsize=500M") .expectedArg("-XX:FlightRecorderOptions=repository=jfrrep"); @@ -107,7 +130,7 @@ public static void main(String[] args) throws Exception { "com.sun.jdi.CommandLineLaunch:vmexec=java,options='-client' '-XX:+PrintVMOptions'" + " -XX:+IgnoreUnrecognizedVMOptions" + " '-XX:StartFlightRecording=dumponexit=true,maxsize=500M' '-XX:FlightRecorderOptions=repository=jfrrep'" - + ",main=" + targ) + + ",main=" + targ + " " + outFilename) .expectedArg("-XX:StartFlightRecording=dumponexit=true,maxsize=500M") .expectedArg("-XX:FlightRecorderOptions=repository=jfrrep"); @@ -120,7 +143,7 @@ public static void main(String[] args) throws Exception { + " -XX:+IgnoreUnrecognizedVMOptions" + " \"-XX:StartFlightRecording=dumponexit=true,maxsize=500M\"" + " '-XX:FlightRecorderOptions=repository=jfrrep'" - + ",main=" + targ + " prop1 prop2 prop3 prop4") + + ",main=" + targ + " " + outFilename + " prop1 prop2 prop3 prop4") .expectedProp("prop1", "val1") .expectedProp("prop2", "val 2") .expectedProp("prop3", "val3") @@ -154,12 +177,18 @@ private static TestResult test(String... args) throws Exception { .map(s -> s.replace("\"", "\\\"")) .toArray(String[]::new); } + try (Jdb jdb = new Jdb(args)) { jdb.waitForSimplePrompt(1024, true); // 1024 lines should be enough jdb.command(JdbCommand.run().allowExit()); - OutputAnalyzer out = new OutputAnalyzer(jdb.getJdbOutput()); - out.shouldContain(JbdOptionsTarg.OK_MSG); - return new TestResult(out); } + String output = Files.readAllLines(outPath, StandardCharsets.UTF_8).stream() + .collect(Collectors.joining(System.getProperty("line.separator"))); + Files.deleteIfExists(outPath); + System.out.println("Debuggee output: ["); + System.out.println(output); + System.out.println("]"); + OutputAnalyzer out = new OutputAnalyzer(output); + return new TestResult(out); } } diff --git a/test/jdk/com/sun/jndi/ldap/SocketCloseTest.java b/test/jdk/com/sun/jndi/ldap/SocketCloseTest.java new file mode 100644 index 00000000000..a33beb6cacc --- /dev/null +++ b/test/jdk/com/sun/jndi/ldap/SocketCloseTest.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.naming.Context; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import javax.net.SocketFactory; +import java.net.InetAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Hashtable; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +/* + * @test + * @bug 8313657 + * @summary make sure socket is closed when the error happens for OutputStream flushing + * The value of provider url can be random, not necessary to be the one in the code + * @library /test/lib + * @run main/othervm SocketCloseTest + */ + +public class SocketCloseTest { + public static String SOCKET_CLOSED_MSG = "The socket has been closed."; + public static String SOCKET_NOT_CLOSED_MSG = "The socket was not closed."; + public static String BAD_FLUSH = "Bad flush!"; + private static final byte[] BIND_RESPONSE = new byte[]{ + 48, 12, 2, 1, 1, 97, 7, 10, 1, 0, 4, 0, 4, 0 + }; + + public static void main(String[] args) throws Exception { + SocketCloseTest scTest = new SocketCloseTest(); + scTest.runCloseSocketScenario(); + } + + public void runCloseSocketScenario() throws Exception { + Hashtable props = new Hashtable<>(); + + props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); + props.put(Context.PROVIDER_URL, "ldap://localhost:1389/o=example"); + props.put("java.naming.ldap.factory.socket", CustomSocketFactory.class.getName()); + try { + final DirContext ctx = new InitialDirContext(props); + } catch (Exception e) { + if (CustomSocketFactory.customSocket.closeMethodCalledCount() > 0) { + System.out.println(SOCKET_CLOSED_MSG); + } else { + System.out.println(SOCKET_NOT_CLOSED_MSG); + throw e; + } + } + } + + public static class CustomSocketFactory extends SocketFactory { + public static CustomSocket customSocket = new CustomSocket(); + + public static CustomSocketFactory getDefault() { + return new CustomSocketFactory(); + } + + @Override + public Socket createSocket() { + return customSocket; + } + + @Override + public Socket createSocket(String s, int timeout) { + return customSocket; + } + + @Override + public Socket createSocket(String host, int port, InetAddress localHost, + int localPort) { + return customSocket; + } + + @Override + public Socket createSocket(InetAddress host, int port) { + return customSocket; + } + + @Override + public Socket createSocket(InetAddress address, int port, + InetAddress localAddress, int localPort) { + return customSocket; + } + } + + private static class LdapInputStream extends InputStream { + private ByteArrayInputStream bos; + + public LdapInputStream() { + } + + @Override + public int read() throws IOException { + bos = new ByteArrayInputStream(BIND_RESPONSE); + return bos.read(); + } + } + + private static class LdapOutputStream extends OutputStream { + + @Override + public void write(int b) throws IOException { + System.out.println("output stream writing"); + } + + @Override + public void flush() throws IOException { + System.out.println(BAD_FLUSH); + throw new IOException(BAD_FLUSH); + } + } + + private static class CustomSocket extends Socket { + private int closeMethodCalled = 0; + private LdapOutputStream output = new LdapOutputStream(); + private LdapInputStream input = new LdapInputStream(); + + public void connect(SocketAddress address, int timeout) { + } + + public InputStream getInputStream() { + return input; + } + + public OutputStream getOutputStream() { + return output; + } + + public int closeMethodCalledCount() { + return closeMethodCalled; + } + + @Override + public void close() throws IOException { + closeMethodCalled++; + super.close(); + } + } +} diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java b/test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java index 90f29e1456f..027f31695ae 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,9 +110,10 @@ void testBind() { try { channel.close(); /* open a new unbound channel for test */ channel = SctpChannel.open(); - connectChannel(channel); - channel.bind(null); - fail("AlreadyConnectedException expected"); + try (var peer = connectChannel(channel)) { + channel.bind(null); + fail("AlreadyConnectedException expected"); + } } catch (AlreadyConnectedException unused) { pass(); } catch (IOException ioe) { unexpected(ioe); } @@ -264,7 +265,9 @@ void testBindUnbind(boolean connected) { } finally { try { if (channel != null) channel.close(); } catch (IOException ioe) { unexpected(ioe); } - } + try { if (peerChannel != null) peerChannel.close(); } + catch (IOException ioe) { unexpected(ioe); } + } } boolean boundAddress(SctpChannel channel, InetAddress addr) diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java b/test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java index 68380a47c11..8cbe034b00d 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -191,6 +191,9 @@ else if (sk.isReadable()) { } } //for + try { sc.close(); } + catch (IOException ioe) { unexpected(ioe); } + } catch (IOException ioe) { unexpected(ioe); } catch (InterruptedException ie) { diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java b/test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java index 1e992a7c05f..fccc12a9f06 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java @@ -61,11 +61,10 @@ void test(String[] args) { void doTest() { SctpChannel channel = null; - SctpServerChannel ssc = null; - try { + try (SctpServerChannel ssc = SctpServerChannel.open()) { /* Create a server channel to connect to */ - ssc = SctpServerChannel.open().bind(null); + ssc.bind(null); Set addrs = ssc.getAllLocalAddresses(); if (addrs.isEmpty()) debug("addrs should not be empty"); @@ -209,8 +208,6 @@ public Void call() throws IOException { } finally { try { if (channel != null) channel.close(); } catch (IOException unused) {} - try { if (ssc != null) ssc.close(); } - catch (IOException unused) {} } } diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java b/test/jdk/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java index af0aed0435d..1da835b9cbb 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java @@ -72,8 +72,7 @@ void test(String[] args) { return; } - try { - SctpChannel sc = SctpChannel.open(); + try (SctpChannel sc = SctpChannel.open()) { /* check supported options */ Set> options = sc.supportedOptions(); @@ -143,8 +142,6 @@ void test(String[] args) { /* SCTP_PRIMARY_ADDR */ void sctpPrimaryAddr() throws IOException { - SocketAddress addrToSet = null;; - System.out.println("TESTING SCTP_PRIMARY_ADDR"); SctpChannel sc = SctpChannel.open(); SctpServerChannel ssc = SctpServerChannel.open().bind(null); @@ -158,12 +155,11 @@ void sctpPrimaryAddr() throws IOException { sc.connect(serverAddr); SctpChannel peerChannel = ssc.accept(); ssc.close(); - Set peerAddrs = peerChannel.getAllLocalAddresses(); - debug("Peer local Addresses: "); - for (Iterator it = peerAddrs.iterator(); it.hasNext(); ) { + Set remoteAddresses = sc.getRemoteAddresses(); + debug("Remote Addresses: "); + for (Iterator it = remoteAddresses.iterator(); it.hasNext(); ) { InetSocketAddress addr = (InetSocketAddress)it.next(); debug("\t" + addr); - addrToSet = addr; // any of the peer addresses will do! } /* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */ @@ -176,25 +172,21 @@ void sctpPrimaryAddr() throws IOException { } else { /* Linux */ SocketAddress primaryAddr = sc.getOption(SCTP_PRIMARY_ADDR); System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr); - /* Verify that this is one of the peer addresses */ - boolean found = false; - addrToSet = primaryAddr; // may not have more than one addr - for (Iterator it = peerAddrs.iterator(); it.hasNext(); ) { - InetSocketAddress addr = (InetSocketAddress)it.next(); - if (addr.equals(primaryAddr)) { - found = true; - } - addrToSet = addr; + /* Verify that this is one of the remote addresses */ + check(remoteAddresses.contains(primaryAddr), "SCTP_PRIMARY_ADDR returned bogus address!"); + + for (Iterator it = remoteAddresses.iterator(); it.hasNext(); ) { + InetSocketAddress addrToSet = (InetSocketAddress) it.next(); + System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet); + sc.setOption(SCTP_PRIMARY_ADDR, addrToSet); + System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet); + primaryAddr = sc.getOption(SCTP_PRIMARY_ADDR); + System.out.println("SCTP_PRIMARY_ADDR returned : " + primaryAddr); + check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly"); } - check(found, "SCTP_PRIMARY_ADDR returned bogus address!"); - - System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet); - sc.setOption(SCTP_PRIMARY_ADDR, addrToSet); - System.out.println("SCTP_PRIMARY_ADDR set to: " + addrToSet); - primaryAddr = sc.getOption(SCTP_PRIMARY_ADDR); - System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr); - check(addrToSet.equals(primaryAddr),"SCTP_PRIMARY_ADDR not set correctly"); } + sc.close(); + peerChannel.close(); } //--------------------- Infrastructure --------------------------- boolean debug = true; diff --git a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Branch.java b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Branch.java index f7638b50d0a..ffd8eb361c3 100644 --- a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Branch.java +++ b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Branch.java @@ -210,7 +210,8 @@ public void run() { /* echo the message */ debug("Server: echoing first message"); buffer.flip(); - int bytes = serverChannel.send(buffer, info); + MessageInfo sendInfo = MessageInfo.createOutgoing(info.association(), null, 0); + int bytes = serverChannel.send(buffer, sendInfo); debug("Server: sent " + bytes + "bytes"); clientFinishedLatch.await(10L, TimeUnit.SECONDS); diff --git a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Send.java b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Send.java index 1f314686bac..feb914a410e 100644 --- a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Send.java +++ b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/Send.java @@ -276,7 +276,8 @@ public void run() { /* echo the message */ debug("Server: echoing first message"); buffer.flip(); - int bytes = serverChannel.send(buffer, info); + MessageInfo sendInfo = MessageInfo.createOutgoing(assoc, null, info.streamNumber()); + int bytes = serverChannel.send(buffer, sendInfo); debug("Server: sent " + bytes + "bytes"); /* receive a large message */ @@ -302,7 +303,8 @@ public void run() { /* echo the message */ debug("Server: echoing second message"); buffer.flip(); - bytes = serverChannel.send(buffer, info); + sendInfo = MessageInfo.createOutgoing(assoc, null, info.streamNumber()); + bytes = serverChannel.send(buffer, sendInfo); debug("Server: sent " + bytes + "bytes"); /* TEST 6 */ diff --git a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java index be50b4efb2f..50741af3565 100644 --- a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java +++ b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java @@ -97,14 +97,19 @@ void doTest(int sendBufferSize, int recvBufferSize, boolean direct, int offset) new SendFailedNotificationHandler(); ByteBuffer recvBuffer = direct ? allocateDirect(recvBufferSize) : allocate((recvBufferSize)); - channel.receive(recvBuffer, null, handler); - - // verify sent buffer received by send failed notification - ByteBuffer buffer = handler.getSendFailedByteBuffer(); - check(buffer.remaining() == sent); - check(buffer.position() == 0); - check(buffer.limit() == sent); - assertSameContent(sendBuffer, handler.getSendFailedByteBuffer()); + MessageInfo info = channel.receive(recvBuffer, null, handler); + debug("receive returned info:" + info); + + if (handler.receivedSendFailed) { + // verify sent buffer received by send failed notification + ByteBuffer buffer = handler.getSendFailedByteBuffer(); + check(buffer.remaining() == sent); + check(buffer.position() == 0); + check(buffer.limit() == sent); + assertSameContent(sendBuffer, handler.getSendFailedByteBuffer()); + } else { + debug("Unexpected event or received data. Check output."); + } } } @@ -112,6 +117,7 @@ class SendFailedNotificationHandler extends AbstractNotificationHandler { /** Reference to the buffer captured in send failed notification */ private ByteBuffer sentBuffer; + boolean receivedSendFailed; @Override public HandlerResult handleNotification( @@ -134,6 +140,7 @@ public HandlerResult handleNotification( public HandlerResult handleNotification( SendFailedNotification notification, Object attachment) { debug("%nSendFailedNotification: %s. ", notification); + receivedSendFailed = true; sentBuffer = notification.buffer(); return HandlerResult.RETURN; } diff --git a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java index 250bf4c4d0a..20267aa6f16 100644 --- a/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java +++ b/test/jdk/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java @@ -154,7 +154,6 @@ void test(String[] args) { /* SCTP_PRIMARY_ADDR */ void sctpPrimaryAddr() throws IOException { - SocketAddress addrToSet = null; ByteBuffer buffer = ByteBuffer.allocate(Util.SMALL_BUFFER); System.out.println("TESTING SCTP_PRIMARY_ADDR"); @@ -189,12 +188,11 @@ void sctpPrimaryAddr() throws IOException { SctpChannel peerChannel = ssc.accept(); ssc.close(); - Set peerAddrs = peerChannel.getAllLocalAddresses(); - debug("Peer local Addresses: "); - for (Iterator it = peerAddrs.iterator(); it.hasNext(); ) { + Set remoteAddresses = smc.getRemoteAddresses(assoc); + debug("Remote Addresses: "); + for (Iterator it = remoteAddresses.iterator(); it.hasNext(); ) { InetSocketAddress addr = (InetSocketAddress)it.next(); debug("\t" + addr); - addrToSet = addr; // any of the peer addresses will do! } /* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */ @@ -207,25 +205,21 @@ void sctpPrimaryAddr() throws IOException { } else { /* Linux */ SocketAddress primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc); System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr); - /* Verify that this is one of the peer addresses */ - boolean found = false; - addrToSet = primaryAddr; // may not have more than one addr - for (Iterator it = peerAddrs.iterator(); it.hasNext(); ) { - InetSocketAddress addr = (InetSocketAddress)it.next(); - if (addr.equals(primaryAddr)) { - found = true; - } - addrToSet = addr; + /* Verify that this is one of the remote addresses */ + check(remoteAddresses.contains(primaryAddr), "SCTP_PRIMARY_ADDR returned bogus address!"); + + for (Iterator it = remoteAddresses.iterator(); it.hasNext(); ) { + InetSocketAddress addrToSet = (InetSocketAddress) it.next(); + System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet); + smc.setOption(SCTP_PRIMARY_ADDR, addrToSet, assoc); + System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet); + primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc); + System.out.println("SCTP_PRIMARY_ADDR returned : " + primaryAddr); + check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly"); } - check(found, "SCTP_PRIMARY_ADDR returned bogus address!"); - - System.out.println("Try SCTP_PRIMARY_ADDR set to: " + addrToSet); - smc.setOption(SCTP_PRIMARY_ADDR, addrToSet, assoc); - System.out.println("SCTP_PRIMARY_ADDR set to: " + addrToSet); - primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc); - System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr); - check(addrToSet.equals(primaryAddr),"SCTP_PRIMARY_ADDR not set correctly"); } + smc.close(); + peerChannel.close(); } class SOTNotificationHandler extends AbstractNotificationHandler diff --git a/test/jdk/java/awt/CardLayout/CardsOrderTest.java b/test/jdk/java/awt/CardLayout/CardsOrderTest.java new file mode 100644 index 00000000000..5ca2cff1ae1 --- /dev/null +++ b/test/jdk/java/awt/CardLayout/CardsOrderTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4689398 + @summary Inserting items in a Container with CardLayout does not work since Merlin +*/ + +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Container; + +public class CardsOrderTest { + + public static void main(String[] args) throws Exception { + + CardLayout layout = new CardLayout(); + Container cont = new Container(); + Component comp1 = new Component() {}; + Component comp2 = new Component() {}; + Component comp3 = new Component() {}; + cont.setLayout(layout); + cont.add(comp1, "1", 0); + cont.add(comp2, "2", 0); + cont.add(comp3, "3", 0); + + // Testing visibility "state" - not actually if its visible on screen + // since this test does not require a UI. + System.out.println("comp1.isVisible() = " + comp1.isVisible()); + System.out.println("comp2.isVisible() = " + comp2.isVisible()); + System.out.println("comp3.isVisible() = " + comp3.isVisible()); + + if (!comp1.isVisible() || comp2.isVisible() || comp3.isVisible()) { + throw new RuntimeException("first added component must be visible"); + } + + System.out.println("CardLayout.next()"); + layout.next(cont); + + System.out.println("comp1.isVisible() = " + comp1.isVisible()); + System.out.println("comp2.isVisible() = " + comp2.isVisible()); + System.out.println("comp3.isVisible() = " + comp3.isVisible()); + + if (!comp3.isVisible() ||comp1.isVisible() || comp2.isVisible()) { + throw new RuntimeException("the wrong component is visible after CardLayout.next() (must be comp3)"); + } + } +} diff --git a/test/jdk/java/awt/CardLayout/ObedienceTest.java b/test/jdk/java/awt/CardLayout/ObedienceTest.java new file mode 100644 index 00000000000..0a3590dd425 --- /dev/null +++ b/test/jdk/java/awt/CardLayout/ObedienceTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4690266 + @summary REGRESSION: Wizard Page does not move to the next page +*/ + +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Container; + +public class ObedienceTest { + + public static void main(String[] args) { + Container cont = new Container(); + Component comp1 = new Component() {}; + Component comp2 = new Component() {}; + CardLayout layout = new CardLayout(); + cont.setLayout(layout); + cont.add(comp1, "first"); + cont.add(comp2, "second"); + + if (!comp1.isVisible()) { + throw new RuntimeException("first component must be visible"); + } + + comp1.setVisible(false); + comp2.setVisible(true); + layout.layoutContainer(cont); + + if (!comp2.isVisible() || comp1.isVisible()) { + System.out.println("comp1.isVisible() = " + comp1.isVisible()); + System.out.println("comp2.isVisible() = " + comp2.isVisible()); + throw new RuntimeException("manually shown component must be visible after layoutContainer()"); + } + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxCrashTest.java b/test/jdk/java/awt/Checkbox/CheckboxCrashTest.java new file mode 100644 index 00000000000..3584233723a --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxCrashTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4378378 + @summary Tests that checkbox.setLabel(null) doesn't crash the VM. + @key headful +*/ + +import java.awt.Checkbox; +import java.awt.EventQueue; +import java.awt.Frame; + +public class CheckboxCrashTest { + + static Frame f; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> runTest()); + Thread.sleep(1000); + } finally { + f.dispose(); + } + } + + static void runTest() { + f = new Frame("CheckboxCrashTest"); + Checkbox cb = new Checkbox(); + f.add(cb); + f.pack(); + cb.setLabel(null); + f.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Checkbox/MultiCheckedCheckboxGroupTest.java b/test/jdk/java/awt/Checkbox/MultiCheckedCheckboxGroupTest.java new file mode 100644 index 00000000000..4e52b8cd269 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/MultiCheckedCheckboxGroupTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4136496 + @key headful + @summary Checkbox.setCheckboxGroup(CheckboxGroup) works wrong on some Checkbox states +*/ + +import java.awt.Checkbox; +import java.awt.CheckboxGroup; + +public class MultiCheckedCheckboxGroupTest { + + public static void main(String[] args) throws Exception { + + CheckboxGroup gr = new CheckboxGroup(); + Checkbox chb1 = new Checkbox("Box 1", true, gr); + Checkbox chb2 = new Checkbox("Box 2", true, null); + + chb2.setCheckboxGroup(gr); + + System.out.println("chb1="+chb1); + System.out.println("chb2="+chb2); + System.out.println("gr.getSelectedCheckbox="+gr.getSelectedCheckbox()); + + if(chb1.getState() + && !chb2.getState() + && chb1.getCheckboxGroup() == gr + && chb2.getCheckboxGroup() == gr + && gr.getSelectedCheckbox() == chb1) { + System.out.println("PASSED"); + } else { + System.out.println("FAILED"); + throw new RuntimeException("Test FAILED"); + } + } +} diff --git a/test/jdk/java/awt/Checkbox/NullCheckboxGroupTest.java b/test/jdk/java/awt/Checkbox/NullCheckboxGroupTest.java new file mode 100644 index 00000000000..be2d139d944 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/NullCheckboxGroupTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4114268 + @key headful + @summary Checkbox.setCheckboxGroup(null) alters selection for CB's previous CBGroup +*/ + +import java.awt.Checkbox; +import java.awt.CheckboxGroup; + +public class NullCheckboxGroupTest { + + + public static void main(String[] args) { + CheckboxGroup cbg = new CheckboxGroup(); + Checkbox chbox1 = new Checkbox("First", cbg, true); + Checkbox chbox2 = new Checkbox("Second", cbg, false); + + chbox2.setCheckboxGroup(null); + + System.out.println("chbox1="+chbox1); + System.out.println("chbox2="+chbox2); + System.out.println("cbg="+cbg); + + if (cbg.getSelectedCheckbox() != chbox1) { + System.out.println("FAILED"); + throw new RuntimeException("Test FAILED"); + } else { + System.out.println("PASSED"); + } + } + } diff --git a/test/jdk/java/awt/Checkbox/SetCheckboxGroupNull.java b/test/jdk/java/awt/Checkbox/SetCheckboxGroupNull.java new file mode 100644 index 00000000000..1ba339ecde7 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/SetCheckboxGroupNull.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4726853 + @key headful + @summary Checkbox is changing it's state after removing from CheckboxGroup +*/ + +import java.awt.Checkbox; +import java.awt.CheckboxGroup; + +public class SetCheckboxGroupNull { + + public static void main(String[] args) { + boolean passed = true; + + // 1 step + { + CheckboxGroup g = new CheckboxGroup(); + Checkbox cb1 = new Checkbox("Label", true, g); + System.out.println("1. (should be true) "+cb1.getState()); + passed = passed && (cb1.getState() == true); + cb1.setCheckboxGroup(null); + System.out.println("2. (should be true) "+cb1.getState()); + passed = passed && (cb1.getState() == true); + } + + // 2 step + { + CheckboxGroup g = new CheckboxGroup(); + Checkbox cb1 = new Checkbox("CB1", true, g); + System.out.println("3. (should be true) " + cb1.getState()); + passed = passed && (cb1.getState() == true); + g.setSelectedCheckbox(null); + System.out.println("4. (should be false) " + cb1.getState()); + passed = passed && (cb1.getState() == false); + } + + if (!passed) { + throw new RuntimeException("SetCheckboxGroupNull FAILED"); + } + System.out.println("SetCheckboxGroupNull PASSED"); + } +} diff --git a/test/jdk/java/awt/Choice/DragOffNoSelectTest.java b/test/jdk/java/awt/Choice/DragOffNoSelectTest.java index 587fc701e93..a3b808dbcf8 100644 --- a/test/jdk/java/awt/Choice/DragOffNoSelectTest.java +++ b/test/jdk/java/awt/Choice/DragOffNoSelectTest.java @@ -71,7 +71,7 @@ static void createUI() { } frame.add(theChoice); frame.addWindowListener(testInstance); - frame.setSize(400, 400); + frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); diff --git a/test/jdk/java/awt/Cursor/SingleColorCursorTest.java b/test/jdk/java/awt/Cursor/SingleColorCursorTest.java new file mode 100644 index 00000000000..a35b13606dd --- /dev/null +++ b/test/jdk/java/awt/Cursor/SingleColorCursorTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4653170 + @summary Make sure setCursor does not produce Arithmetic Exception. + @key headful + @run main SingleColorCursorTest +*/ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Cursor; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; + +public class SingleColorCursorTest extends Panel { + public void init() { + setLayout (new BorderLayout()); + setSize (200,200); + add(new Button("JButton")); + } + + public void start () { + Cursor singleColorCursor = Toolkit.getDefaultToolkit() + .createCustomCursor(new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY), + new Point(0,0), "Single Color Cursor"); + try { + setCursor(singleColorCursor); + } catch (ArithmeticException ae) { + throw new RuntimeException("Setting a 1x1 custom cursor causes arithmetic exception"); + } + } + + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + EventQueue.invokeAndWait(() -> { + Frame frame = new Frame("Test window"); + try { + SingleColorCursorTest test = new SingleColorCursorTest(); + test.init(); + frame.add(test); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + test.start(); + frame.setVisible(false); + } finally { + frame.dispose(); + } + }); + } +} diff --git a/test/jdk/java/awt/Dialog/ComponentShownEvent.java b/test/jdk/java/awt/Dialog/ComponentShownEvent.java new file mode 100644 index 00000000000..ab1763f719d --- /dev/null +++ b/test/jdk/java/awt/Dialog/ComponentShownEvent.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4274360 + @summary Ensures that Dialogs receive COMPONENT_SHOWN events + @key headful + @run main ComponentShownEvent +*/ + +import java.awt.AWTException; +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.lang.reflect.InvocationTargetException; + +public class ComponentShownEvent { + + volatile boolean componentShown = false; + Frame f; + Dialog d; + + public void start() throws InterruptedException, + InvocationTargetException, AWTException { + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(() -> { + f = new Frame(); + d = new Dialog(f); + + d.addComponentListener(new ComponentAdapter() { + public void componentShown(ComponentEvent e) { + componentShown = true; + } + }); + + f.setSize(100, 100); + f.setLocationRelativeTo(null); + f.setVisible(true); + d.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(1000); + + if (!componentShown) { + throw new RuntimeException("test failed"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (d != null) { + d.setVisible(false); + d.dispose(); + } + if (f != null) { + f.setVisible(false); + f.dispose(); + } + }); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + ComponentShownEvent test = new ComponentShownEvent(); + test.start(); + System.out.println("test passed"); + } +} diff --git a/test/jdk/java/awt/Dialog/DialogAsParentOfFileDialog.java b/test/jdk/java/awt/Dialog/DialogAsParentOfFileDialog.java new file mode 100644 index 00000000000..4cc8c83b517 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogAsParentOfFileDialog.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4221123 + @summary Why Dialog can't be an owner of FileDialog? + @key headful + @run main DialogAsParentOfFileDialog +*/ + +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.FileDialog; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class DialogAsParentOfFileDialog { + FileDialog fdialog; + + public void start () { + StringBuilder errors = new StringBuilder(); + String nl = System.lineSeparator(); + Dialog dlg; + String title; + int mode; + boolean passed; + + System.out.println("DialogAsParentOfFileDialog"); + + /* + * public FileDialog(Dialog parent), + * checks owner and default settings. + */ + System.out.print("\ttest 01: "); + dlg = new Dialog(new Frame()); + fdialog = new FileDialog(dlg); + passed = + fdialog.getOwner() == dlg + && fdialog.isModal() + && fdialog.getTitle().equals("") + && fdialog.getMode() == FileDialog.LOAD + && fdialog.getFile() == null + && fdialog.getDirectory() == null + && fdialog.getFilenameFilter() == null; + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + /* + * public FileDialog(Dialog parent, String title), + * checks owner, title and default settings. + */ + System.out.print("\ttest 02: "); + dlg = new Dialog(new Frame()); + title = "Title"; + fdialog = new FileDialog(dlg, title); + passed = + fdialog.getOwner() == dlg + && fdialog.isModal() + && fdialog.getTitle().equals(title) + && fdialog.getMode() == FileDialog.LOAD + && fdialog.getFile() == null + && fdialog.getDirectory() == null + && fdialog.getFilenameFilter() == null; + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + /* + * public FileDialog(Dialog parent, String title), + * title: null. + * expected results: FileDialog object with a null title + */ + System.out.print("\ttest 03: "); + dlg = new Dialog(new Frame()); + title = null; + fdialog = new FileDialog(dlg, title); + passed = + fdialog.getOwner() == dlg + && (fdialog.getTitle() == null + || fdialog.getTitle().equals("")); + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + /* + * public FileDialog(Dialog parent, String title, int mode), + * checks owner, title and mode. + */ + dlg = new Dialog(new Frame()); + title = "Title"; + + System.out.print("\ttest 04: "); + mode = FileDialog.SAVE; + fdialog = new FileDialog(dlg, title, mode); + passed = + fdialog.getOwner() == dlg + && fdialog.isModal() + && fdialog.getTitle().equals(title) + && fdialog.getMode() == mode + && fdialog.getFile() == null + && fdialog.getDirectory() == null + && fdialog.getFilenameFilter() == null; + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + System.out.print("\ttest 05: "); + mode = FileDialog.LOAD; + fdialog = new FileDialog(dlg, title, mode); + passed = + fdialog.getOwner() == dlg + && fdialog.isModal() + && fdialog.getTitle().equals(title) + && fdialog.getMode() == mode + && fdialog.getFile() == null + && fdialog.getDirectory() == null + && fdialog.getFilenameFilter() == null; + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + /* + * public FileDialog(Dialog parent, String title, int mode), + * mode: Integer.MIN_VALUE, Integer.MIN_VALUE+1, + * Integer.MAX_VALUE-1, Integer.MAX_VALUE + * expected results: IllegalArgumentException should be thrown + */ + System.out.print("\ttest 06: "); + dlg = new Dialog(new Frame()); + title = "Title"; + int[] modes = {Integer.MIN_VALUE, Integer.MIN_VALUE+1, + Integer.MAX_VALUE-1, Integer.MAX_VALUE}; + passed = true; + for (int i = 0; i < modes.length; i++) { + try { + fdialog = new FileDialog(dlg, title, modes[i]); + passed = false; + } catch (IllegalArgumentException e) {} + } + System.out.println(passed ? "passed" : "FAILED"); + if (!passed) { + errors.append(nl); + errors.append("DialogAsParentOfFileDialog FAILED"); + } + + if (errors.length() > 0) { + throw new RuntimeException("Following tests failed:" + errors); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + EventQueue.invokeAndWait(() -> { + new DialogAsParentOfFileDialog().start(); + }); + } +} diff --git a/test/jdk/java/awt/Dialog/DialogDeadlockTest.java b/test/jdk/java/awt/Dialog/DialogDeadlockTest.java new file mode 100644 index 00000000000..87a929053c7 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogDeadlockTest.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 5006427 + @summary Shows many modal dialog and checks if there is a deadlock or thread race. + @key headful + @run main DialogDeadlockTest +*/ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Window; +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedList; +import java.util.List; + +public class DialogDeadlockTest { + public static final int MAX_COUNT = 200; + private static Dialog lastDialog; + private static Runnable r; + private static volatile int count; + private static volatile int cumul; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + DialogDeadlockTest ddt = new DialogDeadlockTest(); + ddt.start(); + } + + public void start() { + final Frame frame = new Frame("abc"); + final List toDispose = new LinkedList<>(); + + try { + frame.setLocation(300, 0); + frame.add(new Button("def")); + frame.pack(); + frame.setVisible(true); + cumul = 0; + + r = new Runnable() { + public void run() { + count++; + if (count < 10) { + Dialog xlastDialog = lastDialog; + cumul += count; + Dialog d = new Dialog(frame, "Dialog " + + cumul, true); + d.setLayout(new BorderLayout()); + d.add(new Button("button " + count), BorderLayout.CENTER); + d.pack(); + toDispose.add(d); + lastDialog = d; + EventQueue.invokeLater(r); + d.setVisible(true); + if (xlastDialog != null) { + xlastDialog.setVisible(false); + } else { + if (cumul < MAX_COUNT) { + count = 0; + lastDialog = null; + EventQueue.invokeLater(r); + } + } + } else { + try { + Thread.sleep(1000); + } catch (InterruptedException ignore) { + } + lastDialog.setVisible(false); + lastDialog = null; + } + } + }; + try { + EventQueue.invokeAndWait(r); + } catch (InterruptedException ignore) { + } catch (Exception e) { + throw new RuntimeException("Unexpected exception: " + + e.getLocalizedMessage()); + } + while (cumul < MAX_COUNT - 1) { + try { + Thread.sleep(1000); + } catch (InterruptedException ignore) {} + } + System.out.println("Test PASSED"); + } finally { + try { + EventQueue.invokeAndWait(() -> { + frame.setVisible(false); + frame.dispose(); + for (Window w: toDispose) { + w.dispose(); + } + }); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } +} diff --git a/test/jdk/java/awt/Dialog/DialogLocationTest.java b/test/jdk/java/awt/Dialog/DialogLocationTest.java new file mode 100644 index 00000000000..624db8ea7dd --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogLocationTest.java @@ -0,0 +1,176 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4101437 + @summary Dialog.setLocation(int,int) works unstable when the dialog is visible + @key headful + @run main DialogLocationTest +*/ + +import java.awt.AWTException; +import java.awt.Container; +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GraphicsEnvironment; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.Random; + +public class DialogLocationTest extends Panel { + private volatile int count = 0; + private Dialog my_dialog; + private volatile boolean waitingForEvent = false; + private volatile int newX, newY; + Random random = new Random(); + + public void init() { + Container f = getParent(); + + while (!(f instanceof Frame)) { + f = f.getParent(); + } + + my_dialog = new Dialog((Frame) f, "TestDialog"); + my_dialog.setSize(150, 100); + + setSize(200, 200); + } + + public void start() throws InterruptedException, + InvocationTargetException { + Robot robot; + try { + robot = new Robot(); + EventQueue.invokeAndWait(() -> { + my_dialog.setLocationRelativeTo(null); + my_dialog.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + my_dialog.addComponentListener(new CL()); + setDialogLocation(my_dialog); + } catch (AWTException e) { + throw new RuntimeException(e); + } finally { + EventQueue.invokeAndWait(() -> { + my_dialog.setVisible(false); + my_dialog.dispose(); + }); + } + } + + public void setDialogLocation(Dialog dialog) { + int height, width, insetX, insetY; + Point curLoc; + int i; + + Rectangle screen = GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getMaximumWindowBounds(); + height = screen.height; + width = screen.width; + insetX = screen.x; + insetY = screen.y; + + for (i = 0; i < 100; i++) { + newX = random.nextInt(width - 300 - insetX) + insetX; + newY = random.nextInt(height - 400 - insetY) + insetY; + + if (newX == 0 && newY == 0) { + i--; + continue; + } + + waitingForEvent = true; + + EventQueue.invokeLater(() -> { + dialog.setLocation(newX, newY); + }); + + while (waitingForEvent) { + Thread.yield(); + } + + curLoc = dialog.getLocation(); + if (curLoc.x != newX || curLoc.y != newY) { + count++; + System.out.println("Failed on iteration " + i + " expect:[" + newX + "," + newY + "] reported:[" + curLoc.x + "," + + curLoc.y + "] diff:[" + (curLoc.x - newX) + "," + (curLoc.y - newY) + "]"); + System.out.flush(); + } + } + + if (count > 0) { + throw new RuntimeException("Dialog Location was set incorrectly"); + } + } + + public class CL extends ComponentAdapter { + int lastX, lastY; + + public void componentMoved(ComponentEvent e) { + if (e.getComponent() == my_dialog) { + Point eventLoc = e.getComponent().getLocation(); + if (lastX != eventLoc.x || lastY != eventLoc.y) { + lastX = eventLoc.x; + lastY = eventLoc.y; + if (newX != 0 && newY != 0 && (eventLoc.x != newX || eventLoc.y != newY)) { + count++; + System.out.println("Failed in componentMoved() expect:[" + newX +"," + newY + "] reported: [" + + eventLoc.x + "," + eventLoc.y + "] diff [" + (eventLoc.x - newX) + "," + (eventLoc.y - newY) + "]"); + System.out.flush(); + } + waitingForEvent = false; + } + } + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + Frame frame = new Frame("DialogLocationTest"); + try { + DialogLocationTest test = new DialogLocationTest(); + EventQueue.invokeAndWait(() -> { + frame.add(test); + test.init(); + frame.setVisible(true); + }); + test.start(); + } finally { + EventQueue.invokeLater(() -> { + frame.setVisible(false); + frame.dispose(); + }); + } + } +} + diff --git a/test/jdk/java/awt/Dialog/ModalDialogOnNonEdt.java b/test/jdk/java/awt/Dialog/ModalDialogOnNonEdt.java new file mode 100644 index 00000000000..a7a9565d054 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ModalDialogOnNonEdt.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4636311 4645035 + @summary Modal dialog shown on EDT after modal dialog on EDT doesn't receive mouse events + @key headful + @run main ModalDialogOnNonEdt +*/ + +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.EventQueue; +import java.awt.Robot; +import java.awt.Point; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.InputEvent; +import java.awt.AWTException; +import java.awt.event.MouseEvent; +import java.awt.event.MouseAdapter; +import java.util.ArrayList; +import java.util.List; + +public class ModalDialogOnNonEdt { + + public void start () { + ShowModalDialog showModalDialog = new ShowModalDialog(); + + try { + EventQueue.invokeLater(showModalDialog); + Robot robot = new Robot(); + robot.delay(2000); + + Point origin = ShowModalDialog.lastShownDialog.getLocationOnScreen(); + Dimension dim = ShowModalDialog.lastShownDialog.getSize(); + robot.mouseMove((int)origin.getX() + (int)dim.getWidth()/2, + (int)origin.getY() + (int)dim.getHeight()/2); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + robot.delay(2000); + if (ShowModalDialog.count < 2) { + throw new RuntimeException("TEST FAILED: second modal dialog was not shown"); + } + + /* click on second modal dialog to verify if it receives mouse events */ + synchronized (ShowModalDialog.monitor) { + origin = ShowModalDialog.lastShownDialog.getLocationOnScreen(); + dim = ShowModalDialog.lastShownDialog.getSize(); + robot.mouseMove((int)origin.getX() + (int)dim.getWidth()/2, + (int)origin.getY() + (int)dim.getHeight()/2); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + ShowModalDialog.monitor.wait(2000); + } + + if (ShowModalDialog.count < 3) { + throw new RuntimeException("TEST FAILED: second modal dialog didn't receive mouse events"); + } + + } catch (AWTException e) { + e.printStackTrace(); + throw new RuntimeException("Some AWTException occurred"); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException("Test was interrupted"); + } finally { + for (Window w : ShowModalDialog.toDispose) { + w.setVisible(false); + w.dispose(); + } + } + + System.out.println("TEST PASSED"); + } + + public static void main(String[] args) { + new ModalDialogOnNonEdt().start(); + } +} + +class ShowModalDialog implements Runnable { + static volatile int count = 0; + static Object monitor = new Object(); + static Dialog lastShownDialog; + static List toDispose = new ArrayList<>(); + + public void run() { + count++; + Frame frame = new Frame("Frame #" + count); + toDispose.add(frame); + Dialog dialog = new Dialog(frame, "Modal Dialog #" + count, true); + dialog.setSize(100, 100); + dialog.setLocation(100, 100*count); + dialog.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent me) { + System.out.println(me.toString()); + if (ShowModalDialog.count < 2) { + Runnable runner = new ShowModalDialog(); + new Thread(runner).start(); + } else { + synchronized (monitor) { + ShowModalDialog.count++; + monitor.notifyAll(); + } + } + } + }); + lastShownDialog = dialog; + toDispose.add(dialog); + dialog.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Dialog/NewMessagePumpTest.java b/test/jdk/java/awt/Dialog/NewMessagePumpTest.java new file mode 100644 index 00000000000..084d0f2e43c --- /dev/null +++ b/test/jdk/java/awt/Dialog/NewMessagePumpTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4119383 + @summary Tests total rewrite of modality blocking model + @key headful + @run main/timeout=30 NewMessagePumpTest +*/ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.InvocationTargetException; + +public class NewMessagePumpTest { + public void start() { + Frame1 frame = new Frame1(); + frame.validate(); + frame.setVisible(true); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + NewMessagePumpTest test = new NewMessagePumpTest(); + EventQueue.invokeAndWait(test::start); + } +} + +class Frame1 extends Frame { + Frame1() { + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void jbInit() throws Exception { + MyPanel panel1 = new MyPanel(this); + this.setLayout(new BorderLayout()); + this.setSize(new Dimension(400, 300)); + this.setLocationRelativeTo(null); + this.setTitle("Frame Title"); + panel1.setLayout(new BorderLayout()); + this.add(panel1, BorderLayout.CENTER); + } +} + +class Dialog1 extends Dialog { + BorderLayout borderLayout1 = new BorderLayout(); + Button button1 = new Button(); + + Dialog1(Frame f) { + super(f, true); + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + void jbInit() throws Exception { + button1.setLabel("close"); + button1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + button1_actionPerformed(e); + } + }); + this.setLayout(borderLayout1); + this.add(button1, BorderLayout.NORTH); + } + + void button1_actionPerformed(ActionEvent e) { + dispose(); + } +} + +class MyPanel extends Panel { + Frame frame; + + MyPanel(Frame f) { + frame = f; + } + + public void addNotify() { + super.addNotify(); + System.out.println("AddNotify bringing up modal dialog..."); + final Dialog1 dlg = new Dialog1(frame); + dlg.pack(); + new Thread(() -> { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + try { + EventQueue.invokeAndWait(() -> { + dlg.setVisible(false); + dlg.dispose(); + }); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } + }).start(); + dlg.setVisible(true); + frame.setVisible(false); + frame.dispose(); + System.out.println("Test passed"); + } +} diff --git a/test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java b/test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java index 829eb31ce37..394905e1d19 100644 --- a/test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java +++ b/test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ * @test * @bug 8023213 * @summary Font/Text APIs should not crash/takes long time - * if transform includes INIFINITY + * if transform includes INFINITY * @run main DrawStringWithInfiniteXform */ -import java.awt.*; -import java.awt.font.*; -import java.awt.geom.*; -import java.awt.image.*; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; import java.util.Timer; import java.util.TimerTask; @@ -41,15 +41,22 @@ public class DrawStringWithInfiniteXform { class ScheduleTask extends TimerTask { public void run() { - if (!done) { - throw new - RuntimeException("drawString with InfiniteXform transform takes long time"); + System.out.println("Task running at " + System.currentTimeMillis()); + System.out.flush(); + synchronized (DrawStringWithInfiniteXform.class) { + System.out.println( + "Checking done at " + System.currentTimeMillis()); + System.out.flush(); + if (!done) { + throw new RuntimeException( + "drawString with InfiniteXform transform takes long time"); + } } } } public DrawStringWithInfiniteXform() { timer = new Timer(); - timer.schedule(new ScheduleTask(), 20000); + timer.schedule(new ScheduleTask(), 30000); } public static void main(String [] args) { @@ -58,11 +65,15 @@ public static void main(String [] args) { } private void start() { + System.out.println("start at " + System.currentTimeMillis()); + System.out.flush(); float[] vals = new float[6]; - for (int i=0;i<6;i++) vals[i]=Float.POSITIVE_INFINITY; + for (int i=0; i<6; i++) { + vals[i] = Float.POSITIVE_INFINITY; + } AffineTransform nanTX = new AffineTransform(vals); - BufferedImage bi = new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB); + BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bi.createGraphics(); g2d.rotate(Float.POSITIVE_INFINITY); @@ -73,8 +84,12 @@ private void start() { g2d.setFont(xfiniteFont); g2d.drawString("abc", 20, 20); } - done = true; - timer.cancel(); + System.out.println("Loop done at " + System.currentTimeMillis()); + System.out.flush(); + synchronized (DrawStringWithInfiniteXform.class) { + done = true; + timer.cancel(); + } System.out.println("Test passed"); } } diff --git a/test/jdk/java/awt/FontClass/FontScalerRoundTest.java b/test/jdk/java/awt/FontClass/FontScalerRoundTest.java new file mode 100644 index 00000000000..49901683522 --- /dev/null +++ b/test/jdk/java/awt/FontClass/FontScalerRoundTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8299255 + * @summary Verify no round error in Font scaling + */ + +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; + +public class FontScalerRoundTest { + public static void main(String[] args) { + final double SCALE = 4096.0; + final double STEP = 0.0001; + final double LIMIT = STEP * 100.0; + + BufferedImage img = new BufferedImage(100, 100, + BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = img.createGraphics(); + FontRenderContext frc = g2d.getFontRenderContext(); + + Font font = new Font(Font.DIALOG, Font.PLAIN, 1); + float h1 = getScaledHeight(font, frc, SCALE); + float h2 = getScaledHeight(font, frc, SCALE + STEP); + float diff = Math.abs(h1 - h2); + + if (diff > LIMIT) { + throw new RuntimeException("Font metrix had round error " + + h1 + "," + h2); + } + } + + private static float getScaledHeight(Font font, + FontRenderContext frc, + double scale) { + AffineTransform at = new AffineTransform(scale, 0.0, 0.0, scale, + 0.0, 0.0); + Font transFont = font.deriveFont(at); + LineMetrics m = transFont.getLineMetrics("0", frc); + return m.getHeight(); + } +} + diff --git a/test/jdk/java/awt/Frame/AwtFramePackTest.java b/test/jdk/java/awt/Frame/AwtFramePackTest.java new file mode 100644 index 00000000000..8ea8a309c1d --- /dev/null +++ b/test/jdk/java/awt/Frame/AwtFramePackTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.Panel; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +/* + * @test + * @bug 8265586 + * @key headful + * @summary Tests whether correct native frame insets are obtained + * for Resizable & Non-Resizable AWT Frame by checking the actual + * and expected/preferred frame sizes. + * @run main AwtFramePackTest + */ +public class AwtFramePackTest { + private static Frame frame; + private static Robot robot; + private static StringBuffer errorLog = new StringBuffer(); + + public static void main(String[] args) throws AWTException { + robot = new Robot(); + robot.setAutoDelay(300); + + // Resizable frame + createAWTFrame(true); + + robot.waitForIdle(); + robot.delay(500); + + // Non-Resizable frame + createAWTFrame(false); + + if (errorLog != null && errorLog.length() > 0) { + throw new RuntimeException("Test failed due to the following" + + " one or more errors: \n" + errorLog); + } + } + + private static void createAWTFrame(boolean isResizable) { + try { + frame = new Frame(); + frame.setLayout(new BorderLayout()); + + Panel panel = new Panel(); + panel.add(new Button("Panel Button B1")); + panel.add(new Button("Panel Button B2")); + frame.add(panel, BorderLayout.CENTER); + + MenuBar mb = new MenuBar(); + Menu m = new Menu("Menu"); + mb.add(m); + frame.setMenuBar(mb); + + frame.setResizable(isResizable); + frame.pack(); + frame.setVisible(true); + + robot.waitForIdle(); + robot.delay(500); + + Dimension actualFrameSize = frame.getSize(); + Dimension expectedFrameSize = frame.getPreferredSize(); + + if (!actualFrameSize.equals(expectedFrameSize)) { + String frameType = isResizable ? "ResizableFrame" : "NonResizableFrame"; + System.out.println("Expected frame size: " + expectedFrameSize); + System.out.println("Actual frame size: " + actualFrameSize); + saveScreenCapture(frameType + ".png"); + errorLog.append(frameType + ": Expected and Actual frame size" + + " are different. frame.pack() does not work!! \n"); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + // for debugging purpose, saves screen capture when test fails. + private static void saveScreenCapture(String filename) { + BufferedImage image = robot.createScreenCapture(frame.getBounds()); + try { + ImageIO.write(image,"png", new File(filename)); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java index 4067bcea32e..4f789668c4a 100644 --- a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java +++ b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java @@ -34,11 +34,23 @@ * @run main DragWindowTest */ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -import java.util.concurrent.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Window; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import java.util.concurrent.Callable; import test.java.awt.regtesthelpers.Util; @@ -55,7 +67,7 @@ public class DragWindowTest { public static void main(String[] args) throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(50); + robot.setAutoDelay(100); SwingUtilities.invokeAndWait(new Runnable() { @@ -65,6 +77,7 @@ public void run() { } }); + robot.delay(250); robot.waitForIdle(); Point pointToClick = Util.invokeOnEDT(new Callable() { @@ -134,6 +147,7 @@ private static void createAndShowGUI() { panel.add(button, BorderLayout.CENTER); frame.getContentPane().add(panel); + frame.setLocationRelativeTo(null); frame.setVisible(true); } diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuLocation.java b/test/jdk/java/awt/PopupMenu/PopupMenuLocation.java index 713eb1d706a..197fa8a6927 100644 --- a/test/jdk/java/awt/PopupMenu/PopupMenuLocation.java +++ b/test/jdk/java/awt/PopupMenu/PopupMenuLocation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,10 +33,13 @@ import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.*; +import java.io.File; +import java.util.stream.IntStream; +import javax.imageio.ImageIO; -/** +/* * @test * @key headful * @bug 8160270 @@ -47,43 +50,59 @@ public final class PopupMenuLocation { private static final int SIZE = 350; public static final String TEXT = "Long-long-long-long-long-long-long text in the item-"; + public static final int OFFSET = 50; private static volatile boolean action = false; + private static Robot robot; + private static Frame frame; + private static Rectangle screenBounds; + public static void main(final String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(200); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] sds = ge.getScreenDevices(); for (GraphicsDevice sd : sds) { GraphicsConfiguration gc = sd.getDefaultConfiguration(); - Rectangle bounds = gc.getBounds(); - Point point = new Point(bounds.x, bounds.y); + screenBounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); - while (point.y < bounds.y + bounds.height - insets.bottom - SIZE) { - while (point.x - < bounds.x + bounds.width - insets.right - SIZE) { + Point point = new Point(screenBounds.x + insets.left, + screenBounds.y + insets.top); + final int yBound = screenBounds.y + screenBounds.height + - insets.bottom - SIZE; + final int xBound = screenBounds.x + screenBounds.width + - insets.right - SIZE; + while (point.y < yBound) { + while (point.x < xBound) { test(point); - point.translate(bounds.width / 5, 0); + point.translate(screenBounds.width / 5, 0); } - point.setLocation(bounds.x, point.y + bounds.height / 5); + point.setLocation(screenBounds.x, + point.y + screenBounds.height / 5); } } } - private static void test(final Point tmp) throws Exception { + private static void test(final Point loc) { + frame = new Frame(); PopupMenu pm = new PopupMenu(); - for (int i = 1; i < 7; i++) { - pm.add(TEXT + i); - } - pm.addActionListener(e -> action = true); - Frame frame = new Frame(); + IntStream.rangeClosed(1, 6).forEach(i -> pm.add(TEXT + i)); + pm.addActionListener(e -> { + action = true; + System.out.println(" Got action event " + e); + }); + try { + frame.setUndecorated(true); frame.setAlwaysOnTop(true); frame.setLayout(new FlowLayout()); frame.add(pm); frame.pack(); frame.setSize(SIZE, SIZE); + frame.setLocation(loc); frame.setVisible(true); - frame.setLocation(tmp.x, tmp.y); + frame.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { show(e); @@ -105,23 +124,37 @@ private void show(MouseEvent e) { } } - private static void openPopup(final Frame frame) throws Exception { - Robot robot = new Robot(); - robot.setAutoDelay(200); + private static void openPopup(final Frame frame) { robot.waitForIdle(); Point pt = frame.getLocationOnScreen(); - robot.mouseMove(pt.x + frame.getWidth() / 2, pt.y + 50); + int x = pt.x + frame.getWidth() / 2; + int y = pt.y + OFFSET; + robot.mouseMove(x, y); robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); - int x = pt.x + frame.getWidth() / 2; - int y = pt.y + 130; + robot.delay(200); + y += OFFSET; robot.mouseMove(x, y); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); if (!action) { - throw new RuntimeException(); + captureScreen(); + throw new RuntimeException( + "Failed, didn't receive the PopupMenu ActionEvent on " + + "frame= " + frame + ", isFocused = " + frame.isFocused()); } action = false; } + + private static void captureScreen() { + try { + ImageIO.write(robot.createScreenCapture(screenBounds), + "png", + new File("screen.png")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } diff --git a/test/jdk/java/awt/TextComponent/PeerlessSetCaret/PeerlessSetCaret.java b/test/jdk/java/awt/TextComponent/PeerlessSetCaret/PeerlessSetCaret.java new file mode 100644 index 00000000000..2182cb338e2 --- /dev/null +++ b/test/jdk/java/awt/TextComponent/PeerlessSetCaret/PeerlessSetCaret.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4257143 + @summary RFE: Cannot set some AWT properties until peer has been created + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.TextArea; +import java.awt.TextField; + +public class PeerlessSetCaret { + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + TextField tf = new TextField("Hello, World!"); + TextArea ta = new TextArea("Hello, World!"); + + // without the fix these will throw IllegalComponentStateException + tf.setCaretPosition(1); + ta.setCaretPosition(1); + }); + } +} diff --git a/test/jdk/java/awt/TextComponent/SelectionBounds/SelectionBounds.java b/test/jdk/java/awt/TextComponent/SelectionBounds/SelectionBounds.java new file mode 100644 index 00000000000..51a075e7016 --- /dev/null +++ b/test/jdk/java/awt/TextComponent/SelectionBounds/SelectionBounds.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4118247 + @summary Make sure bounds are enforced correctly on + TextComponent.Select(int, int) + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.TextArea; +import java.awt.TextComponent; + +public class SelectionBounds { + public static TextComponent tc; + + public static int[][] index = { + {0, 0}, // 0 = selectionStart = selectionEnd + {5, 5}, // selectionStart = selectionEnd + {5, 7}, // 0 < selectionStart < selectionEnd < textLength + {-50, 7}, // selectionStart < 0 < selectionEnd < textLength + {-50, 50}, // selectionStart < 0 < textLength < selectionEnd + {5, 50}, // 0 < selectionStart < textLength < selectionEnd + {40, 50}, // 0 < textLength < selectionStart < selectionEnd + {-50, -40}, // selectionStart < selectionEnd < 0 < textLength + {7, 5}, // 0 < selectionEnd < selectionStart < textLength + {7, -50}, // selectionEnd < 0 < selectionStart < textLength + {50, -50}, // selectionEnd < 0 < textLength < selectionStart + {50, 5}, // 0 < selectionEnd < textLength < selectionStart + {50, 40}, // 0 < textLength < selectionEnd < selectionStart + {-40, -50} // selectionEnd < selectionStart < 0 < textLength + }; + + public static String[] selections = { + "", + "", + "56", + "0123456", + "0123456789", + "56789", + "", + "", + "", + "", + "", + "", + "", + "" + }; + + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + tc = new TextArea("0123456789"); + runTheTest(); + }); + } + + private static void runTheTest() { + int i; + String str1; + + for (i=0; i { + aDialog = new Dialog(new Frame()); + aDialog.setTitle("ADialog"); + aDialog.setBackground(Color.lightGray); + aDialog.setLayout(new BorderLayout()); + Panel mainPanel = new Panel(); + mainPanel.setLayout(new BorderLayout(6, 6)); + area = new TextArea(atextCRLF, 25, 68, + TextArea.SCROLLBARS_VERTICAL_ONLY); + area.setFont(new Font("Monospaced", Font.PLAIN, 11)); + mainPanel.add(area, "Center"); + aDialog.add(mainPanel, "Center"); + aDialog.pack(); + System.out.println("before: "+hexEncode(atextCRLF)); + System.out.println(" after: "+hexEncode(area.getText())); + res = area.getText().equals(atextCRLF); + System.out.println("01: " + res + "\n"); + passed = passed && res; + area.setText(atextCRLF); + System.out.println("before: "+hexEncode(atextCRLF)); + System.out.println(" after: "+hexEncode(area.getText())); + res = area.getText().equals(atextCRLF); + System.out.println("02: " + res + "\n"); + passed = passed && res; + + area.setText(""); + atext = "row1"; + area.append(atext+"\r"); + area.append(atext+"\r"); + System.out.println("before: " + +hexEncode(atext+"\r" + atext+"\r")); + System.out.println(" after: "+hexEncode(area.getText())); + res = area.getText().equals(atext + atext); + System.out.println("03: " + res + "\n"); + passed = passed && res; + + area.setText(""); + String atext1 = "fine."; + String atext2 = "messed up."; + atext = atext1 +"\r\n"+ atext2; + for (int i = 0; i < atext.length(); i++) { + area.append(atext.substring(i, i+1)); + } + System.out.println("before: " + +hexEncode(atext1 +"\r\n"+ atext2)); + System.out.println(" after: "+hexEncode(area.getText())); + String s = area.getText(); + String t = s.substring(s.length()-atext2.length()); + res = t.equals(atext2); + System.out.println("04: " + res); + passed = passed && res; + + area.setText(""); + atext = "\r"; + area.append(atext); + System.out.println("before: "+hexEncode(atext)); + System.out.println(" after: "+hexEncode(area.getText())); + res = area.getText().equals(""); + System.out.println("05: " + res + "\n"); + passed = passed && res; + + if (System.getProperty("os.name").toUpperCase(). + startsWith("WIN")) { + if (!passed) { + throw new RuntimeException("TextAreaCRLFTest FAILED."); + } else { + System.out.println("TextAreaCRLFTest PASSED"); + } + } else { + System.out.println("This is a Windows oriented testcase."); + } + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (aDialog != null) { + aDialog.dispose(); + } + }); + } + } + + private static String hexEncode(String str) { + return hexEncode(str.getBytes()); + } + + private static String hexEncode(byte[] bytes) { + StringBuffer buffer = new StringBuffer(bytes.length * 2); + for (int i = 0; i < bytes.length; i++) { + byte b = bytes[i]; + buffer.append(DIGITS[(b & 0xF0) >> 4]); + buffer.append(DIGITS[b & 0x0F]); + } + return buffer.toString(); + } +} diff --git a/test/jdk/java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java b/test/jdk/java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java new file mode 100644 index 00000000000..a2c8613efc9 --- /dev/null +++ b/test/jdk/java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4290704 + @summary Test use of AWTEventListenerProxyTest class +*/ + +import java.awt.AWTEvent; +import java.awt.EventQueue; +import java.awt.Toolkit; +import java.awt.event.AWTEventListener; +import java.awt.event.AWTEventListenerProxy; +import java.util.EventListener; + +public class AWTEventListenerProxyTest { + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + Toolkit tk = Toolkit.getDefaultToolkit(); + if ("sun.awt.X11.XToolkit".equals(tk.getClass().getName())) { + System.out.println("Do not test for XAWT Toolkit."); + System.out.println("Passing automatically."); + return; + } + + // check that if no listeners added, returns a 0-length array, + // not null + AWTEventListener[] array1 = tk.getAWTEventListeners(); + if (array1 == null || array1.length != 0) { + System.out.println("[Empty array test failed!!]"); + throw new RuntimeException("Test failed -" + + " didn't return 0-sized array"); + } + System.out.println("[Empty array test passed]"); + + // simple add/get test + DumbListener dl1 = new DumbListener(); + final long dl1MASK = AWTEvent.ACTION_EVENT_MASK; + tk.addAWTEventListener(dl1, dl1MASK); + + array1 = tk.getAWTEventListeners(); + if (array1 == null || array1.length != 1) { + System.out.println("[Simple add/get test failed!!]"); + throw new RuntimeException("Test failed - didn't " + + "return array of 1"); + } + AWTEventListenerProxy dp1 = (AWTEventListenerProxy) array1[0]; + EventListener getdl1 = dp1.getListener(); + if (getdl1 != dl1) { + System.out.println("[Simple add/get test failed - " + + "wrong listener!!]"); + throw new RuntimeException("Test failed - wrong " + + "listener in proxy"); + } + + long getmask = dp1.getEventMask(); + if (getmask != dl1MASK) { + System.out.println("[Simple add/get test failed - " + + "wrong mask!!]"); + throw new RuntimeException("Test failed - wrong mask in proxy"); + } + System.out.println("[Simple add/get test passed]"); + + // add the same listener inside a proxy, with a different mask + // should get back one listener, with the ORed mask + final long dl2MASK = AWTEvent.CONTAINER_EVENT_MASK; + AWTEventListenerProxy newp = new AWTEventListenerProxy(dl2MASK, + dl1); + tk.addAWTEventListener(newp, dl2MASK); + array1 = tk.getAWTEventListeners(); + if (array1.length != 1) { + System.out.println("[Proxy add/get test failed!!]"); + throw new RuntimeException("Test failed - added proxy, " + + "but didn't return array of 1"); + } + dp1 = (AWTEventListenerProxy) array1[0]; + getdl1 = dp1.getListener(); + if (getdl1 != dl1) { + System.out.println("[Proxy add/get test " + + "failed - wrong listener!!]"); + throw new RuntimeException("Test failed - added proxy, " + + "wrong listener in proxy"); + } + getmask = dp1.getEventMask(); + if (getmask != (dl1MASK | dl2MASK)) { + System.out.println("[Proxy add/get test failed - " + + "wrong mask!!]"); + throw new RuntimeException("Test failed - added proxy, " + + "wrong mask in proxy"); + } + System.out.println("[Proxy add/get test passed]"); + + // add some other listener + DumbListener dl3 = new DumbListener(); + final long dl3MASK = AWTEvent.FOCUS_EVENT_MASK; + tk.addAWTEventListener(dl3, dl3MASK); + + // test getting with a mask for a listener already added + array1 = tk.getAWTEventListeners(dl1MASK); + if (array1.length != 1) { + System.out.println("[Get w/ mask test failed!! - " + + "not 1 listener!]"); + throw new RuntimeException("Test failed - tried to " + + "get w/ mask"); + } + dp1 = (AWTEventListenerProxy) array1[0]; + getdl1 = dp1.getListener(); + if (getdl1 != dl1) { + System.out.println("[Get w/ mask test failed!! - " + + "wrong listener]"); + throw new RuntimeException("Test failed - tried to get " + + "w/ mask, wrong listener in proxy"); + } + System.out.println("[Get w/ mask test passed]"); + + // test getting with a mask for a listener not added + array1 = tk.getAWTEventListeners(AWTEvent.MOUSE_EVENT_MASK); + if (array1.length != 0) { + System.out.println("[Get w/ mask test 2 failed!! - " + + "not 0 listeners!]"); + throw new RuntimeException("Test failed - tried to get " + + "w/ mask 2"); + } + System.out.println("[Get w/ mask test 2 passed]"); + + + // test getting with a compound mask for a listener already added + array1 = tk.getAWTEventListeners(dl1MASK | dl2MASK); + if (array1.length != 1) { + System.out.println("[Get w/ compound mask test failed!! - " + + "not 1 listeners!]"); + throw new RuntimeException("Test failed - tried to get w/ 2 " + + "ORed masks"); + } + dp1 = (AWTEventListenerProxy) array1[0]; + getdl1 = dp1.getListener(); + if (getdl1 != dl1) { + System.out.println("[Get w/ compound mask test failed!! - " + + "wrong listener]"); + throw new RuntimeException("Test failed - tried to get w/ " + + "compound mask, wrong listener in proxy"); + } + System.out.println("[Get w/ compound mask test passed]"); + }); + } + + public static class DumbListener implements AWTEventListener { + public DumbListener() {} + public void eventDispatched(AWTEvent e) {} + } +} diff --git a/test/jdk/java/awt/Toolkit/ListenersDeadlockTest/ListenerDeadlockTest.java b/test/jdk/java/awt/Toolkit/ListenersDeadlockTest/ListenerDeadlockTest.java new file mode 100644 index 00000000000..11a3f34c1e4 --- /dev/null +++ b/test/jdk/java/awt/Toolkit/ListenersDeadlockTest/ListenerDeadlockTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 4338463 + @summary excessive synchronization in notifyAWTEventListeners leads to + deadlock +*/ + +import java.awt.AWTEvent; +import java.awt.EventQueue; +import java.awt.Panel; +import java.awt.Toolkit; +import java.awt.event.AWTEventListener; +import java.awt.event.ActionEvent; + +public class ListenerDeadlockTest { + public static final Object lock = new Object(); + + public static final Toolkit toolkit = Toolkit.getDefaultToolkit(); + + public static Panel panel = new Panel(); + + public static final AWTEventListener listener = new AWTEventListener() { + public void eventDispatched(AWTEvent e) { + if (e.getSource() == panel) { + System.out.println(e); + System.out.println("No deadlock"); + synchronized(lock) { + lock.notifyAll(); + } + } + } + }; + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + toolkit.addAWTEventListener(listener, -1); + + Thread thread = new Thread(new Runnable() { + public void run() { + synchronized (toolkit) { + synchronized (lock) { + try { + lock.notifyAll(); + lock.wait(); + } catch (InterruptedException ex) { + } + } + } + } + }); + + synchronized (lock) { + thread.start(); + try { + lock.wait(); + } catch (InterruptedException ex) { + } + } + + panel.dispatchEvent(new ActionEvent(panel, + ActionEvent.ACTION_PERFORMED, "Try")); + }); + } +} diff --git a/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java b/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java index fe0346d95ec..7bc50cbb142 100644 --- a/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java +++ b/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java @@ -65,8 +65,8 @@ public class NoFormatsDropTest implements AWTEventListener { Frame frame; - DragSourcePanel dragSourcePanel; - DropTargetPanel dropTargetPanel; + volatile DragSourcePanel dragSourcePanel; + volatile DropTargetPanel dropTargetPanel; static final int FRAME_ACTIVATION_TIMEOUT = 1000; static final int DROP_COMPLETION_TIMEOUT = 1000; @@ -103,7 +103,6 @@ public void start() throws InterruptedException, AWTException, InvocationTargetException { try { Robot robot = new Robot(); - robot.setAutoWaitForIdle(true); robot.delay(FRAME_ACTIVATION_TIMEOUT); final Point srcPoint = dragSourcePanel.getLocationOnScreen(); @@ -134,6 +133,7 @@ public void start() throws InterruptedException, AWTException, robot.mouseMove(curPoint.x, curPoint.y); robot.delay(100); } + robot.waitForIdle(); robot.keyRelease(KeyEvent.VK_CONTROL); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); @@ -244,7 +244,7 @@ public Object getTransferData(DataFlavor df) class DropTargetPanel extends Panel implements DropTargetListener { final Dimension preferredDimension = new Dimension(200, 100); - boolean passed = false; + volatile boolean passed = false; public DropTargetPanel() { setDropTarget(new DropTarget(this, this)); diff --git a/test/jdk/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java b/test/jdk/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java index 0e1f06e2cf1..e8f3e21de11 100644 --- a/test/jdk/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java +++ b/test/jdk/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. * 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,13 +25,20 @@ @test @key headful @bug 6497426 - @summary ests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols - @run main CtrlASCII + @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols + @run main/timeout=600 CtrlASCII */ -import java.awt.*; -import java.awt.event.*; -import java.util.*; +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.HashMap; // // In this test, a key listener for KEY_TYPED checks if a character typed has @@ -42,136 +49,135 @@ // produce a unicode character, so there will be no KEY_TYPED and no problem. // Test doesn't try to verify Ctrl+deadkey behavior. // -public class CtrlASCII extends Frame implements KeyListener -{ +public class CtrlASCII extends Frame implements KeyListener { // Declare things used in the test, like buttons and labels here - static Hashtable keycharHash = new Hashtable(); - static boolean testFailed = false; - //Frame frame; + static final HashMap KEYCHAR_MAP = new HashMap<>(); + static volatile boolean testFailed = false; + TextField tf; Robot robot; - static void fillHash( boolean isMSWindows ) { - keycharHash.put( (char)0x20 , KeyEvent.VK_SPACE ); /*32,x20*/ /*' ' */ - keycharHash.put( (char)0x21 , KeyEvent.VK_EXCLAMATION_MARK ); /*33,x21*/ /*'!' fr*/ - keycharHash.put( (char)0x22 , KeyEvent.VK_QUOTEDBL ); /*34,x22*/ /*'"' fr*/ - keycharHash.put( (char)0x23 , KeyEvent.VK_NUMBER_SIGN ); /*35,x23*/ /*'#' de*/ - keycharHash.put( (char)0x24 , KeyEvent.VK_DOLLAR ); /*36,x24*/ /*'$', de_CH*/ - //keycharHash.put('%', (char)0x25 ); /*37,x25*/ /*no VK, cannot test*/ - keycharHash.put( (char)0x26 , KeyEvent.VK_AMPERSAND ); /*38,x26*/ /*'&', fr*/ - keycharHash.put( (char)0x27 , KeyEvent.VK_QUOTE ); /*39,x27*/ /*''', fr*/ - keycharHash.put( (char)0x28 , KeyEvent.VK_LEFT_PARENTHESIS ); /*40,x28*/ /*'(', fr*/ - keycharHash.put( (char)0x29 , KeyEvent.VK_RIGHT_PARENTHESIS ); /*41,x29*/ /*')', fr*/ - keycharHash.put( (char)0x2a , KeyEvent.VK_ASTERISK ); /*42,x2a*/ /*'*', fr*/ - keycharHash.put( (char)0x2b , KeyEvent.VK_PLUS ); /*43,x2b*/ /*'+', de*/ - keycharHash.put( (char)0x2c , KeyEvent.VK_COMMA ); /*44,x2c*/ /*','*/ - keycharHash.put( (char)0x2d , KeyEvent.VK_MINUS ); /*45,x2d*/ /*'-'*/ - keycharHash.put( (char)0x2e , KeyEvent.VK_PERIOD ); /*46,x2e*/ /*'.'*/ - keycharHash.put( (char)0x2f , KeyEvent.VK_SLASH ); /*47,x2f*/ /*'/'*/ - keycharHash.put( (char)0x30 , KeyEvent.VK_0 ); /*48,x30*/ - keycharHash.put( (char)0x31 , KeyEvent.VK_1 ); /*49,x31*/ - keycharHash.put( (char)0x32 , KeyEvent.VK_2 ); /*50,x32*/ - keycharHash.put( (char)0x33 , KeyEvent.VK_3 ); /*51,x33*/ - keycharHash.put( (char)0x34 , KeyEvent.VK_4 ); /*52,x34*/ - keycharHash.put( (char)0x35 , KeyEvent.VK_5 ); /*53,x35*/ - keycharHash.put( (char)0x36 , KeyEvent.VK_6 ); /*54,x36*/ - keycharHash.put( (char)0x37 , KeyEvent.VK_7 ); /*55,x37*/ - keycharHash.put( (char)0x38 , KeyEvent.VK_8 ); /*56,x38*/ - keycharHash.put( (char)0x39 , KeyEvent.VK_9 ); /*57,x39*/ - keycharHash.put( (char)0x3a , KeyEvent.VK_COLON ); /*58,x3a*/ /*':', fr*/ - keycharHash.put( (char)0x3b , KeyEvent.VK_SEMICOLON ); /*59,x3b*/ /*';'*/ - keycharHash.put( (char)0x3c , KeyEvent.VK_LESS ); /*60,x3c*/ /*'<' us 102*/ - keycharHash.put( (char)0x3d , KeyEvent.VK_EQUALS ); /*61,x3d*/ - keycharHash.put( (char)0x3e , KeyEvent.VK_GREATER ); /*62,x3e*/ /*'>' ?????? where???*/ - // Javadoc says: "there is no keycode for the question mark because - // there is no keyboard for which it appears on the primary layer." - // Well, it's Lithuanian standard. - //keycharHash.put('?', (char)0x3f ); /*63,x3f*/ /*no VK, cannot test*/ - keycharHash.put( (char)0x40 , KeyEvent.VK_AT ); /*64,x40*/ /*'@' ?????? where???*/ - keycharHash.put( (char)0x1 , KeyEvent.VK_A ); /*65,x41*/ - keycharHash.put( (char)0x2 , KeyEvent.VK_B ); /*66,x42*/ - keycharHash.put( (char)0x3 , KeyEvent.VK_C ); /*67,x43*/ - keycharHash.put( (char)0x4 , KeyEvent.VK_D ); /*68,x44*/ - keycharHash.put( (char)0x5 , KeyEvent.VK_E ); /*69,x45*/ - keycharHash.put( (char)0x6 , KeyEvent.VK_F ); /*70,x46*/ - keycharHash.put( (char)0x7 , KeyEvent.VK_G ); /*71,x47*/ - keycharHash.put( (char)0x8 , KeyEvent.VK_H ); /*72,x48*/ - keycharHash.put( (char)0x9 , KeyEvent.VK_I ); /*73,x49*/ - keycharHash.put( (char)0xa , KeyEvent.VK_J ); /*74,x4a*/ - keycharHash.put( (char)0xb , KeyEvent.VK_K ); /*75,x4b*/ - keycharHash.put( (char)0xc , KeyEvent.VK_L ); /*76,x4c*/ - keycharHash.put( (char)0xd , KeyEvent.VK_M ); /*77,x4d*/ - keycharHash.put( (char)0xe , KeyEvent.VK_N ); /*78,x4e*/ - keycharHash.put( (char)0xf , KeyEvent.VK_O ); /*79,x4f*/ - keycharHash.put( (char)0x10 , KeyEvent.VK_P ); /*80,x50*/ - keycharHash.put( (char)0x11 , KeyEvent.VK_Q ); /*81,x51*/ - keycharHash.put( (char)0x12 , KeyEvent.VK_R ); /*82,x52*/ - keycharHash.put( (char)0x13 , KeyEvent.VK_S ); /*83,x53*/ - keycharHash.put( (char)0x14 , KeyEvent.VK_T ); /*84,x54*/ - keycharHash.put( (char)0x15 , KeyEvent.VK_U ); /*85,x55*/ - keycharHash.put( (char)0x16 , KeyEvent.VK_V ); /*86,x56*/ - keycharHash.put( (char)0x17 , KeyEvent.VK_W ); /*87,x57*/ - keycharHash.put( (char)0x18 , KeyEvent.VK_X ); /*88,x58*/ - keycharHash.put( (char)0x19 , KeyEvent.VK_Y ); /*89,x59*/ - keycharHash.put( (char)0x1a , KeyEvent.VK_Z ); /*90,x5a*/ - - keycharHash.put( (char)0x1b , KeyEvent.VK_OPEN_BRACKET ); /*91,x5b*/ /*'['*/ - keycharHash.put( (char)0x1c , KeyEvent.VK_BACK_SLASH ); /*92,x5c*/ /*'\'*/ - keycharHash.put( (char)0x1d , KeyEvent.VK_CLOSE_BRACKET ); /*93,x5d*/ /*']'*/ - keycharHash.put( (char)0x5e , KeyEvent.VK_CIRCUMFLEX ); /*94,x5e*/ /*'^' ?? nodead fr, de??*/ - keycharHash.put( (char)0x1f , KeyEvent.VK_UNDERSCORE ); /*95,x5f*/ /*'_' fr*/ - keycharHash.put( (char)0x60 , KeyEvent.VK_BACK_QUOTE ); /*96,x60*/ - /********* Same as uppercase*/ - //keycharHash.put( (char)0x1 , KeyEvent.VK_a );/*97,x61*/ - //keycharHash.put( (char)0x2 , KeyEvent.VK_b );/*98,x62*/ - //keycharHash.put( (char)0x3 , KeyEvent.VK_c );/*99,x63*/ - //keycharHash.put( (char)0x4 , KeyEvent.VK_d );/*100,x64*/ - //keycharHash.put( (char)0x5 , KeyEvent.VK_e );/*101,x65*/ - //keycharHash.put( (char)0x6 , KeyEvent.VK_f );/*102,x66*/ - //keycharHash.put( (char)0x7 , KeyEvent.VK_g );/*103,x67*/ - //keycharHash.put( (char)0x8 , KeyEvent.VK_h );/*104,x68*/ - //keycharHash.put( (char)0x9 , KeyEvent.VK_i );/*105,x69*/ - //keycharHash.put( (char)0xa , KeyEvent.VK_j );/*106,x6a*/ - //keycharHash.put( (char)0xb , KeyEvent.VK_k );/*107,x6b*/ - //keycharHash.put( (char)0xc , KeyEvent.VK_l );/*108,x6c*/ - //keycharHash.put( (char)0xd , KeyEvent.VK_m );/*109,x6d*/ - //keycharHash.put( (char)0xe , KeyEvent.VK_n );/*110,x6e*/ - //keycharHash.put( (char)0xf , KeyEvent.VK_o );/*111,x6f*/ - //keycharHash.put( (char)0x10 , KeyEvent.VK_p );/*112,x70*/ - //keycharHash.put( (char)0x11 , KeyEvent.VK_q );/*113,x71*/ - //keycharHash.put( (char)0x12 , KeyEvent.VK_r );/*114,x72*/ - //keycharHash.put( (char)0x13 , KeyEvent.VK_s );/*115,x73*/ - //keycharHash.put( (char)0x14 , KeyEvent.VK_t );/*116,x74*/ - //keycharHash.put( (char)0x15 , KeyEvent.VK_u );/*117,x75*/ - //keycharHash.put( (char)0x16 , KeyEvent.VK_v );/*118,x76*/ - //keycharHash.put( (char)0x17 , KeyEvent.VK_w );/*119,x77*/ - //keycharHash.put( (char)0x18 , KeyEvent.VK_x );/*120,x78*/ - //keycharHash.put( (char)0x19 , KeyEvent.VK_y );/*121,x79*/ - //keycharHash.put( (char)0x1a , KeyEvent.VK_z );/*122,x7a*/ + static void fillHash() { + KEYCHAR_MAP.put((char) 0x20, KeyEvent.VK_SPACE); /*32,x20*/ /*' ' */ + KEYCHAR_MAP.put((char) 0x21, KeyEvent.VK_EXCLAMATION_MARK); /*33,x21*/ /*'!' fr*/ + KEYCHAR_MAP.put((char) 0x22, KeyEvent.VK_QUOTEDBL); /*34,x22*/ /*'"' fr*/ + KEYCHAR_MAP.put((char) 0x23, KeyEvent.VK_NUMBER_SIGN); /*35,x23*/ /*'#' de*/ + KEYCHAR_MAP.put((char) 0x24, KeyEvent.VK_DOLLAR); /*36,x24*/ /*'$', de_CH*/ + //keycharHash.put('%', (char)0x25 ); /*37,x25*/ /*no VK, cannot test*/ + KEYCHAR_MAP.put((char) 0x26, KeyEvent.VK_AMPERSAND); /*38,x26*/ /*'&', fr*/ + KEYCHAR_MAP.put((char) 0x27, KeyEvent.VK_QUOTE); /*39,x27*/ /*''', fr*/ + KEYCHAR_MAP.put((char) 0x28, KeyEvent.VK_LEFT_PARENTHESIS); /*40,x28*/ /*'(', fr*/ + KEYCHAR_MAP.put((char) 0x29, KeyEvent.VK_RIGHT_PARENTHESIS); /*41,x29*/ /*')', fr*/ + KEYCHAR_MAP.put((char) 0x2a, KeyEvent.VK_ASTERISK); /*42,x2a*/ /*'*', fr*/ + KEYCHAR_MAP.put((char) 0x2b, KeyEvent.VK_PLUS); /*43,x2b*/ /*'+', de*/ + KEYCHAR_MAP.put((char) 0x2c, KeyEvent.VK_COMMA); /*44,x2c*/ /*','*/ + KEYCHAR_MAP.put((char) 0x2d, KeyEvent.VK_MINUS); /*45,x2d*/ /*'-'*/ + KEYCHAR_MAP.put((char) 0x2e, KeyEvent.VK_PERIOD); /*46,x2e*/ /*'.'*/ + KEYCHAR_MAP.put((char) 0x2f, KeyEvent.VK_SLASH); /*47,x2f*/ /*'/'*/ + KEYCHAR_MAP.put((char) 0x30, KeyEvent.VK_0); /*48,x30*/ + KEYCHAR_MAP.put((char) 0x31, KeyEvent.VK_1); /*49,x31*/ + KEYCHAR_MAP.put((char) 0x32, KeyEvent.VK_2); /*50,x32*/ + KEYCHAR_MAP.put((char) 0x33, KeyEvent.VK_3); /*51,x33*/ + KEYCHAR_MAP.put((char) 0x34, KeyEvent.VK_4); /*52,x34*/ + KEYCHAR_MAP.put((char) 0x35, KeyEvent.VK_5); /*53,x35*/ + KEYCHAR_MAP.put((char) 0x36, KeyEvent.VK_6); /*54,x36*/ + KEYCHAR_MAP.put((char) 0x37, KeyEvent.VK_7); /*55,x37*/ + KEYCHAR_MAP.put((char) 0x38, KeyEvent.VK_8); /*56,x38*/ + KEYCHAR_MAP.put((char) 0x39, KeyEvent.VK_9); /*57,x39*/ + KEYCHAR_MAP.put((char) 0x3a, KeyEvent.VK_COLON); /*58,x3a*/ /*':', fr*/ + KEYCHAR_MAP.put((char) 0x3b, KeyEvent.VK_SEMICOLON); /*59,x3b*/ /*';'*/ + KEYCHAR_MAP.put((char) 0x3c, KeyEvent.VK_LESS); /*60,x3c*/ /*'<' us 102*/ + KEYCHAR_MAP.put((char) 0x3d, KeyEvent.VK_EQUALS); /*61,x3d*/ + KEYCHAR_MAP.put((char) 0x3e, KeyEvent.VK_GREATER); /*62,x3e*/ /*'>' ?????? where???*/ + // Javadoc says: "there is no keycode for the question mark because + // there is no keyboard for which it appears on the primary layer." + // Well, it's Lithuanian standard. + //keycharHash.put('?', (char)0x3f); /*63,x3f*/ /*no VK, cannot test*/ + KEYCHAR_MAP.put((char) 0x40, KeyEvent.VK_AT); /*64,x40*/ /*'@' ?????? where???*/ + KEYCHAR_MAP.put((char) 0x1, KeyEvent.VK_A); /*65,x41*/ + KEYCHAR_MAP.put((char) 0x2, KeyEvent.VK_B); /*66,x42*/ + KEYCHAR_MAP.put((char) 0x3, KeyEvent.VK_C); /*67,x43*/ + KEYCHAR_MAP.put((char) 0x4, KeyEvent.VK_D); /*68,x44*/ + KEYCHAR_MAP.put((char) 0x5, KeyEvent.VK_E); /*69,x45*/ + KEYCHAR_MAP.put((char) 0x6, KeyEvent.VK_F); /*70,x46*/ + KEYCHAR_MAP.put((char) 0x7, KeyEvent.VK_G); /*71,x47*/ + KEYCHAR_MAP.put((char) 0x8, KeyEvent.VK_H); /*72,x48*/ + KEYCHAR_MAP.put((char) 0x9, KeyEvent.VK_I); /*73,x49*/ + KEYCHAR_MAP.put((char) 0xa, KeyEvent.VK_J); /*74,x4a*/ + KEYCHAR_MAP.put((char) 0xb, KeyEvent.VK_K); /*75,x4b*/ + KEYCHAR_MAP.put((char) 0xc, KeyEvent.VK_L); /*76,x4c*/ + KEYCHAR_MAP.put((char) 0xd, KeyEvent.VK_M); /*77,x4d*/ + KEYCHAR_MAP.put((char) 0xe, KeyEvent.VK_N); /*78,x4e*/ + KEYCHAR_MAP.put((char) 0xf, KeyEvent.VK_O); /*79,x4f*/ + KEYCHAR_MAP.put((char) 0x10, KeyEvent.VK_P); /*80,x50*/ + KEYCHAR_MAP.put((char) 0x11, KeyEvent.VK_Q); /*81,x51*/ + KEYCHAR_MAP.put((char) 0x12, KeyEvent.VK_R); /*82,x52*/ + KEYCHAR_MAP.put((char) 0x13, KeyEvent.VK_S); /*83,x53*/ + KEYCHAR_MAP.put((char) 0x14, KeyEvent.VK_T); /*84,x54*/ + KEYCHAR_MAP.put((char) 0x15, KeyEvent.VK_U); /*85,x55*/ + KEYCHAR_MAP.put((char) 0x16, KeyEvent.VK_V); /*86,x56*/ + KEYCHAR_MAP.put((char) 0x17, KeyEvent.VK_W); /*87,x57*/ + KEYCHAR_MAP.put((char) 0x18, KeyEvent.VK_X); /*88,x58*/ + KEYCHAR_MAP.put((char) 0x19, KeyEvent.VK_Y); /*89,x59*/ + KEYCHAR_MAP.put((char) 0x1a, KeyEvent.VK_Z); /*90,x5a*/ - keycharHash.put( (char)0x7b , KeyEvent.VK_BRACELEFT ); /*123,x7b*/ /*'{' la (Latin American)*/ - //keycharHash.put( (char)0x1c , KeyEvent.VK_| ); /*124,x7c*/ /* no VK, cannot test*/ - keycharHash.put( (char)0x7d , KeyEvent.VK_BRACERIGHT ); /*125,x7d*/ /*'}' la */ - //keycharHash.put( (char)0x1e , KeyEvent.VK_~ ); /*126,x7e*/ /* no VK, cannot test*/ + KEYCHAR_MAP.put((char) 0x1b, KeyEvent.VK_OPEN_BRACKET); /*91,x5b*/ /*'['*/ + KEYCHAR_MAP.put((char) 0x1c, KeyEvent.VK_BACK_SLASH); /*92,x5c*/ /*'\'*/ + KEYCHAR_MAP.put((char) 0x1d, KeyEvent.VK_CLOSE_BRACKET); /*93,x5d*/ /*']'*/ + KEYCHAR_MAP.put((char) 0x5e, KeyEvent.VK_CIRCUMFLEX); /*94,x5e*/ /*'^' ?? nodead fr, de??*/ + KEYCHAR_MAP.put((char) 0x1f, KeyEvent.VK_UNDERSCORE); /*95,x5f*/ /*'_' fr*/ + KEYCHAR_MAP.put((char) 0x60, KeyEvent.VK_BACK_QUOTE); /*96,x60*/ + /********* Same as uppercase*/ + //keycharHash.put((char)0x1, KeyEvent.VK_a); /*97,x61*/ + //keycharHash.put((char)0x2, KeyEvent.VK_b); /*98,x62*/ + //keycharHash.put((char)0x3, KeyEvent.VK_c); /*99,x63*/ + //keycharHash.put((char)0x4, KeyEvent.VK_d); /*100,x64*/ + //keycharHash.put((char)0x5, KeyEvent.VK_e); /*101,x65*/ + //keycharHash.put((char)0x6, KeyEvent.VK_f); /*102,x66*/ + //keycharHash.put((char)0x7, KeyEvent.VK_g); /*103,x67*/ + //keycharHash.put((char)0x8, KeyEvent.VK_h); /*104,x68*/ + //keycharHash.put((char)0x9, KeyEvent.VK_i); /*105,x69*/ + //keycharHash.put((char)0xa, KeyEvent.VK_j); /*106,x6a*/ + //keycharHash.put((char)0xb, KeyEvent.VK_k); /*107,x6b*/ + //keycharHash.put((char)0xc, KeyEvent.VK_l); /*108,x6c*/ + //keycharHash.put((char)0xd, KeyEvent.VK_m); /*109,x6d*/ + //keycharHash.put((char)0xe, KeyEvent.VK_n); /*110,x6e*/ + //keycharHash.put((char)0xf, KeyEvent.VK_o); /*111,x6f*/ + //keycharHash.put((char)0x10, KeyEvent.VK_p); /*112,x70*/ + //keycharHash.put((char)0x11, KeyEvent.VK_q); /*113,x71*/ + //keycharHash.put((char)0x12, KeyEvent.VK_r); /*114,x72*/ + //keycharHash.put((char)0x13, KeyEvent.VK_s); /*115,x73*/ + //keycharHash.put((char)0x14, KeyEvent.VK_t); /*116,x74*/ + //keycharHash.put((char)0x15, KeyEvent.VK_u); /*117,x75*/ + //keycharHash.put((char)0x16, KeyEvent.VK_v); /*118,x76*/ + //keycharHash.put((char)0x17, KeyEvent.VK_w); /*119,x77*/ + //keycharHash.put((char)0x18, KeyEvent.VK_x); /*120,x78*/ + //keycharHash.put((char)0x19, KeyEvent.VK_y); /*121,x79*/ + //keycharHash.put((char)0x1a, KeyEvent.VK_z); /*122,x7a*/ + KEYCHAR_MAP.put((char) 0x7b, KeyEvent.VK_BRACELEFT); /*123,x7b*/ /*'{' la (Latin American)*/ + //keycharHash.put(char) 0x1c, KeyEvent.VK_|); /*124,x7c*/ /* no VK, cannot test*/ + KEYCHAR_MAP.put((char) 0x7d, KeyEvent.VK_BRACERIGHT); /*125,x7d*/ /*'}' la */ + //keycharHash.put((char) 0x1e, KeyEvent.VK_~); /*126,x7e*/ /* no VK, cannot test*/ } - public static void main(String[] args) { + + public static void main(String[] args) throws AWTException { CtrlASCII test = new CtrlASCII(); test.init(); test.start(); } - public void init() - { - fillHash( false ); - this.setLayout (new BorderLayout ()); + public void init() throws AWTException { + fillHash(); - }//End init() + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(100); - public void start () - { - setSize(400,300); + setLayout(new BorderLayout()); + + setSize(400, 300); setLocationRelativeTo(null); setVisible(true); @@ -181,87 +187,83 @@ public void start () tf.addKeyListener(this); validate(); - try { - robot = new Robot(); - robot.setAutoWaitForIdle(true); - robot.setAutoDelay(100); + robot.waitForIdle(); + robot.delay(1000); - robot.waitForIdle(); + this.requestFocus(); + tf.requestFocusInWindow(); - // wait for focus, etc. (Hack.) - robot.delay(2000); - this.requestFocus(); - tf.requestFocusInWindow(); + robot.waitForIdle(); + }//End init() + public void start() { + try { Point pt = getLocationOnScreen(); - robot.mouseMove( pt.x+100, pt.y+100 ); - robot.delay(2000); - robot.mousePress( InputEvent.BUTTON1_MASK ); - robot.mouseRelease( InputEvent.BUTTON1_MASK ); - Enumeration enuElem = keycharHash.elements(); + robot.mouseMove(pt.x + 100, pt.y + 100); + robot.delay(1000); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + KEYCHAR_MAP.forEach((k, v) -> punchCtrlKey(v)); - int kc; - while( enuElem.hasMoreElements()) { - kc = enuElem.nextElement(); - punchCtrlKey( robot, kc ); - } robot.delay(500); } catch (Exception e) { throw new RuntimeException("The test was not completed.\n\n" + e); + } finally { + dispose(); } - if( testFailed ) { + if (testFailed) { throw new RuntimeException("The test failed.\n\n"); } System.out.println("Success\n"); }// start() - public void punchCtrlKey( Robot ro, int keyCode ) { - ro.keyPress(KeyEvent.VK_CONTROL); + + public void punchCtrlKey(int keyCode) { try { - ro.keyPress(keyCode); - ro.keyRelease(keyCode); - }catch(IllegalArgumentException iae) { - System.err.println("skip probably invalid keyCode "+keyCode); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(keyCode); + } catch (IllegalArgumentException iae) { + System.err.println("skip probably invalid keyCode " + keyCode); + } finally { + try { + robot.keyRelease(keyCode); + } catch (IllegalArgumentException iae) { + System.err.println("skip probably invalid keyCode " + keyCode); + } + robot.keyRelease(KeyEvent.VK_CONTROL); } - ro.keyRelease(KeyEvent.VK_CONTROL); - ro.delay(200); + robot.delay(200); } - public void keyPressed(KeyEvent evt) - { + + public void keyPressed(KeyEvent evt) { //printKey(evt); } - public void keyTyped(KeyEvent evt) - { + public void keyTyped(KeyEvent evt) { printKey(evt); char keych = evt.getKeyChar(); - if( !keycharHash.containsKey( keych ) ) { - System.out.println("Unexpected keychar: "+keych); - System.out.println("Unexpected keychar: "+keych); + if (!KEYCHAR_MAP.containsKey(keych)) { + System.out.println("Unexpected keychar: " + keych); testFailed = true; } } - public void keyReleased(KeyEvent evt) - { + public void keyReleased(KeyEvent evt) { //printKey(evt); } - protected void printKey(KeyEvent evt) - { - switch(evt.getID()) - { - case KeyEvent.KEY_TYPED: - case KeyEvent.KEY_PRESSED: - case KeyEvent.KEY_RELEASED: - break; - default: - System.out.println("Other Event "); - System.out.println("Other Event "); - return; + protected void printKey(KeyEvent evt) { + switch (evt.getID()) { + case KeyEvent.KEY_TYPED: + case KeyEvent.KEY_PRESSED: + case KeyEvent.KEY_RELEASED: + break; + default: + System.out.println("Other Event "); + return; } - System.out.print(" 0x"+ Integer.toHexString(evt.getKeyChar())); - System.out.println (" 0x"+ Integer.toHexString(evt.getKeyChar())); + System.out.println(" 0x" + Integer.toHexString(evt.getKeyChar())); } }// class CtrlASCII diff --git a/test/jdk/java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java b/test/jdk/java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java index 278e862421d..9af56ba044b 100644 --- a/test/jdk/java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java +++ b/test/jdk/java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicReference; import javax.swing.JButton; import javax.swing.JFrame; @@ -55,7 +55,7 @@ public final class MultipleContextsFunctionalTest { private static final int CHECK_LAPSE = 100; private static final int MAX_COUNT = MAX_TIME / INTERVAL; private static final int EXPECTED = MAX_COUNT * NUM_WINDOW; - private static final List WINDOWS = new ArrayList(); + private static final List WINDOWS = new CopyOnWriteArrayList<>(); public static void main(String[] args) { for (int i = 0; i < NUM_WINDOW; i++) { @@ -126,7 +126,7 @@ public void run() { private static final class TestWindow extends JFrame implements ActionListener { private final JButton btn; - private int counter = 0; + private volatile int counter = 0; private final Timer t; TestWindow(final int num) { diff --git a/test/jdk/java/awt/event/StressTest/MouseAndKeyEventStressTest.java b/test/jdk/java/awt/event/StressTest/MouseAndKeyEventStressTest.java new file mode 100644 index 00000000000..2d9563ab2f1 --- /dev/null +++ b/test/jdk/java/awt/event/StressTest/MouseAndKeyEventStressTest.java @@ -0,0 +1,556 @@ +/* + * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.List; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @key headful + * @bug 8302525 + * @summary Test performs various mouse and key operations to check events are getting triggered properly. + * @run main MouseAndKeyEventStressTest + */ +public class MouseAndKeyEventStressTest { + + private volatile static int mouseButtonTypes[] = + { InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, + InputEvent.BUTTON3_DOWN_MASK }; + private volatile static String mouseButtonNames[] = + { "BUTTON1", "BUTTON2", "BUTTON3" }; + + private static Frame frame; + private volatile static Canvas canvas; + private volatile static Button button; + private volatile static List list; + private volatile static Choice choice; + private volatile static Checkbox checkbox; + private volatile static Component[] components; + + private volatile static boolean keyPressed; + private volatile static boolean keyReleased; + private volatile static boolean mousePressed; + private volatile static boolean mouseReleased; + private volatile static boolean actionPerformed; + private volatile static boolean itemEventPerformed; + + private volatile static Robot robot; + private volatile static Point compAt; + private volatile static Dimension compSize; + + private static void initializeGUI() { + frame = new Frame("Test Frame"); + frame.setLayout(new FlowLayout()); + canvas = new Canvas(); + canvas.setSize(50, 50); + canvas.setBackground(Color.red); + button = new Button("Button"); + list = new List(); + list.add("One"); + list.add("Two"); + list.add("Three"); + choice = new Choice(); + for (int i = 0; i < 8; i++) { + choice.add("Choice " + i); + } + choice.select(3); + checkbox = new Checkbox("Checkbox"); + + components = new Component[] { canvas, button, list, choice, checkbox }; + + button.addActionListener((actionEvent) -> { + actionPerformed = true; + System.out.println("button Got an actionEvent: " + actionEvent); + }); + checkbox.addItemListener((itemEvent) -> { + itemEventPerformed = true; + System.out.println("checkbox Got a ItemEvent: " + itemEvent); + }); + list.addItemListener((itemEvent) -> { + itemEventPerformed = true; + System.out.println("List Got a ItemEvent: " + itemEvent); + }); + choice.addItemListener((itemEvent) -> { + itemEventPerformed = true; + System.out.println("Choice Got a ItemEvent: " + itemEvent); + }); + for (int i = 0; i < components.length; i++) { + components[i].addKeyListener(new KeyAdapter() { + + public void keyPressed(KeyEvent ke) { + System.out.println("Got a keyPressedSource: " + ke); + keyPressed = true; + } + + public void keyReleased(KeyEvent ke) { + System.out.println("Got a keyReleasedSource: " + ke); + keyReleased = true; + } + }); + components[i].addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent me) { + mousePressed = true; + System.out.println("Got a mousePressSource: " + me); + } + + public void mouseReleased(MouseEvent me) { + mouseReleased = true; + System.out.println("Got a mouseReleaseSource: " + me); + } + + }); + frame.add(components[i]); + } + + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(MouseAndKeyEventStressTest::initializeGUI); + doTest(); + } finally { + EventQueue.invokeAndWait(MouseAndKeyEventStressTest::disposeFrame); + } + } + + private static void doTest() throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); + robot.waitForIdle(); + + canvasMouseKeyTest(); + buttonMouseKeyTest(); + listMouseKeyTest(); + choiceMouseKeyTest(); + checkboxMouseKeyTest(); + + System.out.println("Test passed!"); + } + + private static void canvasMouseKeyTest() throws Exception { + Component component = canvas; + robot.waitForIdle(); + + for (int i = 0; i < mouseButtonTypes.length; i++) { + resetValues(); + EventQueue.invokeAndWait(() -> { + compAt = component.getLocationOnScreen(); + compSize = component.getSize(); + }); + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: Moving focus. mousePressed event did not occur for " + + component.getClass()); + } + + resetValues(); + robot.keyPress(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyPressed) { + throw new RuntimeException( + "FAIL: keyPressed event " + "did not occur for " + + component.getClass() + " for key A"); + } + + resetValues(); + robot.mousePress(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: mousePressed event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.mouseRelease(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mouseReleased) { + throw new RuntimeException( + "FAIL: mouseReleased event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyReleased) { + throw new RuntimeException("FAIL: keyReleased event " + + "did not occur for " + component.getClass()); + } + + keyType(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + } + System.out.println("Test passed:" + component); + } + + private static void buttonMouseKeyTest() throws Exception { + Component component = button; + robot.waitForIdle(); + + for (int i = 0; i < mouseButtonTypes.length; i++) { + resetValues(); + EventQueue.invokeAndWait(() -> { + compAt = component.getLocationOnScreen(); + compSize = component.getSize(); + }); + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: Moving focus. mousePressed event did not occur for " + + component.getClass()); + } + + resetValues(); + robot.keyPress(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyPressed) { + throw new RuntimeException( + "FAIL: keyPressed event " + "did not occur for " + + component.getClass() + " for key A"); + } + + resetValues(); + robot.mousePress(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: mousePressed event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.mouseRelease(mouseButtonTypes[i]); + robot.waitForIdle(); + + if (!actionPerformed) { + throw new RuntimeException( + "FAIL: action event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + if (!mouseReleased) { + throw new RuntimeException( + "FAIL: mouseReleased event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyReleased) { + throw new RuntimeException("FAIL: keyReleased event " + + "did not occur for " + component.getClass()); + } + + keyType(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + } + System.out.println("Test passed:" + component); + } + + private static void listMouseKeyTest() throws Exception { + Component component = list; + robot.waitForIdle(); + + for (int i = 0; i < mouseButtonTypes.length; i++) { + resetValues(); + EventQueue.invokeAndWait(() -> { + compAt = component.getLocationOnScreen(); + compSize = component.getSize(); + }); + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: Moving focus. mousePressed event did not occur for " + + component.getClass()); + } + + resetValues(); + robot.keyPress(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyPressed) { + throw new RuntimeException( + "FAIL: keyPressed event " + "did not occur for " + + component.getClass() + " for key A"); + } + + resetValues(); + robot.mousePress(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: mousePressed event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.mouseRelease(mouseButtonTypes[i]); + robot.waitForIdle(); + + if (!itemEventPerformed) { + throw new RuntimeException("FAIL: Item event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + if (!mouseReleased) { + throw new RuntimeException( + "FAIL: mouseReleased event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyReleased) { + throw new RuntimeException("FAIL: keyReleased event " + + "did not occur for " + component.getClass()); + } + + keyType(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + } + System.out.println("Test passed:" + component); + } + + private static void choiceMouseKeyTest() throws Exception { + Component component = choice; + robot.waitForIdle(); + + for (int i = 0; i < mouseButtonTypes.length; i++) { + resetValues(); + EventQueue.invokeAndWait(() -> { + compAt = component.getLocationOnScreen(); + compSize = component.getSize(); + }); + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: Moving focus. mousePressed event did not occur for " + + component.getClass()); + } + + if (component instanceof Choice) { + keyType(KeyEvent.VK_ESCAPE); + } + + resetValues(); + robot.keyPress(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyPressed) { + throw new RuntimeException( + "FAIL: keyPressed event " + "did not occur for " + + component.getClass() + " for key A"); + } + + resetValues(); + robot.mousePress(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: mousePressed event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + boolean isMac = + System.getProperty("os.name").toLowerCase().contains("os x"); + if (isMac) { + // Choice's pop-up menu is drawn in front of choice. So + // choice can not get mouse events generated by robot, + // that's why test is made to dispath event. + MouseEvent me = + new MouseEvent(choice, MouseEvent.MOUSE_RELEASED, + System.currentTimeMillis(), mouseButtonTypes[i], + compSize.width, compSize.height, 1, false); + choice.dispatchEvent(me); + } else { + robot.mouseRelease(mouseButtonTypes[i]); + } + robot.waitForIdle(); + + if (!mouseReleased) { + throw new RuntimeException( + "FAIL: mouseReleased event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height + 30); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + + if (!itemEventPerformed) { + throw new RuntimeException("FAIL: Item event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyReleased) { + throw new RuntimeException("FAIL: keyReleased event " + + "did not occur for " + component.getClass()); + } + + keyType(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + } + System.out.println("Test passed:" + component); + } + + private static void checkboxMouseKeyTest() throws Exception { + Component component = checkbox; + robot.waitForIdle(); + for (int i = 0; i < mouseButtonTypes.length; i++) { + + resetValues(); + EventQueue.invokeAndWait(() -> { + compAt = component.getLocationOnScreen(); + compSize = component.getSize(); + }); + + robot.mouseMove(compAt.x + compSize.width / 2, + compAt.y + compSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: Moving focus. mousePressed event did not occur for " + + component.getClass()); + } + + resetValues(); + robot.keyPress(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyPressed) { + throw new RuntimeException( + "FAIL: keyPressed event " + "did not occur for " + + component.getClass() + " for key A"); + } + + resetValues(); + robot.mousePress(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mousePressed) { + throw new RuntimeException( + "FAIL: mousePressed event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.mouseRelease(mouseButtonTypes[i]); + robot.waitForIdle(); + if (!mouseReleased) { + throw new RuntimeException( + "FAIL: mouseReleased event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + if (!itemEventPerformed) { + throw new RuntimeException("FAIL: Item event did not occur for " + + component.getClass() + " for " + mouseButtonNames[i]); + } + + resetValues(); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + if (!keyReleased) { + throw new RuntimeException("FAIL: keyReleased event " + + "did not occur for " + component.getClass()); + } + + keyType(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + } + System.out.println("Test passed:" + component); + } + + private static void resetValues() { + keyPressed = false; + keyReleased = false; + mousePressed = false; + mouseReleased = false; + } + + private static void keyType(int key) throws Exception { + robot.keyPress(key); + robot.keyRelease(key); + } + + public static void disposeFrame() { + if (frame != null) { + frame.dispose(); + } + } + +} diff --git a/test/jdk/java/awt/font/FontScaling/StretchedFontTest.java b/test/jdk/java/awt/font/FontScaling/StretchedFontTest.java index 52ea3571a03..db804b3fff7 100644 --- a/test/jdk/java/awt/font/FontScaling/StretchedFontTest.java +++ b/test/jdk/java/awt/font/FontScaling/StretchedFontTest.java @@ -26,6 +26,7 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.File; @@ -62,15 +63,19 @@ public final class StretchedFontTest { new Color(0x7F000000, true) }; + /** Locale for getting font names. */ + private static final Locale ENGLISH_LOCALE = Locale.ENGLISH; + private static final AffineTransform STRETCH_TRANSFORM = AffineTransform.getScaleInstance(2.0, 1.0); public static void main(String[] args) { List errors = Arrays.stream(getLocalGraphicsEnvironment() - .getAvailableFontFamilyNames(Locale.ENGLISH)) + .getAvailableFontFamilyNames(ENGLISH_LOCALE)) .map(family -> new Font(family, Font.PLAIN, FONT_SIZE)) .filter(font -> font.canDisplay(TEXT.codePointAt(0))) + .filter(font -> !isBrokenFont(font)) .map(font -> font.deriveFont(STRETCH_TRANSFORM)) .flatMap(StretchedFontTest::testFont) .filter(Objects::nonNull) @@ -83,6 +88,26 @@ public static void main(String[] args) { } } + /** + * Checks whether the font renders the glyph in {@code TEXT} and + * returns {@code true} if the glyph isn't rendered. + * + * @param font the font to test + * @return {@code true} if the visual bounds of {@code TEXT} are empty, and + * {@code false} otherwise + */ + private static boolean isBrokenFont(final Font font) { + final boolean empty = + font.createGlyphVector(new FontRenderContext(null, false, false), + TEXT) + .getVisualBounds() + .isEmpty(); + if (empty) { + System.err.println("Broken font: " + font.getFontName(ENGLISH_LOCALE)); + } + return empty; + } + /** * Tests the font with a set of text antialiasing hints. * @@ -146,7 +171,7 @@ private static String testFont(final Font font, if (verifyImage(image)) { return null; } - String fontName = font.getFontName(Locale.ENGLISH); + String fontName = font.getFontName(ENGLISH_LOCALE); String hintValue = getHintString(hint); String hexColor = String.format("0x%08x", foreground.getRGB()); saveImage(image, fontName + "-" + hintValue + "-" + hexColor); diff --git a/test/jdk/java/lang/ProcessHandle/InfoTest.java b/test/jdk/java/lang/ProcessHandle/InfoTest.java index e61b374e0cf..9901ee81592 100644 --- a/test/jdk/java/lang/ProcessHandle/InfoTest.java +++ b/test/jdk/java/lang/ProcessHandle/InfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,12 +39,13 @@ import java.util.Random; import java.util.concurrent.TimeUnit; -import jdk.test.lib.Platform; -import jdk.test.lib.Utils; import org.testng.Assert; import org.testng.TestNG; import org.testng.annotations.Test; +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; + /* * @test * @bug 8077350 8081566 8081567 8098852 8136597 @@ -81,7 +82,6 @@ public class InfoTest { } // Main can be used to run the tests from the command line with only testng.jar. - @SuppressWarnings("raw_types") public static void main(String[] args) { Class[] testclass = {InfoTest.class}; TestNG testng = new TestNG(); @@ -160,11 +160,7 @@ public static void test2() { ProcessHandle.Info info = p1.info(); System.out.printf(" info: %s%n", info); - if (info.user().isPresent()) { - String user = info.user().get(); - Assert.assertNotNull(user, "User name"); - Assert.assertEquals(user, whoami, "User name"); - } + assertUser(info); Optional command = info.command(); if (command.isPresent()) { @@ -291,11 +287,8 @@ public static void test3() { ProcessHandle.Info info = p.info(); System.out.printf(" info: %s%n", info); - if (info.user().isPresent()) { - String user = info.user().get(); - Assert.assertNotNull(user); - Assert.assertEquals(user, whoami); - } + assertUser(info); + if (info.command().isPresent()) { String command = info.command().get(); String expected = "sleep"; @@ -397,7 +390,7 @@ public static void test5() { Instant end = Instant.now().plusMillis(500L); while (end.isBefore(Instant.now())) { // burn the cpu time checking the time - long x = r.nextLong(); + r.nextLong(); } if (self.info().totalCpuDuration().isPresent()) { Duration totalCpu = self.info().totalCpuDuration().get(); @@ -410,6 +403,7 @@ public static void test5() { } } } + /** * Check two Durations, the second should be greater than the first or * within the supplied Epsilon. @@ -443,4 +437,31 @@ static Process spawn(String command, String... args) throws IOException { pb.command(list); return pb.start(); } + + /** + * Asserts the expected process user. + * + * The Expected user is determined by creating a file and reading its owner, see static block above. + * + * On Windows, when run privileged as member of the Administrators group, this does not always + * work because new files can be owned by BUILTIN\Administrators instead, depending on system + * settings. In that case we resort to comparing System property user.name, which does not contain + * the domain name, though. + * + * @param info ProcessHanlde info object + */ + static void assertUser(ProcessHandle.Info info) { + if (!info.user().isPresent()) { + return; + } + String user = info.user().get(); + Assert.assertNotNull(user, "User name"); + if (Platform.isWindows() && "BUILTIN\\Administrators".equals(whoami)) { + int bsi = user.lastIndexOf("\\"); + Assert.assertEquals(bsi == -1 ? user : user.substring(bsi + 1), + System.getProperty("user.name"), "User name"); + } else { + Assert.assertEquals(user, whoami, "User name"); + } + } } diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java index 7792df89155..bf41574342d 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,14 @@ abstract class VarHandleBaseTest { static final int ITERS = Integer.getInteger("iters", 1); - static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); + + // More resilience for Weak* tests. These operations may spuriously + // fail, and so we do several attempts with delay on failure. + // Be mindful of worst-case total time on test, which would be at + // roughly (delay*attempts) milliseconds. + // + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 100); + static final int WEAK_DELAY_MS = Math.max(1, Integer.getInteger("weakDelay", 1)); interface ThrowingRunnable { void run() throws Throwable; @@ -490,4 +497,14 @@ static void testTypes(VarHandle vh) { assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType()); } } + + static void weakDelay() { + try { + if (WEAK_DELAY_MS > 0) { + Thread.sleep(WEAK_DELAY_MS); + } + } catch (InterruptedException ie) { + // Do nothing. + } + } } diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java index 47977761d47..e897d87a9f8 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java @@ -442,6 +442,7 @@ static void testInstanceField(VarHandleTestAccessBoolean recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(recv); @@ -459,6 +460,7 @@ static void testInstanceField(VarHandleTestAccessBoolean recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) vh.get(recv); @@ -476,6 +478,7 @@ static void testInstanceField(VarHandleTestAccessBoolean recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) vh.get(recv); @@ -493,6 +496,7 @@ static void testInstanceField(VarHandleTestAccessBoolean recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) vh.get(recv); @@ -730,6 +734,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(); @@ -747,6 +752,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) vh.get(); @@ -764,6 +770,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) vh.get(); @@ -781,6 +788,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) vh.get(); @@ -1021,6 +1029,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(array, i); @@ -1038,6 +1047,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) vh.get(array, i); @@ -1055,6 +1065,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) vh.get(array, i); @@ -1072,6 +1083,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java index 302b72997e7..10c9ff270c1 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java @@ -420,6 +420,7 @@ static void testInstanceField(VarHandleTestAccessByte recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) vh.get(recv); @@ -437,6 +438,7 @@ static void testInstanceField(VarHandleTestAccessByte recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) vh.get(recv); @@ -454,6 +456,7 @@ static void testInstanceField(VarHandleTestAccessByte recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) vh.get(recv); @@ -471,6 +474,7 @@ static void testInstanceField(VarHandleTestAccessByte recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) vh.get(recv); @@ -724,6 +728,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) vh.get(); @@ -741,6 +746,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire((byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) vh.get(); @@ -758,6 +764,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease((byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) vh.get(); @@ -775,6 +782,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet((byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) vh.get(); @@ -1031,6 +1039,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) vh.get(array, i); @@ -1048,6 +1057,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) vh.get(array, i); @@ -1065,6 +1075,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) vh.get(array, i); @@ -1082,6 +1093,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java index 534ebf83b8a..4b1394336ba 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java @@ -420,6 +420,7 @@ static void testInstanceField(VarHandleTestAccessChar recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) vh.get(recv); @@ -437,6 +438,7 @@ static void testInstanceField(VarHandleTestAccessChar recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) vh.get(recv); @@ -454,6 +456,7 @@ static void testInstanceField(VarHandleTestAccessChar recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) vh.get(recv); @@ -471,6 +474,7 @@ static void testInstanceField(VarHandleTestAccessChar recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) vh.get(recv); @@ -724,6 +728,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain('\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) vh.get(); @@ -741,6 +746,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire('\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) vh.get(); @@ -758,6 +764,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease('\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) vh.get(); @@ -775,6 +782,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet('\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) vh.get(); @@ -1031,6 +1039,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) vh.get(array, i); @@ -1048,6 +1057,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) vh.get(array, i); @@ -1065,6 +1075,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) vh.get(array, i); @@ -1082,6 +1093,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java index 8f5bfca9cf7..3c1ff7fcc53 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java @@ -490,6 +490,7 @@ static void testInstanceField(VarHandleTestAccessDouble recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) vh.get(recv); @@ -507,6 +508,7 @@ static void testInstanceField(VarHandleTestAccessDouble recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) vh.get(recv); @@ -524,6 +526,7 @@ static void testInstanceField(VarHandleTestAccessDouble recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) vh.get(recv); @@ -541,6 +544,7 @@ static void testInstanceField(VarHandleTestAccessDouble recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) vh.get(recv); @@ -746,6 +750,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) vh.get(); @@ -763,6 +768,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) vh.get(); @@ -780,6 +786,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) vh.get(); @@ -797,6 +804,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) vh.get(); @@ -1005,6 +1013,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); @@ -1022,6 +1031,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) vh.get(array, i); @@ -1039,6 +1049,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) vh.get(array, i); @@ -1056,6 +1067,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java index 13bc8a12b02..d1ec3c5565c 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java @@ -490,6 +490,7 @@ static void testInstanceField(VarHandleTestAccessFloat recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) vh.get(recv); @@ -507,6 +508,7 @@ static void testInstanceField(VarHandleTestAccessFloat recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) vh.get(recv); @@ -524,6 +526,7 @@ static void testInstanceField(VarHandleTestAccessFloat recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) vh.get(recv); @@ -541,6 +544,7 @@ static void testInstanceField(VarHandleTestAccessFloat recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) vh.get(recv); @@ -746,6 +750,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) vh.get(); @@ -763,6 +768,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) vh.get(); @@ -780,6 +786,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) vh.get(); @@ -797,6 +804,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) vh.get(); @@ -1005,6 +1013,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); @@ -1022,6 +1031,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) vh.get(array, i); @@ -1039,6 +1049,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) vh.get(array, i); @@ -1056,6 +1067,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java index d459e8eebe5..ba7bb95aee7 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java @@ -420,6 +420,7 @@ static void testInstanceField(VarHandleTestAccessInt recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) vh.get(recv); @@ -437,6 +438,7 @@ static void testInstanceField(VarHandleTestAccessInt recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) vh.get(recv); @@ -454,6 +456,7 @@ static void testInstanceField(VarHandleTestAccessInt recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) vh.get(recv); @@ -471,6 +474,7 @@ static void testInstanceField(VarHandleTestAccessInt recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) vh.get(recv); @@ -724,6 +728,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) vh.get(); @@ -741,6 +746,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) vh.get(); @@ -758,6 +764,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) vh.get(); @@ -775,6 +782,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) vh.get(); @@ -1031,6 +1039,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); @@ -1048,6 +1057,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); @@ -1065,6 +1075,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); @@ -1082,6 +1093,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java index ce6fc2b1137..412adf1d7ce 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java @@ -420,6 +420,7 @@ static void testInstanceField(VarHandleTestAccessLong recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) vh.get(recv); @@ -437,6 +438,7 @@ static void testInstanceField(VarHandleTestAccessLong recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) vh.get(recv); @@ -454,6 +456,7 @@ static void testInstanceField(VarHandleTestAccessLong recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) vh.get(recv); @@ -471,6 +474,7 @@ static void testInstanceField(VarHandleTestAccessLong recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) vh.get(recv); @@ -724,6 +728,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) vh.get(); @@ -741,6 +746,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) vh.get(); @@ -758,6 +764,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) vh.get(); @@ -775,6 +782,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) vh.get(); @@ -1031,6 +1039,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); @@ -1048,6 +1057,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); @@ -1065,6 +1075,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); @@ -1082,6 +1093,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java index 5e8f61b3cdb..c4be5b71190 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java @@ -420,6 +420,7 @@ static void testInstanceField(VarHandleTestAccessShort recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) vh.get(recv); @@ -437,6 +438,7 @@ static void testInstanceField(VarHandleTestAccessShort recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) vh.get(recv); @@ -454,6 +456,7 @@ static void testInstanceField(VarHandleTestAccessShort recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) vh.get(recv); @@ -471,6 +474,7 @@ static void testInstanceField(VarHandleTestAccessShort recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) vh.get(recv); @@ -724,6 +728,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain((short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) vh.get(); @@ -741,6 +746,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire((short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) vh.get(); @@ -758,6 +764,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease((short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) vh.get(); @@ -775,6 +782,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet((short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) vh.get(); @@ -1031,6 +1039,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) vh.get(array, i); @@ -1048,6 +1057,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) vh.get(array, i); @@ -1065,6 +1075,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) vh.get(array, i); @@ -1082,6 +1093,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java index f3705210594..0be9939ddce 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java @@ -519,6 +519,7 @@ static void testInstanceField(VarHandleTestAccessString recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) vh.get(recv); @@ -536,6 +537,7 @@ static void testInstanceField(VarHandleTestAccessString recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) vh.get(recv); @@ -553,6 +555,7 @@ static void testInstanceField(VarHandleTestAccessString recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) vh.get(recv); @@ -570,6 +573,7 @@ static void testInstanceField(VarHandleTestAccessString recv, VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) vh.get(recv); @@ -759,6 +763,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain("foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) vh.get(); @@ -776,6 +781,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire("bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) vh.get(); @@ -793,6 +799,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease("foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) vh.get(); @@ -810,6 +817,7 @@ static void testStaticField(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet("bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) vh.get(); @@ -1002,6 +1010,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) vh.get(array, i); @@ -1019,6 +1028,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) vh.get(array, i); @@ -1036,6 +1046,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) vh.get(array, i); @@ -1053,6 +1064,7 @@ static void testArray(VarHandle vh) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java index 4b67fa9a250..2b9a24699cd 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java @@ -1050,6 +1050,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); @@ -1067,6 +1068,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) vh.get(array, i); @@ -1084,6 +1086,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) vh.get(array, i); @@ -1101,6 +1104,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) vh.get(array, i); @@ -1251,6 +1255,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); @@ -1268,6 +1273,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) vh.get(array, i); @@ -1285,6 +1291,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) vh.get(array, i); @@ -1302,6 +1309,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java index a5afcf76ca5..bdd592e4af4 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java @@ -1050,6 +1050,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); @@ -1067,6 +1068,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) vh.get(array, i); @@ -1084,6 +1086,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) vh.get(array, i); @@ -1101,6 +1104,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) vh.get(array, i); @@ -1251,6 +1255,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); @@ -1268,6 +1273,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) vh.get(array, i); @@ -1285,6 +1291,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) vh.get(array, i); @@ -1302,6 +1309,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java index e40a84ddc19..16b91cff35a 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java @@ -1234,6 +1234,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); @@ -1251,6 +1252,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); @@ -1268,6 +1270,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); @@ -1285,6 +1288,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) vh.get(array, i); @@ -1545,6 +1549,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); @@ -1562,6 +1567,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); @@ -1579,6 +1585,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); @@ -1596,6 +1603,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java index 18e6902082b..b03d79dd6f0 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java @@ -1234,6 +1234,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); @@ -1251,6 +1252,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); @@ -1268,6 +1270,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); @@ -1285,6 +1288,7 @@ static void testArrayReadWrite(ByteArraySource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) vh.get(array, i); @@ -1545,6 +1549,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); @@ -1562,6 +1567,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); @@ -1579,6 +1585,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); @@ -1596,6 +1603,7 @@ static void testArrayReadWrite(ByteBufferSource bs, VarHandleSource vhs) { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java index 3be56ac3c4a..9255bfeb577 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handl } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, true, false); + success = (boolean) mh.invokeExact(recv, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handl } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, false, true); + success = (boolean) mh.invokeExact(recv, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handl } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, true, false); + success = (boolean) mh.invokeExact(recv, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handl { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, false, true); + success = (boolean) mh.invokeExact(recv, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -470,9 +479,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(true, false); + success = (boolean) mh.invokeExact(true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); @@ -487,9 +498,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(false, true); + success = (boolean) mh.invokeExact(false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); @@ -497,16 +510,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(false, false); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact(false, false); assertEquals(success, false, "failing weakCompareAndSetAcquire boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(true, false); + success = (boolean) mh.invokeExact(true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); @@ -521,9 +537,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(false, true); + success = (boolean) mh.invokeExact(false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); @@ -757,9 +775,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, true, false); + success = (boolean) mh.invokeExact(array, i, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -774,9 +794,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, false, true); + success = (boolean) mh.invokeExact(array, i, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -791,9 +813,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, true, false); + success = (boolean) mh.invokeExact(array, i, true, false); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -808,9 +832,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, false, true); + success = (boolean) mh.invokeExact(array, i, false, true); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java index b60ab7bd8e6..a31081d994f 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact(recv, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, (byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact(recv, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, (byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact(recv, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact(recv, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -492,9 +501,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact((byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); @@ -509,9 +520,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact((byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact((byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); @@ -519,16 +532,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact((byte)0x23, (byte)0x45); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact((byte)0x23, (byte)0x45); assertEquals(success, false, "failing weakCompareAndSetAcquire byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact((byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact((byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); @@ -543,9 +559,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact((byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); @@ -801,9 +819,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact(array, i, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -818,9 +838,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact(array, i, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -835,9 +857,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, (byte)0x01, (byte)0x23); + success = (boolean) mh.invokeExact(array, i, (byte)0x01, (byte)0x23); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -852,9 +876,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x23, (byte)0x01); + success = (boolean) mh.invokeExact(array, i, (byte)0x23, (byte)0x01); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java index 79bbb8622e4..fc76b6705e0 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, '\u0123', '\u4567'); + success = (boolean) mh.invokeExact(recv, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, '\u4567', '\u0123'); + success = (boolean) mh.invokeExact(recv, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, '\u0123', '\u4567'); + success = (boolean) mh.invokeExact(recv, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u4567', '\u0123'); + success = (boolean) mh.invokeExact(recv, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -492,9 +501,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact('\u0123', '\u4567'); + success = (boolean) mh.invokeExact('\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); @@ -509,9 +520,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact('\u4567', '\u0123'); + success = (boolean) mh.invokeExact('\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); @@ -519,16 +532,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact('\u4567', '\u89AB'); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact('\u4567', '\u89AB'); assertEquals(success, false, "failing weakCompareAndSetAcquire char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact('\u0123', '\u4567'); + success = (boolean) mh.invokeExact('\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); @@ -543,9 +559,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u4567', '\u0123'); + success = (boolean) mh.invokeExact('\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); @@ -801,9 +819,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, '\u0123', '\u4567'); + success = (boolean) mh.invokeExact(array, i, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -818,9 +838,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567', '\u0123'); + success = (boolean) mh.invokeExact(array, i, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -835,9 +857,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, '\u0123', '\u4567'); + success = (boolean) mh.invokeExact(array, i, '\u0123', '\u4567'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -852,9 +876,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u4567', '\u0123'); + success = (boolean) mh.invokeExact(array, i, '\u4567', '\u0123'); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java index ae31f8dc9b2..158333622e2 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0d, 2.0d); + success = (boolean) mh.invokeExact(recv, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2.0d, 1.0d); + success = (boolean) mh.invokeExact(recv, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1.0d, 2.0d); + success = (boolean) mh.invokeExact(recv, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handle { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0d, 1.0d); + success = (boolean) mh.invokeExact(recv, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -414,9 +423,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0d, 2.0d); + success = (boolean) mh.invokeExact(1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); @@ -431,9 +442,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2.0d, 1.0d); + success = (boolean) mh.invokeExact(2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); @@ -441,16 +454,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2.0d, 3.0d); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact(2.0d, 3.0d); assertEquals(success, false, "failing weakCompareAndSetAcquire double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1.0d, 2.0d); + success = (boolean) mh.invokeExact(1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); @@ -465,9 +481,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0d, 1.0d); + success = (boolean) mh.invokeExact(2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); @@ -645,9 +663,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0d, 2.0d); + success = (boolean) mh.invokeExact(array, i, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -662,9 +682,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d, 1.0d); + success = (boolean) mh.invokeExact(array, i, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -679,9 +701,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1.0d, 2.0d); + success = (boolean) mh.invokeExact(array, i, 1.0d, 2.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -696,9 +720,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0d, 1.0d); + success = (boolean) mh.invokeExact(array, i, 2.0d, 1.0d); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java index 4fdc63dff0c..0350406d1b2 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0f, 2.0f); + success = (boolean) mh.invokeExact(recv, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2.0f, 1.0f); + success = (boolean) mh.invokeExact(recv, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1.0f, 2.0f); + success = (boolean) mh.invokeExact(recv, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0f, 1.0f); + success = (boolean) mh.invokeExact(recv, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -414,9 +423,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0f, 2.0f); + success = (boolean) mh.invokeExact(1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); @@ -431,9 +442,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2.0f, 1.0f); + success = (boolean) mh.invokeExact(2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); @@ -441,16 +454,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2.0f, 3.0f); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact(2.0f, 3.0f); assertEquals(success, false, "failing weakCompareAndSetAcquire float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1.0f, 2.0f); + success = (boolean) mh.invokeExact(1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); @@ -465,9 +481,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0f, 1.0f); + success = (boolean) mh.invokeExact(2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); @@ -645,9 +663,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0f, 2.0f); + success = (boolean) mh.invokeExact(array, i, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -662,9 +682,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f, 1.0f); + success = (boolean) mh.invokeExact(array, i, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -679,9 +701,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1.0f, 2.0f); + success = (boolean) mh.invokeExact(array, i, 1.0f, 2.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -696,9 +720,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0f, 1.0f); + success = (boolean) mh.invokeExact(array, i, 2.0f, 1.0f); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java index aebeece1254..239b7548f9d 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles h } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(recv, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles h } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(recv, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles h } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(recv, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles h { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(recv, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -492,9 +501,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); @@ -509,9 +520,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); @@ -519,16 +532,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF, 0xCAFEBABE); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact(0x89ABCDEF, 0xCAFEBABE); assertEquals(success, false, "failing weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); @@ -543,9 +559,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); @@ -801,9 +819,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(array, i, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -818,9 +838,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(array, i, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -835,9 +857,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 0x01234567, 0x89ABCDEF); + success = (boolean) mh.invokeExact(array, i, 0x01234567, 0x89ABCDEF); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -852,9 +876,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x89ABCDEF, 0x01234567); + success = (boolean) mh.invokeExact(array, i, 0x89ABCDEF, 0x01234567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java index c30b1395ee3..41afce3d468 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -492,9 +501,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); @@ -509,9 +520,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); @@ -519,16 +532,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL); assertEquals(success, false, "failing weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); @@ -543,9 +559,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); @@ -801,9 +819,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -818,9 +838,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -835,9 +857,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) mh.invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -852,9 +876,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) mh.invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java index 49e9f744b9b..cfe3105782b 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact(recv, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, (short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact(recv, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, (short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact(recv, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact(recv, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -492,9 +501,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact((short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); @@ -509,9 +520,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact((short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact((short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); @@ -519,16 +532,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact((short)0x4567, (short)0x89AB); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact((short)0x4567, (short)0x89AB); assertEquals(success, false, "failing weakCompareAndSetAcquire short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact((short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact((short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); @@ -543,9 +559,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact((short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); @@ -801,9 +819,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact(array, i, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -818,9 +838,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact(array, i, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -835,9 +857,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, (short)0x0123, (short)0x4567); + success = (boolean) mh.invokeExact(array, i, (short)0x0123, (short)0x4567); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -852,9 +876,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x4567, (short)0x0123); + success = (boolean) mh.invokeExact(array, i, (short)0x4567, (short)0x0123); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java index cd70d2d7928..7b80c12467b 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java @@ -30,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -208,9 +209,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, "foo", "bar"); + success = (boolean) mh.invokeExact(recv, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -225,9 +228,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo"); + success = (boolean) mh.invokeExact(recv, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -242,9 +247,11 @@ static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handle } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar"); + success = (boolean) mh.invokeExact(recv, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -260,8 +267,10 @@ static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handle { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "bar", "foo"); + success = (boolean) mh.invokeExact(recv, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -392,9 +401,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact("foo", "bar"); + success = (boolean) mh.invokeExact("foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); @@ -409,9 +420,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo"); + success = (boolean) mh.invokeExact("bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); @@ -419,16 +432,19 @@ static void testStaticField(Handles hs) throws Throwable { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "baz"); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact("bar", "baz"); assertEquals(success, false, "failing weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact("foo", "bar"); + success = (boolean) mh.invokeExact("foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); @@ -443,9 +459,11 @@ static void testStaticField(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("bar", "foo"); + success = (boolean) mh.invokeExact("bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); @@ -601,9 +619,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, "foo", "bar"); + success = (boolean) mh.invokeExact(array, i, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -618,9 +638,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo"); + success = (boolean) mh.invokeExact(array, i, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -635,9 +657,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar"); + success = (boolean) mh.invokeExact(array, i, "foo", "bar"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -652,9 +676,11 @@ static void testArray(Handles hs) throws Throwable { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "bar", "foo"); + success = (boolean) mh.invokeExact(array, i, "bar", "foo"); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template index 9f409dfaf0b..31bdcd22543 100644 --- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template +++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template @@ -658,6 +658,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(recv); @@ -675,6 +676,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(recv); @@ -692,6 +694,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(recv, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(recv); @@ -709,6 +712,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(recv, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(recv); @@ -1063,6 +1067,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain($value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(); @@ -1080,6 +1085,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire($value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(); @@ -1097,6 +1103,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease($value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(); @@ -1114,6 +1121,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet($value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(); @@ -1471,6 +1479,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1488,6 +1497,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1505,6 +1515,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1522,6 +1533,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template index bea9fec4e2b..c25ac554472 100644 --- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template +++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template @@ -1591,6 +1591,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1608,6 +1609,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1625,6 +1627,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1642,6 +1645,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1908,6 +1912,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1925,6 +1930,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1942,6 +1948,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); @@ -1959,6 +1966,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template index 79875db904b..a26dc769024 100644 --- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template +++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template @@ -30,6 +30,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.util.ArrayList; @@ -209,9 +210,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, $value1$, $value2$); + success = (boolean) mh.invokeExact(recv, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -226,9 +229,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$); + success = (boolean) mh.invokeExact(recv, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -243,9 +248,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$); + success = (boolean) mh.invokeExact(recv, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -261,8 +268,10 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value2$, $value1$); + success = (boolean) mh.invokeExact(recv, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); @@ -532,9 +541,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact($value1$, $value2$); + success = (boolean) mh.invokeExact($value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); @@ -549,9 +560,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$); + success = (boolean) mh.invokeExact($value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); @@ -559,16 +572,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { - boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value3$); + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); + boolean success = (boolean) mh.invokeExact($value2$, $value3$); assertEquals(success, false, "failing weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value"); } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact($value1$, $value2$); + success = (boolean) mh.invokeExact($value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); @@ -583,9 +599,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value2$, $value1$); + success = (boolean) mh.invokeExact($value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); @@ -880,9 +898,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, $value1$, $value2$); + success = (boolean) mh.invokeExact(array, i, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -897,9 +917,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$); + success = (boolean) mh.invokeExact(array, i, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -914,9 +936,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$); + success = (boolean) mh.invokeExact(array, i, $value1$, $value2$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); @@ -931,9 +955,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { + MethodHandle mh = hs.get(TestAccessMode.WEAK_COMPARE_AND_SET); boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value2$, $value1$); + success = (boolean) mh.invokeExact(array, i, $value2$, $value1$); + if (!success) weakDelay(); } assertEquals(success, true, "success weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); diff --git a/test/jdk/java/net/Socket/B8312065.java b/test/jdk/java/net/Socket/B8312065.java new file mode 100644 index 00000000000..272e53c8c11 --- /dev/null +++ b/test/jdk/java/net/Socket/B8312065.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023, Alibaba Group Holding Limited. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8312065 + * @summary Socket.connect does not timeout as expected when profiling (i.e. keep receiving signal) + * @requires (os.family != "windows") + * @compile NativeThread.java + * @run main/othervm/native/timeout=120 B8312065 + */ + +import sun.misc.Signal; + +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.util.concurrent.TimeUnit; + +public class B8312065 { + public static void main(String[] args) throws Exception { + System.loadLibrary("NativeThread"); + + // Setup SIGPIPE handler + Signal.handle(new Signal("PIPE"), System.out::println); + + long osThreadId = NativeThread.getID(); + + int timeoutMillis = 2000; + int n = 10; + Thread t = new Thread(() -> { + // Send SIGPIPE to the thread every second + for (int i = 0; i < n; i++) { + if (NativeThread.signal(osThreadId, NativeThread.SIGPIPE) != 0) { + System.out.println("Test FAILED: failed to send signal"); + System.exit(1); + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + System.out.println("Test FAILED: unexpected interrupt"); + System.exit(1); + } + } + System.out.println("Test FAILED: Socket.connect blocked " + n + " seconds, " + + "expected around " + timeoutMillis / 1000 + " seconds"); + System.exit(1); + }); + t.setDaemon(true); + t.start(); + + long startTime = System.nanoTime(); + + try { + Socket socket = new Socket(); + // There is no good way to mock SocketTimeoutException, just assume 192.168.255.255 is not in use + socket.connect(new InetSocketAddress("192.168.255.255", 8080), timeoutMillis); + } catch (SocketTimeoutException e) { + long duration = TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); + if (duration >= timeoutMillis) { + System.out.println("Test passed"); + } else { + System.out.println("Test FAILED: duration " + duration + " ms, expected >= " + timeoutMillis + " ms"); + System.exit(1); + } + } + } +} diff --git a/test/jdk/java/net/Socket/NativeThread.java b/test/jdk/java/net/Socket/NativeThread.java new file mode 100644 index 00000000000..5ab00ef855e --- /dev/null +++ b/test/jdk/java/net/Socket/NativeThread.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +public class NativeThread { + + public static final int SIGPIPE; + + static { + SIGPIPE = getSIGPIPE(); + } + + public static native long getID(); + + public static native int signal(long threadId, int sig); + + private static native int getSIGPIPE(); +} diff --git a/test/jdk/java/net/Socket/SocketAcceptInterruptTest.java b/test/jdk/java/net/Socket/SocketAcceptInterruptTest.java new file mode 100644 index 00000000000..c759609091b --- /dev/null +++ b/test/jdk/java/net/Socket/SocketAcceptInterruptTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8237858 + * @summary PlainSocketImpl.socketAccept() handles EINTR incorrectly + * @requires (os.family != "windows") + * @compile NativeThread.java + * @run main/othervm/native -Djdk.net.usePlainSocketImpl=true SocketAcceptInterruptTest 0 + * @run main/othervm/native -Djdk.net.usePlainSocketImpl=true SocketAcceptInterruptTest 5000 + * @run main/othervm/native SocketAcceptInterruptTest 0 + * @run main/othervm/native SocketAcceptInterruptTest 5000 + */ +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class SocketAcceptInterruptTest { + + public static void main(String[] args) throws Exception { + System.loadLibrary("NativeThread"); + InetAddress loopback = InetAddress.getLoopbackAddress(); + ExecutorService executor = Executors.newFixedThreadPool(1); + + try ( ServerSocket ss = new ServerSocket(0, 50, loopback);) { + Server server = new Server(ss, Integer.parseInt(args[0])); + Future future = executor.submit(server); + long threadId = server.getID(); + + sendSignal(threadId, ss); + sleep(100); + // In failing case server socket will be closed, so we do need to check first + if (!ss.isClosed()) { + // After sending SIGPIPE, create client socket and connect to server + try ( Socket s = new Socket(loopback, ss.getLocalPort()); InputStream in = s.getInputStream();) { + in.read(); // reading one byte is enought for test. + } + } + Result result = future.get(); + if (result.status == Result.FAIL) { + throw result.exception; + } + } finally { + executor.shutdown(); + } + System.out.println("OK!"); + } + + private static void sendSignal(long threadId, ServerSocket ss) { + System.out.println("Sending SIGPIPE to ServerSocket thread."); + int count = 0; + while (!ss.isClosed() && count++ < 20) { + sleep(10); + if (NativeThread.signal(threadId, NativeThread.SIGPIPE) != 0) { + throw new RuntimeException("Failed to interrupt the server thread."); + } + } + } + + private static void sleep(long time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + // ignore the exception. + } + } + + static class Server implements Callable { + + private volatile long threadId; + private final ServerSocket serverSocket; + private final int timeout; + + public Server(ServerSocket ss, int timeout) { + serverSocket = ss; + this.timeout = timeout; + } + + @Override + public Result call() { + try { + threadId = NativeThread.getID(); + serverSocket.setSoTimeout(timeout); + try ( Socket socket = serverSocket.accept(); + OutputStream outputStream = socket.getOutputStream();) { + outputStream.write("Hello!".getBytes()); + return new Result(Result.SUCCESS, null); + } + } catch (IOException e) { + close(); + return new Result(Result.FAIL, e); + } + } + + long getID() { + while (threadId == 0) { + sleep(5); + } + return threadId; + } + + private void close() { + if (!serverSocket.isClosed()) { + try { + serverSocket.close(); + } catch (IOException ex) { + // ignore the exception + } + } + } + } + + static class Result { + + static final int SUCCESS = 0; + static final int FAIL = 1; + final int status; + final Exception exception; + + public Result(int status, Exception ex) { + this.status = status; + exception = ex; + } + } +} diff --git a/test/jdk/java/net/Socket/SocketReadInterruptTest.java b/test/jdk/java/net/Socket/SocketReadInterruptTest.java new file mode 100644 index 00000000000..340f8bf2f16 --- /dev/null +++ b/test/jdk/java/net/Socket/SocketReadInterruptTest.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8237858 + * @summary PlainSocketImpl.socketAccept() handles EINTR incorrectly + * @requires (os.family != "windows") + * @compile NativeThread.java + * @run main/othervm/native -Djdk.net.usePlainSocketImpl=true SocketReadInterruptTest 2000 3000 + * @run main/othervm/native SocketReadInterruptTest 2000 3000 + * @run main/othervm/native -Djdk.net.usePlainSocketImpl=true SocketReadInterruptTest 2000 0 + * @run main/othervm/native SocketReadInterruptTest 2000 0 + */ +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.ServerSocket; + +import java.net.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class SocketReadInterruptTest { + + public static void main(String[] args) throws Exception { + System.loadLibrary("NativeThread"); + ExecutorService executor = Executors.newFixedThreadPool(2); + InetAddress loopback = InetAddress.getLoopbackAddress(); + + try ( ServerSocket ss = new ServerSocket(0, 50, loopback); + Socket s1 = new Socket(loopback, ss.getLocalPort());) { + Server server = new Server(ss, Integer.parseInt(args[0])); + Future f1 = executor.submit(server); + + Client client = new Client(s1, Integer.parseInt(args[1])); + Future f2 = executor.submit(client); + long threadId = client.getID(); + + sleep(200); + System.out.println("Sending SIGPIPE to client thread."); + if (NativeThread.signal(threadId, NativeThread.SIGPIPE) != 0) { + throw new RuntimeException("Failed to interrupt the thread."); + } + + Result r1 = f1.get(); + if (r1.status == Result.FAIL) { + throw r1.exception; + } + + Result r2 = f2.get(); + if (r2.status == Result.FAIL) { + throw r2.exception; + } + System.out.println("OK!"); + } finally { + executor.shutdown(); + } + } + + private static void sleep(long time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + static class Client implements Callable { + + private volatile long threadId; + private final Socket client; + private final int timeout; + + public Client(Socket s, int timeout) { + client = s; + this.timeout = timeout; + } + + @Override + public Result call() { + threadId = NativeThread.getID(); + byte[] arr = new byte[64]; + try ( InputStream in = client.getInputStream();) { + client.setSoTimeout(timeout); + in.read(arr); + return new Result(Result.SUCCESS, null); + } catch (IOException ex) { + close(); + return new Result(Result.FAIL, ex); + } + } + + long getID() { + while (threadId == 0) { + sleep(5); + } + return threadId; + } + + void close() { + if (!client.isClosed()) { + try { + client.close(); + } catch (IOException ex) { + // ignore the exception. + } + } + } + } + + static class Server implements Callable { + + private final ServerSocket serverSocket; + private final int timeout; + + public Server(ServerSocket ss, int timeout) { + serverSocket = ss; + this.timeout = timeout; + } + + @Override + public Result call() { + try { + try ( Socket client = serverSocket.accept(); OutputStream outputStream = client.getOutputStream();) { + sleep(timeout); + outputStream.write("This is just a test string.".getBytes()); + return new Result(Result.SUCCESS, null); + } + } catch (IOException e) { + close(); + return new Result(Result.FAIL, e); + } + } + + public void close() { + if (!serverSocket.isClosed()) { + try { + serverSocket.close(); + } catch (IOException ex) { + } + } + } + } + + static class Result { + + static final int SUCCESS = 0; + static final int FAIL = 1; + final int status; + final Exception exception; + + public Result(int status, Exception ex) { + this.status = status; + exception = ex; + } + } +} diff --git a/test/jdk/java/net/Socket/libNativeThread.c b/test/jdk/java/net/Socket/libNativeThread.c new file mode 100644 index 00000000000..8d2204cea7f --- /dev/null +++ b/test/jdk/java/net/Socket/libNativeThread.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +#include +#include +#include +#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) +#include +#endif + +/* + * Class: NativeThread + * Method: getID + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_NativeThread_getID(JNIEnv *env, jclass class) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return (jlong)pthread_self(); + #else + return 0; + #endif +} + +/* + * Class: NativeThread + * Method: signal + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_NativeThread_signal(JNIEnv *env, jclass class, jlong thread, jint sig) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return pthread_kill((pthread_t)thread, sig); + #else + return 0; + #endif +} + +/* + * Class: NativeThread + * Method: getSIGPIPE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_NativeThread_getSIGPIPE(JNIEnv *env, jclass class) +{ + #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) + return SIGPIPE; + #else + return 0; + #endif +} diff --git a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java index c936a3e9e27..5ff3898fb2d 100644 --- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java +++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java @@ -35,30 +35,45 @@ */ /* - * @test - * @summary JSR-166 tck tests, in a number of variations. - * The first is the conformance testing variant, - * while others also test implementation details. + * @test id=default + * @summary Conformance testing variant of JSR-166 tck tests. * @build * * @modules java.management * @run junit/othervm/timeout=1000 JSR166TestCase + */ + +/* + * @test id=forkjoinpool-common-parallelism + * @summary Test implementation details variant of JSR-166 + * tck tests with ForkJoinPool common parallelism. + * @build * + * @modules java.management * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED * --add-opens java.base/java.lang=ALL-UNNAMED * -Djsr166.testImplementationDetails=true + * -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 * JSR166TestCase * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED * --add-opens java.base/java.lang=ALL-UNNAMED * -Djsr166.testImplementationDetails=true - * -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 + * -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 + * -Djava.util.secureRandomSeed=true * JSR166TestCase + */ + +/* + * @test id=others + * @summary Remaining test implementation details variant of + * JSR-166 tck tests apart from ForkJoinPool common + * parallelism. + * @build * + * @modules java.management * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED * --add-opens java.base/java.lang=ALL-UNNAMED * -Djsr166.testImplementationDetails=true - * -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 - * -Djava.util.secureRandomSeed=true * JSR166TestCase * @run junit/othervm/timeout=1000/policy=tck.policy * --add-opens java.base/java.util.concurrent=ALL-UNNAMED diff --git a/test/jdk/java/util/jar/JarFile/SignedJarPendingBlock.java b/test/jdk/java/util/jar/JarFile/SignedJarPendingBlock.java new file mode 100644 index 00000000000..a6f9955a507 --- /dev/null +++ b/test/jdk/java/util/jar/JarFile/SignedJarPendingBlock.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @modules java.base/sun.security.tools.keytool + * @summary JARs with pending block files (where .RSA comes before .SF) should verify correctly + */ + +import jdk.security.jarsigner.JarSigner; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.KeyStore; +import java.util.Collections; +import java.util.jar.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +public class SignedJarPendingBlock { + + public static void main(String[] args) throws Exception { + Path jar = createJarFile(); + Path signed = signJarFile(jar); + Path pendingBlocks = moveBlockFirst(signed); + Path invalid = invalidate(pendingBlocks); + + // 1: Regular signed JAR with no pending blocks should verify + checkSigned(signed); + + // 2: Signed jar with pending blocks should verify + checkSigned(pendingBlocks); + + // 3: Invalid signed jar with pending blocks should throw SecurityException + try { + checkSigned(invalid); + throw new Exception("Expected invalid digest to be detected"); + } catch (SecurityException se) { + // Ignore + } + } + + private static void checkSigned(Path b) throws Exception { + try (JarFile jf = new JarFile(b.toFile(), true)) { + + JarEntry je = jf.getJarEntry("a.txt"); + try (InputStream in = jf.getInputStream(je)) { + in.transferTo(OutputStream.nullOutputStream()); + } + } + } + + /** + * Invalidate signed file by modifying the contents of "a.txt" + */ + private static Path invalidate(Path s) throws Exception{ + Path invalid = Path.of("pending-block-file-invalidated.jar"); + + try (ZipFile zip = new ZipFile(s.toFile()); + ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(invalid))) { + + for (ZipEntry ze : Collections.list(zip.entries())) { + String name = ze.getName(); + out.putNextEntry(new ZipEntry(name)); + + if (name.equals("a.txt")) { + // Change the contents of a.txt to trigger SignatureException + out.write("b".getBytes(StandardCharsets.UTF_8)); + } else { + try (InputStream in = zip.getInputStream(ze)) { + in.transferTo(out); + } + } + } + } + return invalid; + } + + private static Path moveBlockFirst(Path s) throws Exception { + Path b = Path.of("pending-block-file-blockfirst.jar"); + try (ZipFile in = new ZipFile(s.toFile()); + ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(b))) { + + copy("META-INF/MANIFEST.MF", in, out); + + // Switch the order of the RSA and SF files + copy("META-INF/SIGNER.RSA", in, out); + copy("META-INF/SIGNER.SF", in, out); + + copy("a.txt", in, out); + } + return b; + } + + /** + * Copy an entry from a ZipFile to a ZipOutputStream + */ + private static void copy(String name, ZipFile in, ZipOutputStream out) throws Exception { + out.putNextEntry(new ZipEntry(name)); + try (InputStream is = in.getInputStream(in.getEntry(name))) { + is.transferTo(out); + } + } + + private static Path signJarFile(Path j) throws Exception { + Path s = Path.of("pending-block-file-signed.jar"); + + Files.deleteIfExists(Path.of("ks")); + + sun.security.tools.keytool.Main.main( + ("-keystore ks -storepass changeit -keypass changeit -dname" + + " CN=SIGNER" +" -alias r -genkeypair -keyalg rsa").split(" ")); + + char[] pass = "changeit".toCharArray(); + + KeyStore ks = KeyStore.getInstance(new File("ks"), pass); + + KeyStore.PrivateKeyEntry pke = (KeyStore.PrivateKeyEntry) + ks.getEntry("r", new KeyStore.PasswordProtection(pass)); + + JarSigner signer = new JarSigner.Builder(pke) + .digestAlgorithm("SHA-256") + .signatureAlgorithm("SHA256withRSA") + .signerName("SIGNER") + .build(); + + try (ZipFile in = new ZipFile(j.toFile()); + OutputStream out = Files.newOutputStream(s)) { + signer.sign(in, out); + } + + return s; + } + + /** + * Create a jar file with single entry "a.txt" containing "a" + */ + private static Path createJarFile() throws Exception { + Path jar = Path.of("pending-block-file.jar"); + Manifest manifest = new Manifest(); + manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); + try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(jar),manifest)) { + out.putNextEntry(new JarEntry("a.txt")); + out.write("a".getBytes(StandardCharsets.UTF_8)); + } + return jar; + } +} diff --git a/test/jdk/java/util/jar/JarFile/VerifySignedJar.java b/test/jdk/java/util/jar/JarFile/VerifySignedJar.java index 1f4db736e8f..e6bec92215c 100644 --- a/test/jdk/java/util/jar/JarFile/VerifySignedJar.java +++ b/test/jdk/java/util/jar/JarFile/VerifySignedJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. * 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,48 +23,121 @@ /** * @test + * @library /test/lib + * @modules java.base/sun.security.x509 + * @modules java.base/sun.security.tools.keytool * @bug 4419266 4842702 * @summary Make sure verifying signed Jar doesn't throw SecurityException */ -import java.io.File; -import java.util.jar.JarFile; +import jdk.security.jarsigner.JarSigner; +import sun.security.tools.keytool.CertAndKeyGen; +import sun.security.x509.X500Name; + +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.KeyStore; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.Objects; +import java.util.concurrent.TimeUnit; import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; -import java.util.Enumeration; +import java.util.zip.ZipFile; + +import static jdk.test.lib.Utils.runAndCheckException; + public class VerifySignedJar { - private static void Unreached (Object o) - throws Exception - { - // Should never get here - throw new Exception ("Expected exception was not thrown"); - } public static void main(String[] args) throws Exception { - File f = new File(System.getProperty("test.src", "."), "thawjar.jar"); - JarFile jf = new JarFile(f); - try { - // Read entries via Enumeration - for (Enumeration e = jf.entries(); e.hasMoreElements();) - jf.getInputStream((ZipEntry) e.nextElement()); - // Read entry by name - ZipEntry ze = jf.getEntry("getprop.class"); - JarEntry je = jf.getJarEntry("getprop.class"); + Path j = createJar(); + Path s = signJar(j, keyEntry("cn=duke")); + + try (JarFile jf = new JarFile(s.toFile())) { - // Make sure we throw NPE on null objects - try { Unreached (jf.getEntry(null)); } - catch (NullPointerException e) {} + for (JarEntry e: Collections.list(jf.entries())) { + // Reading entry to trigger verification + jf.getInputStream(e).transferTo(OutputStream.nullOutputStream()); + // Check that all regular files are signed by duke + if (!e.getName().startsWith("META-INF/")) { + checkSignedBy(e, "cn=duke"); + } + } - try { Unreached (jf.getJarEntry(null)); } - catch (NullPointerException e) {} + // Read ZIP and JAR entries by name + Objects.requireNonNull(jf.getEntry("getprop.class")); + Objects.requireNonNull(jf.getJarEntry("getprop.class")); - try { Unreached (jf.getInputStream(null)); } - catch (NullPointerException e) {} + // Make sure we throw NPE on null parameters + runAndCheckException(() -> jf.getEntry(null), NullPointerException.class); + runAndCheckException(() -> jf.getJarEntry(null), NullPointerException.class); + runAndCheckException(() -> jf.getInputStream(null), NullPointerException.class); } catch (SecurityException se) { throw new Exception("Got SecurityException when verifying signed " + "jar:" + se); } } + + // Check that a JAR entry is signed by an expected DN + private static void checkSignedBy(JarEntry e, String expectedDn) throws Exception { + Certificate[] certs = e.getCertificates(); + if (certs == null || certs.length == 0) { + throw new Exception("JarEntry has no certificates: " + e.getName()); + } + + if (certs[0] instanceof X509Certificate) { + X509Certificate x = (X509Certificate)certs[0]; + String name = x.getSubjectX500Principal().getName(); + if (!name.equalsIgnoreCase(expectedDn)) { + throw new Exception(String.format("Expected entry signed by %s, was %s", name, expectedDn)); + } + } else { + throw new Exception("Expected JarEntry.getCertificate to return X509Certificate"); + } + } + + private static Path createJar() throws Exception { + Path j = Path.of("unsigned.jar"); + try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(j))){ + out.putNextEntry(new JarEntry("getprop.class")); + out.write(new byte[] {(byte) 0XCA, (byte) 0XFE, (byte) 0XBA, (byte) 0XBE}); + } + return j; + } + + private static Path signJar(Path j, KeyStore.PrivateKeyEntry entry) throws Exception { + Path s = Path.of("signed.jar"); + + JarSigner signer = new JarSigner.Builder(entry) + .signerName("zigbert") + .digestAlgorithm("SHA-256") + .signatureAlgorithm("SHA256withRSA") + .build(); + + try (ZipFile zip = new ZipFile(j.toFile()); + OutputStream out = Files.newOutputStream(s)) { + signer.sign(zip, out); + } + + return s; + } + + private static KeyStore.PrivateKeyEntry keyEntry(String dname) throws Exception { + + CertAndKeyGen gen = new CertAndKeyGen("RSA", "SHA256withRSA"); + + gen.generate(1048); // Small key size makes test run faster + + var oneDay = TimeUnit.DAYS.toSeconds(1); + Certificate cert = gen.getSelfCertificate(new X500Name(dname), oneDay); + + return new KeyStore.PrivateKeyEntry(gen.getPrivateKey(), + new Certificate[] {cert}); + } } diff --git a/test/jdk/java/util/jar/JarFile/thawjar.jar b/test/jdk/java/util/jar/JarFile/thawjar.jar index 49d247cb40d..e69de29bb2d 100644 Binary files a/test/jdk/java/util/jar/JarFile/thawjar.jar and b/test/jdk/java/util/jar/JarFile/thawjar.jar differ diff --git a/test/jdk/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java b/test/jdk/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java index 4f82efc7d54..fe308327553 100644 --- a/test/jdk/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java +++ b/test/jdk/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,11 +40,14 @@ import javax.management.remote.JMXServiceURL; import javax.management.remote.rmi.RMIConnectorServer; +import jdk.test.lib.Utils; + /* * @test * @bug 6697180 * @summary test on a client notification deadlock. * @author Shanliang JIANG + * @library /test/lib * * @run clean MultiThreadDeadLockTest * @run build MultiThreadDeadLockTest @@ -53,7 +56,7 @@ public class MultiThreadDeadLockTest { - private static long serverTimeout = 500L; + private static long serverTimeout = Utils.adjustTimeout(500); public static void main(String[] args) throws Exception { print("Create the MBean server"); @@ -122,7 +125,7 @@ public static void main(String[] args) throws Exception { StateMachine.setState(CREATE_SOCKET); print("Check whether the user thread gets free to call the mbean."); - if (!ut.waitDone(5000)) { + if (!ut.waitDone(Utils.adjustTimeout(5000))) { throw new RuntimeException("Possible deadlock!"); } diff --git a/test/jdk/javax/management/remote/mandatory/connection/ReconnectTest.java b/test/jdk/javax/management/remote/mandatory/connection/ReconnectTest.java index 6c3ca9a1c67..3ace0ba5018 100644 --- a/test/jdk/javax/management/remote/mandatory/connection/ReconnectTest.java +++ b/test/jdk/javax/management/remote/mandatory/connection/ReconnectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,16 @@ * @bug 4927217 * @summary test to reconnect * @author Shanliang JIANG - * + * @library /test/lib * @run clean ReconnectTest * @run build ReconnectTest * @run main ReconnectTest */ +import jdk.test.lib.Utils; + import java.util.*; import java.net.MalformedURLException; -import java.io.IOException; import javax.management.*; import javax.management.remote.*; @@ -46,7 +47,7 @@ public class ReconnectTest { private static HashMap env = new HashMap(2); static { - String timeout = "1000"; + String timeout = Long.toString(Utils.adjustTimeout(1000)); env.put("jmx.remote.x.server.connection.timeout", timeout); env.put("jmx.remote.x.client.connection.check.period", timeout); } @@ -104,7 +105,7 @@ private static boolean test(String proto) for (int i=0; i<3; i++) { System.out.println("************** Sleeping ...... "+i); - Thread.sleep(2000); + Thread.sleep(Utils.adjustTimeout(2000)); System.out.println("Sleep done."); System.out.println("The default domain is " diff --git a/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/GetSoundBankSecurityException.java b/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/GetSoundBankSecurityException.java new file mode 100644 index 00000000000..53f0450f482 --- /dev/null +++ b/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/GetSoundBankSecurityException.java @@ -0,0 +1,50 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.sound.midi.InvalidMidiDataException; +import javax.sound.midi.MidiSystem; + +/** + * @test + * @bug 8312535 + * @summary MidiSystem.getSoundbank() throws unexpected SecurityException + * @run main/othervm/policy=security.policy GetSoundBankSecurityException + */ +public final class GetSoundBankSecurityException { + + public static void main(String[] args) throws Exception { + File tempFile = new File("sound.bank"); + tempFile.createNewFile(); + try { + MidiSystem.getSoundbank(tempFile); + throw new RuntimeException("InvalidMidiDataException is expected"); + } catch (InvalidMidiDataException ignore) { + } finally { + Files.delete(Paths.get(tempFile.getAbsolutePath())); + } + } +} diff --git a/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/security.policy b/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/security.policy new file mode 100644 index 00000000000..6c9c2a26aaf --- /dev/null +++ b/test/jdk/javax/sound/midi/Soundbanks/GetSoundBankSecurityException/security.policy @@ -0,0 +1,4 @@ +grant { + permission java.io.FilePermission "*", "read,write,delete"; + permission java.util.PropertyPermission "user.dir", "read"; +}; diff --git a/test/jdk/javax/swing/JColorChooser/Test6827032.java b/test/jdk/javax/swing/JColorChooser/Test6827032.java index fff9834d687..096d6b1eeba 100644 --- a/test/jdk/javax/swing/JColorChooser/Test6827032.java +++ b/test/jdk/javax/swing/JColorChooser/Test6827032.java @@ -24,7 +24,7 @@ /* * @test * @key headful - * @bug 6827032 + * @bug 6827032 8197825 * @summary Color chooser with drag enabled shouldn't throw NPE * @author Peter Zhelezniakov * @library ../regtesthelpers @@ -38,47 +38,57 @@ public class Test6827032 { - private static volatile Point point; + private static JFrame frame; private static JColorChooser cc; public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel(new NimbusLookAndFeel()); - - Robot robot = new Robot(); - robot.setAutoDelay(50); - - - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - createAndShowGUI(); + try { + UIManager.setLookAndFeel(new NimbusLookAndFeel()); + + Robot robot = new Robot(); + robot.setAutoDelay(100); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel"); + point = previewPanel.getLocationOnScreen(); + } + }); + + point.translate(5, 5); + + robot.mouseMove(point.x, point.y); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(1000); + } finally { + if (frame != null) { + SwingUtilities.invokeAndWait(() -> frame.dispose()); } - }); - - robot.waitForIdle(); - - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel"); - point = previewPanel.getLocationOnScreen(); - } - }); - - point.translate(5, 5); - - robot.mouseMove(point.x, point.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + } } private static void createAndShowGUI() { - JFrame frame = new JFrame(Test6827032.class.getName()); + frame = new JFrame(Test6827032.class.getName()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cc = new JColorChooser(); cc.setDragEnabled(true); frame.add(cc); frame.pack(); + frame.setLocationRelativeTo(null); frame.setVisible(true); } } diff --git a/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java b/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java index 9df8816b0a7..0e1831afb31 100644 --- a/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java +++ b/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java @@ -23,17 +23,23 @@ import java.awt.Component; import java.awt.Dimension; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Point; +import java.awt.Rectangle; import java.awt.Robot; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.File; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFileChooser; @@ -175,12 +181,18 @@ private static Point getActualLocation(final MyFileChooser fcoo) return pt.get(); } - public static void verify(int x1, int x2, int y1, int y2) { + public static void verify(int x1, int x2, int y1, int y2) throws Exception { System.out.println("verify " + x1 + "==" + x2 + "; " + y1 + "==" + y2); if ((Math.abs(x1 - x2) < TOLERANCE_LEVEL) && (Math.abs(y1 - y2) < TOLERANCE_LEVEL)) { System.out.println("Test passed"); } else { + GraphicsConfiguration gc = GraphicsEnvironment. + getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); + Rectangle gcBounds = gc.getBounds(); + BufferedImage bufferedImage = robot.createScreenCapture( + new Rectangle(gcBounds)); + ImageIO.write(bufferedImage, "png",new File("FailureImage.png")); throw new RuntimeException( "Test Failed, setLocation() is not working properly"); } diff --git a/test/jdk/javax/swing/JMenuItem/JMenuItemSetAcceleratorTest.java b/test/jdk/javax/swing/JMenuItem/JMenuItemSetAcceleratorTest.java new file mode 100644 index 00000000000..ff96c2b3aec --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/JMenuItemSetAcceleratorTest.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; + +/* + * @test + * @key headful + * @bug 8296275 + * @summary To verify the setAccelerator method of JMenuItem. + * @requires (os.family=="mac") + * @run main JMenuItemSetAcceleratorTest + */ + +public class JMenuItemSetAcceleratorTest { + private static JFrame frame; + private static final CountDownLatch actionLatch = new CountDownLatch(1); + private volatile static Point frameAt; + private volatile static Dimension frameSize; + + private static void createAndShow() { + frame = new JFrame("JMenuItem.setAccelerator"); + frame.setLayout(new FlowLayout()); + + JMenuBar bar = new JMenuBar(); + JMenu menu = new JMenu("File"); + JMenuItem menuItem = new JMenuItem("Menu Item"); + + menuItem.setAccelerator( + KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.META_DOWN_MASK)); + menuItem.addActionListener(e -> { + System.out.println("menu item action."); + actionLatch.countDown(); + }); + + menu.add(menuItem); + bar.add(menu); + + frame.setJMenuBar(bar); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(JMenuItemSetAcceleratorTest::createAndShow); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.setAutoWaitForIdle(true); + + EventQueue.invokeAndWait(() -> { + frameAt = frame.getLocationOnScreen(); + frameSize = frame.getSize(); + }); + + robot.mouseMove(frameAt.x + frameSize.width / 2, + frameAt.y + frameSize.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_META); + robot.keyPress(KeyEvent.VK_M); + robot.keyRelease(KeyEvent.VK_M); + robot.keyRelease(KeyEvent.VK_META); + + if (!actionLatch.await(5, TimeUnit.SECONDS)) { + throw new RuntimeException( + "Hasn't received the JMenuItem action event by pressing " + + "accelerator keys, test fails."); + } + System.out.println("Test passed, received action event on menu item."); + } finally { + SwingUtilities.invokeAndWait(JMenuItemSetAcceleratorTest::disposeFrame); + } + } + + public static void disposeFrame() { + if (frame != null) { + frame.dispose(); + } + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/7156657/bug7156657.java b/test/jdk/javax/swing/JPopupMenu/7156657/bug7156657.java index a018ad0455d..b6f4a4c3aff 100644 --- a/test/jdk/javax/swing/JPopupMenu/7156657/bug7156657.java +++ b/test/jdk/javax/swing/JPopupMenu/7156657/bug7156657.java @@ -25,12 +25,18 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Window; import java.awt.image.BufferedImage; +import java.io.File; import java.util.concurrent.Callable; +import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPanel; @@ -103,24 +109,56 @@ public void run() { Rectangle popupRectangle = Util.invokeOnEDT(new Callable() { @Override public Rectangle call() throws Exception { - return popupMenu.getBounds(); + return new Rectangle(popupMenu.getLocationOnScreen(), + popupMenu.getSize()); } }); BufferedImage redBackgroundCapture = robot.createScreenCapture(popupRectangle); + BufferedImage redFrame = robot.createScreenCapture(frame.getBounds()); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { lowerFrame.getContentPane().setBackground(Color.GREEN); + lowerFrame.invalidate(); } }); robot.waitForIdle(); + robot.delay(1000); // Give frame time to repaint BufferedImage greenBackgroundCapture = robot.createScreenCapture(popupRectangle); + BufferedImage greenFrame = robot.createScreenCapture(frame.getBounds()); if (Util.compareBufferedImages(redBackgroundCapture, greenBackgroundCapture)) { + try { + GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + for (int i = 0; i < devices.length; i++) { + GraphicsConfiguration[] screens = devices[i].getConfigurations(); + for (int j = 0; j < screens.length; j++) { + BufferedImage fullScreen = robot.createScreenCapture(screens[j].getBounds()); + if (screens[j].getBounds().intersects(popupRectangle)) { + Graphics g = fullScreen.getGraphics(); + g.setColor(Color.CYAN); + g.drawRect(popupRectangle.x - 1, popupRectangle.y - 1, + popupRectangle.width + 2, popupRectangle.height + 2); + g.dispose(); + } + ImageIO.write(fullScreen, "png", new File("dev" + i + "scr" + j + ".png")); + } + } + ImageIO.write(redFrame, "png", new File("redframe.png")); + ImageIO.write(redBackgroundCapture, "png", new File("redbg.png")); + ImageIO.write(greenFrame, "png", new File("greenframe.png")); + ImageIO.write(greenBackgroundCapture, "png", new File("greenbg.png")); + } finally { + SwingUtilities.invokeAndWait(() -> { + frame.dispose(); + lowerFrame.dispose(); + }); + } + robot.waitForIdle(); throw new RuntimeException("The test failed"); } @@ -148,8 +186,8 @@ public static void setOpaque(Window window, boolean opaque) { private static JFrame createFrame() { JFrame result = new JFrame(); - result.setLocation(0, 0); result.setSize(400, 300); + result.setLocationRelativeTo(null); result.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); result.setUndecorated(true); diff --git a/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java new file mode 100644 index 00000000000..842a62558cf --- /dev/null +++ b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @key headful + * @bug 8223788 + * @summary JSpinner buttons in JColorChooser dialog may capture focus + * using TAB Key + * @run main JSpinnerButtonFocusTest + */ + +import java.awt.Robot; +import java.awt.BorderLayout; +import java.awt.ContainerOrderFocusTraversalPolicy; +import java.awt.event.KeyEvent; +import javax.swing.JFrame; +import javax.swing.JSpinner; +import javax.swing.JSpinner.DefaultEditor; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +public class JSpinnerButtonFocusTest { + static JFrame frame; + static Robot robot; + static JSpinner spinner1, spinner2; + static DefaultEditor editor2; + static boolean jTextFieldFocusStatus; + + public static void main(String args[]) throws Exception { + + for (UIManager.LookAndFeelInfo LF : UIManager.getInstalledLookAndFeels()) { + try { + UIManager.setLookAndFeel(LF.getClassName()); + robot = new Robot(); + robot.setAutoDelay(50); + robot.setAutoWaitForIdle(true); + + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + spinner1 = new JSpinner(); + spinner2 = new JSpinner(); + + frame.setLayout(new BorderLayout()); + frame.getContentPane().add(spinner1, BorderLayout.NORTH); + frame.getContentPane().add(spinner2, BorderLayout.SOUTH); + + ((DefaultEditor)spinner1.getEditor()).setFocusable(false); + spinner1.setFocusable(false); + + editor2 = (DefaultEditor) spinner2.getEditor(); + editor2.setFocusable(false); + spinner2.setFocusable(false); + + frame.setFocusTraversalPolicy( + new ContainerOrderFocusTraversalPolicy()); + frame.setFocusTraversalPolicyProvider(true); + + frame.pack(); + frame.setVisible(true); + }); + + robot.waitForIdle(); + pressTab(5); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + jTextFieldFocusStatus = editor2.getTextField().isFocusOwner(); + }); + + if (!jTextFieldFocusStatus) { + throw new RuntimeException( + "Spinner's Text Field doesn't have focus "); + } + } finally { + if(frame != null){ + SwingUtilities.invokeAndWait(frame::dispose); + } + } + } + } + + public static void pressTab(int n) { + for (int i = 0; i < n; i++) { + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + } + } +} diff --git a/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.html b/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.html deleted file mode 100644 index 5737912f130..00000000000 --- a/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - diff --git a/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java b/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java index c2e2c14d7d8..4f78e73b911 100644 --- a/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java +++ b/test/jdk/javax/swing/JTabbedPane/4209065/bug4209065.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,37 +21,63 @@ * questions. */ -import java.awt.EventQueue; +/* + * @test + * @bug 4209065 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary To test if the style of the text on the tab matches the description. + * @run main/manual bug4209065 + */ + import java.lang.reflect.InvocationTargetException; -import javax.swing.JApplet; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; -/** - * @test - * @bug 4209065 - * @author Georges Saab - * @run applet/manual=yesno bug4209065.html - */ -public final class bug4209065 extends JApplet { - - @Override - public void init() { - try { - EventQueue.invokeAndWait(this::createTabbedPane); - } catch (InterruptedException | InvocationTargetException e) { - throw new RuntimeException(e); - } + +public final class bug4209065 { + + private static JFrame frame; + private static final String text = + "If the style of the text on the tabs matches the descriptions," + + "\npress PASS.\n\nNOTE: where a large font is used, the" + + " text may be larger\nthan the tab height but this is OK" + + " and NOT a failure."; + + public static void createAndShowGUI() throws InterruptedException, + InvocationTargetException { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("JTabbedPane"); + + JTabbedPane tp = new JTabbedPane(); + + tp.addTab("
big
", + new JLabel()); + tp.addTab("
red
", + new JLabel()); + tp.addTab("
Bold Italic!
", + new JLabel()); + + frame.getContentPane().add(tp); + frame.setSize(400, 400); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + + + PassFailJFrame.addTestFrame(frame); + PassFailJFrame.positionTestFrame(frame, + PassFailJFrame.Position.HORIZONTAL); + }); } - private void createTabbedPane() { - JTabbedPane tp = new JTabbedPane(); - getContentPane().add(tp); - String text = "
If the style of the text on the tabs matches" - + "
the descriptions, press PASS
"; - tp.addTab("
big
", new JLabel(text)); - tp.addTab("
red
", new JLabel(text)); - tp.addTab("
Bold Italic!
", new JLabel(text)); + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame passFailJFrame = new PassFailJFrame("JTabbedPane " + + "Test Instructions", text, 5, 19, 35); + createAndShowGUI(); + passFailJFrame.awaitAndCheck(); } -} +} \ No newline at end of file diff --git a/test/jdk/javax/swing/Popup/TaskbarPositionTest.java b/test/jdk/javax/swing/Popup/TaskbarPositionTest.java index a088cb07a9a..5378f61c96f 100644 --- a/test/jdk/javax/swing/Popup/TaskbarPositionTest.java +++ b/test/jdk/javax/swing/Popup/TaskbarPositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; @@ -33,8 +35,9 @@ import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + import javax.swing.AbstractAction; import javax.swing.JComboBox; import javax.swing.JFrame; @@ -47,54 +50,61 @@ import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; -import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; + +import jtreg.SkippedException; -/** +/* * @test * @bug 4245587 4474813 4425878 4767478 8015599 * @key headful * @summary Tests the location of the heavy weight popup portion of JComboBox, * JMenu and JPopupMenu. + * The test uses Ctrl+Down Arrow which is a system shortcut on macOS, + * disable it in system settings, otherwise the test will fail * @library ../regtesthelpers + * @library /test/lib * @build Util + * @build jtreg.SkippedException * @run main TaskbarPositionTest */ public class TaskbarPositionTest implements ActionListener { - private boolean done; - private Throwable error; - private static TaskbarPositionTest test; private static JFrame frame; private static JPopupMenu popupMenu; private static JPanel panel; + private static JComboBox combo1; private static JComboBox combo2; - private static JMenuBar menubar; + private static JMenu menu1; private static JMenu menu2; + private static JMenu submenu; + private static Rectangle fullScreenBounds; // The usable desktop space: screen size - screen insets. private static Rectangle screenBounds; - private static String[] numData = { + + private static final String[] numData = { "One", "Two", "Three", "Four", "Five", "Six", "Seven" }; - private static String[] dayData = { + private static final String[] dayData = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; - private static char[] mnDayData = { + private static final char[] mnDayData = { 'M', 'T', 'W', 'R', 'F', 'S', 'U' }; public TaskbarPositionTest() { frame = new JFrame("Use CTRL-down to show a JPopupMenu"); frame.setContentPane(panel = createContentPane()); - frame.setJMenuBar(createMenuBar("1 - First Menu", true)); + frame.setJMenuBar(createMenuBar()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // CTRL-down will show the popup. panel.getInputMap().put(KeyStroke.getKeyStroke( - KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP"); + KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK), "OPEN_POPUP"); panel.getActionMap().put("OPEN_POPUP", new PopupHandler()); frame.pack(); @@ -103,7 +113,6 @@ public TaskbarPositionTest() { fullScreenBounds = new Rectangle(new Point(), toolkit.getScreenSize()); screenBounds = new Rectangle(new Point(), toolkit.getScreenSize()); - // Reduce the screen bounds by the insets. GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc != null) { @@ -116,37 +125,56 @@ public TaskbarPositionTest() { } // Place the frame near the bottom. - frame.setLocation(0, screenBounds.y + screenBounds.height - frame.getHeight()); + frame.setLocation(screenBounds.x, + screenBounds.y + screenBounds.height - frame.getHeight()); frame.setVisible(true); } - public static class ComboPopupCheckListener implements PopupMenuListener { + private static class ComboPopupCheckListener implements PopupMenuListener { + @Override public void popupMenuCanceled(PopupMenuEvent ev) { } + @Override public void popupMenuWillBecomeVisible(PopupMenuEvent ev) { } + @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) { - Point cpos = combo1.getLocation(); - SwingUtilities.convertPointToScreen(cpos, panel); - - JPopupMenu pm = (JPopupMenu) combo1.getUI().getAccessibleChild(combo1, 0); - - if (pm != null) { - Point p = pm.getLocation(); - SwingUtilities.convertPointToScreen(p, pm); - if (p.y+1 < cpos.y) { - System.out.println("p.y " + p.y + " cpos.y " + cpos.y); - throw new RuntimeException("ComboBox popup is wrongly aligned"); - } // check that popup was opened down + JComboBox combo = (JComboBox) ev.getSource(); + Point comboLoc = combo.getLocationOnScreen(); + + JPopupMenu popupMenu = (JPopupMenu) combo.getUI().getAccessibleChild(combo, 0); + + Point popupMenuLoc = popupMenu.getLocationOnScreen(); + Dimension popupSize = popupMenu.getSize(); + + isPopupOnScreen(popupMenu, fullScreenBounds); + + if (comboLoc.x > 0) { + // The frame is located at the bottom of the screen, + // the combo popups should open upwards + if (popupMenuLoc.y + popupSize.height < comboLoc.y) { + System.err.println("popup " + popupMenuLoc + + " combo " + comboLoc); + throw new RuntimeException("ComboBox popup should open upwards"); + } + } else { + // The frame has been moved to negative position away from + // the bottom of the screen, the combo popup should + // open downwards in this case + if (popupMenuLoc.y + 1 < comboLoc.y) { + System.err.println("popup " + popupMenuLoc + + " combo " + comboLoc); + throw new RuntimeException("ComboBox popup should open downwards"); + } } } } - private class PopupHandler extends AbstractAction { - + private static class PopupHandler extends AbstractAction { + @Override public void actionPerformed(ActionEvent e) { if (!popupMenu.isVisible()) { popupMenu.show((Component) e.getSource(), 40, 40); @@ -155,18 +183,20 @@ public void actionPerformed(ActionEvent e) { } } - class PopupListener extends MouseAdapter { + private static class PopupListener extends MouseAdapter { - private JPopupMenu popup; + private final JPopupMenu popup; public PopupListener(JPopupMenu popup) { this.popup = popup; } + @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } + @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } @@ -182,121 +212,137 @@ private void maybeShowPopup(MouseEvent e) { /** * Tests if the popup is on the screen. */ - public static void isPopupOnScreen(JPopupMenu popup, Rectangle checkBounds) { + private static void isPopupOnScreen(JPopupMenu popup, Rectangle checkBounds) { + if (!popup.isVisible()) { + throw new RuntimeException("Popup not visible"); + } Dimension dim = popup.getSize(); - Point pt = new Point(); - SwingUtilities.convertPointToScreen(pt, popup); + Point pt = popup.getLocationOnScreen(); Rectangle bounds = new Rectangle(pt, dim); if (!SwingUtilities.isRectangleContainingRectangle(checkBounds, bounds)) { - throw new RuntimeException("We do not match! " + checkBounds + " / " + bounds); + throw new RuntimeException("Popup is outside of screen bounds " + + checkBounds + " / " + bounds); } + } + private static void isComboPopupOnScreen(JComboBox comboBox) { + if (!comboBox.isPopupVisible()) { + throw new RuntimeException("ComboBox popup not visible"); + } + JPopupMenu popupMenu = (JPopupMenu) comboBox.getUI().getAccessibleChild(comboBox, 0); + isPopupOnScreen(popupMenu, screenBounds); } - private JPanel createContentPane() { - JPanel panel = new JPanel(); + private JPanel createContentPane() { combo1 = new JComboBox<>(numData); - panel.add(combo1); + combo1.addPopupMenuListener(new ComboPopupCheckListener()); + combo2 = new JComboBox<>(dayData); combo2.setEditable(true); - panel.add(combo2); - panel.setSize(300, 200); + combo2.addPopupMenuListener(new ComboPopupCheckListener()); popupMenu = new JPopupMenu(); - JMenuItem item; for (int i = 0; i < dayData.length; i++) { - item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i])); + JMenuItem item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i])); item.addActionListener(this); } - panel.addMouseListener(new PopupListener(popupMenu)); JTextField field = new JTextField("CTRL+down for Popup"); // CTRL-down will show the popup. field.getInputMap().put(KeyStroke.getKeyStroke( - KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP"); + KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK), "OPEN_POPUP"); field.getActionMap().put("OPEN_POPUP", new PopupHandler()); + JPanel panel = new JPanel(); + panel.add(combo1); + panel.add(combo2); + panel.setSize(300, 200); + panel.addMouseListener(new PopupListener(popupMenu)); panel.add(field); return panel; } - /** - * @param str name of Menu - * @param bFlag set mnemonics on menu items - */ - private JMenuBar createMenuBar(String str, boolean bFlag) { - menubar = new JMenuBar(); - - menu1 = new JMenu(str); - menu1.setMnemonic(str.charAt(0)); - menu1.addActionListener(this); + private JMenuBar createMenuBar() { + JMenuBar menubar = new JMenuBar(); + menu1 = new JMenu("1 - First Menu"); + menu1.setMnemonic('1'); + createSubMenu(menu1, "1 JMenuItem", 8, null); menubar.add(menu1); - for (int i = 0; i < 8; i++) { - JMenuItem menuitem = new JMenuItem("1 JMenuItem" + i); - menuitem.addActionListener(this); - if (bFlag) { - menuitem.setMnemonic('0' + i); - } - menu1.add(menuitem); - } - // second menu menu2 = new JMenu("2 - Second Menu"); - menu2.addActionListener(this); menu2.setMnemonic('2'); - + createSubMenu(menu2, "2 JMenuItem", 4, null); + menu2.add(new JSeparator()); menubar.add(menu2); - for (int i = 0; i < 5; i++) { - JMenuItem menuitem = new JMenuItem("2 JMenuItem" + i); - menuitem.addActionListener(this); - if (bFlag) { - menuitem.setMnemonic('0' + i); - } - menu2.add(menuitem); - } - JMenu submenu = new JMenu("Sub Menu"); + submenu = new JMenu("Sub Menu"); submenu.setMnemonic('S'); - submenu.addActionListener(this); - for (int i = 0; i < 5; i++) { - JMenuItem menuitem = new JMenuItem("S JMenuItem" + i); - menuitem.addActionListener(this); - if (bFlag) { - menuitem.setMnemonic('0' + i); - } - submenu.add(menuitem); - } - menu2.add(new JSeparator()); + createSubMenu(submenu, "S JMenuItem", 4, this); menu2.add(submenu); return menubar; } + private static void createSubMenu(JMenu menu, String prefix, int count, ActionListener action) { + for (int i = 0; i < count; ++i) { + JMenuItem menuitem = new JMenuItem(prefix + i); + menu.add(menuitem); + if (action != null) { + menuitem.addActionListener(action); + } + } + } + + public void actionPerformed(ActionEvent evt) { Object obj = evt.getSource(); if (obj instanceof JMenuItem) { - // put the focus on the noneditable combo. + // put the focus on the non-editable combo. combo1.requestFocus(); } } + private static void hidePopup(Robot robot) { + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + } + public static void main(String[] args) throws Throwable { + GraphicsDevice mainScreen = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice(); + Rectangle mainScreenBounds = mainScreen.getDefaultConfiguration() + .getBounds(); + GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getScreenDevices(); + for (GraphicsDevice screen : screens) { + if (screen == mainScreen) { + continue; + } + + Rectangle bounds = screen.getDefaultConfiguration() + .getBounds(); + if (bounds.x < 0) { + // The test may fail if a screen have negative origin + throw new SkippedException("Configurations with negative screen" + + " origin are not supported"); + } + if (bounds.y >= mainScreenBounds.height) { + // The test may fail if there's a screen to bottom of the main monitor + throw new SkippedException("Configurations with a screen beneath" + + " the main one are not supported"); + } + } try { // Use Robot to automate the test - Robot robot; - robot = new Robot(); + Robot robot = new Robot(); robot.setAutoDelay(50); - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - test = new TaskbarPositionTest(); - } - }); + SwingUtilities.invokeAndWait(TaskbarPositionTest::new); robot.waitForIdle(); robot.delay(1000); @@ -310,58 +356,90 @@ public void run() { // 2 menu with sub menu robot.keyPress(KeyEvent.VK_RIGHT); robot.keyRelease(KeyEvent.VK_RIGHT); - Util.hitMnemonics(robot, KeyEvent.VK_S); + // Open the submenu + robot.keyPress(KeyEvent.VK_S); + robot.keyRelease(KeyEvent.VK_S); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> isPopupOnScreen(menu2.getPopupMenu(), screenBounds)); + SwingUtilities.invokeAndWait(() -> isPopupOnScreen(submenu.getPopupMenu(), screenBounds)); + // Hit Enter to perform the action of + // a selected menu item in the submenu + // which requests focus on combo1, non-editable combo box robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); - // Focus should go to non editable combo box robot.waitForIdle(); - robot.delay(500); + // Focus should go to combo1 + // Open combo1 popup robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); - // How do we check combo boxes? + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> isComboPopupOnScreen(combo1)); + hidePopup(robot); - // Editable combo box + // Move focus to combo2, editable combo box robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); + + robot.waitForIdle(); + + // Open combo2 popup robot.keyPress(KeyEvent.VK_DOWN); robot.keyRelease(KeyEvent.VK_DOWN); - // combo1.getUI(); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> isComboPopupOnScreen(combo2)); + hidePopup(robot); - // Popup from Text field + // Move focus to the text field robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); + + robot.waitForIdle(); + + // Open its popup robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_DOWN); robot.keyRelease(KeyEvent.VK_DOWN); robot.keyRelease(KeyEvent.VK_CONTROL); - // Popup from a mouse click. - Point pt = new Point(2, 2); - SwingUtilities.convertPointToScreen(pt, panel); - robot.mouseMove(pt.x, pt.y); - robot.mousePress(InputEvent.BUTTON3_MASK); - robot.mouseRelease(InputEvent.BUTTON3_MASK); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> isPopupOnScreen(popupMenu, fullScreenBounds)); + hidePopup(robot); + + // Popup from a mouse click + SwingUtilities.invokeAndWait(() -> { + Point pt = panel.getLocationOnScreen(); + pt.translate(4, 4); + robot.mouseMove(pt.x, pt.y); + }); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + // Ensure popupMenu is shown within screen bounds robot.waitForIdle(); - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setLocation(-30, 100); - combo1.addPopupMenuListener(new ComboPopupCheckListener()); - combo1.requestFocus(); - } + SwingUtilities.invokeAndWait(() -> isPopupOnScreen(popupMenu, fullScreenBounds)); + hidePopup(robot); + + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + frame.setLocation(-30, 100); + combo1.requestFocus(); }); + robot.waitForIdle(); + + // Open combo1 popup again robot.keyPress(KeyEvent.VK_DOWN); robot.keyRelease(KeyEvent.VK_DOWN); - robot.keyPress(KeyEvent.VK_ESCAPE); - robot.keyRelease(KeyEvent.VK_ESCAPE); + + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> isComboPopupOnScreen(combo1)); + hidePopup(robot); robot.waitForIdle(); } finally { diff --git a/test/jdk/javax/swing/dnd/7171812/bug7171812.java b/test/jdk/javax/swing/dnd/7171812/bug7171812.java index ff985b1a426..405ef6c5a46 100644 --- a/test/jdk/javax/swing/dnd/7171812/bug7171812.java +++ b/test/jdk/javax/swing/dnd/7171812/bug7171812.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,26 +26,40 @@ * @key headful * @bug 7171812 * @summary [macosx] Views keep scrolling back to the drag position after DnD - * @author Alexander Zuev * @run main bug7171812 */ -import java.awt.*; -import java.awt.dnd.*; +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; import java.awt.event.InputEvent; -import javax.swing.*; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; public class bug7171812 { static JFrame mainFrame; static String listData[]; static JListWithScroll list; static JScrollPane scrollPane; + static volatile Point pt; + static volatile int height; /** * @param args the command line arguments */ public static void main(String[] args) throws Exception{ + Robot robot = new Robot(); + robot.setAutoDelay(100); + robot.setAutoWaitForIdle(true); + SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { @@ -53,18 +67,21 @@ public void run() { } }); - Robot robot = new Robot(); - robot.setAutoDelay(10); robot.waitForIdle(); - robot.mouseMove(scrollPane.getLocationOnScreen().x + 5, scrollPane.getLocationOnScreen().y + 5); - robot.mousePress(InputEvent.BUTTON1_MASK); - for(int offset = 5; offset < scrollPane.getHeight()-20; offset++) { - robot.mouseMove(scrollPane.getLocationOnScreen().x+5, scrollPane.getLocationOnScreen().y+offset); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + pt = scrollPane.getLocationOnScreen(); + height = scrollPane.getHeight(); + }); + robot.mouseMove(pt.x + 5, pt.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for(int offset = 5; offset < height - 20; offset++) { + robot.mouseMove(pt.x + 5, pt.y + offset); } for(int offset = 5; offset < 195; offset++) { - robot.mouseMove(scrollPane.getLocationOnScreen().x+offset, scrollPane.getLocationOnScreen().y+scrollPane.getHeight()-20); + robot.mouseMove(pt.x + offset, pt.y + height - 20); } - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); try { SwingUtilities.invokeAndWait(new Runnable() { @Override diff --git a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java index f1f5751ab14..0c1b784ecd3 100644 --- a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java +++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * java.base/sun.security.x509 * java.xml.crypto/org.jcp.xml.dsig.internal.dom * jdk.httpserver/com.sun.net.httpserver + * @library /test/lib + * @build jdk.test.lib.Asserts * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java * @run main/othervm/timeout=300 -Dsun.net.httpserver.nodelay=true GenerationTests @@ -92,6 +94,8 @@ import javax.xml.transform.stream.StreamResult; import org.w3c.dom.*; +import jdk.test.lib.Asserts; + /** * Test that recreates merlin-xmldsig-twenty-three test vectors (and more) * but with different keys and X.509 data. @@ -286,6 +290,7 @@ private static enum KeyInfoType { public static void main(String args[]) throws Exception { setup(); + test_context_iterator(); test_create_signature_enveloped_dsa(1024); test_create_signature_enveloped_dsa(2048); test_create_signature_enveloping_b64_dsa(); @@ -1863,6 +1868,48 @@ static boolean test_create_detached_signature0(String canonicalizationMethod, return true; } + static boolean test_context_iterator() throws Exception { + System.out.println("Testing context iterator() method."); + + Reference ref = fac.newReference("#object", + fac.newDigestMethod(DigestMethod.SHA512, null)); + SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha512, + Collections.singletonList(ref)); + + Document doc = db.newDocument(); + XMLObject obj = fac.newXMLObject(Collections.singletonList( + new DOMStructure(doc.createTextNode("test text"))), "object", + null, null); + + DOMSignContext dsc = new DOMSignContext(signingKey, doc); + Asserts.assertNotNull(dsc.iterator()); + Asserts.assertFalse(dsc.iterator().hasNext()); + + String namespaceURI = "https://example.com/ns"; + String idAttrValue = "id1"; + String elementQualifiedName = "test:data"; + + Element elm = doc.createElementNS(namespaceURI, elementQualifiedName); + elm.setAttributeNS(namespaceURI, "test:id", idAttrValue); + dsc.setIdAttributeNS(elm, namespaceURI, "id"); + + Iterator> iter = dsc.iterator(); + Asserts.assertTrue(dsc.iterator().hasNext()); + + Map.Entry element = iter.next(); + Asserts.assertEquals(element.getKey(), idAttrValue); + Asserts.assertEquals(element.getValue().getNodeName(), elementQualifiedName); + + try { + iter.remove(); + throw new RuntimeException( + "The expected UnsupportedOperationException was not thrown."); + } catch (UnsupportedOperationException exc) { + // this is expected + } + return true; + } + private static Key[] getCachedKeys(String signatureMethod) { return cachedKeys.computeIfAbsent(signatureMethod, sm -> { try { diff --git a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java index 1dbcceb216b..d0e252a16a6 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java +++ b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java @@ -174,6 +174,7 @@ private static Document createDocument(String content) throws ParserConfiguratio insertSetting(doc, EventNames.JavaExceptionThrow, "threshold", "0 ns"); insertSetting(doc, EventNames.JavaErrorThrow, "threshold", "0 ns"); insertSetting(doc, EventNames.SecurityProperty, "threshold", "0 ns"); + insertSetting(doc, EventNames.SecurityProviderService, "threshold", "0 ns"); insertSetting(doc, EventNames.TLSHandshake, "threshold", "0 ns"); insertSetting(doc, EventNames.X509Certificate, "threshold", "0 ns"); insertSetting(doc, EventNames.X509Validation, "threshold", "0 ns"); diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java index 8d3864c2164..ddd5ebdeb24 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java @@ -206,6 +206,7 @@ private static void testSettingConfiguration(String configurationName) throws Ex settingValues.put(EventNames.X509Certificate + "#threshold", "0 ns"); settingValues.put(EventNames.X509Validation + "#threshold", "0 ns"); settingValues.put(EventNames.Deserialization + "#threshold", "0 ns"); + settingValues.put(EventNames.SecurityProviderService + "#threshold", "0 ns"); try (Recording recording = new Recording(c)) { Map eventTypes = new HashMap<>(); diff --git a/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java new file mode 100644 index 00000000000..a886a7e3b20 --- /dev/null +++ b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jfr.event.security; + +import java.security.*; +import java.security.cert.CertPathBuilder; +import java.util.Collections; +import java.util.List; +import java.util.function.*; + +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.test.lib.Asserts; +import jdk.test.lib.jfr.Events; +import jdk.test.lib.jfr.EventNames; + +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; + +/* + * @test + * @bug 8254711 + * @summary Add JFR events for security crypto algorithms + * @key jfr + * @requires vm.hasJFR + * @library /test/lib + * @modules jdk.jfr/jdk.jfr.events + * @run main/othervm jdk.jfr.event.security.TestSecurityProviderServiceEvent + */ +public class TestSecurityProviderServiceEvent { + + public static void main(String[] args) throws Exception { + testAlg(cipherFunc, "AES", "SunJCE", + "SunEC", "Cipher", 1, Collections.emptyList()); + testAlg(signatureFunc, "SHA256withRSA", "SunRsaSign", + "SunEC", "Signature", 2, List.of("MessageDigest")); + testAlg(messageDigestFunc, "SHA-512", "SUN", + "SunEC", "MessageDigest", 1, Collections.emptyList()); + testAlg(keystoreFunc, "PKCS12", "SUN", + "SunEC", "KeyStore", 1, Collections.emptyList()); + testAlg(certPathBuilderFunc, "PKIX", "SUN", + "SunEC", "CertPathBuilder", 2, List.of("CertificateFactory")); + } + + private static void testAlg(BiFunction bif, String alg, + String workingProv, String brokenProv, String algType, + int expected, List other) throws Exception { + // bootstrap security Provider services + Provider p = bif.apply(alg, workingProv); + + try (Recording recording = new Recording()) { + recording.enable(EventNames.SecurityProviderService); + recording.start(); + p = bif.apply(alg, workingProv); + bif.apply(alg, brokenProv); + recording.stop(); + List events = Events.fromRecording(recording); + Asserts.assertEquals(events.size(), expected, "Incorrect number of events"); + assertEvent(events, algType, alg, p.getName(), other); + } + } + + private static BiFunction cipherFunc = (s1, p1 ) -> { + Cipher c; + try { + c = Cipher.getInstance(s1, p1); + return c.getProvider(); + } catch (NoSuchAlgorithmException | NoSuchPaddingException | NoSuchProviderException e) { + // expected + } + return null; + }; + + private static BiFunction signatureFunc = (s1, p1 ) -> { + Signature s; + try { + s = Signature.getInstance(s1, p1); + return s.getProvider(); + } catch (NoSuchAlgorithmException | NoSuchProviderException e) { + // expected + } + return null; + }; + + private static BiFunction messageDigestFunc = (s1, p1 ) -> { + MessageDigest md; + try { + md = MessageDigest.getInstance(s1, p1); + return md.getProvider(); + } catch (NoSuchAlgorithmException | NoSuchProviderException e) { + // expected + } + return null; + }; + + private static BiFunction keystoreFunc = (s1, p1 ) -> { + KeyStore ks; + try { + ks = KeyStore.getInstance(s1, p1); + return ks.getProvider(); + } catch (NoSuchProviderException | KeyStoreException e) { + // expected + } + return null; + }; + + private static BiFunction certPathBuilderFunc = (s1, p1 ) -> { + CertPathBuilder cps; + try { + cps = CertPathBuilder.getInstance(s1, p1); + return cps.getProvider(); + } catch (NoSuchProviderException | NoSuchAlgorithmException e) { + // expected + } + return null; + }; + + private static void assertEvent(List events, String type, + String alg, String workingProv, List other) { + boolean secondaryEventOK = other.isEmpty() ? true : false; + for (RecordedEvent e : events) { + if (other.contains(e.getValue("type"))) { + // secondary operation in service stack while constructing this request + secondaryEventOK = true; + continue; + } + Events.assertField(e, "provider").equal(workingProv); + Events.assertField(e, "type").equal(type); + Events.assertField(e, "algorithm").equal(alg); + } + if (!secondaryEventOK) { + throw new RuntimeException("Secondary events missing"); + } + + } +} diff --git a/test/jdk/jdk/security/jarsigner/JarWithOneNonDisabledDigestAlg.java b/test/jdk/jdk/security/jarsigner/JarWithOneNonDisabledDigestAlg.java index 899500672ad..f0c25dc85bb 100644 --- a/test/jdk/jdk/security/jarsigner/JarWithOneNonDisabledDigestAlg.java +++ b/test/jdk/jdk/security/jarsigner/JarWithOneNonDisabledDigestAlg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @summary Check that jar entry with at least one non-disabled digest * algorithm in manifest is treated as signed * @modules java.base/sun.security.tools.keytool + * @modules java.base/sun.security.util * @library /test/lib * @build jdk.test.lib.util.JarUtils * jdk.test.lib.security.SecurityUtils @@ -34,61 +35,94 @@ */ import java.io.InputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; +import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.security.CodeSigner; import java.security.KeyStore; +import java.security.cert.CertPathValidatorException; +import java.util.Collections; +import java.util.Date; import java.util.Enumeration; -import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipFile; import jdk.security.jarsigner.JarSigner; import jdk.test.lib.util.JarUtils; -import jdk.test.lib.security.SecurityUtils; +import sun.security.util.ConstraintsParameters; +import sun.security.util.DisabledAlgorithmConstraints; +import sun.security.util.JarConstraintsParameters; public class JarWithOneNonDisabledDigestAlg { private static final String PASS = "changeit"; - private static final String TESTFILE1 = "testfile1"; - private static final String TESTFILE2 = "testfile2"; + private static final Path TESTFILE1 = Path.of("testfile1"); + private static final Path TESTFILE2 = Path.of("testfile2"); + private static final Path UNSIGNED_JAR = Path.of("unsigned.jar"); + private static final Path SIGNED_JAR = Path.of("signed.jar"); + private static final Path SIGNED_TWICE_JAR = Path.of("signed2.jar"); + private static final Path MULTI_SIGNED_JAR = Path.of("multi-signed.jar"); + private static final Path CURRENT_DIR = Path.of("."); public static void main(String[] args) throws Exception { - SecurityUtils.removeFromDisabledAlgs("jdk.jar.disabledAlgorithms", - List.of("SHA1")); - Files.write(Path.of(TESTFILE1), TESTFILE1.getBytes()); - JarUtils.createJarFile(Path.of("unsigned.jar"), Path.of("."), - Path.of(TESTFILE1)); + // Sanity check: Assert that MD5 is disabled, SHA-256 enabled + checkDigestAlgorithmPermits(); - genkeypair("-alias SHA1 -sigalg SHA1withRSA"); - genkeypair("-alias SHA256 -sigalg SHA256withRSA"); + // Create an unsigned JAR with a single file + Files.write(TESTFILE1, TESTFILE1.toString().getBytes()); + JarUtils.createJarFile(UNSIGNED_JAR, CURRENT_DIR, TESTFILE1); - KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); - try (FileInputStream fis = new FileInputStream("keystore")) { - ks.load(fis, PASS.toCharArray()); - } + // Generate a keystore with two different signers + genkeypair("-alias SIGNER1"); + genkeypair("-alias SIGNER2"); + KeyStore ks = loadKeyStore(); // Sign JAR twice with same signer but different digest algorithms // so that each entry in manifest file contains two digest values. - signJarFile(ks, "SHA1", "MD5", "unsigned.jar", "signed.jar"); - signJarFile(ks, "SHA1", "SHA1", "signed.jar", "signed2.jar"); - checkThatJarIsSigned("signed2.jar", false); + // Note that MD5 is a disabled digest algorithm, while SHA-256 is not + signJarFile(ks, "SIGNER1", "MD5", UNSIGNED_JAR, SIGNED_JAR); + signJarFile(ks, "SIGNER1", "SHA256", SIGNED_JAR, SIGNED_TWICE_JAR); + checkThatJarIsSigned(SIGNED_TWICE_JAR, Map.of(TESTFILE1.toString(), 1)); // add another file to the JAR - Files.write(Path.of(TESTFILE2), "testFile2".getBytes()); - JarUtils.updateJarFile(Path.of("signed2.jar"), Path.of("."), - Path.of(TESTFILE2)); + Files.write(TESTFILE2, TESTFILE2.toString().getBytes()); + JarUtils.updateJarFile(SIGNED_TWICE_JAR, CURRENT_DIR, TESTFILE2); + + // Sign the updated JAR, now with a different signer and with an enabled digest alg + signJarFile(ks, "SIGNER2", "SHA256", SIGNED_TWICE_JAR, MULTI_SIGNED_JAR); - // Sign again with different signer (SHA256) and SHA-1 digestalg. - // TESTFILE1 should have two signers and TESTFILE2 should have one - // signer. - signJarFile(ks, "SHA256", "SHA1", "signed2.jar", "multi-signed.jar"); + // TESTFILE1 should have two signers and TESTFILE2 should have one signer. + checkThatJarIsSigned(MULTI_SIGNED_JAR, + Map.of(TESTFILE1.toString(), 2, + TESTFILE2.toString(), 1) + ); + } - checkThatJarIsSigned("multi-signed.jar", true); + private static void checkDigestAlgorithmPermits() throws Exception { + ConstraintsParameters cp = new JarConstraintsParameters(Collections.emptyList(), new Date()); + DisabledAlgorithmConstraints jarConstraints = DisabledAlgorithmConstraints.jarConstraints(); + try { + jarConstraints.permits("MD5", cp, false); + throw new Exception("This test assumes that MD5 is disabled"); + } catch (CertPathValidatorException e) { + // Ignore + } + try { + jarConstraints.permits("SHA256", cp, false); + } catch (CertPathValidatorException e) { + throw new Exception("This test assumes that SHA256 is enabled"); + } + } + + private static KeyStore loadKeyStore() throws Exception { + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + try (InputStream fis = Files.newInputStream(Path.of("keystore"))) { + ks.load(fis, PASS.toCharArray()); + } + return ks; } private static KeyStore.PrivateKeyEntry getEntry(KeyStore ks, String alias) @@ -101,12 +135,13 @@ private static KeyStore.PrivateKeyEntry getEntry(KeyStore ks, String alias) private static void genkeypair(String cmd) throws Exception { cmd = "-genkeypair -keystore keystore -storepass " + PASS + - " -keypass " + PASS + " -keyalg rsa -dname CN=Duke " + cmd; + " -keypass " + PASS + " -keyalg rsa -sigalg SHA256withRSA " + + "-dname CN=Duke " + cmd; sun.security.tools.keytool.Main.main(cmd.split(" ")); } private static void signJarFile(KeyStore ks, String alias, - String digestAlg, String inputFile, String outputFile) + String digestAlg, Path inputFile, Path outputFile) throws Exception { JarSigner signer = new JarSigner.Builder(getEntry(ks, alias)) @@ -114,38 +149,36 @@ private static void signJarFile(KeyStore ks, String alias, .signerName(alias) .build(); - try (ZipFile in = new ZipFile(inputFile); - FileOutputStream out = new FileOutputStream(outputFile)) { + try (ZipFile in = new ZipFile(inputFile.toFile()); + OutputStream out = Files.newOutputStream(outputFile)) { signer.sign(in, out); } } - private static void checkThatJarIsSigned(String jarFile, boolean multi) + private static void checkThatJarIsSigned(Path jarFile, Map expected) throws Exception { - try (JarFile jf = new JarFile(jarFile, true)) { + try (JarFile jf = new JarFile(jarFile.toFile(), true)) { Enumeration entries = jf.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); if (entry.isDirectory() || isSigningRelated(entry.getName())) { continue; } - InputStream is = jf.getInputStream(entry); - while (is.read() != -1); + try (InputStream is = jf.getInputStream(entry)) { + is.transferTo(OutputStream.nullOutputStream()); + } CodeSigner[] signers = entry.getCodeSigners(); - if (signers == null) { - throw new Exception("JarEntry " + entry.getName() + - " is not signed"); - } else if (multi) { - if (entry.getName().equals(TESTFILE1) && - signers.length != 2) { - throw new Exception("Unexpected number of signers " + - "for " + entry.getName() + ": " + signers.length); - } else if (entry.getName().equals(TESTFILE2) && - signers.length != 1) { - throw new Exception("Unexpected number of signers " + - "for " + entry.getName() + ": " + signers.length); - } + if (!expected.containsKey(entry.getName())) { + throw new Exception("Unexpected entry " + entry.getName()); + } + int expectedSigners = expected.get(entry.getName()); + int actualSigners = signers == null ? 0 : signers.length; + + if (expectedSigners != actualSigners) { + throw new Exception("Unexpected number of signers " + + "for " + entry.getName() + ": " + actualSigners + + ", expected " + expectedSigners); } } } diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java deleted file mode 100644 index cd1db71c418..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @bug 8189131 - * @summary Interoperability tests with Actalis CA - * @build ValidatePathWithParams - * @run main/othervm/timeout=180 -Djava.security.debug=certpath ActalisCA OCSP - * @run main/othervm/timeout=180 -Djava.security.debug=certpath ActalisCA CRL - */ - - /* - * Obtain test artifacts for Actalis CA from: - * - * Test website with *active* TLS Server certificate: - * https://ssltest-active.actalis.it/ - * - * Test website with *revoked* TLS Server certificate: - * https://ssltest-revoked.actalis.it/ - * - * Test website with *expired* TLS Server certificate: - * https://ssltest-expired.actalis.it/ - */ -public class ActalisCA { - - // Owner: CN=Actalis Organization Validated Server CA G3, O=Actalis S.p.A., - // L=Ponte San Pietro, ST=Bergamo, C=IT - // Issuer: CN=Actalis Authentication Root CA, O=Actalis S.p.A ./03358520967, - // L=Milan, C=IT - // Serial number: 5c3b3f37adfc28fe0fcfd3abf83f8551 - // Valid from: Mon Jul 06 00:20:55 PDT 2020 until: Sun Sep 22 04:22:02 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIHdTCCBV2gAwIBAgIQXDs/N638KP4Pz9Or+D+FUTANBgkqhkiG9w0BAQsFADBr\n" + - "MQswCQYDVQQGEwJJVDEOMAwGA1UEBwwFTWlsYW4xIzAhBgNVBAoMGkFjdGFsaXMg\n" + - "Uy5wLkEuLzAzMzU4NTIwOTY3MScwJQYDVQQDDB5BY3RhbGlzIEF1dGhlbnRpY2F0\n" + - "aW9uIFJvb3QgQ0EwHhcNMjAwNzA2MDcyMDU1WhcNMzAwOTIyMTEyMjAyWjCBiTEL\n" + - "MAkGA1UEBhMCSVQxEDAOBgNVBAgMB0JlcmdhbW8xGTAXBgNVBAcMEFBvbnRlIFNh\n" + - "biBQaWV0cm8xFzAVBgNVB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+Z/+yaZahaP/Vgak/V00se\n" + - "Hdh7F+B6h5HVdwdh+17E2jl+aMTfyvBFcg2H/9Qjyl4TY8NW/6v0DPK52sVt8a35\n" + - "I+7xLGLPohAl4z6pEf2OxgjMNfXXCXS33smRgz1dLQFo8UpAb3rf84zkXaqEI6Qi\n" + - "2P+5pibVFQigRbn4RcE+K2a/nm2M/o+WZTSio+E+YXacnNk71VcO82biOof+jBKT\n" + - "iC3Xi7rAlypmme+QFBw9F1J89ig3smV/HaN8tO0lfTpvm7Zvzd5TkMs=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=ssltest-active.actalis.it, O=Actalis S.p.A., L=Ponte San Pietro, - // ST=Bergamo, C=IT - // Issuer: CN=Actalis Organization Validated Server CA G3, O=Actalis S.p A., - // L=Ponte San Pietro, ST=Bergamo, C=IT - // Serial number: 4a49e2afcd448af3b7f5f14e1cd5954 - // Valid from: Tue Mar 08 08:00:57 PST 2022 until: Wed Mar 08 08:00:57 PST 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIH0jCCBbqgAwIBAgIQBKSeKvzUSK87f18U4c1ZVDANBgkqhkiG9w0BAQsFADCB\n" + - "iTELMAkGA1UEBhMCSVQxEDAOBgNVBAgMB0JlcmdhbW8xGTAXBgNVBAcMEFBvbnRl\n" + - "IFNhbiBQaWV0cm8xFzAVBgNVBAoMDkFjdGFsaXMgUy5wLkEuMTQwMgYDVQQDDCtB\n" + - "Y3RhbGlzIE9yZ2FuaXphdGlvbiBWYWxpZGF0ZWQgU2VydmVyIENBIEczMB4XDTIy\n" + - "MDMwODE2MDA1N1oXDTIzMDMwODE2MDA1N1owdzELMAkGA1UEBhMCSVQxEDAOBgNV\n" + - "BAgMB0JlcmdhbW8xGTAXBgNVBAcMEFBvbnRlIFNhbiBQaWV0cm8xFzAVBgNVBAoM\n" + - "DkFjdGFsaXMgUy5wLkEuMSIwIAYDVQQDDBlzc2x0ZXN0LWFjdGl2ZS5hY3RhbGlz\n" + -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m\n" + - "54DVM6gC8DYhvnZg8ILaLrAwDgYDVR0PAQH/BAQDAgWgMIIBfQYKKwYBBAHWeQIE\n" + - "AgSCAW0EggFpAWcAdQCt9776fP8QyIudPZwePhhqtGcpXc+xDCTKhYY069yCigAA\n" + - "AX9qTFEkAAAEAwBGMEQCIFB4RW+Fca/jj96sFg9JtZVe/CAQq74HAezTi2AD07qL\n" + - "AiBej8APns5uKmaHNYbU6lel6kdowIaUY/+iqX82e2KhrAB2AOg+0No+9QY1MudX\n" + - "KLyJa8kD08vREWvs62nhd31tBr1uAAABf2pMUVMAAAQDAEcwRQIgcopYpSUDiQ2C\n" + - "7j06vgbfsn3ux4REvpbrbWatifLtfVMCIQCi96i+4EhAUOw4dumA7hJwlG+qD/+5\n" + - "uSL3aKB9KR7apAB2AG9Tdqwx8DEZ2JkApFEV/3cVHBHZAsEAKQaNsgiaN9kTAAAB\n" + - "f2pMUYEAAAQDAEcwRQIgdCNjaV7nQcCiVefX28u1vtQMy+rqT4F4i9EVJ2xbqbQC\n" + - "IQCrpcYqt53tX/rSMoGnjFhDGnMhnYyc2AqzpokfhmdcVTANBgkqhkiG9w0BAQsF\n" + - "AAOCAgEAfXISBKP1dZQv1kkWZVDXiVY/fv+068DKq2e8hgBcsN6b9a2rlVfBU2iq\n" + - "W9KqFNET5GDWf1wjM71Itjau8b1A3+apcNdEGQk3eqIOymK5kVtVvAI2ahp4926x\n" + - "Kkt/sexmi1pJGA+eLfTixkCoaESh5P8U7HDW/vUFXm2AtLQih+oT5OVoYt5e9pXr\n" + - "hr8oadm/ZDJxiyDL1vcTIsl2TM4/Fpo2IWxYzUC+YshnuLiRwWI840maJmWFx/lJ\n" + - "Pzdik3P51Uef7VsCSBhTxER09/B4IrEUMDAhVgG5QNbcFSHvnmpV8JLrNuBKUROU\n" + - "xnDsWieKlb5YO6S6PjGOncOrd+k4RCIYRaekSnx52WBKkpqxMEv/rjY1Glx4Cota\n" + - "mpNiYDvZHGzrRQtY2eH17XhFatBxEEbJMA+0QPbFksHcKxAxJgMDncqag4TDq5fT\n" + - "I2NUxqiB51F5w0x+++lyLnUZ+z4BJFZ73VdtfoJ2fsuRhemOoZjHPi/V2exXpAfb\n" + - "pomha3KCrTcuFv1lj8mPx5L4ciNPxuDFgjeXEaTGjS8IvdNoJIrgdHdahMwkwS/y\n" + - "wei7FJ1Ey0maqRUpUlAY6sIQPQ/KDltTuKX/C94C5pYLI0JXCScr5xg6C+r2ckbA\n" + - "rjhpn3C/NptVyZgT8bL4XT5ITrAjwPciBj0yxYzUkrLZO1wKQSQ=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=ssltest-revoked.actalis.it, O=Actalis S.p.A., L=Ponte San Pietro, ST=Bergamo, C=IT - // Issuer: CN=Actalis Organization Validated Server CA G3, O=Actalis S.p.A., - // L=Ponte San Pietro, ST=Bergamo, C=IT - // Serial number: 320955171b78d49507508910da2c5bc4 - // Valid from: Tue Sep 27 03:40:43 PDT 2022 until: Wed Sep 27 03:40:43 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIH1TCCBb2gAwIBAgIQMglVFxt41JUHUIkQ2ixbxDANBgkqhkiG9w0BAQsFADCB\n" + - "iTELMAkGA1UEBhMCSVQxEDAOBgNVBAgMB0JlcmdhbW8xGTAXBgNVBAcMEFBvbnRl\n" + - "IFNhbiBQaWV0cm8xFzAVBgNVBAoMDkFjdGFsaXMgUy5wLkEuMTQwMgYDVQQDDCtB\n" + - "Y3RhbGlzIE9yZ2FuaXphdGlvbiBWYWxpZGF0ZWQgU2VydmVyIENBIEczMB4XDTIy\n" + - "MDkyNzEwNDA0M1oXDTIzMDkyNzEwNDA0M1oweDELMAkGA1UEBhMCSVQxEDAOBgNV\n" + - "BAgMB0JlcmdhbW8xGTAXBgNVBAcMEFBvbnRlIFNhbiBQaWV0cm8xFzAVBgNVBAoM\n" + - "DkFjdGFsaXMgUy5wLkEuMSMwIQYDVQQDDBpzc2x0ZXN0LXJldm9rZWQu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P0Epsr2wcVT9tIFYMGzUpIO51mCk3Aq1AmiQZwZZhqOIN\n" + - "RDx7lGESPj3IgdVfJi9Ing/OUNtS46Ug9DSuDcGqdY7KnTYEUdWGsUJNtnpjd4lS\n" + - "U6oIAeW1aKuOve6iNg1vsFAN57aJNh1ih3BOup58J9ve42bNlAYWN8wiNxM+Aeba\n" + - "ArUSTnH/QEYCyMRD0XqIREVR9VhNODgSZbL3XedYBAW9wImi1whp+u+8aReXd7lC\n" + - "Q3kD9KRyfZ9Kk05Glf3DsZMWvp1N2ZZWaU2Ms5U3ijUheCiBrqrs8a8=\n" + - "-----END CERTIFICATE-----"; - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Sep 27 03:52:40 PDT 2022", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/AmazonCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/AmazonCA.java deleted file mode 100644 index dec0ff8872a..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/AmazonCA.java +++ /dev/null @@ -1,613 +0,0 @@ -/* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8233223 - * @summary Interoperability tests with Amazon's CA1, CA2, CA3, and CA4 - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath AmazonCA OCSP - * @run main/othervm -Djava.security.debug=certpath AmazonCA CRL - */ - -/* - * Obtain TLS test artifacts for Amazon CAs from: - * - * Amazon Root CA 1 - * Valid - https://good.sca1a.amazontrust.com/ - * Revoked - https://revoked.sca1a.amazontrust.com/ - * Amazon Root CA 2 - * Valid - https://good.sca2a.amazontrust.com/ - * Revoked - https://revoked.sca2a.amazontrust.com/ - * Amazon Root CA 3 - * Valid - https://good.sca3a.amazontrust.com/ - * Revoked - https://revoked.sca3a.amazontrust.com/ - * Amazon Root CA 4 - * Valid - https://good.sca4a.amazontrust.com/ - * Revoked - https://revoked.sca4a.amazontrust.com/ - */ -public class AmazonCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new AmazonCA_1().runTest(pathValidator); - new AmazonCA_2().runTest(pathValidator); - new AmazonCA_3().runTest(pathValidator); - new AmazonCA_4().runTest(pathValidator); - } -} - -class AmazonCA_1 { - - // Owner: CN=Amazon RSA 2048 M02, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 1, O=Amazon, C=US - // Serial number: 773124a4bcbd44ec7b53beaf194842d3a0fa1 - // Valid from: Tue Aug 23 15:25:30 PDT 2022 until: Fri Aug 23 15:25:30 PDT 2030 - private static final String INT_VALID = "-----BEGIN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5yb290Y2ExLmFtYXpvbnRydXN0LmNvbS9yb290Y2ExLmNlcjA/BgNVHR8E\n" + - "ODA2MDSgMqAwhi5odHRwOi8vY3JsLnJvb3RjYTEuYW1hem9udHJ1c3QuY29tL3Jv\n" + - "b3RjYTEuY3JsMBMGA1UdIAQMMAowCAYGZ4EMAQIBMA0GCSqGSIb3DQEBCwUAA4IB\n" + - "AQAtTi6Fs0Azfi+iwm7jrz+CSxHH+uHl7Law3MQSXVtR8RV53PtR6r/6gNpqlzdo\n" + - "Zq4FKbADi1v9Bun8RY8D51uedRfjsbeodizeBB8nXmeyD33Ep7VATj4ozcd31YFV\n" + - "fgRhvTSxNrrTlNpWkUk0m3BMPv8sg381HhA6uEYokE5q9uws/3YkKqRiEz3TsaWm\n" + - "JqIRZhMbgAfp7O7FUwFIb7UIspogZSKxPIWJpxiPo3TcBambbVtQOcNRWz5qCQdD\n" + - "slI2yayq0n2TXoHyNCLEH8rpsJRVILFsg0jc7BaFrMnF462+ajSehgj12IidNeRN\n" + - "4zl+EoNaWdpnWndvSpAEkq2P\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=Amazon RSA 2048 M01, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 1, O=Amazon, C=US - // Serial number: 77312380b9d6688a33b1ed9bf9ccda68e0e0f - // Valid from: Tue Aug 23 15:21:28 PDT 2022 until: Fri Aug 23 15:21:28 PDT 2030 - private static final String INT_REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIEXjCCA0agAwIBAgITB3MSOAudZoijOx7Zv5zNpo4ODzANBgkqhkiG9w0BAQsF\n" + - "ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" + - "b24gUm9vdCBDQSAxMB4XDTIyMDgyMzIyMjEyOFoXDTMwMDgyMzIyMjEyOFowPDEL\n" + - "MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEcMBoGA1UEAxMTQW1hem9uIFJT\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XwZCav0h1ogdPMN1KakK1DT0VwA/+hFvGPJnMV1Kx2G4S1ZaSk0uU\n" + - "5QfoiYIIano01J5k4T2HapKQmmOhS/iPtuo00wW+IMLeBuKMn3OLn005hcrOGTad\n" + - "hcmeyfhQP7Z+iKHvyoQGi1C0ClymHETx/chhQGDyYSWqB/THwnN15AwLQo0E5V9E\n" + - "SJlbe4mBlqeInUsNYugExNf+tOiybcrswBy8OFsd34XOW3rjSUtsuafd9AWySa3h\n" + - "xRRrwszrzX/WWGm6wyB+f7C4\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.rootca1.demo.amazontrust.com - // Issuer: CN=Amazon RSA 2048 M02, O=Amazon, C=US - // Serial number: 60c6e837b2e7586d8464eb34f4a85fe - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIGKDCCBRCgAwIBAgIQBgxug3sudYbYRk6zT0qF/jANBgkqhkiG9w0BAQsFADA8\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRwwGgYDVQQDExNBbWF6b24g\n" + - "UlNBIDIwNDggTTAyMB4XDTIzMDUxMDAwMDAwMFoXDTI0MDYwNzIzNTk1OVowLTEr\n" + - "MCkGA1UEAxMidmFsaWQucm9vdGNhMS5kZW1vLmFtYXpvbnRydXN0LmNvbTCCASIw\n" + - "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3hA+omhUcO8nYO8/+dkpbYz8WI\n" + - "1ms7Y7JA2pPFfp2N/aWcf6m5ORm1BkyGLOttjTu318Qpa9eahQ1Pi3RNe3BtqjD9\n" + - "jcHncpwAFMsXy1beZA7sZ7AA4vKltA3t6yrU5ruTLUGQwUndeIBBSTW5QpdT9I/p\n" + - "EM7d+Miwre63kofbJ1lVPAJvN/udMVqGWNF8V5qscklUUHoSKA3FWWsiCyIgnthg\n" + - "G3u6R1KH66Qionp0ho/ttvrBCI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cyAugZHyd919BdAgIg\n" + - "UnGGpQtZmWnPMmdgpzI7jrCLuC370Tn0i7Aktdzj2X8AdgDatr9rP7W2Ip+bwrtc\n" + - "a+hwkXFsu1GEhTS9pD0wSNf7qwAAAYgHvXVpAAAEAwBHMEUCIGN6cT+6uwDospXe\n" + - "gMa8b38oXouXUT66X2gOiJ0SoRyQAiEAjDMu2vEll5tRpUvU8cD4gR2xV4hqoDxx\n" + - "Q+QGW+PvJxcwDQYJKoZIhvcNAQELBQADggEBACtxC3LlQvULeI3lt7ZYFSWndEhm\n" + - "tNUotoeKSXJXdoIpqSr10bzMPX9SHvemgOUtzP3JNqWPHw1uW9YFyeDE6yWj/B13\n" + - "Xj1hv1cqYIwyaOZBerU/9PT5PaCn20AC9DHbc7iBv+zs+DYiqlAFJ1GVaprwLul4\n" + - "8wp3gnC3Hjb8NykydCo6vw0AJ2UzjpjiTyVZ93jITzLOiboOUa1gQGnojzWlYaet\n" + - "sXe+RDylBp/Wuj1ZS7v/etltzYm5GanPi4y/p7Ta3Uky6std/GM6XbPRdBEFboFR\n" + - "B2IP0divd9c74Q+tLgpsAz5yXm9LtYPMcEPC2YRN2PgBg67c5+A7eIOluuw=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.rootca1.demo.amazontrust.com - // Issuer: CN=Amazon RSA 2048 M01, O=Amazon, C=US - // Serial number: e1023665b1268d788cc25bf69a9d05e - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIGMjCCBRqgAwIBAgIQDhAjZlsSaNeIzCW/aanQXjANBgkqhkiG9w0BAQsFADA8\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRwwGgYDVQQDExNBbWF6b24g\n" + - "UlNBIDIwNDggTTAxMB4XDTIzMDUxMDAwMDAwMFoXDTI0MDYwNzIzNTk1OVowLzEt\n" + - "MCsGA1UEAxMkcm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mFtYXpvbnRydXN0LmNvbS9yMm0wMS5j\n" + - "ZXIwDAYDVR0TAQH/BAIwADCCAX4GCisGAQQB1nkCBAIEggFuBIIBagFoAHYA7s3Q\n" + - "ZNXbGs7FXLedtM0TojKHRny87N7DUUhZRnEftZsAAAGIB72TggAABAMARzBFAiAZ\n" + - "naLbRHRuaRrE304GSuWX/79MU/e+SSlr0cNJ0kNNaAIhAPnz9HayL4txhkTEZiMs\n" + - "nttNnNqD17I0J17JLVOF4i/4AHYASLDja9qmRzQP5WoC+p0w6xxSActW3SyB2bu/\n" + - "qznYhHMAAAGIB72TmwAABAMARzBFAiEAgEqT7CYGQ/u36/3YcxBH78QfknI9kgcY\n" + - "sgJLkurUF6cCIFZZ/b803+ek6o+bmdV/uVx2UlskAyyolZ2okBAb6IscAHYA2ra/\n" + - "az+1tiKfm8K7XGvocJFxbLtRhIU0vaQ9MEjX+6sAAAGIB72TbQAABAMARzBFAiEA\n" + - "6z2RSoK263hvYF71rj1d0TpC70/6zagSRR4glHOT6IACICYvaMAnrCNSTSiZ20Wz\n" + - "Ju5roTippO3BWKhQYrTKZuu4MA0GCSqGSIb3DQEBCwUAA4IBAQB4S1JGulFpMIaP\n" + - "NtLUJmjWz8eexQdWLDVF+H8dd6xpZgpiYtig/Ynphzuk1IIF8DkT3CeK/9vrezgI\n" + - "igNjneN9B4eIuzi/rJzIKeUwpZ2k5D+36Ab4esseoc+TopmNerw8hidt2g818jER\n" + - "D71ppSMakeQFPGe/Hs2/cVa/G1DNVcU2XAut45yRZ/+xsZ0/mcBDVsG9P5uGCN5O\n" + - "7SAp4J959WnKDqgVuU9WowPE5IjmS9BAv2gjniFYdDV2yksyf7+8edHd1KfSVX06\n" + - "pLx6CuCVZGJFG4Q2Aa1YAh1Wvt9hqWeXXpNRO2/wChL5rhT4GajsrGepsk4bjxYX\n" + - "Wf2iZ8mX\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - - // Validate valid - pathValidator.validate(new String[]{VALID, INT_VALID}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT_REVOKED}, - ValidatePathWithParams.Status.REVOKED, - "Mon May 15 13:36:57 PDT 2023", System.out); - } -} - -class AmazonCA_2 { - - // Owner: CN=Amazon RSA 4096 M02, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 2, O=Amazon, C=US - // Serial number: 773125b0c34c3c940299a9f04a39e5a52ccd9 - // Valid from: Tue Aug 23 15:29:13 PDT 2022 until: Fri Aug 23 15:29:13 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIGXjCCBEagAwIBAgITB3MSWww0w8lAKZqfBKOeWlLM2TANBgkqhkiG9w0BAQwF\n" + - "ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" + - "b24gUm9vdCBDQSAyMB4XDTIyMDgyMzIyMjkxM1oXDTMwMDgyMzIyMjkxM1owPDEL\n" + - "MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEcMBoGA1UEAxMTQW1hem9uIFJT\n" + - "QSA0MDk2IE0wMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMGMl/pZ\n" + - "1OsxHY9gw/YfdON4mmrANkPwi7z2djHA5ELt/vRI3Su0le6OoipLf03iyoCnYy4Y\n" + - "rpfTbhyDriE8NJpps2ODJ5W1h0rz6FM1Q5Jt35wfk+4CEfATBTegHVlUJ0rJgzK5\n" + - "Yl/jrk12ZsC4ZeRn54shszcK6bHj4LZIHXhrYIIfetBMMD8V7hlhd54AclEWutUV\n" + - "eBEjkSCzDSk+pQKIjCL0crqvRSPvUNry/BV65zfGmceSYxpcLmV7k7Spwpo+1z8w\n" + - "+Odfnx2vsm7olPldfaThqk6fXBtInORl4Ef32xF3VDT13UeXtQPolFhnp8UOci64\n" + - "bW+R8tbtGpUXIA8Dhr8SgYPH6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qmkV776X1G+AaaQ7mlU\n" + - "giCYi6NqRQSyhn8zrKkNnbO6QL5a9ICC47kiZYRAR/hRvZOt11QUK5tCMXJXo0iO\n" + - "4XKkMu+jdnehP1kh4xuZhYznIgKK6MJIITFI/Jj89U4SOPncyuS94sUuE2EqvvO/\n" + - "t81qeoey6wThz5iRbU/0CvDFnTMgebWGUZ2UZJ+az/rb3KYXGfVWasLIonkvYT7z\n" + - "vHOGNAA9oQ8TTgPOmPfSVyfpplKtO/aybWp5QSH2csIwuvw5dkmpkc42iD57XHob\n" + - "5LbMJg99z3vQBmod/ipmOpND95/BeA2mllBZgZ53S0nvDXDzbzR9Fd81PAz9Qruo\n" + - "dOJKcD6plKQjZjkLzNh1v/RoCFO8kiJGE4UBMTM8FUk0DXH4bALII4wwmDelrSUu\n" + - "lKvDTDxZvPF4dbEXICNPd51EMGPgETxwboOV+bzWFVI0IWQ8PhZ2VuMPDk2taOMp\n" + - "NsuLtlYc2twPb9r/Hvgv7G6+ItpBHZwOVt1oI3pHbjMp7P3pOZSPr6G1WkNy9mX8\n" + - "rVc=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.rootca2.demo.amazontrust.com - // Issuer: CN=Amazon RSA 4096 M02, O=Amazon, C=US - // Serial number: 662f7646d76193cbb76946d111e49fa - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIICzCCBfOgAwIBAgIQBmL3ZG12GTy7dpRtER5J+jANBgkqhkiG9w0BAQwFADA8\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRwwGgYDVQQDExNBbWF6b24g\n" + - "UlNBIDQwOTYgTTAyMB4XDTIzMDUxMDAwMDAwMFoXDTI0MDYwNzIzNTk1OVowLTEr\n" + - "MCkGA1UEAxMidmFsaWQucm9vdGNhMi5kZW1vLmFtYXpvbnRydXN0LmNvbTCCAiIw\n" + - "DQYJKo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FGUaUaU8Xlsd\n" + - "V6Fo8VmNwFc88VCqOp8eI/IicHxMDLl8TKXMvr3CYh8A9nCeFGcV+4CL+7JF2t5K\n" + - "YvV5r074Wyk0QMlRVYMNDl0t+VAEoDJ7RRE+kEvplWcsX9S2wvr4HhkA4iChpwFm\n" + - "2UDTppHskSWyLsuNQvipn0zTzZ8RIxXd/ei0qCdhKmkV7x9cgbTiyXgaI7iJEtdo\n" + - "RvYNcXc2RmitWjY5Av8yJGOk0eYpCwRrBv6ughbtJe3NMrqUeTyrKidIEo9KnRSA\n" + - "rMokRbHunkroS97VkoK/9j9pNJki+qAH9XTLYWcm/5+cTSGRsN+escRgZwV6KWg/\n" + - "JQQe5LbwU2HHzNqWuk63GC/ngVlWXjaVFfbNVmYEKZFFazcZchesN1YyDu+WndOx\n" + - "+rTcuke2feOvQ4EnVviM0k85JZNiqPDH2iafAWyqZFUYTnb7XK3HhJflAniv/SLq\n" + - "DQfbJmtQtNHdJYgVmC1u2RT9gbJDIAj0ZI4vU2WVB5Hmd9F31un6jundEuG4+S4=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.rootca2.demo.amazontrust.com - // Issuer: CN=Amazon RSA 4096 M02, O=Amazon, C=US - // Serial number: 788baa8f47bc5b1c624424216240fd3 - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIIEjCCBfqgAwIBAgIQB4i6qPR7xbHGJEJCFiQP0zANBgkqhkiG9w0BAQwFADA8\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRwwGgYDVQQDExNBbWF6b24g\n" + - "UlNBIDQwOTYgTTAyMB4XDTIzMDUxMDAwMDAwMFoXDTI0MDYwNzIzNTk1OVowLzEt\n" + - "MCsGA1UEAxMkcmV2b2tlZC5yb290Y2EyLmRlbW8uYW1hem9udHJ1c3QuY29tMIIC\n" + - "IjANBgkqhkiG9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wYDVR0fBDQwMjAwoC6gLIYqaHR0\n" + - "cDovL2NybC5yNG0wMi5hbWF6b250cnVzdC5jb20vcjRtMDIuY3JsMBMGA1UdIAQM\n" + - "MAowCAYGZ4EMAQIBMHUGCCsGAQUFBwEBBGkwZzAtBggrBgEFBQcwAYYhaHR0cDov\n" + - "L29jc3AucjRtMDIuYW1hem9udHJ1c3QuY29tMDYGCCsGAQUFBzAChipodHRwOi8v\n" + - "Y3J0LnI0bTAyLmFtYXpvbnRydXN0LmNvbS9yNG0wMi5jZXIwDAYDVR0TAQH/BAIw\n" + - "ADCCAX0GCisGAQQB1nkCBAIEggFtBIIBaQFnAHYA7s3QZNXbGs7FXLedtM0TojKH\n" + - "Rny87N7DUUhZRnEftZsAAAGIB72CzgAABAMARzBFAiEA2vPYIPfGJeynPaZHq/c0\n" + - "GGvyT6MpvFGMW0s0woLRT28CIEFbZbFSCnKugaqw9QDNi7vYmIF3Gyi3s6G2cCxY\n" + - "4RJXAHYASLDja9qmRzQP5WoC+p0w6xxSActW3SyB2bu/qznYhHMAAAGIB72DDgAA\n" + - "BAMARzBFAiAvfNcgtFEwk5C9dvMUYANbIAv0IOdF1new8Umn3cM+JwIhALbs/3L9\n" + - "0ndF7sRKDZmfronNruptFlrI528P5Qi2P528AHUA2ra/az+1tiKfm8K7XGvocJFx\n" + - "bLtRhIU0vaQ9MEjX+6sAAAGIB72CxQAABAMARjBEAiBKUns2FPbs0cThb6e7SnyL\n" + - "y4/qP3V1Q/ASt/ZDRTeEQQIgWSQO4Gsz32srtqYuTM9AsFd92WA44kJHincdcGVX\n" + - "XbIwDQYJKoZIhvcNAQEMBQADggIBAAnaNbn2wXylTCS7dtgB3rWdUf6hja1UDuvB\n" + - "uZEL2dUOvyXfVFLNxKdeWBPzqpwEBNNwPQXhoI97TXlyu2x60jLzQamoGoRQ3s0P\n" + - "NLhasLGEIQH/oYdMV/yp8EI8fUuRVE3xyw39FRqOrmsUFAnxNQmBO/09JM7sLcvS\n" + - "wwh14p9dFTTolJHgnL4ZEtmZxSddFG+GBSTJ/A7dVSmwIudwzd+goA6173BI6yeT\n" + - "hhQumLctQiOM7y1MzFeV8rL+oIpd2xuzyhKKT1EgvU6/wyt0Ib8QqsFsrXPnUOKk\n" + - "HAq3SeZyq35QUaTKoaH9L1iZMbSCG9Jm6FMb12SdAz53653tYvAiUS76oD8Jot13\n" + - "RZu5NUlWAVLLq0OaEtuGp0bh+cVtzVnCC9m1qa46YpY0SojpvSbakgQMMGIgDlT3\n" + - "wFE7tST4WlsDC1f/m+H9V5qz/j0U8D3eNNdowxPqx/JZq/sk9ZK5KyMFARrvM+fh\n" + - "YrVYjKt91mu7JaS4pPOyZmJ8OQ14EvrN7BXc7IkNrI1reeaRFe49k5DAETB8VmP5\n" + - "2F0SWou2KkgtJvU4Z7YjlZ2HNHnpjTK5KdPNpRSt7EUy2zn9NCNoyQhnws70FyXv\n" + - "oPFyG92lnUQOKaAUhVRwTr9fvnkdMOzSKg/spxi2Ogdzym5Jw68eguwi0dVqX2+9\n" + - "3zViP2aH\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon May 15 13:38:54 PDT 2023", System.out); - } -} - -class AmazonCA_3 { - - // Owner: CN=Amazon ECDSA 256 M02, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 3, O=Amazon, C=US - // Serial number: 773126de2c2fafd2c47ad88b1566e0182046d - // Valid from: Tue Aug 23 15:33:24 PDT 2022 until: Fri Aug 23 15:33:24 PDT 2030 - private static final String INT_VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIC1DCCAnmgAwIBAgITB3MSbeLC+v0sR62IsVZuAYIEbTAKBggqhkjOPQQDAjA5\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g\n" + - "Um9vdCBDQSAzMB4XDTIyMDgyMzIyMzMyNFoXDTMwMDgyMzIyMzMyNFowPTELMAkG\n" + - "A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEdMBsGA1UEAxMUQW1hem9uIEVDRFNB\n" + - "IDI1NiBNMDIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9vQLD4W/Kg4AnFRl8\n" + - "x/FUbLqtd5ICYjUijGsytF9hmgb/Dyk+Ebt4cw6rAlGbaiOLapSJKZiZr+UQdh3I\n" + - "QOr+o4IBWjCCAVYwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYw\n" + - "HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBS7eJrXaDMy\n" + - "nRq7bP2xNEwB3svQdTAfBgNVHSMEGDAWgBSrttvXBp43rDCGB5Fwx5zEGbF4wDB7\n" + - "BggrBgEFBQcBAQRvMG0wLwYIKwYBBQUHMAGGI2h0dHA6Ly9vY3NwLnJvb3RjYTMu\n" + - "YW1hem9udHJ1c3QuY29tMDoGCCsGAQUFBzAChi5odHRwOi8vY3J0LnJvb3RjYTMu\n" + - "YW1hem9udHJ1c3QuY29tL3Jvb3RjYTMuY2VyMD8GA1UdHwQ4MDYwNKAyoDCGLmh0\n" + - "dHA6Ly9jcmwucm9vdGNhMy5hbWF6b250cnVzdC5jb20vcm9vdGNhMy5jcmwwEwYD\n" + - "VR0gBAwwCjAIBgZngQwBAgEwCgYIKoZIzj0EAwIDSQAwRgIhAKSYEcDcp3kcPMzh\n" + - "OIYDWZOLu4InPod4fQhRTmc2zBAgAiEAmwdGE4AuNWhw9N8REhf82rJLNm7h9Myg\n" + - "TsR9Wu0bQYU=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=Amazon ECDSA 256 M01, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 3, O=Amazon, C=US - // Serial number: 773126684d577c0fcf8d3a342bea86f94fc8f - // Valid from: Tue Aug 23 15:31:46 PDT 2022 until: Fri Aug 23 15:31:46 PDT 2030 - private static final String INT_REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIC0zCCAnmgAwIBAgITB3MSZoTVd8D8+NOjQr6ob5T8jzAKBggqhkjOPQQDAjA5\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g\n" + - "Um9vdCBDQSAzMB4XDTIyMDgyMzIyMzE0NloXDTMwMDgyMzIyMzE0NlowPTELMAkG\n" + - "A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEdMBsGA1UEAxMUQW1hem9uIEVDRFNB\n" + - "IDI1NiBNMDEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT80w+2RwNHzyXmVUM/\n" + - "OUKBZpJkTzHyCKDl4sBrUfjzVjot/lNba9kYzMKSHYv95CUDoMaF2h2KAqx65uLQ\n" + - "Y8ago4IBWjCCAVYwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYw\n" + - "HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBRPWfy8BhYo\n" + - "v6LI2wj7zxMkumlCXDAfBgNVHSMEGDAWgBSrttvXBp43rDCGB5Fwx5zEGbF4wDB7\n" + - "BggrBgEFBQcBAQRvMG0wLwYIKwYBBQUHMAGGI2h0dHA6Ly9vY3NwLnJvb3RjYTMu\n" + - "YW1hem9udHJ1c3QuY29tMDoGCCsGAQUFBzAChi5odHRwOi8vY3J0LnJvb3RjYTMu\n" + - "YW1hem9udHJ1c3QuY29tL3Jvb3RjYTMuY2VyMD8GA1UdHwQ4MDYwNKAyoDCGLmh0\n" + - "dHA6Ly9jcmwucm9vdGNhMy5hbWF6b250cnVzdC5jb20vcm9vdGNhMy5jcmwwEwYD\n" + - "VR0gBAwwCjAIBgZngQwBAgEwCgYIKoZIzj0EAwIDSAAwRQIhALRfxq3SQIhj5xA4\n" + - "S5UAY/KlKqayZDpnbBdCDH8Kqmf/AiAUVZddALefnqRe+ifxN2FUp461LL6/cgVM\n" + - "EH3Ty27f1Q==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.rootca3.demo.amazontrust.com - // Issuer: CN=Amazon ECDSA 256 M02, O=Amazon, C=US - // Serial number: 8e2f14864fb28e4a1da0f15a5118cc8 - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIEfjCCBCWgAwIBAgIQCOLxSGT7KOSh2g8VpRGMyDAKBggqhkjOPQQDAjA9MQsw\n" + - "CQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMR0wGwYDVQQDExRBbWF6b24gRUNE\n" + - "U0EgMjU2IE0wMjAeFw0yMzA1MTAwMDAwMDBaFw0yNDA2MDcyMzU5NTlaMC0xKzAp\n" + - "BgNVBAMTInZhbGlkLnJvb3RjYTMuZGVtby5hbWF6b250cnVzdC5jb20wWTATBgcq\n" + - "hkjOPQIBBggqhkjOPQMBBwNCAAQfWc7gBGBBBmseCb2XWWRQVhCUQDVml3mVgvj5\n" + - "RmnP1y5wpifUTFqu8ELdI7YGZ4JMSnetiKNmLtg5yhTEjzCQo4IDFTCCAxEwHwYD\n" + - "VR0jBBgwFoAUu3ia12gzMp0au2z9sTRMAd7L0HUwHQYDVR0OBBYEFHCE8orvZDUK\n" + - "5TI9MYadzxWR9CZGMEkGA1UdEQRCMECCInZhbGlkLnJvb3RjYTMuZGVtby5hbWF6\n" + - "b250cnVzdC5jb22CGmdvb2Quc2NhM2EuYW1hem9udHJ1c3QuY29tMA4GA1UdDwEB\n" + - "/wQEAwIHgDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwOwYDVR0fBDQw\n" + - "MjAwoC6gLIYqaHR0cDovL2NybC5lMm0wMi5hbWF6b250cnVzdC5jb20vZTJtMDIu\n" + - "Y3JsMBMGA1UdIAQMMAowCAYGZ4EMAQIBMHUGCCsGAQUFBwEBBGkwZzAtBggrBgEF\n" + - "BQcwAYYhaHR0cDovL29jc3AuZTJtMDIuYW1hem9udHJ1c3QuY29tMDYGCCsGAQUF\n" + - "BzAChipodHRwOi8vY3J0LmUybTAyLmFtYXpvbnRydXN0LmNvbS9lMm0wMi5jZXIw\n" + - "DAYDVR0TAQH/BAIwADCCAXwGCisGAQQB1nkCBAIEggFsBIIBaAFmAHUA7s3QZNXb\n" + - "Gs7FXLedtM0TojKHRny87N7DUUhZRnEftZsAAAGIB71y/gAABAMARjBEAiAEAXIb\n" + - "aOVR26HgFaI+qoIasCb8w2sOqVxGAxf5iPgX6QIgdAlMjqeoihi1arnJpzN8Bqxy\n" + - "5ULMUO7GK3JEgcogJHMAdgBIsONr2qZHNA/lagL6nTDrHFIBy1bdLIHZu7+rOdiE\n" + - "cwAAAYgHvXLkAAAEAwBHMEUCIF7wDDmWxTHwBZM7Me8eOCM1aQ/g1c1rJg/I+NJa\n" + - "HkZYAiEA8p+IviuY5piHBELjUtVlZLiS9XSSMxpQNhUerqC/YFoAdQDatr9rP7W2\n" + - "Ip+bwrtca+hwkXFsu1GEhTS9pD0wSNf7qwAAAYgHvXKvAAAEAwBGMEQCIFLskZDs\n" + - "UG4+/88D/5/QbD9zT6ZmZlwXiPZ6H2YR/KiJAiBvi4vvNsb9KNAhJMgI2T2iCg9U\n" + - "CIru+US6y3ua7dKKDTAKBggqhkjOPQQDAgNHADBEAiAzvgzKV/kvBbKWCT1NNUBD\n" + - "AF9okIEcJx/ukFgzmYMwUQIgXeJeVf3izkxsgiEUSknwHsErLFs/cEme2PSRj2AW\n" + - "dYA=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.rootca3.demo.amazontrust.com - // Issuer: CN=Amazon ECDSA 256 M01, O=Amazon, C=US - // Serial number: c458bfaeedae16a5e61fe64773fc898 - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIEhzCCBC2gAwIBAgIQDEWL+u7a4WpeYf5kdz/ImDAKBggqhkjOPQQDAjA9MQsw\n" + - "CQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMR0wGwYDVQQDExRBbWF6b24gRUNE\n" + - "U0EgMjU2IE0wMTAeFw0yMzA1MTAwMDAwMDBaFw0yNDA2MDcyMzU5NTlaMC8xLTAr\n" + - "BgNVBAMTJHJldm9rZWQucm9vdGNhMy5kZW1vLmFtYXpvbnRydXN0LmNvbTBZMBMG\n" + - "ByqGSM49AgEGCCqGSM49AwEHA0IABAsSs5kW5TZlS0SDrMb9iUQAqEaKa12Fc6SN\n" + - "9UR6qtOFdW/1UuziDq3Hl5dqsAYZJkbJSPCIsD2HTP/EGTMKITCjggMbMIIDFzAf\n" + - "BgNVHSMEGDAWgBRPWfy8BhYov6LI2wj7zxMkumlCXDAdBgNVHQ4EFgQUeE55ET2e\n" + - "i8KbY7KHTxOuvCkRpTowTgYDVR0RBEcwRYIkcmV2b2tlZC5yb290Y2EzLmRlbW8u\n" + - "YW1hem9udHJ1c3QuY29tgh1yZXZva2VkLnNjYTNhLmFtYXpvbnRydXN0LmNvbTAO\n" + - "BgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMDsG\n" + - "A1UdHwQ0MDIwMKAuoCyGKmh0dHA6Ly9jcmwuZTJtMDEuYW1hem9udHJ1c3QuY29t\n" + - "L2UybTAxLmNybDATBgNVHSAEDDAKMAgGBmeBDAECATB1BggrBgEFBQcBAQRpMGcw\n" + - "LQYIKwYBBQUHMAGGIWh0dHA6Ly9vY3NwLmUybTAxLmFtYXpvbnRydXN0LmNvbTA2\n" + - "BggrBgEFBQcwAoYqaHR0cDovL2NydC5lMm0wMS5hbWF6b250cnVzdC5jb20vZTJt\n" + - "MDEuY2VyMAwGA1UdEwEB/wQCMAAwggF9BgorBgEEAdZ5AgQCBIIBbQSCAWkBZwB2\n" + - "AHb/iD8KtvuVUcJhzPWHujS0pM27KdxoQgqf5mdMWjp0AAABiAe9lQ8AAAQDAEcw\n" + - "RQIgZVFAX5WPZRBpEOqk620v4Rbzxh/3wrJ5QBMBJ0Mb8B0CIQC0oxFVLfs+PAv7\n" + - "25wawOu2VgDXG9lJAJtCwk3gN8BshQB2AEiw42vapkc0D+VqAvqdMOscUgHLVt0s\n" + - "gdm7v6s52IRzAAABiAe9lQ4AAAQDAEcwRQIhAIPVMj6IfjAUKeGYbpG9s0DRdWbc\n" + - "b8OzsOf+kRqk03NMAiB777hfoFCUMPrN0g8o5v6zp3T3qOhRnYY0TZN4q4NnMgB1\n" + - "ANq2v2s/tbYin5vCu1xr6HCRcWy7UYSFNL2kPTBI1/urAAABiAe9lN4AAAQDAEYw\n" + - "RAIgL0qoVbKLFD+Y3f/V6Rw+euZrPO6d1HEVPQGo7wLzkl8CIGHp3PQmmrEofl76\n" + - "4da7bY0L+csFW0sB8clN0KziMfe6MAoGCCqGSM49BAMCA0gAMEUCIQC+6VdX9X5g\n" + - "x3NSUmJ7py01Zxf26TNBv1ildxqesvZ/7wIgIrefriRzPiIFDHCUbdjk0VlmMwZR\n" + - "VzXXHINsGCiCKOs=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - - // Validate valid - pathValidator.validate(new String[]{VALID, INT_VALID}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT_REVOKED}, - ValidatePathWithParams.Status.REVOKED, - "Mon May 15 13:41:22 PDT 2023", System.out); - } -} - -class AmazonCA_4 { - - // Owner: CN=Amazon ECDSA 384 M02, O=Amazon, C=US - // Issuer: CN=Amazon Root CA 4, O=Amazon, C=US - // Serial number: 773127dfaa6b9e2b95538aa76dde4307f17c4 - // Valid from: Tue Aug 23 15:36:58 PDT 2022 until: Fri Aug 23 15:36:58 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDETCCApagAwIBAgITB3MSffqmueK5VTiqdt3kMH8XxDAKBggqhkjOPQQDAzA5\n" + - "MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g\n" + - "Um9vdCBDQSA0MB4XDTIyMDgyMzIyMzY1OFoXDTMwMDgyMzIyMzY1OFowPTELMAkG\n" + - "A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEdMBsGA1UEAxMUQW1hem9uIEVDRFNB\n" + - "IDM4NCBNMDIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATNYzWQDXV0NoNmR0hJPwJq\n" + - "hjYOOS9z0B2Z7MQudxg5x3Vsib6N+tJkq8dljRq5o6K0bbh/kRVfoi9wfKhB03Yz\n" + - "gkerrwRCH7Z9gU5nbBY+Y5+EtImq4yOB0n7JQgQxWemjggFaMIIBVjASBgNVHRMB\n" + - "Af8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcD\n" + - "AQYIKwYBBQUHAwIwHQYDVR0OBBYEFKbZqzuHmTP/6Gj4i2GDbNCyuq+9MB8GA1Ud\n" + - "IwQYMBaAFNPsxzplbszh2naaVvuc84ZtV+WBMHsGCCsGAQUFBwEBBG8wbTAvBggr\n" + - "BgEFBQcwAYYjaHR0cDovL29jc3Aucm9vdGNhNC5hbWF6b250cnVzdC5jb20wOgYI\n" + - "KwYBBQUHMAKGLmh0dHA6Ly9jcnQucm9vdGNhNC5hbWF6b250cnVzdC5jb20vcm9v\n" + - "dGNhNC5jZXIwPwYDVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NybC5yb290Y2E0LmFt\n" + - "YXpvbnRydXN0LmNvbS9yb290Y2E0LmNybDATBgNVHSAEDDAKMAgGBmeBDAECATAK\n" + - "BggqhkjOPQQDAwNpADBmAjEA2zCG6x0xMlgSXWEGLN8+1XN+OCYF5vj0Z1jtVy+A\n" + - "pdLlzuxNt9HBWn3hvqvO2W8KAjEApNdsZOCmk5uZBYiuCSBnDH3jyKhN6dWyuuHW\n" + - "9Wj7SxKnOU5+wYWZA0BQAv1KT62i\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.rootca4.demo.amazontrust.com - // Issuer: CN=Amazon ECDSA 384 M02, O=Amazon, C=US - // Serial number: f579bed3369f1a147ea5d0e8e6532d3 - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIEvjCCBESgAwIBAgIQD1eb7TNp8aFH6l0OjmUy0zAKBggqhkjOPQQDAzA9MQsw\n" + - "CQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMR0wGwYDVQQDExRBbWF6b24gRUNE\n" + - "U0EgMzg0IE0wMjAeFw0yMzA1MTAwMDAwMDBaFw0yNDA2MDcyMzU5NTlaMC0xKzAp\n" + - "BgNVBAMTInZhbGlkLnJvb3RjYTQuZGVtby5hbWF6b250cnVzdC5jb20wdjAQBgcq\n" + - "hkjOPQIBBgUrgQQAIgNiAAT6/95JFuvx5t9MVeRZmBtXq63Q2fXZnSwEy2U2F4Qc\n" + - "ejhDwcYfD2HmT6S6GrKqLNJMa5n2YOvet4LZpKJLFF+BQo6FJt5cXkzHHxZ1I4z3\n" + - "8pGU79CpCgFOFy6QUlF68NajggMXMIIDEzAfBgNVHSMEGDAWgBSm2as7h5kz/+ho\n" + - "+Ithg2zQsrqvvTAdBgNVHQ4EFgQUR/GnpQkrUsCj8jF6/JIE1Rs07zswSQYDVR0R\n" + - "BEIwQIIidmFsaWQucm9vdGNhNC5kZW1vLmFtYXpvbnRydXN0LmNvbYIaZ29vZC5z\n" + - "Y2E0YS5hbWF6b250cnVzdC5jb20wDgYDVR0PAQH/BAQDAg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n" + - "FSMsnoHJcqMZLo9s+4Rf0zS3\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.rootca4.demo.amazontrust.com - // Issuer: CN=Amazon ECDSA 384 M02, O=Amazon, C=US - // Serial number: 4a5d392936b4decb818b7fb106ebbd8 - // Valid from: Tue May 09 17:00:00 PDT 2023 until: Fri Jun 07 16:59:59 PDT 2024 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIExjCCBEygAwIBAgIQBKXTkpNrTey4GLf7EG672DAKBggqhkjOPQQDAzA9MQsw\n" + - "CQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMR0wGwYDVQQDExRBbWF6b24gRUNE\n" + - "U0EgMzg0IE0wMjAeFw0yMzA1MTAwMDAwMDBaFw0yNDA2MDcyMzU5NTlaMC8xLTAr\n" + - "BgNVBAMTJHJldm9rZWQucm9vdGNhNC5kZW1vLmFtYXpvbnRydXN0LmNvbTB2MBAG\n" + - "ByqGSM49AgEGBSuBBAAiA2IABFYfMbv5/vgqDunZj4ffJiuELtdwfEPXx9QlZnCm\n" + - "rBP3Z4/GvUVRVmyh5sYdnbCGCEClH/RxU6BC5SKv+TzhsFLEumhezanljnQXRAIL\n" + - "a1OGbP8zLLP6FuAD0cjY3P3adKOCAx0wggMZMB8GA1UdIwQYMBaAFKbZqzuHmTP/\n" + - "6Gj4i2GDbNCyuq+9MB0GA1UdDgQWBBSqnGV5pN/agPCtVdV37CP1z/DUqjBOBgNV\n" + - "HREERzBFgiRyZXZva2VkLnJvb3RjYTQuZGVtby5hbWF6b250cnVzdC5jb22CHXJl\n" + - "dm9rZWQuc2NhNGEuYW1hem9udHJ1c3QuY29tMA4GA1UdDwEB/wQEAwIHgDAdBgNV\n" + - "HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwOwYDVR0fBDQwMjAwoC6gLIYqaHR0\n" + - "cDovL2NybC5lM20wMi5hbWF6b250cnVzdC5jb20vZTNtMDIuY3JsMBMGA1UdIAQM\n" + - "MAowCAYGZ4EMAQIBMHUGCCsGAQUFBwEBBGkwZzAtBggrBgEFBQcwAYYhaHR0cDov\n" + - "L29jc3AuZTNtMDIuYW1hem9udHJ1c3QuY29tMDYGCCsGAQUFBzAChipodHRwOi8v\n" + - "Y3J0LmUzbTAyLmFtYXpvbnRydXN0LmNvbS9lM20wMi5jZXIwDAYDVR0TAQH/BAIw\n" + - "ADCCAX8GCisGAQQB1nkCBAIEggFvBIIBawFpAHYAdv+IPwq2+5VRwmHM9Ye6NLSk\n" + - "zbsp3GhCCp/mZ0xaOnQAAAGIB72QJQAABAMARzBFAiA74zKrlL+y5rYwSLxBL8fs\n" + - "QYRYXF0s0sGoaSEeAg1DkgIhAPu8Z0TLIFoppmyiv+A5z6S+SG+v/kOsAYmQmiUO\n" + - "5scIAHcASLDja9qmRzQP5WoC+p0w6xxSActW3SyB2bu/qznYhHMAAAGIB72QJgAA\n" + - "BAMASDBGAiEAg+x7JBT3oIaZdnfgGN1G6SAiNUL7zR/tBhbWIG9tz94CIQDGwBiV\n" + - "Tslt11+W3ZaNsS7UtUIiB45YHUc4qKm5ry2fTAB2ANq2v2s/tbYin5vCu1xr6HCR\n" + - "cWy7UYSFNL2kPTBI1/urAAABiAe9kAgAAAQDAEcwRQIgPvKfSpMJKRocGk9+GNr3\n" + - "hUj8x8WySB//0X116TNgA0gCIQDhGRqxnEZmEFGEfj5GY9vjEfm0kKwcL0lCuwBu\n" + - "NZG4dzAKBggqhkjOPQQDAwNoADBlAjEA1PLdsrko3tDs50aAeEU9Gn+0CG8QKy7R\n" + - "fQaXBTjGETDgGJk/7zGNpGelKPr/UYV9AjASwdA32S8jIADxA8HrqiMsVYDFMnbU\n" + - "jLLwR6CTLtAcWtwVmoQ2x0usvTvN8YJBPoA=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon May 15 13:42:48 PDT 2023", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/BuypassCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/BuypassCA.java deleted file mode 100644 index 9ad20271bec..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/BuypassCA.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @bug 8189131 - * @summary Interoperability tests with Buypass Class 2 and Class 3 CA - * @build ValidatePathWithParams - * @run main/othervm/timeout=180 -Djava.security.debug=certpath BuypassCA OCSP - * @run main/othervm/timeout=180 -Djava.security.debug=certpath BuypassCA CRL - */ - - /* - * Obtain test artifacts for Buypass Class 2 and Class 3 CAs from: - * Buypass Class 3 CA 2 - * https://valid.qcevident.ca23.ssl.buypass.no/ - * https://revoked.qcevident.ca23.ssl.buypass.no/ - * https://expired.qcevident.ca23.ssl.buypass.no/ - * https://valid.evident.ca23.ssl.buypass.no/ - * https://revoked.evident.ca23.ssl.buypass.no/ - * https://expired.evident.ca23.ssl.buypass.no/ - * https://valid.businessplus.ca23.ssl.buypass.no - * https://revoked.businessplus.ca23.ssl.buypass.no - * https://expired.businessplus.ca23.ssl.buypass.no - - * Buypass Class 2 CA 2 - * https://valid.business.ca22.ssl.buypass.no - * https://revoked.business.ca22.ssl.buypass.no - * https://expired.business.ca22.ssl.buypass.no - * https://valid.domain.ca22.ssl.buypass.no - * https://revoked.domain.ca22.ssl.buypass.no - * https://expired.domain.ca22.ssl.buypass.no/ - */ -public class BuypassCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new BuypassClass2().runTest(pathValidator); - new BuypassClass3().runTest(pathValidator); - } -} - -class BuypassClass2 { - - // Owner: CN=Buypass Class 2 CA 2, O=Buypass AS-983163327, C=NO - // Issuer: CN=Buypass Class 2 Root CA, O=Buypass AS-983163327, C=NO - // Serial number: 1b781c6d5e34ce1f77 - // Valid from: Mon Mar 25 05:17:10 PDT 2019 until: Sat Oct 26 02:16:17 PDT 2030 - private static final String INT_CLASS_2 = "-----BEGIN CERTIFICATE-----\n" + - "MIIFKTCCAxGgAwIBAgIJG3gcbV40zh93MA0GCSqGSIb3DQEBCwUAME4xCzAJBgNV\n" + - "BAYTAk5PMR0wGwYDVQQKDBRCdXlwYXNzIEFTLTk4MzE2MzMyNzEgMB4GA1UEAwwX\n" + - "QnV5cGFzcyBDbGFzcyAyIFJvb3QgQ0EwHhcNMTkwMzI1MTIxNzEwWhcNMzAxMDI2\n" + - "MDkxNjE3WjBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwUQnV5cGFzcyBBUy05ODMx\n" + - "NjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAyMIIBIjANBgkqhkiG\n" + - "9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnKtnxp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LZ7LRM\n" + - "BmkkF9nqkWxxISadx12nbxn0LsU2k8Xyt830DqhHGSoYHEC/iGxbU4Bub8NC0uw/\n" + - "QNBj5Gd5cXLFhRUWLLBTq4p6P6kLc7JudpM4FNQ+stWK/eDZylbDLN3iCBRnHH4p\n" + - "qg6HAlWuieiAKVsidBMxPUyDLJ/8Dt+aW8Z3vCNcYC2n7wqrLZz5e4FG+Wn9teFW\n" + - "Rt5pO6ZUZAkDS59ZVojbbjOdQzNw3QHtZl0IMHeNYXJlPIUlHi4hGL3maGZ9sBF+\n" + - "AMfMLDu56+J2DewIuTXPzCeJeSTam/ybNt5FxTznxCSCIDqwmZMy3AQEz9nGSbE8\n" + - "zfwB5VT2ijLB0PpPX4YbLf33Vodf0NAkBUv6N5It30XiTUPhdk+caBYPoljz/J9U\n" + - "15T5+EGHs8ccHQWyYQ6gqYk8o4JgP4rSJqO1sMI=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.domain.ca22.ssl.buypass.no - // Issuer: CN=Buypass Class 2 CA 2, O=Buypass AS-983163327, C=NO - // Serial number: 34e2bff8063debd18d79 - // Valid from: Mon Sep 23 04:12:34 PDT 2019 until: Mon Oct 11 14:59:00 PDT 2021 - private static final String VALID_CLASS_2 = "-----BEGIN CERTIFICATE-----\n" + - "MIIF8jCCBNqgAwIBAgIKNOK/+AY969GNeTANBgkqhkiG9w0BAQsFADBLMQswCQYD\n" + - "VQQGEwJOTzEdMBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMM\n" + - "FEJ1eXBhc3MgQ2xhc3MgMiBDQSAyMB4XDTE5MDkyMzExMTIzNFoXDTIxMTAxMTIx\n" + - "NTkwMFowKzEpMCcGA1UEAwwgdmFsaWQuZG9tYWluLmNhMjIuc3NsLmJ1eXBhc3Mu\n" + - "bm8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCeu/8j7y55R3OucDek\n" + - "gtdoVOEJQb2XaCR4Ow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OjUlR3SD14QIhAKZp0cdwFpm+hh0taFVSTmluGsHmXPMCIQq9hLAB\n" + - "VYgyAHYApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFtXdLbFwAA\n" + - "BAMARzBFAiBhr7KQc9yO3zb1iLlE0JW9whR0/bhrPDkk5BYnBKjzFAIhAMMTdHfk\n" + - "1ljso5jKzIUcBpSW0HnTcuKiB3VxGpL7GFVWAHUAb1N2rDHwMRnYmQCkURX/dxUc\n" + - "EdkCwQApBo2yCJo32RMAAAFtXdLYSAAABAMARjBEAiADoZr6Cp5AGM1eT2aUeRaQ\n" + - "kv0vRaegjRGIhKRCvRGyFAIgWLU/7zh28LI8vAyWr8mpDqlUXvF13i3zSD3whq4L\n" + - "Lu4wDQYJKoZIhvcNAQELBQADggEBAJH1RhTuMbhEOYlw+Efbx7PP7EEC/GQ1ijET\n" + - "vZS45jFQyTKhFUcdP2QPAtEVo1nS8PBs0txQJBf0xceWUjer9ruxiAS+JlW21AOi\n" + - "Uq9Kahpj5k63Z7tN8KTeOUE8wZGmHyvVcPP6mkC94RbjYIb4gd13eYxd2Vv1a7YX\n" + - "dNI+J3g7sX5ijssfJxzDd0hORj2584YY2WiKKvIGxwDnLkxk09i3IvjEKsAi4Cgn\n" + - "5798X5sSL1Q9C6gHEWt+cB5UtfILCfbLNRczS9zGku6gjh1c8dB7zc63mn7oCf1C\n" + - "gnQ2xqwbZb3Wau8CPwcMqJWgQZLQFPbZd+4Xo5SDDqYppV4oN2A=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.domain.ca22.ssl.buypass.no - // Issuer: CN=Buypass Class 2 CA 2, O=Buypass AS-983163327, C=NO - // Serial number: 34e4b97261795f98c495 - // Valid from: Mon Sep 23 04:52:42 PDT 2019 until: Thu Sep 23 14:59:00 PDT 2021 - private static final String REVOKED_CLASS_2 = "-----BEGIN CERTIFICATE-----\n" + - "MIIF9zCCBN+gAwIBAgIKNOS5cmF5X5jElTANBgkq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TAiAFD5QO+KTfySri9QXptik3wo66zDOmkVES1snvVQ==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID_CLASS_2, INT_CLASS_2}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED_CLASS_2, INT_CLASS_2}, - ValidatePathWithParams.Status.REVOKED, - "Mon Sep 23 04:53:18 PDT 2019", System.out); - } -} - -class BuypassClass3 { - - // Owner: CN=Buypass Class 3 CA 2, O=Buypass AS-983163327, C=NO - // Issuer: CN=Buypass Class 3 Root CA, O=Buypass AS-983163327, C=NO - // Serial number: 1be0dc6a3e7f220475 - // Valid from: Mon Mar 25 05:12:16 PDT 2019 until: Sat Oct 26 01:16:17 PDT 2030 - private static final String INT_CLASS_3 = "-----BEGIN CERTIFICATE-----\n" + - "MIIFKTCCAxGgAwIBAgIJG+Dcaj5/IgR1MA0GCSqGSIb3DQEBCwUAME4xCzAJBgNV\n" + - "BAYTAk5PMR0wGwYDVQQKDBRCdXlwYXNzIEFTLTk4MzE2MzMyNzEgMB4GA1UEAwwX\n" + - "QnV5cGFzcyBDbGFzcyAzIFJvb3QgQ0EwHhcNMTkwMzI1MTIxMjE2WhcNMzAxMDI2\n" + - "MDgxNjE3WjBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwUQnV5cGFzcyBBUy05ODMx\n" + - "NjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAyMIIBIjANBgkqhkiG\n" + - "9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvU4V2hRFFe4K7BMEmm4IoMTwS7NyDQB4JEar\n" + - "dV1qBsKHIIQJDm9hbCakcLIWXVv6vYrJZ1AEF0b6awBwhhlqXlyNnOtNa9uR+IAP\n" + - "86d4yOGpgHSlNAhdtOOk9Qw6MUzzBo1lyoYmoL0f5n02SMrlMcArSg458o08eDUx\n" + - "4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5CisypdQuZ5zyy/6SXZCKkPcikR87ysSKnjtteXbxMWVtwkeBALT\n" + - "K7DbJA+5aOCYRNj6CJGULQKiGlC01/ipORKewf5J3yus81lLHzBmgQMA5l9RL8rV\n" + - "6dI246mPpQ+8WDLsDrK3ydSDv5izgdVHzhL0tT2u4vwSq2WUqCgi4xLIA1N/fA2H\n" + - "xEW7zh0X/3YVz++g/6bd7iqRD9nRRZxACekRbza7AqU5xN1UjvVtCJQ9VC74K9KP\n" + - "pBoLWE2Bz5ksL9VUc4kS+WGORvZrSE1EpBq6cHc=\n" + - "-----END CERTIFICATE-----"; - - // Owner: SERIALNUMBER=983163327, CN=valid.businessplus.ca23.ssl.buypass.no, O=BUYPASS AS, - // L=OSLO, OID.2.5.4.17=0484, C=NO - // Issuer: CN=Buypass Class 3 CA 2, O=Buypass AS-983163327, C=NO - // Serial number: 267b7a9f0c3da9b94b39 - // Valid from: Mon Sep 23 04:17:42 PDT 2019 until: Mon Oct 11 14:59:00 PDT 2021 - private static final String VALID_CLASS_3 = "-----BEGIN CERTIFICATE-----\n" + - "MIIGUTCCBTmgAwIBAgIKJnt6nww9qblLOTANBgkqhkiG9w0BAQsFADBLMQswCQYD\n" + - "VQQGEwJOTzEdMBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMM\n" + - "FEJ1eXBhc3MgQ2xhc3MgMyBDQSAyMB4XDTE5MDkyMzExMTc0MloXDTIxMTAxMTIx\n" + - "NTkwMFowgYUxCzAJBgNVBAYTAk5PMQ0wCwYDVQQRDAQwNDg0MQ0wCwYDVQQHDARP\n" + - "U0xPMRMwEQYDVQQKDApCVVlQQVNTIEFTMS8wLQYDVQQDDCZ2YWxpZC5idXNpbmVz\n" + - "c3BsdXMuY2EyMy5zc2wuYnV5cGFzcy5ubzESMBAGA1UEBRMJOTgzMTYzMzI3MIIB\n" + - "IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArqj6dPVIQUULBV/S+u2/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LonG7bICWAe1vnCNud4CIE7/KRDu9Jys24rtmLz9yCNYJfZDvooK5PT9+rWR\n" + - "OC4+AHUApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFtXdd54gAA\n" + - "BAMARjBEAiB09qp4sGA+Kxg823hea3ZyTV7mU1ZQ9j9fqqX8KZ1mpwIgUICM2H0Y\n" + - "8z+V9m+6SutZ5WTD+Arg3K8O6/dvyKu0QmEAdQBvU3asMfAxGdiZAKRRFf93FRwR\n" + - "2QLBACkGjbIImjfZEwAAAW1d13cSAAAEAwBGMEQCIFLqxvNOKVFlTjHPXwk93VeW\n" + - "zCqFtcxJkunD/iiv0Kn9AiBoyvUrjYn4MPTht9zb0OyaSMWb00/HXP/4AVmUzHrz\n" + - "YzANBgkqhkiG9w0BAQsFAAOCAQEAsmQAOn1f1CbvnOpggS2efmy1pQXvvw+YeCYP\n" + - "bElO578h7scn8al4N7huQZ/z14BELe0chGWNA/ReW5nAu3SUOiv+E8/kv9i9Y8ul\n" + - "MJPL62nXW6Z/mkyystuBNtON420iWL/gS/vduxSZE/iBB4znctDpXS917/XWf31Y\n" + - "ZonemF3MSfi/s9V0Ic82ZY/+HZ4NLTDyKRd4kFF58OoH9RZNb6g8MbTp+gPadiUG\n" + - "UcfPGV3yGiugQa7WHTl7QJ9ishyafiZ4hpeKem6TMDEztgGyLIZ4MSxQvoeI2jJP\n" + - "KjHd5fW/HClbEcrN+w0a0MUNMaAOaZfMS7jS6sDpaVL8D0EX5A==\n" + - "-----END CERTIFICATE-----"; - - // Owner: SERIALNUMBER=983163327, CN=revoked.businessplus.ca23.ssl.buypass.no, O=BUYPASS AS, - // L=OSLO, OID.2.5.4.17=0484, C=NO - // Issuer: CN=Buypass Class 3 CA 2, O=Buypass AS-983163327, C=NO - // Serial number: 267cee3fab06c615fb27 - // Valid from: Mon Sep 23 04:56:56 PDT 2019 until: Thu Sep 23 14:59:00 PDT 2021 - private static final String REVOKED_CLASS_3 = "-----BEGIN C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Km8dVH5RurqVm9xZcXb1nbwfu2k3lqqsp/uwqvLBItJDvA8pfi\n" + - "2R46sEtj2gFpAlKFDwepuaklqhrvEoIjIaAL0RrGfKY0oRQw1YMbPNIebsVaWr04\n" + - "rt6tlxrq7PyW1w9Mt3445WA1NzSWc7pAjFLfY6u87QaPHI4ES31H9xxRDsxmr6Y3\n" + - "BJmiWd5uUxev0nVw0saqvlo4yAEBq4rI/DieKcQI4qEI8myzoS0R0azMfLM=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID_CLASS_3, INT_CLASS_3}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED_CLASS_3, INT_CLASS_3}, - ValidatePathWithParams.Status.REVOKED, - "Mon Sep 23 04:57:31 PDT 2019", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java new file mode 100644 index 00000000000..abc7bbe3272 --- /dev/null +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -0,0 +1,561 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test id=actalisauthenticationrootca + * @bug 8189131 + * @summary Interoperability tests with Actalis CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp + * CAInterop actalisauthenticationrootca OCSP + * @run main/othervm/timeout=180 -Djava.security.debug=certpath,ocsp + * CAInterop actalisauthenticationrootca CRL + */ + +/* + * @test id=amazonrootca1 + * @bug 8233223 + * @summary Interoperability tests with Amazon's CA1 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop amazonrootca1 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop amazonrootca1 CRL + */ + +/* + * @test id=amazonrootca2 + * @bug 8233223 + * @summary Interoperability tests with Amazon's CA2 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop amazonrootca2 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop amazonrootca2 CRL + */ + +/* + * @test id=amazonrootca3 + * @bug 8233223 + * @summary Interoperability tests with Amazon's CA3 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop amazonrootca3 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop amazonrootca3 CRL + */ + +/* + * @test id=amazonrootca4 + * @bug 8233223 + * @summary Interoperability tests with Amazon's CA4 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop amazonrootca4 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop amazonrootca4 CRL + */ + +/* + * @test id=buypassclass2ca + * @bug 8189131 + * @summary Interoperability tests with Buypass Class 2 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop buypassclass2ca OCSP + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop buypassclass2ca CRL + */ + +/* + * @test id=buypassclass3ca + * @bug 8189131 + * @summary Interoperability tests with Buypass Class 3 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop buypassclass3ca OCSP + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop buypassclass3ca CRL + */ + +/* + * @test id=comodorsaca + * @bug 8189131 + * @summary Interoperability tests with Comodo RSA CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop comodorsaca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop comodorsaca CRL + */ + +/* + * @test id=comodoeccca + * @bug 8189131 + * @summary Interoperability tests with Comodo ECC CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop comodoeccca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop comodoeccca CRL + */ + +/* + * @test id=usertrustrsaca + * @bug 8189131 + * @summary Interoperability tests with Comodo userTrust RSA CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop usertrustrsaca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop usertrustrsaca CRL + */ + +/* + * @test id=usertrusteccca + * @bug 8189131 + * @summary Interoperability tests with Comodo userTrust ECC CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop usertrusteccca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop usertrusteccca CRL + */ + +/* + * @test id=letsencryptisrgx1 + * @bug 8189131 + * @summary Interoperability tests with Let's Encrypt CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop letsencryptisrgx1 DEFAULT + */ + +/* + * @test id=globalsignrootcar6 + * @bug 8216577 + * @summary Interoperability tests with GlobalSign R6 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop globalsignrootcar6 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop globalsignrootcar6 CRL + */ + +/* + * @test id=entrustrootcaec1 + * @bug 8195774 + * @summary Interoperability tests with Entrust CAs + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop entrustrootcaec1 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop entrustrootcaec1 CRL + */ + +/* + * @test id=entrustrootcag4 + * @bug 8243321 + * @summary Interoperability tests with Entrust CAs + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop entrustrootcag4 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop entrustrootcag4 CRL + */ + +/* + * @test id=godaddyrootg2ca + * @bug 8196141 + * @summary Interoperability tests with GoDaddy CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop godaddyrootg2ca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop godaddyrootg2ca CRL + */ + +/* + * @test id=starfieldrootg2ca + * @bug 8196141 + * @summary Interoperability tests with Starfield CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop starfieldrootg2ca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop starfieldrootg2ca CRL + */ + +/* + * @test id=globalsigneccrootcar4 + * @bug 8307134 + * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop globalsigneccrootcar4 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop globalsigneccrootcar4 CRL + */ + +/* + * @test id=gtsrootcar1 + * @bug 8307134 + * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop gtsrootcar1 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop gtsrootcar1 CRL + */ + +/* + * @test id=gtsrootcar2 + * @bug 8307134 + * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop gtsrootcar2 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop gtsrootcar2 CRL + */ + +/* + * @test id=gtsrootecccar3 + * @bug 8307134 + * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop gtsrootecccar3 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop gtsrootecccar3 CRL + */ + +/* + * @test id=gtsrootecccar4 + * @bug 8307134 + * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop gtsrootecccar4 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop gtsrootecccar4 CRL + */ + +/* + * @test id=microsoftecc2017 + * @bug 8304760 + * @summary Interoperability tests with Microsoft TLS root CAs + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop microsoftecc2017 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop microsoftecc2017 CRL + */ + +/* + * @test id=microsoftrsa2017 + * @bug 8304760 + * @summary Interoperability tests with Microsoft TLS root CAs + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop microsoftrsa2017 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop microsoftrsa2017 CRL + */ + +/* + * @test id=quovadisrootca1g3 + * @bug 8189131 + * @summary Interoperability tests with QuoVadis Root CA1 G3 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop quovadisrootca1g3 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop quovadisrootca1g3 CRL + */ + +/* + * @test id=quovadisrootca2g3 + * @bug 8189131 + * @summary Interoperability tests with QuoVadis Root CA2 G3 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop quovadisrootca2g3 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop quovadisrootca2g3 CRL + */ + +/* + * @test id=quovadisrootca3g3 + * @bug 8189131 + * @summary Interoperability tests with QuoVadis Root CA3 G3 CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop quovadisrootca3g3 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop quovadisrootca3g3 CRL + */ + +/* + * @test id=sslrootrsaca + * @bug 8243320 + * @summary Interoperability tests with SSL.com's RSA CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop sslrootrsaca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop sslrootrsaca CRL + */ + +/* + * @test id=sslrootevrsaca + * @bug 8243320 + * @summary Interoperability tests with SSL.com's EV RSA CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop sslrootevrsaca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop sslrootevrsaca CRL + */ + +/* + * @test id=sslrooteccca + * @bug 8243320 + * @summary Interoperability tests with SSL.com's ECC CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop sslrooteccca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop sslrooteccca CRL + */ + +/* + * @test id=teliasonerarootcav1 + * @bug 8210432 + * @summary Interoperability tests with TeliaSonera Root CA v1 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop teliasonerarootcav1 OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop teliasonerarootcav1 CRL + */ + +/* + * @test id=twcaglobalrootca + * @bug 8305975 + * @summary Interoperability tests with TWCA Global Root CA from TAIWAN-CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop twcaglobalrootca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop twcaglobalrootca CRL + */ + +/* + * @test id=certignarootca + * @bug 8314960 + * @summary Interoperability tests with Certigna Root CAs from Dhimyotis + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop certignarootca OCSP + * @run main/othervm -Djava.security.debug=certpath CAInterop certignarootca CRL + */ + +/** + * Collection of certificate validation tests for interoperability with external CAs + */ +public class CAInterop { + + /** + * Returns the test configuration for CA + * + * @param alias from the cacerts file without [jdk] + * @return CATestURLs + */ + private CATestURLs getTestURLs(String alias) { + switch (alias) { + case "actalisauthenticationrootca": + return new CATestURLs("https://ssltest-active.actalis.it", + "https://ssltest-revoked.actalis.it"); + + case "amazonrootca1": + return new CATestURLs("https://valid.rootca1.demo.amazontrust.com", + "https://revoked.rootca1.demo.amazontrust.com"); + case "amazonrootca2": + return new CATestURLs("https://valid.rootca2.demo.amazontrust.com", + "https://revoked.rootca2.demo.amazontrust.com"); + case "amazonrootca3": + return new CATestURLs("https://valid.rootca3.demo.amazontrust.com", + "https://revoked.rootca3.demo.amazontrust.com"); + case "amazonrootca4": + return new CATestURLs("https://valid.rootca4.demo.amazontrust.com", + "https://revoked.rootca4.demo.amazontrust.com"); + + case "buypassclass2ca": + return new CATestURLs("https://valid.business.ca22.ssl.buypass.no", + "https://revoked.business.ca22.ssl.buypass.no"); + case "buypassclass3ca": + return new CATestURLs("https://valid.qcevident.ca23.ssl.buypass.no", + "https://revoked.qcevident.ca23.ssl.buypass.no"); + + case "comodorsaca": + return new CATestURLs("https://comodorsacertificationauthority-ev.comodoca.com", + "https://comodorsacertificationauthority-ev.comodoca.com:444"); + case "comodoeccca": + return new CATestURLs("https://comodoecccertificationauthority-ev.comodoca.com", + "https://comodoecccertificationauthority-ev.comodoca.com:444"); + case "usertrustrsaca": + return new CATestURLs("https://usertrustrsacertificationauthority-ev.comodoca.com", + "https://usertrustrsacertificationauthority-ev.comodoca.com:444"); + case "usertrusteccca": + return new CATestURLs("https://usertrustecccertificationauthority-ev.comodoca.com", + "https://usertrustecccertificationauthority-ev.comodoca.com:444"); + + case "letsencryptisrgx1": + return new CATestURLs("https://valid-isrgrootx1.letsencrypt.org", + "https://revoked-isrgrootx1.letsencrypt.org"); + + case "globalsignrootcar6": + return new CATestURLs("https://valid.r6.roots.globalsign.com", + "https://revoked.r6.roots.globalsign.com"); + + case "entrustrootcaec1": + return new CATestURLs("https://validec.entrust.net", + "https://revokedec.entrust.net"); + case "entrustrootcag4": + return new CATestURLs("https://validg4.entrust.net", + "https://revokedg4.entrust.net"); + + case "godaddyrootg2ca": + return new CATestURLs("https://valid.gdig2.catest.godaddy.com", + "https://revoked.gdig2.catest.godaddy.com"); + case "starfieldrootg2ca": + return new CATestURLs("https://valid.sfig2.catest.starfieldtech.com", + "https://revoked.sfig2.catest.starfieldtech.com"); + + case "globalsigneccrootcar4": + return new CATestURLs("https://good.gsr4.demo.pki.goog", + "https://revoked.gsr4.demo.pki.goog"); + case "gtsrootcar1": + return new CATestURLs("https://good.gtsr1.demo.pki.goog", + "https://revoked.gtsr1.demo.pki.goog"); + case "gtsrootcar2": + return new CATestURLs("https://good.gtsr2.demo.pki.goog", + "https://revoked.gtsr2.demo.pki.goog"); + case "gtsrootecccar3": + return new CATestURLs("https://good.gtsr3.demo.pki.goog", + "https://revoked.gtsr3.demo.pki.goog"); + case "gtsrootecccar4": + return new CATestURLs("https://good.gtsr4.demo.pki.goog", + "https://revoked.gtsr4.demo.pki.goog"); + + case "microsoftecc2017": + return new CATestURLs("https://acteccroot2017.pki.microsoft.com", + "https://rvkeccroot2017.pki.microsoft.com"); + case "microsoftrsa2017": + return new CATestURLs("https://actrsaroot2017.pki.microsoft.com", + "https://rvkrsaroot2017.pki.microsoft.com"); + + case "quovadisrootca1g3": + return new CATestURLs("https://quovadis-root-ca-1-g3.chain-demos.digicert.com", + "https://quovadis-root-ca-1-g3-revoked.chain-demos.digicert.com"); + case "quovadisrootca2g3": + return new CATestURLs("https://quovadis-root-ca-2-g3.chain-demos.digicert.com", + "https://quovadis-root-ca-2-g3-revoked.chain-demos.digicert.com"); + case "quovadisrootca3g3": + return new CATestURLs("https://quovadis-root-ca-3-g3.chain-demos.digicert.com", + "https://quovadis-root-ca-3-g3-revoked.chain-demos.digicert.com"); + + case "sslrootrsaca": + return new CATestURLs("https://test-dv-rsa.ssl.com", + "https://revoked-rsa-dv.ssl.com"); + case "sslrootevrsaca": + return new CATestURLs("https://test-ev-rsa.ssl.com", + "https://revoked-rsa-ev.ssl.com"); + case "sslrooteccca": + return new CATestURLs("https://test-dv-ecc.ssl.com", + "https://revoked-ecc-dv.ssl.com"); + + case "teliasonerarootcav1": + return new CATestURLs("https://juolukka.cover.sonera.net:10443", + "https://juolukka.cover.sonera.net:10444"); + + case "twcaglobalrootca": + return new CATestURLs("https://evssldemo6.twca.com.tw", + "https://evssldemo7.twca.com.tw"); + + case "certignarootca": + return new CATestURLs("https://valid.servicesca.dhimyotis.com", + "https://revoked.servicesca.dhimyotis.com"); + + default: throw new RuntimeException("No test setup found for: " + alias); + } + } + + public static void main(String[] args) throws Exception { + if (args.length < 2) { + throw new RuntimeException("Run as: CAInterop "); + } + + String caAlias = args[0]; + + CAInterop caInterop = new CAInterop(args[1]); + CATestURLs caTestURLs = caInterop.getTestURLs(caAlias); + + caInterop.validate(caAlias + " [jdk]", + caTestURLs.getVALID_URL(), + caTestURLs.getREVOKED_URL()); + } + + static class CATestURLs { + final String VALID_URL; + final String REVOKED_URL; + + public CATestURLs(String validURL, + String revokedURL) { + VALID_URL = validURL; + REVOKED_URL = revokedURL; + } + + public String getVALID_URL() { + return VALID_URL; + } + + public String getREVOKED_URL() { + return REVOKED_URL; + } + } + + /** + * Constructor for interoperability test with third party CA. + * + * @param revocationMode revocation checking mode to use + */ + public CAInterop(String revocationMode) { + if ("CRL".equalsIgnoreCase(revocationMode)) { + ValidatePathWithURL.enableCRLOnly(); + } else if ("OCSP".equalsIgnoreCase(revocationMode)) { + ValidatePathWithURL.enableOCSPOnly(); + } else { + // OCSP and CRL check by default + ValidatePathWithURL.enableOCSPAndCRL(); + } + + ValidatePathWithURL.logRevocationSettings(); + } + + /** + * Validates provided URLs using HttpsURLConnection making sure they + * anchor to the root CA found in cacerts using provided alias. + * + * @param caAlias CA alis from cacerts file + * @param validCertURL valid test URL + * @param revokedCertURL revoked test URL + * @throws Exception thrown when certificate can't be validated as valid or revoked + */ + public void validate(String caAlias, + String validCertURL, + String revokedCertURL) throws Exception { + + ValidatePathWithURL validatePathWithURL = new ValidatePathWithURL(caAlias); + + if (validCertURL != null) { + validatePathWithURL.validateDomain(validCertURL, false); + } + + if (revokedCertURL != null) { + validatePathWithURL.validateDomain(revokedCertURL, true); + } + } +} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CertignaCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CertignaCA.java new file mode 100644 index 00000000000..f1dd2d6229a --- /dev/null +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CertignaCA.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8245654 8256895 + * @summary Interoperability tests with Certigna Root CAs from Dhimyotis + * @build ValidatePathWithParams + * @run main/othervm -Djava.security.debug=certpath CertignaCA OCSP + * @run main/othervm -Djava.security.debug=certpath CertignaCA CRL + */ +public class CertignaCA { + // Owner: CN=Certigna Services CA, OID.2.5.4.97=NTRFR-48146308100036, + // OU=0002 48146308100036, O=DHIMYOTIS, C=FR + // Issuer: CN=Certigna, O=Dhimyotis, C=FR + // Serial number: 6f82fa28acd6f784bb5b120ba87367ad + // Valid from: Wed Nov 25 03:33:52 PST 2015 until: Sat Nov 22 03:33:52 PST 2025 + private static final String INT_CERTIGNA = "-----BEGIN CERTIFICATE-----\n" + + "MIIGFjCCBP6gAwIBAgIQb4L6KKzW94S7WxILqHNnrTANBgkqhkiG9w0BAQsFADA0\n" + + "MQswCQYDVQQGEw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qHgUp8yqeWtl1n44ZxkkK1t9GRwhn\n" + + "DWLv73/xhTmdhWYQ/reo0GbgBoLiltKmIJQ=\n" + + "-----END CERTIFICATE-----"; + + // Owner: SERIALNUMBER=S266241169, CN=valid.servicesca.dhimyotis.com, O=DHIMYOTIS, + // L=VILLENEUVE D'ASCQ, C=FR + // Issuer: CN=Certigna Services CA, OID.2.5.4.97=NTRFR-48146308100036, OU=0002 + // 48146308100036, O=DHIMYOTIS, C=FR + // Serial number: c641ef7b0340c21515d8c462e729dc0e + // Valid from: Thu Mar 09 15:00:00 PST 2023 until: Mon Mar 11 15:59:59 PDT 2024 + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIIdzCCBl+gAwIBAgIRAMZB73sDQMIVFdjEYucp3A4wDQYJKoZIhvcNAQELBQAw\n" + + "fTELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURISU1ZT1RJUzEcMBoGA1UECwwTMDAw\n" + + "MiA0ODE0NjMwODEwMDAzNjEdMBsGA1UEYQwUTlRSRlItNDgxNDYzMDgxMDAwMzYx\n" + + "HTAbBgNVBAMMFENlcnRpZ25hIFNlcnZpY2VzIENBMB4XDTIzMDMwOTIzMDAwMFoX\n" + + "DTI0MDMxMTIyNTk1OVowezELMAkGA1UEBhMCRlIxGjAYBgNVBAcMEVZJTExFTkVV\n" + + "VkUgRCdBU0NRMRIwEAYDVQQKDAlESElNWU9USVMxJzAlBgNVBAMMHnZhbGlkLnNl\n" + + "cnZpY2VzY2EuZGhpbXlvdGlzLmNvbTETMBEGA1UEBRMKUzI2NjI0MTE2OTCCASIw\n" + + "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJDrFpZWEeBJoMUuG37wEmJ7XVeX\n" + + "Jde1bgURpFbLwifRj2TVmMdtfg9hXHL7B7Mh/+I8/e7kJz8mlU9qUYKyH24oAitE\n" + + "myXYHAKTydqTseiM3mp92n4PM+DrgsdbT7bpmiirNM0/sqWFNyGUz7kP6Z5E3uuU\n" + +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byF9j67kLs3f7/c5Kx3FlclJ7/vlL8zEcTmGU7rm\n" + + "ZFOhEMDT/UYkitqAOvrgT60oIm9YJ1XTAVTeDbW0FFAb2nFmeBOrw8N3jaCb+jpO\n" + + "ysBA/lDaGTiQhMlJK44vwgS+TjbeWHxvmAE5srKa7MWU8Mmku2vuX95lupJo4LmD\n" + + "zOsihH00hyhtHFUB1TGXuaf77kFsipE6iycyxpcrpJ1UAWiZrba6PAZ85TbYhEdY\n" + + "FDNm7F7CVPU67HV5gE2kDa3Jprd1SjwO095LsRptWhzxUByhee3JI0jljBTaKowy\n" + + "jPv8oekm7zqCLzY=\n" + + "-----END CERTIFICATE-----"; + + // Owner: SERIALNUMBER=S266251168, CN=revoked.servicesca.certigna.com, O=DHIMYOTIS, + // L=VILLENEUVE D'ASCQ, C=FR + // Issuer: CN=Certigna Services CA, OID.2.5.4.97=NTRFR-48146308100036, OU=0002 + // 48146308100036, O=DHIMYOTIS, C=FR + // Serial number: e863f752a23a735e3ccf958abf18565b + // Valid from: Thu Mar 09 15:00:00 PST 2023 until: Fri Mar 08 14:59:59 PST 2024 + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIIezCCBmOgAwIBAgIRAOhj91KiOnNePM+Vir8YVlswDQYJKoZIhvcNAQELBQAw\n" + + "fTELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURISU1ZT1RJUzEcMBoGA1UECwwTMDAw\n" + + "MiA0ODE0NjMwODEwMDAzNjEdMBsGA1UEYQwUTlRSRlItNDgxNDYzMDgxMDAwMzYx\n" + + "HTAbBgNVBAMMFENlcnRpZ25hIFNlcnZpY2VzIENBMB4XDTIzMDMwOTIzMDAwMFoX\n" + + "DTI0MDMwODIyNTk1OVowfDELMAkGA1UEBhMCRlIxGjAYBgNVBAcMEVZJTExFTkVV\n" + + "VkUgRCdBU0NRMRIwEAYDVQQKDAlESElNWU9USVMxKDAmBgNVBAMMH3Jldm9rZWQu\n" + + "c2VydmljZXNjYS5jZXJ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16z2A/wAwrFvxI0XrjHpOyDp4CBDYqDADNPiL\n" + + "vlEkiwP6r7WHjUdWRb7W0t75uAkcajn46XKpFmaHHie5KBch+KDGsUionuH5ZW8Y\n" + + "klh2B34uLWcGZuIR7PeCO9+91mbn/bBNeabGC70qMStaB139lp9P2M+l2WpyREUK\n" + + "l7qHwTsrlMmNb8n44zGtY4wL9NSYWTdTfhcU0FAPdPcLlnjoQubJ1O0vPkzfVYns\n" + + "WQrslxoCBor6CL6AYMQz3jbzQ0soD3Reb11+uTngWGJZtx4DT09RFB3a+1rcYjiS\n" + + "ijCBB+Lqx0xfLQnfBv1A0wjNqUY+gyEe0SpXqB4edqy5uaqawRRKMuNSnb2BVz0/\n" + + "keo1Kif/GSak+JUBpJ8hkJWygtrWCETUNfoseQhqo3gism0EGxJ04tBp+DRvfbrz\n" + + "X4aBgALRro3jSIR1Ibp+e0fxePwShy715SF2H4SfjvplTAKq5bwztZtQUkPR6fJ7\n" + + "5xT0f762c1yytKP1rHFMvzl6k7QWvC6zb2FeG5UqXJw3wFxxWsCuAUu5SPFfXdno\n" + + "5lIHTTV5rpZBN+PzTZsz\n" + + "-----END CERTIFICATE-----"; + + public static void main(String[] args) throws Exception { + + // Added to test for JDK-8256895 + System.setProperty("jdk.security.certpath.ocspNonce", "true"); + + // OCSP check by default + boolean ocspEnabled = args.length < 1 || !"CRL".equalsIgnoreCase(args[0]); + + ValidatePathWithParams pathValidator; + String[] validChainToValidate; + String[] revChainToValidate; + + if (!ocspEnabled) { + pathValidator = new ValidatePathWithParams(null); + pathValidator.enableCRLCheck(); + + validChainToValidate = new String[]{VALID, INT_CERTIGNA}; + revChainToValidate = new String[]{REVOKED, INT_CERTIGNA}; + } else { + // int certificate doesn't specify OCSP responder + pathValidator = new ValidatePathWithParams(new String[]{INT_CERTIGNA}); + pathValidator.enableOCSPCheck(); + + validChainToValidate = new String[]{VALID}; + revChainToValidate = new String[]{REVOKED}; + } + + // Validate valid + pathValidator.validate(validChainToValidate, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(revChainToValidate, + ValidatePathWithParams.Status.REVOKED, + "Fri Mar 10 03:39:51 PST 2023", System.out); + } +} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java deleted file mode 100644 index 73d7171b906..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java +++ /dev/null @@ -1,643 +0,0 @@ -/* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @bug 8189131 8231887 - * @summary Interoperability tests with Comodo RSA, ECC, userTrust RSA, and - * userTrust ECC CAs - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath ComodoCA OCSP - * @run main/othervm -Djava.security.debug=certpath ComodoCA CRL - */ - - /* - * Obtain TLS test artifacts for Comodo CAs from: - * - * Valid TLS Certificates: - * https://comodorsacertificationauthority-ev.comodoca.com - * https://comodoecccertificationauthority-ev.comodoca.com - * https://usertrustrsacertificationauthority-ev.comodoca.com - * https://usertrustecccertificationauthority-ev.comodoca.com - * - * Revoked TLS Certificates: - * https://comodorsacertificationauthority-ev.comodoca.com:444 - * https://comodoecccertificationauthority-ev.comodoca.com:444 - * https://usertrustrsacertificationauthority-ev.comodoca.com:444 - * https://usertrustecccertificationauthority-ev.comodoca.com:444 - */ -public class ComodoCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new ComodoRSA().runTest(pathValidator); - new ComodoECC().runTest(pathValidator); - new ComodoUserTrustRSA().runTest(pathValidator); - new ComodoUserTrustECC().runTest(pathValidator); - } -} - -class ComodoRSA { - - // Owner: CN=COMODO RSA Extended Validation Secure Server CA, - // O=COMODO CA Limited, L=Salford, ST=Greater Manchester, C=GB - // Issuer: CN=COMODO RSA Certification Authority, O=COMODO CA Limited, - // L=Salford, ST=Greater Manchester, C=GB - // Serial number: 6a74380d4ebfed435b5a3f7e16abdd8 - // Valid from: Sat Feb 11 16:00:00 PST 2012 until: Thu Feb 11 15:59:59 PST 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIGDjCCA/agAwIBAgIQBqdDgNTr/tQ1taP34Wq92DANBgkqhkiG9w0BAQwFADCB\n" - + "hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G\n" - + "A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV\n" - + "BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTIwMjEy\n" - + "MDAwMDAwWhcNMjcwMjExMjM1OTU5WjCBkjELMAkGA1UEBhMCR0IxGzAZBgNVBAgT\n" - + "EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR\n" - + "Q09NT0RPIENBIExpbWl0ZWQ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AQEMBQADggIBAERCnUFRK0iIXZebeV4R\n" - + "AUpSGXtBLMeJPNBy3IX6WK/VJeQT+FhlZ58N/1eLqYVeyqZLsKeyLeCMIs37/3mk\n" - + "jCuN/gI9JN6pXV/kD0fQ22YlPodHDK4ixVAihNftSlka9pOlk7DgG4HyVsTIEFPk\n" - + "1Hax0VtpS3ey4E/EhOfUoFDuPPpE/NBXueEoU/1Tzdy5H3pAvTA/2GzS8+cHnx8i\n" - + "teoiccsq8FZ8/qyo0QYPFBRSTP5kKwxpKrgNUG4+BAe/eiCL+O5lCeHHSQgyPQ0o\n" - + "fkkdt0rvAucNgBfIXOBhYsvss2B5JdoaZXOcOBCgJjqwyBZ9kzEi7nQLiMBciUEA\n" - + "KKlHMd99SUWa9eanRRrSjhMQ34Ovmw2tfn6dNVA0BM7pINae253UqNpktNEvWS5e\n" - + "ojZh1CSggjMziqHRbO9haKPl0latxf1eYusVqHQSTC8xjOnB3xBLAer2VBvNfzu9\n" - + "XJ/B288ByvK6YBIhMe2pZLiySVgXbVrXzYxtvp5/4gJYp9vDLVj2dAZqmvZh+fYA\n" - + "tmnYOosxWd2R5nwnI4fdAw+PKowegwFOAWEMUnNt/AiiuSpm5HZNMaBWm9lTjaK2\n" - + "jwLI5jqmBNFI+8NKAnb9L9K8E7bobTQk+p0pisehKxTxlgBzuRPpwLk6R1YCcYAn\n" - + "pLwltum95OmYdBbxN4SBB7SC\n" - + "-----END CERTIFICATE-----"; - - // Owner: CN=comodorsacertificationauthority-ev.comodoca.com, - // O=Sectigo Limited, STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, - // L=Salford, ST=Manchester, OID.2.5.4.17=M5 3EQ, C=GB, OID.2.5.4.15=Private Organization, - // OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=COMODO RSA Extended Validation Secure Server CA, O=COMODO CA Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: 9eb246629030e0b527ca2f93e5ebf25a - // Valid from: Mon Mar 01 16:00:00 PST 2021 until: Sat Apr 02 16:59:59 PDT 2022 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHSzCCBjOgAwIBAgIRAJ6yRmKQMOC1J8ovk+Xr8lowDQYJKoZIhvcNAQELBQAw\n" + - "gZIxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO\n" + - "BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTgwNgYD\n" + - "VQQDEy9DT01PRE8gUlNBIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZl\n" + - "ciBDQTAeFw0yMTAzMDIwMDAwMDBaFw0yMjA0MDIyMzU5NTlaMIIBNzERMA8GA1UE\n" + - "BRMIMDQwNTg2OTAxEzARBgsrBgEEAYI3PAIBAxMCR0IxHTAbBgNVBA8TFFByaXZh\n" + - "dGUgT3JnYW5pemF0aW9uMQswCQYDVQQGEwJHQjEPMA0GA1UEERMGTTUgM0VRMRMw\n" + - "EQYDVQQIEwpNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRYwFAYDVQQJEw1U\n" + - "cmFmZm9yZCBSb2FkMRYwFAYDVQQJEw1FeGNoYW5nZSBRdWF5MSUwIwYDVQQJExwz\n" + - "cmQgRmxvb3IsIDI2IE9mZmljZSBWaWxsYWdlMRgwFgYDVQQKEw9TZWN0aWdvIExp\n" + - "bWl0ZWQxODA2BgNVBAMTL2NvbW9kb3JzYWNlcnRpZmljYXRpb25hdXRob3JpdHkt\n" + - "ZXYuY29tb2RvY2EuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n" + - "0P95lAFOOkEOy614rCX7OlOK0Xy0nPAcCFxAcLYBosX8YmXWuePHg596UyEqE3U5\n" + - "30pTqiccY53bDiYPgSJgr1OlfC7BPLN+QKaeSrFmNgrcoA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L8cP5tRwAA\n" + - "AXfyqEfyAAAEAwBHMEUCIQDJbHPgbqK21/Nugwl5mgMO81YQSHOm4VcQ8UvOJjnN\n" + - "JQIgWw9fortwJBtv2Mts6xJYr5D6itPpEYP8uegURneBwRsAdgBvU3asMfAxGdiZ\n" + - "AKRRFf93FRwR2QLBACkGjbIImjfZEwAAAXfyqEjyAAAEAwBHMEUCIDifAsuw37D4\n" + - "beHZ9Ed5/Pab0Eg6Cobrh4jv3bjfA6KIAiEAmiA/XD+AccfI85c+C2zH9wNIs+Zm\n" + - "/V/uo/sv0i9eCAYwDQYJKoZIhvcNAQELBQADggEBADRFnOFgb3mzCUpXxiU5/mM5\n" + - "ECRj3NzXKXjcYlSMhVcWA7Eqa5rhJuh11vbPoDQzQcGxntS/zhRwJFRF3hnyFa3m\n" + - "4t+7ZnUaJN+GOMTABh4kYiOSpE9id12URdJzWv2IHg4CU3OLnsBHGh7H9eWfbPvn\n" + - "OW4owV1ChpiEHh40i/NQkTn9JzjlZepI9+EsSdhn2tpis7tko6PX/plgw8bRgm7f\n" + - "ong2QaX/DE6z4VIdomW8TQhB9turhKxwjzPTbtYDQIgZfRP/H1S5jYutqbE5yL5B\n" + - "r+VOiSuB8234P4xWg1IBL2EFbxPdgOSMTWRJutUcj44kJKmwp5GUQtySSccw4gk=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=comodorsacertificationauthority-ev.comodoca.com, OU=COMODO EV SGC SSL, - // O=Sectigo Limited, STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, - // L=Salford, OID.2.5.4.17=M5 3EQ, C=GB, OID.2.5.4.15=Private Organization, - // OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=COMODO RSA Extended Validation Secure Server CA, O=COMODO CA Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: a0c7cabcc25ed9358ded02cc1d485545 - // Valid from: Sun Sep 29 17:00:00 PDT 2019 until: Tue Dec 28 15:59:59 PST 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIH0TCCBrmgAwIBAgIRAKDHyrzCXtk1je0CzB1IVUUwDQYJKoZIhvcNAQELBQAw\n" + - "gZIxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO\n" + - "BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTgwNgYD\n" + - "VQQDEy9DT01PRE8gUlNBIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZl\n" + - "ciBDQTAeFw0xOTA5MzAwMDAwMDBaFw0yMTEyMjgyMzU5NTlaMIIBPjERMA8GA1UE\n" + - "BRMIMDQwNTg2OTAxEzARBgsrBgEEAYI3PAIBAxMCR0IxHTAbBgNVBA8TFFByaXZh\n" + - "dGUgT3JnYW5pemF0aW9uMQswCQYDVQQGEwJHQjEPMA0GA1UEERMGTTUgM0VRMRAw\n" + - "DgYDVQQHEwdTYWxmb3JkMRYwFAYDVQQJEw1UcmFmZm9yZCBSb2FkMRYwFAYDVQQJ\n" + - "Ew1FeGNoYW5nZSBRdWF5MSUwIwYDVQQJExwzcmQgRmxvb3IsIDI2IE9mZmljZSBW\n" + - "aWxsYWdlMRgwFgYDVQQKEw9TZWN0aWdvIExpbWl0ZWQxGjAYBgNVBAsTEUNPTU9E\n" + - "TyBFViBTR0MgU1NMMTgwNgYDVQQDEy9jb21vZG9yc2FjZXJ0aWZpY2F0aW9uYXV0\n" + - "aG9yaXR5LWV2LmNvbW9kb2NhLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n" + - "AQoCggEBAND/eZQBTjpBDsuteKwl+zpTitF8tJzwHAhcQHC2AaLF/GJl1rnjx4Of\n" + - "elMhKhN1Od9KU6onHGOd2w4mD4EiYK9TpXwuwTyzfkCmnkqxZjYK3KAJN013o4L+\n" + - "8y1zsGVUulpN/GfMaxT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EQCIDqP1einOiPHnaG1fOZMDrEc\n" + - "RAxjq3vEl94fp4pkmke7AiBsJOvPE6irgcOO1/lnP7NRuln7iPJjU7T20PEK5/rm\n" + - "KwB2AFWB1MIWkDYBSuoLm1c8U/DA5Dh4cCUIFy+jqh0HE9MMAAABbYMBd0kAAAQD\n" + - "AEcwRQIhALgUI5XxM1NHbJDdr19h2pe3LhzK4tpuB/OQ9BgCyrGXAiBdr6mNCB/G\n" + - "rbdVx0u7iezwC7mq7iaWugR3rrWlSA8fWQB2ALvZ37wfinG1k5Qjl6qSe0c4V5UK\n" + - "q1LoGpCWZDaOHtGFAAABbYMBd1oAAAQDAEcwRQIgXbG32dagMeLhuZb+LSpJO1vI\n" + - "BmxmRnNdiz5FbG9cCbwCIQCr1X9f+ebT5fhlDUNBURUorTtM8QQciBiueBqvHk7+\n" + - "1DANBgkqhkiG9w0BAQsFAAOCAQEAM/A/1dgoc5NP1n+w3SX9qWcN7QT7ExdrnZSl\n" + - "Ygn0PF2fx4gz7cvNKucbpQJNA4C9awGydyYK8/o5KDUXt3K7eb1OAZ/NZBjygsJs\n" + - "ikXvxlBh8oEoqBOfOtr24l0NGUWnP8Qeu/VPcIMER4V8qX+in0pCXkSd67nkp6Bs\n" + - "EcqhDPgmzdSC1gQHsZuBdotG14OfdH1cG1bRK6GadISLG1h8BFukVem42B149v8F\n" + - "MCIUQAYprAVv2WlTZKBx9XzuK6IK3+klHZ07Jfvjvt7PPG5HKSMWBMnMaTHKcyQI\n" + - "G3t91yw7BnNNInZlBSsFtqjbHhDcr7uruZdbi0rerSsi2qDr0w==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 02 02:51:39 PST 2021", System.out); - } -} - -class ComodoECC { - - // Owner: CN=COMODO ECC Extended Validation Secure Server CA, - // O=COMODO CA Limited, L=Salford, ST=Greater Manchester, C=GB - // Issuer: CN=COMODO ECC Certification Authority, O=COMODO CA Limited, - // L=Salford, ST=Greater Manchester, C=GB - // Serial number: 61d4643b412b5d8d715499d8553aa03 - // Valid from: Sun Apr 14 17:00:00 PDT 2013 until: Fri Apr 14 16:59:59 PDT 2028 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIDojCCAyigAwIBAgIQBh1GQ7QStdjXFUmdhVOqAzAKBggqhkjOPQQDAzCBhTEL\n" - + "MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE\n" - + "BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT\n" - + "IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTMwNDE1MDAw\n" - + "MDAwWhcNMjgwNDE0MjM1OTU5WjCBkjELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy\n" - + "ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N\n" - + "T0RPIENBIExpbWl0ZWQxODA2BgNVBAMTL0NPTU9ETyBFQ0MgRXh0ZW5kZWQgVmFs\n" - + "aWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\n" - + "QgAEV3AaPyeTQy0aWXXkBJMR42DsJ5pnbliJe7ndaHzCDslVlY8ofpxeFiqluZrK\n" - + "KNcJeBU/Jl1YI9jLMyMZKsfSoaOCAWkwggFlMB8GA1UdIwQYMBaAFHVxpxlIGbyd\n" - + "nepBR9+UxEh3mdN5MB0GA1UdDgQWBBTTTsMZulhZ0Rxgt2FTRzund4/4ijAOBgNV\n" - + "HQ8BAf8EBAMCAYYwEgYDVR0TAQH/BAgwBgEB/wIBADA+BgNVHSAENzA1MDMGBFUd\n" - + "IAAwKzApBggrBgEFBQcCARYdaHR0cHM6Ly9zZWN1cmUuY29tb2RvLmNvbS9DUFMw\n" - + "TAYDVR0fBEUwQzBBoD+gPYY7aHR0cDovL2NybC5jb21vZG9jYS5jb20vQ09NT0RP\n" - + "RUNDQ2VydGlmaWNhdGlvbkF1dGhvcml0eS5jcmwwcQYIKwYBBQUHAQEEZTBjMDsG\n" - + "CCsGAQUFBzAChi9odHRwOi8vY3J0LmNvbW9kb2NhLmNvbS9DT01PRE9FQ0NBZGRU\n" - + "cnVzdENBLmNydDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2EuY29t\n" - + "MAoGCCqGSM49BAMDA2gAMGUCMQDmPWS98nREWdt4xB83r9MVvgG5INpKHi6V1dUY\n" - + "lCqvSvXXjK0QvZSrOB7cj9RavGgCMG2xJNG+SvlTWEYpmK7eXSgmRUgoBDeQ0yDK\n" - + "lnxmeeOBnnCaDIxAcA3aCj2Gtdt3sA==\n" - + "-----END CERTIFICATE-----"; - - // Owner: CN=comodoecccertificationauthority-ev.comodoca.com, O=Sectigo Limited, STREET="3rd Floor, - // 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, L=Salford, ST=Manchester, OID.2.5.4.17=M5 3EQ, - // C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=COMODO ECC Extended Validation Secure Server CA, O=COMODO CA Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: db437a31e5be29a62443e3caa1479001 - // Valid from: Mon Mar 01 16:00:00 PST 2021 until: Sat Apr 02 16:59:59 PDT 2022 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFvzCCBWWgAwIBAgIRANtDejHlvimmJEPjyqFHkAEwCgYIKoZIzj0EAwIwgZIx\n" + - "CzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVh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BQEwJTAjBggrBgEFBQcCARYXaHR0cHM6Ly9z\n" + - "ZWN0aWdvLmNvbS9DUFMwBwYFZ4EMAQEwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDov\n" + - "L2NybC5jb21vZG9jYS5jb20vQ09NT0RPRUNDRXh0ZW5kZWRWYWxpZGF0aW9uU2Vj\n" + - "dXJlU2VydmVyQ0EuY3JsMIGHBggrBgEFBQcBAQR7MHkwUQYIKwYBBQUHMAKGRWh0\n" + - "dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET0VDQ0V4dGVuZGVkVmFsaWRhdGlv\n" + - "blNlY3VyZVNlcnZlckNBLmNydDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuY29t\n" + - "b2RvY2EuY29tMDoGA1UdEQQzMDGCL2NvbW9kb2VjY2NlcnRpZmljYXRpb25hdXRo\n" + - "b3JpdHktZXYuY29tb2RvY2EuY29tMIIBBAYKKwYBBAHWeQIEAgSB9QSB8gDwAHYA\n" + - "RqVV63X6kSAwtaKJafTzfREsQXS+/Um4havy/HD+bUcAAAF38qtH4AAABAMARzBF\n" + - "AiBsKoB1TTfoUYUNqF160/vlOENHyK1zzARcnfGKYURHTwIhANKYWg1CO7jyCPk+\n" + - "IrrLaR+461snNK4LJZXJm4o/9GeeAHYAb1N2rDHwMRnYmQCkURX/dxUcEdkCwQAp\n" + - "Bo2yCJo32RMAAAF38qtJIAAABAMARzBFAiEA1hgxkYZb5Tc9+vQsDnsfXVewClN2\n" + - "7gzwd4hZdqAsOSYCID9CWcBvkKrL44mfe9ky1Z6BnAWHUBMCxTjt8MO/IMZ8MAoG\n" + - "CCqGSM49BAMCA0gAMEUCIBa3sfOiVb0q4LcXU9umKjzVw3Ib8VdiPTtXSnyl0oLb\n" + - "AiEAnpRB53UtLAF7xw98ELmK/LEk1b5KSlqoO8sFHgwQ8vI=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=comodoecccertificationauthority-ev.comodoca.com, OU=COMODO EV SSL, O=Sectigo Limited, - // STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, L=Salford, OID.2.5.4.17=M5 3EQ, - // C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=COMODO ECC Extended Validation Secure Server CA, O=COMODO CA Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: 7972d9d8472a2d52ad1ee6edfb16cbe1 - // Valid from: Sun Sep 29 17:00:00 PDT 2019 until: Tue Dec 28 15:59:59 PST 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIGPzCCBeWgAwIBAgIQeXLZ2EcqLVKtHubt+xbL4TAKBggqhkjOPQQDAjCBkjEL\n" + - "MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE\n" + - "BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxODA2BgNVBAMT\n" + - "L0NPTU9ETyBFQ0MgRXh0ZW5kZWQgVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENB\n" + - "MB4XDTE5MDkzMDAwMDAwMFoXDTIxMTIyODIzNTk1OVowggE6MREwDwYDVQQFEwgw\n" + - "NDA1ODY5MDETMBEGCysGAQQBgjc8AgEDEwJHQjEdMBsGA1UEDxMUUHJpdmF0ZSBP\n" + - "cmdhbml6YXRpb24xCzAJBgNVBAYTAkdCMQ8wDQYDVQQREwZNNSAzRVExEDAOBgNV\n" + - "BAcTB1NhbGZvcmQxFjAUBgNVBAkTDVRyYWZmb3JkIFJvYWQxFjAUBgNVBAkTDUV4\n" + - "Y2hhbmdlIFF1YXkxJTAjBgNVBAkTHDNyZCBGbG9vciwgMjYgT2ZmaWNlIFZpbGxh\n" + - "Z2UxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDEWMBQGA1UECxMNQ09NT0RPIEVW\n" +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uJiq+D0ZLp51oVUyWD9EyrtgBSCNwIW4cMCIAqg\n" + - "0VFTWHEmAVjaV23fGj3Ybu3mpSiHr6viGlgA2lYaAHUAVYHUwhaQNgFK6gubVzxT\n" + - "8MDkOHhwJQgXL6OqHQcT0wwAAAFtgwQTKAAABAMARjBEAiBb/gW1RU7kgFBiNpHx\n" + - "LStujKIocyENUTXsMbsac+LktwIgXbEr8vOOCEdBdXQ2F/FKec8ft6gz57mHNmwl\n" + - "pp7phbQAdgC72d+8H4pxtZOUI5eqkntHOFeVCqtS6BqQlmQ2jh7RhQAAAW2DBBM6\n" + - "AAAEAwBHMEUCIQDjKN3h86ofR94+JxLFoYuoA+DRtxEY8XGg+NQXlZfUrgIgEoO2\n" + - "ZzKbGfohdwj/WtDwJDRX5pjXF4M0nECiwtYXDIwwCgYIKoZIzj0EAwIDSAAwRQIg\n" + - "AkIRVQBwrElFjrnqk5XPvnlnwkIm1A70ayqOf1FexoQCIQC8tBTn//RCfrhcgTjd\n" + - "ER4wRjFfFoc6lC68OHGVg9CZZg==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 02 02:53:40 PST 2021", System.out); - } -} - -class ComodoUserTrustRSA { - - // Owner: CN=Sectigo RSA Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Issuer: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US - // Serial number: 284e39c14b386d889c7299e58cd05a57 - // Valid from: Thu Nov 01 17:00:00 PDT 2018 until: Tue Dec 31 15:59:59 PST 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIGNDCCBBygAwIBAgIQKE45wUs4bYiccpnljNBaVz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2crF3ZSA3tuV\n" + - "/UJ33mjdVO8wBD8aI5y10QreSPJvZHHNDyCmoyjXvNhR+u3arXUoHWxO+MZBeXbi\n" + - "iF7Nwn/IEmQvWBW8l6D26CXIavcY1kAJcfyzHkrPbLo+fAOa/KFl3lIU+0biEVNk\n" + - "Q9zXE6hC6X4=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=usertrustrsacertificationauthority-ev.comodoca.com, O=Sectigo Limited, STREET="3rd Floor, - // 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, L=Salford, ST=Manchester, OID.2.5.4.17=M5 3EQ, - // C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=Sectigo RSA Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: 4e484426dbfed0c222b2ed152465614a - // Valid from: Mon Mar 01 16:00:00 PST 2021 until: Sat Apr 02 16:59:59 PDT 2022 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHTzCCBjegAwIBAgIQTkhEJtv+0MIisu0VJGVhSjANBgkqhkiG9w0BAQsFADCB\n" + - "kTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G\n" + - "A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTkwNwYDVQQD\n" + - "EzBTZWN0aWdvIFJTQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIg\n" + - "Q0EwHhcNMjEwMzAyMDAwMDAwWhcNMjIwNDAyMjM1OTU5WjCCAToxETAPBgNVBAUT\n" + - "CDA0MDU4NjkwMRMwEQYLKwYBBAGCNzwCAQMTAkdCMR0wGwYDVQQPExRQcml2YXRl\n" + - "IE9yZ2FuaXphdGlvbjELMAkGA1UEBhMCR0IxDzANBgNVBBETBk01IDNFUTETMB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Wd40LjOEg31sA43ofO8n2pySP5LG5XAsvoAyPCy3zXhx5cdtmQFLIkntus\n" + - "DCfN+n51HPUo8r4PUhQtOiRUB3K871LTdwyv4/CRXS2fIhtO1pxYNKFOw0yrUf6j\n" + - "ECgk\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=usertrustrsacertificationauthority-ev.comodoca.com, OU=COMODO EV SGC SSL, O=Sectigo Limited, - // STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, L=Salford, ST=Manchester, - // OID.2.5.4.17=M5 3EQ, C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=Sectigo RSA Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: b07fd164b5790c9d5d1fddff5819cdb2 - // Valid from: Sun Sep 29 17:00:00 PDT 2019 until: Tue Dec 28 15:59:59 PST 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIH5TCCBs2gAwIBAgIRALB/0WS1eQydXR/d/1gZzbIwDQYJKoZIhvcNAQELBQAw\n" + - "gZExCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO\n" + - "BgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE5MDcGA1UE\n" + - "AxMwU2VjdGlnbyBSU0EgRXh0ZW5kZWQgVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVy\n" + - "IENBMB4XDTE5MDkzMDAwMDAwMFoXDTIxMTIyODIzNTk1OVowggFWMREwDwYDVQQF\n" + - "EwgwNDA1ODY5MDETMBEGCysGAQQBgjc8AgEDEwJHQjEdMBsGA1UEDxMUUHJpdmF0\n" + - "ZSBPcmdhbml6YXRpb24xCzAJBgNVBAYTAkdCMQ8wDQYDVQQREwZNNSAzRVExEzAR\n" + - "BgNVBAgTCk1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7Bi7tmou/Ng47RtXW3DjGdrePGSfOdl7h62k8qprU\n" + - "JeLyloDqhvmT/CG/hdwrfZ3Sv3N2xpetGcnW5S3oEi3m+/M1ls9eD+x1vybqV9Kd\n" + - "lcjuV7SYDlbvAS9w7TcygudhdW0cI8XTCvesGKohBkAlqaQ/MWYpt4WvsxHjbWgn\n" + - "5ZlIYR6A1ZFEjADifViH/5AA79lgGhAskkIWPjvRFalEVKTKtjhRK76eCfZs4Frr\n" + - "CEOpon+BeNKk+x/K/r10dSoWe0SV2uGVxTD83zkP++eREwo1hTgn8bXn7ftlnA3j\n" + - "7ml+Usz6udaD\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 02 02:55:42 PST 2021", System.out); - } -} - -class ComodoUserTrustECC { - - // Owner: CN=Sectigo ECC Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Issuer: CN=USERTrust ECC Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US - // Serial number: 80f5606d3a162b143adc12fbe8c2066f - // Valid from: Thu Nov 01 17:00:00 PDT 2018 until: Tue Dec 31 15:59:59 PST 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDyTCCA0+gAwIBAgIRAID1YG06FisUOtwS++jCBm8wCgYIKoZIzj0EAwMwgYgx\n" + - "CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRQwEgYDVQQHEwtKZXJz\n" + - "ZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMS4wLAYDVQQD\n" + - "EyVVU0VSVHJ1c3QgRUNDIENlcnRpZmljYXRpb24gQXV0aG9yaXR5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mstXNFLONj\n" + - "RFa0JqI/iKUJMFcCMCbLgyzcFW7DihtY5XE0XCLCw+git0NjxiFB6FaOFIlyDdqT\n" + - "j+Th+DJ92JLvICVD/g==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=usertrustecccertificationauthority-ev.comodoca.com, O=Sectigo Limited, - // STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, L=Salford, - // ST=Manchester, OID.2.5.4.17=M5 3EQ, - // C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=Sectigo ECC Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: 9aa5da67480446fd7bf408fd5fdaa1d8 - // Valid from: Mon Mar 01 16:00:00 PST 2021 until: Sat Apr 02 16:59:59 PDT 2022 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFwTCCBWigAwIBAgIRAJql2mdIBEb9e/QI/V/aodgwCgYIKoZIzj0EAwIwgZEx\n" + - "CzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNV\n" + - "BAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE5MDcGA1UEAxMw\n" + - "U2VjdGlnbyBFQ0MgRXh0ZW5kZWQgVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENB\n" + - "MB4XDTIxMDMwMjAwMDAwMFoXDTIyMDQwMjIzNTk1OVowggE6MREwDwYDVQQFEwgw\n" + - "NDA1ODY5MDETMBEGCysGAQQBgjc8AgEDEwJHQjEdMBsGA1UEDxMUUHJpdmF0ZSBP\n" + - "cmdhbml6YXRpb24xCzAJBgNVBAYTAkdCMQ8wDQYDVQQREwZNNSAzRVExEzARBgNV\n" + - "BAgTCk1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxFjAUBgNVB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WZpY2F0aW9u\n" + - "YXV0aG9yaXR5LWV2LmNvbW9kb2NhLmNvbTCCAQMGCisGAQQB1nkCBAIEgfQEgfEA\n" + - "7wB2AEalVet1+pEgMLWiiWn0830RLEF0vv1JuIWr8vxw/m1HAAABd/Kung0AAAQD\n" + - "AEcwRQIhAI16l52NctGAphhc6eh2kK2vO5QYk5nyouL3P6U/gG/dAiBfJRJ+iqE/\n" + - "noco35RpNtlV4GABrwmw1I/1R+L79VzwEAB1AG9Tdqwx8DEZ2JkApFEV/3cVHBHZ\n" + - "AsEAKQaNsgiaN9kTAAABd/KunvwAAAQDAEYwRAIgS+r3C10ua38DPJKvUJvW5bvL\n" + - "SCQ949n3sBJvhV6aXq4CIH/oEGgvJmKtMEjVKUQg8TrZO6LwQ+0sYfL79Qvm8wL3\n" + - "MAoGCCqGSM49BAMCA0cAMEQCID4Q9cc8OQ9tmKnnKZyplPsPipI5apVGkBqFRUSt\n" + - "zzM3AiAw5tw3cv/oabDsYdU+lmp5kZ/S3Z97ANAAaHE0AfXe/Q==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=usertrustecccertificationauthority-ev.comodoca.com, OU=COMODO EV SGC SSL, - // O=Sectigo Limited, STREET="3rd Floor, 26 Office Village", STREET=Exchange Quay, STREET=Trafford Road, - // L=Salford, OID.2.5.4.17=M5 3EQ, - // C=GB, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, SERIALNUMBER=04058690 - // Issuer: CN=Sectigo ECC Extended Validation Secure Server CA, O=Sectigo Limited, L=Salford, - // ST=Greater Manchester, C=GB - // Serial number: 8b72489b7f505a55e2a22659c90ed2ab - // Valid from: Sun Sep 29 17:00:00 PDT 2019 until: Tue Dec 28 15:59:59 PST 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIGRTCCBeugAwIBAgIRAItySJt/UFpV4qImWckO0qswCgYIKoZIzj0EAwIwgZEx\n" + - "CzAJBgNVBAYTAkdCMRswGQ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eerQmQ+ar3D9/TwA9RQckVDu5IrgweREwCgYIKoZIzj0EAwID\n" + - "SAAwRQIhAPwQWGWd3oR7YJ7ngCDQ9TAbdPgND51SiR34WfEgaTQtAiAxD4umKm02\n" + - "59GEMj5NpyF2ZQEq5mEGcjJNojrn+PC4zg==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 02 02:59:25 PST 2021", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/EntrustCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/EntrustCA.java deleted file mode 100644 index 40b01309ccb..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/EntrustCA.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8195774 8243321 - * @summary Interoperability tests with Entrust CAs - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath EntrustCA OCSP - * @run main/othervm -Djava.security.debug=certpath EntrustCA CRL - */ - -/* - * Obtain test artifacts for Entrust CA from: - * - * EC CA: - * Valid: https://validec.entrust.net - * Revoked https://revokedec.entrust.net - * - * G4 CA: - * Valid: https://validg4.entrust.net - * Revoked: https://revokedg4.entrust.net - */ -public class EntrustCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - boolean ocspEnabled = false; - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - ocspEnabled = true; - } - - new Entrust_ECCA().runTest(pathValidator, ocspEnabled); - new Entrust_G4().runTest(pathValidator, ocspEnabled); - } -} - -class Entrust_ECCA { - - // Owner: CN=Entrust Certification Authority - L1J, OU="(c) 2016 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - // Issuer: CN=Entrust Root Certification Authority - EC1, OU="(c) 2012 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIID5zCCA2ygAwIBAgIQCoPUgD5+n1EAAAAAUdTB9zAKBggqhkjOPQQDAzCBvzEL\n" + - "MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1Nl\n" + - "ZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEy\n" + - "IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UE\n" + - "AxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4X\n" + - "DTE2MDQwNTIwMTk1NFoXDTM3MTAwNTIwNDk1NFowgboxCzAJBgNVBAYTAlVTMRYw\n" + - "FAYDVQQ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FICATE-----"; - - // Owner: CN=validec.entrust.net, SERIALNUMBER=D15576572, OID.2.5.4.15=Private Organization, O="Entrust, Inc.", - // OID.1.3.6.1.4.1.311.60.2.1.2=Maryland, OID.1.3.6.1.4.1.311.60.2.1.3=US, L=Kanata, ST=Ontario, C=CA - // Issuer: CN=Entrust Certification Authority - L1J, OU="(c) 2016 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFrTCCBTKgAwIBAgIQYtgW4DLwh74AAAAAVqBXkTAKBggqhkjOPQQDAjCBujEL\n" + - "MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1Nl\n" + - "ZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDE2\n" + - "IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEuMCwGA1UE\n" + - "AxMlRW50cnVzdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEwxSjAeFw0xODA2\n" + - "MjUxMzE1NTdaFw0xOTA2MjUxMzQ1NTBaMIHJMQswCQYDVQQGEwJDQTEQMA4GA1UE\n" + - "CBMHT250YXJpbzEPMA0GA1UEBxMGS2FuYXRhMRMwEQYLKwYBBAGCNzwCAQMTAlVT\n" + - "MRkwFwYLKwYBBAGCNzwCAQITCE1hcnlsYW5kMRYwFAYDVQQKEw1FbnRydXN0LCBJ\n" + - "bmMuMR0wGwYDVQQPExRQcml2YXRlIE9yZ2FuaXphdGlvbjESMBAGA1UEBRMJRDE1\n" + - "NTc2NTcyMRwwGgYDVQQDExN2YWxpZGVjLmVudHJ1c3QubmV0MFkwEwYHKoZIzj0C\n" + - "AQYIKoZIzj0DAQcDQgAEHQe7lUaAUgIwR9EiLJlhkbx+HfSr22M3JvQD6+fnYgqd\n" + - "55e6E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WeBDAEBMB8GA1UdIwQYMBaAFMP5RQO+yPkLPEU18+ty7Ofo65Sb\n" + - "MB0GA1UdDgQWBBT+J7OhS6gskCanmOGnx10DPSF8ATAJBgNVHRMEAjAAMAoGCCqG\n" + - "SM49BAMCA2kAMGYCMQCQLUQABT74TmdHzAtB97uNF5+Zy15wzkmlKeRSOXCIf2C5\n" + - "YKjsgdkR1OdzZXcpjNgCMQDfWcdPhodNXZC4l1lLPOPaTzPPw6uVqqoITQlc6r1t\n" + - "dRkkD6K9ii/X8EtwoFp7s80=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revokedec.entrust.net, SERIALNUMBER=115868500, OID.2.5.4.15=Private Organization, O="Entrust, Inc.", - // OID.1.3.6.1.4.1.311.60.2.1.2=Texas, OID.1.3.6.1.4.1.311.60.2.1.3=US, L=Kanata, ST=Ontario, C=CA - // Issuer: CN=Entrust Certification Authority - L1J, OU="(c) 2016 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIGJzCCBaygAwIBAgIRAM0WDfag1taIAAAAAFagJ5gwCgYIKoZIzj0EAwIwgbox\n" + - "CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9T\n" + - "ZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAx\n" + - "NiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxLjAsBgNV\n" + - "BAMTJUVudHJ1c3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBMMUowHhcNMTcw\n" + - "NTI0MTcwNzA4WhcNMTkwNTI0MTczNjU1WjCByDELMAkGA1UEBhMCQ0ExEDAOBgNV\n" + - "BAgTB09udGFyaW8xDzANBgNVBAcTBkthbmF0YTETMBEGCysGAQQBgjc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OyWqDKWPSUeYCIQCwI5tDyyaJtyFY9/OVqLG+BKPKjscUtTqGJYl4\n" + - "XbOo1jAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF\n" + - "BwMCMGMGCCsGAQUFBwEBBFcwVTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50\n" + - "cnVzdC5uZXQwLgYIKwYBBQUHMAKGImh0dHA6Ly9haWEuZW50cnVzdC5uZXQvbDFq\n" + - "LWVjMS5jZXIwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5l\n" + - "dC9sZXZlbDFqLmNybDBKBgNVHSAEQzBBMDYGCmCGSAGG+mwKAQIwKDAmBggrBgEF\n" + - "BQcCARYaaHR0cDovL3d3dy5lbnRydXN0Lm5ldC9ycGEwBwYFZ4EMAQEwHwYDVR0j\n" + - "BBgwFoAUw/lFA77I+Qs8RTXz63Ls5+jrlJswHQYDVR0OBBYEFIj28ytR8ulo1p2t\n" + - "ZnBQOLK0rlLUMAkGA1UdEwQCMAAwCgYIKoZIzj0EAwIDaQAwZgIxANzqGRI0en5P\n" + - "gSUDcdwoQSNKrBPBfGz2AQVLHAXsxvIlGhKZAQtM49zxA8AdFy/agwIxAMEjJH6A\n" + - "4UbcGZc40eYu6wUbAxiUDD3gwSElNQ8Z6IhNLPCCdMM6KZORyaagAcXn4A==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Wed May 24 10:39:28 PDT 2017", System.out); - } -} - -class Entrust_G4 { - - // Owner: CN=Entrust Certification Authority - L1N, OU="(c) 2014 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - // Issuer: CN=Entrust Root Certification Authority - G4, OU="(c) 2015 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIGMjCCBBqgAwIBAgIRAKvsd/8bQQwHAAAAAFVl2AUwDQYJKoZIhvcNAQELBQAw\n" + - "gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL\n" + - "Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg\n" + - "MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw\n" + - "BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0\n" + - "MB4XDTE3MTEyMjIwMDQyMFoXDTMwMTIyMjIwMzQyMFowgboxCzAJBgNVBAYTAlVT\n" + - "MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1\n" + - "c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNCBFbnRydXN0LCBJ\n" + - "bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxLjAsBgNVBAMTJUVudHJ1c3Qg\n" + - "Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBMMU4wggEiMA0GCSqGSIb3DQEBAQUA\n" + - "A4IBDwAwggEKAoIBAQDcSG+caYQ4xcvf+dt8bgCEHorO0g5j0H1NOtQzRXgUoG8y\n" + - "QuRbJX9swyKqQZbsc18YvTV8OKA/uSNE46Jvq47TFPojWWTVLbNDqpM07e4EFYKs\n" + - "A9NFzAUngijnf3ivnXA6iNPAMXaEhXmhY/YFjk8NoM7Y1PFsA0oj5hamKQ06iO/j\n" + - "gvBSc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mB+qB6y5gaajiTIMscGIcZIKTe2YdKrLoicvEz8k+loM7favik\n" + - "vzFioTNTDHYGx3mkfElBE7ycY8n+jZE3QBBv33k28MeQi7XNgEaMc4tYwoZIdE9A\n" + - "xVccXTzEQzka82dOkRB1dU0XZId9XAWv+CtNc2TjF6Wgx2seA/c6H8S0IfgQBIV2\n" + - "8iN2wZns2QFdawkdy3hMUqPnA++kuGhLW3GemsIY5dP/WxY8rd+OfLb/Ks9T1pCd\n" + - "28t7PQRcQsgkYmouzrOW9ASBvYqLLdhl4y+fFXff8RkPIKMNoYP06WJvRKmky9R/\n" + - "41/nXRas\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=validg4.entrust.net, SERIALNUMBER=1913605, OID.2.5.4.15=Private Organization, - // O=Entrust Datacard Limited, OID.1.3.6.1.4.1.311.60.2.1.2=Ontario, OID.1.3.6.1.4.1.311.60.2.1.3=CA, - // L=Ottawa, ST=Ontario, C=CA - // Issuer: CN=Entrust Certification Authority - L1N, OU="(c) 2014 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - // Serial number: 83790beb78eeb966007ad3dbf11d570 - // Valid from: Fri May 29 13:29:00 PDT 2020 until: Sun Aug 28 13:34:23 PDT 2022 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFpjCCBI6gAwIBAgIQCDeQvreO65ZgB609vxHVcDANBgkqhkiG9w0BAQsFADCB\n" + - "ujELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsT\n" + - "H1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAy\n" + - "MDE0IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEuMCwG\n" + - "A1UEAxMlRW50cnVzdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEwxTjAeFw0y\n" + - "MD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2h0dHA6Ly9haWEuZW50cnVzdC5uZXQvbDFuLWNoYWluMjU2\n" + - "LmNlcjAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmVudHJ1c3QubmV0L2xl\n" + - "dmVsMW4uY3JsMB4GA1UdEQQXMBWCE3ZhbGlkZzQuZW50cnVzdC5uZXQwSwYDVR0g\n" + - "BEQwQjA3BgpghkgBhvpsCgECMCkwJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LmVu\n" + - "dHJ1c3QubmV0L3JwYTAHBgVngQwBATANBgkqhkiG9w0BAQsFAAOCAQEAOExxxxEk\n" + - "iAZZ4RJSWwI/CBQYAlUmd2wb/SBk9eYNAu/UL0XiAbwbOjH2dV6JHwAdwn0eoPR1\n" + - "KK/E1/OVoVibVBdxLMISPqdodRgHps6kGCOJxS8Zz8d3AEvx27EQ/Hg/EwIJZsUK\n" + - "dyb48V6a3XzExqLiwGu9oI9Ozm3/mo11ixmhvSFXH+FZf93qvvCSO+XTGGrLv5ja\n" + - "Tkazn/HgnwUBHd1TiO0jLhAdc+rZyd/SDjXMAXsa99zVfc2MY0Mb8+MohNHOwqYg\n" + - "tuYuirvtt9P0oteauL+iEBCRcqsmJaHGeaEyJH2QMxC5W22KpW245eHisW7rMoGQ\n" + - "9nbGmfe97p7bHQ==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revokedg4.entrust.net, SERIALNUMBER=1913605, OID.2.5.4.15=Private Organization, - // O=Entrust Datacard Limited, OID.1.3.6.1.4.1.311.60.2.1.2=Ontario, OID.1.3.6.1.4.1.311.60.2.1.3=CA, - // L=Ottawa, ST=Ontario, C=CA - // Issuer: CN=Entrust Certification Authority - L1N, OU="(c) 2014 Entrust, Inc. - for authorized use only", - // OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US - // Serial number: 24c5f46412b9dcc242a93017176979d6 - // Valid from: Fri May 29 13:36:00 PDT 2020 until: Sun Aug 28 13:40:43 PDT 2022 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIFqjCCBJKgAwIBAgIQJMX0ZBK53MJCqTAXF2l51jANBgkqhkiG9w0BAQsFADCB\n" + - "ujELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsT\n" + - "H1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAy\n" + - "MDE0IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEuMCwG\n" + - "A1UEAxMlRW50cnVzdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEwxTjAeFw0y\n" + - "MDA1MjkyMDM2MDBaFw0yMjA4MjgyMDQwNDNaMIHTMQswCQYDVQQGEwJDQTEQMA4G\n" + - "A1UECBMHT250YXJpbzEPMA0GA1UEBxMGT3R0YXdhMRMwEQYLKwYBBAGCNzwCAQMT\n" + - "AkNBMRgwFgYLKwYBBAGCNzwCAQITB09udGFyaW8xITAfBgNVBAoTGEVudHJ1c3Qg\n" + - "RGF0YWNhcmQgTGltaXRlZDEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + - "EDAOBgNVBAUTBzE5MTM2MDUxHjAcBgNVBAMTFXJldm9rZWRnNC5lbnRydXN0Lm5l\n" + - "dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN6Bvaj7EG752e15UQH9\n" + - "4o8+660Gi3caUAAu45vZebO7EfRgrz0zyalpiexmQzocGn6Zog2yVqmMZjrMY11a\n" + - "q96s0pzVKImnA/787G7J5lRncP+PM6/WGtUUGS2hHiifoW5Ya/kcI1uk6EDT0leb\n" + - "HIedOiwcfDkq38g5ckuWNae24DAD8AM9XBJXMuNbuiqo03wMlDL3Jif8wNQfpmPD\n" + - "b+KR6IwGJdYwLBMoMcPmZF0rykW3YTO2NTDGCwvT8zzvjIKp8caRkI6pfkKmc89U\n" + - "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D5A=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Fri May 29 13:42:13 PDT 2020", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java deleted file mode 100644 index 244ef26c2ca..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @bug 8216577 8249176 - * @summary Interoperability tests with GlobalSign R6 CA - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath GlobalSignR6CA OCSP - * @run main/othervm -Djava.security.debug=certpath GlobalSignR6CA CRL - */ - - /* - * - * Obtain TLS test artifacts for GlobalSign R6 CA from: - * - * Valid TLS Certificates: - * https://valid.r6.roots.globalsign.com/ - * - * Revoked TLS Certificates: - * https://revoked.r6.roots.globalsign.com/ - */ -public class GlobalSignR6CA { - - // Owner: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE - // Issuer: CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA - R6 - // Serial number: 7803182afbecd89eb19309bb4a25bdaa - // Valid from: Mon Jul 27 17:00:00 PDT 2020 until: Sat Jul 27 17:00:00 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIGwDCCBKigAwIBAgIQeAMYKvvs2J6xkwm7SiW9qjANBgkqhkiG9w0BAQwFADBM\n" + - "MSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xv\n" + - "YmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjAeFw0yMDA3MjgwMDAwMDBaFw0z\n" + - "MDA3MjgwMDAwMDBaMFUxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWdu\n" + - "IG52LXNhMSswKQYDVQQDEyJHbG9iYWxTaWduIEF0bGFzIFI2IEVWIFRMUyBDQSAy\n" + - "MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtQ8IiN2Ukq/Clynv\n" + - "HhqugFQg5SXIyVO4ZRnxo0hNnaek78LRn4Bkaqcwv6Ls0Ftn4bK2zvBaS1zsfUTA\n" + - "vfup/s86zHCRvOqAL8zO/WiMV1G5ikHSlD6RtpIOHRX4y0oIGW59ADY0ANwDeDWL\n" + - "x/RgSltuQIqeGXwZnyZFwWtxVkSE4p5tn2Lb6USzwcD22taiXmeYsPMWfJfmWPRj\n" + - "ZuYBgxn6tvUVRO+ZzAUKEEaJK/LVLieAVEmfR6anEJ/gWczxz12Lwu6qF5ov0OQt\n" + - "AP0rfruyje/EJt6xHjpJ2OgDzCWYstXOpRPDHYS3klpaRbowAlpJdYMRAqY5CNiP\n" + - "RAx3wvsWCVI5Uk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k8qdw3UueHSDjqWUjHYoo8TV3DLqUXmIy1Ks3MkESsFKeLpEbk\n" + - "VMZga0lbDnqqRc5a2yzrXmwVYDeWVeD20s5vPoKCnFzmcR+2v9TKD4bI6XWVl84q\n" + - "GzfFRVdY9f8KN+7891+47ZhptvxtNqJKVI2O+EAP/PvTpwes983LkFzsev4/+Qxs\n" + - "EszD7/pE+Byj3t9CMat2XoX0jfJjbEXgewFb/gCwHvqNKLNWrYfE9qN8b6qm4xQk\n" + - "qGQKTrFKsBJx4TU+h10qXDhpmOBswiJqoG16XCV32oSn0JUYvXVAvP6YjueOv/jr\n" + - "0ZMTWGh8wCz6v3XBaXR0rxDAz9GImpU+xPx2XjuHac7OnYbN+i8p7cJPUxABjHiA\n" + - "LWXIZtCn5ziCfvYC6+SCp8x9TPJzAIfJ4NKv/8SpvvzuchVkAQqlQaGFBEdkX84R\n" + - "I/WYYG+2BliFIpbQnfljYWCURbfsYz7+Zxb94+4yzva49p8T6lALoK3s2kqIVLKN\n" + - "s6qAnk/qX6JihkaR3W+iViHMC5tqQX/pd8QIXccF3PA2OdeNGU4iUNZqUbYB4VZd\n" + - "AaOaeaUl0LwAta6DB5w344eUIqDgaitSwQZBnxppmwL3tGzP1ero2e2RvBmphbxI\n" + - "atIdxA==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid.r6.roots.globalsign.com, - // O=GMO GlobalSign LTD, STREET="Springfield House, Sandling Road", OID.2.5.4.17=ME14 2LP, L=Maidstone, ST=Kent, - // C=GB, SERIALNUMBER=04705639, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB - // Issuer: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE - // Serial number: 1aff2829dd8bf07aa65a7b3c920ca4b - // Valid from: Thu Aug 27 00:20:06 PDT 2020 until: Tue Sep 28 00:20:06 PDT 2021 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHyjCCBbKgAwIBAgI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CMRT58svhcswDQYJKoZIhvcNAQELBQADggIBAByb\n" + - "hoL/sArmkNjTFiEEBocMfb+brgRQdb08NKC1BDxGnfIFjUmOFzI2SVgtBmcoF8FI\n" + - "0WyXQv6ZxVE01DFZpeZpsJJYfBAjg9NR4/B7UjajvOJwQNpaciAGQ0ZzTu+SmHja\n" + - "jIiC2KqiA7Me2MoUne6hhxZ3dXEneIml8hnbTf2mjSBCVpQqyf2goslhGduPitI6\n" + - "guTtVD2PVaNCVkjlRn4Euspl2JjQWzGcEruqGyQN+Bu4yt1hsD4Jj6V9Hmzo8Vrd\n" + - "5LUxFPRGIgCUDiiwnENVsQB/D24y3IapPkojujrvsVsmQN42GIgOY5tLK/8cCziD\n" + - "vf0GzZnmL1D2ezi3TaBj+XBWFcAyF2Y9AnVRmC9CrVcp6EX0KhD4g9ZgbpJZpVlk\n" + - "G3xfOiZWTeqLnQhCMXcdcutWIwXAX5gueyF1t545vECCE4PeGZNAeWqdbrj7xaS8\n" + - "3rKQdgwF9r6p7F5HHwEVCckhovEYU4DNFzYb9n/YmC3hmskFB1keTYqydKUYEGZ5\n" + - "fvLvsjRj9xwOCqIs5j1vuKw2CaqmHxrfYaDMMSZPq/iYrOWrf72wZIvtnAHePt3X\n" + - "atQMqNbDMQrjul31ljDP9CIbbtuZSkSACyMxiC10l4uTTLQiTxtZPkwIazOjnbBe\n" + - "A4fruOEQ2k1gu5oFgqmo+xuclOKNjwd/RkK4FXnD\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.r6.roots.globalsign.com, - // O=GMO GlobalSign LTD, STREET="Springfield House, Sandling Road", OID.2.5.4.17=ME14 2LP, L=Maidstone, ST=Kent, - // C=GB, SERIALNUMBER=04705639, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB - // Issuer: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE - // Serial number: 1df30d84796ac20c47da63b8e681e8f - // Valid from: Thu Aug 27 00:37:53 PDT 2020 until: Tue Sep 28 00:37:53 PDT 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHzzCCBbegAwIBAgIQAd8w2EeWrCDEfaY7jmgejzANBgkqhkiG9w0BAQsFADBV\n" + - "MQswCQYDVQQGEwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTErMCkGA1UE\n" + - "AxMiR2xvYmFsU2lnbiBBdGxhcyBSNiBFViBUTFMgQ0EgMjAyMDAeFw0yMDA4Mjcw\n" + - "NzM3NTNaFw0yMTA5MjgwNzM3NTNaMIH8MRMwEQYLKwYBBAGCNzwCAQMTAkdCMR0w\n" + - "GwYDVQQPDBRQcml2YXRlIE9yZ2FuaXphdGlvbjERMA8GA1UEBRMIMDQ3MDU2Mzkx\n" + - "CzAJBgNVBAYTAkdCMQ0wCwYDVQQIDARLZW50MRIwEAYDVQQHDAlNYWlkc3RvbmUx\n" + - "ETAPBgNVBBEMCE1FMTQgMkxQMSkwJwYDVQQJDCBTcHJpbmdmaWVsZCBIb3VzZSwg\n" + - "U2FuZGxpbmcgUm9hZDEbMBkGA1UECgwSR01PIEdsb2JhbFNpZ24gTFREMSgwJgYD\n" + - "VQQDDB9yZXZva2VkLnI2LnJvb3RzLmdsb2JhbHNpZ24uY29tMIIBIjANBgkqhkiG\n" + - "9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvaNcp7bzmm02Z0S92ZzJ/ul3uQWz3EnBORcI\n" + - "RuEzm0HY4t0n9DGnxpxOi/aWGX/Vj7qZC4m3G7uCE7dMy6CfXTwh4UZ+nPVijImo\n" + - "q/msJzmju/pk8HVeOEhk88yvwfzmzYLjoQagmHnDUSQULEmNWihejIh4B61qx4SI\n" + - "UoBPoBgqDfZW27HkJeqNAO6rljZTZwLenJesm2QMjebYaKxQBi3fLy0Lua2sxTik\n" + - "fbT3swEPN9xxvMomtNNM2tJwdExL2RpO8dObUe37ep6roG7gWh8NYDKMo6j9Rn9e\n" + - "f0S9j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AAQDAEcwRQIhALl0LXt6pFqS0cHF/XkxSfDJJdhppR2eSlcMFpZY0q1PAiBJ\n" + - "YkKHqq/YD0gwtZAUEPSk54G1cLxFoUiounjya1XTRzANBgkqhkiG9w0BAQsFAAOC\n" + - "AgEAdeQotBhB7bn+CztQmF13rdBphHrGkkyHC3hL1bxkmHJcrLQ5ochqPvgdgAVq\n" + - "DXcV8zSyNwVxW6REi+uYzcsOPKo/llmgF7Psqn1t/EDcutWlykh8UwE5UaLJ2EWD\n" + - "HnIu06n47lWtAwlNMXJ/ce0oVjqsgY52Y1u54e8wFXt6lsSw02tzIC6eo1BFKxQ3\n" + - "lDKYVXgg0OvMG/C2rvH/EIq5r+st49rNGWfcWRoHsDUruChZOHwJ9PrXKBLB/QVd\n" + - "4uw2V/0ipOETDudly7yLodXP8quhet4bCEO9gweXppL/MikLrE5xt46HW1/6w+jF\n" + - "wKCHWlq4ViswlaQ8q0oY/97o2udnuDQaNdrLgW3VofMeBIMNPBgkLDicOH6bLwNf\n" + - "lV68qi1ZBxBuOdoOqQyZ9RU9d3EL50XEJ4MtUvjJRAT5EWdFaB8SGGZbD5fyza8c\n" + - "KmeO5tkZWYecLd8CKqwKcW7umPflEwOzw60Cxg6eyBYA8Jfagpbdb/kXsF6Ov8IW\n" + - "vxNdHCnXnR3oBWm2uHddESO2zGF1ZfOb0O3cHHG5nCgVkWW68VpgX/LaN90u6Dzw\n" + - "diJX7esZV5ZaniqD+flWldgAdcfeXlJ5b7I7GnFr61ycmZT/qupagUS1WDq/zfct\n" + - "QcB4QmnAzGe6kcqiDOSyIYWpiw09jha63KpJtJDWRemrlQI=\n" + - "-----END CERTIFICATE-----"; - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Thu Aug 27 00:38:11 PDT 2020", System.out); - } -} - diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoDaddyCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoDaddyCA.java deleted file mode 100644 index e8971b987ca..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoDaddyCA.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -/* - * @test - * @bug 8196141 - * @summary Interoperability tests with GoDaddy/Starfield CA - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath GoDaddyCA OCSP - * @run main/othervm -Djava.security.debug=certpath GoDaddyCA CRL - */ - -/* - * Obtain test artifacts for GoDaddy/Starfield CAs from: - * - * Go Daddy Root Certificate Authority - G2: - * valid: https://valid.gdig2.catest.godaddy.com/ - * expired: https://expired.gdig2.catest.godaddy.com/ - * revoked: https://revoked.gdig2.catest.godaddy.com/ - * - * Starfield Root Certificate Authority - G2: - * valid: https://valid.sfig2.catest.starfieldtech.com/ - * expired: https://expired.sfig2.catest.starfieldtech.com/ - * revoked: https://revoked.sfig2.catest.starfieldtech.com/ - */ -public class GoDaddyCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - // CRL check - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new GoDaddyGdig2().runTest(pathValidator); - new GoDaddySfig2().runTest(pathValidator); - } -} - -class GoDaddyGdig2 { - - // Owner: CN=Go Daddy Secure Certificate Authority - G2, - // OU=http://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", - // L=Scottsdale, ST=Arizona, C=US - // Issuer: CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", - // L=Scottsdale, ST=Arizona, C=US - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIE0DCCA7igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx\n" - + "EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT\n" - + "EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp\n" - + "ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTExMDUwMzA3MDAwMFoXDTMxMDUwMzA3\n" - + "MDAwMFowgbQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH\n" - + "EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjEtMCsGA1UE\n" - + "CxMkaHR0cDovL2NlcnRzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkvMTMwMQYDVQQD\n" - + "EypHbyBEYWRkeSBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwggEi\n" - + "MA0GCSqGSIb3DQEBAQU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w9RKpv0vHP8ds42pM3Z2Czqrpv1KrKQ0U11\n" - + "GIo/ikGQI31bS/6kA1ibRrLDYGCD+H1QQc7CoZDDu+8CL9IVVO5EFdkKrqeKM+2x\n" - + "LXY2JtwE65/3YR8V3Idv7kaWKK2hJn0KCacuBKONvPi8BDAB\n" - + "-----END CERTIFICATE-----"; - - // 1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/businessCategory=Private - // Organization/serialNumber=5510922, C=US, ST=Arizona, L=Scottsdale, O=GoDaddy INC., CN=valid.gdig2.catest.godaddy.com - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHbzCCBlegAwIBAgIIC3Go9uPeseowDQYJKoZIhvcNAQELBQAwgbQxCzAJBgNV\n" + - "BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRow\n" + - "GAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjEtMCsGA1UECxMkaHR0cDovL2NlcnRz\n" + - "LmdvZGFkZHkuY29tL3JlcG9zaXRvcnkvMTMwMQYDVQQDEypHbyBEYWRkeSBTZWN1\n" + - "cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwHhcNMTcwOTE1MjMyMzAyWhcN\n" + - "MTkwOTE1MjMyMzAyWjCB1TETMBEGCysGAQQBgjc8AgEDEwJVUzEZMBcGCysGAQQB\n" + - "gjc8AgECEwhEZWxhd2FyZTEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + - "EDAOBgNVBAUTBzU1MTA5MjIxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25h\n" + - "MRMwEQYDVQQHEwpTY290dHNkYWxlMRUwEwYDVQQKEwxHb0RhZGR5IElOQy4xJzAl\n" + - "BgNVBAMTHnZhbGlkLmdkaWcyLmNhdGVzdC5nb2RhZGR5LmNvbTCCASIwDQYJKoZI\n" + - "hvcNAQEBB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1.3.6.1.4.1.311.60.2.1.2=Delaware/businessCategory=Private - // Organization/serialNumber=5510922, C=US, ST=Arizona, L=Scottsdale, O=GoDaddy INC., CN=revoked.gdig2.catest.godaddy.com - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHdDCCBlygAwIBAgIIEBJV3vmogM8wDQYJKoZIhvcNAQELBQAwgbQxCzAJBgNV\n" + - "BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRow\n" + - "GAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjEtMCsGA1UECxMkaHR0cDovL2NlcnRz\n" + - "LmdvZGFkZHkuY29tL3JlcG9zaXRvcnkvMTMwMQYDVQQDEypHbyBEYWRkeSBTZWN1\n" + - "cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwHhcNMTcwOTE1MjMyMzAzWhcN\n" + - "MTkwOTE1MjMyMzAzWjCB1zETMBEGCysGAQQBgjc8AgEDEwJVUzEZMBcGCysGAQQB\n" + - "gjc8AgECEwhEZWxhd2FyZTEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + - "EDAOBgNVBAUTBzU1MTA5MjIxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25h\n" + - "MRMwEQYDVQQHEwpTY290dHNkYWxlMRUwEwYDVQQKEwxHb0RhZGR5IElOQy4xKTAn\n" + - "BgNVBAMTIHJldm9rZWQuZ2RpZzIuY2F0ZXN0LmdvZGFkZHkuY29tMIIBIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCuBsAR2XGf05mYOuag+0aS4lBuLO5/f\n" + - "kEO7KNo7BcdY7J78yXYRYW0jGnV29bjrQZJfu5yv5bU+OjTIDVbCWZAwtBXEKrJj\n" + - "riIOUXi3hXphtlyMMAaiXQoA84jwS634DsD0w6XUUP2Lem8jC3RudjvmkDQHoY3M\n" + - "uhhS7jLx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UKnhN38/z8dU4QUCIFrzGJyajoVPQ2fzOTb9ygzA7T3wqsnT3ML5/KJ6\n" + - "+6+CAHYA7ku9t3XOYLrhQmkfq+GeZqMPfl+wctiDAMR7iXqo/csAAAFeh9uXHQAA\n" + - "BAMARzBFAiEA5DENZZT7SBxNRvo9yFHNNeWqH2d4uqGUwc1rKILrMGsCIHZ3N4dZ\n" + - "zv/J+7fbLP1nrAmdUT92ow1bhtMPuq2PfXsAAHcApLkJkLQYWBSHuxOizGdwCjw1\n" + - "mAT5G9+443fNDsgN3BAAAAFeh9uYjAAABAMASDBGAiEAyY8ylnGHiH5L3yXE7BsH\n" + - "v75ja2RtuuYbMADAlDK/ZDoCIQDwuCq3x+egpB/GISxTnwkrDwhNhhIJNyk5F4j1\n" + - "/J8A0DANBgkqhkiG9w0BAQsFAAOCAQEAMGot6gBZ77HIDMb1n/HPrKdSHN0ngq7Z\n" + - "rhrkgbp+mH1Cs1lZA3qldMDxKXgNiodFqU/e4VewasQ9tJMmDXrTZIHualJGmIvq\n" + - "ISvV0ZUfSW/sJmo0ZDw8iBM993LDkA4wSc6SunhjOwu3LBfl9aKkeq6IhUEAG8X7\n" + - "54oO4iApt+APLMyeV9lZ/T7MGVbAjwdm+T1RMa/Ca99BahaRWN7hiM+zS3Ly+l6G\n" + - "7kqAkBFuJWbbZImADZ2RPldY6hBzTk6MT2hLCV40UD8JqwJo+qq7nGfJdTaFyZI6\n" + - "nJvrVATO7jL64YFP3xlVi8EQaCeKdZdn+BCCNA/ja0mWMj8EU9Islg==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, null, System.out); - } -} - -class GoDaddySfig2 { - - // Owner: CN=Starfield Secure Certificate Authority - G2, - // OU=http://certs.starfieldtech.com/repository/, O="Starfield Technologies, Inc.", - // L=Scottsdale, ST=Arizona, C=US - // Issuer: CN=Starfield Root Certificate Authority - G2, - // O="Starfield Technologies, Inc.", L=Scottsdale, ST=Arizona, C=US - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIFADCCA+igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n" - + "EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n" - + "HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs\n" - + "ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTExMDUwMzA3MDAw\n" - + "MFoXDTMxMDUwMzA3MDAwMFowgcYxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6\n" - + "b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj\n" - + "aG5vbG9naWVzLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydHMuc3RhcmZpZWxk\n" - + "dGVjaC5jb20vcmVwb3NpdG9yeS8xNDAyBgNVBAMTK1N0YXJmaWVsZCBTZWN1cmUg\n" - + "Q2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" - + "DwAwggEKAoIBAQDlkGZL7PlGcakgg77pbL9KyUhpgXVObST2yxcT+LBxWYR6ayuF\n" - + "pDS1FuXLzOlBcCykLtb6Mn3hqN6UEKwxwcDYav9ZJ6t21vwLdGu4p64/xFT0tDFE\n" - + "3ZNWjKRMXpuJyySDm+JXfbfYEh/JhW300YDxUJuHrtQLEAX7J7oobRfpDtZNuTlV\n" - + "Bv8KJAV+L8YdcmzUiymMV33a2etmGtNPp99/UsQwxaXJDgLFU793OGgGJMNmyDd+\n" - + "MB5FcSM1/5DYKp2N57CSTTx/KgqT3M0WRmX3YISLdkuRJ3MUkuDq7o8W6o0OPnYX\n" - + "v32JgIBEQ+ct4EMJddo26K3biTr1XRKOIwSDAgMBAAGjggEsMIIBKDAPBgNVHRMB\n" - + "Af8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUJUWBaFAmOD07LSy+\n" - + "zWrZtj2zZmMwHwYDVR0jBBgwFoAUfAwyH6fZMH/EfWijYqihzqsHWycwOgYIKwYB\n" - + "BQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5zdGFyZmllbGR0ZWNo\n" - + "LmNvbS8wOwYDVR0fBDQwMjAwoC6gLIYqaHR0cDovL2NybC5zdGFyZmllbGR0ZWNo\n" - + "LmNvbS9zZnJvb3QtZzIuY3JsMEwGA1UdIARFMEMwQQYEVR0gADA5MDcGCCsGAQUF\n" - + "BwIBFitodHRwczovL2NlcnRzLnN0YXJmaWVsZHRlY2guY29tL3JlcG9zaXRvcnkv\n" - + "MA0GCSqGSIb3DQEBCwUAA4IBAQBWZcr+8z8KqJOLGMfeQ2kTNCC+Tl94qGuc22pN\n" - + "QdvBE+zcMQAiXvcAngzgNGU0+bE6TkjIEoGIXFs+CFN69xpk37hQYcxTUUApS8L0\n" - + "rjpf5MqtJsxOYUPl/VemN3DOQyuwlMOS6eFfqhBJt2nk4NAfZKQrzR9voPiEJBjO\n" - + "eT2pkb9UGBOJmVQRDVXFJgt5T1ocbvlj2xSApAer+rKluYjdkf5lO6Sjeb6JTeHQ\n" - + "sPTIFwwKlhR8Cbds4cLYVdQYoKpBaXAko7nv6VrcPuuUSvC33l8Odvr7+2kDRUBQ\n" - + "7nIMpBKGgc0T0U7EPMpODdIm8QC3tKai4W56gf0wrHofx1l7\n" - + "-----END CERTIFICATE-----"; - - // 1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Arizona/businessCategory=Private - // Organization/serialNumber=R17247416, C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, LLC, - // CN=valid.sfig2.catest.starfieldtech.com - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHuzCCBqOgAwIBAgIIaZoUcUIjkGwwDQYJKoZIhvcNAQELBQAwgcYxCzAJBgNV\n" + - "BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUw\n" + - "IwYDVQQKExxTdGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTMwMQYDVQQLEypo\n" + - "dHRwOi8vY2VydHMuc3RhcmZpZWxkdGVjaC5jb20vcmVwb3NpdG9yeS8xNDAyBgNV\n" + - "BAMTK1N0YXJmaWVsZCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIw\n" + - "HhcNMTcwOTE3MDM0ODAxWhcNMTkwOTE3MDM0ODAxWjCB6zETMBEGCysGAQQBgjc8\n" + - "AgEDEwJVUzEYMBYGCysGAQQBgjc8AgECEwdBcml6b25hMR0wGwYDVQQPExRQcml2\n" + - "YXRlIE9yZ2FuaXphdGlvbjESMBAGA1UEBRMJUjE3MjQ3NDE2MQswCQYDVQQGEwJV\n" + - "UzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEkMCIGA1UE\n" + - "ChMbU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgTExDMS0wKwYDVQQDEyR2YWxpZC5z\n" + - "ZmlnMi5jYXRlc3Quc3RhcmZpZWxkdGVjaC5jb20wggEiMA0GCSqGSIb3DQEBAQUA\n" + - "A4IBDwAwggEKAoIBAQDVxhI45IQtNrJuun7HU8v2CKg/h/euysft2VrRsaGSMAln\n" + - "V6TtpWj2UGm7OmzE2NNzOhD9JJQSc1W6aHEsCTVJ148sgldFFmP39cboBFoLCFlJ\n" + - "DxsVGeyKu+KlDKq7Vp2+ty3TeFNOBXEVtEc8SsC8mVjsk2VWW7X/fCVFYEzzyPUI\n" + - "sJP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GAiEA/s7a5OGhtaCutT1l4KNE7dUbM3WGUExG/ZJ+Y6IH3nUCIQCvpVJf\n" + - "Y0XBInIUv391hNzSEhv6nvIBEjZtKdvGcP8/5QB2AO5Lvbd1zmC64UJpH6vhnmaj\n" + - "D35fsHLYgwDEe4l6qP3LAAABXo30fxEAAAQDAEcwRQIhANqG9yfi3ax0pTnwr4Ti\n" + - "wVfUrZclJDS06ePkTHppLkLTAiBTRKkVf1df4Irvmd7neT1wdS2fhDxmnVIYAN5J\n" + - "6tOGDQB1AKS5CZC0GFgUh7sTosxncAo8NZgE+RvfuON3zQ7IDdwQAAABXo30gFsA\n" + - "AAQDAEYwRAIgb8Xc54M+QD4wfSWLj5Ae/wrSEgRp7Kbf4Lf4vT4W0usCIGAShkJI\n" + - "CRxoudQDRxooNJhfXgsTB8QhwFC9PUPo3ZV+MA0GCSqGSIb3DQEBCwUAA4IBAQBt\n" + - "TqvwxqrkPYm/ssbN9cpVWlrQPw3DblsAEV6gnrrTJMd7HB042H3HLUiitddRjO40\n" + - "0EJM/tUOSGcWfqnJHWFDKoWzdrF5lHAzSRkMjdXgY9TTN5K5tUMEpfRjtink/zoY\n" + - "pNyc5ua4SXn94KfMZcOYGRvUM+0q6vLRBBMH541E3M6q6JbEBqZJFY8gBWwYqHH0\n" + - "xNGahm5++v4trFFCJzSfvfV1v+rnqy8tRivi7ZFLXWCcSyAqMH+T9Q36lKeFtaw4\n" + - "Sapf+dh2yrd2IBLW5eaAD13nCAjO/W0GuC7zw4+4mhW5+DTVJXrCkK5XddkVLhML\n" + - "k5pMoIv5EsFIm0Cs+DfF\n" + - "-----END CERTIFICATE-----"; - - // 1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Arizona/businessCategory=Private - // Organization/serialNumber=R17247416, C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, LLC, - // CN=revoked.sfig2.catest.starfieldtech.com - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MII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uOLN0LTAzNTQ7pfb7oFYbr0R4LWe2ZvBIAHYA7ku9t3XOYLrhQmkf\n" + - "q+GeZqMPfl+wctiDAMR7iXqo/csAAAFemkLVbwAABAMARzBFAiEAmWkzcotxZSwb\n" + - "xPS3MG13TVXGu2+MiXXjOIf42DR8zJQCIBL4cSOJh+LX5kpPub6KOiEOn7TVE1Zv\n" + - "IQUxuf+vyAD4AHYApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFe\n" + - "mkLXRQAABAMARzBFAiBX8foh/KrYr34O2c9cH6uyWW2XjBHNLsYX1mr+8VuNaAIh\n" + - "AObDQwpDYh/bNp6k547gDxnR73LeU3kvl1Y76GjgxLAhMA0GCSqGSIb3DQEBCwUA\n" + - "A4IBAQDJ5vlagzOH8/ORUMgT33muSDFXCe5el/sQzVg8dridw9qjnxOpkGibdCiT\n" + - "b9Il1bdi7UnG8MlA3XpDjGgp6J/mUTijD9WcFx4lp5JnPaIbShHWCyIlRVZJzrZc\n" + - "UYhR56xXOKDYKYOIvM6qTqegXyEynJrIVTArMk7jQf0oNQLLHzXE1fVS1zut0H5l\n" + - "GE+TBgjasMEa1o1e/H/heSytb2zFNsZr8oxojzGBmlKyfCoIIcCv3PxX2ur57zJE\n" + - "9ADWoYK/7gYVba0JmLV4nQltDPp06nOYT9imxBWTrFahgPx1jOQDLgIpitkjyCy4\n" + - "xpmxUk8L6yc3O3aSD9OU/fzk/t/d\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, null, System.out); - } -} - diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoogleCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoogleCA.java deleted file mode 100644 index 95ac059de03..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GoogleCA.java +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8307134 - * @summary Interoperability tests with Google's GlobalSign R4 and GTS Root certificates - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath GoogleCA OCSP - * @run main/othervm -Djava.security.debug=certpath GoogleCA CRL - */ - -/* - * Obtain TLS test artifacts for Google CAs from: - * - * https://pki.goog/repository/ - */ -public class GoogleCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - boolean ocspEnabled = false; - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - ocspEnabled = true; - } - - new GoogleGSR4().runTest(pathValidator); - new GoogleGTSR1().runTest(pathValidator); - new GoogleGTSR2().runTest(pathValidator); - new GoogleGTSR3().runTest(pathValidator); - new GoogleGTSR4().runTest(pathValidator); - } -} - -class GoogleGSR4 { - - // Owner: CN=GTS CA 2D4, O=Google Trust Services LLC, C=US - // Issuer: CN=GlobalSign, O=GlobalSign, OU=GlobalSign ECC Root CA - R4 - // Serial number: 21668f1cd0a2a8f847d8aad34 - // Valid from: Tue Oct 04 17:00:42 PDT 2022 until: Wed Sep 29 17:00:42 PDT 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDBDCCAqugAwIBAgINAhZo8c0KKo+EfYqtNDAKBggqhkjOPQQDAjBQMSQwIgYD\n" + - "VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh\n" + - "bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMjIxMDA1MDAwMDQyWhcNMjcw\n" + - "OTMwMDAwMDQyWjBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0\n" + - "IFNlcnZpY2VzIExMQzETMBEGA1UEAxMKR1RTIENBIDJENDBZMBMGByqGSM49AgEG\n" + - "CCqGSM49AwEHA0IABPQdCdV61990MPueGTVpXAjRmp2JIxt0Yuy59RZYT/XKg1lN\n" + - "gpRc0eh/bHtpehigtqe+llKTiVEkMhSMURoQQsOjggFyMIIBbjAOBgNVHQ8BAf8E\n" + - "BAMCAYYwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQI\n" + - "MAYBAf8CAQAwHQYDVR0OBBYEFKiI2Yo5rGXVgks3qJVsZUPNRAHgMB8GA1UdIwQY\n" + - "MBaAFFSwe61FuOJAf/sKbvu+M8k8o4TVMGYGCCsGAQUFBwEBBFowWDAlBggrBgEF\n" + - "BQcwAYYZaHR0cDovL29jc3AucGtpLmdvb2cvZ3NyNDAvBggrBgEFBQcwAoYjaHR0\n" + - "cDovL3BraS5nb29nL3JlcG8vY2VydHMvZ3NyNC5kZXIwMgYDVR0fBCswKTAnoCWg\n" + - "I4YhaHR0cDovL2NybC5wa2kuZ29vZy9nc3I0L2dzcjQuY3JsME0GA1UdIARGMEQw\n" + - "CAYGZ4EMAQIBMDgGCisGAQQB1nkCBQMwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly9w\n" + - "a2kuZ29vZy9yZXBvc2l0b3J5LzAKBggqhkjOPQQDAgNHADBEAiBi+ikli1YBHQGs\n" + - "b5mnyBo5mydw04o386BPgaPpiBzgagIgbcpwQJCalLIekv8XRMoWFr3nV5XJfWRU\n" + - "5QPpOX0rXbg=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=good.gsr4.demo.pki.goog - // Issuer: CN=GTS CA 2D4, O=Google Trust Services LLC, C=US - // Serial number: 4c435754ee6e013c10efaff908a58cbb - // Valid from: Mon Mar 27 12:41:45 PDT 2023 until: Sun Jun 25 12:41:44 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIEsTCCBFegAwIBAgIQTENXVO5uATwQ76/5CKWMuzAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBIDJENDAeFw0yMzAzMjcxOTQxNDVaFw0yMzA2MjUxOTQx\n" + - "NDRaMCIxIDAeBgNVBAMTF2dvb2QuZ3NyNC5kZW1vLnBraS5nb29nMIIBIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAymtcnnxJ8pSF4YJUKTWKcHbRw28ShLzo\n" + - "KVTRPUsRrZZDqyDx296k3e0D04kBhcvEduxtEabCe89m06SH7L+bGVi25j35AXwn\n" + - "6aziLs/EV4BRy9ACfYipeT5PnQbaMmVe65q/RYKmWqD/z0SEh2uMFxRVl1CBmS/J\n" + - "owbNUlrEEDiYkE/nGfCmacpW0QZ7kxGjSR34mCSDugIYE/HME3ZVcZOVf2LT0lBA\n" + - "DhQtZI6cXy2lO8Ro/dUtcZKjo8iu0xW1pQeiJq9+CGp62MJFmpl+EfzP/B8aXQiF\n" + - "+m44LJJgAjiShAwVo9HbJUYv0dqCS9G22FL43xXqAdD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PIfqN6qWi\n" + - "lzblUM0=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.gsr4.demo.pki.goog - // Issuer: CN=GTS CA 2D4, O=Google Trust Services LLC, C=US - // Serial number: 1f9bd55e26716b3710b2614cec6fff02 - // Valid from: Mon Mar 27 12:48:37 PDT 2023 until: Sun Jun 25 12:48:36 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIEtzCCBFygAwIBAgIQH5vVXiZxazcQsmFM7G//AjAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBIDJENDAeFw0yMzAzMjcxOTQ4MzdaFw0yMzA2MjUxOTQ4\n" + - "MzZaMCUxIzAhBgNVBAMTGnJldm9rZWQuZ3NyNC5kZW1vLnBraS5nb29nMIIBIjAN\n" + - "BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApVuoZ/bS9c2WSQ8W1FjPEsdGoANj\n" + - "PqKaPwdyUhnko9ayyGGi5hHLYqir2tiNjfO8i5e3ybe6CIaybY37SQebquV+rioH\n" + - "O9BS75GgtYXCaMK/8prya9RiaUjy7kecvpKtJNiaXrLJy8Vzq9g39n9hiXJYMGkc\n" + - "fCWYjWd5jU4pAsYTslmuIYoIZuwRRX34iET6Brs3ijykcmYtG5F90wqFlvRxRh0x\n" + - "vD0EeTOLGZSDQMYxlhfrqG449I10iTHusSxI2AXB6k7N2UXMJ44D7Z3RWkv1ItsY\n" + - "eKVXQyLAYd8YYTFNdGa75SoRr+ChFbLCgSUMg188T/SS013bH/XSHpCbQQIDAQAB\n" + - "o4ICgDCCAnwwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwG\n" + - "A1UdEwEB/wQCMAAwHQYDVR0OBBYEFLXeKzKKPx+Vs7YEKdmz9Vur9BZiMB8GA1Ud\n" + - "IwQYMBaAFKiI2Yo5rGXVgks3qJVsZUPNRAHgMHgGCCsGAQUFBwEBBGwwajA1Bggr\n" + - "BgEFBQcwAYYpaHR0cDovL29jc3AucGtpLmdvb2cvcy9ndHMyZDQvaG5fZHY1dHlS\n" + - "SVkwMQYIKwYBBQUHMAKGJWh0dHA6Ly9wa2kuZ29vZy9yZXBvL2NlcnRzL2d0czJk\n" + - "NC5kZXIwJQYDVR0RBB4wHIIacmV2b2tlZC5nc3I0LmRlbW8ucGtpLmdvb2cwIQYD\n" + - "VR0gBBowGDAIBgZngQwBAgEwDAYKKwYBBAHWeQIFAzA8BgNVHR8ENTAzMDGgL6At\n" + - "hitodHRwOi8vY3Jscy5wa2kuZ29vZy9ndHMyZDQvSUlXMzNMVUVwV3cuY3JsMIIB\n" + - "AwYKKwYBBAHWeQIEAgSB9ASB8QDvAHYAejKMVNi3LbYg6jjgUh7phBZwMhOFTTvS\n" + - "K8E6V6NS61IAAAGHJNUx1gAABAMARzBFAiEAj/RgXx1ScnsOf9R9N3eyPMJtH33C\n" + - "mOrRCOodG8QXmE0CIHwNJC5E53BVmfMzZwJH9f2BiUx31SGHWFvG283zVtX/AHUA\n" + - "6D7Q2j71BjUy51covIlryQPTy9ERa+zraeF3fW0GvW4AAAGHJNUxnAAABAMARjBE\n" + - "AiAI7pcrKatsz0G4QYPKmS74VQVEgnHqgKSoqv0ghTJXTgIgPyoYubz4MEHYirBu\n" + - "69BLC2jioXr8+wS7MK1IPqjdH44wCgYIKoZIzj0EAwIDSQAwRgIhAI4NdZ5JwTuW\n" + - "P+RH2bsAc5xrb804G9mOc3WMRVxTUKesAiEA/jHMJ2YdPv0WXKjKY7nUyFjUPdin\n" + - "BHRHfBeltynaFzU=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Mar 27 13:49:33 PDT 2023", System.out); - } -} - -class GoogleGTSR1 { - - // Owner: CN=GTS CA 1D4, O=Google Trust Services LLC, C=US - // Issuer: CN=GTS Root R1, O=Google Trust Services LLC, C=US - // Serial number: 2008eb2023336658b64cddb9b - // Valid from: Wed Aug 12 17:00:42 PDT 2020 until: Wed Sep 29 17:00:42 PDT 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFjDCCA3SgAwIBAgINAgCOsgIzNmWLZM3bmzANBgkqhkiG9w0BAQsFADBHMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU\n" + - "MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMjAwODEzMDAwMDQyWhcNMjcwOTMwMDAw\n" + - "MDQyWjBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp\n" + - "Y2VzIExMQzETMBEGA1UEAxMKR1RTIENBIDFENDCCASIwDQYJKoZIhvcNAQEBBQAD\n" + - "ggEPADCCAQoCggEBAKvAqqPCE27l0w9zC8dTPIE89bA+xTmDaG7y7VfQ4c+mOWhl\n" + - "UebUQpK0yv2r678RJExK0HWDjeq+nLIHN1Em5j6rARZixmyRSjhIR0KOQPGBMUld\n" + - "saztIIJ7O0g/82qj/vGDl//3t4tTqxiRhLQnTLXJdeB+2DhkdU6IIgx6wN7E5NcU\n" + - "H3Rcsejcqj8p5Sj19vBm6i1FhqLGymhMFroWVUGO3xtIH91dsgy4eFKcfKVLWK3o\n" + - "2190Q0Lm/SiKmLbRJ5Au4y1euFJm2JM9eB84Fkqa3ivrXWUeVtye0CQdKvsY2Fka\n" + - "zvxtxvusLJzLWYHk55zcRAacDA2SeEtBbQfD1qsCAwEAAaOCAXYwggFyMA4GA1Ud\n" + - "DwEB/wQEAwIBhjAdBgNVHSUEFjAUB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o+WhT9BYM0Ji+wdVmnRffXgloEoluTNcWzc4\n" + - "1dFpgJu8fF3LG0gl2ibSYiCi9a6hvU0TppjJyIWXhkJTcMJlPrWx1VytEUGrX2l0\n" + - "JDwRjW/656r0KVB02xHRKvm2ZKI03TglLIpmVCK3kBKkKNpBNkFt8rhafcCKOb9J\n" + - "x/9tpNFlQTl7B39rJlJWkR17QnZqVptFePFORoZmFzM=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=good.gtsr1.demo.pki.goog - // Issuer: CN=GTS CA 1D4, O=Google Trust Services LLC, C=US - // Serial number: 19c08d5cde41fc84108f54c8d2a1aeca - // Valid from: Mon Mar 27 12:33:43 PDT 2023 until: Sun Jun 25 12:33:42 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFcjCCBFqgAwIBAgIQGcCNXN5B/IQQj1TI0qGuyjANBgkqhkiG9w0BAQsFADBG\n" + - "MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM\n" + - "QzETMBEGA1UEAxMKR1RTIENBIDFENDAeFw0yMzAzMjcxOTMzNDNaFw0yMzA2MjUx\n" + - "OTMzNDJaMCMxITAfBgNVBAMTGGdvb2QuZ3RzcjEuZGVtby5wa2kuZ29vZzCCASIw\n" + - "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMkOYhMM6kQMlep+l2/l5KTC1ow8\n" + - "nXHwXQzugR2Js302pM3p2UCfnfhlK0a9UUSVtAZa8ydVUyVRF9LzW1rOIK8UdlEj\n" + - "O6qAvPnPw8laY7rCPWRPibxu0OqL/5sYD+a4hQ7GhVsYDXXxnWQvLV5mppRlYF/8\n" + - "80ugGggRb+U3y6V84f1JnwSMvZFULe19BOeV5qWAHHFfgy0zePzcDMy8AqxaVBOb\n" + - "FVSsbdql2gnRyC4WZ9D5lc8vwS84KrJbce2+VtrpcKVALtyVA0Zzor2lr2wOVc4i\n" + - "OOwMNk9948eStAj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UTBu5fVZPQ27EgehTIA6kNhQj2g7fkF\n" + - "Bd5zAl4k7WdsDZCeOHml6XXQZHvc+p4DYBKTTt3h81lsMLw8aWCOaiSmrQ0hZS/E\n" + - "iuaqvlOFpOTd0x+MN2qcU14hi8SKxBgpraqR/s7OCwUFltxcPq0GAybzDGc9lgB+\n" + - "Jt56QviN641s7hxThyGhFIHSePgWuwbT1grJKQiSW35yI4PJO90HoCpd2MLrC5Ic\n" + - "B89ykY8mQcx+naGPZQdwdpx9GvKwSZdn+cq3kZwD66iXnwhqmiEdq4eBZr8ygSya\n" + - "lnGV2OW+\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.gtsr1.demo.pki.goog - // Issuer: CN=GTS CA 1D4, O=Google Trust Services LLC, C=US - // Serial number: c414c34e6c2cc66c102b8d3502be3bb4 - // Valid from: Mon Mar 27 12:42:39 PDT 2023 until: Sun Jun 25 12:42:38 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIFfDCCBGSgAwIBAgIRAMQUw05sLMZsECuNNQK+O7QwDQYJKoZIhvcNAQELBQAw\n" + - "RjELMAkGA1UEBhMCVVMxIjAgBgNVBAoTGUdvb2dsZSBUcnVzdCBTZXJ2aWNlcyBM\n" + - "TEMxEzARBgNVBAMTCkdUUyBDQSAxRDQwHhcNMjMwMzI3MTk0MjM5WhcNMjMwNjI1\n" + - "MTk0MjM4WjAmMSQwIgYDVQQDExtyZXZva2VkLmd0c3IxLmRlbW8ucGtpLmdvb2cw\n" + - "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCOeL80aphh8K8Cz41Sl2Cv\n" + - "cI3Elrrm/2sQH5Q0nxNuoZcxTGk3hD75Ntf6eqgclUQXJDEGbfoo3q7kYIQPXEIy\n" + - "+AuiMTd80ZRHuPBp8ci/wkh6N7B9mE/rjzJz77QgJluykoXRx9SiDyE4Yn9sRbBH\n" + - "jNm/KBv8wMV6hzJZYaALyDpGVNuAx9c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iNbu\n" + - "vsyOi9nE6pDm86nggExXRa13wwCtr2wjAn5IpDANBgkqhkiG9w0BAQsFAAOCAQEA\n" + - "ezldM/NCUH58eXPZnbPaMMKrT5oNBxv+hypDy96+PyAqKtbC2bK+7sobGMZkfpG5\n" + - "8dW0mFmfazzjgbZUj54ZVHG4KaHeit8Nq1s07wh2Jo1c2JQdKxEXAOItax/IOfEd\n" + - "tqSg8AwSmhogQeiA7EXRspw4dYXL5uP/8jPPqByMI3PRmm3y7wyQLKNlNAfSgn7m\n" + - "wkrZxMRAENML4JND5UKxg7zo9e/Wvf4UPtEVVZaEj6ZxOe4JljvErCtayaw03t5p\n" + - "I18IAhXRpqm8JG1UGWjn49O8vkjB0bf/7iVXXI4rg6gGVia+HFuxKVGk5OQzo4Qd\n" + - "wBl6yOc8tpUH3phFPYbiMg==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Mar 27 13:43:25 PDT 2023", System.out); - } -} - -class GoogleGTSR2 { - - // Owner: CN=GTS CA 1D8, O=Google Trust Services LLC, C=US - // Issuer: CN=GTS Root R2, O=Google Trust Services LLC, C=US - // Serial number: 219c15ac025a1b0a5c1d9d501 - // Valid from: Tue Oct 04 17:00:42 PDT 2022 until: Wed Sep 29 17:00:42 PDT 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFjDCCA3SgAwIBAgINAhnBWsAlobClwdnVATANBgkqhkiG9w0BAQsFADBHMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU\n" + - "MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMjIxMDA1MDAwMDQyWhcNMjcwOTMwMDAw\n" + - "MDQ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9wa2kuZ29vZy9yZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAgEA\n" + - "q3rJUW9syti3qkV5WNXCpJj2WoCptfxOdIrojT4Q1CIGzruFu4GXB8pfkJu7iU8k\n" + - "Aklel6RCn7MG/aI12ndmvUsW86e6UJDWEMz1CsQPA92AOsktAVXiGVDx3RAiPfP2\n" + - "9W9yNwlImSVZhGNQISC0SueK7QOv+mHHWE/7G0G0/YqAxMbVZzyrPYHfPUh0SD1g\n" + - "k7qYjq9hGJB7w7cfepZ2iPdKzlj/4aFOe04gho1zHMLJYIs03nb6uWg0AwX55SSu\n" + - "KvehoYs1ItHdEV1J2XfATZpCn6jMTEB/JYERbXW0VWLUhdaZORtaayQoU5YXbgvg\n" + - "bsPgqdIsPaxs/Chrp6zIKvs503YYcvs0GQSUQ1MFAWc+Loc39669T7WnL8Uu2yCO\n" + - "RxjFp3+fhTVA5UYwL1vy4wPnNUoa4+CA6JypT6ODUWcXZa8pWOdyHpbg0IeL389D\n" + - "s67kirG8/eKQxFzckbhL5AD8BJS3wkF7O7A8Gd+2VvSWhmEQzzOBHcvT/lqrCSe0\n" + - "7R7CV/Pw4E9C2GBLGfw8opxGXrdfJRjU6nHf5c+tC4xIjH/i3PQjaIFLG3D60mav\n" + - "0nkS92iorZl2dCiHTKxaD/J4B6VV03lpEcUdVg4WeGAmTClsXUnMOjCnlVYMLg9v\n" + - "URq0LbylxbGBelBrCNyqBS5UO6+9F4/Yi4vzoIvvbJ0=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=good.gtsr2.demo.pki.goog - // Issuer: CN=GTS CA 1D8, O=Google Trust Services LLC, C=US - // Serial number: 428fe99edb0df46e1008e4452f6cbfd2 - // Valid from: Mon Mar 27 12:52:12 PDT 2023 until: Sun Jun 25 12:52:11 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFdDCCBFygAwIBAgIQQo/pntsN9G4QCORFL2y/0jANBgkqhkiG9w0BAQsFAD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AgGBmeBDAECATAMBgorBgEEAdZ5AgUDMDwGA1UdHwQ1MDMwMaAvoC2G\n" + - "K2h0dHA6Ly9jcmxzLnBraS5nb29nL2d0czFkOC8tME5ITHA5Y0w5US5jcmwwggEE\n" + - "BgorBgEEAdZ5AgQCBIH1BIHyAPAAdgB6MoxU2LcttiDqOOBSHumEFnAyE4VNO9Ir\n" + - "wTpXo1LrUgAAAYck2PpFAAAEAwBHMEUCIAznUI2WdAkwXBvnx0a8Io6hnZReoXsd\n" + - "Y+o+xpXqZsbbAiEAw/i7jWA43QWEMZz265nflCNxAS1W+s7nsZaKL512/S8AdgDo\n" + - "PtDaPvUGNTLnVyi8iWvJA9PL0RFr7Otp4Xd9bQa9bgAAAYck2PoBAAAEAwBHMEUC\n" + - "IHWqRE57W1pJJJAXrxFNMrjEO3f0YejAfi47mdyS1zJYAiEA4ye+achvGTYIMRnl\n" + - "jwBlTsYQQYt7KAVt2VAGMRB4H8kwDQYJKoZIhvcNAQELBQADggEBAGf9hz7NJRow\n" + - "veCSrfeVav2tDkx8s9VU7VD+lApip1mdqOGsqkCkeaA5hsGfhqleQFwsOAjduBFA\n" + - "nSV6KgiqFsgHSuS9zuSp2aVe8xhxq6mpr4LngkeUDc32mB9tW9AMaiYp8UeYyFGq\n" + - "hvjUb7/H2wFlT6qO+Qp/+hmfulKqNnrSzpZLIl+x2EBn3L6CFe5xaKzNaANgbShI\n" + - "cQsyKdaUrSAzNJZWnHwaAyQ1msqqXXoVzKmjAGMgZrXZNxv8Lh9V1v+F9WHDIjeQ\n" + - "TtahntIgq38eGtZAnyjdrUtfQwBlQI3zaE0n7n6Fq8ocglJE5woRlL/eTmSKiZr9\n" + - "rrEY0sJ0fCw=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.gtsr2.demo.pki.goog - // Issuer: CN=GTS CA 1D8, O=Google Trust Services LLC, C=US - // Serial number: df9af5c19e9dbdf6107cb03548ffbd06 - // Valid from: Mon Mar 27 12:45:09 PDT 2023 until: Sun Jun 25 12:45:08 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIFejCCBGKgAwIBAgIRAN+a9cGenb32EHywNUj/vQYwDQYJKoZIhvcNAQELBQAw\n" + - "RjELMAkGA1UEBhMCVVMxIjAgBgNVBAoTGUdvb2dsZSBUcnVzdCBTZXJ2aWNlcyBM\n" + - "TEMxEzARBgNVBAMTCkdUUyBDQSAxRDgwHhcNMjMwMzI3MTk0NTA5WhcNMjMwNjI1\n" + - "MTk0NTA4WjAmMSQwIgYDVQQDExtyZXZva2VkLmd0c3IyLmRlbW8ucGtpLmdvb2cw\n" + - "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDFJUSh0aOOjj6BXJqBFDOD\n" + - "GFjnr1VKDfWYdGWfB3QNhcbjz7qJRLeZDSYQZ3H2D5pkOQhl6xYLOZ1L0v+0TWW9\n" + - "5lCXQ476jdZXzPlOC29gYFX4VzS9w92ochg0dUhHdzKcWsqBjqChZdudGydYfwNS\n" + - "edZIhd4AcamVsXbCqAhS01Evo2hiBRlmMgryR9Ok2xRqbJiyvd8awhBIB4L0vMN+\n" + - "CgMpWMgaV1nn+LjEa3bHisyNVsRLdDZXY6Bgq3hUQ9jQWJdK/vGxHqunqC5ByrqG\n" + - "iN+4/+kK/PS8okkpAEAOXFoohogb6BQASMRgO/l50Mz8B24NGgWVLlWdaNysgU8f\n" + - "AgMBAAGjggKBMIICfTAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUH\n" + - "AwEwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUh/wMqf9pabUzGDoQvsyHVaT1rjAw\n" + - "HwYDVR0jBBgwFoAUkPhQ+ueQJcnkJ30S3UdY53QPtmoweAYIKwYBBQUHAQEEbDBq\n" + - "MDUGCCsGAQUFBzABhilodHRwOi8vb2NzcC5wa2kuZ29vZy9zL2d0czFkOC9CdWF6\n" + - "OFdQMnoybzAxBggrBgEFBQcwAoYlaHR0cDovL3BraS5nb29nL3JlcG8vY2VydHMv\n" + - "Z3RzMWQ4LmRlcjAmBgNVHREEHzAdghtyZXZva2VkLmd0c3IyLmRlbW8ucGtpLmdv\n" + - "b2cwIQYDVR0gBBowGDAIBgZngQwBAgEwDAYKKwYBBAHWeQIFAzA8BgNVHR8ENTAz\n" + - "MDGgL6AthitodHRwOi8vY3Jscy5wa2kuZ29vZy9ndHMxZDgvLTBOSExwOWNMOVEu\n" + - "Y3JsMIIBAwYKKwYBBAHWeQIEAgSB9ASB8QDvAHYAejKMVNi3LbYg6jjgUh7phBZw\n" + - "MhOFTTvSK8E6V6NS61IAAAGHJNGpywAABAMARzBFAiEApXndD34BJ3oOCLvGoa5f\n" + - "Xu0P6t4yf1pdCQONuLTSrX4CIDMp1N5/VKjClXqE/t2xux3mvJH2ceVECID4B69v\n" + - "WfOhAHUA6D7Q2j71BjUy51covIlryQPTy9ERa+zraeF3fW0GvW4AAAGHJNGphwAA\n" + - "BAMARjBEAiBa5aSnTCc2ceQj/asKFYRRGbwzXTnaDbvNMMeB4ogEXAIgZykyJVPh\n" + - "4Sfkroi8tvV6dwxexp0dT2EXHAmr+/GzZU0wDQYJKoZIhvcNAQELBQADggEBAHVn\n" + - "uWbk/OaljXKeyhlDCgdvnzJGCFQXwGyIJzNDkCs8k3iA1iwJKArvpkczxnCBxCPE\n" + - "imW2MHWCayT9JXKuO4ppU0oTh6GYvRV6DV1OkuWXsna7+dGf3+tkm9k0wauI6J8X\n" + - "H1T8Dq3W0+S+8UNSftduYSR1wTcN15OxIzlZ/FrV3LLRDxH2RKSsXfXBLgP1befh\n" + - "m+8SPQTpZ5NdMl7my0gmVgNF5ZIbFiHYzJkF2vS4iXJCI6fTWyoA1u/7jQyHdLOy\n" + - "pY0s6gKWEwwtpYC1lWI6ek/wLfuNrJbiRRiRs8e3HHQymn8K3T1PM+7n8huDy95b\n" + - "f1EgLMjvEtx6xpIqrqg=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Mar 27 13:45:40 PDT 2023", System.out); - } -} - -class GoogleGTSR3 { - - // Owner: CN=GTS CA 2D3, O=Google Trust Services LLC, C=US - // Issuer: CN=GTS Root R3, O=Google Trust Services LLC, C=US - // Serial number: 21668d8d65bc4320e5b8e5e76 - // Valid from: Tue Oct 04 17:00:42 PDT 2022 until: Wed Sep 29 17:00:42 PDT 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDIDCCAqagAwIBAgINAhZo2NZbxDIOW45edjAKBggqhkjOPQQDAzBHMQswCQYD\n" + - "VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG\n" + - "A1UEAxMLR1RTIFJvb3QgUjMwHhcNMjIxMDA1MDAwMDQyWhcNMjcwOTMwMDAwMDQy\n" + - "WjBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz\n" + - "IExMQzETMBEGA1UEAxMKR1RTIENBIDJEMzBZMBMGByqGSM49AgEGCCqGSM49AwEH\n" + - "A0IABGQQXn8LoR0OtyBn+KkEav3utA7WFBgWEb/8bXVlW6xJLTZJIC04lsNmNKWJ\n" + - "P/fwHYfrZcx1o4vvOUTO9OD/7pijggF2MIIBcjAOBgNVHQ8BAf8EBAMCAYYwHQYD\n" + - "VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8CAQAw\n" + - "HQYDVR0OBBYEFL+pU78badiFKTSaaUPL1nrUmf9tMB8GA1UdIwQYMBaAFMHxJrqg\n" + - "La6Fgc/T8SoSvbgKZ/28MGgGCCsGAQUFBwEBBFwwWjAmBggrBgEFBQcwAYYaaHR0\n" + - "cDovL29jc3AucGtpLmdvb2cvZ3RzcjMwMAYIKwYBBQUHMAKGJGh0dHA6Ly9wa2ku\n" + - "Z29vZy9yZXBvL2NlcnRzL2d0c3IzLmRlcjA0BgNVHR8ELTArMCmgJ6AlhiNodHRw\n" + - "Oi8vY3JsLnBraS5nb29nL2d0c3IzL2d0c3IzLmNybDBNBgNVHSAERjBEMAgGBmeB\n" + - "DAECATA4BgorBgEEAdZ5AgUDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vcGtpLmdv\n" + - "b2cvcmVwb3NpdG9yeS8wCgYIKoZIzj0EAwMDaAAwZQIxAO3wG4U11INX3hl2UyCn\n" + - "0A/upBaO+BBzX1OiQx7UfmMXc65kqkdIcNzZc6G6EWnNVAIwBG0LuIKWXfYc+Wbk\n" + - "STfMvwatUvd6QjdIKsYF0e8Hiaav+hLI0DzOuJcDPFtfYIyY\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=good.gtsr3.demo.pki.goog - // Issuer: CN=GTS CA 2D3, O=Google Trust Services LLC, C=US - // Serial number: 7d08ad6716e51d1210bfc149e3d0af19 - // Valid from: Mon Mar 27 12:37:41 PDT 2023 until: Sun Jun 25 12:37:40 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIEszCCBFmgAwIBAgIQfQitZxblHRIQv8FJ49CvGTAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBIDJEMzAeFw0yMzAzMjcxOTM3NDFaFw0yMzA2MjUxOTM3\n" + - "NDBaMCMxITAfBgNVBAMTGGdvb2QuZ3RzcjMuZGVtby5wa2kuZ29vZzCCASIwDQYJ\n" + - "KoZIhvcNAQEBBQADggEPADCCAQoCggEBAL7R40feuILVPC65FhoVh3kZ8mJuEKpJ\n" + - "SiSB9gbKRkaKB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7cYfSflOAA0DLxHsHAXpVs2LuLYlq34bSxbyUa85UyYAdgCzc3cH\n" + - "4YRQ+GOG1gWp3BEJSnktsWcMC4fc8AMOeTalmgAAAYckzOf5AAAEAwBHMEUCICza\n" + - "2nef9GWr9tF/ZXxhMYP15JQsdWPWmpQkdS/xUBWyAiEAs9AaeMarT7EaBVoSatAT\n" + - "Poj6cOhdvF/uDOHigyQdVd8wCgYIKoZIzj0EAwIDSAAwRQIhALv6jaEFgAIe3NbX\n" + - "87YEjhMMymK7wl435DQD9syoOEx2AiBbcYXr6nLNWA1pPoRiA1WvHgTVJFWftpYt\n" + - "e8CkUXnIxA==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.gtsr3.demo.pki.goog - // Issuer: CN=GTS CA 2D3, O=Google Trust Services LLC, C=US - // Serial number: 7ffa6a827df64c6010ebc47b5ca3eda7 - // Valid from: Mon Mar 27 12:45:58 PDT 2023 until: Sun Jun 25 12:45:57 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIEuTCCBF+gAwIBAgIQf/pqgn32TGAQ68R7XKPtpzAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBIDJEMzAeFw0yMzAzMjcxOTQ1NThaFw0yMzA2MjUxOTQ1\n" + - "NTdaMCYxJDAiBgNVBAMTG3Jldm9rZWQuZ3RzcjMuZGVtby5wa2kuZ29vZzCCASIw\n" + - "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKpn78KglifqiS3f5hPLH64og4aH\n" + - "7a1tDBza2ebTLYB74i1u65EIENCyzvz6OYvh8kKzhqZMPFbORd8OCESzebjv/Dc2\n" + - "BJJV498N3BfSZYWN+baVxKuOZ4HWXV5NyP85rEvbcaAWcmqvh++G88FOCTQvYd4D\n" + - "/RKgAMptDjM+4X6V2NIRXcmOZ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wenYAULrRiAiEA6uKFK1sbnJ1J\n" + - "lW8Tw2G4jGpEFIc4C9duRbU6DIbGnckwCgYIKoZIzj0EAwIDSAAwRQIgN3byD4lu\n" + - "a8A0hzUR1OnPoXSyfus6HOhmBozH6coY9MICIQDsT5jj5GKVtxtlcki5iE08K70Z\n" + - "gt/tkcE1Fkk4RsZORA==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Mar 27 13:47:24 PDT 2023", System.out); - } -} - -class GoogleGTSR4 { - - // Owner: CN=GTS CA 2P2, O=Google Trust Services LLC, C=US - // Issuer: CN=GTS Root R4, O=Google Trust Services LLC, C=US - // Serial number: 2166825e1700440612491f540 - // Valid from: Tue Oct 04 17:00:42 PDT 2022 until: Wed Sep 29 17:00:42 PDT 2027 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDITCCAqagAwIBAgINAhZoJeFwBEBhJJH1QDAKBggqhkjOPQQDAzBHMQswCQYD\n" + - "VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG\n" + - "A1UEAxMLR1RTIFJvb3QgUjQwHhcNMjIxMDA1MDAwMDQyWhcNMjcwOTMwMDAwMDQy\n" + - "WjBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz\n" + - "IExMQzETMBEGA1UEAxMKR1RTIENBIDJQMjBZMBMGByqGSM49AgEGCCqGSM49AwEH\n" + - "A0IABKdQkzjAHqOUsb/TkH7cz5lRtD374tNZ8rYrCUb1mxypE+VmCb1Jgzq+93tR\n" + - "dE78GRzPI4+q6raha1TEyWgoniOjggF2MIIBcjAOBgNVHQ8BAf8EBAMCAYYwHQYD\n" + - "VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8CAQAw\n" + - "HQYDVR0OBBYEFIcjqVBIDgeJVApxMPYz0gpH9p2sMB8GA1UdIwQYMBaAFIBM1ut0\n" + - "/0k2o9XY/LU+xWrwlB2MMGgGCCsGAQUFBwEBBFwwWjAmBggrBgEFBQcwAYYaaHR0\n" + - "cDovL29jc3AucGtpLmdvb2cvZ3RzcjQwMAYIKwYBBQUHMAKGJGh0dHA6Ly9wa2ku\n" + - "Z29vZy9yZXBvL2NlcnRzL2d0c3I0LmRlcjA0BgNVHR8ELTArMCmgJ6AlhiNodHRw\n" + - "Oi8vY3JsLnBraS5nb29nL2d0c3I0L2d0c3I0LmNybDBNBgNVHSAERjBEMAgGBmeB\n" + - "DAECATA4BgorBgEEAdZ5AgUDMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vcGtpLmdv\n" + - "b2cvcmVwb3NpdG9yeS8wCgYIKoZIzj0EAwMDaQAwZgIxAMnbIiQb5fsdexUuVGoB\n" + - "MVwsDPGd7VC13Y0OBezt7FqFHDwqm8nnVdV/FkNyXNv9/AIxAN51NGqMcbexMOYK\n" + - "pLC0zXfjNwvqBsZhmzCCQIM6MVyBID0rjjxPu7laIaHqAu6T5Q==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=good.gtsr4.demo.pki.goog - // Issuer: CN=GTS CA 2P2, O=Google Trust Services LLC, C=US - // Serial number: 743c4f78750e30f0d407a19254ba96a - // Valid from: Mon Mar 27 12:40:42 PDT 2023 until: Sun Jun 25 12:40:41 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIEsTCCBFegAwIBAgIQB0PE94dQ4w8NQHoZJUupajAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBID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Mi94NWswT2ZlZ0o4OC5jcmwwggECBgor\n" + - "BgEEAdZ5AgQCBIHzBIHwAO4AdQDoPtDaPvUGNTLnVyi8iWvJA9PL0RFr7Otp4Xd9\n" + - "bQa9bgAAAYckzdBSAAAEAwBGMEQCICpm7XEQds5Pzk59Qhhlx3PjipAEVzxVJB3H\n" + - "UmmGlHYKAiBG39UauHNNQDMYK2PEnILbFI0AvVWpCBUck4CHbs+9xAB1AHoyjFTY\n" + - "ty22IOo44FIe6YQWcDIThU070ivBOlejUutSAAABhyTN0JoAAAQDAEYwRAIgekoP\n" + - "yJFspEfqvzW/pzVtRn8oz1L/PBzw2NYRPFdDkRUCIG1uIaGUA7uqiILD6vvp/1VD\n" + - "XriEIH8/qz/3qWqxsZanMAoGCCqGSM49BAMCA0gAMEUCIQCnpyh5H9Hn+f8nOFZp\n" + - "wz7p+x5pmMVvPzah1g+EmoFO/wIgStidgVhudT/vpM2OH/oN30Na+EJJDqWxousN\n" + - "6t9L8FQ=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked.gtsr4.demo.pki.goog - // Issuer: CN=GTS CA 2P2, O=Google Trust Services LLC, C=US - // Serial number: 6b2d650d4bc3bd3f11a595bf05187915 - // Valid from: Mon Mar 27 12:47:43 PDT 2023 until: Sun Jun 25 12:47:42 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIEuDCCBF6gAwIBAgIQay1lDUvDvT8RpZW/BRh5FTAKBggqhkjOPQQDAjBGMQsw\n" + - "CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzET\n" + - "MBEGA1UEAxMKR1RTIENBIDJQMjAeFw0yMzAzMjcxOTQ3NDNaFw0yMzA2MjUxOTQ3\n" + - "NDJaMCYxJDAiBgNVBAMTG3Jldm9rZWQuZ3RzcjQuZGVtby5wa2kuZ29vZzCCASIw\n" + - "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOEKo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ykDTU3mqgLIk+fPmVn6JGUXB\n" + - "W4xouGUA1iiNs7G0AiEAtuWnV/J5llcxB7ZTwkCb6cviyv4Z6O396ZGW8GsrqAQA\n" + - "dQC3Pvsk35xNunXyOcW6WPRsXfxCz3qfNcSeHQmBJe20mQAAAYck1BYIAAAEAwBG\n" + - "MEQCIHcK1H025GIv8klzQGSZAL9NnuH5EzeGra0jRRg5RM4UAiAQaJyJDBkJRL/C\n" + - "F9WCg9Lmp8bdsXkG5WPreI24ansAPTAKBggqhkjOPQQDAgNIADBFAiBehPLU7raP\n" + - "509khaP9yiKiL3mbygtfQo4MDpBnd2RI6wIhAOdlQythGgU+nOENodsB+wUOQXOb\n" + - "akcBOxrDWfyhxmpk\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Mar 27 13:48:18 PDT 2023", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/LetsEncryptCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/LetsEncryptCA.java deleted file mode 100644 index d97342ae8d2..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/LetsEncryptCA.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @bug 8189131 - * @summary Interoperability tests with Let's Encrypt CA - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath LetsEncryptCA OCSP - * @run main/othervm -Djava.security.debug=certpath LetsEncryptCA CRL - */ - - /* - * Obtain TLS test artifacts for Let's Encrypt CA from: - * - * Valid TLS Certificates: - * https://valid-isrgrootx1.letsencrypt.org/ - * - * Revoked TLS Certificates: - * https://revoked-isrgrootx1.letsencrypt.org/ - * - * Test artifacts don't have CRLs listed and intermediate cert doesn't have OCSP. - */ -public class LetsEncryptCA { - - // Owner: CN=R3, O=Let's Encrypt, C=US - // Issuer: CN=ISRG Root X1, O=Internet Security Research Group, C=US - // Serial number: 912b084acf0c18a753f6d62e25a75f5a - // Valid from: Thu Sep 03 17:00:00 PDT 2020 until: Mon Sep 15 09:00:00 PDT 2025 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw\n" + - "TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh\n" + - "cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw\n" + - "WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg\n" + - "RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n" + - "AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP\n" + - "R5Q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5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2\n" + - "yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O\n" + - "yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids\n" + - "hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+\n" + - "HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv\n" + - "MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX\n" + - "nLRbwHOoq7hHwg==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=valid-isrgrootx1.letsencrypt.org - // Issuer: CN=R3, O=Let's Encrypt, C=US - // Serial number: 46326744d1c2f3feeca7148ed59353144a6 - // Valid from: Wed Jun 02 08:00:18 PDT 2021 until: Tue Aug 31 08:00:18 PDT 2021 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBDCgAwIBAgISBGMmdE0cLz/uynFI7Vk1MUSmMA0GCSqGSIb3DQEBCwUA\n" + - "MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD\n" + - "EwJSMzAeFw0yMTA2MDIxNTAwMThaFw0yMTA4MzExNTAwMThaMCsxKTAnBgNVBAMT\n" + - "IHZhbGlkLWlzcmdyb290eDEubGV0c2VuY3J5cHQub3JnMIIBIjANBgkqhkiG9w0B\n" + - "AQEFAAOCAQ8AMIIBCgKCAQEAmdx7jlaUZ0MgEvqzYWXItAFxVAOmR3KF+79vU195\n" + - "O5X54Go1+GU+eyFAeTqr6W1gC/MIrSA9LO4neJUx5AWCYaLq7IE7/YnmXTT6BB0x\n" + - "WFN3V1OJg9bAqpc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OBkEOblkEHq5Lf+wtkQIhAO2HhwOm3wns\n" + - "ZTsXjUCcfQA0lKBI2TKkg9tJKFs3uuKDMA0GCSqGSIb3DQEBCwUAA4IBAQBJJ47x\n" + - "ZhKN3QRBYVROpoYDSh0a/JW7zPGRCxK5fnDY9UT8m4gEh3yhDTkycX+vo8TReK6W\n" + - "fEYareTSTq71MYgtKDYEARm10DuL7Vdig9Tf5DpjXLHaba+wqPz24lwhiJgoKRRr\n" + - "8by3wXPFCGSuQyDo1ZUNrAJVYKO4hPMob1ZE8z9IYW63GvzBjEla/HxoVa9iTkv+\n" + - "31rsKzpSbMJpnQ7WcgkUPdpoDo4JElGCyf7VZHNicumipAiCmKu0Q6TRCPOXxlKE\n" + - "/BIyDey3rXVw3wzOlxmVF6t/V3vGtbgVvN/feUe/ytyv4vLfRR4udi2XxWt3x1la\n" + - "7R3zuWdRQhh21p1H\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked-isrgrootx1.letsencrypt.org - // Issuer: CN=R3, O=Let's Encrypt, C=US - // Serial number: 4f1333011635d76d6356c5f1fb8a7273617 - // Valid from: Fri Jun 25 08:18:10 PDT 2021 until: Thu Sep 23 08:18:09 PDT 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIFSTCCBDGgAwIBAgISBPEzMBFjXXbWNWxfH7inJzYXMA0GCSqGSIb3DQEBCwUA\n" + - "MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD\n" + - "EwJSMzAeFw0yMTA2MjUxNTE4MTBaFw0yMTA5MjMxNTE4MDlaMC0xKzApBgNVBAMT\n" + - "InJldm9rZWQtaXNyZ3Jvb3R4MS5sZXRzZW5jcnlwdC5vcmcwggEiMA0GCSqGSIb3\n" + - "DQEBAQUAA4IBDwAwggEKAoIBAQCkCp4fq7FnN5lfAWX0vhCcyC5WO9TuU6ckuYYj\n" + - "8/wQ8GQ/FIl+vXCAmHIfIX14irQ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aJl+IvDXAAABekP23sYAAAQD\n" + - "AEcwRQIgGli/1mmKKnZ0uxDIX7ySqAyD2C7FTf+y3py2S0Xcv4YCIQCZve3cqKZ2\n" + - "lrEyyaMeLZA+PIxUMniHx3gDkro0sKLzOzANBgkqhkiG9w0BAQsFAAOCAQEAle42\n" + - "p58OTusm7DAOcdK4ld+pJu2bz9F940Wrnql08rciRjGIVpp5PhMNFm9AOaptKPNY\n" + - "h62V2GEOVaLxmvr9/8EDFcCCPAGV1DNYrG9aTKaiXk7IzO4UxKbzox4iUcuop/zB\n" + - "uofxT8uBLmT4XYZrQXXKj1KdfJGzgeoXqBv5PPCiP3hmBQixoJnSKImnUIXWh4O8\n" + - "kBtmgII5ug0q+jI3LvpJuv7xQsaNYFBcmFiQQ7YRt4W99GMdbYGjhzT8iBDEH7nG\n" + - "MsqWuwB5TN5vIuw2aWxcfaqKayq7UPA4rJePWdD/5RzKlQKLQx0BA3AL+3Nnj1fT\n" + - "NEKwCWWylIND6z/9Xw==\n" + - "-----END CERTIFICATE-----"; - - public static void main(String[] args) throws Exception { - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - pathValidator.enableCRLCheck(); - - // Validate int, EE certs don't have CRLs - pathValidator.validate(new String[]{INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - return; - } - - // OCSP check by default - // intermediate cert R3 doesn't specify OCSP responder - ValidatePathWithParams pathValidator = new ValidatePathWithParams(new String[]{INT}); - pathValidator.enableOCSPCheck(); - - // Validate valid - pathValidator.validate(new String[]{VALID}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED}, - ValidatePathWithParams.Status.REVOKED, - "Fri Jun 25 09:18:12 PDT 2021", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/MicrosoftTLS.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/MicrosoftTLS.java deleted file mode 100644 index e21aad61b83..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/MicrosoftTLS.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8304760 - * @summary Interoperability tests with Microsoft TLS root CAs - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath MicrosoftTLS OCSP - * @run main/othervm -Djava.security.debug=certpath MicrosoftTLS CRL - */ - -/* - * Microsoft ECC Root Certificate Authority 2017: - * Valid: http://acteccroot2017.pki.microsoft.com/ - * Revoked: http://rvkeccroot2017.pki.microsoft.com/ - * Expired: http://expeccroot2017.pki.microsoft.com/ - * - * Microsoft RSA Root Certificate Authority 2017: - * Valid: http://actrsaroot2017.pki.microsoft.com/ - * Revoked: http://rvkrsaroot2017.pki.microsoft.com/ - * Expired: http://exprsaroot2017.pki.microsoft.com/ - */ -public class MicrosoftTLS { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new MicrosoftECCTLS().runTest(pathValidator); - new MicrosoftRSATLS().runTest(pathValidator); - } -} - -class MicrosoftECCTLS { - - // Owner: CN=Microsoft ECC TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Issuer: CN=Microsoft ECC Root Certificate Authority 2017, O=Microsoft - // Corporation, C=US - // Serial number: 33000000282bfd23e7d1add707000000000028 - // Valid from: Thu Jun 24 12:58:36 PDT 2021 until: Wed Jun 24 12:58:36 PDT 2026 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIESTCCA8+gAwIBAgITMwAAACgr/SPn0a3XBwAAAAAAKDAKBggqhkjOPQQDAzBl\n" + - "MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw\n" + - "NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5\n" + - "IDIwMTcwHhcNMjEwNjI0MTk1ODM2WhcNMjYwNjI0MTk1ODM2WjBbMQswCQYDVQQG\n" + - "EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSwwKgYDVQQDEyNN\n" + - "aWNyb3NvZnQgRUNDIFRMUyBJc3N1aW5nIEFPQyBDQSAwMTB2MBAGByqGSM49AgEG\n" + - "BSuBBAAiA2IABMBXcHExvrYrhw7v30oPR4aBaMne5o0FtTtbMV7iqVhTJDQSWDEJ\n" + - "hr528nyS6jcLLu9pLXQMJYxVd7bz4wWXgVtZnnbQ7trAAIPWVh5B6f5eJf5OQ7w7\n" + - "AwJgz3snP5Hx16OCAkkwggJFMA4GA1UdDwEB/wQEAwIBhjAQBgkrBgEEAYI3FQEE\n" + - "AwIBADAdBgNVHQ4EFgQUMVu5zlEbfNGqA8Dr7TZdwp3TieEwHQYDVR0lBBYwFAYI\n" + - "KwYBBQUHAwEGCCsGAQUFBwMCMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMBIG\n" + - "A1UdEwEB/wQIMAYBAf8CAQAwHwYDVR0jBBgwFoAUyMuZcnBSDPjmvrIEVykqz0IQ\n" + - "7TUwcAYDVR0fBGkwZzBloGOgYYZfaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3Br\n" + - "aW9wcy9jcmwvTWljcm9zb2Z0JTIwRUNDJTIwUm9vdCUyMENlcnRpZmljYXRlJTIw\n" + - "QXV0aG9yaXR5JTIwMjAxNy5jcmwwga4GCCsGAQUFBwEBBIGhMIGeMG0GCCsGAQUF\n" + - "BzAChmFodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jv\n" + - "c29mdCUyMEVDQyUyMFJvb3QlMjBDZXJ0aWZpY2F0ZSUyMEF1dGhvcml0eSUyMDIw\n" + - "MTcuY3J0MC0GCCsGAQUFBzABhiFodHRwOi8vb25lb2NzcC5taWNyb3NvZnQuY29t\n" + - "L29jc3AwcAYDVR0gBGkwZzAIBgZngQwBAgEwCAYGZ4EMAQICMFEGDCsGAQQBgjdM\n" + - "g30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtp\n" + - "b3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wCgYIKoZIzj0EAwMDaAAwZQIxANmPydUj\n" + - "lgj/2K77UnMeMkSGIgXzOhcTsixzZL+NmTR1Bq2hSPeA6Y3mn3lMlwxZmAIwIio6\n" + - "KrgItH4YmLWKd8QClIrE9QjbDlR7oFqaU3J34bWbMlAEjRARdZhhQlNwdORe\n" + - "-----END CERTIFICATE-----"; - - // Owner: O=Microsoft Corporation, L=Redmond, ST=Washington, C=US - // Issuer: CN=Microsoft ECC TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Serial number: 3300000154e1c6007ee3d5c903000000000154 - // Valid from: Fri Oct 14 13:44:52 PDT 2022 until: Mon Oct 09 13:44:52 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIF3zCCBWSgAwIBAgITMwAAAVThxgB+49XJAwAAAAABVDAKBggqhkjOPQQDAzBb\n" + - "MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSww\n" + - "KgYDVQQDEyNNaWNyb3NvZnQgRUNDIFRMUyBJc3N1aW5nIEFPQyBDQSAwMTAeFw0y\n" + - "MjEwMTQyMDQ0NTJaFw0yMzEwMDkyMDQ0NTJaMFQxCzAJBgNVBAYTAlVTMRMwEQYD\n" + - "VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy\n" + - "b3NvZnQgQ29ycG9yYXRpb24wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARk86yqvyiv\n" + - "jH2Frg2l6bmh1f0CqiKAEHdA2S2vTQhR4CtvFArkrPdqcKrhAAfQSgnC8KJQ08gl\n" + - "QvjK55202ib55YX3h+96IW6fQOkE18cvPwqkD3DVQuROouLaL1r70NWjggPvMIID\n" + - "6zCCAX8GCisGAQQB1nkCBAIEggFvBIIBawFpAHYA6D7Q2j71BjUy51covIlryQPT\n" + - "y9ERa+zraeF3fW0GvW4AAAGD2EdUigAABAMARzBFAiEA6rbt+9QhpuqX36PnuckO\n" + - "fR0Wu/8z3Yry9fdFKvJDCEUCIGBz901b4ZGEjCaSJdlZVr29v2td4crPa9I6S97i\n" + - "nShAAHYAs3N3B+GEUPhjhtYFqdwRCUp5LbFnDAuH3PADDnk2pZoAAAGD2EdU/wAA\n" + - "BAMARzBFAiBIvnSKGeCIWOlZowi7s7ZdwmyGhv2waJWSdewUSS6UOAIhALJhPQ19\n" + - "nmjjTwWB9sgCIF7RZbd2xwBd1hno06MQMSqTAHcAejKMVNi3LbYg6jjgUh7phBZw\n" + - "MhOFTTvSK8E6V6NS61IAAAGD2EdUxwAABAMASDBGAiEArrc6Fu74KTj/z4lGCK9A\n" + - "O6UkhLpKnXdxEHilY7ghcZICIQCUjkvK4wehX1q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Aty4rA+yuliwCag88VnDRH\n" + - "9cjiongZgpddIYS8xf76B2pi/Q==\n" + - "-----END CERTIFICATE-----"; - - // Owner: O=Microsoft Corporation, L=Redmond, ST=Washington, C=US - // Issuer: CN=Microsoft ECC TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Serial number: 3300000155ea28117be8708034000000000155 - // Valid from: Fri Oct 14 13:50:39 PDT 2022 until: Mon Oct 09 13:50:39 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIF3TCCBWOgAwIBAgITMwAAAVXqKBF76HCANAAAAAABVTAKBggqhkjOPQQDAzBb\n" + - "MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSww\n" + - "KgYDVQQDEyNNaWNyb3NvZnQgRUNDIFRMUyBJc3N1aW5nIEFPQyBDQSAwMTAeFw0y\n" + - "MjEwMTQyMDUwMzlaFw0yMzEwMDkyMDUwMzlaMFQxCzAJBgNVBAYTAlVTMRMwEQYD\n" + - "VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy\n" + - "b3NvZnQgQ29ycG9yYXRpb24wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARbimHzMojc\n" + - "ilBoJCu+adc99oS855DwGTmkKofXfEf6Ej6G9v6Zg1Y2a1wqs5Wd3IcqQONeqKK8\n" + - "EGxUL7DBpf1dBDsRpWSfenYIRtAzs/JznW0dfGPgnY0kGi4g52JegCOjggPuMIID\n" + - "6jCCAX4GCisGAQQB1nkCBAIEggFuBIIBagFoAHUArfe++nz/EMiLnT2cHj4YarRn\n" + - "KV3PsQwkyoWGNOvcgooAAAGD2EyY+gAABAMARjBEAiBnysZazdmXKeL4CnYkJxI2\n" + - "g5juWT5jQfBi5Nxfc3zc9gIgGSGTTGw+E0864BRuAJjhFRF+j5keQ7Rik+PhGnd1\n" + - "P1gAdgB6MoxU2LcttiDqOOBSH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0cDovL3d3dy5taWNyb3NvZnQuY29t\n" + - "L3BraW9wcy9Eb2NzL1JlcG9zaXRvcnkuaHRtMAgGBmeBDAECAjAfBgNVHSMEGDAW\n" + - "gBQxW7nOURt80aoDwOvtNl3CndOJ4TATBgNVHSUEDDAKBggrBgEFBQcDATAKBggq\n" + - "hkjOPQQDAwNoADBlAjBBhbuh/iukcibeEh/Op3RfNf6jUSyza4lZvsJsRiEVwySa\n" + - "ofmg8OvBO2l2+9MjoCUCMQCoiyS1tDgtjW9gguKDgPXypURpL27KfnCzwx6ar2LN\n" + - "gCZ/soGnLsgPIscuNH/BK20=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Fri Oct 14 15:46:18 PDT 2022", System.out); - } -} - -class MicrosoftRSATLS { - - // Owner: CN=Microsoft RSA TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Issuer: CN=Microsoft RSA Root Certificate Authority 2017, O=Microsoft - // Corporation, C=US - // Serial number: 330000002ffaf06f6697e2469c00000000002f - // Valid from: Thu Jun 24 13:57:35 PDT 2021 until: Wed Jun 24 13:57:35 PDT 2026 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIHmDCCBYCgAwIBAgITMwAAAC/68G9ml+JGnAAAAAAALzANBgkqhkiG9w0BAQwF\n" + - "ADBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u\n" + - "MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y\n" + - "aXR5IDIwMTcwHhcNMjEwNjI0MjA1NzM1WhcNMjYwNjI0MjA1NzM1WjBbMQswCQYD\n" + - "VQQGEwJVUzEeMBw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qBNp0H5q/V2R31Wi8rijHGQ\n" + - "4CxHqzP5VJbjgvRQgxAp39BrmLQ+JSvf9e5VqQqaH4NYgpB1WObq12B73BJHjBOv\n" + - "pRrULFjPqDW8sPRBzBTRXkXOPEdZbzQj6O/CWEFsg6ilO4thk3n3drb9FEJjVh9u\n" + - "GtRXV6Ea5bNaPvJppZNXb7M9mORk3mddx/K1FgOETQE3quh+mU4ojbSRUWMVmjcb\n" + - "6bKF5oQd+Q0do4yaEIfH1oVnIas/FIE/xu3Z4fvBs0qdiNLCeNT6uS26vqD2PEvV\n" + - "lFWb683Do3Ls59MMCxhy6Erb7kFQgu1oUWXGFhbMQkeLN4TXGi6X3loXYfING9om\n" + - "nWa/udxvPRwAZmcHU2l2W8cwVXiy6uucsh3kPQ==\n" + - "-----END CERTIFICATE-----"; - - // Owner: O=Microsoft Corporation, L=Redmond, ST=Washington, C=US - // Issuer: CN=Microsoft RSA TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Serial number: 330000014a3b44c12636e54b9f00000000014a - // Valid from: Fri Oct 14 13:55:34 PDT 2022 until: Mon Oct 09 13:55:34 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIILDCCBhSgAwIBAgITMwAAAUo7RMEmNuVLnwAAAAABSjANBgkqhkiG9w0BAQwF\n" + - "ADBbMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u\n" + - "MSwwKgYDVQQDEyNNaWNyb3NvZnQgUlNBIFRMUyBJc3N1aW5nIEFPQyBDQSAwMTAe\n" + - "Fw0yMjEwMTQyMDU1MzRaFw0yMzEwMDkyMDU1MzRaMFQxCzAJBgNVBAYTAlVTMRMw\n" + - "EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN\n" + - "aWNyb3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n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i6/yiQ0Vx6rBMSKmEzkZx72Xkh9IowCeZJ\n" + - "w/gstrzKepSljWUuNi2iXJB2OuIqydFodLXFc9eeH8MXShDqwFF77nf3R3jMAhvI\n" + - "6fHnEz7+UqhMuyiAU5TfSjC1WyeqHhDZawWPumFyXEh0XX1eUphfoN3bApbZJhEE\n" + - "tyhcz44mGawrjSpxlJGgE5TmKJ+CC73TcBC5Ehelo+Is1gzbbVQCu6gMZQyYS8qf\n" + - "kg+JqJAOfx+YFn4bPAio8uF6XpcvMkcd9dyEYi2Q9zMhnQoOjLWj0pPSQaCBmmbI\n" + - "ougVo16GCOdcOG9+c6dBjbHseaQY0a95ZirtNLbutIvmvMIysvAHMC3NkunnD0cQ\n" + - "BxF47+meDc80QJGCaNlJ8E1SlUbEtRfVNsbcw1skO3hAsYAIA8M//BW7XcKRDvLn\n" + - "nPrC+5fWtDzmXgUE/Sve3rCr/AfBiBrLERcJHxYy41U=\n" + - "-----END CERTIFICATE-----"; - - // Owner: O=Microsoft Corporation, L=Redmond, ST=Washington, C=US - // Issuer: CN=Microsoft RSA TLS Issuing AOC CA 01, O=Microsoft Corporation, C=US - // Serial number: 330000014b4c2b0b9955688feb00000000014b - // Valid from: Fri Oct 14 13:56:58 PDT 2022 until: Mon Oct 09 13:56:58 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIIKjCCBhKgAwIBAgITMwAAAUtMKwuZVWiP6wAAAAABSzANBgkqhkiG9w0BAQwF\n" + - "ADBbMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u\n" + - "MSwwKgYDVQQDEyNNaWNyb3NvZnQgUlNBIFRMUyBJc3N1aW5nIEFPQyBDQSAwMTAe\n" + - "Fw0yMjEwMTQyMDU2NThaFw0yMzEwMDkyMDU2NThaMFQxCzAJBgNVBAYTAlVTMRMw\n" + - "EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN\n" + - "aWNyb3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n" + - "AoIBAQD2UxPzrv61IqG8jCFPWM3KeQpBeBlxh3mzvWVFmo340r0J1C3uLaUTPYLo\n" + - "P+Xndq2GqYLlm/5FEY7ynU1as57SH0tHbKCIYYJezn/ZJHUYcOY80uGKpP3bdbRq\n" + - "W51Xo7/gzTrXFJ2Nrn05d9mKBq+Oxs71+Nj7QuzjHYAF0n8OWNwZCBOBdAX3EDVQ\n" + - "4HBMSkIzriodM0FD2zkT8RIvZ7WbpLxvZXqWbynAeLirTRYE2lY9UalxrP+wCef9\n" + - "DARxcpEgF30nwRnALfOhnuOhdrtdLYhArfQMyDcvJnDyzCWEZCaPNtBhdsziJjf9\n" + - "A8R4/qdnlQE4/24O9MXQja5dwyyRAgMBAAGjggPsMIID6DCCAXwGCisGAQQB1nkC\n" + - "BAIEggFsBIIBaAFmAHYA6D7Q2j71BjUy51covIlryQPTy9ERa+zraeF3fW0GvW4A\n" + - "AAGD2FJirgAABAMARzBFAiBct8qI4aiBtisWWMKAtwCueQWAnFtxcrGBiZjwctiB\n" + - "pwIhAPasvYgCS4Rbhb6p2//TCeq0P2H3jUftmi0afwhJYXLaAHUAs3N3B+GEUPhj\n" + - "htYFqdwRCUp5LbFnDAuH3PADDnk2pZoAAAGD2FJjIwAABAMARjBEAiBjbry24wGs\n" + - "tpzJFzxWAk7h3IHMKiY1KxIieJMBe7k1dQIgPvDrVgOiUeWlYJmDSdRafTVZHfQg\n" + - "bODj86WqyB5ndt4AdQB6MoxU2LcttiDqOOBSHumEFnAyE4VNO9IrwTpXo1LrUgAA\n" + - "AYPYUmLUAAAEAwBGMEQCIHlmAPOJT2CSJPnupJqbiUOE8nukIuNxaayaEROQQC16\n" + - "AiBufiWDUp9FNjGdZVhjX3t/Bh3iSNrMJD22k5BcNzUbIjAbBgkrBgEEAYI3FQoE\n" + - "DjAMMAoGCC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ljDZfHNmzdVTSVlqzhliv2cRuZyk7lf1LoIXBTz3Y\n" + - "6ofOjgsP05XEZmMxMwM40FVeslTfuu301plj5KuHpQfbSny0VES3DQnZi+gHX+Zn\n" + - "XuIYQL9stePqQr1GJBqAHM4sRgUCnW5t8efIYDMpYhQynXbniowLGbXOa0OP1IFG\n" + - "oGmhPRonR1aJ2eFBfe0pnc4WO5qdiXQp/XWWYmUJaD7SdGDQF7wH9BUJdldIk6uI\n" + - "SGTh4YD2VAXAGH4e9wHI5t9Lyah/VeBoLU1j3SsJfL6XfcWCwFG2sdqFFQHcONBl\n" + - "ApIjebH4RlOGiRRRJ5/Wz9Wk850mEvF16UlB1MUpLiKU63/nJvuR1TvOisAUl+5L\n" + - "oAfBFVkX4IGJU+9tc4VXYvTpd24xLHk/o6Fnl23D6zWlsZKldNxYPhiriXN9Duvb\n" + - "6xmaQX4gua6jmTFUhKDyyVJpW1A4GjuenPYsCmabzydiAeMIQirCCLSTqXrSw1YL\n" + - "2+608l1nqYy1JOrSq/zFp3c5buSFbjj7jVJB5LEh\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Fri Oct 14 15:46:18 PDT 2022", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java deleted file mode 100644 index e171bafe1ad..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8189131 8207059 - * @key intermittent - * @summary Interoperability tests with QuoVadis Root CA1, CA2, and CA3 G3 CAs - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath QuoVadisCA OCSP - * @run main/othervm -Djava.security.debug=certpath QuoVadisCA CRL - */ - -/* - * Obtain TLS test artifacts for QuoVadis CAs from: - * - * https://www.quovadisglobal.com/download-roots-crl/ - * - */ -public class QuoVadisCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - new RootCA1G3().runTest(pathValidator); - new RootCA2G3().runTest(pathValidator); - new RootCA3G3().runTest(pathValidator); - } -} - -class RootCA1G3 { - - // Owner: CN=DigiCert QuoVadis TLS ICA QV Root CA 1 G3, O="DigiCert, Inc", C=US - // Issuer: CN=QuoVadis Root CA 1 G3, O=QuoVadis Limited, C=BM - // Serial number: 2837d5c3c2b57294becf99afe8bbdcd1bb0b20f1 - // Valid from: Wed Jan 06 12:50:51 PST 2021 until: Sat Jan 04 12:50:51 PST 2031 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFgDCCA2igAwIBAgIUKDfVw8K1cpS+z5mv6Lvc0bsLI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BggrBgEF\n" + - "BQcDATA7BgNVHR8ENDAyMDCgLqAshipodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFs\n" + - "LmNvbS9xdnJjYTFnMy5jcmwwHQYDVR0OBBYEFJkRfemwrS1iWnDTPI2HIK3a2i5B\n" + - "MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAb6tTptzzi4ssb+jA\n" + - "n2O2vAjAo7ydlfN9v+QH0ZuGHlUc9bm8dpNpBo9yt6fWHIprGLJjVOF7HwVDQcJD\n" + - "DhX4638Q7ETDrbTVQ4/edX6Yesq6C1G8Pza1LwStXD/jCQHFvWbPud86V0ikS4rS\n" + - "qlmu3fzUrGZ2/Q+n5jrnRqM5IS8TXYcnzLD3azH1+aZjkwQt9HP4IuvAe/Bg9aWE\n" + - "XeDmksbg0SqQInrWn+BVYtD+hCZNz8K0GnKKpx3Q9VxzRv+BMbO5e9iqK1Hcj5Wv\n" + - "ZXvU45j2r5y9WML4fc8CvphzbF6ezr1e51i+yabNmfld33gRX48V5oNk16wX32ed\n" + - "kQ83sKNomQm1dXURWK8aSDcZFAvJQ8vKTLIE9wiQmtjfSGoJzQhKLaN+egrp4L9y\n" + - "fjpFIeK4zgAH39P4s4kaPWTdfXe2n6P5o7Xolp4R22SVkI76d8d+5Iv7Rtqd+mqI\n" + - "y1hkwyTBbOBLtyF7yMtJQewkkZ0MWxkPvWg193RbYVRx8w1EycnxMgNwy2sJw7MR\n" + - "XM6Mihkw910BkvlbsFUXw4uSvRkkRWSBWVrkM5hvZGtbIJkqrdnj55RSk4DLOOT/\n" + - "LUyji/KpgD7YCi7emFA4tH6OpkNrjUJ3gdRnD4GwQj/87tYeoQWZ6uCl0MHDUCmw\n" + - "73bpxSkjPrYbmKo9mGEAMhW1ZxY=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-1-g3.chain-demos.digicert.com, O="DigiCert, Inc.", - // L=Lehi, ST=Utah, C=US - // Issuer: CN=DigiCert QuoVadis TLS ICA QV Root CA 1 G3, O="DigiCert, Inc", C=US - // Serial number: a94cc08600f5fe5d3f0659bfcfec6f0 - // Valid from: Fri Mar 04 16:00:00 PST 2022 until: Wed Apr 05 16:59:59 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIG/DCCBeSgAwIBAgIQCpTMCGAPX+XT8GWb/P7G8DANBgkqhkiG9w0BAQsFADBZ\n" + - "MQswCQYDVQQGEwJVUzEWMBQGA1UECgwNRGlnaUNlcnQsIEluYzEyMDAGA1UEAwwp\n" + - "RGlnaUNlcnQgUXVvVmFkaXMgVExTIElDQSBRViBSb290IENBIDEgRzMwHhcNMjIw\n" + - "MzA1MDAwMDAwWhcNMjMwNDA1MjM1OTU5WjB9MQswCQYDVQQGEwJVUzENMAsGA1UE\n" + - "CBMEVXRhaDENMAsGA1UEBxMETGVoaTEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4x\n" + - "NzA1BgNVBAMTLnF1b3ZhZGlzLXJvb3QtY2EtMS1nMy5jaGFpbi1kZW1vcy5kaWdp\n" + - "Y2VydC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3HrwaCagg\n" + - "6bxmgEC+neLN/ShfNYuOMQ2Slk5q/zDUhQRpNQnh3nUwoRSWRvwGxDFsRj++LECF\n" + - "TMdfzIu+0rlFzGqd3B5mlRsJrcycy/+ILwGNtIooUSU7pvJAVgLZ5N1SSVZoY+i3\n" + - "bqLiMmv2/JfouT1SQB3U0tGmS+QKyBtVyKPVeuAhnLdyw90UiB7Gu9qXQpCawac8\n" + - "pXPQLFzyEP7VJO0wDXanXvi6YPuIhh4m+j2YVCd9d2zI3y3kOrkuaUY5UCBvMG/b\n" + - "Pc7/5pBsqf+E+7RHF24JAR2aqXzARWt2MzRiwpE/DJDfu097IUtR5aEdCRIKw/b4\n" + - "GcHEbVaE3c8RAgMBAAGjggOaMIIDljAfBgNVHSMEGDAWgBSZEX3psK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n3\n" + - "0lGGmEpnZP9dZw375SuVX6OjAiBbfpZesx7GgSNygEF+zkBAXx+AFJF5GoGiOjFX\n" + - "0ykjDAB2ALNzdwfhhFD4Y4bWBancEQlKeS2xZwwLh9zwAw55NqWaAAABf1w80SoA\n" + - "AAQDAEcwRQIgfSXjtjuKjFiVYwdlitFNgTTSc7uP9hyazlrCKO9GsaYCIQCKimXl\n" + - "j4LjJ4BlG9H1J+V747tuf7ONnAzkCPsa2ymOuzANBgkqhkiG9w0BAQsFAAOCAQEA\n" + - "b9havJS9egan+4dgMhI6gDt6rjdWRniyi7kXv7/vWJXOxR1xl2d/WYDLsfp3BbqW\n" + - "YuKQwB5tTH1hEoNhQIyGnuE1Y1ZgtX24rSVfTCkU/3dnTZaIhaZgFHyftAum7xSI\n" + - "Qzu7pwih+PXrGNXupsnZ+VUE7a7zHyRDajixhSp7dZS4zLoDTxeyKX0MDmo4e8Mi\n" + - "HNYVASYcrdld90jVJaeI/V3EkJAX7/Eyo9JqzivEwGM0e0JhCLekcVSzhjGoAlbQ\n" + - "tIzCIaeVUlWKKiNXSKr1WD4oCD3ky4Y5VekTGzyUf/0LYzV+Y7p8epc5vTWKwYx/\n" + - "vQwJ4RsgFit+c84mSg4qug==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-1-g3-revoked.chain-demos.digicert.com, - // O="DigiCert, Inc.", L=Lehi, ST=Utah, C=US - // Issuer: CN=DigiCert QuoVadis TLS ICA QV Root CA 1 G3, O="DigiCert, Inc", C=US - // Serial number: e7eff4cdd14ebed1daa7bb7e07300ed - // Valid from: Fri Mar 04 16:00:00 PST 2022 until: Wed Apr 05 16:59:59 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHDjCCBfagAwIBAgIQDn7/TN0U6+0dqnu34HMA7TANBgkqhkiG9w0BAQsFADBZ\n" + - "MQswCQYDVQQGEwJVUzEWMBQGA1UECgwNRGlnaUNlcnQsIEluYzEyMDAGA1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p/BjAN\n" + - "BgkqhkiG9w0BAQsFAAOCAQEAFrVjcQxq81PXEgHCf48+FOle8kUpJGxpH1n1Sp0p\n" + - "V95wrXj47oT1Vt9WqXPrNDfDkxwAvvXrCMXjHEg2YN0FCEanVec8GciuRRRtXrOE\n" + - "QOXAqGv5j+KG7bEvMNUFS90fesxfxVAQkr1zIT70nMAOKV1NOyQ/q8bZ+jehcRZB\n" + - "wUKrCWAzvOw4DPytrDcQmflvQN+Bw92T3uDuoYT/oBcobpVfKpfuW/+ZxxXTIp4L\n" + - "sixlx82SZNTo6e3LOqsgZnR6TFyRJ63sK65M+W0d55bHvleUAHRCOiGhhgqE/cby\n" + - "z50hDzJMLnjskMSpkxMoeSeutAS2e7oIvA//7C37LrQccQ==\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) - throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 08 11:22:28 PST 2022", System.out); - } -} - -class RootCA2G3 { - - // Owner: CN=DigiCert QV EV TLS ICA G1, O="DigiCert, Inc.", C=US - // Issuer: CN=QuoVadis Root CA 2 G3, O=QuoVadis Limited, C=BM - // Serial number: 65e9bcd53e791df22dffeb5ecc2bc7a5588d0883 - // Valid from: Mon Mar 16 12:39:42 PDT 2020 until: Thu Mar 14 12:39:42 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFbzCCA1egAwIBAgIUZem81T55HfIt/+tezCvHpViNCIMwDQYJKoZIhvcNAQEL\n" + - "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" + - "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0yMDAzMTYxOTM5NDJaFw0z\n" + - "MDAzMTQxOTM5ND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R39LX8M63EjiNxx0LThZHROqYqev6\n" + - "5ox/c5NNitk8/ODA8osdPpvnUBAlmE0+gqBvnTBRPVrJFd9bOr5BK8z6Os9/U0ed\n" + - "c3UINkWLS05B7ChC9s6Zw1Vd/WlW08TQJ80GpvAIbEKcg8EO/DXPniHxC4cMtv1T\n" + - "jtNeh98XiVgQXHL1FY+u/l413J8C4utKi4ZOQeCJDqvlSDzRsOi+tHsXrCJxnMWN\n" + - "2QBgMGgdPW37zwf0EffoH0Gee3pTgg7I5SzmvBq0t5xRDfv4N0OdM/sN1mc5f3o7\n" + - "0YCd9WXhyDCV5W2O8QIbrd42CK5k1rlM6gXwOyDmYY5CVAl1QeXEeRfDk/zNjU/1\n" + - "+LnH/Dv88VcZhODYq+VGbyM8bpNr0v95PY3yaH4kzpWGqWAN5i9LosfcaqRPmyL4\n" + - "PcKTQwcA9AVTjITExFua/QtGrXLPvMVxR248G9IQpJMxP3JEGkjlKCenmc29r2u1\n" + - "KE4TeCs2xxjR1PusTfX91bBW3YAoAPDTRQKZjolegLUY44j3uKSzAdhMEbZQhovH\n" + - "Lraqx1WjTayTuq1Vuakcia5shmgFVSNcE+NVgLEIe32oTOm/G6Kd1lcm9C4Ph1Cg\n" + - "nfDuqohZrk76kJTk8poAY5aFCQHhVzbpSw3zooMGjjvWnkG+/DC6SZM8rKoOdKiB\n" + - "cy+N\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-2-g3.chain-demos.digicert.com, O="DigiCert, - // Inc.", L=Lehi, ST=Utah, C=US, SERIALNUMBER=5299537-0142, OID.1.3.6.1.4 - // 1.311.60.2.1.2=Utah, OID.1.3.6.1.4.1.311.60.2.1.3=US, - // OID.2.5.4 .15=Private Organization - // Issuer: CN=DigiCert QV EV TLS ICA G1, O="DigiCert, Inc.", C=US - // Serial number: 9c5e9d5f169d3a59e64db208d3e849d - // Valid from: Wed Feb 02 16:00:00 PST 2022 until: Mon Mar 06 15:59:59 PST 2023 - private static final String VALID = "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Gc7WuE\n" + - "r+bLfnQoerq9KB1bAHYAs3N3B+GEUPhjhtYFqdwRCUp5LbFnDAuH3PADDnk2pZoA\n" + - "AAF+wdwZZAAABAMARzBFAiEA4vYazXAaD1BfJ8MqEmrfxeTIDQ6LZkmqfh8xEnVz\n" + - "8VYCIF/RgfyBhOeH40wfgwpFTa+Y+t7EWg0PtjC4IaIFTKYKMA0GCSqGSIb3DQEB\n" + - "CwUAA4IBAQC5KLlms/+5XcCIEFBpQSwT7VoRcqnrVWlhya+9ClA98LYuDUeHcHt6\n" + - "lHvfjEEmy2s2GoKHK/JxXzftBau5LbDWlvQ6EF+22fnaVDsKIwNgYwbhJb+6zr8t\n" + - "LOFS6Y51YSlRrDUvy94S3PE7N8D3wyKq18IhXOI1WUeR0bKHLlXtl+ZjKMIMkd/l\n" + - "YtLnnskRCQa0P/HLwQYLUpgiNGVZJQbjrWsVzcw12mR/gza1KjR02STJRGZad7L0\n" + - "Oz48CRhm94iaEjFcVKT3vcDUrtCKpkmhBACcdA3NNqDq10i/SLspOeDLSESkkJKF\n" + - "w8w3YCqXjZn5JyV3sVHYNezNKtLdCxn4\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-2-g3-revoked.chain-demos.digicert.com, - // O="DigiCert, Inc.", L=Lehi, ST=Utah, C=US, SERIALNUMBER=5299537-0142, - // OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.2=Utah, - // OID.1.3.6.1.4.1.311.60.2.1.3=US - // Issuer: CN=DigiCert QV EV TLS ICA G1, O="DigiCert, Inc.", C=US - // Serial number: 3f84605850df3ac98fcc15adec269f8 - // Valid from: Sun Apr 17 17:00:00 PDT 2022 until: Fri May 19 16:59:59 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHQDCCBiigAwIBAgIQA/hGBYUN86yY/MFa3sJp+DANBgkqhkiG9w0BAQsFADBK\n" + - "MQswCQYDVQQGEwJVUzEXMBUGA1UECgw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2c222TK\n" + - "sWkL5sLFqLVZj2vOugIhAODd/OUy236+9alC2U5nxl1oej9fOF4por2OZMFQfpFF\n" + - "MA0GCSqGSIb3DQEBCwUAA4IBAQAyrJzyOiRAETfoYddTmRmbnFNuHx4YAkkdxn2d\n" + - "BXdy4jPn0kTtDo4592KnbTdieSCWghmEmcEY1sQXdX6iqKwzmp408jfUDohl5evV\n" + - "oZrum3P3zgLRz1qswFM5a2HteWzCWWi/n6d6nKXj6PGGVAMQfk1s6PaWhYBuiaag\n" + - "myYss/LTPzaLGUfFzlt/HfomiD+BNuBOVa+pPrmTWhex+e02z95n6RPYCiazuZNZ\n" + - "xiarN83pRNu/fIjVXw2jENg7+kaC1wwLqET0x6/EJa6YI3Xa7Aumb8Pp2r2UZ5Tr\n" + - "7BUhmiRLkvw/9SI8ceXNSwuTTGK2fKHm2/CWqI0cS3zWk3dC\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) - throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Apr 18 14:07:46 PDT 2022", System.out); - } -} - -class RootCA3G3 { - - // Owner: CN=DigiCert QuoVadis TLS ICA QV Root CA 3 G3, O="DigiCert, Inc", C=US - // Issuer: CN=QuoVadis Root CA 3 G3, O=QuoVadis Limited, C=BM - // Serial number: 427dd33a8ff51d8152e813c7dec93ba76312a7d8 - // Valid from: Wed Jan 06 12:55:40 PST 2021 until: Sat Jan 04 12:55:40 PST 2031 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFgDCCA2igAwIBAgIUQn3TOo/1HYFS6BPH3sk7p2MSp9gwDQYJKoZIhvcNAQEL\n" + - "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" + - "BgNVBAMTFVF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wwHQYDVR0OBBYEFDNm+y+RBcyzYlLvzTz1fhzOpxeW\n" + - "MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAY0ZuDgyM4I4MO9ll\n" + - "D8qFUPQ8xtcGOuJgSRhDS2onIJ0M8yOGOYJCobIEGIgqyx94kI/n/1Xw+Wvsnhwb\n" + - "OYOtVedx6VGDu6IuSKTVgPPhzwKP5ZA7wtmgKR8+W4E3DM1VerA9Po9ycDK9qCdl\n" + - "K4tuF37grKEzlQKovG+kn0z+Zi0D/E1kN1Q8YmX35HHRenJWKEnAL9QROh0X9jFi\n" + - "SlsHPrxWC3adOdAW+B+kVG0cM2nurd0Ic2YkiLKOOaSd5hbCQY/fCZwohtest+ZU\n" + - "Ajyd+FVzSNvEFrwPzZwKfcdemvD4kew8lx5sG6BUL4GkFWnotxSr+F9Huwgj4pC+\n" + - "cxE2841a/9r/gliuwDM/8jkt16epFAdw0fXemyM8FdHJDnB++3d8SyjOOQ8j+VHW\n" + - "31NWx27sORa5CgRchlldXWDzIIEwbc82a1OAfGUmNAsdEHjMl1HMcZHbjCmdSdsw\n" + - "fmyldZrj2YmvOI5ZlE9z4vzi35KyqlxWCtu9O/SJq/rBvYS0TPmm8HbhJQbeMe6p\n" + - "vJGrxcb1muSBANn9T9wvukjiNNw32ciSDCjZ0h4N+CGxbzoZtgIAQ29IunYdnJix\n" + - "ZiP+ED6xvwgVRBkDSgWD2W/hex/+z4fNmGQJDcri51/tZCqHHv2Y7XReuf4Fk+nP\n" + - "l8Sd/Kpqwde/sJkoqwDcBSJygh0=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-3-g3.chain-demos.digicert.com, O="DigiCert, Inc.", - // L=Lehi, ST=Utah, C=US - // Issuer: CN=DigiCert QuoVadis TLS ICA QV Root CA 3 G3, O="DigiCert, Inc", C=US - // Serial number: f27ee3fad1d754ae78d7866da0a4f6f - // Valid from: Fri Mar 04 16:00:00 PST 2022 until: Wed Apr 05 16:59:59 PDT 2023 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIG/jCCBeagAwIBAgIQDyfuP60ddUrnjXhm2gpPbzANBgkqhkiG9w0BAQsFADBZ\n" + - "MQswCQYDVQQGEwJVUzEWMBQGA1UECgwNRGlnaUNlcnQsIEluYzEyMDAGA1UEAwwp\n" + - "RGlnaUNlcnQgUXVvVmFkaXMgVExTIElDQSBRViBSb290IENBIDMgRzMwHhcNMjIw\n" + - "MzA1MDAwMDAwWhcNMjMwNDA1MjM1OTU5WjB9MQswCQYDVQQGEwJVUzENMAsGA1UE\n" + - "CBMEVXRhaDENMAsGA1UEBxMETGVoaTEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4x\n" + - "NzA1BgNVBAMTLnF1b3ZhZGlzLXJvb3QtY2EtMy1nMy5jaGFpbi1kZW1vcy5kaWdp\n" + - "Y2VydC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDOZpBBS8yo\n" + - "ioVgFUQDCVcnkHTL4/PfaPKGK1owE0+mKz1AXmYX1rzFfp6gFqjbZeclhWCKoINE\n" + - "OrZ2+1mGp75+nCP89NgoGzPgjYLVsM97gN2Y36/jXu8TwsZdYfBw9gxL+YApvq2r\n" + - "NbPfxXaYfWdq8bz0RzqXRgS8BqKi1q8tKyahx5EJ3fCpozY9NPvCnipwbWXL9evF\n" + - "Oak3c5Ip2YME4mHh8PujrznCVBte7KGLDn2KwbOUbh5SKKBL32vzTPOERWEDMbAu\n" + - "3XqQh/cc4LTp32Lf/XkfnUOSbzNh+Te8ZjeDzI+SYNg9bleKpPxLSkBZyurs4mCD\n" + - "92L8BXPlMaGjAgMBAAGjggOcMIIDmDAfBgNVHSMEGDAWgBQzZvsvkQXMs2JS7808\n" + - "9X4czqcXljAdBgNVHQ4EFgQUnf71SuL2Z73DAgGKgO7UVFDBIkgwOQYDVR0RBDIw\n" + - "MIIucXVvdmFkaXMtcm9vdC1jYS0zLWczLmN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bFnDAuH3PADDnk2pZoAAAF/XBsl\n" + - "BwAABAMARzBFAiEAsHzOaXv9OIo4RvaKUEscoLpnM98C+4hc6v4Z26d41aICIC2o\n" + - "aTrc5JsqgDhJXp7UArQPziUqDso967W2mrLa0nLdMA0GCSqGSIb3DQEBCwUAA4IB\n" + - "AQC2CaUwlIb+uKsELGw5U2KV0q8uMp/nBIyFaW/HNOJUf8j1keaf31WWBAFfUQVY\n" + - "pzFRUnRmNTtGxCvzyY1YhoQSwswGghz8ZCSQPWCST/Tl8kKuVFas8wSUXaEV23t4\n" + - "G0pfIlXL2oIuJwREjzv54SK7xsQ4whco0nw8DvLt+/5us4t96u8r1EuBKkF45ngz\n" + - "t77MTqpa0nvWUT7q9POT7xwQNui7P0j5t7prVX/fBKm5EfK1Jdi1Toj9+VxTIWYk\n" + - "splUCXw7zxaA3nlrncAmnHxZEY8sQjpGY1OGY0udd+m5bldJNbRTA1Q+VoPVMiU6\n" + - "osdBQGUbbWrqm1fnoFW1VvUt\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=quovadis-root-ca-3-g3-revoked.chain-demos.digicert.com, - // O="DigiCert, Inc.", L=Lehi, ST=Utah, C=US - // Issuer: CN=DigiCert QuoVadis TLS ICA QV Root CA 3 G3, O="DigiCert, Inc", C=US - // Serial number: aafa7cafda91796626f5fc8bcb38702 - // Valid from: Fri Mar 04 16:00:00 PST 2022 until: Wed Apr 05 16:59:59 PDT 2023 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHDTCCBfWgAwIBAgIQCq+nyv2pF5Zib1/IvLOHAjANBgkqhkiG9w0BAQsFADBZ\n" + - "MQswCQYDVQQGEwJVUzEWMBQGA1UECgwNRGlnaUNlcnQsIEluYzEyMDAGA1UEAwwp\n" + - "RGlnaUNlcnQgUXVvVmFkaXMgVExTIElDQSBRViBSb290IENBIDMgRzMwHhcNMjIw\n" + - "MzA1MDAwMDAwWhcNMjMwNDA1MjM1OTU5WjCBhTELMAkGA1U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vDTNxFOO6IG2vfR\n" + - "+JAUnS9iVUQ1rXHU72cxUsne5aRyLQ0W/2Zayx85O6/C9gIUJgJVRuk0dTPZ6tnq\n" + - "FoW1S4GwqEpzTuJU8rP5IvMYoYo8jItpjzS0W90gtDvev/XBRs1ig28Ky7ZS5AtQ\n" + - "S2Q6Ikg9YzegE9YNj2wqdZnEneoce0G1InysM/geY1BZ57G9RAUZkzWVTJRLJgbg\n" + - "2nWSqpQJ765gg9JdsRo+zqj1kUBbUYoTSlaAJG6ucrlB\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator) - throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Tue Mar 08 11:23:06 PST 2022", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SSLCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SSLCA.java deleted file mode 100644 index 1d31833398b..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SSLCA.java +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8243320 - * @summary Interoperability tests with SSL.com's RSA, EV RSA, and ECC CA - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath SSLCA OCSP - * @run main/othervm -Djava.security.debug=certpath SSLCA CRL - */ - -/* - * Obtain TLS test artifacts for SSL.com CAs from: - * - * SSL.com RSA CA - * Valid - https://test-dv-rsa.ssl.com - * Revoked - https://revoked-rsa-dv.ssl.com/ - * SSL.com EV RSA CA - * Valid - https://test-ev-rsa.ssl.com - * Revoked - https://revoked-rsa-ev.ssl.com/ - * SSL.com ECC CA - * Valid - https://test-dv-ecc.ssl.com - * Revoked - https://revoked-ecc-dv.ssl.com/ - */ -public class SSLCA { - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - boolean ocspEnabled = false; - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - ocspEnabled = true; - } - - new SSLCA_RSA().runTest(pathValidator, ocspEnabled); - new SSLCA_EV_RSA().runTest(pathValidator, ocspEnabled); - new SSLCA_ECC().runTest(pathValidator, ocspEnabled); - } -} - -class SSLCA_RSA { - - // Owner: CN=SSL.com RSA SSL subCA, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Issuer: CN=SSL.com Root Certification Authority RSA, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Serial number: 997ed109d1f07fc - // Valid from: Fri Feb 12 10:48:52 PST 2016 until: Wed Feb 12 10:48:52 PST 2031 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIGbzCCBFegAwIBAgIICZftEJ0fB/wwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE\n" + - "BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK\n" + - "DA9TU0wgQ29ycG9yYXRpb24xMT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zxvmr9JQcFTsP2c\n" + - "bRbjaT7JD6MBidAWRCJWClR/5etTZwWwWrRCrzvIHC7WO6rCzwu69a+l7ofCKlWs\n" + - "y702dmPTKEdEfwhgLx0LxJr/Aw==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=test-dv-rsa.ssl.com - // Issuer: CN=SSL.com RSA SSL subCA, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Serial number: 4ceada4ade82a6ccd0b2ae32c0dbfd62 - // Valid from: Fri Jun 28 07:06:50 PDT 2019 until: Sun Jun 27 07:06:50 PDT 2021 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHTjCCBTagAwIBAgIQTOraSt6CpszQsq4ywNv9YjANBgkqhkiG9w0BAQsFADBp\n" + - "MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0b24x\n" + - "GDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjEeMBwGA1UEAwwVU1NMLmNvbSBSU0Eg\n" + - "U1NMIHN1YkNBMB4XDTE5MDYyODE0MDY1MFoXDTIxMDYyNzE0MDY1MFowHjEcMBoG\n" + - "A1UEAwwTdGVzdC1kdi1yc2Euc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n" + - "ADCCAQoCggEBAKlOrYr8fnHN8REfJDwgsBhJvnsU4beQIYYaOAzR8pmo8eq1U/K0\n" + - "uwRrgJ5K61V78zBO5qmZNiivBobViftObWrq2H6QhQsYdMYXld3SEnEotIIriRHY\n" + - "2PcqlgnFYXkqI0ZKs4kNs+j3GS0IwncJJwKtypmtLTCLK5J/kG7qB2MNfXZTIzKI\n" + - "iZza4RUM1j67Hv3fPJzNEJ9urfjaI4xcRh5airlzBWOBU9pW87P7BgQN7cNzJQji\n" + - "4DSvb1pSXv8sBbZk5fmG+81PyUxcfqj7Dbih0J1Aoq0YysHugsrK/kLz+CvqL9B2\n" + - "a1JMZfob9jzcA7XPjpggLc3az2W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VKQB2AId1v+dZfPiMQ5lfvfNu/1aNR1Y2/0q1\n" + - "YMG06v9eoIMPAAABa55yL4IAAAQDAEcwRQIhANcF26iGoUuzZL6rGKduPtyyYusf\n" + - "03lBKSyvxabB9WuvAiBNbxR210L+JP89s/ONw53lYVr+1m/c3u9/9Wpu7c3n5jAN\n" + - "BgkqhkiG9w0BAQsFAAOCAgEACX2CbVM8MCIJ+2Wsap1v6VU2kpCS/FBIsLSTWNEf\n" + - "dREv1nh93qQ2CPIxj5kP/0EOUfq7tmQCJHMODVgz3iHrdxRB1E58nXHlZ6vUdrCo\n" + - "pD9d6Cp+AwvrOdv6MndVJgel9tVOAqAUblwdLzPNQHEcXoKnFEVv2SVQCmAYLlkP\n" + - "xX2RS73gseiit4QnVZOWi/wDhqMm7/iq8n7rL/f7+ly2+7e3LVjxd24HZkgxNgbn\n" + - "JDjYvIla+EvyrY8514Ru3Pf1UICY03VpYjE8R7SxrqcvOLtwvOVew6TuCUl6RNpl\n" + - "xeC9Oa1dgf+QRXN7LvmBXUP2nOCnwJE1ENvThPLw9BXLatVJgkA/v/mYWE5VjzIL\n" + - "hboPH2fNWemUv5QMzxUkqhgHgrhr8wnhI6xYIYciGDbmmfnItHex7bxktT7axoCD\n" + - "3dTQQe01YfK/LlkHtnBmJf/t0F33m8KXcQ51fic/TR2U5Tampxp2kdFdTyvRRqMl\n" + - "igqo3EhiPmB9bKsnXDA2AnvdjZT9uFwbUu5lNxjiMQcSZikjQAjJPgjCZ9BQOGbL\n" + - "eqgZcw2CxWMxFSTLL3TIBlNL/0GpRlTvr3IGyvHEr7EESXKD+Ar8XW+4VlMc1s8F\n" + - "cdtnus71s7wm+JUSXcM0WJUkRUvWqHlPi3Ucfe7k6x6BG9Mb42ECjorefPXvFu7v\n" + - "OT4=\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked-rsa-dv.ssl.com - // Issuer: CN=SSL.com RSA SSL subCA, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Serial number: 3f527e677d00558272ac90d1620b67f4 - // Valid from: Fri Jun 28 07:13:48 PDT 2019 until: Sun Jun 27 07:13:48 PDT 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHVzCCBT+gAwIBAgIQP1J+Z30AVYJyrJDRYgtn9DANBgkqhkiG9w0BAQsFADBp\n" + - "MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0b24x\n" + - "GDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjEeMBwGA1UEAwwVU1NMLmNvbSBSU0Eg\n" + - "U1NMIHN1YkNBMB4XDTE5MDYyODE0MTM0OFoXDTIxMDYyNzE0MTM0OFowITEfMB0G\n" + - "A1UEAwwWcmV2b2tlZC1yc2EtZHYuc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD\n" + - "ggEPADCCAQoCggEBAMKtMVeo+fMoeu1nLrcwxNAdfUysNKEhNZbMUOu9pzCChEvJ\n" + - "QHUicdrIZYl9m59uKUMh3Dj2nJLZ3a0pP4iWKcOEfCVMtA83/GDJl/BVj3XFbsMl\n" + - "+HSIu7R0vQM4enOztLabnOzvE4pQOFUp8u5SKO+hmB0zQ1iWkevYjJOf5DBZ7Zsa\n" + - "uF4qy9JqSF07gj/7FNqmqnfy6Z8yc8WAMjoUJrVrvmHQZeX/bCWxczFhYmAtYlwO\n" + - "7a914VP79b3Jq60HbLbYBdILnuU1Uu5L/JbG+hm/fH2meY30aWUaKcGY04ej6xuM\n" + - "hWsLhOrmcl3P7/E5UUojaR1Zvdtsn7jkQ8Y3iOsCAwEAAaOCA0EwggM9MB8GA1Ud\n" + - "IwQYMBaAFCYUfuDc16b34tQEJ99h8cLs5zLKMHwGCCsGAQUFBwEBBHAwbjBKBggr\n" + - "BgEFBQcwAoY+aHR0cDovL3d3dy5zc2wuY29tL3JlcG9zaXRvcnkvU1NMY29tLVN1\n" + - "YkNBLVNTTC1SU0EtNDA5Ni1SMS5j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sFAAOCAgEAAtTlh2YMwe6E0+EWKU3H79NmgLjK\n" + - "xoR3VtT56ILRt0qJuJ+z1iqq/IxZBe7wnUUWU46SWmBfDEQcGI7Hdomr67QBZNZz\n" + - "+wvnatMzrCPM7jPsb05Motz99NSk6yzQzR2c030sy1d78mRKJ/4wpidNDHpjuYL9\n" + - "cBp2gKf2/RxU74+BhugCjLqB1gojGO0CT1/g5a1QMtqRMM0EPrJrrtcEM0zG48yI\n" + - "P3b57Nl2ZbshRvY9bVi3of2SaPFQgu99/zAlerPUThz4O2CskOgKt77y6KOgCbBp\n" + - "7fQF6vh/aOm0Xba2Z0CtB+uVN2g4+LwyuovOy+JyjGKv7GxRKEQmGZsRLDVpxOs5\n" + - "W47K+iuOEhTRWRkStfuk2LcCLwTrgxHv2/Wo+80ME/7wxGKs1IzlkcFtFLhaeN4p\n" + - "QsmADpcyBfeWmvTdKgaVBOE2F/nenIiKpo+0jcoMAW6JgMD+otn8gofBq+Za1N4X\n" + - "xckvLWbMDAj4lELBHXu7gLHHLJCL9GGPD5HKjH/RyLtKKaRgT/AV6jl/woKTAzGF\n" + - "SPqgNQsu+sCdUbO0nDONkXDxhfan8XNrd32KMPGucJySiyjpHkurobMuGbs/LQzd\n" + - "JLTSTIIIPpEHBk7PHRGPSFewIhi0aDhupgZLU9UGrLRw/xV/KlGqTcGFWBvvOC+I\n" + - "CSZFRr0hWBv/dfw=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Fri Jun 28 07:25:02 PDT 2019", System.out); - } -} - -class SSLCA_EV_RSA { - - // Owner: CN=SSL.com EV SSL Intermediate CA RSA R3, O=SSL Corp, L=Houston, ST=Texas, C=US - // Issuer: CN=SSL.com EV Root Certification Authority RSA R2, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Serial number: 56b629cd34bc78f6 - // Valid from: Wed May 31 11:14:37 PDT 2017 until: Fri May 30 11:14:37 PDT 2042 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIG4DCCBMigAwIBAgIQA6P00GAwUqM3zjgKiDAxjDANBgkqhkiG9w0BAQsFADCB\n" + - "gjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9u\n" + - "MRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNzA1BgNVBAMMLlNTTC5jb20gRVYg\n" + - "Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EgUjIwHhcNMTkwMzI2MTc0\n" + - "NjUzWhcNMzQwMzIyMTc0NjUzWjByMQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4\n" + - "YXMxEDAOBgNVBAcMB0hvdXN0b24xETAPBgNVBAoMCFNTTCBDb3JwMS4wLAYDVQQD\n" + - "DCVTU0wuY29tIEVWIFNTTCBJbnRlcm1lZGlhdGUgQ0EgUlNBIFIzMIICIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAkby+CNUTyO0wakMc6VeJxQLGcTtfwJG6\n" + - "W9MYhMBWW22YUMtfCL7at/ey89eCc0cNy9uekJqitJe78Ion5qHBLfSpahYWttzr\n" + - "LflXkdlPz6xsZuw7F/tp6oYrcUpRIX92ci0EhORtb5xoX7rwzrBnG2Jv7fPn8JGj\n" + - "wmvYPS0meVkuKGtdR/s3dkl0tDraq2xti8cN7W9VawzLDL9yNyEw2GWAp3M5Uqex\n" + - "Yjh9HY5w/4bgk7K0KSw+2njaXCEa2MugM6txHDKjocVFBe7G8JPMKkCcbbrgZo/q\n" + - "ygTnIY8q7B1XQG2wrdsu4LTo9ijIYmoZHBAKN/XCdPecQYF9cHrv6NjVUcMrNmHT\n" + - "B43NrIvrXmm3lZJ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DaNZ+LV3su8YTsh/453vExhiNhPVEqLyGlkkW0B2gNW8z\n" + - "bsRy6L5QW0cZ4gZrY86MvHB0Gl299mTJ4jcgic+Oalbz9SZJ+EiW/aUDSpZ2zawi\n" + - "ackPWmAbk0y0gouOymrwOJZTuq+AJEJ6M+WSVdknwE7YwDpVMszHXS38BS1A5N1i\n" + - "rzW3BcARHbtCb00vEy2mzW5JPM2LjkzfgJ0lBiyDCE3ZeBeUtKmcdFUFrHwHl3gV\n" + - "aRipD+xMa1hGOTh33eMzwWoRxvk6o7y73Sy6XBfycN+8LhXUZT0X8STmWtBtLSMp\n" + - "blWMjuuFyUVQvIj05N7hORY/LhdQhEx8kVwS5RkLVSpRnohdk+nI69yIA7EwZKlw\n" + - "kKEsDqlVOeDYWVWQANDC55kJ7nOyJbqtGJqImwWXdQcf37fi80cf+mKOYs5vNmkx\n" + - "D9bwFWsKnP71x0liSlv8z79vRAo8FJwTgXRNO1c0ACf0rXEJy3GRAXRWiTvuGahR\n" + - "JVM3Jnn0G6o3+vTfwa7CKR/9Jc4t25iRU3xmSgiusg4u8i5x\n" + - "-----END CERTIFICATE-----"; - - // Owner: OID.1.3.6.1.4.1.311.60.2.1.3=US, OID.1.3.6.1.4.1.311.60.2.1.2=Nevada, STREET=3100 Richmond Ave, - // OID.2.5.4.15=Private Organization, OID.2.5.4.17=77098, CN=test-ev-rsa.ssl.com, SERIALNUMBER=NV20081614243, - // O=SSL Corp, L=Houston, ST=Texas, C=US - // Issuer: CN=SSL.com EV SSL Intermediate CA RSA R3, O=SSL Corp, L=Houston, ST=Texas, C=US - // Serial number: 558089b221d7cd9c7a4bc4a7fd7e2969 - // Valid from: Mon Jul 01 13:28:01 PDT 2019 until: Wed Jun 30 13:28:01 PDT 2021 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIISTCCBjGgAwIBAgIQVYCJsiHXzZx6S8Sn/X4paTANBgkqhkiG9w0BAQsFADBy\n" + - "MQswCQYDVQQGEwJVUzEOMA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foPIKoy0Rv/d\n" + - "DXOVm0FzKDH2zWHN/oQZ/7gwd21hvAIhAL2gDESf+tcjCkbjdj9NpDa/fVWO9VZD\n" + - "uPPnAZ6jf2G3MA0GCSqGSIb3DQEBCwUAA4ICAQAcYH/+o9N0E3H9h0GfohGElfRw\n" + - "XPUnQI3/CZwuG0ShCbpVspvUkuR/P0Hjr9XgDVy39R9SOaEDK3/coG8/Ry56Lrm0\n" + - "17v+yeEzAVK51eQeinHoCYc9TIwmyrwt36JE/zIwnDB623Y4ccxYN5LZxjVx668/\n" + - "xj3JffaY5185qPjAqkjLUzj9TeeAJk/ws1YXbQJvO4CZV2QXrishC+dEoqvfOe/u\n" + - "sMHcMJy+cFrPhe4cC7s9fHeYTpF36yvfWrgjGwDki/9zgRhOvDuM72dIMkrcHkZi\n" + - "OvZMgyoXz/Nw3D514K9BSt6xRB2qGzI8fx0EOGzEEjX1Zdie2uVDy9aC8k8TjQAM\n" + - "v/YT7Bggpv300hWvBGw0QT8l7Nk1PZFBagAhqRCKRsR1pUZ8CyZzwNkNyUSYV4Or\n" + - "n0vYwVEgpMeSMu/ObWwWPM7QKSNcSSIV5lxmsZX+wS76OpDMHm27P94RTEePF4sG\n" + - "QmvY6hgHSlREJUL0vyGGY2Rbm3cL3zaM4qTquN18v61uUVKakELYIcRZwVTyBj5M\n" + - "KxOkjGXnLYpDOLFHD4WB1q7J+SorG43V+nbmTEN5fshGUjjWoz5ykfErnyJa1+Py\n" + - "FXWoPFb425DelhuDe94btROuJELRfzhqDXoKrhDgSQGV2qM3sk6uIPOaoH4N31ko\n" + - "C41bezSdJ5r4mif8iA==\n" + - "-----END CERTIFICATE-----"; - - // Owner: OID.1.3.6.1.4.1.311.60.2.1.3=US, OID.1.3.6.1.4.1.311.60.2.1.2=Nevada, STREET=3100 Richmond Ave, - // OID.2.5.4.15=Private Organization, OID.2.5.4.17=77098, CN=revoked-rsa-ev.ssl.com, SERIALNUMBER=NV20081614243, - // O=SSL Corp, L=Houston, ST=Texas, C=US - // Issuer: CN=SSL.com EV SSL Intermediate CA RSA R3, O=SSL Corp, L=Houston, ST=Texas, C=US - // Serial number: 1ea7f53492bded2d425135bdf525889f - // Valid from: Mon Jul 01 13:29:02 PDT 2019 until: Wed Jun 30 13:29:02 PDT 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIIUzCCBjugAwIBAgIQHqf1NJK97S1CUTW99SWInzANBgkqhkiG9w0BAQsFADBy\n" + - "MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0b24x\n" + - "ETAPBgNVBAoMCFNTTCBDb3JwMS4wLAYDVQQDDCVTU0wuY29tIEVWIFNTTCBJbnRl\n" + - "cm1lZGlhdGUgQ0EgUlNBIFIzMB4XDTE5MDcwMTIwMjkwMloXDTIxMDYzMDIwMjkw\n" + - "MlowgfQxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91\n" + - "c3RvbjERMA8GA1UECgwIU1NMIENvcnAxFjAUBgNVBAUTDU5WMjAwODE2MTQyNDMx\n" + - "HzAdBgNVBAMMFnJldm9rZWQtcnNhLWV2LnNzbC5jb20xDjAMBgNVBBEMBTc3MDk4\n" + - "MR0wGwYDVQQPDBRQcml2YXRlIE9yZ2FuaXphdGlvbjEaMBgGA1UECQwRMzEwMCBS\n" + - "aWNobW9uZCBBdmUxFzAVBgsrBgEEAYI3PAIBAgwGTmV2YWRhMRMwEQYLKwYBBAGC\n" + - "NzwCAQMTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlqZwW2n7\n" + - "Ot8ujRGyCkzf/FqkiIi6+mq7QXlBMsZVNmLcWzatoS9K8WOviU+lmYpdV3rkrX1v\n" + - "e/FZBwtBR/x1FRN3CPoGcO0Yu6CZjknHtyyNQ36mwUy7UW+rQKYjDfU4aXme4bP8\n" + - "Dk2rUYQtM/xpYHKDk9x7Vg4z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ziH+eyvTk3tdhIq2x\n" + - "oDZXs7SSZK6hf/im+7OFSkROy6CwhAn3nxRI9lpag1tTgF4kVSctBv+301ev0twX\n" + - "0w6RymKcvEbcuSDHkzOYWxc1cqwOxjA=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Mon Jul 01 20:53:13 PDT 2019", System.out); - } -} - -class SSLCA_ECC { - - // Owner: CN=SSL.com SSL Intermediate CA ECC R2, O=SSL Corp, L=Houston, ST=Texas, C=US - // Issuer: CN=SSL.com Root Certification Authority ECC, O=SSL Corporation, L=Houston, ST=Texas, C=US - // Serial number: 75e6dfcbc1685ba8 - // Valid from: Fri Feb 12 10:14:03 PST 2016 until: Tue Feb 12 10:14:03 PST 2041 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIDejCCAv+gAwIBAgIQHNcSEt4VENkSgtozEEoQLzAKBggqhkjOPQQDAzB8MQsw\n" + - "CQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0b24xGDAW\n" + - "BgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBSb290IENl\n" + - "cnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzAeFw0xOTAzMDcxOTQyNDJaFw0zNDAz\n" + - "MDMxOTQyNDJaMG8xCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UE\n" + - "BwwHSG91c3RvbjERMA8GA1UECgwIU1NMIENvcnAxKzApBgNVBAMMIlNTTC5jb20g\n" + - "U1NMIEludGVybWVkaWF0ZSBDQSBFQ0MgUjIwdjAQBgcqhkjOPQIBBgUrgQQAIgNi\n" + - "AASEOWn30uEYKDLFu4sCjFQ1VupFaeMtQjqVWyWSA7+KFljnsVaFQ2hgs4cQk1f/\n" + - "RQ2INSwdVCYU0i5qsbom20rigUhDh9dM/r6bEZ75eFE899kSCI14xqThYVLPdLEl\n" + - "+dyjggFRMIIBTTASBgNVHRMBAf8ECDAGAQH/AgEAMB8GA1UdIwQYMBaAFILRhXMw\n" + - "5zUE044CkvvlpNHEIejNMHgGCCsGAQUFBwEBBGwwajBGBggrBgEFBQcwAoY6aHR0\n" + - "cDovL3d3dy5zc2wuY29tL3JlcG9zaXRvcnkvU1NMY29tLVJvb3RDQS1FQ0MtMzg0\n" + - "LVIxLmNydDAgBggrBgEFBQcwAYYUaHR0cDovL29jc3BzLnNzbC5jb20wEQYDVR0g\n" + - "BAowCDAGBgRVHSAAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATA7BgNV\n" + - "HR8ENDAyMDCgLqAshipodHRwOi8vY3Jscy5zc2wuY29tL3NzbC5jb20tZWNjLVJv\n" + - "b3RDQS5jcmwwHQYDVR0OBBYEFA10Zgpen+Is7NXCXSUEf3Uyuv99MA4GA1UdDwEB\n" + - "/wQEAwIBhjAKBggqhkjOPQQDAwNpADBmAjEAxYt6Ylk/N8Fch/3fgKYKwI5A011Q\n" + - "MKW0h3F9JW/NX/F7oYtWrxljheH8n2BrkDybAjEAlCxkLE0vQTYcFzrR24oogyw6\n" + - "VkgTm92+jiqJTO5SSA9QUa092S5cTKiHkH2cOM6m\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=test-dv-ecc.ssl.com - // Issuer: CN=SSL.com SSL Intermediate CA ECC R2, O=SSL Corp, L=Houston, ST=Texas, C=US - // Serial number: 1bfbd8e4bea894f3d1887c50e7d366d7 - // Valid from: Fri Jun 28 06:58:27 PDT 2019 until: Sun Jun 27 06:58:27 PDT 2021 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIE9TCCBHqgAwIBAgIQG/vY5L6olPPRiHxQ59Nm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DgYDVR0PAQH/BAQDAgeAMIIB\n" + - "gQYKKwYBBAHWeQIEAgSCAXEEggFtAWsAdwCHdb/nWXz4jEOZX73zbv9WjUdWNv9K\n" + - "tWDBtOr/XqCDDwAAAWueaoEnAAAEAwBIMEYCIQCdy3N9w0pem1XShE/rkVSpHxQb\n" + - "8QdUu3E6R+oncxOGXgIhAJoWg2gJYc9DWDl5ImnrqsmVS6OPgSQRvDsjRIN9gH7a\n" + - "AHcAu9nfvB+KcbWTlCOXqpJ7RzhXlQqrUugakJZkNo4e0YUAAAFrnmqArQAABAMA\n" + - "SDBGAiEAs2yfi9e1h6dTQbe4WPd7+5qf7kvP7Vr2k0nAtBS1IgECIQCQYL9he9J4\n" + - "Bh5cpQezTVPgLAOGcf5xIcCrBs1QJe66/AB3AFWB1MIWkDYBSuoLm1c8U/DA5Dh4\n" + - "cCUIFy+jqh0HE9MMAAABa55qgaEAAAQDAEgwRgIhAI/27txsvzpbBXkMICi/UOzE\n" + - "t8uZidbF9KSwmGRPT/6gAiEAhm/VeWHDeWK8gFMU+f0/x4jK7UbzySGBvPzbPpNd\n" + - "EDwwCgYIKoZIzj0EAwMDaQAwZgIxAJKn8Hr68Z/2rA+VHfZo8eeIFaZ3nvSvQO92\n" + - "1Byl6cPAm8DsdCnYT16uNSL8Zb5IQAIxAOFLsqPDCSAYkpgutAnVgwI+c549SIRU\n" + - "k8ol+wUx6zgMmt8VHYagyj6IO0GRDjm/eA==\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=revoked-ecc-dv.ssl.com - // Issuer: CN=SSL.com SSL Intermediate CA ECC R2, O=SSL Corp, L=Houston, ST=Texas, C=US - // Serial number: 423c2b57dfa379d0c45ffceb6284ed99 - // Valid from: Fri Jun 28 07:09:30 PDT 2019 until: Sun Jun 27 07:09:30 PDT 2021 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIE+TCCBH+gAwIBAgIQQjwrV9+jedDEX/zrYoTtmTAKBggqhkjOPQQDAzB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VR0PAQH/\n" + - "BAQDAgeAMIIBfQYKKwYBBAHWeQIEAgSCAW0EggFpAWcAdQBElGUusO7Or8RAB9io\n" + - "/ijA2uaCvtjLMbU/0zOWtbaBqAAAAWuedJ/tAAAEAwBGMEQCIGPBF546Tn/lzB22\n" + - "ICpFLOWOIyIOPwL9S4ikS8Vt1aFTAiBe8mp/WCJnV7WxMIVWEUSLVOYn7erwyu6D\n" + - "hWNIST4W8wB2AG9Tdqwx8DEZ2JkApFEV/3cVHBHZAsEAKQaNsgiaN9kTAAABa550\n" + - "oQEAAAQDAEcwRQIhAJ3nwLI7kLP2SKicFKuJoqRYKE/FR2Ff65WL+iWxm/6nAiAJ\n" + - "cd9EKnBETwM9qQfKoSSs2oTQL4QjSKJZi/sPfKQaagB2ALvZ37wfinG1k5Qjl6qS\n" + - "e0c4V5UKq1LoGpCWZDaOHtGFAAABa550oH4AAAQDAEcwRQIhAIo6k5BMSFN3FnD4\n" + - "UFbyJJG/Bujh+OFTYzVM8vuIBoU0AiAhBe+air4wHvd68ykK6xOPv9Qshje9F6LC\n" + - "gxTqbMOEkDAKBggqhkjOPQQDAwNoADBlAjEAyayBtbcCQB0fE+cCc7OHLuNvb9tl\n" + - "uiHWy/Ika6IA72WJLLmED971ik08OMa2mGt4AjAklxdElQ5Z/nSeJ2CNEwD7pcYz\n" + - "468kkrMoGU2lk3QmwcXZscPIoh4Pwew6QteY4J0=\n" + - "-----END CERTIFICATE-----"; - - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) throws Exception { - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Fri Jun 28 07:59:20 PDT 2019", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java deleted file mode 100644 index 48c4d77a6ba..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8305975 - * @summary Interoperability tests with TWCA Global Root CA from TAIWAN-CA - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath TWCAGlobalCA OCSP - * @run main/othervm -Djava.security.debug=certpath TWCAGlobalCA CRL - */ - -/* - * Obtain TLS test artifacts for TWCA Global Root CA from: - * - * Valid TLS Certificates: - * https://evssldemo6.twca.com.tw - * - * Revoked TLS Certificates: - * https://evssldemo7.twca.com.tw - */ -public class TWCAGlobalCA { - - // Owner: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, O=TAIWAN-CA, C=TW - // Issuer: CN=TWCA Global Root CA, OU=Root CA, O=TAIWAN-CA, C=TW - // Serial number: 40013304f70000000000000cc042cd6d - // Valid from: Thu Aug 23 02:53:30 PDT 2012 until: Fri Aug 23 08:59:59 PDT 2030 - private static final String INT = "-----BEGIN CERTIFICATE-----\n" + - "MIIFdzCCA1+gAwIBAgIQQAEzBPcAAAAAAAAMwELNb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R3L1RXQ0FS\n" + - "Q0EvZ2xvYmFsX3Jldm9rZV80MDk2LmNybDASBgNVHRMBAf8ECDAGAQH/AgEAMDgG\n" + - "CCsGAQUFBwEBBCwwKjAoBggrBgEFBQcwAYYcaHR0cDovL1Jvb3RPY3NwLnR3Y2Eu\n" + - "Y29tLnR3LzANBgkqhkiG9w0BAQsFAAOCAgEAaOmLaZ2+WN2EtB6feuSV5KnL88ck\n" + - "I9jsUTB4YtKsv0ViORkeBMCQur5OoAgRE9VYdRVlWHN0zJAX232fdoZmnajl8gtj\n" + - "u0AOOyDDJ7Vlh38rDMRlX/u+MS2DFcsq5Vd3EMwJsWWFR9D3Dcey+Tu9uEmEdqeB\n" + - "+Erd4YjCeV9PyOW3SzPQ47RdW6XYmHArPh65/LcmSxTn/lxQy/NEBGGWqhm6s6n1\n" + - "49mPq4MtQcMLo/NBI+8jv7BVjnThbbEh2edHHxMNiAd5kLZFDCyJuFkoezjWL4AH\n" + - "ratXdoHtqvqtPoy97LyGrLrJeh+0hkO9u8QOt2gF7BEhNfid7o5dnsPRk+8l77Hn\n" + - "T1dvBs++M0r0QG4AWMSMj9uUn6rhl4FGTvAsyB1fA8p/xCLoIEetIpKRP3BD+ve2\n" + - "eYjWPorR/0W77iMTeoQEeuxDIxi2J/U9QLKKvzzqBy1TYrqqPe5YxqHLNAcfHZvo\n" + - "BTPPbtP0WAiXrJiELTYcqFXETvQcGw0XjoUZNvJE8RD7vssSNT17RKU8iBRX7CbL\n" + - "AB3T8gYykPMJTUqQSmdgEdVRBcqRMMdU+XRAEoU/Mz5oHAkm3ZNTDNwsEp2Dg1/b\n" + - "qzfPMhg4/3/YyWzGrzNeCSWZkjYImAzLCvN0D5rbdVHEmFIrEJt+igocGozroq5x\n" + - "DT5KhixlrqexzWE=\n" + - "-----END CERTIFICATE-----"; - - // Owner: OID.2.5.4.17=100, STREET="10F.,NO.85,Yanping S. Rd.,Taipei City 100,Taiwan (R.O.C)", - // SERIALNUMBER=70759028, OID.1.3.6.1.4.1.311.60.2.1.3=TW, OID.1.3.6.1.4.1.311.60.2.1.2=Taiwan, - // OID.1.3.6.1.4.1.311.60.2.1.1=Taipei, OID.2.5.4.15=Private Organization, - // CN=evssldemo6.twca.com.tw, O=TAIWAN-CA INC., L=Taipei, ST=Taiwan, C=TW - // Issuer: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, - // O=TAIWAN-CA, C=TW - // Serial number: 47e70000001258ff71d89af7f0353fef - // Valid from: Thu Mar 02 00:49:56 PST 2023 until: Sun Mar 31 08:59:59 PDT 2024 - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIH7zCCBtegAwIBAgIQR+cAAAASWP9x2Jr38DU/7zANBgkqhkiG9w0BAQsFADBz\n" + - "MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRwwGgYDVQQLExNHbG9i\n" + - "YWwgRVZTU0wgU3ViLUNBMTIwMAYDVQQDEylUV0NBIEdsb2JhbCBFVlNTTCBDZXJ0\n" + - "aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0yMzAzMDIwODQ5NTZaFw0yNDAzMzExNTU5\n" + - "NTlaMIIBMzELMAkGA1UEBhMCVFcxDzANBgNVBAgTBlRhaXdhbjEPMA0GA1UEBxMG\n" + - "VGFpcGVpMRcwFQYDVQQKEw5UQUlXQU4tQ0EgSU5DLjEfMB0GA1UEAxMWZXZzc2xk\n" + - "ZW1vNi50d2NhLmNvbS50dzEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + - "FzAVBgsrBgEEAYI3PAIBARMGVGFpcGVpMRcwFQYLKwYBBAGCNzwCAQITBlRhaXdh\n" + - "bjETMBEGCysGAQQBgjc8AgEDEwJUVzERMA8GA1UEBRMINzA3NTkwMjgxQTA/BgNV\n" + - "BAkTODEwRi4sTk8uODUsWWFucGluZyBTLiBSZC4sVGFpcGVpIENpdHkgMTAwLFRh\n" + - "aXdhbiAoUi5PLkMpM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SrSBciBzO53HFk1pE\n" + - "TABXFcoK3gmhWM04lysmJMwAzRUbNQVizpGDICbRjCOVnwCbutnSnka8pDHkq4Zy\n" + - "BrUeZe2xJe8jWvukwqvNzIIvwg==\n" + - "-----END CERTIFICATE-----"; - - // Owner: OID.2.5.4.17=100, STREET="10F.,NO.85,Yanping S. Rd.,Taipei City 100,Taiwan (R.O.C)", - // SERIALNUMBER=70759028, OID.1.3.6.1.4.1.311.60.2.1.3=TW, OID.1.3.6.1.4.1.311.60.2.1.2=Taiwan, - // OID.1.3.6.1.4.1.311.60.2.1.1=Taipei, OID.2.5.4.15=Private Organization, - // CN=evssldemo7.twca.com.tw, O=TAIWAN-CA INC., L=Taipei, ST=Taiwan, C=TW - // Issuer: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, - // O=TAIWAN-CA, C=TW - // Serial number: 47e70000001258f036a5b513091ccb2e - // Valid from: Tue Feb 07 02:03:08 PST 2023 until: Thu Mar 07 07:59:59 PST 2024 - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIHdjCCBl6gAwIBAgIQR+cAAAASWPA2pbUTCRzLLjANBgkqhkiG9w0BAQsFADBz\n" + - "MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRwwGgYDVQQLExNHbG9i\n" + - "YWwgRVZTU0wgU3ViLUNBMTIwMAYDVQQDEylUV0NBIEdsb2JhbCBFVlNTTCBDZXJ0\n" + - "aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0yMzAyMDcxMDAzMDhaFw0yNDAzMDcxNTU5\n" + - "NTlaMIIBMzELMAkGA1UEBhMCVFcxDzANBgNVBAgTBlRhaXdhbjEPMA0GA1UEBxMG\n" + - "VGFpcGVpMRcwFQYDVQQKEw5UQUlXQU4tQ0EgSU5DLjEfMB0GA1UEAxMWZXZzc2xk\n" + - "ZW1vNy50d2NhLmNvbS50dzEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\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cu97p4P8igJYM+VfwXNwYYRCXUr9f4ESD7t5vXlYoE\n" + - "c4m5KiBQD9XtZS77QRon9JCQklxTvMkxuLwWvSdzicEUzWeFp+kN/fcXL2SVsb17\n" + - "xDPMMsMMh7L/f+uMWDYZ+wH17LYQxOLi7VXT3fv8nl2X2iD3d4CCh0Tu\n" + - "-----END CERTIFICATE-----"; - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Thu Mar 23 17:30:19 PDT 2023", System.out); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java deleted file mode 100644 index 3dc0c94abc2..00000000000 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8210432 - * @summary Interoperability tests with TeliaSonera Root CA v1 - * @build ValidatePathWithParams - * @run main/othervm -Djava.security.debug=certpath TeliaSoneraCA OCSP - * @run main/othervm -Djava.security.debug=certpath TeliaSoneraCA CRL - */ - -/* - * Obtain TLS test artifacts for TeliaSonera Root CA v1 from: - * - * Valid TLS Certificates: - * https://juolukka.cover.sonera.net:10443/ - * - * Revoked TLS Certificates: - * https://juolukka.cover.sonera.net:10444/ - */ -public class TeliaSoneraCA { - - // Owner: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI - // Issuer: CN=TeliaSonera Root CA v1, O=TeliaSonera - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIHHjCCBQagAwIBAgIQTEYq9tv794BPhMF8/qlytjANBgkqhkiG9w0BAQsFADA3\n" - + "MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9v\n" - + "dCBDQSB2MTAeFw0xNDEwMTYwODA5NTdaFw0zMjEwMTYwNTA0MDBaMEYxCzAJBgNV\n" - + "BAYTAkZJMRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEhMB8GA1UEAwwYVGVsaWFTb25l\n" - + "cmEgU2VydmVyIENBIHYyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA\n" - + "rwQN5rfRLbVAiYWLJF9SI4YLm8oqrtf8OjGybgoLyiMIo8nhY/atuGRFWCQNOnUK\n" - + "caZn29C360PlC5yYrsrSHuouROisqHSJcgA7HvV+37Rcry7daeDj6rfyx4yI5dmj\n" - + "LwHkK0j1NzhX1JxFDgPeLNuebgzv/j8OfRhYK/BttpystC4Zgm3gZheKDjYsDS5D\n" - + "gjffuOysP3vewrcuw0EIZFx+HawuwNBLq4tMf4VSitYDHJSLIM2TeXZGGY5slTbT\n" - + "yLnrU5mIzG9WKq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BSb290JTIwQ0ElMjB2MSxvPVRlbGlhU29uZXJhP2Nl\n" - + "cnRpZmljYXRlcmV2b2NhdGlvbmxpc3Q7YmluYXJ5MB0GA1UdDgQWBBQvSTwpT9cH\n" - + "JfnGjNVk9WY9EoMilTAfBgNVHSMEGDAWgBTwj1k4ALP1j5qWDNXr+nuqF+gTEjAN\n" - + "BgkqhkiG9w0BAQsFAAOCAgEAg9EVFW6ioZ2ctrX8KqvW9XPYZR01yNgqlO7pwBWf\n" - + "HzuBCbUdyVzumfQnU24Sce92oMtEfyuxIOmhvoXU7LpnYlH3Q29UGP5dL0D3edGz\n" - + "HeU6Tf8bkcOEHtnTrkd+y+rfFSDWYl9r1y993NAcrBHhroQCE53mlrO7TjXa3zDq\n" - + "6LGR8T8VgvGw0IBz6mzAks0wMYB0b4uREPmWXi+m+RqG3lnpl+eBzz6YVLkxIYMq\n" - + "QIXJIBsu4/ybmadsfdql6E8Lo3dKVD4UG10mtd+iPbJiBiW/a9VbEe3NVKIv4H2y\n" - + "HqYcxDXAeUI66E3K2cjCmKoQaa0Ywt02ikZFd0v1OWNPS7YWbEJWkVR1PcPMESK9\n" - + "6HKI4xhG2tJesmXjQ8q8aSx2u79Zts3ewjKqTmurf6FXW3u9TpSCUe6Drr/3X7Ve\n" - + "nBy4M0sLwCecD/L9gjTa+EItQTYzCkpxiMO49tQdX/BpwgWju4Kg3qkaBNTzvSlk\n" - + "gdnRJqCUkVuzwK4yBqUoyRz3prlhvvRGdZJKf6IXRDhncpey5pm0PQYQ4cArx7Go\n" - + "AaAKz0ZTHOKjnM2KIdUhBJQybL7oPklSfkeMWoUoYED6R4YMTt/JXX4ixEb5DgDJ\n" - + "0F+bNcF7qGrJTkTx0Ccy4BuuY05hJckd72E7WdmjN7DDeosghgWZNV/6D7N5tfxo\n" - + "nlU=\n" - + "-----END CERTIFICATE-----"; - - // Owner: CN=juolukka.cover.sonera.net, OU=security, O=Telia Finland Oyj, L=helsinki, C=FI - // Issuer: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + - "MIIHiDCCBXCgAwIBAgIPAWOq14hk136UDQY3WSjLMA0GCSqGSIb3DQEBCwUAMEYx\n" + - "CzAJBgNVBAYTAkZJMRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEhMB8GA1UEAwwYVGVs\n" + - "aWFTb25lcmEgU2VydmVyIENBIHYyMB4XDTE4MDUyOTA3NDA0MVoXDTE5MDUyOTA3\n" + - "NDA0MVowczELMAkGA1UEBhMCRkkxETAPBgNVBAcMCGhlbHNpbmtpMRowGAYDVQQK\n" + - "DBFUZWxpYSBGaW5sYW5kIE95ajERMA8GA1UECwwIc2VjdXJpdHkxIjAgBgNVBAMM\n" + - "GWp1b2x1a2thLmNvdmVyLnNvbmVyYS5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" + - "DwAwggEKAoIBAQDLks9F8ZUqV9G4jn3fY234OX09Dmqqtuk0qAmjWpF0JAn2o64t\n" + - "whVxFLx9e2IwUPTQgyo6FwRsiT19m99BhgxYnJOxVRwURxSL3mqlV9gX4oFMmT4O\n" + - "EOYEjaJXi8ne1pJX80y2hVQ48XqgODnKdKZVwa5YoeWZQJiaq+C5JkMDN8qzpiyQ\n" + - "X3EfJspLkKy2E+UVxWmfnyf0v70ES9TQ8qgxwvsf7LRZ8Jixq7TTO5VbqWsdBvJC\n" + - "9Zm2aBOYJ7ptSZQ5YDfeUJG2c9S/zFmngoPnTrvAZwUeU3YTrbdZQy899ZOatWac\n" + - "6lHUYU2EagEmbj/jtIvJ6wMbzhleIXRQFWibAgMBAAGjggNEMIIDQDAfBgNVHSME\n" + - "GDAWgBQvSTwpT9cHJfnGjNVk9WY9EoMilTAdBgNVHQ4EFgQUbMozh4osL4gFJvb5\n" + - "baELpQSKEhIwDgYDVR0PAQH/BAQDAgSwME4GA1UdIARHMEUwQwYGZ4EMAQICMDkw\n" + - "NwYIKwYBBQUHAgEWK2h0dHA6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IBAIl5UWSwCXF85+2lU6t89K7I4TvZ\n" + - "Ggof0NLngea9qxBq00opfnl9i2LPRnsjh9s3iA29i2daTEuJn3qt3Ygcm27Jd7WM\n" + - "5StcxQ483GAaL5s5m2QqkZB8eLfez3tIyCMGCAyixBDNRNPVI4xZr6sSOenWtipo\n" + - "gMt+/gvRIMdMT79IXPFz4W9RWCwnfJNOlfH2OkS3KZYaPSaEvs6sfMW1DDZosrBy\n" + - "6F+DITPLllOVSE4+PTxvXLKVy+srFwF1VocQXKkWMHQ7AfWNnOGzb7B1qg7gsw0n\n" + - "axqinyCjkhMpHpcVtmD9Pi15HLFDIy9yI2S+FHJQfhUSmM/LdCWzQpnee6/Wo+uw\n" + - "p0Jg2v6v9GGaqfpuiVJPFN9dOv3OjMU7DL5lgMRWFRo2T8+wBHXDyBhT0W0y5kRJ\n" + - "eWA7t6CnkziHuaOihZAHUH3nn5exjqUFVS0ThbF6hxN7HAlq/xIbTKlZjkLlc14W\n" + - "fB8vkxJyy/tgBZ4dCj9Y1Y32d4eFT5JZJgqgkN59SmX56BswNXncGrk/vWZFFx+g\n" + - "9dgb8QSe8KseD1iSLc7SsqVDv8NPYdaI3eZ90W8Wv0/CDls321O6UbAmURzQwFGB\n" + - "w8WnteoVBi6Wf6M1TxIfJsXBYeIN0BB6AYc8cmZIOtx2C8aH4JJT45MyFnBv3ac5\n" + - "Ahs9pGn/+K+5yb2e\n" + - "-----END CERTIFICATE-----"; - - // Owner: CN=juolukka.cover.sonera.net, OU=Security, O=TeliaSonera Finland, L=Helsinki, C=FI - // Issuer: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + - "MIIGEDCCA/igAwIBAgIRAKWJTjs6v04ZTyb2wJxfnJswDQYJKoZIhvcNAQELBQAw\n" + - "RjELMAkGA1UEBhMCRkkxFDASBgNVBAoMC1RlbGlhU29uZXJhMSEwHwYDVQQDDBhU\n" + - "ZWxpYVNvbmVyYSB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EMEKgQKA+hjxodHRwOi8vY3JsLTMudHJ1\n" + - "c3QudGVsaWFzb25lcmEuY29tL3RlbGlhc29uZXJhc2VydmVyY2F2Mi5jcmwwHQYD\n" + - "VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMA4GA1UdDwEB/wQEAwIEsDAkBgNV\n" + - "HREEHTAbghlqdW9sdWtrYS5jb3Zlci5zb25lcmEubmV0MB0GA1UdDgQWBBSa+vJH\n" + - "I6Lt9Aqw5ondhoZu4/IJezANBgkqhkiG9w0BAQsFAAOCAgEASRK1l1MZb/IRlyi+\n" + - "XjfZcxJdFuNzW2kpZstW6Ni2XiD3p7aROBfDFtu7GajzZHb6p76auDb4NwJgeE/3\n" + - "6gnXoIK00HwpF2RAhxDpkF8r3q0jSqGhSv/xz9Nx7JBzgqfSw3Ha4ohioIed3uc+\n" + - "nMDyvVenio4GYgtxIIubSybCxMv/lBA/S4daIVCYK3VOoBbM2F36ecAKvRU5vIWM\n" + - "urXsfANL3u4qgJpaM0DclzFsOkVsRPffzToko/Nr6pGXYjt47IzTRlwLMnLehoZW\n" + - "ZZMGMVVOlR7XGf81UjWB6OsKeoQ4FWgcb/rIJcZusm+LqvnsCHuC3gtuC2nGA7lr\n" + - "fseUlG7QZN9/QfUIyvL69wAzeVj1cUcd7GHcAH9DyZJfI8orv4PyUvitDdgISkFu\n" + - "GZ562O7cGmCv00/6I4t0z9wZal8a5lRDoKXAYy+u/adrO1JjLwi11y/DTw9LQ7sJ\n" + - "gVP/v2GsI0ajF9A6z33UHN9uxXZVmQNvOiMkcJiGLovFgu5zxoAg2W3pHjbBbeL8\n" + - "v5MPqgsKafgzaSRtXBBvaISHi9hhRR8v/qSwO3NyLm8uAhQD4x+OPHrmQ/s16j45\n" + - "Ib53UHj1k6byXGUqDgzFBsmEPV6Shf2C4/HcRHpAX8wQx3xVwDtRzDpNUR6vnNfi\n" + - "PwzRU1xsQKd8llmgl4l+fYV0tBA=\n" + - "-----END CERTIFICATE-----"; - - public static void main(String[] args) throws Exception { - - ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { - pathValidator.enableCRLCheck(); - } else { - // OCSP check by default - pathValidator.enableOCSPCheck(); - } - - // Validate valid - pathValidator.validate(new String[]{VALID, INT}, - ValidatePathWithParams.Status.GOOD, null, System.out); - - // Validate Revoked - pathValidator.validate(new String[]{REVOKED, INT}, - ValidatePathWithParams.Status.REVOKED, - "Thu Dec 22 23:14:55 PST 2016", System.out); - - // reset validation date back to current date - pathValidator.resetValidationDate(); - } -} diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithURL.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithURL.java new file mode 100644 index 00000000000..80aaa710de8 --- /dev/null +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithURL.java @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import jtreg.SkippedException; + +import javax.net.ssl.*; +import javax.security.auth.x500.X500Principal; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.security.*; +import java.security.cert.*; +import java.security.cert.Certificate; + +public class ValidatePathWithURL { + + private final X509Certificate rootCertificate; + private final X500Principal rootPrincipal; + + /** + * Enables the certificate revocation checking and loads the certificate from + * cacerts file for give caAlias + * + * @param caAlias CA alias for CA certificate in cacerts file + * @throws Exception when fails to get CA certificate from cacerts file + */ + public ValidatePathWithURL(String caAlias) throws Exception { + System.setProperty("com.sun.net.ssl.checkRevocation", "true"); + Security.setProperty("ssl.TrustManagerFactory.algorithm", "SunPKIX"); + + // some test sites don't have correct hostname specified in test certificate + HttpsURLConnection.setDefaultHostnameVerifier(new CustomHostnameVerifier()); + + String FS = System.getProperty("file.separator"); + String CACERTS_STORE = + System.getProperty("test.jdk") + FS + "lib" + FS + "security" + FS + "cacerts"; + + KeyStore cacerts = KeyStore.getInstance("PKCS12"); + try (FileInputStream fis = new FileInputStream(CACERTS_STORE)) { + cacerts.load(fis, null); + } + + rootCertificate = (X509Certificate) cacerts.getCertificate(caAlias); + rootPrincipal = rootCertificate.getSubjectX500Principal(); + } + + /** + * Enable revocation checking using OCSP and disables CRL check + */ + public static void enableOCSPOnly() { + System.setProperty("com.sun.security.enableCRLDP", "false"); + Security.setProperty("ocsp.enable", "true"); + } + + /** + * Enable revocation checking using CRL + */ + public static void enableCRLOnly() { + System.setProperty("com.sun.security.enableCRLDP", "true"); + Security.setProperty("ocsp.enable", "false"); + } + + /** + * Enable revocation checking using OCSP or CRL + */ + public static void enableOCSPAndCRL() { + System.setProperty("com.sun.security.enableCRLDP", "true"); + Security.setProperty("ocsp.enable", "true"); + } + + /** + * Logs revocation settings + */ + public static void logRevocationSettings() { + System.out.println("====================================================="); + System.out.println("CONFIGURATION"); + System.out.println("====================================================="); + System.out.println("http.proxyHost :" + System.getProperty("http.proxyHost")); + System.out.println("http.proxyPort :" + System.getProperty("http.proxyPort")); + System.out.println("https.proxyHost :" + System.getProperty("https.proxyHost")); + System.out.println("https.proxyPort :" + System.getProperty("https.proxyPort")); + System.out.println("https.socksProxyHost :" + + System.getProperty("https.socksProxyHost")); + System.out.println("https.socksProxyPort :" + + System.getProperty("https.socksProxyPort")); + System.out.println("jdk.certpath.disabledAlgorithms :" + + Security.getProperty("jdk.certpath.disabledAlgorithms")); + System.out.println("com.sun.security.enableCRLDP :" + + System.getProperty("com.sun.security.enableCRLDP")); + System.out.println("ocsp.enable :" + Security.getProperty("ocsp.enable")); + System.out.println("====================================================="); + } + + /** + * Validates end entity certificate used in provided test URL using + * HttpsURLConnection. Validation is skipped on network error or if + * the certificate is expired. + * + * @param testURL URL to validate + * @param revokedCert if true then validate is REVOKED certificate + * @throws Exception on failure to validate certificate + */ + public void validateDomain(final String testURL, + final boolean revokedCert) + throws Exception { + System.out.println(); + System.out.println("===== Validate " + testURL + "====="); + if (!validateDomainCertChain(testURL, revokedCert)) { + throw new RuntimeException("Failed to validate " + testURL); + } + System.out.println("======> SUCCESS"); + } + + private boolean validateDomainCertChain(final String testURL, + final boolean revokedCert) + throws Exception { + HttpsURLConnection httpsURLConnection = null; + try { + URL url = new URL(testURL); + httpsURLConnection = (HttpsURLConnection) url.openConnection(); + httpsURLConnection.setInstanceFollowRedirects(false); + httpsURLConnection.connect(); + + // certain that test certificate anchors to trusted CA for VALID certificate + // if the connection is successful + Certificate[] chain = httpsURLConnection.getServerCertificates(); + httpsURLConnection.disconnect(); + validateAnchor(chain); + } catch (SSLHandshakeException e) { + System.out.println("SSLHandshakeException: " + e.getMessage()); + Throwable cause = e.getCause(); + + while (cause != null) { + if (cause instanceof CertPathValidatorException) { + CertPathValidatorException cpve =(CertPathValidatorException)cause; + if (cpve.getReason() == CertPathValidatorException.BasicReason.REVOKED + || cpve.getCause() instanceof CertificateRevokedException) { + System.out.println("Certificate is revoked"); + + // We can validate anchor for revoked certificates as well + Certificate[] chain = cpve.getCertPath().getCertificates().toArray(new Certificate[0]); + validateAnchor(chain); + + if (revokedCert) { + return true; + } + } else if (cpve.getReason() == CertPathValidatorException.BasicReason.EXPIRED + || cpve.getCause() instanceof CertificateExpiredException) { + System.out.println("Certificate is expired"); + throw new SkippedException("Certificate is expired, skip the test"); + } + break; + } + cause = cause.getCause(); + } + + throw new RuntimeException("Unhandled exception", e); + } catch (SSLException e) { + // thrown if root CA is not included in cacerts + throw new RuntimeException(e); + } catch (IOException e) { + throw new SkippedException("Network setup issue, skip this test", e); + } finally { + if (httpsURLConnection != null) { + httpsURLConnection.disconnect(); + } + } + + return !revokedCert; + } + + private void validateAnchor(Certificate[] chain) throws Exception { + X509Certificate interCert = null; + + // fail if there is no intermediate CA or self-signed + if (chain.length < 2) { + throw new RuntimeException("Cert chain too short " + chain.length); + } else { + System.out.println("Finding intermediate certificate issued by CA"); + for (Certificate cert : chain) { + if (cert instanceof X509Certificate) { + X509Certificate certificate = (X509Certificate)cert; + System.out.println("Checking: " + certificate.getSubjectX500Principal()); + System.out.println("Issuer: " + certificate.getIssuerX500Principal()); + if (certificate.getIssuerX500Principal().equals(rootPrincipal)) { + interCert = certificate; + break; + } + } + } + } + + if (interCert == null) { + throw new RuntimeException("Intermediate Root CA not found in the chain"); + } + + // validate intermediate CA signed by root CA under test + System.out.println("Found intermediate root CA: " + interCert.getSubjectX500Principal()); + System.out.println("intermediate CA Issuer: " + interCert.getIssuerX500Principal()); + interCert.verify(rootCertificate.getPublicKey()); + System.out.println("Verified: Intermediate CA signed by test root CA"); + } + + private static class CustomHostnameVerifier implements HostnameVerifier { + @Override + public boolean verify(String hostname, SSLSession session) { + // Allow any hostname + return true; + } + } +} diff --git a/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java b/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java index d3c656043a2..66efefeee4a 100644 --- a/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java +++ b/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,7 +83,7 @@ public class AlpnGreaseTest implements SSLContextTemplate { new String(greaseBytes, StandardCharsets.ISO_8859_1); private static void findGreaseInClientHello(byte[] bytes) throws Exception { - for (int i = 0; i < bytes.length - greaseBytes.length; i++) { + for (int i = 0; i < bytes.length - greaseBytes.length + 1; i++) { if (Arrays.equals(bytes, i, i + greaseBytes.length, greaseBytes, 0, greaseBytes.length)) { System.out.println("Found greaseBytes in ClientHello at: " + i); diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt index 847d4f69391..9ad2b728dcd 100644 --- a/test/langtools/ProblemList.txt +++ b/test/langtools/ProblemList.txt @@ -60,7 +60,6 @@ tools/javac/importscope/T8193717.java # javap tools/javap/output/RepeatingTypeAnnotations.java 8057687 generic-all emit correct byte code an attributes for type annotations -tools/javap/T6587786.java 8195589 generic-all T6587786.java failed after JDK-8189997 ########################################################################### # diff --git a/test/langtools/jdk/jshell/HangingRemoteAgent.java b/test/langtools/jdk/jshell/HangingRemoteAgent.java index e64f1c25ea3..515f98731a3 100644 --- a/test/langtools/jdk/jshell/HangingRemoteAgent.java +++ b/test/langtools/jdk/jshell/HangingRemoteAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,12 +30,15 @@ import jdk.jshell.spi.ExecutionControlProvider; /** - * Hang for three minutes (long enough to cause a timeout). + * HangingRemoteAgent main() runs in its loop for 2X the timeout + * we give the launcher to fail to attach. */ class HangingRemoteAgent extends RemoteExecutionControl { - private static final long DELAY = 4000L; - private static final int TIMEOUT = 2000; + private static float timeoutFactor = Float.parseFloat(System.getProperty("test.timeout.factor", "1.0")); + + private static final int TIMEOUT = (int)(2000 * timeoutFactor); + private static final long DELAY = TIMEOUT * 2L; private static final boolean INFRA_VERIFY = false; public static void main(String[] args) throws Exception { diff --git a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java index 44354c57433..577228d4820 100644 --- a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * 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 8169519 + * @bug 8169519 8207166 * @summary Tests for JDI connector timeout failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build HangingRemoteAgent diff --git a/test/langtools/tools/javac/inference_context_min/DontMinimizeInfContextTest.java b/test/langtools/tools/javac/inference_context_min/DontMinimizeInfContextTest.java new file mode 100644 index 00000000000..40784555112 --- /dev/null +++ b/test/langtools/tools/javac/inference_context_min/DontMinimizeInfContextTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8232933 + * @summary Javac inferred type does not conform to equality constraint + * @compile DontMinimizeInfContextTest.java + */ + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +class DontMinimizeInfContextTest { + void m() { + List> a = new LinkedList<>(); + Map>> b = a.stream().collect( + Collectors.groupingBy(A::getval, Collectors.toList()) + ); + } + + class A { + String getval() { + return "s"; + } + } +} diff --git a/test/langtools/tools/javap/T6587786.java b/test/langtools/tools/javap/T6587786.java index 950ff20a463..4cb1acf5b1f 100644 --- a/test/langtools/tools/javap/T6587786.java +++ b/test/langtools/tools/javap/T6587786.java @@ -36,18 +36,21 @@ public static void main(String[] args) throws Exception { } public void run() throws IOException { - javap("com.sun.javadoc.Doc", "com.sun.crypto.provider.ai"); - javap("com.sun.crypto.provider.ai", "com.sun.javadoc.ClassDoc"); + javap("jdk.javadoc.doclet.Doclet", "java.util.List"); + javap("java.util.List", "jdk.javadoc.doclet.StandardDoclet"); } void javap(String... args) { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); //sun.tools.javap.Main.entry(args); - int rc = com.sun.tools.javap.Main.run(args, out); - if (rc != 0) - throw new Error("javap failed. rc=" + rc); - out.close(); - System.out.println(sw.toString()); + try { + int rc = com.sun.tools.javap.Main.run(args, out); + if (rc != 0) + throw new Error("javap failed. rc=" + rc); + } finally { + out.close(); + System.out.println(sw.toString()); + } } } diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java index f4ee0546c70..5b3f1889cb7 100644 --- a/test/lib/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -82,7 +82,7 @@ public static boolean isEmulatedClient() { } public static boolean isTieredSupported() { - return compiler.contains("Tiered Compilers"); + return (compiler != null) && compiler.contains("Tiered Compilers"); } public static boolean isInt() { diff --git a/test/lib/jdk/test/lib/cds/CDSTestUtils.java b/test/lib/jdk/test/lib/cds/CDSTestUtils.java index 6a75f7f229a..db6abb97899 100644 --- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java +++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java @@ -558,8 +558,12 @@ public static File getSourceFile(String name) { // ============================= Logging public static OutputAnalyzer executeAndLog(ProcessBuilder pb, String logName) throws Exception { + return executeAndLog(pb.start(), logName); + } + + public static OutputAnalyzer executeAndLog(Process process, String logName) throws Exception { long started = System.currentTimeMillis(); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + OutputAnalyzer output = new OutputAnalyzer(process); writeFile(getOutputFile(logName + ".stdout"), output.getStdout()); writeFile(getOutputFile(logName + ".stderr"), output.getStderr()); diff --git a/test/lib/jdk/test/lib/jfr/EventNames.java b/test/lib/jdk/test/lib/jfr/EventNames.java index ffdc88d26b3..df834c7fd31 100644 --- a/test/lib/jdk/test/lib/jfr/EventNames.java +++ b/test/lib/jdk/test/lib/jfr/EventNames.java @@ -175,6 +175,7 @@ public class EventNames { public final static String X509Certificate = PREFIX + "X509Certificate"; public final static String X509Validation = PREFIX + "X509Validation"; public final static String SecurityProperty = PREFIX + "SecurityPropertyModification"; + public final static String SecurityProviderService = PREFIX + "SecurityProviderService"; public final static String Deserialization = PREFIX + "Deserialization"; // Flight Recorder diff --git a/test/lib/jdk/test/lib/util/JarUtils.java b/test/lib/jdk/test/lib/util/JarUtils.java index cf4d1d515fa..b1cc74f5294 100644 --- a/test/lib/jdk/test/lib/util/JarUtils.java +++ b/test/lib/jdk/test/lib/util/JarUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,7 +157,7 @@ public static void updateJarFile(Path jarfile, Path dir, Path... files) while (jentries.hasMoreElements()) { JarEntry jentry = jentries.nextElement(); if (!names.contains(jentry.getName())) { - jos.putNextEntry(jentry); + jos.putNextEntry(copyEntry(jentry)); jf.getInputStream(jentry).transferTo(jos); } } @@ -289,7 +289,7 @@ public static void updateJar(String src, String dest, changes.remove(name); } else { System.out.println(String.format("- Copy %s", name)); - jos.putNextEntry(entry); + jos.putNextEntry(copyEntry(entry)); srcJarFile.getInputStream(entry).transferTo(jos); } } @@ -359,4 +359,17 @@ private static List findAllRegularFiles(Path dir, Path[] files) throws IOE } return entries; } + + private static JarEntry copyEntry(JarEntry e1) { + JarEntry e2 = new JarEntry(e1.getName()); + e2.setMethod(e1.getMethod()); + e2.setTime(e1.getTime()); + e2.setComment(e1.getComment()); + e2.setExtra(e1.getExtra()); + if (e1.getMethod() == JarEntry.STORED) { + e2.setSize(e1.getSize()); + e2.setCrc(e1.getCrc()); + } + return e2; + } }