diff --git a/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java b/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java index a51fe64ecac..9f262fa0106 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -156,13 +156,6 @@ String getID() { return id; } - String getJavaID() { - // Tweak ISO compatibility for bundle generation - return id.replaceFirst("^he", "iw") - .replaceFirst("^id", "in") - .replaceFirst("^yi", "ji"); - } - boolean isRoot() { return "root".equals(id); } diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java index ddd08b38863..5fd7a583a42 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -536,7 +536,6 @@ private static void convertBundles(List bundles) throws Exception { Map targetMap = bundle.getTargetMap(); EnumSet bundleTypes = bundle.getBundleTypes(); var id = bundle.getID(); - var javaId = bundle.getJavaID(); if (bundle.isRoot()) { // Add DateTimePatternChars because CLDR no longer supports localized patterns. @@ -548,31 +547,31 @@ private static void convertBundles(List bundles) throws Exception { if (bundleTypes.contains(Bundle.Type.LOCALENAMES)) { Map localeNamesMap = extractLocaleNames(targetMap, id); if (!localeNamesMap.isEmpty() || bundle.isRoot()) { - bundleGenerator.generateBundle("util", "LocaleNames", javaId, true, localeNamesMap, BundleType.OPEN); + bundleGenerator.generateBundle("util", "LocaleNames", id, true, localeNamesMap, BundleType.OPEN); } } if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) { Map currencyNamesMap = extractCurrencyNames(targetMap, id, bundle.getCurrencies()); if (!currencyNamesMap.isEmpty() || bundle.isRoot()) { - bundleGenerator.generateBundle("util", "CurrencyNames", javaId, true, currencyNamesMap, BundleType.OPEN); + bundleGenerator.generateBundle("util", "CurrencyNames", id, true, currencyNamesMap, BundleType.OPEN); } } if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) { Map zoneNamesMap = extractZoneNames(targetMap, id); if (!zoneNamesMap.isEmpty() || bundle.isRoot()) { - bundleGenerator.generateBundle("util", "TimeZoneNames", javaId, true, zoneNamesMap, BundleType.TIMEZONE); + bundleGenerator.generateBundle("util", "TimeZoneNames", id, true, zoneNamesMap, BundleType.TIMEZONE); } } if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) { Map calendarDataMap = extractCalendarData(targetMap, id); if (!calendarDataMap.isEmpty() || bundle.isRoot()) { - bundleGenerator.generateBundle("util", "CalendarData", javaId, true, calendarDataMap, BundleType.PLAIN); + bundleGenerator.generateBundle("util", "CalendarData", id, true, calendarDataMap, BundleType.PLAIN); } } if (bundleTypes.contains(Bundle.Type.FORMATDATA)) { Map formatDataMap = extractFormatData(targetMap, id); if (!formatDataMap.isEmpty() || bundle.isRoot()) { - bundleGenerator.generateBundle("text", "FormatData", javaId, true, formatDataMap, BundleType.PLAIN); + bundleGenerator.generateBundle("text", "FormatData", id, true, formatDataMap, BundleType.PLAIN); } } diff --git a/make/modules/java.rmi/Launcher.gmk b/make/modules/java.rmi/Launcher.gmk index a69a90bcc81..8a540da898b 100644 --- a/make/modules/java.rmi/Launcher.gmk +++ b/make/modules/java.rmi/Launcher.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -25,10 +25,6 @@ include LauncherCommon.gmk -$(eval $(call SetupBuildLauncher, rmid, \ - MAIN_CLASS := sun.rmi.server.Activation, \ -)) - $(eval $(call SetupBuildLauncher, rmiregistry, \ MAIN_CLASS := sun.rmi.registry.RegistryImpl, \ )) diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index 7ab9074c36c..347ed27278d 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -8735,6 +8735,61 @@ instruct castLL(iRegL dst) ins_pipe(pipe_class_empty); %} +instruct castFF(vRegF dst) +%{ + match(Set dst (CastFF dst)); + + size(0); + format %{ "# castFF of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(pipe_class_empty); +%} + +instruct castDD(vRegD dst) +%{ + match(Set dst (CastDD dst)); + + size(0); + format %{ "# castDD of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(pipe_class_empty); +%} + +instruct castVVD(vecD dst) +%{ + match(Set dst (CastVV dst)); + + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(pipe_class_empty); +%} + +instruct castVVX(vecX dst) +%{ + match(Set dst (CastVV dst)); + + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(pipe_class_empty); +%} + +instruct castVV(vReg dst) +%{ + match(Set dst (CastVV dst)); + + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(pipe_class_empty); +%} + // ============================================================================ // Atomic operation instructions // diff --git a/src/hotspot/cpu/aarch64/aarch64_neon.ad b/src/hotspot/cpu/aarch64/aarch64_neon.ad index 5adb7d9ca97..99526155c45 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon.ad +++ b/src/hotspot/cpu/aarch64/aarch64_neon.ad @@ -874,21 +874,19 @@ instruct reduce_min4I(iRegINoSp dst, iRegIorL2I isrc, vecX vsrc, vecX tmp, rFlag ins_pipe(pipe_slow); %} -instruct reduce_max2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecX tmp, rFlagsReg cr) +instruct reduce_max2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecD tmp, rFlagsReg cr) %{ predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_INT); match(Set dst (MaxReductionV isrc vsrc)); ins_cost(INSN_COST); effect(TEMP_DEF dst, TEMP tmp, KILL cr); - format %{ "dup $tmp, T2D, $vsrc\n\t" - "smaxv $tmp, T4S, $tmp\n\t" + format %{ "smaxp $tmp, T2S, $vsrc, $vsrc\n\t" "umov $dst, $tmp, S, 0\n\t" "cmpw $dst, $isrc\n\t" "cselw $dst, $dst, $isrc GT\t# max reduction2I" %} ins_encode %{ - __ dup(as_FloatRegister($tmp$$reg), __ T2D, as_FloatRegister($vsrc$$reg)); - __ smaxv(as_FloatRegister($tmp$$reg), __ T4S, as_FloatRegister($tmp$$reg)); + __ smaxp(as_FloatRegister($tmp$$reg), __ T2S, as_FloatRegister($vsrc$$reg), as_FloatRegister($vsrc$$reg)); __ umov(as_Register($dst$$reg), as_FloatRegister($tmp$$reg), __ S, 0); __ cmpw(as_Register($dst$$reg), as_Register($isrc$$reg)); __ cselw(as_Register($dst$$reg), as_Register($dst$$reg), as_Register($isrc$$reg), Assembler::GT); @@ -896,21 +894,19 @@ instruct reduce_max2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecX tmp, rFlag ins_pipe(pipe_slow); %} -instruct reduce_min2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecX tmp, rFlagsReg cr) +instruct reduce_min2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecD tmp, rFlagsReg cr) %{ predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_INT); match(Set dst (MinReductionV isrc vsrc)); ins_cost(INSN_COST); effect(TEMP_DEF dst, TEMP tmp, KILL cr); - format %{ "dup $tmp, T2D, $vsrc\n\t" - "sminv $tmp, T4S, $tmp\n\t" + format %{ "sminp $tmp, T2S, $vsrc, $vsrc\n\t" "umov $dst, $tmp, S, 0\n\t" "cmpw $dst, $isrc\n\t" "cselw $dst, $dst, $isrc LT\t# min reduction2I" %} ins_encode %{ - __ dup(as_FloatRegister($tmp$$reg), __ T2D, as_FloatRegister($vsrc$$reg)); - __ sminv(as_FloatRegister($tmp$$reg), __ T4S, as_FloatRegister($tmp$$reg)); + __ sminp(as_FloatRegister($tmp$$reg), __ T2S, as_FloatRegister($vsrc$$reg), as_FloatRegister($vsrc$$reg)); __ umov(as_Register($dst$$reg), as_FloatRegister($tmp$$reg), __ S, 0); __ cmpw(as_Register($dst$$reg), as_Register($isrc$$reg)); __ cselw(as_Register($dst$$reg), as_Register($dst$$reg), as_Register($isrc$$reg), Assembler::LT); @@ -4053,22 +4049,21 @@ instruct replicate2D(vecX dst, vRegD src) // ====================REDUCTION ARITHMETIC==================================== -instruct reduce_add2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, iRegINoSp tmp, iRegINoSp tmp2) +instruct reduce_add2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecD vtmp, iRegINoSp itmp) %{ predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_INT); match(Set dst (AddReductionVI isrc vsrc)); ins_cost(INSN_COST); - effect(TEMP tmp, TEMP tmp2); - format %{ "umov $tmp, $vsrc, S, 0\n\t" - "umov $tmp2, $vsrc, S, 1\n\t" - "addw $tmp, $isrc, $tmp\n\t" - "addw $dst, $tmp, $tmp2\t# add reduction2I" + effect(TEMP vtmp, TEMP itmp); + format %{ "addpv $vtmp, T2S, $vsrc, $vsrc\n\t" + "umov $itmp, $vtmp, S, 0\n\t" + "addw $dst, $itmp, $isrc\t# add reduction2I" %} ins_encode %{ - __ umov($tmp$$Register, as_FloatRegister($vsrc$$reg), __ S, 0); - __ umov($tmp2$$Register, as_FloatRegister($vsrc$$reg), __ S, 1); - __ addw($tmp$$Register, $isrc$$Register, $tmp$$Register); - __ addw($dst$$Register, $tmp$$Register, $tmp2$$Register); + __ addpv(as_FloatRegister($vtmp$$reg), __ T2S, + as_FloatRegister($vsrc$$reg), as_FloatRegister($vsrc$$reg)); + __ umov($itmp$$Register, as_FloatRegister($vtmp$$reg), __ S, 0); + __ addw($dst$$Register, $itmp$$Register, $isrc$$Register); %} ins_pipe(pipe_class_default); %} diff --git a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 index b2f2f0c3d0e..1ecf682dea6 100644 --- a/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 +++ b/src/hotspot/cpu/aarch64/aarch64_neon_ad.m4 @@ -496,21 +496,19 @@ REDUCE_MAX_MIN_INT(min, 8, S, X, Min, s, LT) REDUCE_MAX_MIN_INT(min, 4, I, X, Min, u, LT) dnl define(`REDUCE_MAX_MIN_2I', ` -instruct reduce_$1`'2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecX tmp, rFlagsReg cr) +instruct reduce_$1`'2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, vecD tmp, rFlagsReg cr) %{ predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_INT); match(Set dst ($2ReductionV isrc vsrc)); ins_cost(INSN_COST); effect(TEMP_DEF dst, TEMP tmp, KILL cr); - format %{ "dup $tmp, T2D, $vsrc\n\t" - "s$1v $tmp, T4S, $tmp\n\t" + format %{ "s$1p $tmp, T2S, $vsrc, $vsrc\n\t" "umov $dst, $tmp, S, 0\n\t" "cmpw $dst, $isrc\n\t" "cselw $dst, $dst, $isrc $3\t# $1 reduction2I" %} ins_encode %{ - __ dup(as_FloatRegister($tmp$$reg), __ T2D, as_FloatRegister($vsrc$$reg)); - __ s$1v(as_FloatRegister($tmp$$reg), __ T4S, as_FloatRegister($tmp$$reg)); + __ s$1p(as_FloatRegister($tmp$$reg), __ T2S, as_FloatRegister($vsrc$$reg), as_FloatRegister($vsrc$$reg)); __ umov(as_Register($dst$$reg), as_FloatRegister($tmp$$reg), __ S, 0); __ cmpw(as_Register($dst$$reg), as_Register($isrc$$reg)); __ cselw(as_Register($dst$$reg), as_Register($dst$$reg), as_Register($isrc$$reg), Assembler::$3); @@ -1603,27 +1601,22 @@ dnl // ====================REDUCTION ARITHMETIC==================================== dnl define(`REDUCE_ADD_INT', ` -instruct reduce_add$1$2`'(iRegINoSp dst, iRegIorL2I isrc, vec$3 vsrc, ifelse($1, 2, iRegINoSp tmp, vecX vtmp), iRegINoSp ifelse($1, 2, tmp2, itmp)) +instruct reduce_add$1$2`'(iRegINoSp dst, iRegIorL2I isrc, vec$3 vsrc, vec$3 vtmp, iRegINoSp itmp) %{ predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_INT); match(Set dst (AddReductionVI isrc vsrc)); ins_cost(INSN_COST); - effect(TEMP ifelse($1, 2, tmp, vtmp), TEMP ifelse($1, 2, tmp2, itmp)); - format %{ ifelse($1, 2, `"umov $tmp, $vsrc, S, 0\n\t" - "umov $tmp2, $vsrc, S, 1\n\t" - "addw $tmp, $isrc, $tmp\n\t" - "addw $dst, $tmp, $tmp2\t# add reduction2I"',`"addv $vtmp, T4S, $vsrc\n\t" + effect(TEMP vtmp, TEMP itmp); + format %{ ifelse($1, 2, `"addpv $vtmp, T2S, $vsrc, $vsrc\n\t"',`"addv $vtmp, T4S, $vsrc\n\t"') "umov $itmp, $vtmp, S, 0\n\t" - "addw $dst, $itmp, $isrc\t# add reduction4I"') + "addw $dst, $itmp, $isrc\t# add reduction$1I" %} ins_encode %{ - ifelse($1, 2, `__ umov($tmp$$Register, as_FloatRegister($vsrc$$reg), __ S, 0); - __ umov($tmp2$$Register, as_FloatRegister($vsrc$$reg), __ S, 1); - __ addw($tmp$$Register, $isrc$$Register, $tmp$$Register); - __ addw($dst$$Register, $tmp$$Register, $tmp2$$Register);', `__ addv(as_FloatRegister($vtmp$$reg), __ T4S, - as_FloatRegister($vsrc$$reg)); + ifelse($1, 2, `__ addpv(as_FloatRegister($vtmp$$reg), __ T2S, + as_FloatRegister($vsrc$$reg), as_FloatRegister($vsrc$$reg));', `__ addv(as_FloatRegister($vtmp$$reg), __ T4S, + as_FloatRegister($vsrc$$reg));') __ umov($itmp$$Register, as_FloatRegister($vtmp$$reg), __ S, 0); - __ addw($dst$$Register, $itmp$$Register, $isrc$$Register);') + __ addw($dst$$Register, $itmp$$Register, $isrc$$Register); %} ins_pipe(pipe_class_default); %}')dnl diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp index ca464c13d4d..8415a34fb41 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp @@ -2404,6 +2404,8 @@ void mvnw(Register Rd, Register Rm, INSN(umlalv, 1, 0b100000, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S INSN(maxv, 0, 0b011001, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S INSN(minv, 0, 0b011011, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(smaxp, 0, 0b101001, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S + INSN(sminp, 0, 0b101011, false); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S INSN(cmeq, 1, 0b100011, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D INSN(cmgt, 0, 0b001101, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D INSN(cmge, 0, 0b001111, true); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index 24a604de8e0..3a7d753cabb 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -5182,6 +5182,39 @@ instruct castLL( iRegL dst ) %{ ins_pipe(empty); %} +instruct castFF( regF dst ) %{ + match(Set dst (CastFF dst)); + format %{ "! castFF of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe(empty); +%} + +instruct castDD( regD dst ) %{ + match(Set dst (CastDD dst)); + format %{ "! castDD of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe(empty); +%} + +instruct castVVD( vecD dst ) %{ + match(Set dst (CastVV dst)); + format %{ "! castVV of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe(empty); +%} + +instruct castVVX( vecX dst ) %{ + match(Set dst (CastVV dst)); + format %{ "! castVV of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe(empty); +%} + + //----------Arithmetic Instructions-------------------------------------------- // Addition Instructions // Register Addition diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 62f78592b2c..fd60f32ec5a 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -10335,6 +10335,38 @@ instruct castLL(iRegLdst dst) %{ ins_pipe(pipe_class_default); %} +instruct castFF(regF dst) %{ + match(Set dst (CastFF dst)); + format %{ " -- \t// castFF of $dst" %} + size(0); + ins_encode( /*empty*/ ); + ins_pipe(pipe_class_default); +%} + +instruct castDD(regD dst) %{ + match(Set dst (CastDD dst)); + format %{ " -- \t// castDD of $dst" %} + size(0); + ins_encode( /*empty*/ ); + ins_pipe(pipe_class_default); +%} + +instruct castVV8(iRegLdst dst) %{ + match(Set dst (CastVV dst)); + format %{ " -- \t// castVV of $dst" %} + size(0); + ins_encode( /*empty*/ ); + ins_pipe(pipe_class_default); +%} + +instruct castVV16(vecX dst) %{ + match(Set dst (CastVV dst)); + format %{ " -- \t// castVV of $dst" %} + size(0); + ins_encode( /*empty*/ ); + ins_pipe(pipe_class_default); +%} + instruct checkCastPP(iRegPdst dst) %{ match(Set dst (CheckCastPP dst)); format %{ " -- \t// checkcastPP of $dst" %} diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index e6eed075c21..46da1cb0732 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -5260,6 +5260,30 @@ instruct castLL(iRegL dst) %{ ins_pipe(pipe_class_dummy); %} +instruct castFF(regF dst) %{ + match(Set dst (CastFF dst)); + size(0); + format %{ "# castFF of $dst" %} + ins_encode(/*empty*/); + ins_pipe(pipe_class_dummy); +%} + +instruct castDD(regD dst) %{ + match(Set dst (CastDD dst)); + size(0); + format %{ "# castDD of $dst" %} + ins_encode(/*empty*/); + ins_pipe(pipe_class_dummy); +%} + +instruct castVV(iRegL dst) %{ + match(Set dst (CastVV dst)); + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/*empty*/); + ins_pipe(pipe_class_dummy); +%} + //----------Conditional_store-------------------------------------------------- // Conditional-store of the updated heap-top. // Used during allocation of the shared heap. diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index c5236b35bf4..72629508414 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -1471,7 +1471,7 @@ void Assembler::vaesenclast(XMMRegister dst, XMMRegister nds, XMMRegister src, i void Assembler::andb(Address dst, Register src) { InstructionMark im(this); - prefix(dst, src); + prefix(dst, src, true); emit_int8(0x20); emit_operand(src, dst); } diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index edba6aace8e..5f6d5bc6fdb 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -8127,3 +8127,25 @@ instruct vmask_first_or_last_true_avx(rRegI dst, vec mask, rRegL tmp, vec xtmp, ins_pipe( pipe_slow ); %} #endif // _LP64 + +instruct castVV(vec dst) +%{ + match(Set dst (CastVV dst)); + + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(empty); +%} + +instruct castVVLeg(legVec dst) +%{ + match(Set dst (CastVV dst)); + + size(0); + format %{ "# castVV of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(empty); +%} diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index a00b64e9434..e2f4cfac644 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -7178,6 +7178,22 @@ instruct castLL( eRegL dst ) %{ ins_pipe( empty ); %} +instruct castFF( regF dst ) %{ + match(Set dst (CastFF dst)); + format %{ "#castFF of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe( empty ); +%} + +instruct castDD( regD dst ) %{ + match(Set dst (CastDD dst)); + format %{ "#castDD of $dst" %} + ins_encode( /*empty encoding*/ ); + ins_cost(0); + ins_pipe( empty ); +%} + // Load-locked - same as a regular pointer load when used with compare-swap instruct loadPLocked(eRegP dst, memory mem) %{ match(Set dst (LoadPLocked mem)); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index b317182ca4f..b252ee49576 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -7624,6 +7624,28 @@ instruct castLL(rRegL dst) ins_pipe(empty); %} +instruct castFF(regF dst) +%{ + match(Set dst (CastFF dst)); + + size(0); + format %{ "# castFF of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(empty); +%} + +instruct castDD(regD dst) +%{ + match(Set dst (CastDD dst)); + + size(0); + format %{ "# castDD of $dst" %} + ins_encode(/* empty encoding */); + ins_cost(0); + ins_pipe(empty); +%} + // LoadP-locked same as a regular LoadP when used with compare-swap instruct loadPLocked(rRegP dst, memory mem) %{ diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 1e0c375a025..551accf97f4 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -2346,6 +2346,9 @@ void os::print_memory_info(outputStream* st) { st->print("(" UINT64_FORMAT "k free)", ((jlong)si.freeswap * si.mem_unit) >> 10); st->cr(); + st->print("Page Sizes: "); + _page_sizes.print_on(st); + st->cr(); } // Print the first "model name" line and the first "flags" line @@ -3504,6 +3507,25 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) { // Mapping succeeded, sanity check passed. munmap(p, page_size); return true; + } else { + log_info(pagesize)("Large page size (" SIZE_FORMAT "%s) failed sanity check, " + "checking if smaller large page sizes are usable", + byte_size_in_exact_unit(page_size), + exact_unit_for_byte_size(page_size)); + for (size_t page_size_ = _page_sizes.next_smaller(page_size); + page_size_ != (size_t)os::vm_page_size(); + page_size_ = _page_sizes.next_smaller(page_size_)) { + flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB | hugetlbfs_page_size_flag(page_size_); + p = mmap(NULL, page_size_, PROT_READ|PROT_WRITE, flags, -1, 0); + if (p != MAP_FAILED) { + // Mapping succeeded, sanity check passed. + munmap(p, page_size_); + log_info(pagesize)("Large page size (" SIZE_FORMAT "%s) passed sanity check", + byte_size_in_exact_unit(page_size_), + exact_unit_for_byte_size(page_size_)); + return true; + } + } } if (warn) { @@ -3578,35 +3600,20 @@ static void set_coredump_filter(CoredumpFilterBit bit) { static size_t _large_page_size = 0; -size_t os::Linux::find_default_large_page_size() { - if (_default_large_page_size != 0) { - return _default_large_page_size; - } - size_t large_page_size = 0; +static size_t scan_default_large_page_size() { + size_t default_large_page_size = 0; // large_page_size on Linux is used to round up heap size. x86 uses either // 2M or 4M page, depending on whether PAE (Physical Address Extensions) // mode is enabled. AMD64/EM64T uses 2M page in 64bit mode. IA64 can use - // page as large as 256M. + // page as large as 1G. // // Here we try to figure out page size by parsing /proc/meminfo and looking // for a line with the following format: // Hugepagesize: 2048 kB // // If we can't determine the value (e.g. /proc is not mounted, or the text - // format has been changed), we'll use the largest page size supported by - // the processor. - -#ifndef ZERO - large_page_size = - AARCH64_ONLY(2 * M) - AMD64_ONLY(2 * M) - ARM32_ONLY(2 * M) - IA32_ONLY(4 * M) - IA64_ONLY(256 * M) - PPC_ONLY(4 * M) - S390_ONLY(1 * M); -#endif // ZERO + // format has been changed), we'll set largest page size to 0 FILE *fp = fopen("/proc/meminfo", "r"); if (fp) { @@ -3615,7 +3622,7 @@ size_t os::Linux::find_default_large_page_size() { char buf[16]; if (fscanf(fp, "Hugepagesize: %d", &x) == 1) { if (x && fgets(buf, sizeof(buf), fp) && strcmp(buf, " kB\n") == 0) { - large_page_size = x * K; + default_large_page_size = x * K; break; } } else { @@ -3628,21 +3635,17 @@ size_t os::Linux::find_default_large_page_size() { } fclose(fp); } - return large_page_size; + + return default_large_page_size; } -size_t os::Linux::find_large_page_size(size_t large_page_size) { - if (_default_large_page_size == 0) { - _default_large_page_size = Linux::find_default_large_page_size(); - } - // We need to scan /sys/kernel/mm/hugepages +static os::PageSizes scan_multiple_page_support() { + // Scan /sys/kernel/mm/hugepages // to discover the available page sizes const char* sys_hugepages = "/sys/kernel/mm/hugepages"; + os::PageSizes page_sizes; DIR *dir = opendir(sys_hugepages); - if (dir == NULL) { - return _default_large_page_size; - } struct dirent *entry; size_t page_size; @@ -3650,43 +3653,32 @@ size_t os::Linux::find_large_page_size(size_t large_page_size) { if (entry->d_type == DT_DIR && sscanf(entry->d_name, "hugepages-%zukB", &page_size) == 1) { // The kernel is using kB, hotspot uses bytes - if (large_page_size == page_size * K) { - closedir(dir); - return large_page_size; - } + // Add each found Large Page Size to page_sizes + page_sizes.add(page_size * K); } } closedir(dir); - return _default_large_page_size; -} - -size_t os::Linux::setup_large_page_size() { - _default_large_page_size = Linux::find_default_large_page_size(); - - if (!FLAG_IS_DEFAULT(LargePageSizeInBytes) && LargePageSizeInBytes != _default_large_page_size ) { - _large_page_size = find_large_page_size(LargePageSizeInBytes); - if (_large_page_size == _default_large_page_size) { - warning("Setting LargePageSizeInBytes=" SIZE_FORMAT " has no effect on this OS. Using the default large page size " - SIZE_FORMAT "%s.", - LargePageSizeInBytes, - byte_size_in_proper_unit(_large_page_size), proper_unit_for_byte_size(_large_page_size)); - } - } else { - _large_page_size = _default_large_page_size; - } - const size_t default_page_size = (size_t)Linux::page_size(); - if (_large_page_size > default_page_size) { - _page_sizes.add(_large_page_size); + LogTarget(Debug, pagesize) lt; + if (lt.is_enabled()) { + LogStream ls(lt); + ls.print("Large Page sizes: "); + page_sizes.print_on(&ls); } - return _large_page_size; + return page_sizes; } size_t os::Linux::default_large_page_size() { return _default_large_page_size; } +void warn_no_large_pages_configured() { + if (!FLAG_IS_DEFAULT(UseLargePages)) { + log_warning(pagesize)("UseLargePages disabled, no large pages configured and available on the system."); + } +} + bool os::Linux::setup_large_page_type(size_t page_size) { if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM) && @@ -3729,13 +3721,13 @@ bool os::Linux::setup_large_page_type(size_t page_size) { UseSHM = false; } - if (!FLAG_IS_DEFAULT(UseLargePages)) { - log_warning(pagesize)("UseLargePages disabled, no large pages configured and available on the system."); - } + warn_no_large_pages_configured(); return false; } void os::large_page_init() { + // 1) Handle the case where we do not want to use huge pages and hence + // there is no need to scan the OS for related info if (!UseLargePages && !UseTransparentHugePages && !UseHugeTLBFS && @@ -3753,8 +3745,73 @@ void os::large_page_init() { return; } - size_t large_page_size = Linux::setup_large_page_size(); - UseLargePages = Linux::setup_large_page_type(large_page_size); + // 2) Scan OS info + size_t default_large_page_size = scan_default_large_page_size(); + os::Linux::_default_large_page_size = default_large_page_size; + if (default_large_page_size == 0) { + // No large pages configured, return. + warn_no_large_pages_configured(); + UseLargePages = false; + UseTransparentHugePages = false; + UseHugeTLBFS = false; + UseSHM = false; + return; + } + os::PageSizes all_large_pages = scan_multiple_page_support(); + + // 3) Consistency check and post-processing + + // It is unclear if /sys/kernel/mm/hugepages/ and /proc/meminfo could disagree. Manually + // re-add the default page size to the list of page sizes to be sure. + all_large_pages.add(default_large_page_size); + + // Check LargePageSizeInBytes matches an available page size and if so set _large_page_size + // using LargePageSizeInBytes as the maximum allowed large page size. If LargePageSizeInBytes + // doesn't match an available page size set _large_page_size to default_large_page_size + // and use it as the maximum. + if (FLAG_IS_DEFAULT(LargePageSizeInBytes) || + LargePageSizeInBytes == 0 || + LargePageSizeInBytes == default_large_page_size) { + _large_page_size = default_large_page_size; + log_info(pagesize)("Using the default large page size: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(_large_page_size), + exact_unit_for_byte_size(_large_page_size)); + } else { + if (all_large_pages.contains(LargePageSizeInBytes)) { + _large_page_size = LargePageSizeInBytes; + log_info(pagesize)("Overriding default large page size (" SIZE_FORMAT "%s) " + "using LargePageSizeInBytes: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(default_large_page_size), + exact_unit_for_byte_size(default_large_page_size), + byte_size_in_exact_unit(_large_page_size), + exact_unit_for_byte_size(_large_page_size)); + } else { + _large_page_size = default_large_page_size; + log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (" SIZE_FORMAT "%s) " + "using the default large page size: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(LargePageSizeInBytes), + exact_unit_for_byte_size(LargePageSizeInBytes), + byte_size_in_exact_unit(_large_page_size), + exact_unit_for_byte_size(_large_page_size)); + } + } + + // Populate _page_sizes with large page sizes less than or equal to + // _large_page_size. + for (size_t page_size = _large_page_size; page_size != 0; + page_size = all_large_pages.next_smaller(page_size)) { + _page_sizes.add(page_size); + } + + LogTarget(Info, pagesize) lt; + if (lt.is_enabled()) { + LogStream ls(lt); + ls.print("Usable page sizes: "); + _page_sizes.print_on(&ls); + } + + // Now determine the type of large pages to use: + UseLargePages = os::Linux::setup_large_page_type(_large_page_size); set_coredump_filter(LARGEPAGES_BIT); } @@ -3965,6 +4022,7 @@ char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, assert(is_aligned(req_addr, page_size), "Must be"); assert(is_aligned(alignment, os::vm_allocation_granularity()), "Must be"); assert(_page_sizes.contains(page_size), "Must be a valid page size"); + assert(page_size > (size_t)os::vm_page_size(), "Must be a large page size"); assert(bytes >= page_size, "Shouldn't allocate large pages for small sizes"); // We only end up here when at least 1 large page can be used. diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 8659175b653..e32996302e6 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -78,9 +78,8 @@ class Linux { static GrowableArray* nindex_to_node() { return _nindex_to_node; } static size_t default_large_page_size(); - static size_t find_default_large_page_size(); - static size_t find_large_page_size(size_t page_size); - static size_t setup_large_page_size(); + static size_t scan_default_large_page_size(); + static os::PageSizes scan_multiple_page_support(); static bool setup_large_page_type(size_t page_size); static bool transparent_huge_pages_sanity_check(bool warn, size_t pages_size); diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index b9f48898d9d..7db1b9b7039 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -714,6 +714,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, case os::vm_thread: case os::pgc_thread: case os::cgc_thread: + case os::asynclog_thread: case os::watcher_thread: if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); break; diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp index 1eb62bf4228..ad48c6e4747 100644 --- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp @@ -551,6 +551,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // the si_code for this condition may change in the future. // Furthermore, a false-positive should be harmless. if (UnguardOnExecutionViolation > 0 && + stub == NULL && (sig == SIGSEGV || sig == SIGBUS) && uc->context_trapno == trap_page_fault) { int page_size = os::vm_page_size(); diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 3c5ea2983bc..f4c7c444ee5 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -343,6 +343,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // the si_code for this condition may change in the future. // Furthermore, a false-positive should be harmless. if (UnguardOnExecutionViolation > 0 && + stub == NULL && (sig == SIGSEGV || sig == SIGBUS) && uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { int page_size = os::vm_page_size(); diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp index 673558e9dea..a11d8b61258 100644 --- a/src/hotspot/share/adlc/formssel.cpp +++ b/src/hotspot/share/adlc/formssel.cpp @@ -764,6 +764,11 @@ int InstructForm::memory_operand(FormDict &globals) const { bool InstructForm::captures_bottom_type(FormDict &globals) const { if (_matrule && _matrule->_rChild && (!strcmp(_matrule->_rChild->_opType,"CastPP") || // new result type + !strcmp(_matrule->_rChild->_opType,"CastDD") || + !strcmp(_matrule->_rChild->_opType,"CastFF") || + !strcmp(_matrule->_rChild->_opType,"CastII") || + !strcmp(_matrule->_rChild->_opType,"CastLL") || + !strcmp(_matrule->_rChild->_opType,"CastVV") || !strcmp(_matrule->_rChild->_opType,"CastX2P") || // new result type !strcmp(_matrule->_rChild->_opType,"DecodeN") || !strcmp(_matrule->_rChild->_opType,"EncodeP") || diff --git a/src/hotspot/share/c1/c1_Compiler.cpp b/src/hotspot/share/c1/c1_Compiler.cpp index eec37e4e5fc..3795b4e0192 100644 --- a/src/hotspot/share/c1/c1_Compiler.cpp +++ b/src/hotspot/share/c1/c1_Compiler.cpp @@ -223,11 +223,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) { #ifdef JFR_HAVE_INTRINSICS case vmIntrinsics::_counterTime: case vmIntrinsics::_getEventWriter: -#if defined(_LP64) || !defined(TRACE_ID_SHIFT) - case vmIntrinsics::_getClassId: #endif -#endif - break; case vmIntrinsics::_getObjectSize: break; case vmIntrinsics::_blackhole: diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp index 79795a95da3..a93009cff3d 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.cpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp @@ -3055,33 +3055,6 @@ void LIRGenerator::do_IfOp(IfOp* x) { } #ifdef JFR_HAVE_INTRINSICS -void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) { - CodeEmitInfo* info = state_for(x); - CodeEmitInfo* info2 = new CodeEmitInfo(info); // Clone for the second null check - - assert(info != NULL, "must have info"); - LIRItem arg(x->argument_at(0), this); - - arg.load_item(); - LIR_Opr klass = new_register(T_METADATA); - __ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset(), T_ADDRESS), klass, info); - LIR_Opr id = new_register(T_LONG); - ByteSize offset = KLASS_TRACE_ID_OFFSET; - LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG); - - __ move(trace_id_addr, id); - __ logical_or(id, LIR_OprFact::longConst(0x01l), id); - __ store(id, trace_id_addr); - -#ifdef TRACE_ID_META_BITS - __ logical_and(id, LIR_OprFact::longConst(~TRACE_ID_META_BITS), id); -#endif -#ifdef TRACE_ID_SHIFT - __ unsigned_shift_right(id, TRACE_ID_SHIFT, id); -#endif - - __ move(id, rlock_result(x)); -} void LIRGenerator::do_getEventWriter(Intrinsic* x) { LabelObj* L_end = new LabelObj(); @@ -3131,9 +3104,6 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { } #ifdef JFR_HAVE_INTRINSICS - case vmIntrinsics::_getClassId: - do_ClassIDIntrinsic(x); - break; case vmIntrinsics::_getEventWriter: do_getEventWriter(x); break; diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 1ab24193357..82cb3128419 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -390,7 +390,7 @@ static void rewrite_nofast_bytecode(const methodHandle& method) { void MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread* thread, InstanceKlass* ik) { for (int i = 0; i < ik->methods()->length(); i++) { methodHandle m(thread, ik->methods()->at(i)); - if (!ik->has_old_class_version()) { + if (!ik->can_be_verified_at_dumptime()) { rewrite_nofast_bytecode(m); } Fingerprinter fp(m); @@ -580,7 +580,7 @@ class CollectCLDClosure : public CLDClosure { bool MetaspaceShared::linking_required(InstanceKlass* ik) { // For static CDS dump, do not link old classes. // For dynamic CDS dump, only link classes loaded by the builtin class loaders. - return DumpSharedSpaces ? !ik->has_old_class_version() : !ik->is_shared_unregistered_class(); + return DumpSharedSpaces ? !ik->can_be_verified_at_dumptime() : !ik->is_shared_unregistered_class(); } bool MetaspaceShared::link_class_for_cds(InstanceKlass* ik, TRAPS) { @@ -756,7 +756,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) { ExceptionMark em(current); JavaThread* THREAD = current; // For exception macros. Arguments::assert_is_dumping_archive(); - if (ik->is_loaded() && !ik->is_linked() && !ik->has_old_class_version() && + if (ik->is_loaded() && !ik->is_linked() && !ik->can_be_verified_at_dumptime() && !SystemDictionaryShared::has_class_failed_verification(ik)) { bool saved = BytecodeVerificationLocal; if (ik->is_shared_unregistered_class() && ik->class_loader() == NULL) { diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp index d536ebf5dd5..a10a9d3d551 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp @@ -188,10 +188,6 @@ void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) { } } -void BCEscapeAnalyzer::set_dirty(ArgumentMap vars) { - clear_bits(vars, _dirty); -} - void BCEscapeAnalyzer::set_modified(ArgumentMap vars, int offs, int size) { for (int i = 0; i < _arg_size; i++) { @@ -490,7 +486,6 @@ void BCEscapeAnalyzer::iterate_one_block(ciBlock *blk, StateInfo &state, Growabl ArgumentMap array = state.apop(); set_method_escape(array); state.apush(unknown_obj); - set_dirty(array); } break; case Bytecodes::_istore: @@ -1451,7 +1446,6 @@ BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent) , _arg_local(_arena) , _arg_stack(_arena) , _arg_returned(_arena) - , _dirty(_arena) , _return_local(false) , _return_allocated(false) , _allocated_escapes(false) @@ -1463,7 +1457,6 @@ BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent) _arg_local.clear(); _arg_stack.clear(); _arg_returned.clear(); - _dirty.clear(); Arena* arena = CURRENT_ENV->arena(); _arg_modified = (uint *) arena->Amalloc(_arg_size * sizeof(uint)); Copy::zero_to_bytes(_arg_modified, _arg_size * sizeof(uint)); diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.hpp b/src/hotspot/share/ci/bcEscapeAnalyzer.hpp index 1dd1e13d29b..79f28847d05 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.hpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.hpp @@ -54,7 +54,6 @@ class BCEscapeAnalyzer : public ResourceObj { VectorSet _arg_local; VectorSet _arg_stack; VectorSet _arg_returned; - VectorSet _dirty; enum{ ARG_OFFSET_MAX = 31}; uint *_arg_modified; @@ -84,7 +83,6 @@ class BCEscapeAnalyzer : public ResourceObj { void clear_bits(ArgumentMap vars, VectorSet &bs); void set_method_escape(ArgumentMap vars); void set_global_escape(ArgumentMap vars, bool merge = false); - void set_dirty(ArgumentMap vars); void set_modified(ArgumentMap vars, int offs, int size); bool is_recursive_call(ciMethod* callee); diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 52bba31c599..724ecfcd586 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -722,18 +722,17 @@ ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current, const char *path, const struct stat* st, bool is_boot_append, bool from_class_path_attr) { - JavaThread* thread = current->as_Java_thread(); ClassPathEntry* new_entry = NULL; if ((st->st_mode & S_IFMT) == S_IFREG) { - ResourceMark rm(thread); + ResourceMark rm(current); // Regular file, should be a zip file // Canonicalized filename - const char* canonical_path = get_canonical_path(path, thread); + const char* canonical_path = get_canonical_path(path, current); if (canonical_path == NULL) { return NULL; } char* error_msg = NULL; - jzfile* zip = open_zip_file(canonical_path, &error_msg, thread); + jzfile* zip = open_zip_file(canonical_path, &error_msg, current); if (zip != NULL && error_msg == NULL) { new_entry = new ClassPathZipEntry(zip, path, is_boot_append, from_class_path_attr); } else { diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index cd95a8a49f4..733758bcdc6 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -1386,7 +1386,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { if (has_class_failed_verification(k)) { return warn_excluded(k, "Failed verification"); } else { - if (!k->has_old_class_version()) { + if (!k->can_be_verified_at_dumptime()) { return warn_excluded(k, "Not linked"); } } @@ -1400,7 +1400,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { return true; } - if (k->has_old_class_version() && k->is_linked()) { + if (k->can_be_verified_at_dumptime() && k->is_linked()) { return warn_excluded(k, "Old class has been linked"); } @@ -1855,8 +1855,6 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla // either of these two loaders. The check itself does not // try to resolve T. oop klass_loader = klass->class_loader(); - assert(klass_loader != NULL, "should not be called for boot loader"); - assert(loader1 != loader2, "must be"); if (!is_system_class_loader(klass_loader) && !is_platform_class_loader(klass_loader)) { @@ -1872,6 +1870,17 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla return; } + if (DumpSharedSpaces && !is_builtin(klass)) { + // During static dump, unregistered classes (those intended for + // custom loaders) are loaded by the boot loader. Need to + // exclude these for the same reason as above. + // This should be fixed by JDK-8261941. + return; + } + + assert(klass_loader != NULL, "should not be called for boot loader"); + assert(loader1 != loader2, "must be"); + if (DynamicDumpSharedSpaces && Thread::current()->is_VM_thread()) { // We are re-laying out the vtable/itables of the *copy* of // a class during the final stage of dynamic dumping. The diff --git a/src/hotspot/share/compiler/disassembler.cpp b/src/hotspot/share/compiler/disassembler.cpp index 25f5fe73618..bd9272a8e6c 100644 --- a/src/hotspot/share/compiler/disassembler.cpp +++ b/src/hotspot/share/compiler/disassembler.cpp @@ -804,16 +804,24 @@ bool Disassembler::load_library(outputStream* st) { // 4. hsdis-.so (using LD_LIBRARY_PATH) if (jvm_offset >= 0) { // 1. /lib//libhsdis-.so - strcpy(&buf[jvm_offset], hsdis_library_name); - strcat(&buf[jvm_offset], os::dll_file_extension()); - if (Verbose) st->print_cr("Trying to load: %s", buf); - _library = os::dll_load(buf, ebuf, sizeof ebuf); - if (_library == NULL && lib_offset >= 0) { - // 2. /lib//hsdis-.so - strcpy(&buf[lib_offset], hsdis_library_name); - strcat(&buf[lib_offset], os::dll_file_extension()); + if (jvm_offset + strlen(hsdis_library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) { + strcpy(&buf[jvm_offset], hsdis_library_name); + strcat(&buf[jvm_offset], os::dll_file_extension()); if (Verbose) st->print_cr("Trying to load: %s", buf); _library = os::dll_load(buf, ebuf, sizeof ebuf); + } else { + if (Verbose) st->print_cr("Try to load hsdis library failed: the length of path is beyond the OS limit"); + } + if (_library == NULL && lib_offset >= 0) { + // 2. /lib//hsdis-.so + if (lib_offset + strlen(hsdis_library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) { + strcpy(&buf[lib_offset], hsdis_library_name); + strcat(&buf[lib_offset], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s", buf); + _library = os::dll_load(buf, ebuf, sizeof ebuf); + } else { + if (Verbose) st->print_cr("Try to load hsdis library failed: the length of path is beyond the OS limit"); + } } if (_library == NULL && lib_offset > 0) { // 3. /lib/hsdis-.so @@ -821,10 +829,14 @@ bool Disassembler::load_library(outputStream* st) { const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) { lib_offset = p - buf + 1; - strcpy(&buf[lib_offset], hsdis_library_name); - strcat(&buf[lib_offset], os::dll_file_extension()); - if (Verbose) st->print_cr("Trying to load: %s", buf); - _library = os::dll_load(buf, ebuf, sizeof ebuf); + if (lib_offset + strlen(hsdis_library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) { + strcpy(&buf[lib_offset], hsdis_library_name); + strcat(&buf[lib_offset], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s", buf); + _library = os::dll_load(buf, ebuf, sizeof ebuf); + } else { + if (Verbose) st->print_cr("Try to load hsdis library failed: the length of path is beyond the OS limit"); + } } } } diff --git a/src/hotspot/share/gc/shared/referenceProcessor.cpp b/src/hotspot/share/gc/shared/referenceProcessor.cpp index 5f94e8affc4..75876d5d010 100644 --- a/src/hotspot/share/gc/shared/referenceProcessor.cpp +++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp @@ -40,6 +40,7 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" #include "runtime/nonJavaThread.hpp" +#include "runtime/thread.inline.hpp" ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; diff --git a/src/hotspot/share/gc/shared/taskTerminator.cpp b/src/hotspot/share/gc/shared/taskTerminator.cpp index 0bf1bc61d45..b0d7663c296 100644 --- a/src/hotspot/share/gc/shared/taskTerminator.cpp +++ b/src/hotspot/share/gc/shared/taskTerminator.cpp @@ -78,7 +78,6 @@ TaskTerminator::TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set) : TaskTerminator::~TaskTerminator() { if (_offered_termination != 0) { assert(_offered_termination == _n_threads, "Must be terminated or aborted"); - assert_queue_set_empty(); } assert(_spin_master == NULL, "Should have been reset"); diff --git a/src/hotspot/share/gc/shared/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp index 718d0929a4e..0342241465c 100644 --- a/src/hotspot/share/gc/shared/taskqueue.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.hpp @@ -465,6 +465,8 @@ class GenericTaskQueueSet: public TaskQueueSetSuperImpl { GenericTaskQueueSet(uint n); ~GenericTaskQueueSet(); + // Set the i'th queue to the provided queue. + // Does not transfer ownership of the queue to this queue set. void register_queue(uint i, T* q); T* queue(uint n); diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp index 171e25ed48e..573ba400649 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -51,7 +51,7 @@ ThreadLocalAllocBuffer::ThreadLocalAllocBuffer() : _allocated_before_last_gc(0), _bytes_since_last_sample_point(0), _number_of_refills(0), - _slow_refill_waste(0), + _refill_waste(0), _gc_waste(0), _slow_allocations(0), _allocated_size(0), @@ -104,9 +104,9 @@ void ThreadLocalAllocBuffer::accumulate_and_reset_statistics(ThreadLocalAllocSta stats->update_fast_allocations(_number_of_refills, _allocated_size, _gc_waste, - _slow_refill_waste); + _refill_waste); } else { - assert(_number_of_refills == 0 && _slow_refill_waste == 0 && _gc_waste == 0, + assert(_number_of_refills == 0 && _refill_waste == 0 && _gc_waste == 0, "tlab stats == 0"); } @@ -147,7 +147,7 @@ void ThreadLocalAllocBuffer::retire(ThreadLocalAllocStats* stats) { } void ThreadLocalAllocBuffer::retire_before_allocation() { - _slow_refill_waste += (unsigned int)remaining(); + _refill_waste += (unsigned int)remaining(); retire(); } @@ -173,7 +173,7 @@ void ThreadLocalAllocBuffer::resize() { void ThreadLocalAllocBuffer::reset_statistics() { _number_of_refills = 0; - _slow_refill_waste = 0; + _refill_waste = 0; _gc_waste = 0; _slow_allocations = 0; _allocated_size = 0; @@ -292,7 +292,7 @@ void ThreadLocalAllocBuffer::print_stats(const char* tag) { } Thread* thrd = thread(); - size_t waste = _gc_waste + _slow_refill_waste; + size_t waste = _gc_waste + _refill_waste; double waste_percent = percent_of(waste, _allocated_size); size_t tlab_used = Universe::heap()->tlab_used(thrd); log.trace("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]" @@ -307,7 +307,7 @@ void ThreadLocalAllocBuffer::print_stats(const char* tag) { _allocation_fraction.average() * tlab_used / K, _number_of_refills, waste_percent, _gc_waste * HeapWordSize, - _slow_refill_waste * HeapWordSize); + _refill_waste * HeapWordSize); } void ThreadLocalAllocBuffer::set_sample_end(bool reset_byte_accumulation) { @@ -346,8 +346,8 @@ PerfVariable* ThreadLocalAllocStats::_perf_max_refills; PerfVariable* ThreadLocalAllocStats::_perf_total_allocations; PerfVariable* ThreadLocalAllocStats::_perf_total_gc_waste; PerfVariable* ThreadLocalAllocStats::_perf_max_gc_waste; -PerfVariable* ThreadLocalAllocStats::_perf_total_slow_refill_waste; -PerfVariable* ThreadLocalAllocStats::_perf_max_slow_refill_waste; +PerfVariable* ThreadLocalAllocStats::_perf_total_refill_waste; +PerfVariable* ThreadLocalAllocStats::_perf_max_refill_waste; PerfVariable* ThreadLocalAllocStats::_perf_total_slow_allocations; PerfVariable* ThreadLocalAllocStats::_perf_max_slow_allocations; AdaptiveWeightedAverage ThreadLocalAllocStats::_allocating_threads_avg(0); @@ -363,16 +363,16 @@ void ThreadLocalAllocStats::initialize() { if (UsePerfData) { EXCEPTION_MARK; - _perf_allocating_threads = create_perf_variable("allocThreads", PerfData::U_None, CHECK); - _perf_total_refills = create_perf_variable("fills", PerfData::U_None, CHECK); - _perf_max_refills = create_perf_variable("maxFills", PerfData::U_None, CHECK); - _perf_total_allocations = create_perf_variable("alloc", PerfData::U_Bytes, CHECK); - _perf_total_gc_waste = create_perf_variable("gcWaste", PerfData::U_Bytes, CHECK); - _perf_max_gc_waste = create_perf_variable("maxGcWaste", PerfData::U_Bytes, CHECK); - _perf_total_slow_refill_waste = create_perf_variable("slowWaste", PerfData::U_Bytes, CHECK); - _perf_max_slow_refill_waste = create_perf_variable("maxSlowWaste", PerfData::U_Bytes, CHECK); - _perf_total_slow_allocations = create_perf_variable("slowAlloc", PerfData::U_None, CHECK); - _perf_max_slow_allocations = create_perf_variable("maxSlowAlloc", PerfData::U_None, CHECK); + _perf_allocating_threads = create_perf_variable("allocThreads", PerfData::U_None, CHECK); + _perf_total_refills = create_perf_variable("fills", PerfData::U_None, CHECK); + _perf_max_refills = create_perf_variable("maxFills", PerfData::U_None, CHECK); + _perf_total_allocations = create_perf_variable("alloc", PerfData::U_Bytes, CHECK); + _perf_total_gc_waste = create_perf_variable("gcWaste", PerfData::U_Bytes, CHECK); + _perf_max_gc_waste = create_perf_variable("maxGcWaste", PerfData::U_Bytes, CHECK); + _perf_total_refill_waste = create_perf_variable("refillWaste", PerfData::U_Bytes, CHECK); + _perf_max_refill_waste = create_perf_variable("maxRefillWaste", PerfData::U_Bytes, CHECK); + _perf_total_slow_allocations = create_perf_variable("slowAlloc", PerfData::U_None, CHECK); + _perf_max_slow_allocations = create_perf_variable("maxSlowAlloc", PerfData::U_None, CHECK); } } @@ -383,8 +383,8 @@ ThreadLocalAllocStats::ThreadLocalAllocStats() : _total_allocations(0), _total_gc_waste(0), _max_gc_waste(0), - _total_slow_refill_waste(0), - _max_slow_refill_waste(0), + _total_refill_waste(0), + _max_refill_waste(0), _total_slow_allocations(0), _max_slow_allocations(0) {} @@ -395,15 +395,15 @@ unsigned int ThreadLocalAllocStats::allocating_threads_avg() { void ThreadLocalAllocStats::update_fast_allocations(unsigned int refills, size_t allocations, size_t gc_waste, - size_t slow_refill_waste) { + size_t refill_waste) { _allocating_threads += 1; _total_refills += refills; _max_refills = MAX2(_max_refills, refills); _total_allocations += allocations; _total_gc_waste += gc_waste; _max_gc_waste = MAX2(_max_gc_waste, gc_waste); - _total_slow_refill_waste += slow_refill_waste; - _max_slow_refill_waste = MAX2(_max_slow_refill_waste, slow_refill_waste); + _total_refill_waste += refill_waste; + _max_refill_waste = MAX2(_max_refill_waste, refill_waste); } void ThreadLocalAllocStats::update_slow_allocations(unsigned int allocations) { @@ -418,8 +418,8 @@ void ThreadLocalAllocStats::update(const ThreadLocalAllocStats& other) { _total_allocations += other._total_allocations; _total_gc_waste += other._total_gc_waste; _max_gc_waste = MAX2(_max_gc_waste, other._max_gc_waste); - _total_slow_refill_waste += other._total_slow_refill_waste; - _max_slow_refill_waste = MAX2(_max_slow_refill_waste, other._max_slow_refill_waste); + _total_refill_waste += other._total_refill_waste; + _max_refill_waste = MAX2(_max_refill_waste, other._max_refill_waste); _total_slow_allocations += other._total_slow_allocations; _max_slow_allocations = MAX2(_max_slow_allocations, other._max_slow_allocations); } @@ -431,8 +431,8 @@ void ThreadLocalAllocStats::reset() { _total_allocations = 0; _total_gc_waste = 0; _max_gc_waste = 0; - _total_slow_refill_waste = 0; - _max_slow_refill_waste = 0; + _total_refill_waste = 0; + _max_refill_waste = 0; _total_slow_allocations = 0; _max_slow_allocations = 0; } @@ -444,7 +444,7 @@ void ThreadLocalAllocStats::publish() { _allocating_threads_avg.sample(_allocating_threads); - const size_t waste = _total_gc_waste + _total_slow_refill_waste; + const size_t waste = _total_gc_waste + _total_refill_waste; const double waste_percent = percent_of(waste, _total_allocations); log_debug(gc, tlab)("TLAB totals: thrds: %d refills: %d max: %d" " slow allocs: %d max %d waste: %4.1f%%" @@ -453,7 +453,7 @@ void ThreadLocalAllocStats::publish() { _allocating_threads, _total_refills, _max_refills, _total_slow_allocations, _max_slow_allocations, waste_percent, _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize, - _total_slow_refill_waste * HeapWordSize, _max_slow_refill_waste * HeapWordSize); + _total_refill_waste * HeapWordSize, _max_refill_waste * HeapWordSize); if (UsePerfData) { _perf_allocating_threads ->set_value(_allocating_threads); @@ -462,8 +462,8 @@ void ThreadLocalAllocStats::publish() { _perf_total_allocations ->set_value(_total_allocations); _perf_total_gc_waste ->set_value(_total_gc_waste); _perf_max_gc_waste ->set_value(_max_gc_waste); - _perf_total_slow_refill_waste ->set_value(_total_slow_refill_waste); - _perf_max_slow_refill_waste ->set_value(_max_slow_refill_waste); + _perf_total_refill_waste ->set_value(_total_refill_waste); + _perf_max_refill_waste ->set_value(_max_refill_waste); _perf_total_slow_allocations ->set_value(_total_slow_allocations); _perf_max_slow_allocations ->set_value(_max_slow_allocations); } diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp index 8e2fe23aee7..f8bb516f027 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -63,7 +63,7 @@ class ThreadLocalAllocBuffer: public CHeapObj { static unsigned _target_refills; // expected number of refills between GCs unsigned _number_of_refills; - unsigned _slow_refill_waste; + unsigned _refill_waste; unsigned _gc_waste; unsigned _slow_allocations; size_t _allocated_size; @@ -194,8 +194,8 @@ class ThreadLocalAllocStats : public StackObj { static PerfVariable* _perf_total_allocations; static PerfVariable* _perf_total_gc_waste; static PerfVariable* _perf_max_gc_waste; - static PerfVariable* _perf_total_slow_refill_waste; - static PerfVariable* _perf_max_slow_refill_waste; + static PerfVariable* _perf_total_refill_waste; + static PerfVariable* _perf_max_refill_waste; static PerfVariable* _perf_total_slow_allocations; static PerfVariable* _perf_max_slow_allocations; @@ -207,8 +207,8 @@ class ThreadLocalAllocStats : public StackObj { size_t _total_allocations; size_t _total_gc_waste; size_t _max_gc_waste; - size_t _total_slow_refill_waste; - size_t _max_slow_refill_waste; + size_t _total_refill_waste; + size_t _max_refill_waste; unsigned int _total_slow_allocations; unsigned int _max_slow_allocations; @@ -221,7 +221,7 @@ class ThreadLocalAllocStats : public StackObj { void update_fast_allocations(unsigned int refills, size_t allocations, size_t gc_waste, - size_t slow_refill_waste); + size_t refill_waste); void update_slow_allocations(unsigned int allocations); void update(const ThreadLocalAllocStats& other); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp index c9065f33414..92c3f6f63ff 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp @@ -540,7 +540,7 @@ void ShenandoahReferenceProcessor::enqueue_references(bool concurrent) { enqueue_references_locked(); } else { // Heap_lock protects external pending list - MonitorLocker ml(Heap_lock, Mutex::_no_safepoint_check_flag); + MonitorLocker ml(Heap_lock); enqueue_references_locked(); diff --git a/src/hotspot/share/interpreter/rewriter.cpp b/src/hotspot/share/interpreter/rewriter.cpp index 7838c6b7768..74f87ca208b 100644 --- a/src/hotspot/share/interpreter/rewriter.cpp +++ b/src/hotspot/share/interpreter/rewriter.cpp @@ -571,7 +571,7 @@ void Rewriter::rewrite(InstanceKlass* klass, TRAPS) { #if INCLUDE_CDS if (klass->is_shared()) { assert(!klass->is_rewritten(), "rewritten shared classes cannot be rewritten again"); - assert(klass->has_old_class_version(), "only shared old classes aren't rewritten"); + assert(klass->can_be_verified_at_dumptime(), "only shared old classes aren't rewritten"); } #endif // INCLUDE_CDS ResourceMark rm(THREAD); diff --git a/src/hotspot/share/jfr/jfr.cpp b/src/hotspot/share/jfr/jfr.cpp index 7fb4eb29c85..6f5704bab96 100644 --- a/src/hotspot/share/jfr/jfr.cpp +++ b/src/hotspot/share/jfr/jfr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -25,12 +25,14 @@ #include "precompiled.hpp" #include "jfr/jfr.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" +#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp" #include "jfr/recorder/jfrRecorder.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" #include "jfr/recorder/repository/jfrEmergencyDump.hpp" #include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/recorder/repository/jfrRepository.hpp" #include "jfr/support/jfrThreadLocal.hpp" +#include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/thread.hpp" @@ -109,3 +111,16 @@ bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* delimiter bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* delimiter) { return JfrOptionSet::parse_start_flight_recording_option(option, delimiter); } + +JRT_LEAF(void, Jfr::get_class_id_intrinsic(const Klass* klass)) + assert(klass != NULL, "sanity"); + JfrTraceIdLoadBarrier::load_barrier(klass); +JRT_END + +address Jfr::epoch_address() { + return JfrTraceIdEpoch::epoch_address(); +} + +address Jfr::signal_address() { + return JfrTraceIdEpoch::signal_address(); +} diff --git a/src/hotspot/share/jfr/jfr.hpp b/src/hotspot/share/jfr/jfr.hpp index a249089d570..c97cc807c3b 100644 --- a/src/hotspot/share/jfr/jfr.hpp +++ b/src/hotspot/share/jfr/jfr.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -30,6 +30,7 @@ class JavaThread; class Thread; +class Klass; extern "C" void JNICALL jfr_register_natives(JNIEnv*, jclass); @@ -54,6 +55,11 @@ class Jfr : AllStatic { static void exclude_thread(Thread* thread); static bool is_excluded(Thread* thread); static void include_thread(Thread* thread); + + // intrinsic support + static void get_class_id_intrinsic(const Klass* klass); + static address epoch_address(); + static address signal_address(); }; #endif // SHARE_JFR_JFR_HPP diff --git a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp index c5d290ac538..db137776f65 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -44,7 +44,7 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) { (char*)"destroyJFR", (char*)"()Z", (void*)jfr_destroy_jfr, (char*)"emitEvent", (char*)"(JJJ)Z", (void*)jfr_emit_event, (char*)"getAllEventClasses", (char*)"()Ljava/util/List;", (void*)jfr_get_all_event_classes, - (char*)"getClassIdNonIntrinsic", (char*)"(Ljava/lang/Class;)J", (void*)jfr_class_id, + (char*)"getClassId", (char*)"(Ljava/lang/Class;)J", (void*)jfr_class_id, (char*)"getPid", (char*)"()Ljava/lang/String;", (void*)jfr_get_pid, (char*)"getStackTraceId", (char*)"(I)J", (void*)jfr_stacktrace_id, (char*)"getThreadId", (char*)"(Ljava/lang/Thread;)J", (void*)jfr_id_for_thread, diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index fa9b3da0ff3..b93651a0490 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -863,12 +863,11 @@ class MethodIteratorHost { bool operator()(KlassPtr klass) { if (_method_used_predicate(klass)) { const InstanceKlass* ik = InstanceKlass::cast(klass); - const int len = ik->methods()->length(); - Filter filter(ik->previous_versions() != NULL ? len : 0); while (ik != NULL) { + const int len = ik->methods()->length(); for (int i = 0; i < len; ++i) { MethodPtr method = ik->methods()->at(i); - if (_method_flag_predicate(method) && filter(i)) { + if (_method_flag_predicate(method)) { _method_cb(method); } } diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp index 6cc32a1f388..653c90fdba8 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -67,8 +67,8 @@ class JfrTraceIdEpoch : AllStatic { return _epoch_state; } - static jlong epoch_address() { - return (jlong)&_epoch_state; + static address epoch_address() { + return (address)&_epoch_state; } static u1 current() { @@ -114,6 +114,10 @@ class JfrTraceIdEpoch : AllStatic { static void set_changed_tag_state() { _tag_state.signal(); } + + static address signal_address() { + return _tag_state.signaled_address(); + } }; #endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDEPOCH_HPP diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.hpp index 449fd7033ee..18635bbd660 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.hpp @@ -67,12 +67,14 @@ class PackageEntry; * */ class JfrTraceIdLoadBarrier : AllStatic { + friend class Jfr; friend class JfrCheckpointManager; private: static bool initialize(); static void clear(); static void destroy(); static void enqueue(const Klass* klass); + static void load_barrier(const Klass* klass); public: static traceid load(const ClassLoaderData* cld); static traceid load(const Klass* klass); diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp index d997c99b488..0842e35a3aa 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -65,12 +65,16 @@ inline traceid set_used_and_get(const T* type) { return TRACE_ID(type); } -inline traceid JfrTraceIdLoadBarrier::load(const Klass* klass) { - assert(klass != NULL, "invariant"); - if (should_tag(klass)) { +inline void JfrTraceIdLoadBarrier::load_barrier(const Klass* klass) { SET_USED_THIS_EPOCH(klass); enqueue(klass); JfrTraceIdEpoch::set_changed_tag_state(); +} + +inline traceid JfrTraceIdLoadBarrier::load(const Klass* klass) { + assert(klass != NULL, "invariant"); + if (should_tag(klass)) { + load_barrier(klass); } assert(USED_THIS_EPOCH(klass), "invariant"); return TRACE_ID(klass); diff --git a/src/hotspot/share/jfr/utilities/jfrSignal.hpp b/src/hotspot/share/jfr/utilities/jfrSignal.hpp index 253290961f6..410ec1e8504 100644 --- a/src/hotspot/share/jfr/utilities/jfrSignal.hpp +++ b/src/hotspot/share/jfr/utilities/jfrSignal.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -46,6 +46,8 @@ class JfrSignal { } return false; } + + address signaled_address() { return (address)&_signaled; } }; #endif // SHARE_JFR_UTILITIES_JFRSIGNAL_HPP diff --git a/src/hotspot/share/logging/logAsyncWriter.cpp b/src/hotspot/share/logging/logAsyncWriter.cpp new file mode 100644 index 00000000000..b3b61f8a7c0 --- /dev/null +++ b/src/hotspot/share/logging/logAsyncWriter.cpp @@ -0,0 +1,194 @@ +/* + * 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. + * + */ +#include "precompiled.hpp" +#include "logging/logAsyncWriter.hpp" +#include "logging/logConfiguration.hpp" +#include "logging/logFileOutput.hpp" +#include "logging/logHandle.hpp" +#include "runtime/atomic.hpp" + +Semaphore AsyncLogWriter::_sem(0); +Semaphore AsyncLogWriter::_io_sem(1); + +class AsyncLogLocker : public StackObj { + private: + static Semaphore _lock; + public: + AsyncLogLocker() { + _lock.wait(); + } + + ~AsyncLogLocker() { + _lock.signal(); + } +}; + +Semaphore AsyncLogLocker::_lock(1); + +void AsyncLogWriter::enqueue_locked(const AsyncLogMessage& msg) { + if (_buffer.size() >= _buffer_max_size) { + bool p_created; + uint32_t* counter = _stats.add_if_absent(msg.output(), 0, &p_created); + *counter = *counter + 1; + // drop the enqueueing message. + return; + } + + assert(_buffer.size() < _buffer_max_size, "_buffer is over-sized."); + _buffer.push_back(msg); + _sem.signal(); +} + +void AsyncLogWriter::enqueue(LogFileOutput& output, const LogDecorations& decorations, const char* msg) { + AsyncLogMessage m(output, decorations, os::strdup(msg)); + + { // critical area + AsyncLogLocker lock; + enqueue_locked(m); + } +} + +// LogMessageBuffer consists of a multiple-part/multiple-line messsage. +// The lock here guarantees its integrity. +void AsyncLogWriter::enqueue(LogFileOutput& output, LogMessageBuffer::Iterator msg_iterator) { + AsyncLogLocker lock; + + for (; !msg_iterator.is_at_end(); msg_iterator++) { + AsyncLogMessage m(output, msg_iterator.decorations(), os::strdup(msg_iterator.message())); + enqueue_locked(m); + } +} + +AsyncLogWriter::AsyncLogWriter() + : _initialized(false), + _stats(17 /*table_size*/) { + if (os::create_thread(this, os::asynclog_thread)) { + _initialized = true; + } else { + log_warning(logging, thread)("AsyncLogging failed to create thread. Falling back to synchronous logging."); + } + + log_info(logging)("The maximum entries of AsyncLogBuffer: " SIZE_FORMAT ", estimated memory use: " SIZE_FORMAT " bytes", + _buffer_max_size, AsyncLogBufferSize); +} + +class AsyncLogMapIterator { + AsyncLogBuffer& _logs; + + public: + AsyncLogMapIterator(AsyncLogBuffer& logs) :_logs(logs) {} + bool do_entry(LogFileOutput* output, uint32_t* counter) { + using none = LogTagSetMapping; + + if (*counter > 0) { + LogDecorations decorations(LogLevel::Warning, none::tagset(), output->decorators()); + stringStream ss; + ss.print(UINT32_FORMAT_W(6) " messages dropped due to async logging", *counter); + AsyncLogMessage msg(*output, decorations, ss.as_string(true /*c_heap*/)); + _logs.push_back(msg); + *counter = 0; + } + + return true; + } +}; + +void AsyncLogWriter::write() { + // Use kind of copy-and-swap idiom here. + // Empty 'logs' swaps the content with _buffer. + // Along with logs destruction, all processed messages are deleted. + // + // The operation 'pop_all()' is done in O(1). All I/O jobs are then performed without + // lock protection. This guarantees I/O jobs don't block logsites. + AsyncLogBuffer logs; + bool own_io = false; + + { // critical region + AsyncLogLocker lock; + + _buffer.pop_all(&logs); + // append meta-messages of dropped counters + AsyncLogMapIterator dropped_counters_iter(logs); + _stats.iterate(&dropped_counters_iter); + own_io = _io_sem.trywait(); + } + + LinkedListIterator it(logs.head()); + if (!own_io) { + _io_sem.wait(); + } + + while (!it.is_empty()) { + AsyncLogMessage* e = it.next(); + char* msg = e->message(); + + if (msg != nullptr) { + e->output()->write_blocking(e->decorations(), msg); + os::free(msg); + } + } + _io_sem.signal(); +} + +void AsyncLogWriter::run() { + while (true) { + // The value of a semphore cannot be negative. Therefore, the current thread falls asleep + // when its value is zero. It will be waken up when new messages are enqueued. + _sem.wait(); + write(); + } +} + +AsyncLogWriter* AsyncLogWriter::_instance = nullptr; + +void AsyncLogWriter::initialize() { + if (!LogConfiguration::is_async_mode()) return; + + assert(_instance == nullptr, "initialize() should only be invoked once."); + + AsyncLogWriter* self = new AsyncLogWriter(); + if (self->_initialized) { + Atomic::release_store_fence(&AsyncLogWriter::_instance, self); + // All readers of _instance after the fence see non-NULL. + // We use LogOutputList's RCU counters to ensure all synchronous logsites have completed. + // After that, we start AsyncLog Thread and it exclusively takes over all logging I/O. + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + ts->wait_until_no_readers(); + } + os::start_thread(self); + log_debug(logging, thread)("Async logging thread started."); + } +} + +AsyncLogWriter* AsyncLogWriter::instance() { + return _instance; +} + +// write() acquires and releases _io_sem even _buffer is empty. +// This guarantees all logging I/O of dequeued messages are done when it returns. +void AsyncLogWriter::flush() { + if (_instance != nullptr) { + _instance->write(); + } +} diff --git a/src/hotspot/share/logging/logAsyncWriter.hpp b/src/hotspot/share/logging/logAsyncWriter.hpp new file mode 100644 index 00000000000..736a957b218 --- /dev/null +++ b/src/hotspot/share/logging/logAsyncWriter.hpp @@ -0,0 +1,176 @@ +/* + * 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. + * + */ +#ifndef SHARE_LOGGING_LOGASYNCWRITER_HPP +#define SHARE_LOGGING_LOGASYNCWRITER_HPP +#include "logging/log.hpp" +#include "logging/logDecorations.hpp" +#include "logging/logFileOutput.hpp" +#include "logging/logMessageBuffer.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/nonJavaThread.hpp" +#include "utilities/hashtable.hpp" +#include "utilities/linkedlist.hpp" + +template +class LinkedListDeque : private LinkedListImpl { + private: + LinkedListNode* _tail; + size_t _size; + + public: + LinkedListDeque() : _tail(NULL), _size(0) {} + void push_back(const E& e) { + if (!_tail) { + _tail = this->add(e); + } else { + _tail = this->insert_after(e, _tail); + } + + ++_size; + } + + // pop all elements to logs. + void pop_all(LinkedList* logs) { + logs->move(static_cast* >(this)); + _tail = NULL; + _size = 0; + } + + void pop_all(LinkedListDeque* logs) { + logs->_size = _size; + logs->_tail = _tail; + pop_all(static_cast* >(logs)); + } + + void pop_front() { + LinkedListNode* h = this->unlink_head(); + if (h == _tail) { + _tail = NULL; + } + + if (h != NULL) { + --_size; + this->delete_node(h); + } + } + + size_t size() const { return _size; } + + const E* front() const { + return this->_head == NULL ? NULL : this->_head->peek(); + } + + const E* back() const { + return _tail == NULL ? NULL : _tail->peek(); + } + + LinkedListNode* head() const { + return this->_head; + } +}; + +class AsyncLogMessage { + LogFileOutput& _output; + const LogDecorations _decorations; + char* _message; + +public: + AsyncLogMessage(LogFileOutput& output, const LogDecorations& decorations, char* msg) + : _output(output), _decorations(decorations), _message(msg) {} + + // placeholder for LinkedListImpl. + bool equals(const AsyncLogMessage& o) const { return false; } + + LogFileOutput* output() const { return &_output; } + const LogDecorations& decorations() const { return _decorations; } + char* message() const { return _message; } +}; + +typedef LinkedListDeque AsyncLogBuffer; +typedef KVHashtable AsyncLogMap; + +// +// ASYNC LOGGING SUPPORT +// +// Summary: +// Async Logging is working on the basis of singleton AsyncLogWriter, which manages an intermediate buffer and a flushing thread. +// +// Interface: +// +// initialize() is called once when JVM is initialized. It creates and initializes the singleton instance of AsyncLogWriter. +// Once async logging is established, there's no way to turn it off. +// +// instance() is MT-safe and returns the pointer of the singleton instance if and only if async logging is enabled and has well +// initialized. Clients can use its return value to determine async logging is established or not. +// +// The basic operation of AsyncLogWriter is enqueue(). 2 overloading versions of it are provided to match LogOutput::write(). +// They are both MT-safe and non-blocking. Derived classes of LogOutput can invoke the corresponding enqueue() in write() and +// return 0. AsyncLogWriter is responsible of copying neccessary data. +// +// The static member function flush() is designated to flush out all pending messages when JVM is terminating. +// In normal JVM termination, flush() is invoked in LogConfiguration::finalize(). flush() is MT-safe and can be invoked arbitrary +// times. It is no-op if async logging is not established. +// +class AsyncLogWriter : public NonJavaThread { + static AsyncLogWriter* _instance; + // _sem is a semaphore whose value denotes how many messages have been enqueued. + // It decreases in AsyncLogWriter::run() + static Semaphore _sem; + // A lock of IO + static Semaphore _io_sem; + + volatile bool _initialized; + AsyncLogMap _stats; // statistics for dropped messages + AsyncLogBuffer _buffer; + + // The memory use of each AsyncLogMessage (payload) consists of itself and a variable-length c-str message. + // A regular logging message is smaller than vwrite_buffer_size, which is defined in logtagset.cpp + const size_t _buffer_max_size = {AsyncLogBufferSize / (sizeof(AsyncLogMessage) + vwrite_buffer_size)}; + + AsyncLogWriter(); + void enqueue_locked(const AsyncLogMessage& msg); + void write(); + void run() override; + void pre_run() override { + NonJavaThread::pre_run(); + log_debug(logging, thread)("starting AsyncLog Thread tid = " INTX_FORMAT, os::current_thread_id()); + } + char* name() const override { return (char*)"AsyncLog Thread"; } + bool is_Named_thread() const override { return true; } + void print_on(outputStream* st) const override { + st->print("\"%s\" ", name()); + Thread::print_on(st); + st->cr(); + } + + public: + void enqueue(LogFileOutput& output, const LogDecorations& decorations, const char* msg); + void enqueue(LogFileOutput& output, LogMessageBuffer::Iterator msg_iterator); + + static AsyncLogWriter* instance(); + static void initialize(); + static void flush(); +}; + +#endif // SHARE_LOGGING_LOGASYNCWRITER_HPP diff --git a/src/hotspot/share/logging/logConfiguration.cpp b/src/hotspot/share/logging/logConfiguration.cpp index 2fddbe8bedd..5e2f786a657 100644 --- a/src/hotspot/share/logging/logConfiguration.cpp +++ b/src/hotspot/share/logging/logConfiguration.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" #include "logging/logConfiguration.hpp" #include "logging/logDecorations.hpp" #include "logging/logDecorators.hpp" @@ -261,6 +262,10 @@ void LogConfiguration::configure_output(size_t idx, const LogSelectionList& sele } if (!enabled && idx > 1) { + // User may disable a logOuput like this: + // LogConfiguration::parse_log_arguments(filename, "all=off", "", "", &stream); + // Just be conservative. Flush them all before deleting idx. + AsyncLogWriter::flush(); // Output is unused and should be removed, unless it is stdout/stderr (idx < 2) delete_output(idx); return; @@ -278,6 +283,12 @@ void LogConfiguration::disable_outputs() { ts->disable_outputs(); } + // Handle jcmd VM.log disable + // ts->disable_outputs() above has deleted output_list with RCU synchronization. + // Therefore, no new logging entry can enter AsyncLog buffer for the time being. + // flush pending entries before LogOutput instances die. + AsyncLogWriter::flush(); + while (idx > 0) { LogOutput* out = _outputs[--idx]; // Delete the output unless stdout or stderr (idx 0 or 1) @@ -545,6 +556,12 @@ void LogConfiguration::print_command_line_help(outputStream* out) { " If set to 0, log rotation is disabled." " This will cause existing log files to be overwritten."); out->cr(); + out->print_cr("\nAsynchronous logging (off by default):"); + out->print_cr(" -Xlog:async"); + out->print_cr(" All log messages are written to an intermediate buffer first and will then be flushed" + " to the corresponding log outputs by a standalone thread. Write operations at logsites are" + " guaranteed non-blocking."); + out->cr(); out->print_cr("Some examples:"); out->print_cr(" -Xlog"); @@ -587,6 +604,10 @@ void LogConfiguration::print_command_line_help(outputStream* out) { out->print_cr(" -Xlog:disable -Xlog:safepoint=trace:safepointtrace.txt"); out->print_cr("\t Turn off all logging, including warnings and errors,"); out->print_cr("\t and then enable messages tagged with 'safepoint' up to 'trace' level to file 'safepointtrace.txt'."); + + out->print_cr(" -Xlog:async -Xlog:gc=debug:file=gc.log -Xlog:safepoint=trace"); + out->print_cr("\t Write logs asynchronously. Enable messages tagged with 'safepoint' up to 'trace' level to stdout "); + out->print_cr("\t and messages tagged with 'gc' up to 'debug' level to file 'gc.log'."); } void LogConfiguration::rotate_all_outputs() { @@ -613,3 +634,5 @@ void LogConfiguration::notify_update_listeners() { _listener_callbacks[i](); } } + +bool LogConfiguration::_async_mode = false; diff --git a/src/hotspot/share/logging/logConfiguration.hpp b/src/hotspot/share/logging/logConfiguration.hpp index 34c0c07b76a..542aaa2433b 100644 --- a/src/hotspot/share/logging/logConfiguration.hpp +++ b/src/hotspot/share/logging/logConfiguration.hpp @@ -58,6 +58,7 @@ class LogConfiguration : public AllStatic { static UpdateListenerFunction* _listener_callbacks; static size_t _n_listener_callbacks; + static bool _async_mode; // Create a new output. Returns NULL if failed. static LogOutput* new_output(const char* name, const char* options, outputStream* errstream); @@ -123,6 +124,11 @@ class LogConfiguration : public AllStatic { // Rotates all LogOutput static void rotate_all_outputs(); + + static bool is_async_mode() { return _async_mode; } + static void set_async_mode(bool value) { + _async_mode = value; + } }; #endif // SHARE_LOGGING_LOGCONFIGURATION_HPP diff --git a/src/hotspot/share/logging/logDecorators.hpp b/src/hotspot/share/logging/logDecorators.hpp index c6877b5867a..cddd9c3bf85 100644 --- a/src/hotspot/share/logging/logDecorators.hpp +++ b/src/hotspot/share/logging/logDecorators.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -84,7 +84,7 @@ class LogDecorators { static const LogDecorators None; LogDecorators() : _decorators(DefaultDecoratorsMask) { - }; + } void clear() { _decorators = 0; diff --git a/src/hotspot/share/logging/logFileOutput.cpp b/src/hotspot/share/logging/logFileOutput.cpp index 22f01186b88..1728317e024 100644 --- a/src/hotspot/share/logging/logFileOutput.cpp +++ b/src/hotspot/share/logging/logFileOutput.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" #include "logging/logConfiguration.hpp" #include "logging/logFileOutput.hpp" #include "memory/allocation.inline.hpp" @@ -284,12 +285,7 @@ bool LogFileOutput::initialize(const char* options, outputStream* errstream) { return true; } -int LogFileOutput::write(const LogDecorations& decorations, const char* msg) { - if (_stream == NULL) { - // An error has occurred with this output, avoid writing to it. - return 0; - } - +int LogFileOutput::write_blocking(const LogDecorations& decorations, const char* msg) { _rotation_semaphore.wait(); int written = LogFileStreamOutput::write(decorations, msg); if (written > 0) { @@ -304,12 +300,33 @@ int LogFileOutput::write(const LogDecorations& decorations, const char* msg) { return written; } +int LogFileOutput::write(const LogDecorations& decorations, const char* msg) { + if (_stream == NULL) { + // An error has occurred with this output, avoid writing to it. + return 0; + } + + AsyncLogWriter* aio_writer = AsyncLogWriter::instance(); + if (aio_writer != nullptr) { + aio_writer->enqueue(*this, decorations, msg); + return 0; + } + + return write_blocking(decorations, msg); +} + int LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator) { if (_stream == NULL) { // An error has occurred with this output, avoid writing to it. return 0; } + AsyncLogWriter* aio_writer = AsyncLogWriter::instance(); + if (aio_writer != nullptr) { + aio_writer->enqueue(*this, msg_iterator); + return 0; + } + _rotation_semaphore.wait(); int written = LogFileStreamOutput::write(msg_iterator); if (written > 0) { @@ -461,7 +478,8 @@ void LogFileOutput::describe(outputStream *out) { LogOutput::describe(out); out->print(" "); - out->print("filecount=%u,filesize=" SIZE_FORMAT "%s", _file_count, + out->print("filecount=%u,filesize=" SIZE_FORMAT "%s,async=%s", _file_count, byte_size_in_proper_unit(_rotate_size), - proper_unit_for_byte_size(_rotate_size)); + proper_unit_for_byte_size(_rotate_size), + LogConfiguration::is_async_mode() ? "true" : "false"); } diff --git a/src/hotspot/share/logging/logFileOutput.hpp b/src/hotspot/share/logging/logFileOutput.hpp index 5301816313d..9b22969368e 100644 --- a/src/hotspot/share/logging/logFileOutput.hpp +++ b/src/hotspot/share/logging/logFileOutput.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -85,6 +85,7 @@ class LogFileOutput : public LogFileStreamOutput { virtual bool initialize(const char* options, outputStream* errstream); virtual int write(const LogDecorations& decorations, const char* msg); virtual int write(LogMessageBuffer::Iterator msg_iterator); + int write_blocking(const LogDecorations& decorations, const char* msg); virtual void force_rotate(); virtual void describe(outputStream* out); diff --git a/src/hotspot/share/logging/logOutputList.hpp b/src/hotspot/share/logging/logOutputList.hpp index d02f50cc8b2..e2179cc68ea 100644 --- a/src/hotspot/share/logging/logOutputList.hpp +++ b/src/hotspot/share/logging/logOutputList.hpp @@ -63,7 +63,6 @@ class LogOutputList { // Bookkeeping functions to keep track of number of active readers/iterators for the list. jint increase_readers(); jint decrease_readers(); - void wait_until_no_readers() const; public: LogOutputList() : _active_readers(0) { @@ -91,6 +90,7 @@ class LogOutputList { // Removes all outputs. Equivalent of set_output_level(out, Off) // for all outputs. void clear(); + void wait_until_no_readers() const; class Iterator { friend class LogOutputList; diff --git a/src/hotspot/share/logging/logTagSet.hpp b/src/hotspot/share/logging/logTagSet.hpp index 52fdf19ef11..f932a6d175a 100644 --- a/src/hotspot/share/logging/logTagSet.hpp +++ b/src/hotspot/share/logging/logTagSet.hpp @@ -67,6 +67,10 @@ class LogTagSet { static void describe_tagsets(outputStream* out); static void list_all_tagsets(outputStream* out); + void wait_until_no_readers() const { + _output_list.wait_until_no_readers(); + } + static LogTagSet* first() { return _list; } @@ -163,4 +167,5 @@ class LogTagSetMapping : public AllStatic { template LogTagSet LogTagSetMapping::_tagset(&LogPrefix::prefix, T0, T1, T2, T3, T4); +extern const size_t vwrite_buffer_size; #endif // SHARE_LOGGING_LOGTAGSET_HPP diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 04b6187ef40..d9f6c81b21f 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -73,7 +73,6 @@ void ConstantPool::copy_fields(const ConstantPool* orig) { set_has_dynamic_constant(); } - // Copy class version set_major_version(orig->major_version()); set_minor_version(orig->minor_version()); diff --git a/src/hotspot/share/oops/generateOopMap.cpp b/src/hotspot/share/oops/generateOopMap.cpp index 46395f8b4ac..5dcfdec1087 100644 --- a/src/hotspot/share/oops/generateOopMap.cpp +++ b/src/hotspot/share/oops/generateOopMap.cpp @@ -34,7 +34,6 @@ #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "runtime/handles.inline.hpp" -#include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" #include "runtime/relocator.hpp" @@ -907,18 +906,12 @@ void GenerateOopMap::monitor_push(CellTypeState cts) { // Interpretation handling methods // -void GenerateOopMap::do_interpretation(Thread* thread) +void GenerateOopMap::do_interpretation() { + // "i" is just for debugging, so we can detect cases where this loop is + // iterated more than once. int i = 0; do { - if (i != 0 && thread->is_Java_thread()) { - JavaThread* jt = thread->as_Java_thread(); - if (jt->thread_state() == _thread_in_vm) { - // Since this JavaThread has looped at least once and is _thread_in_vm, - // we honor any pending blocking request. - ThreadBlockInVM tbivm(jt); - } - } #ifndef PRODUCT if (TraceNewOopMapGeneration) { tty->print("\n\nIteration #%d of do_interpretation loop, method:\n", i); @@ -2136,7 +2129,7 @@ bool GenerateOopMap::compute_map(Thread* current) { // Step 3: Calculate stack maps if (!_got_error) - do_interpretation(current); + do_interpretation(); // Step 4:Return results if (!_got_error && report_results()) diff --git a/src/hotspot/share/oops/generateOopMap.hpp b/src/hotspot/share/oops/generateOopMap.hpp index 4f1ee26a10a..734f85e1bc2 100644 --- a/src/hotspot/share/oops/generateOopMap.hpp +++ b/src/hotspot/share/oops/generateOopMap.hpp @@ -374,7 +374,7 @@ class GenerateOopMap { static void reachable_basicblock (GenerateOopMap *c, int deltaBci, int *data); // Interpretation methods (primary) - void do_interpretation (Thread* thread); + void do_interpretation (); void init_basic_blocks (); void setup_method_entry_state (); void interp_all (); diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 603bdec1eb2..acc52d94fdc 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2402,7 +2402,7 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) { void InstanceKlass::remove_unshareable_info() { - if (has_old_class_version()) { + if (can_be_verified_at_dumptime()) { // Set the old class bit. set_is_shared_old_klass(); } @@ -2546,17 +2546,17 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl // without changing the old verifier, the verification constraint cannot be // retrieved during dump time. // Verification of archived old classes will be performed during run time. -bool InstanceKlass::has_old_class_version() const { +bool InstanceKlass::can_be_verified_at_dumptime() const { if (major_version() < 50 /*JAVA_6_VERSION*/) { return true; } - if (java_super() != NULL && java_super()->has_old_class_version()) { + if (java_super() != NULL && java_super()->can_be_verified_at_dumptime()) { return true; } Array* interfaces = local_interfaces(); int len = interfaces->length(); for (int i = 0; i < len; i++) { - if (interfaces->at(i)->has_old_class_version()) { + if (interfaces->at(i)->can_be_verified_at_dumptime()) { return true; } } @@ -2851,9 +2851,9 @@ void InstanceKlass::set_package(ClassLoaderData* loader_data, PackageEntry* pkg_ } } -// Function set_classpath_index checks if the package of the InstanceKlass is in the -// boot loader's package entry table. If so, then it sets the classpath_index -// in the package entry record. +// Function set_classpath_index ensures that for a non-null _package_entry +// of the InstanceKlass, the entry is in the boot loader's package entry table. +// It then sets the classpath_index in the package entry record. // // The classpath_index field is used to find the entry on the boot loader class // path for packages with classes loaded by the boot loader from -Xbootclasspath/a diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 50279d7956a..d0b829ed8cb 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -1228,7 +1228,7 @@ class InstanceKlass: public Klass { virtual void remove_java_mirror(); void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS); void init_shared_package_entry(); - bool has_old_class_version() const; + bool can_be_verified_at_dumptime() const; jint compute_modifier_flags() const; diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index 69340c66ab2..32ac7c816c8 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -1094,8 +1094,8 @@ void itableMethodEntry::initialize(InstanceKlass* klass, Method* m) { #ifdef ASSERT if (MetaspaceShared::is_in_shared_metaspace((void*)&_method) && !MetaspaceShared::remapped_readwrite() && - !m->method_holder()->has_old_class_version() && - !klass->has_old_class_version()) { + !m->method_holder()->can_be_verified_at_dumptime() && + !klass->can_be_verified_at_dumptime()) { // At runtime initialize_itable is rerun as part of link_class_impl() // for a shared class loaded by the non-boot loader. // The dumptime itable method entry should be the same as the runtime entry. diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp index 091a09b9b56..2e9da21ca6b 100644 --- a/src/hotspot/share/opto/addnode.cpp +++ b/src/hotspot/share/opto/addnode.cpp @@ -920,9 +920,23 @@ const Type* XorINode::Value(PhaseGVN* phase) const { if (in1->eqv_uncast(in2)) { return add_id(); } + // result of xor can only have bits sets where any of the + // inputs have bits set. lo can always become 0. + const TypeInt* t1i = t1->is_int(); + const TypeInt* t2i = t2->is_int(); + if ((t1i->_lo >= 0) && + (t1i->_hi > 0) && + (t2i->_lo >= 0) && + (t2i->_hi > 0)) { + // hi - set all bits below the highest bit. Using round_down to avoid overflow. + const TypeInt* t1x = TypeInt::make(0, round_down_power_of_2(t1i->_hi) + (round_down_power_of_2(t1i->_hi) - 1), t1i->_widen); + const TypeInt* t2x = TypeInt::make(0, round_down_power_of_2(t2i->_hi) + (round_down_power_of_2(t2i->_hi) - 1), t2i->_widen); + return t1x->meet(t2x); + } return AddNode::Value(phase); } + //------------------------------add_ring--------------------------------------- // Supplied function returns the sum of the inputs IN THE CURRENT RING. For // the logical operations the ring's ADD is really a logical OR function. @@ -970,6 +984,19 @@ const Type* XorLNode::Value(PhaseGVN* phase) const { if (in1->eqv_uncast(in2)) { return add_id(); } + // result of xor can only have bits sets where any of the + // inputs have bits set. lo can always become 0. + const TypeLong* t1l = t1->is_long(); + const TypeLong* t2l = t2->is_long(); + if ((t1l->_lo >= 0) && + (t1l->_hi > 0) && + (t2l->_lo >= 0) && + (t2l->_hi > 0)) { + // hi - set all bits below the highest bit. Using round_down to avoid overflow. + const TypeLong* t1x = TypeLong::make(0, round_down_power_of_2(t1l->_hi) + (round_down_power_of_2(t1l->_hi) - 1), t1l->_widen); + const TypeLong* t2x = TypeLong::make(0, round_down_power_of_2(t2l->_hi) + (round_down_power_of_2(t2l->_hi) - 1), t2l->_widen); + return t1x->meet(t2x); + } return AddNode::Value(phase); } diff --git a/src/hotspot/share/opto/castnode.hpp b/src/hotspot/share/opto/castnode.hpp index 11bb127898a..6c7fad8e04b 100644 --- a/src/hotspot/share/opto/castnode.hpp +++ b/src/hotspot/share/opto/castnode.hpp @@ -115,6 +115,37 @@ class CastLLNode: public ConstraintCastNode { virtual uint ideal_reg() const { return Op_RegL; } }; +class CastFFNode: public ConstraintCastNode { +public: + CastFFNode(Node* n, const Type* t, bool carry_dependency = false) + : ConstraintCastNode(n, t, carry_dependency){ + init_class_id(Class_CastFF); + } + virtual int Opcode() const; + virtual uint ideal_reg() const { return Op_RegF; } +}; + +class CastDDNode: public ConstraintCastNode { +public: + CastDDNode(Node* n, const Type* t, bool carry_dependency = false) + : ConstraintCastNode(n, t, carry_dependency){ + init_class_id(Class_CastDD); + } + virtual int Opcode() const; + virtual uint ideal_reg() const { return Op_RegD; } +}; + +class CastVVNode: public ConstraintCastNode { +public: + CastVVNode(Node* n, const Type* t, bool carry_dependency = false) + : ConstraintCastNode(n, t, carry_dependency){ + init_class_id(Class_CastVV); + } + virtual int Opcode() const; + virtual uint ideal_reg() const { return in(1)->ideal_reg(); } +}; + + //------------------------------CastPPNode------------------------------------- // cast pointer to pointer (different type) class CastPPNode: public ConstraintCastNode { diff --git a/src/hotspot/share/opto/classes.hpp b/src/hotspot/share/opto/classes.hpp index aeb2547b8e8..6d2274eaf57 100644 --- a/src/hotspot/share/opto/classes.hpp +++ b/src/hotspot/share/opto/classes.hpp @@ -62,8 +62,11 @@ macro(CallLeafNoFP) macro(CallRuntime) macro(CallNative) macro(CallStaticJava) +macro(CastDD) +macro(CastFF) macro(CastII) macro(CastLL) +macro(CastVV) macro(CastX2P) macro(CastP2X) macro(CastPP) diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 9b5c7113471..924677f15d4 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -1106,7 +1106,8 @@ void ConnectionGraph::process_call_arguments(CallNode *call) { strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 || strcmp(call->as_CallLeaf()->_name, "bigIntegerRightShiftWorker") == 0 || strcmp(call->as_CallLeaf()->_name, "bigIntegerLeftShiftWorker") == 0 || - strcmp(call->as_CallLeaf()->_name, "vectorizedMismatch") == 0) + strcmp(call->as_CallLeaf()->_name, "vectorizedMismatch") == 0 || + strcmp(call->as_CallLeaf()->_name, "get_class_id_intrinsic") == 0) ))) { call->dump(); fatal("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name); diff --git a/src/hotspot/share/opto/idealKit.cpp b/src/hotspot/share/opto/idealKit.cpp index 0bf0c753a6e..7dd28e11787 100644 --- a/src/hotspot/share/opto/idealKit.cpp +++ b/src/hotspot/share/opto/idealKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -351,7 +351,8 @@ Node* IdealKit::load(Node* ctl, const Type* t, BasicType bt, int adr_idx, - bool require_atomic_access) { + bool require_atomic_access, + MemNode::MemOrd mo) { assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" ); const TypePtr* adr_type = NULL; // debug-mode-only argument @@ -359,9 +360,9 @@ Node* IdealKit::load(Node* ctl, Node* mem = memory(adr_idx); Node* ld; if (require_atomic_access && bt == T_LONG) { - ld = LoadLNode::make_atomic(ctl, mem, adr, adr_type, t, MemNode::unordered); + ld = LoadLNode::make_atomic(ctl, mem, adr, adr_type, t, mo); } else { - ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, MemNode::unordered); + ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, mo); } return transform(ld); } diff --git a/src/hotspot/share/opto/idealKit.hpp b/src/hotspot/share/opto/idealKit.hpp index 1ff67c2f361..368de030b95 100644 --- a/src/hotspot/share/opto/idealKit.hpp +++ b/src/hotspot/share/opto/idealKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -220,7 +220,7 @@ class IdealKit: public StackObj { const Type* t, BasicType bt, int adr_idx, - bool require_atomic_access = false); + bool require_atomic_access = false, MemNode::MemOrd mo = MemNode::unordered); // Return the new StoreXNode Node* store(Node* ctl, diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 6730f78b638..2bf58647257 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -57,6 +57,10 @@ #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" +#if INCLUDE_JFR +#include "jfr/jfr.hpp" +#endif + //---------------------------make_vm_intrinsic---------------------------- CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { vmIntrinsicID id = m->intrinsic_id(); @@ -2802,37 +2806,83 @@ bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* func #ifdef JFR_HAVE_INTRINSICS -/* -* oop -> myklass -* myklass->trace_id |= USED -* return myklass->trace_id & ~0x3 -*/ +/** + * if oop->klass != null + * // normal class + * epoch = _epoch_state ? 2 : 1 + * if oop->klass->trace_id & ((epoch << META_SHIFT) | epoch)) != epoch { + * ... // enter slow path when the klass is first recorded or the epoch of JFR shifts + * } + * id = oop->klass->trace_id >> TRACE_ID_SHIFT // normal class path + * else + * // primitive class + * if oop->array_klass != null + * id = (oop->array_klass->trace_id >> TRACE_ID_SHIFT) + 1 // primitive class path + * else + * id = LAST_TYPE_ID + 1 // void class path + * if (!signaled) + * signaled = true + */ bool LibraryCallKit::inline_native_classID() { - Node* cls = null_check(argument(0), T_OBJECT); - Node* kls = load_klass_from_mirror(cls, false, NULL, 0); - kls = null_check(kls, T_OBJECT); - - ByteSize offset = KLASS_TRACE_ID_OFFSET; - Node* insp = basic_plus_adr(kls, in_bytes(offset)); - Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered); + Node* cls = argument(0); - Node* clsused = longcon(0x01l); // set the class bit - Node* orl = _gvn.transform(new OrLNode(tvalue, clsused)); - const TypePtr *adr_type = _gvn.type(insp)->isa_ptr(); - store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered); - -#ifdef TRACE_ID_META_BITS - Node* mbits = longcon(~TRACE_ID_META_BITS); - tvalue = _gvn.transform(new AndLNode(tvalue, mbits)); -#endif -#ifdef TRACE_ID_SHIFT - Node* cbits = intcon(TRACE_ID_SHIFT); - tvalue = _gvn.transform(new URShiftLNode(tvalue, cbits)); -#endif - - set_result(tvalue); + IdealKit ideal(this); +#define __ ideal. + IdealVariable result(ideal); __ declarations_done(); + Node* kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), + basic_plus_adr(cls, java_lang_Class::klass_offset()), + TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); + + + __ if_then(kls, BoolTest::ne, null()); { + Node* kls_trace_id_addr = basic_plus_adr(kls, in_bytes(KLASS_TRACE_ID_OFFSET)); + Node* kls_trace_id_raw = ideal.load(ideal.ctrl(), kls_trace_id_addr,TypeLong::LONG, T_LONG, Compile::AliasIdxRaw); + + Node* epoch_address = makecon(TypeRawPtr::make(Jfr::epoch_address())); + Node* epoch = ideal.load(ideal.ctrl(), epoch_address, TypeInt::BOOL, T_BOOLEAN, Compile::AliasIdxRaw); + epoch = _gvn.transform(new LShiftLNode(longcon(1), epoch)); + Node* mask = _gvn.transform(new LShiftLNode(epoch, intcon(META_SHIFT))); + mask = _gvn.transform(new OrLNode(mask, epoch)); + Node* kls_trace_id_raw_and_mask = _gvn.transform(new AndLNode(kls_trace_id_raw, mask)); + + float unlikely = PROB_UNLIKELY(0.999); + __ if_then(kls_trace_id_raw_and_mask, BoolTest::ne, epoch, unlikely); { + sync_kit(ideal); + make_runtime_call(RC_LEAF, + OptoRuntime::get_class_id_intrinsic_Type(), + CAST_FROM_FN_PTR(address, Jfr::get_class_id_intrinsic), + "get_class_id_intrinsic", + TypePtr::BOTTOM, + kls); + ideal.sync_kit(this); + } __ end_if(); + + ideal.set(result, _gvn.transform(new URShiftLNode(kls_trace_id_raw, ideal.ConI(TRACE_ID_SHIFT)))); + } __ else_(); { + Node* array_kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), + basic_plus_adr(cls, java_lang_Class::array_klass_offset()), + TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); + __ if_then(array_kls, BoolTest::ne, null()); { + Node* array_kls_trace_id_addr = basic_plus_adr(array_kls, in_bytes(KLASS_TRACE_ID_OFFSET)); + Node* array_kls_trace_id_raw = ideal.load(ideal.ctrl(), array_kls_trace_id_addr, TypeLong::LONG, T_LONG, Compile::AliasIdxRaw); + Node* array_kls_trace_id = _gvn.transform(new URShiftLNode(array_kls_trace_id_raw, ideal.ConI(TRACE_ID_SHIFT))); + ideal.set(result, _gvn.transform(new AddLNode(array_kls_trace_id, longcon(1)))); + } __ else_(); { + // void class case + ideal.set(result, _gvn.transform(longcon(LAST_TYPE_ID + 1))); + } __ end_if(); + + Node* signaled_flag_address = makecon(TypeRawPtr::make(Jfr::signal_address())); + Node* signaled = ideal.load(ideal.ctrl(), signaled_flag_address, TypeInt::BOOL, T_BOOLEAN, Compile::AliasIdxRaw, true, MemNode::acquire); + __ if_then(signaled, BoolTest::ne, ideal.ConI(1)); { + ideal.store(ideal.ctrl(), signaled_flag_address, ideal.ConI(1), T_BOOLEAN, Compile::AliasIdxRaw, MemNode::release, true); + } __ end_if(); + } __ end_if(); + + final_sync(ideal); + set_result(ideal.value(result)); +#undef __ return true; - } bool LibraryCallKit::inline_native_getEventWriter() { diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index df8a3148986..0b77183f740 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -4991,52 +4991,64 @@ Node *PhaseIdealLoop::get_late_ctrl( Node *n, Node *early ) { } #endif - // if this is a load, check for anti-dependent stores - // We use a conservative algorithm to identify potential interfering - // instructions and for rescheduling the load. The users of the memory - // input of this load are examined. Any use which is not a load and is - // dominated by early is considered a potentially interfering store. - // This can produce false positives. if (n->is_Load() && LCA != early) { - int load_alias_idx = C->get_alias_index(n->adr_type()); - if (C->alias_type(load_alias_idx)->is_rewritable()) { - Unique_Node_List worklist; - - Node* mem = n->in(MemNode::Memory); - for (DUIterator_Fast imax, i = mem->fast_outs(imax); i < imax; i++) { - Node* s = mem->fast_out(i); - worklist.push(s); - } - for (uint i = 0; i < worklist.size() && LCA != early; i++) { - Node* s = worklist.at(i); - if (s->is_Load() || s->Opcode() == Op_SafePoint || - (s->is_CallStaticJava() && s->as_CallStaticJava()->uncommon_trap_request() != 0) || - s->is_Phi()) { - continue; - } else if (s->is_MergeMem()) { - for (DUIterator_Fast imax, i = s->fast_outs(imax); i < imax; i++) { - Node* s1 = s->fast_out(i); - worklist.push(s1); - } - } else { - Node* sctrl = has_ctrl(s) ? get_ctrl(s) : s->in(0); - assert(sctrl != NULL || !s->is_reachable_from_root(), "must have control"); - if (sctrl != NULL && !sctrl->is_top() && is_dominator(early, sctrl)) { - const TypePtr* adr_type = s->adr_type(); - if (s->is_ArrayCopy()) { - // Copy to known instance needs destination type to test for aliasing - const TypePtr* dest_type = s->as_ArrayCopy()->_dest_type; - if (dest_type != TypeOopPtr::BOTTOM) { - adr_type = dest_type; - } + LCA = get_late_ctrl_with_anti_dep(n->as_Load(), early, LCA); + } + + assert(LCA == find_non_split_ctrl(LCA), "unexpected late control"); + return LCA; +} + +// if this is a load, check for anti-dependent stores +// We use a conservative algorithm to identify potential interfering +// instructions and for rescheduling the load. The users of the memory +// input of this load are examined. Any use which is not a load and is +// dominated by early is considered a potentially interfering store. +// This can produce false positives. +Node* PhaseIdealLoop::get_late_ctrl_with_anti_dep(LoadNode* n, Node* early, Node* LCA) { + int load_alias_idx = C->get_alias_index(n->adr_type()); + if (C->alias_type(load_alias_idx)->is_rewritable()) { + Unique_Node_List worklist; + + Node* mem = n->in(MemNode::Memory); + for (DUIterator_Fast imax, i = mem->fast_outs(imax); i < imax; i++) { + Node* s = mem->fast_out(i); + worklist.push(s); + } + for (uint i = 0; i < worklist.size() && LCA != early; i++) { + Node* s = worklist.at(i); + if (s->is_Load() || s->Opcode() == Op_SafePoint || + (s->is_CallStaticJava() && s->as_CallStaticJava()->uncommon_trap_request() != 0) || + s->is_Phi()) { + continue; + } else if (s->is_MergeMem()) { + for (DUIterator_Fast imax, i = s->fast_outs(imax); i < imax; i++) { + Node* s1 = s->fast_out(i); + worklist.push(s1); + } + } else { + Node* sctrl = has_ctrl(s) ? get_ctrl(s) : s->in(0); + assert(sctrl != NULL || !s->is_reachable_from_root(), "must have control"); + if (sctrl != NULL && !sctrl->is_top() && is_dominator(early, sctrl)) { + const TypePtr* adr_type = s->adr_type(); + if (s->is_ArrayCopy()) { + // Copy to known instance needs destination type to test for aliasing + const TypePtr* dest_type = s->as_ArrayCopy()->_dest_type; + if (dest_type != TypeOopPtr::BOTTOM) { + adr_type = dest_type; } - if (C->can_alias(adr_type, load_alias_idx)) { - LCA = dom_lca_for_get_late_ctrl(LCA, sctrl, n); - } else if (s->is_CFG()) { - for (DUIterator_Fast imax, i = s->fast_outs(imax); i < imax; i++) { - Node* s1 = s->fast_out(i); - if (_igvn.type(s1) == Type::MEMORY) { - worklist.push(s1); + } + if (C->can_alias(adr_type, load_alias_idx)) { + LCA = dom_lca_for_get_late_ctrl(LCA, sctrl, n); + } else if (s->is_CFG() && s->is_Multi()) { + // Look for the memory use of s (that is the use of its memory projection) + for (DUIterator_Fast imax, i = s->fast_outs(imax); i < imax; i++) { + Node* s1 = s->fast_out(i); + assert(s1->is_Proj(), "projection expected"); + if (_igvn.type(s1) == Type::MEMORY) { + for (DUIterator_Fast jmax, j = s1->fast_outs(jmax); j < jmax; j++) { + Node* s2 = s1->fast_out(j); + worklist.push(s2); } } } @@ -5062,8 +5074,6 @@ Node *PhaseIdealLoop::get_late_ctrl( Node *n, Node *early ) { } } } - - assert(LCA == find_non_split_ctrl(LCA), "unexpected late control"); return LCA; } @@ -5091,23 +5101,24 @@ bool PhaseIdealLoop::is_dominator(Node *d, Node *n) { // does not need to be cleared between calls to get_late_ctrl(). // Algorithm trades a larger constant factor for better asymptotic behavior // -Node *PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal( Node *n1, Node *n2, Node *tag ) { +Node *PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal(Node *n1, Node *n2, Node *tag_node) { uint d1 = dom_depth(n1); uint d2 = dom_depth(n2); + jlong tag = tag_node->_idx | (((jlong)_dom_lca_tags_round) << 32); do { if (d1 > d2) { // current lca is deeper than n2 - _dom_lca_tags.map(n1->_idx, tag); + _dom_lca_tags.at_put_grow(n1->_idx, tag); n1 = idom(n1); d1 = dom_depth(n1); } else if (d1 < d2) { // n2 is deeper than current lca - Node *memo = _dom_lca_tags[n2->_idx]; - if( memo == tag ) { + jlong memo = _dom_lca_tags.at_grow(n2->_idx, 0); + if (memo == tag) { return n1; // Return the current LCA } - _dom_lca_tags.map(n2->_idx, tag); + _dom_lca_tags.at_put_grow(n2->_idx, tag); n2 = idom(n2); d2 = dom_depth(n2); } else { @@ -5116,19 +5127,19 @@ Node *PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal( Node *n1, Node *n2, No // to be searched more carefully. // Scan up all the n1's with equal depth, looking for n2. - _dom_lca_tags.map(n1->_idx, tag); + _dom_lca_tags.at_put_grow(n1->_idx, tag); Node *t1 = idom(n1); while (dom_depth(t1) == d1) { if (t1 == n2) return n2; - _dom_lca_tags.map(t1->_idx, tag); + _dom_lca_tags.at_put_grow(t1->_idx, tag); t1 = idom(t1); } // Scan up all the n2's with equal depth, looking for n1. - _dom_lca_tags.map(n2->_idx, tag); + _dom_lca_tags.at_put_grow(n2->_idx, tag); Node *t2 = idom(n2); while (dom_depth(t2) == d2) { if (t2 == n1) return n1; - _dom_lca_tags.map(t2->_idx, tag); + _dom_lca_tags.at_put_grow(t2->_idx, tag); t2 = idom(t2); } // Move up to a new dominator-depth value as well as up the dom-tree. @@ -5147,25 +5158,11 @@ Node *PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal( Node *n1, Node *n2, No // be of fixed size. void PhaseIdealLoop::init_dom_lca_tags() { uint limit = C->unique() + 1; - _dom_lca_tags.map( limit, NULL ); -#ifdef ASSERT - for( uint i = 0; i < limit; ++i ) { - assert(_dom_lca_tags[i] == NULL, "Must be distinct from each node pointer"); - } -#endif // ASSERT -} - -//------------------------------clear_dom_lca_tags------------------------------ -// Tag could be a node's integer index, 32bits instead of 64bits in some cases -// Intended use does not involve any growth for the array, so it could -// be of fixed size. -void PhaseIdealLoop::clear_dom_lca_tags() { - uint limit = C->unique() + 1; - _dom_lca_tags.map( limit, NULL ); - _dom_lca_tags.clear(); + _dom_lca_tags.at_grow(limit, 0); + _dom_lca_tags_round = 0; #ifdef ASSERT - for( uint i = 0; i < limit; ++i ) { - assert(_dom_lca_tags[i] == NULL, "Must be distinct from each node pointer"); + for (uint i = 0; i < limit; ++i) { + assert(_dom_lca_tags.at(i) == 0, "Must be distinct from each node pointer"); } #endif // ASSERT } diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 726ca9e9228..12bbc2017f0 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -867,9 +867,9 @@ class PhaseIdealLoop : public PhaseTransform { // Support for faster execution of get_late_ctrl()/dom_lca() // when a node has many uses and dominator depth is deep. - Node_Array _dom_lca_tags; + GrowableArray _dom_lca_tags; + uint _dom_lca_tags_round; void init_dom_lca_tags(); - void clear_dom_lca_tags(); // Helper for debugging bad dominance relationships bool verify_dominance(Node* n, Node* use, Node* LCA, Node* early); @@ -1063,7 +1063,6 @@ class PhaseIdealLoop : public PhaseTransform { _igvn(igvn), _verify_me(nullptr), _verify_only(false), - _dom_lca_tags(arena()), // Thread::resource_area _nodes_required(UINT_MAX) { assert(mode != LoopOptsVerify, "wrong constructor to verify IdealLoop"); build_and_optimize(mode); @@ -1077,7 +1076,6 @@ class PhaseIdealLoop : public PhaseTransform { _igvn(igvn), _verify_me(verify_me), _verify_only(verify_me == nullptr), - _dom_lca_tags(arena()), // Thread::resource_area _nodes_required(UINT_MAX) { build_and_optimize(LoopOptsVerify); } @@ -1485,7 +1483,7 @@ class PhaseIdealLoop : public PhaseTransform { void handle_use( Node *use, Node *def, small_cache *cache, Node *region_dom, Node *new_false, Node *new_true, Node *old_false, Node *old_true ); bool split_up( Node *n, Node *blk1, Node *blk2 ); void sink_use( Node *use, Node *post_loop ); - Node *place_near_use( Node *useblock ) const; + Node* place_outside_loop(Node* useblock, IdealLoopTree* loop) const; Node* try_move_store_before_loop(Node* n, Node *n_ctrl); void try_move_store_after_loop(Node* n); bool identical_backtoback_ifs(Node *n); @@ -1613,7 +1611,15 @@ class PhaseIdealLoop : public PhaseTransform { LoopNode* create_inner_head(IdealLoopTree* loop, LongCountedLoopNode* head, LongCountedLoopEndNode* exit_test); - bool is_safe_load_ctrl(Node* ctrl); + Node* get_late_ctrl_with_anti_dep(LoadNode* n, Node* early, Node* LCA); + + bool ctrl_of_use_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop, Node* ctrl); + + bool ctrl_of_all_uses_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop); + + Node* compute_early_ctrl(Node* n, Node* n_ctrl); + + void try_sink_out_of_loop(Node* n); }; diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 4c0033ec630..526b17131ff 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -1134,21 +1134,26 @@ static bool merge_point_safe(Node* region) { } -//------------------------------place_near_use--------------------------------- -// Place some computation next to use but not inside inner loops. -// For inner loop uses move it to the preheader area. -Node *PhaseIdealLoop::place_near_use(Node *useblock) const { - IdealLoopTree *u_loop = get_loop( useblock ); - if (u_loop->_irreducible) { - return useblock; - } - if (u_loop->_child) { - if (useblock == u_loop->_head && u_loop->_head->is_OuterStripMinedLoop()) { - return u_loop->_head->in(LoopNode::EntryControl); +//------------------------------place_outside_loop--------------------------------- +// Place some computation outside of this loop on the path to the use passed as argument +Node* PhaseIdealLoop::place_outside_loop(Node* useblock, IdealLoopTree* loop) const { + Node* head = loop->_head; + assert(!loop->is_member(get_loop(useblock)), "must be outside loop"); + if (head->is_Loop() && head->as_Loop()->is_strip_mined()) { + loop = loop->_parent; + assert(loop->_head->is_OuterStripMinedLoop(), "malformed strip mined loop"); + } + + // Pick control right outside the loop + for (;;) { + Node* dom = idom(useblock); + if (loop->is_member(get_loop(dom))) { + break; } - return useblock; + useblock = dom; } - return u_loop->_head->as_Loop()->skip_strip_mined()->in(LoopNode::EntryControl); + assert(find_non_split_ctrl(useblock) == useblock, "should be non split control"); + return useblock; } @@ -1402,143 +1407,212 @@ void PhaseIdealLoop::split_if_with_blocks_post(Node *n) { } } - // See if a shared loop-varying computation has no loop-varying uses. - // Happens if something is only used for JVM state in uncommon trap exits, - // like various versions of induction variable+offset. Clone the - // computation per usage to allow it to sink out of the loop. - if (has_ctrl(n) && !n->in(0)) {// n not dead and has no control edge (can float about) + try_sink_out_of_loop(n); + + try_move_store_after_loop(n); + + // Check for Opaque2's who's loop has disappeared - who's input is in the + // same loop nest as their output. Remove 'em, they are no longer useful. + if( n_op == Op_Opaque2 && + n->in(1) != NULL && + get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) { + _igvn.replace_node( n, n->in(1) ); + } +} + +// See if a shared loop-varying computation has no loop-varying uses. +// Happens if something is only used for JVM state in uncommon trap exits, +// like various versions of induction variable+offset. Clone the +// computation per usage to allow it to sink out of the loop. +void PhaseIdealLoop::try_sink_out_of_loop(Node* n) { + if (has_ctrl(n) && + !n->is_Phi() && + !n->is_Bool() && + !n->is_Proj() && + !n->is_MergeMem() && + !n->is_CMove() && + n->Opcode() != Op_Opaque4) { Node *n_ctrl = get_ctrl(n); IdealLoopTree *n_loop = get_loop(n_ctrl); - if( n_loop != _ltree_root ) { - DUIterator_Fast imax, i = n->fast_outs(imax); - for (; i < imax; i++) { - Node* u = n->fast_out(i); - if( !has_ctrl(u) ) break; // Found control user - IdealLoopTree *u_loop = get_loop(get_ctrl(u)); - if( u_loop == n_loop ) break; // Found loop-varying use - if( n_loop->is_member( u_loop ) ) break; // Found use in inner loop - if( u->Opcode() == Op_Opaque1 ) break; // Found loop limit, bugfix for 4677003 - } - bool did_break = (i < imax); // Did we break out of the previous loop? - if (!did_break && n->outcnt() > 1) { // All uses in outer loops! - Node *late_load_ctrl = NULL; - if (n->is_Load()) { - // If n is a load, get and save the result from get_late_ctrl(), - // to be later used in calculating the control for n's clones. - clear_dom_lca_tags(); - late_load_ctrl = get_late_ctrl(n, n_ctrl); - } - // If n is a load, and the late control is the same as the current - // control, then the cloning of n is a pointless exercise, because - // GVN will ensure that we end up where we started. - if (!n->is_Load() || (late_load_ctrl != n_ctrl && is_safe_load_ctrl(late_load_ctrl))) { - Node* outer_loop_clone = NULL; - for (DUIterator_Last jmin, j = n->last_outs(jmin); j >= jmin; ) { - Node *u = n->last_out(j); // Clone private computation per use - _igvn.rehash_node_delayed(u); - Node *x = n->clone(); // Clone computation - Node *x_ctrl = NULL; - if( u->is_Phi() ) { - // Replace all uses of normal nodes. Replace Phi uses - // individually, so the separate Nodes can sink down - // different paths. - uint k = 1; - while( u->in(k) != n ) k++; - u->set_req( k, x ); - // x goes next to Phi input path - x_ctrl = u->in(0)->in(k); - --j; - } else { // Normal use - // Replace all uses - for( uint k = 0; k < u->req(); k++ ) { - if( u->in(k) == n ) { - u->set_req( k, x ); - --j; - } - } + if (n_loop != _ltree_root && n->outcnt() > 1) { + // Compute early control: needed for anti-dependence analysis. It's also possible that as a result of + // previous transformations in this loop opts round, the node can be hoisted now: early control will tell us. + Node* early_ctrl = compute_early_ctrl(n, n_ctrl); + if (n_loop->is_member(get_loop(early_ctrl)) && // check that this one can't be hoisted now + ctrl_of_all_uses_out_of_loop(n, early_ctrl, n_loop)) { // All uses in outer loops! + assert(!n->is_Store() && !n->is_LoadStore(), "no node with a side effect"); + Node* outer_loop_clone = NULL; + for (DUIterator_Last jmin, j = n->last_outs(jmin); j >= jmin;) { + Node* u = n->last_out(j); // Clone private computation per use + _igvn.rehash_node_delayed(u); + Node* x = n->clone(); // Clone computation + Node* x_ctrl = NULL; + if (u->is_Phi()) { + // Replace all uses of normal nodes. Replace Phi uses + // individually, so the separate Nodes can sink down + // different paths. + uint k = 1; + while (u->in(k) != n) k++; + u->set_req(k, x); + // x goes next to Phi input path + x_ctrl = u->in(0)->in(k); + // Find control for 'x' next to use but not inside inner loops. + x_ctrl = place_outside_loop(x_ctrl, n_loop); + --j; + } else { // Normal use + if (has_ctrl(u)) { x_ctrl = get_ctrl(u); + } else { + x_ctrl = u->in(0); } - // Find control for 'x' next to use but not inside inner loops. - // For inner loop uses get the preheader area. - x_ctrl = place_near_use(x_ctrl); - - if (n->is_Load()) { - // For loads, add a control edge to a CFG node outside of the loop - // to force them to not combine and return back inside the loop - // during GVN optimization (4641526). - // - // Because we are setting the actual control input, factor in - // the result from get_late_ctrl() so we respect any - // anti-dependences. (6233005). - x_ctrl = dom_lca(late_load_ctrl, x_ctrl); - - // Don't allow the control input to be a CFG splitting node. - // Such nodes should only have ProjNodes as outs, e.g. IfNode - // should only have IfTrueNode and IfFalseNode (4985384). - x_ctrl = find_non_split_ctrl(x_ctrl); - - IdealLoopTree* x_loop = get_loop(x_ctrl); - Node* x_head = x_loop->_head; - if (x_head->is_Loop() && (x_head->is_OuterStripMinedLoop() || x_head->as_Loop()->is_strip_mined())) { - if (is_dominator(n_ctrl, x_head) && n_ctrl != x_head) { - // Anti dependence analysis is sometimes too - // conservative: a store in the outer strip mined loop - // can prevent a load from floating out of the outer - // strip mined loop but the load may not be referenced - // from the safepoint: loop strip mining verification - // code reports a problem in that case. Make sure the - // load is not moved in the outer strip mined loop in - // that case. - x_ctrl = x_head->as_Loop()->skip_strip_mined()->in(LoopNode::EntryControl); - } else if (x_head->is_OuterStripMinedLoop()) { - // Do not add duplicate LoadNodes to the outer strip mined loop - if (outer_loop_clone != NULL) { - _igvn.replace_node(x, outer_loop_clone); - continue; - } - outer_loop_clone = x; - } - } - assert(dom_depth(n_ctrl) <= dom_depth(x_ctrl), "n is later than its clone"); + x_ctrl = place_outside_loop(x_ctrl, n_loop); + // Replace all uses + if (u->is_ConstraintCast() && u->bottom_type()->higher_equal(_igvn.type(n)) && u->in(0) == x_ctrl) { + // If we're sinking a chain of data nodes, we might have inserted a cast to pin the use which is not necessary + // anymore now that we're going to pin n as well + _igvn.replace_node(u, x); + --j; + } else { + int nb = u->replace_edge(n, x, &_igvn); + j -= nb; + } + } - x->set_req(0, x_ctrl); + if (n->is_Load()) { + // For loads, add a control edge to a CFG node outside of the loop + // to force them to not combine and return back inside the loop + // during GVN optimization (4641526). + assert(x_ctrl == get_late_ctrl_with_anti_dep(x->as_Load(), early_ctrl, x_ctrl), "anti-dependences were already checked"); + + IdealLoopTree* x_loop = get_loop(x_ctrl); + Node* x_head = x_loop->_head; + if (x_head->is_Loop() && x_head->is_OuterStripMinedLoop()) { + // Do not add duplicate LoadNodes to the outer strip mined loop + if (outer_loop_clone != NULL) { + _igvn.replace_node(x, outer_loop_clone); + continue; + } + outer_loop_clone = x; } - register_new_node(x, x_ctrl); - - // Some institutional knowledge is needed here: 'x' is - // yanked because if the optimizer runs GVN on it all the - // cloned x's will common up and undo this optimization and - // be forced back in the loop. - // I tried setting control edges on the x's to force them to - // not combine, but the matching gets worried when it tries - // to fold a StoreP and an AddP together (as part of an - // address expression) and the AddP and StoreP have - // different controls. - if (!x->is_Load() && !x->is_DecodeNarrowPtr()) { - _igvn._worklist.yank(x); + x->set_req(0, x_ctrl); + } else if (n->in(0) != NULL){ + x->set_req(0, x_ctrl); + } + assert(dom_depth(n_ctrl) <= dom_depth(x_ctrl), "n is later than its clone"); + assert(!n_loop->is_member(get_loop(x_ctrl)), "should have moved out of loop"); + register_new_node(x, x_ctrl); + + if (x->in(0) == NULL && !x->is_DecodeNarrowPtr()) { + assert(!x->is_Load(), "load should be pinned"); + // Use a cast node to pin clone out of loop + Node* cast = NULL; + for (uint k = 0; k < x->req(); k++) { + Node* in = x->in(k); + if (in != NULL && n_loop->is_member(get_loop(get_ctrl(in)))) { + const Type* in_t = _igvn.type(in); + if (in_t->isa_int()) { + cast = new CastIINode(in, in_t, true); + } else if (in_t->isa_long()) { + cast = new CastLLNode(in, in_t, true); + } else if (in_t->isa_ptr()) { + cast = new CastPPNode(in, in_t, true); + } else if (in_t->isa_float()) { + cast = new CastFFNode(in, in_t, true); + } else if (in_t->isa_double()) { + cast = new CastDDNode(in, in_t, true); + } else if (in_t->isa_vect()) { + cast = new CastVVNode(in, in_t, true); + } + } + if (cast != NULL) { + cast->set_req(0, x_ctrl); + register_new_node(cast, x_ctrl); + x->replace_edge(in, cast); + break; + } } + assert(cast != NULL, "must have added a cast to pin the node"); } - _igvn.remove_dead_node(n); } + _igvn.remove_dead_node(n); } + _dom_lca_tags_round = 0; } } +} - try_move_store_after_loop(n); +Node* PhaseIdealLoop::compute_early_ctrl(Node* n, Node* n_ctrl) { + Node* early_ctrl = NULL; + ResourceMark rm; + Unique_Node_List wq; + wq.push(n); + for (uint i = 0; i < wq.size(); i++) { + Node* m = wq.at(i); + Node* c = NULL; + if (m->is_CFG()) { + c = m; + } else if (m->pinned()) { + c = m->in(0); + } else { + for (uint j = 0; j < m->req(); j++) { + Node* in = m->in(j); + if (in == NULL) { + continue; + } + wq.push(in); + } + } + if (c != NULL) { + assert(is_dominator(c, n_ctrl), ""); + if (early_ctrl == NULL) { + early_ctrl = c; + } else if (is_dominator(early_ctrl, c)) { + early_ctrl = c; + } + } + } + assert(is_dominator(early_ctrl, n_ctrl), "early control must dominate current control"); + return early_ctrl; +} - // Check for Opaque2's who's loop has disappeared - who's input is in the - // same loop nest as their output. Remove 'em, they are no longer useful. - if( n_op == Op_Opaque2 && - n->in(1) != NULL && - get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) { - _igvn.replace_node( n, n->in(1) ); +bool PhaseIdealLoop::ctrl_of_all_uses_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop) { + for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { + Node* u = n->fast_out(i); + if (u->Opcode() == Op_Opaque1) { + return false; // Found loop limit, bugfix for 4677003 + } + // We can't reuse tags in PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal() so make sure calls to + // get_late_ctrl_with_anti_dep() use their own tag + _dom_lca_tags_round++; + assert(_dom_lca_tags_round != 0, "shouldn't wrap around"); + + if (u->is_Phi()) { + for (uint j = 1; j < u->req(); ++j) { + if (u->in(j) == n && !ctrl_of_use_out_of_loop(n, n_ctrl, n_loop, u->in(0)->in(j))) { + return false; + } + } + } else { + Node* ctrl = has_ctrl(u) ? get_ctrl(u) : u->in(0); + if (!ctrl_of_use_out_of_loop(n, n_ctrl, n_loop, ctrl)) { + return false; + } + } } + return true; } -bool PhaseIdealLoop::is_safe_load_ctrl(Node* ctrl) { - if (ctrl->is_Proj() && ctrl->in(0)->is_Call() && ctrl->has_out_with(Op_Catch)) { - return false; +bool PhaseIdealLoop::ctrl_of_use_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop, Node* ctrl) { + if (n->is_Load()) { + ctrl = get_late_ctrl_with_anti_dep(n->as_Load(), n_ctrl, ctrl); + } + IdealLoopTree *u_loop = get_loop(ctrl); + if (u_loop == n_loop) { + return false; // Found loop-varying use + } + if (n_loop->is_member(u_loop)) { + return false; // Found use in inner loop } return true; } diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index d9e2096616f..e18eb375839 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -2212,22 +2212,16 @@ void Node::verify_edges(Unique_Node_List &visited) { } // Verify all nodes if verify_depth is negative -void Node::verify(Node* n, int verify_depth) { +void Node::verify(int verify_depth, VectorSet& visited, Node_List& worklist) { assert(verify_depth != 0, "depth should not be 0"); - ResourceMark rm; - VectorSet old_space; - VectorSet new_space; - Node_List worklist; - worklist.push(n); Compile* C = Compile::current(); - uint last_index_on_current_depth = 0; + uint last_index_on_current_depth = worklist.size() - 1; verify_depth--; // Visiting the first node on depth 1 // Only add nodes to worklist if verify_depth is negative (visit all nodes) or greater than 0 bool add_to_worklist = verify_depth != 0; - for (uint list_index = 0; list_index < worklist.size(); list_index++) { - n = worklist[list_index]; + Node* n = worklist[list_index]; if (n->is_Con() && n->bottom_type() == Type::TOP) { if (C->cached_top_node() == NULL) { @@ -2236,17 +2230,28 @@ void Node::verify(Node* n, int verify_depth) { assert(C->cached_top_node() == n, "TOP node must be unique"); } - for (uint i = 0; i < n->len(); i++) { - Node* x = n->in(i); + uint in_len = n->len(); + for (uint i = 0; i < in_len; i++) { + Node* x = n->_in[i]; if (!x || x->is_top()) { continue; } // Verify my input has a def-use edge to me // Count use-def edges from n to x - int cnt = 0; - for (uint j = 0; j < n->len(); j++) { - if (n->in(j) == x) { + int cnt = 1; + for (uint j = 0; j < i; j++) { + if (n->_in[j] == x) { + cnt++; + break; + } + } + if (cnt == 2) { + // x is already checked as n's previous input, skip its duplicated def-use count checking + continue; + } + for (uint j = i + 1; j < in_len; j++) { + if (n->_in[j] == x) { cnt++; } } @@ -2260,11 +2265,7 @@ void Node::verify(Node* n, int verify_depth) { } assert(cnt == 0, "mismatched def-use edge counts"); - // Contained in new_space or old_space? - VectorSet* v = C->node_arena()->contains(x) ? &new_space : &old_space; - // Check for visited in the proper space. Numberings are not unique - // across spaces so we need a separate VectorSet for each space. - if (add_to_worklist && !v->test_set(x->_idx)) { + if (add_to_worklist && !visited.test_set(x->_idx)) { worklist.push(x); } } diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index 8931514e538..092614f18e7 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -57,6 +57,9 @@ class CallNode; class CallRuntimeNode; class CallNativeNode; class CallStaticJavaNode; +class CastFFNode; +class CastDDNode; +class CastVVNode; class CastIINode; class CastLLNode; class CatchNode; @@ -691,6 +694,9 @@ class Node { DEFINE_CLASS_ID(CastII, ConstraintCast, 0) DEFINE_CLASS_ID(CheckCastPP, ConstraintCast, 1) DEFINE_CLASS_ID(CastLL, ConstraintCast, 2) + DEFINE_CLASS_ID(CastFF, ConstraintCast, 3) + DEFINE_CLASS_ID(CastDD, ConstraintCast, 4) + DEFINE_CLASS_ID(CastVV, ConstraintCast, 5) DEFINE_CLASS_ID(CMove, Type, 3) DEFINE_CLASS_ID(SafePointScalarObject, Type, 4) DEFINE_CLASS_ID(DecodeNarrowPtr, Type, 5) @@ -1202,7 +1208,7 @@ class Node { void collect_nodes_out_all_ctrl_boundary(GrowableArray *ns) const; void verify_edges(Unique_Node_List &visited); // Verify bi-directional edges - static void verify(Node* n, int verify_depth); + static void verify(int verify_depth, VectorSet& visited, Node_List& worklist); // This call defines a class-unique string used to identify class instances virtual const char *Name() const; diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index 212d0ca30e7..1ff359e2b42 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1021,11 +1021,17 @@ void PhaseIterGVN::shuffle_worklist() { #ifndef PRODUCT void PhaseIterGVN::verify_step(Node* n) { if (VerifyIterativeGVN) { + ResourceMark rm; + VectorSet visited; + Node_List worklist; + _verify_window[_verify_counter % _verify_window_size] = n; ++_verify_counter; if (C->unique() < 1000 || 0 == _verify_counter % (C->unique() < 10000 ? 10 : 100)) { ++_verify_full_passes; - Node::verify(C->root(), -1); + worklist.push(C->root()); + Node::verify(-1, visited, worklist); + return; } for (int i = 0; i < _verify_window_size; i++) { Node* n = _verify_window[i]; @@ -1038,8 +1044,11 @@ void PhaseIterGVN::verify_step(Node* n) { continue; } // Typical fanout is 1-2, so this call visits about 6 nodes. - Node::verify(n, 4); + if (!visited.test_set(n->_idx)) { + worklist.push(n); + } } + Node::verify(4, visited, worklist); } } @@ -1238,7 +1247,7 @@ Node *PhaseIterGVN::transform_old(Node* n) { // Remove 'n' from hash table in case it gets modified _table.hash_delete(n); if (VerifyIterativeGVN) { - assert(!_table.find_index(n->_idx), "found duplicate entry in table"); + assert(!_table.find_index(n->_idx), "found duplicate entry in table"); } // Apply the Ideal call in a loop until it no longer applies diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index 7f7d265b6e8..ec401f8cbb9 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1498,6 +1498,21 @@ const TypeFunc *OptoRuntime::register_finalizer_Type() { return TypeFunc::make(domain,range); } +#if INCLUDE_JFR +const TypeFunc *OptoRuntime::get_class_id_intrinsic_Type() { + // create input type (domain) + const Type **fields = TypeTuple::fields(1); + fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS; + const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 1, fields); + + // create result type (range) + fields = TypeTuple::fields(0); + + const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields); + + return TypeFunc::make(domain,range); +} +#endif //----------------------------------------------------------------------------- // Dtrace support. entry and exit probes have the same signature diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp index f93c147bc34..aeda193926a 100644 --- a/src/hotspot/share/opto/runtime.hpp +++ b/src/hotspot/share/opto/runtime.hpp @@ -304,6 +304,8 @@ class OptoRuntime : public AllStatic { static const TypeFunc* register_finalizer_Type(); + JFR_ONLY(static const TypeFunc* get_class_id_intrinsic_Type();) + // Dtrace support static const TypeFunc* dtrace_method_entry_exit_Type(); static const TypeFunc* dtrace_object_alloc_Type(); diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 67b67967540..f613299a1c4 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -1439,9 +1439,10 @@ bool LibraryCallKit::inline_vector_convert() { return false; // should be primitive type } BasicType elem_bt_to = elem_type_to->basic_type(); - if (is_mask && elem_bt_from != elem_bt_to) { - return false; // type mismatch + if (is_mask && (type2aelembytes(elem_bt_from) != type2aelembytes(elem_bt_to))) { + return false; // elem size mismatch } + int num_elem_from = vlen_from->get_con(); int num_elem_to = vlen_to->get_con(); diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index 94f75098da1..5e29337b9da 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -3191,31 +3191,7 @@ JvmtiEnv::RawMonitorEnter(JvmtiRawMonitor * rmonitor) { // in thread.cpp. JvmtiPendingMonitors::enter(rmonitor); } else { - Thread* thread = Thread::current(); - if (thread->is_Java_thread()) { - JavaThread* current_thread = thread->as_Java_thread(); - - /* Transition to thread_blocked without entering vm state */ - /* This is really evil. Normally you can't undo _thread_blocked */ - /* transitions like this because it would cause us to miss a */ - /* safepoint but since the thread was already in _thread_in_native */ - /* the thread is not leaving a safepoint safe state and it will */ - /* block when it tries to return from native. We can't safepoint */ - /* block in here because we could deadlock the vmthread. Blech. */ - - JavaThreadState state = current_thread->thread_state(); - assert(state == _thread_in_native, "Must be _thread_in_native"); - // frame should already be walkable since we are in native - assert(!current_thread->has_last_Java_frame() || - current_thread->frame_anchor()->walkable(), "Must be walkable"); - current_thread->set_thread_state(_thread_blocked); - - rmonitor->raw_enter(current_thread); - // restore state, still at a safepoint safe state - current_thread->set_thread_state(state); - } else { - rmonitor->raw_enter(thread); - } + rmonitor->raw_enter(Thread::current()); } return JVMTI_ERROR_NONE; } /* end RawMonitorEnter */ diff --git a/src/hotspot/share/prims/jvmtiRawMonitor.cpp b/src/hotspot/share/prims/jvmtiRawMonitor.cpp index b423a79360c..46a3bbd77f6 100644 --- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp +++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp @@ -43,10 +43,12 @@ void JvmtiPendingMonitors::transition_raw_monitors() { "Java thread has not been created yet or more than one java thread " "is running. Raw monitor transition will not work"); JavaThread* current_java_thread = JavaThread::current(); - assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm"); - for (int i = 0; i < count(); i++) { - JvmtiRawMonitor* rmonitor = monitors()->at(i); - rmonitor->raw_enter(current_java_thread); + { + ThreadToNativeFromVM ttnfvm(current_java_thread); + for (int i = 0; i < count(); i++) { + JvmtiRawMonitor* rmonitor = monitors()->at(i); + rmonitor->raw_enter(current_java_thread); + } } // pending monitors are converted to real monitor so delete them all. dispose(); @@ -60,7 +62,6 @@ JvmtiRawMonitor::JvmtiRawMonitor(const char* name) : _owner(NULL), _recursions(0), _entry_list(NULL), _wait_set(NULL), - _waiters(0), _magic(JVMTI_RM_MAGIC), _name(NULL) { #ifdef ASSERT @@ -217,11 +218,12 @@ inline void JvmtiRawMonitor::dequeue_waiter(QNode& node) { // simple_wait is not quite so simple as we have to deal with the interaction // with the Thread interrupt state, which resides in the java.lang.Thread object. // That state must only be accessed while _thread_in_vm and requires proper thread-state -// transitions. However, we cannot perform such transitions whilst we hold the RawMonitor, -// else we can deadlock with the VMThread (which may also use RawMonitors as part of -// executing various callbacks). +// transitions. // Returns M_OK usually, but M_INTERRUPTED if the thread is a JavaThread and was // interrupted. +// Note: +// - simple_wait never reenters the monitor. +// - A JavaThread must be in native. int JvmtiRawMonitor::simple_wait(Thread* self, jlong millis) { guarantee(_owner == self , "invariant"); guarantee(_recursions == 0, "invariant"); @@ -235,21 +237,24 @@ int JvmtiRawMonitor::simple_wait(Thread* self, jlong millis) { int ret = M_OK; if (self->is_Java_thread()) { JavaThread* jt = self->as_Java_thread(); - // Transition to VM so we can check interrupt state - ThreadInVMfromNative tivm(jt); - if (jt->is_interrupted(true)) { + guarantee(jt->thread_state() == _thread_in_native, "invariant"); + { + // This transition must be after we exited the monitor. + ThreadInVMfromNative tivmfn(jt); + if (jt->is_interrupted(true)) { ret = M_INTERRUPTED; - } else { - ThreadBlockInVM tbivm(jt); - if (millis <= 0) { - self->_ParkEvent->park(); } else { - self->_ParkEvent->park(millis); + ThreadBlockInVM tbivm(jt); + if (millis <= 0) { + self->_ParkEvent->park(); + } else { + self->_ParkEvent->park(millis); + } + // Return to VM before post-check of interrupt state + } + if (jt->is_interrupted(true)) { + ret = M_INTERRUPTED; } - // Return to VM before post-check of interrupt state - } - if (jt->is_interrupted(true)) { - ret = M_INTERRUPTED; } } else { if (millis <= 0) { @@ -261,10 +266,6 @@ int JvmtiRawMonitor::simple_wait(Thread* self, jlong millis) { dequeue_waiter(node); - simple_enter(self); - guarantee(_owner == self, "invariant"); - guarantee(_recursions == 0, "invariant"); - return ret; } @@ -306,75 +307,37 @@ void JvmtiRawMonitor::simple_notify(Thread* self, bool all) { return; } -// Any JavaThread will enter here with state _thread_blocked unless we -// are in single-threaded mode during startup. -void JvmtiRawMonitor::raw_enter(Thread* self) { - void* contended; - JavaThread* jt = NULL; - // don't enter raw monitor if thread is being externally suspended, it will - // surprise the suspender if a "suspended" thread can still enter monitor - if (self->is_Java_thread()) { - jt = self->as_Java_thread(); - while (true) { - // To pause suspend requests while in blocked we must block handshakes. - jt->handshake_state()->lock(); - // Suspend request flag can only be set in handshakes. - // By blocking handshakes, suspend request flag cannot change its value. - if (!jt->handshake_state()->is_suspended()) { - contended = Atomic::cmpxchg(&_owner, (Thread*)NULL, jt); - jt->handshake_state()->unlock(); - break; - } - jt->handshake_state()->unlock(); - - // We may only be in states other than _thread_blocked when we are - // in single-threaded mode during startup. - guarantee(jt->thread_state() == _thread_blocked, "invariant"); - - jt->set_thread_state_fence(_thread_blocked_trans); - SafepointMechanism::process_if_requested(jt); - // We should transition to thread_in_vm and then to thread_in_vm_trans, - // but those are always treated the same as _thread_blocked_trans. - jt->set_thread_state(_thread_blocked); - } - } else { - contended = Atomic::cmpxchg(&_owner, (Thread*)NULL, self); - } +void JvmtiRawMonitor::ExitOnSuspend::operator()(JavaThread* current) { + // We must exit the monitor in case of a safepoint. + _rm->simple_exit(current); + _rm_exited = true; +} - if (contended == self) { +// JavaThreads will enter here with state _thread_in_native. +void JvmtiRawMonitor::raw_enter(Thread* self) { + // TODO Atomic::load on _owner field + if (_owner == self) { _recursions++; return; } - if (contended == NULL) { - guarantee(_owner == self, "invariant"); - guarantee(_recursions == 0, "invariant"); - return; - } - self->set_current_pending_raw_monitor(this); if (!self->is_Java_thread()) { simple_enter(self); } else { - // In multi-threaded mode, we must enter this method blocked. - guarantee(jt->thread_state() == _thread_blocked, "invariant"); + JavaThread* jt = self->as_Java_thread(); + guarantee(jt->thread_state() == _thread_in_native, "invariant"); + ThreadInVMfromNative tivmfn(jt); for (;;) { - simple_enter(jt); - if (!SafepointMechanism::should_process(jt)) { - // Not suspended so we're done here. - break; + ExitOnSuspend eos(this); + { + ThreadBlockInVMPreprocess tbivmp(jt, eos); + simple_enter(jt); } - if (!jt->is_suspended()) { - // Not suspended so we're done here. + if (!eos.monitor_exited()) { break; } - simple_exit(jt); - jt->set_thread_state_fence(_thread_blocked_trans); - SafepointMechanism::process_if_requested(jt); - // We should transition to thread_in_vm and then to thread_in_vm_trans, - // but those are always treated the same as _thread_blocked_trans. - jt->set_thread_state(_thread_blocked); } } @@ -411,37 +374,34 @@ int JvmtiRawMonitor::raw_wait(jlong millis, Thread* self) { intptr_t save = _recursions; _recursions = 0; - _waiters++; ret = simple_wait(self, millis); - _recursions = save; - _waiters--; - - guarantee(self == _owner, "invariant"); - if (self->is_Java_thread()) { + // Now we need to re-enter the monitor. For JavaThreads + // we need to manage suspend requests. + if (self->is_Java_thread()) { // JavaThread re-enter JavaThread* jt = self->as_Java_thread(); - guarantee(jt->thread_state() == _thread_in_native, "invariant"); + ThreadInVMfromNative tivmfn(jt); for (;;) { - if (!SafepointMechanism::should_process(jt)) { - // Not suspended so we're done here: - break; + ExitOnSuspend eos(this); + { + ThreadBlockInVMPreprocess tbivmp(jt, eos); + simple_enter(jt); } - simple_exit(jt); - jt->set_thread_state_fence(_thread_in_native_trans); - SafepointMechanism::process_if_requested(jt); - if (jt->is_interrupted(true)) { - ret = M_INTERRUPTED; + if (!eos.monitor_exited()) { + break; } - // We should transition to thread_in_vm and then to thread_in_vm_trans, - // but those are always treated the same as _thread_in_native_trans. - jt->set_thread_state(_thread_in_native); - simple_enter(jt); } - guarantee(jt == _owner, "invariant"); - } else { + if (jt->is_interrupted(true)) { + ret = M_INTERRUPTED; + } + } else { // Non-JavaThread re-enter assert(ret != M_INTERRUPTED, "Only JavaThreads can be interrupted"); + simple_enter(self); } + _recursions = save; + + guarantee(self == _owner, "invariant"); return ret; } diff --git a/src/hotspot/share/prims/jvmtiRawMonitor.hpp b/src/hotspot/share/prims/jvmtiRawMonitor.hpp index c7089a59198..496d267fd32 100644 --- a/src/hotspot/share/prims/jvmtiRawMonitor.hpp +++ b/src/hotspot/share/prims/jvmtiRawMonitor.hpp @@ -37,6 +37,21 @@ // A simplified version of the ObjectMonitor code. // +// Important note: +// Raw monitors can be used in callbacks which happen during safepoint by the VM +// thread (e.g., heapRootCallback). This means we may not transition/safepoint +// poll in many cases, else the agent JavaThread can deadlock with the VM thread, +// as this old comment says: +// "We can't safepoint block in here because we could deadlock the vmthread. Blech." +// The rules are: +// - We must never safepoint poll if raw monitor is owned. +// - We may safepoint poll before it is owned and after it has been released. +// If this were the only thing we needed to think about we could just stay in +// native for all operations. However we need to honor a suspend request, not +// entering a monitor if suspended, and check for interrupts. Honoring a suspend +// request and reading the interrupt flag must be done from VM state +// (a safepoint unsafe state). + class JvmtiRawMonitor : public CHeapObj { // Helper class to allow Threads to be linked into queues. @@ -59,7 +74,6 @@ class JvmtiRawMonitor : public CHeapObj { // The list is actually composed of nodes, // acting as proxies for Threads. QNode* volatile _wait_set; // Threads wait()ing on the monitor - volatile jint _waiters; // number of waiting threads int _magic; char* _name; // JVMTI_RM_MAGIC is set in contructor and unset in destructor. @@ -75,6 +89,16 @@ class JvmtiRawMonitor : public CHeapObj { int simple_wait(Thread* self, jlong millis); void simple_notify(Thread* self, bool all); + class ExitOnSuspend { + protected: + JvmtiRawMonitor* _rm; + bool _rm_exited; + public: + ExitOnSuspend(JvmtiRawMonitor* rm) : _rm(rm), _rm_exited(false) {} + void operator()(JavaThread* current); + bool monitor_exited() { return _rm_exited; } + }; + public: // return codes diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 2b896db5a4a..99479bb8b7a 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -1852,9 +1852,12 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( return JVMTI_ERROR_INTERNAL; } - // Save fields from the old_cp. - merge_cp->copy_fields(old_cp()); - scratch_cp->copy_fields(old_cp()); + // Set dynamic constants attribute from the original CP. + if (old_cp->has_dynamic_constant()) { + scratch_cp->set_has_dynamic_constant(); + } + // Copy attributes from scratch_cp to merge_cp + merge_cp->copy_fields(scratch_cp()); log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count); @@ -4396,6 +4399,16 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas swap_annotations(the_class, scratch_class); + // Replace minor version number of class file + u2 old_minor_version = the_class->constants()->minor_version(); + the_class->constants()->set_minor_version(scratch_class->constants()->minor_version()); + scratch_class->constants()->set_minor_version(old_minor_version); + + // Replace major version number of class file + u2 old_major_version = the_class->constants()->major_version(); + the_class->constants()->set_major_version(scratch_class->constants()->major_version()); + scratch_class->constants()->set_major_version(old_major_version); + // Replace CP indexes for class and name+type of enclosing method u2 old_class_idx = the_class->enclosing_method_class_index(); u2 old_method_idx = the_class->enclosing_method_method_index(); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index d1116467de1..24cb6d66c05 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -524,7 +524,7 @@ static SpecialFlag const special_jvm_flags[] = { { "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, { "SuspendRetryCount", JDK_Version::undefined(), JDK_Version::jdk(17), JDK_Version::jdk(18) }, { "SuspendRetryDelay", JDK_Version::undefined(), JDK_Version::jdk(17), JDK_Version::jdk(18) }, - { "CriticalJNINatives", JDK_Version::jdk(16), JDK_Version::jdk(17), JDK_Version::jdk(18) }, + { "CriticalJNINatives", JDK_Version::jdk(16), JDK_Version::jdk(18), JDK_Version::jdk(19) }, { "AlwaysLockClassLoader", JDK_Version::jdk(17), JDK_Version::jdk(18), JDK_Version::jdk(19) }, { "UseBiasedLocking", JDK_Version::jdk(15), JDK_Version::jdk(18), JDK_Version::jdk(19) }, { "BiasedLockingStartupDelay", JDK_Version::jdk(15), JDK_Version::jdk(18), JDK_Version::jdk(19) }, @@ -1330,7 +1330,6 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop log_info(cds)("optimized module handling: disabled due to incompatible property: %s=%s", key, value); } if (strcmp(key, "jdk.module.showModuleResolution") == 0 || - strcmp(key, "jdk.module.illegalAccess") == 0 || strcmp(key, "jdk.module.validation") == 0 || strcmp(key, "java.system.class.loader") == 0) { MetaspaceShared::disable_full_module_graph(); @@ -2061,8 +2060,7 @@ bool Arguments::parse_uintx(const char* value, } bool Arguments::create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal) { - assert(is_internal_module_property(prop_name) || - strcmp(prop_name, "jdk.module.illegalAccess") == 0, "unknown module property: '%s'", prop_name); + assert(is_internal_module_property(prop_name), "unknown module property: '%s'", prop_name); size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2; char* property = AllocateHeap(prop_len, mtArguments); int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value); @@ -2427,10 +2425,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m return res; } } else if (match_option(option, "--illegal-access=", &tail)) { - warning("Option --illegal-access is deprecated and will be removed in a future release."); - if (!create_module_property("jdk.module.illegalAccess", tail, ExternalProperty)) { - return JNI_ENOMEM; - } + char version[256]; + JDK_Version::jdk(17).to_string(version, sizeof(version)); + warning("Ignoring option %s; support was removed in %s", option->optionString, version); // -agentlib and -agentpath } else if (match_option(option, "-agentlib:", &tail) || (is_absolute_path = match_option(option, "-agentpath:", &tail))) { @@ -2748,6 +2745,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m } else if (strcmp(tail, ":disable") == 0) { LogConfiguration::disable_logging(); ret = true; + } else if (strcmp(tail, ":async") == 0) { + LogConfiguration::set_async_mode(true); + ret = true; } else if (*tail == '\0') { ret = LogConfiguration::parse_command_line_arguments(); assert(ret, "-Xlog without arguments should never fail to parse"); diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index b3e082850f9..5ffb1e755cc 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -239,7 +239,8 @@ const intx ObjectAlignmentInBytes = 8; "Use intrinsics for java.util.Base64") \ \ product(size_t, LargePageSizeInBytes, 0, \ - "Large page size (0 to let VM choose the page size)") \ + "Maximum large page size used (0 will use the default large " \ + "page size for the environment as the maximum)") \ range(0, max_uintx) \ \ product(size_t, LargePageHeapSizeThreshold, 128*M, \ @@ -711,7 +712,7 @@ const intx ObjectAlignmentInBytes = 8; "at one time (minimum is 1024).") \ range(1024, max_jint) \ \ - product(intx, MonitorUsedDeflationThreshold, 90, EXPERIMENTAL, \ + product(intx, MonitorUsedDeflationThreshold, 90, DIAGNOSTIC, \ "Percentage of used monitors before triggering deflation (0 is " \ "off). The check is performed on GuaranteedSafepointInterval " \ "or AsyncDeflationInterval.") \ @@ -2015,6 +2016,11 @@ const intx ObjectAlignmentInBytes = 8; "Use the FP register for holding the frame pointer " \ "and not as a general purpose register.") \ \ + product(size_t, AsyncLogBufferSize, 2*M, \ + "Memory budget (in bytes) for the buffer of Asynchronous " \ + "Logging (-Xlog:async).") \ + range(100*K, 50*M) \ + \ product(bool, CheckIntrinsics, true, DIAGNOSTIC, \ "When a class C is loaded, check that " \ "(1) all intrinsics defined by the VM for class C are present "\ diff --git a/src/hotspot/share/runtime/handshake.cpp b/src/hotspot/share/runtime/handshake.cpp index fdc05c7d13c..4f5ce113d2a 100644 --- a/src/hotspot/share/runtime/handshake.cpp +++ b/src/hotspot/share/runtime/handshake.cpp @@ -600,14 +600,6 @@ HandshakeState::ProcessResult HandshakeState::try_process(HandshakeOperation* ma return pr_ret; } -void HandshakeState::lock() { - _lock.lock_without_safepoint_check(); -} - -void HandshakeState::unlock() { - _lock.unlock(); -} - void HandshakeState::do_self_suspend() { assert(Thread::current() == _handshakee, "should call from _handshakee"); assert(_lock.owned_by_self(), "Lock must be held"); diff --git a/src/hotspot/share/runtime/handshake.hpp b/src/hotspot/share/runtime/handshake.hpp index 15ea79c8a60..b3fc62ce1bd 100644 --- a/src/hotspot/share/runtime/handshake.hpp +++ b/src/hotspot/share/runtime/handshake.hpp @@ -73,7 +73,6 @@ class JvmtiRawMonitor; // operation is only done by either VMThread/Handshaker on behalf of the // JavaThread or by the target JavaThread itself. class HandshakeState { - friend JvmtiRawMonitor; friend ThreadSelfSuspensionHandshake; friend SuspendThreadHandshake; friend JavaThread; @@ -103,9 +102,6 @@ class HandshakeState { HandshakeOperation* pop_for_self(); HandshakeOperation* pop(); - void lock(); - void unlock(); - public: HandshakeState(JavaThread* thread); diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp index b7f5015ee2a..06974b89e42 100644 --- a/src/hotspot/share/runtime/init.cpp +++ b/src/hotspot/share/runtime/init.cpp @@ -33,6 +33,7 @@ #endif #include "interpreter/bytecodes.hpp" #include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" #include "logging/logTag.hpp" #include "memory/universe.hpp" #include "prims/jvmtiExport.hpp" @@ -123,6 +124,7 @@ jint init_globals() { if (status != JNI_OK) return status; + AsyncLogWriter::initialize(); gc_barrier_stubs_init(); // depends on universe_init, must be before interpreter_init interpreter_init_stub(); // before methods get loaded accessFlags_init(); diff --git a/src/hotspot/share/runtime/interfaceSupport.inline.hpp b/src/hotspot/share/runtime/interfaceSupport.inline.hpp index 19ae9370672..f42617766d0 100644 --- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp +++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp @@ -202,7 +202,14 @@ class ThreadInVMfromNative : public ThreadStateTransition { trans_from_native(_thread_in_vm); } ~ThreadInVMfromNative() { - trans(_thread_in_vm, _thread_in_native); + assert(_thread->thread_state() == _thread_in_vm, "coming from wrong thread state"); + // We cannot assert !_thread->owns_locks() since we have valid cases where + // we call known native code using this wrapper holding locks. + _thread->check_possible_safepoint(); + // Once we are in native vm expects stack to be walkable + _thread->frame_anchor()->make_walkable(_thread); + OrderAccess::storestore(); // Keep thread_state change and make_walkable() separate. + _thread->set_thread_state(_thread_in_native); } }; @@ -226,49 +233,63 @@ class ThreadToNativeFromVM : public ThreadStateTransition { } }; - -// Parameter in_flight_mutex_addr is only used by class Mutex to avoid certain deadlock -// scenarios while making transitions that might block for a safepoint or handshake. -// It's the address of a pointer to the mutex we are trying to acquire. This will be used to -// access and release said mutex when transitioning back from blocked to vm (destructor) in -// case we need to stop for a safepoint or handshake. -class ThreadBlockInVM : public ThreadStateTransition { +// Perform a transition to _thread_blocked and take a call-back to be executed before +// SafepointMechanism::process_if_requested when returning to the VM. This allows us +// to perform an "undo" action if we might block processing a safepoint/handshake operation +// (such as thread suspension). +template +class ThreadBlockInVMPreprocess : public ThreadStateTransition { private: - Mutex** _in_flight_mutex_addr; - + PRE_PROC& _pr; public: - ThreadBlockInVM(JavaThread* thread, Mutex** in_flight_mutex_addr = NULL) - : ThreadStateTransition(thread), _in_flight_mutex_addr(in_flight_mutex_addr) { + ThreadBlockInVMPreprocess(JavaThread* thread, PRE_PROC& pr) : ThreadStateTransition(thread), _pr(pr) { assert(thread->thread_state() == _thread_in_vm, "coming from wrong thread state"); thread->check_possible_safepoint(); // Once we are blocked vm expects stack to be walkable thread->frame_anchor()->make_walkable(thread); + OrderAccess::storestore(); // Keep thread_state change and make_walkable() separate. thread->set_thread_state(_thread_blocked); } - ~ThreadBlockInVM() { + ~ThreadBlockInVMPreprocess() { assert(_thread->thread_state() == _thread_blocked, "coming from wrong thread state"); // Change to transition state and ensure it is seen by the VM thread. _thread->set_thread_state_fence(_thread_blocked_trans); if (SafepointMechanism::should_process(_thread)) { - if (_in_flight_mutex_addr != NULL) { - release_mutex(); - } + _pr(_thread); SafepointMechanism::process_if_requested(_thread); } _thread->set_thread_state(_thread_in_vm); } +}; - void release_mutex() { - Mutex* in_flight_mutex = *_in_flight_mutex_addr; - if (in_flight_mutex != NULL) { - in_flight_mutex->release_for_safepoint(); +class InFlightMutexRelease { + private: + Mutex** _in_flight_mutex_addr; + public: + InFlightMutexRelease(Mutex** in_flight_mutex_addr) : _in_flight_mutex_addr(in_flight_mutex_addr) {} + void operator()(JavaThread* current) { + if (_in_flight_mutex_addr != NULL && *_in_flight_mutex_addr != NULL) { + (*_in_flight_mutex_addr)->release_for_safepoint(); *_in_flight_mutex_addr = NULL; } } }; +// Parameter in_flight_mutex_addr is only used by class Mutex to avoid certain deadlock +// scenarios while making transitions that might block for a safepoint or handshake. +// It's the address of a pointer to the mutex we are trying to acquire. This will be used to +// access and release said mutex when transitioning back from blocked to vm (destructor) in +// case we need to stop for a safepoint or handshake. +class ThreadBlockInVM { + InFlightMutexRelease _ifmr; + ThreadBlockInVMPreprocess _tbivmpp; + public: + ThreadBlockInVM(JavaThread* thread, Mutex** in_flight_mutex_addr = NULL) + : _ifmr(in_flight_mutex_addr), _tbivmpp(thread, _ifmr) {} +}; + // Debug class instantiated in JRT_ENTRY macro. // Can be used to verify properties on enter/exit of the VM. diff --git a/src/hotspot/share/runtime/mutex.cpp b/src/hotspot/share/runtime/mutex.cpp index ddfd8a8b98a..5af0dfe51ba 100644 --- a/src/hotspot/share/runtime/mutex.cpp +++ b/src/hotspot/share/runtime/mutex.cpp @@ -261,11 +261,6 @@ Mutex::~Mutex() { os::free(const_cast(_name)); } -// Only Threads_lock and Heap_lock may be safepoint_check_sometimes. -bool is_sometimes_ok(const char* name) { - return (strcmp(name, "Threads_lock") == 0 || strcmp(name, "Heap_lock") == 0); -} - Mutex::Mutex(int Rank, const char * name, bool allow_vm_block, SafepointCheckRequired safepoint_check_required) : _owner(NULL) { assert(os::mutex_init_done(), "Too early!"); @@ -277,9 +272,6 @@ Mutex::Mutex(int Rank, const char * name, bool allow_vm_block, _safepoint_check_required = safepoint_check_required; _skip_rank_check = false; - assert(_safepoint_check_required != _safepoint_check_sometimes || is_sometimes_ok(name), - "Lock has _safepoint_check_sometimes %s", name); - assert(_rank > special || _safepoint_check_required == _safepoint_check_never, "Special locks or below should never safepoint"); #endif @@ -306,7 +298,6 @@ void Mutex::print_on_error(outputStream* st) const { const char* print_safepoint_check(Mutex::SafepointCheckRequired safepoint_check) { switch (safepoint_check) { case Mutex::_safepoint_check_never: return "safepoint_check_never"; - case Mutex::_safepoint_check_sometimes: return "safepoint_check_sometimes"; case Mutex::_safepoint_check_always: return "safepoint_check_always"; default: return ""; } diff --git a/src/hotspot/share/runtime/mutex.hpp b/src/hotspot/share/runtime/mutex.hpp index de29d09de8f..13bfda92f3e 100644 --- a/src/hotspot/share/runtime/mutex.hpp +++ b/src/hotspot/share/runtime/mutex.hpp @@ -132,11 +132,6 @@ class Mutex : public CHeapObj { // _safepoint_check_never, that means that whenever the lock is acquired by a JavaThread // it will verify that it is done without a safepoint check. - - // There are a couple of existing locks that will sometimes have a safepoint check and - // sometimes not when acquired by a JavaThread, but these locks are set up carefully - // to avoid deadlocks. TODO: Fix these locks and remove _safepoint_check_sometimes. - // TODO: Locks that are shared between JavaThreads and NonJavaThreads // should never encounter a safepoint check while they are held, or else a // deadlock can occur. We should check this by noting which @@ -155,17 +150,12 @@ class Mutex : public CHeapObj { enum class SafepointCheckRequired { _safepoint_check_never, // Mutexes with this value will cause errors // when acquired by a JavaThread with a safepoint check. - _safepoint_check_sometimes, // A couple of special locks are acquired by JavaThreads sometimes - // with and sometimes without safepoint checks. These - // locks will not produce errors when locked. _safepoint_check_always // Mutexes with this value will cause errors // when acquired by a JavaThread without a safepoint check. }; // Bring the enumerator names into class scope. static const SafepointCheckRequired _safepoint_check_never = SafepointCheckRequired::_safepoint_check_never; - static const SafepointCheckRequired _safepoint_check_sometimes = - SafepointCheckRequired::_safepoint_check_sometimes; static const SafepointCheckRequired _safepoint_check_always = SafepointCheckRequired::_safepoint_check_always; diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp index f279074ce87..6d191b2e769 100644 --- a/src/hotspot/share/runtime/mutexLocker.cpp +++ b/src/hotspot/share/runtime/mutexLocker.cpp @@ -285,7 +285,7 @@ void mutex_init() { def(JNICritical_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always); // used for JNI critical regions def(AdapterHandlerLibrary_lock , PaddedMutex , nonleaf, true, _safepoint_check_always); - def(Heap_lock , PaddedMonitor, nonleaf+1, false, _safepoint_check_sometimes); // Doesn't safepoint check during termination. + def(Heap_lock , PaddedMonitor, nonleaf+1, false, _safepoint_check_always); // Doesn't safepoint check during termination. def(JfieldIdCreation_lock , PaddedMutex , nonleaf+1, true, _safepoint_check_always); // jfieldID, Used in VM_Operation def(CompiledIC_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_never); // locks VtableStubs_lock, InlineCacheBuffer_lock diff --git a/src/hotspot/share/runtime/nonJavaThread.hpp b/src/hotspot/share/runtime/nonJavaThread.hpp index c35234015a7..5ff74c72bd2 100644 --- a/src/hotspot/share/runtime/nonJavaThread.hpp +++ b/src/hotspot/share/runtime/nonJavaThread.hpp @@ -106,11 +106,6 @@ class WorkerThread: public NamedThread { WorkerThread() : _id(0) { } virtual bool is_Worker_thread() const { return true; } - virtual WorkerThread* as_Worker_thread() const { - assert(is_Worker_thread(), "Dubious cast to WorkerThread*?"); - return (WorkerThread*) this; - } - void set_id(uint work_id) { _id = work_id; } uint id() const { return _id; } }; diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index aa30a27b8af..d662ffe0770 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -307,6 +307,27 @@ oop ObjectMonitor::object_peek() const { return _object.peek(); } +void ObjectMonitor::ExitOnSuspend::operator()(JavaThread* current) { + if (current->is_suspended()) { + _om->_recursions = 0; + _om->_succ = NULL; + // Don't need a full fence after clearing successor here because of the call to exit(). + _om->exit(current, false /* not_suspended */); + _om_exited = true; + + current->set_current_pending_monitor(_om); + } +} + +void ObjectMonitor::ClearSuccOnSuspend::operator()(JavaThread* current) { + if (current->is_suspended()) { + if (_om->_succ == current) { + _om->_succ = NULL; + OrderAccess::fence(); // always do a full fence when successor is cleared + } + } +} + // ----------------------------------------------------------------------------- // Enter support @@ -406,46 +427,29 @@ bool ObjectMonitor::enter(JavaThread* current) { assert(current->thread_state() == _thread_in_vm, "invariant"); - current->frame_anchor()->make_walkable(current); - // Thread must be walkable before it is blocked. - // Read in reverse order. - OrderAccess::storestore(); for (;;) { - current->set_thread_state(_thread_blocked); - EnterI(current); - current->set_thread_state_fence(_thread_blocked_trans); - if (SafepointMechanism::should_process(current) && - current->is_suspended()) { - // We have acquired the contended monitor, but while we were - // waiting another thread suspended us. We don't want to enter - // the monitor while suspended because that would surprise the - // thread that suspended us. - _recursions = 0; - _succ = NULL; - // Don't need a full fence after clearing successor here because of the call to exit(). - exit(current, false /* not_suspended */); - SafepointMechanism::process_if_requested(current); - // Since we are going to _thread_blocked we skip setting _thread_in_vm here. - } else { - // Only exit path from for loop + ExitOnSuspend eos(this); + { + ThreadBlockInVMPreprocess tbivs(current, eos); + EnterI(current); + current->set_current_pending_monitor(NULL); + // We can go to a safepoint at the end of this block. If we + // do a thread dump during that safepoint, then this thread will show + // as having "-locked" the monitor, but the OS and java.lang.Thread + // states will still report that the thread is blocked trying to + // acquire it. + // If there is a suspend request, ExitOnSuspend will exit the OM + // and set the OM as pending. + } + if (!eos.exited()) { + // ExitOnSuspend did not exit the OM + assert(owner_raw() == current, "invariant"); break; } } - current->set_current_pending_monitor(NULL); - - // We cleared the pending monitor info since we've just gotten past - // the enter-check-for-suspend dance and we now own the monitor free - // and clear, i.e., it is no longer pending. - // We can go to a safepoint at the end of this block. If we - // do a thread dump during that safepoint, then this thread will show - // as having "-locked" the monitor, but the OS and java.lang.Thread - // states will still report that the thread is blocked trying to - // acquire it. - - // Completed the tranisition. - SafepointMechanism::process_if_requested(current); - current->set_thread_state(_thread_in_vm); + // We've just gotten past the enter-check-for-suspend dance and we now own + // the monitor free and clear. } add_to_contentions(-1); @@ -519,7 +523,7 @@ int ObjectMonitor::TryLock(JavaThread* current) { // Contending threads that see that condition know to retry their operation. // bool ObjectMonitor::deflate_monitor() { - if (is_busy() != 0) { + if (is_busy()) { // Easy checks are first - the ObjectMonitor is busy so no deflation. return false; } @@ -969,21 +973,11 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) { assert(current->thread_state() == _thread_in_vm, "invariant"); - current->frame_anchor()->make_walkable(current); - // Thread must be walkable before it is blocked. - // Read in reverse order. - OrderAccess::storestore(); - current->set_thread_state(_thread_blocked); - current->_ParkEvent->park(); - current->set_thread_state_fence(_thread_blocked_trans); - if (SafepointMechanism::should_process(current)) { - if (_succ == current) { - _succ = NULL; - OrderAccess::fence(); // always do a full fence when successor is cleared - } - SafepointMechanism::process_if_requested(current); + { + ClearSuccOnSuspend csos(this); + ThreadBlockInVMPreprocess tbivs(current, csos); + current->_ParkEvent->park(); } - current->set_thread_state(_thread_in_vm); } // Try again, but just so we distinguish between futile wakeups and @@ -1541,11 +1535,8 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { assert(current->thread_state() == _thread_in_vm, "invariant"); { - current->frame_anchor()->make_walkable(current); - // Thread must be walkable before it is blocked. - // Read in reverse order. - OrderAccess::storestore(); - current->set_thread_state(_thread_blocked); + ClearSuccOnSuspend csos(this); + ThreadBlockInVMPreprocess tbivs(current, csos); if (interrupted || HAS_PENDING_EXCEPTION) { // Intentionally empty } else if (node._notified == 0) { @@ -1555,15 +1546,6 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { ret = current->_ParkEvent->park(millis); } } - current->set_thread_state_fence(_thread_blocked_trans); - if (SafepointMechanism::should_process(current)) { - if (_succ == current) { - _succ = NULL; - OrderAccess::fence(); // always do a full fence when successor is cleared - } - SafepointMechanism::process_if_requested(current); - } - current->set_thread_state(_thread_in_vm); } // Node may be on the WaitSet, the EntryList (or cxq), or in transition diff --git a/src/hotspot/share/runtime/objectMonitor.hpp b/src/hotspot/share/runtime/objectMonitor.hpp index 86724c864fa..8240226bdd6 100644 --- a/src/hotspot/share/runtime/objectMonitor.hpp +++ b/src/hotspot/share/runtime/objectMonitor.hpp @@ -236,7 +236,7 @@ class ObjectMonitor : public CHeapObj { volatile markWord* header_addr(); void set_header(markWord hdr); - intptr_t is_busy() const { + bool is_busy() const { // TODO-FIXME: assert _owner == null implies _recursions = 0 intptr_t ret_code = _waiters | intptr_t(_cxq) | intptr_t(_EntryList); if (contentions() > 0) { @@ -245,7 +245,7 @@ class ObjectMonitor : public CHeapObj { if (!owner_is_DEFLATER_MARKER()) { ret_code |= intptr_t(owner_raw()); } - return ret_code; + return ret_code != 0; } const char* is_busy_to_string(stringStream* ss); @@ -302,6 +302,24 @@ class ObjectMonitor : public CHeapObj { // returns false and throws IllegalMonitorStateException (IMSE). bool check_owner(TRAPS); + private: + class ExitOnSuspend { + protected: + ObjectMonitor* _om; + bool _om_exited; + public: + ExitOnSuspend(ObjectMonitor* om) : _om(om), _om_exited(false) {} + void operator()(JavaThread* current); + bool exited() { return _om_exited; } + }; + class ClearSuccOnSuspend { + protected: + ObjectMonitor* _om; + public: + ClearSuccOnSuspend(ObjectMonitor* om) : _om(om) {} + void operator()(JavaThread* current); + }; + public: bool enter(JavaThread* current); void exit(JavaThread* current, bool not_suspended = true); void wait(jlong millis, bool interruptible, TRAPS); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 290c4c8abb6..7eaaa9db984 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -450,6 +450,7 @@ class os: AllStatic { java_thread, // Java, CodeCacheSweeper, JVMTIAgent and Service threads. compiler_thread, watcher_thread, + asynclog_thread, // dedicated to flushing logs os_thread }; diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index c016b86e4ba..130ad243508 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -986,7 +986,6 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* current, InstanceKlass::register_finalizer(instanceOop(obj), CHECK); JRT_END - jlong SharedRuntime::get_java_tid(Thread* thread) { if (thread != NULL) { if (thread->is_Java_thread()) { diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index 4f70b0d764e..a53d8a31f50 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -1771,9 +1771,9 @@ void ObjectSynchronizer::log_in_use_monitor_details(outputStream* out) { const markWord mark = mid->header(); ResourceMark rm; out->print(INTPTR_FORMAT " %d%d%d " INTPTR_FORMAT " %s", p2i(mid), - mid->is_busy() != 0, mark.hash() != 0, mid->owner() != NULL, + mid->is_busy(), mark.hash() != 0, mid->owner() != NULL, p2i(obj), obj == NULL ? "" : obj->klass()->external_name()); - if (mid->is_busy() != 0) { + if (mid->is_busy()) { out->print(" (%s)", mid->is_busy_to_string(&ss)); ss.reset(); } diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 07bdf5c6352..3ff07b2676e 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -53,6 +53,7 @@ #include "jfr/jfrEvents.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" #include "logging/logConfiguration.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" @@ -3416,8 +3417,12 @@ void Threads::destroy_vm() { // to prevent this. The GC vm_operations will not be able to // queue until after the vm thread is dead. After this point, // we'll never emerge out of the safepoint before the VM exits. + // Assert that the thread is terminated so that acquiring the + // Heap_lock doesn't cause the terminated thread to participate in + // the safepoint protocol. - MutexLocker ml(Heap_lock, Mutex::_no_safepoint_check_flag); + assert(thread->is_terminated(), "must be terminated here"); + MutexLocker ml(Heap_lock); VMThread::wait_for_vm_thread_exit(); assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint"); @@ -3764,6 +3769,7 @@ void Threads::print_on(outputStream* st, bool print_stacks, StringDedup::threads_do(&cl); } cl.do_thread(WatcherThread::watcher_thread()); + cl.do_thread(AsyncLogWriter::instance()); st->flush(); } @@ -3817,6 +3823,7 @@ void Threads::print_on_error(outputStream* st, Thread* current, char* buf, st->print_cr("Other Threads:"); print_on_error(VMThread::vm_thread(), st, current, buf, buflen, &found_current); print_on_error(WatcherThread::watcher_thread(), st, current, buf, buflen, &found_current); + print_on_error(AsyncLogWriter::instance(), st, current, buf, buflen, &found_current); if (Universe::heap() != NULL) { PrintOnErrorClosure print_closure(st, current, buf, buflen, &found_current); diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index f6781eddf99..76076709df6 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -103,6 +103,7 @@ class JavaThread; // - GangWorker // - WatcherThread // - JfrThreadSampler +// - LogAsyncWriter // // All Thread subclasses must be either JavaThread or NonJavaThread. // This means !t->is_Java_thread() iff t is a NonJavaThread, or t is @@ -355,7 +356,7 @@ class Thread: public ThreadShadow { virtual bool is_active_Java_thread() const { return false; } // Casts - virtual WorkerThread* as_Worker_thread() const { return NULL; } + inline const WorkerThread* as_Worker_thread() const; inline JavaThread* as_Java_thread(); inline const JavaThread* as_Java_thread() const; diff --git a/src/hotspot/share/runtime/thread.inline.hpp b/src/hotspot/share/runtime/thread.inline.hpp index 8559fe914db..95a703fd230 100644 --- a/src/hotspot/share/runtime/thread.inline.hpp +++ b/src/hotspot/share/runtime/thread.inline.hpp @@ -31,6 +31,7 @@ #include "runtime/orderAccess.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.hpp" +#include "runtime/nonJavaThread.hpp" #if defined(__APPLE__) && defined(AARCH64) #include "runtime/os.hpp" @@ -64,6 +65,11 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* new_list) { Atomic::release_store_fence(&_threads_hazard_ptr, new_list); } +inline const WorkerThread* Thread::as_Worker_thread() const { + assert(is_Worker_thread(), "incorrect cast to const WorkerThread"); + return static_cast(this); +} + #if defined(__APPLE__) && defined(AARCH64) inline void Thread::init_wx() { assert(this == Thread::current(), "should only be called for current thread"); diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index 747efb436dc..b0e1ba37029 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -192,10 +192,8 @@ class ThreadScanHashtable : public CHeapObj { return (unsigned int)(((uint32_t)(uintptr_t)s1) * 2654435761u); } - int _table_size; - // ResourceHashtable SIZE is specified at compile time so our - // dynamic _table_size is unused for now; 1031 is the first prime - // after 1024. + // ResourceHashtable SIZE is specified at compile time so we + // use 1031 which is the first prime after 1024. typedef ResourceHashtable PtrTable; @@ -205,7 +203,7 @@ class ThreadScanHashtable : public CHeapObj { // ResourceHashtable is passed to various functions and populated in // different places so we allocate it using C_HEAP to make it immune // from any ResourceMarks that happen to be in the code paths. - ThreadScanHashtable(int table_size) : _table_size(table_size), _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable()) {} + ThreadScanHashtable() : _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable()) {} ~ThreadScanHashtable() { delete _ptrs; } @@ -870,12 +868,8 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { } } - // Hash table size should be first power of two higher than twice the length of the ThreadsList - int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1; - hash_table_size = round_up_power_of_2(hash_table_size); - // Gather a hash table of the current hazard ptrs: - ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size); + ThreadScanHashtable *scan_table = new ThreadScanHashtable(); ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table); threads_do(&scan_cl); OrderAccess::acquire(); // Must order reads of hazard ptr before reads of @@ -929,14 +923,9 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { bool ThreadsSMRSupport::is_a_protected_JavaThread(JavaThread *thread) { assert_locked_or_safepoint(Threads_lock); - // Hash table size should be first power of two higher than twice - // the length of the Threads list. - int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1; - hash_table_size = round_up_power_of_2(hash_table_size); - // Gather a hash table of the JavaThreads indirectly referenced by // hazard ptrs. - ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size); + ThreadScanHashtable *scan_table = new ThreadScanHashtable(); ScanHazardPtrGatherProtectedThreadsClosure scan_cl(scan_table); threads_do(&scan_cl); OrderAccess::acquire(); // Must order reads of hazard ptr before reads of diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 45d005e7f98..af69cf1aa09 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -51,6 +51,7 @@ #include "gc/shared/vmStructs_gc.hpp" #include "interpreter/bytecodes.hpp" #include "interpreter/interpreter.hpp" +#include "logging/logAsyncWriter.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/heap.hpp" @@ -408,7 +409,7 @@ typedef HashtableEntry KlassHashtableEntry; static_field(ThreadLocalAllocBuffer, _reserve_for_allocation_prefetch, int) \ static_field(ThreadLocalAllocBuffer, _target_refills, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \ - nonstatic_field(ThreadLocalAllocBuffer, _slow_refill_waste, unsigned) \ + nonstatic_field(ThreadLocalAllocBuffer, _refill_waste, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _gc_waste, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _slow_allocations, unsigned) \ nonstatic_field(VirtualSpace, _low_boundary, char*) \ @@ -1336,6 +1337,7 @@ typedef HashtableEntry KlassHashtableEntry; declare_type(NonJavaThread, Thread) \ declare_type(NamedThread, NonJavaThread) \ declare_type(WatcherThread, NonJavaThread) \ + declare_type(AsyncLogWriter, NonJavaThread) \ declare_type(JavaThread, Thread) \ declare_type(JvmtiAgentThread, JavaThread) \ declare_type(MonitorDeflationThread, JavaThread) \ diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 1ce11b8c9a2..082a3272c6f 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -151,6 +151,11 @@ class oopDesc; #define INTX_FORMAT_W(width) "%" #width PRIdPTR #define UINTX_FORMAT_W(width) "%" #width PRIuPTR +// Convert pointer to intptr_t, for use in printing pointers. +inline intptr_t p2i(const volatile void* p) { + return (intptr_t) p; +} + //---------------------------------------------------------------------------------------------------- // Constants @@ -416,7 +421,7 @@ inline address_word castable_address(void* x) { return address_w inline size_t pointer_delta(const volatile void* left, const volatile void* right, size_t element_size) { - assert(left >= right, "avoid underflow"); + assert(left >= right, "avoid underflow - left: " PTR_FORMAT " right: " PTR_FORMAT, p2i(left), p2i(right)); return (((uintptr_t) left) - ((uintptr_t) right)) / element_size; } @@ -1089,11 +1094,6 @@ inline int build_int_from_shorts( jushort low, jushort high ) { return ((int)((unsigned int)high << 16) | (unsigned int)low); } -// Convert pointer to intptr_t, for use in printing pointers. -inline intptr_t p2i(const void * p) { - return (intptr_t) p; -} - // swap a & b template static void swap(T& a, T& b) { T tmp = a; diff --git a/src/hotspot/share/utilities/hashtable.cpp b/src/hotspot/share/utilities/hashtable.cpp index c3c62e4c20b..5b99bba8bec 100644 --- a/src/hotspot/share/utilities/hashtable.cpp +++ b/src/hotspot/share/utilities/hashtable.cpp @@ -279,6 +279,7 @@ template class BasicHashtable; template class BasicHashtable; template class BasicHashtable; template class BasicHashtable; +template class BasicHashtable; template void BasicHashtable::verify_table(char const*); template void BasicHashtable::verify_table(char const*); diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java index 1a683e823fc..cf90882d124 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -1673,8 +1673,8 @@ private static Method getPrivateMethod(Class cl, String name, * otherwise. */ private static boolean packageEquals(Class cl1, Class cl2) { - return (cl1.getClassLoader() == cl2.getClassLoader() && - cl1.getPackageName().equals(cl2.getPackageName())); + return cl1.getClassLoader() == cl2.getClassLoader() && + cl1.getPackageName() == cl2.getPackageName(); } /** diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 687de4153db..e30db2c4d86 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -3043,7 +3043,7 @@ private void checkPackageAccess(SecurityManager sm, final ClassLoader ccl, if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String pkg = this.getPackageName(); - if (pkg != null && !pkg.isEmpty()) { + if (!pkg.isEmpty()) { // skip the package access check on a proxy class in default proxy package if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { sm.checkPackageAccess(pkg); @@ -3077,7 +3077,7 @@ private static void checkPackageAccessForPermittedSubclasses(SecurityManager sm, if (Proxy.isProxyClass(c)) throw new InternalError("a permitted subclass should not be a proxy class: " + c); String pkg = c.getPackageName(); - if (pkg != null && !pkg.isEmpty()) { + if (!pkg.isEmpty()) { packages.add(pkg); } } @@ -3094,7 +3094,7 @@ private static void checkPackageAccessForPermittedSubclasses(SecurityManager sm, private String resolveName(String name) { if (!name.startsWith("/")) { String baseName = getPackageName(); - if (baseName != null && !baseName.isEmpty()) { + if (!baseName.isEmpty()) { int len = baseName.length() + 1 + name.length(); StringBuilder sb = new StringBuilder(len); name = sb.append(baseName.replace('.', '/')) diff --git a/src/java.base/share/classes/java/lang/Module.java b/src/java.base/share/classes/java/lang/Module.java index c4ce97dd26d..a0c034888f6 100644 --- a/src/java.base/share/classes/java/lang/Module.java +++ b/src/java.base/share/classes/java/lang/Module.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -56,8 +56,6 @@ import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; import jdk.internal.misc.CDS; -import jdk.internal.misc.VM; -import jdk.internal.module.IllegalAccessLogger; import jdk.internal.module.ModuleLoaderMap; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.Resources; @@ -903,27 +901,8 @@ private void implAddExportsOrOpens(String pn, return; // check if the package is already exported/open to other - if (implIsExportedOrOpen(pn, other, open)) { - - // if the package is exported/open for illegal access then we need - // to record that it has also been exported/opened reflectively so - // that the IllegalAccessLogger doesn't emit a warning. - boolean needToAdd = false; - if (!other.isNamed()) { - IllegalAccessLogger l = IllegalAccessLogger.illegalAccessLogger(); - if (l != null) { - if (open) { - needToAdd = l.isOpenForIllegalAccess(this, pn); - } else { - needToAdd = l.isExportedForIllegalAccess(this, pn); - } - } - } - if (!needToAdd) { - // nothing to do - return; - } - } + if (implIsExportedOrOpen(pn, other, open)) + return; // can only export a package in the module if (!descriptor.packages().contains(pn)) { diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index b310b2defed..1d49b7b9b02 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -3239,8 +3239,12 @@ public static String join(CharSequence delimiter, CharSequence... elements) { */ @ForceInline static String join(String prefix, String suffix, String delimiter, String[] elements, int size) { - int icoder = prefix.coder() | suffix.coder() | delimiter.coder(); - long len = (long) prefix.length() + suffix.length() + (long) Math.max(0, size - 1) * delimiter.length(); + int icoder = prefix.coder() | suffix.coder(); + long len = (long) prefix.length() + suffix.length(); + if (size > 1) { // when there are more than one element, size - 1 delimiters will be emitted + len += (long) (size - 1) * delimiter.length(); + icoder |= delimiter.coder(); + } // assert len > 0L; // max: (long) Integer.MAX_VALUE << 32 // following loop wil add max: (long) Integer.MAX_VALUE * Integer.MAX_VALUE to len // so len can overflow at most once diff --git a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java index b57f73c0fb9..90887c8136e 100644 --- a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java +++ b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java @@ -156,7 +156,7 @@ public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, * to the bootstrap, that would appear in the * {@code BootstrapMethods} attribute * @return the nominal descriptor - * @throws NullPointerException if any parameter is null + * @throws NullPointerException if the argument or its contents are {@code null} */ public DynamicCallSiteDesc withArgs(ConstantDesc... bootstrapArgs) { return new DynamicCallSiteDesc(bootstrapMethod, invocationName, invocationType, bootstrapArgs); diff --git a/src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java b/src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java index 2ef81c14519..23b7284b311 100644 --- a/src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java @@ -45,7 +45,7 @@ /* package */ class IndirectVarHandle extends VarHandle { @Stable - private final MethodHandle[] handleMap = new MethodHandle[AccessMode.values().length]; + private final MethodHandle[] handleMap = new MethodHandle[AccessMode.COUNT]; private final VarHandle directTarget; // cache, for performance reasons private final VarHandle target; private final BiFunction handleFactory; diff --git a/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 42d8ad0b663..0e1cac19720 100644 --- a/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -864,6 +864,12 @@ void addMethod() { onStack = emitTryFinally(i); i += 2; // jump to the end of the TF idiom continue; + case TABLE_SWITCH: + assert lambdaForm.isTableSwitch(i); + int numCases = (Integer) name.function.intrinsicData(); + onStack = emitTableSwitch(i, numCases); + i += 2; // jump to the end of the TS idiom + continue; case LOOP: assert lambdaForm.isLoop(i); onStack = emitLoop(i); @@ -1389,6 +1395,58 @@ private static int popInsnOpcode(BasicType type) { } } + private Name emitTableSwitch(int pos, int numCases) { + Name args = lambdaForm.names[pos]; + Name invoker = lambdaForm.names[pos + 1]; + Name result = lambdaForm.names[pos + 2]; + + Class returnType = result.function.resolvedHandle().type().returnType(); + MethodType caseType = args.function.resolvedHandle().type() + .dropParameterTypes(0, 1) // drop collector + .changeReturnType(returnType); + String caseDescriptor = caseType.basicType().toMethodDescriptorString(); + + emitPushArgument(invoker, 2); // push cases + mv.visitFieldInsn(Opcodes.GETFIELD, "java/lang/invoke/MethodHandleImpl$CasesHolder", "cases", + "[Ljava/lang/invoke/MethodHandle;"); + int casesLocal = extendLocalsMap(new Class[] { MethodHandle[].class }); + emitStoreInsn(L_TYPE, casesLocal); + + Label endLabel = new Label(); + Label defaultLabel = new Label(); + Label[] caseLabels = new Label[numCases]; + for (int i = 0; i < caseLabels.length; i++) { + caseLabels[i] = new Label(); + } + + emitPushArgument(invoker, 0); // push switch input + mv.visitTableSwitchInsn(0, numCases - 1, defaultLabel, caseLabels); + + mv.visitLabel(defaultLabel); + emitPushArgument(invoker, 1); // push default handle + emitPushArguments(args, 1); // again, skip collector + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", caseDescriptor, false); + mv.visitJumpInsn(Opcodes.GOTO, endLabel); + + for (int i = 0; i < numCases; i++) { + mv.visitLabel(caseLabels[i]); + // Load the particular case: + emitLoadInsn(L_TYPE, casesLocal); + emitIconstInsn(i); + mv.visitInsn(Opcodes.AALOAD); + + // invoke it: + emitPushArguments(args, 1); // again, skip collector + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", caseDescriptor, false); + + mv.visitJumpInsn(Opcodes.GOTO, endLabel); + } + + mv.visitLabel(endLabel); + + return result; + } + /** * Emit bytecode for the loop idiom. *

diff --git a/src/java.base/share/classes/java/lang/invoke/Invokers.java b/src/java.base/share/classes/java/lang/invoke/Invokers.java index 7bc58e277eb..4b32f822685 100644 --- a/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -55,8 +55,8 @@ class Invokers { INV_GENERIC = 1, // MethodHandles.invoker (generic invocation) INV_BASIC = 2, // MethodHandles.basicInvoker VH_INV_EXACT = 3, // MethodHandles.varHandleExactInvoker - VH_INV_GENERIC = VH_INV_EXACT + VarHandle.AccessMode.values().length, // MethodHandles.varHandleInvoker - INV_LIMIT = VH_INV_GENERIC + VarHandle.AccessMode.values().length; + VH_INV_GENERIC = VH_INV_EXACT + VarHandle.AccessMode.COUNT, // MethodHandles.varHandleInvoker + INV_LIMIT = VH_INV_GENERIC + VarHandle.AccessMode.COUNT; /** Compute and cache information common to all collecting adapters * that implement members of the erasure-family of the given erased type. diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/src/java.base/share/classes/java/lang/invoke/LambdaForm.java index 639edec90dd..d0480cd7e0f 100644 --- a/src/java.base/share/classes/java/lang/invoke/LambdaForm.java +++ b/src/java.base/share/classes/java/lang/invoke/LambdaForm.java @@ -314,6 +314,7 @@ enum Kind { GET_DOUBLE_VOLATILE("getDoubleVolatile"), PUT_DOUBLE_VOLATILE("putDoubleVolatile"), TRY_FINALLY("tryFinally"), + TABLE_SWITCH("tableSwitch"), COLLECT("collect"), COLLECTOR("collector"), CONVERT("convert"), @@ -707,6 +708,32 @@ boolean isTryFinally(int pos) { return isMatchingIdiom(pos, "tryFinally", 2); } + /** + * Check if i-th name is a start of the tableSwitch idiom. + */ + boolean isTableSwitch(int pos) { + // tableSwitch idiom: + // t_{n}:L=MethodHandle.invokeBasic(...) // args + // t_{n+1}:L=MethodHandleImpl.tableSwitch(*, *, *, t_{n}) + // t_{n+2}:?=MethodHandle.invokeBasic(*, t_{n+1}) + if (pos + 2 >= names.length) return false; + + final int POS_COLLECT_ARGS = pos; + final int POS_TABLE_SWITCH = pos + 1; + final int POS_UNBOX_RESULT = pos + 2; + + Name collectArgs = names[POS_COLLECT_ARGS]; + Name tableSwitch = names[POS_TABLE_SWITCH]; + Name unboxResult = names[POS_UNBOX_RESULT]; + return tableSwitch.refersTo(MethodHandleImpl.class, "tableSwitch") && + collectArgs.isInvokeBasic() && + unboxResult.isInvokeBasic() && + tableSwitch.lastUseIndex(collectArgs) == 3 && // t_{n+1}:L=MethodHandleImpl.(*, *, *, t_{n}); + lastUseIndex(collectArgs) == POS_TABLE_SWITCH && // t_{n} is local: used only in t_{n+1} + unboxResult.lastUseIndex(tableSwitch) == 1 && // t_{n+2}:?=MethodHandle.invokeBasic(*, t_{n+1}) + lastUseIndex(tableSwitch) == POS_UNBOX_RESULT; // t_{n+1} is local: used only in t_{n+2} + } + /** * Check if i-th name is a start of the loop idiom. */ @@ -1067,24 +1094,13 @@ static class NamedFunction { final MemberName member; private @Stable MethodHandle resolvedHandle; @Stable MethodHandle invoker; - private final MethodHandleImpl.Intrinsic intrinsicName; NamedFunction(MethodHandle resolvedHandle) { - this(resolvedHandle.internalMemberName(), resolvedHandle, MethodHandleImpl.Intrinsic.NONE); - } - NamedFunction(MethodHandle resolvedHandle, MethodHandleImpl.Intrinsic intrinsic) { - this(resolvedHandle.internalMemberName(), resolvedHandle, intrinsic); + this(resolvedHandle.internalMemberName(), resolvedHandle); } NamedFunction(MemberName member, MethodHandle resolvedHandle) { - this(member, resolvedHandle, MethodHandleImpl.Intrinsic.NONE); - } - NamedFunction(MemberName member, MethodHandle resolvedHandle, MethodHandleImpl.Intrinsic intrinsic) { this.member = member; this.resolvedHandle = resolvedHandle; - this.intrinsicName = intrinsic; - assert(resolvedHandle == null || - resolvedHandle.intrinsicName() == MethodHandleImpl.Intrinsic.NONE || - resolvedHandle.intrinsicName() == intrinsic) : resolvedHandle.intrinsicName() + " != " + intrinsic; // The following assert is almost always correct, but will fail for corner cases, such as PrivateInvokeTest. //assert(!isInvokeBasic(member)); } @@ -1097,7 +1113,6 @@ static class NamedFunction { // necessary to pass BigArityTest this.member = Invokers.invokeBasicMethod(basicInvokerType); } - this.intrinsicName = MethodHandleImpl.Intrinsic.NONE; assert(isInvokeBasic(member)); } @@ -1250,7 +1265,15 @@ public boolean isConstantZero() { } public MethodHandleImpl.Intrinsic intrinsicName() { - return intrinsicName; + return resolvedHandle != null + ? resolvedHandle.intrinsicName() + : MethodHandleImpl.Intrinsic.NONE; + } + + public Object intrinsicData() { + return resolvedHandle != null + ? resolvedHandle.intrinsicData() + : null; } } @@ -1732,15 +1755,15 @@ private static void createFormsFor(BasicType type) { Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) }; idForm = new LambdaForm(2, idNames, 1, Kind.IDENTITY); idForm.compileToBytecode(); - idFun = new NamedFunction(idMem, SimpleMethodHandle.make(idMem.getInvocationType(), idForm), - MethodHandleImpl.Intrinsic.IDENTITY); + idFun = new NamedFunction(idMem, MethodHandleImpl.makeIntrinsic(SimpleMethodHandle.make(idMem.getInvocationType(), idForm), + MethodHandleImpl.Intrinsic.IDENTITY)); Object zeValue = Wrapper.forBasicType(btChar).zero(); Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) }; zeForm = new LambdaForm(1, zeNames, 1, Kind.ZERO); zeForm.compileToBytecode(); - zeFun = new NamedFunction(zeMem, SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm), - MethodHandleImpl.Intrinsic.ZERO); + zeFun = new NamedFunction(zeMem, MethodHandleImpl.makeIntrinsic(SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm), + MethodHandleImpl.Intrinsic.ZERO)); } LF_zero[ord] = zeForm; diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java index 88ccfab9de8..ae241759b20 100644 --- a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java +++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java @@ -38,6 +38,7 @@ import static java.lang.invoke.LambdaForm.BasicType.*; import static java.lang.invoke.MethodHandleImpl.Intrinsic; import static java.lang.invoke.MethodHandleImpl.NF_loop; +import static java.lang.invoke.MethodHandleImpl.makeIntrinsic; /** Transforms on LFs. * A lambda-form editor can derive new LFs from its base LF. @@ -619,7 +620,7 @@ LambdaForm spreadArgumentsForm(int pos, Class arrayType, int arrayLength) { // adjust the arguments MethodHandle aload = MethodHandles.arrayElementGetter(erasedArrayType); for (int i = 0; i < arrayLength; i++) { - Name loadArgument = new Name(new NamedFunction(aload, Intrinsic.ARRAY_LOAD), spreadParam, i); + Name loadArgument = new Name(new NamedFunction(makeIntrinsic(aload, Intrinsic.ARRAY_LOAD)), spreadParam, i); buf.insertExpression(exprPos + i, loadArgument); buf.replaceParameterByCopy(pos + i, exprPos + i); } diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index 36864c23843..69453e24abc 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -1679,6 +1679,11 @@ MethodHandleImpl.Intrinsic intrinsicName() { return MethodHandleImpl.Intrinsic.NONE; } + /*non-public*/ + Object intrinsicData() { + return null; + } + /*non-public*/ MethodHandle withInternalMemberName(MemberName member, boolean isInvokeSpecial) { if (member != null) { diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 96fb8370cbd..846a55423d3 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -49,6 +49,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.stream.Stream; @@ -823,7 +825,9 @@ static LambdaForm makeGuardWithTestForm(MethodType basicType) { names[PROFILE] = new Name(getFunction(NF_profileBoolean), names[CALL_TEST], names[GET_COUNTERS]); } // call selectAlternative - names[SELECT_ALT] = new Name(new NamedFunction(getConstantHandle(MH_selectAlternative), Intrinsic.SELECT_ALTERNATIVE), names[TEST], names[GET_TARGET], names[GET_FALLBACK]); + names[SELECT_ALT] = new Name(new NamedFunction( + makeIntrinsic(getConstantHandle(MH_selectAlternative), Intrinsic.SELECT_ALTERNATIVE)), + names[TEST], names[GET_TARGET], names[GET_FALLBACK]); // call target or fallback invokeArgs[0] = names[SELECT_ALT]; @@ -894,7 +898,7 @@ private static LambdaForm makeGuardWithCatchForm(MethodType basicType) { Object[] args = new Object[invokeBasic.type().parameterCount()]; args[0] = names[GET_COLLECT_ARGS]; System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT-ARG_BASE); - names[BOXED_ARGS] = new Name(new NamedFunction(invokeBasic, Intrinsic.GUARD_WITH_CATCH), args); + names[BOXED_ARGS] = new Name(new NamedFunction(makeIntrinsic(invokeBasic, Intrinsic.GUARD_WITH_CATCH)), args); // t_{i+1}:L=MethodHandleImpl.guardWithCatch(target:L,exType:L,catcher:L,t_{i}:L); Object[] gwcArgs = new Object[] {names[GET_TARGET], names[GET_CLASS], names[GET_CATCHER], names[BOXED_ARGS]}; @@ -1226,6 +1230,7 @@ enum Intrinsic { SELECT_ALTERNATIVE, GUARD_WITH_CATCH, TRY_FINALLY, + TABLE_SWITCH, LOOP, ARRAY_LOAD, ARRAY_STORE, @@ -1240,11 +1245,17 @@ enum Intrinsic { static final class IntrinsicMethodHandle extends DelegatingMethodHandle { private final MethodHandle target; private final Intrinsic intrinsicName; + private final Object intrinsicData; IntrinsicMethodHandle(MethodHandle target, Intrinsic intrinsicName) { + this(target, intrinsicName, null); + } + + IntrinsicMethodHandle(MethodHandle target, Intrinsic intrinsicName, Object intrinsicData) { super(target.type(), target); this.target = target; this.intrinsicName = intrinsicName; + this.intrinsicData = intrinsicData; } @Override @@ -1257,6 +1268,11 @@ Intrinsic intrinsicName() { return intrinsicName; } + @Override + Object intrinsicData() { + return intrinsicData; + } + @Override public MethodHandle asTypeUncached(MethodType newType) { // This MH is an alias for target, except for the intrinsic name @@ -1282,9 +1298,13 @@ public MethodHandle asCollector(Class arrayType, int arrayLength) { } static MethodHandle makeIntrinsic(MethodHandle target, Intrinsic intrinsicName) { + return makeIntrinsic(target, intrinsicName, null); + } + + static MethodHandle makeIntrinsic(MethodHandle target, Intrinsic intrinsicName, Object intrinsicData) { if (intrinsicName == target.intrinsicName()) return target; - return new IntrinsicMethodHandle(target, intrinsicName); + return new IntrinsicMethodHandle(target, intrinsicName, intrinsicData); } static MethodHandle makeIntrinsic(MethodType type, LambdaForm form, Intrinsic intrinsicName) { @@ -1360,7 +1380,8 @@ static void assertSame(Object mh1, Object mh2) { NF_tryFinally = 3, NF_loop = 4, NF_profileBoolean = 5, - NF_LIMIT = 6; + NF_tableSwitch = 6, + NF_LIMIT = 7; private static final @Stable NamedFunction[] NFS = new NamedFunction[NF_LIMIT]; @@ -1394,6 +1415,9 @@ private static NamedFunction createFunction(byte func) { case NF_profileBoolean: return new NamedFunction(MethodHandleImpl.class .getDeclaredMethod("profileBoolean", boolean.class, int[].class)); + case NF_tableSwitch: + return new NamedFunction(MethodHandleImpl.class + .getDeclaredMethod("tableSwitch", int.class, MethodHandle.class, CasesHolder.class, Object[].class)); default: throw new InternalError("Undefined function: " + func); } @@ -1602,7 +1626,7 @@ private static LambdaForm makeLoopForm(MethodType basicType, BasicType[] localVa Object[] args = new Object[invokeBasic.type().parameterCount()]; args[0] = names[GET_COLLECT_ARGS]; System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT - ARG_BASE); - names[BOXED_ARGS] = new Name(new NamedFunction(invokeBasic, Intrinsic.LOOP), args); + names[BOXED_ARGS] = new Name(new NamedFunction(makeIntrinsic(invokeBasic, Intrinsic.LOOP)), args); // t_{i+1}:L=MethodHandleImpl.loop(localTypes:L,clauses:L,t_{i}:L); Object[] lArgs = @@ -1839,7 +1863,7 @@ private static LambdaForm makeTryFinallyForm(MethodType basicType) { Object[] args = new Object[invokeBasic.type().parameterCount()]; args[0] = names[GET_COLLECT_ARGS]; System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT-ARG_BASE); - names[BOXED_ARGS] = new Name(new NamedFunction(invokeBasic, Intrinsic.TRY_FINALLY), args); + names[BOXED_ARGS] = new Name(new NamedFunction(makeIntrinsic(invokeBasic, Intrinsic.TRY_FINALLY)), args); // t_{i+1}:L=MethodHandleImpl.tryFinally(target:L,exType:L,catcher:L,t_{i}:L); Object[] tfArgs = new Object[] {names[GET_TARGET], names[GET_CLEANUP], names[BOXED_ARGS]}; @@ -1941,7 +1965,7 @@ private static LambdaForm makeCollectorForm(MethodType basicType, Class array storeNameCursor < STORE_ELEMENT_LIMIT; storeIndex++, storeNameCursor++, argCursor++){ - names[storeNameCursor] = new Name(new NamedFunction(storeFunc, Intrinsic.ARRAY_STORE), + names[storeNameCursor] = new Name(new NamedFunction(makeIntrinsic(storeFunc, Intrinsic.ARRAY_STORE)), names[CALL_NEW_ARRAY], storeIndex, names[argCursor]); } @@ -1952,6 +1976,141 @@ private static LambdaForm makeCollectorForm(MethodType basicType, Class array return lform; } + // use a wrapper because we need this array to be @Stable + static class CasesHolder { + @Stable + final MethodHandle[] cases; + + public CasesHolder(MethodHandle[] cases) { + this.cases = cases; + } + } + + static MethodHandle makeTableSwitch(MethodType type, MethodHandle defaultCase, MethodHandle[] caseActions) { + MethodType varargsType = type.changeReturnType(Object[].class); + MethodHandle collectArgs = varargsArray(type.parameterCount()).asType(varargsType); + + MethodHandle unboxResult = unboxResultHandle(type.returnType()); + + BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLL(); + LambdaForm form = makeTableSwitchForm(type.basicType(), data, caseActions.length); + BoundMethodHandle mh; + CasesHolder caseHolder = new CasesHolder(caseActions); + try { + mh = (BoundMethodHandle) data.factory().invokeBasic(type, form, (Object) defaultCase, (Object) collectArgs, + (Object) unboxResult, (Object) caseHolder); + } catch (Throwable ex) { + throw uncaughtException(ex); + } + assert(mh.type() == type); + return mh; + } + + private static class TableSwitchCacheKey { + private static final Map CACHE = new ConcurrentHashMap<>(); + + private final MethodType basicType; + private final int numberOfCases; + + public TableSwitchCacheKey(MethodType basicType, int numberOfCases) { + this.basicType = basicType; + this.numberOfCases = numberOfCases; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TableSwitchCacheKey that = (TableSwitchCacheKey) o; + return numberOfCases == that.numberOfCases && Objects.equals(basicType, that.basicType); + } + @Override + public int hashCode() { + return Objects.hash(basicType, numberOfCases); + } + } + + private static LambdaForm makeTableSwitchForm(MethodType basicType, BoundMethodHandle.SpeciesData data, + int numCases) { + MethodType lambdaType = basicType.invokerType(); + + // We need to cache based on the basic type X number of cases, + // since the number of cases is used when generating bytecode. + // This also means that we can't use the cache in MethodTypeForm, + // which only uses the basic type as a key. + TableSwitchCacheKey key = new TableSwitchCacheKey(basicType, numCases); + LambdaForm lform = TableSwitchCacheKey.CACHE.get(key); + if (lform != null) { + return lform; + } + + final int THIS_MH = 0; + final int ARG_BASE = 1; // start of incoming arguments + final int ARG_LIMIT = ARG_BASE + basicType.parameterCount(); + final int ARG_SWITCH_ON = ARG_BASE; + assert ARG_SWITCH_ON < ARG_LIMIT; + + int nameCursor = ARG_LIMIT; + final int GET_COLLECT_ARGS = nameCursor++; + final int GET_DEFAULT_CASE = nameCursor++; + final int GET_UNBOX_RESULT = nameCursor++; + final int GET_CASES = nameCursor++; + final int BOXED_ARGS = nameCursor++; + final int TABLE_SWITCH = nameCursor++; + final int UNBOXED_RESULT = nameCursor++; + + int fieldCursor = 0; + final int FIELD_DEFAULT_CASE = fieldCursor++; + final int FIELD_COLLECT_ARGS = fieldCursor++; + final int FIELD_UNBOX_RESULT = fieldCursor++; + final int FIELD_CASES = fieldCursor++; + + Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType); + + names[THIS_MH] = names[THIS_MH].withConstraint(data); + names[GET_DEFAULT_CASE] = new Name(data.getterFunction(FIELD_DEFAULT_CASE), names[THIS_MH]); + names[GET_COLLECT_ARGS] = new Name(data.getterFunction(FIELD_COLLECT_ARGS), names[THIS_MH]); + names[GET_UNBOX_RESULT] = new Name(data.getterFunction(FIELD_UNBOX_RESULT), names[THIS_MH]); + names[GET_CASES] = new Name(data.getterFunction(FIELD_CASES), names[THIS_MH]); + + { + MethodType collectArgsType = basicType.changeReturnType(Object.class); + MethodHandle invokeBasic = MethodHandles.basicInvoker(collectArgsType); + Object[] args = new Object[invokeBasic.type().parameterCount()]; + args[0] = names[GET_COLLECT_ARGS]; + System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT - ARG_BASE); + names[BOXED_ARGS] = new Name(new NamedFunction(makeIntrinsic(invokeBasic, Intrinsic.TABLE_SWITCH, numCases)), args); + } + + { + Object[] tfArgs = new Object[]{ + names[ARG_SWITCH_ON], names[GET_DEFAULT_CASE], names[GET_CASES], names[BOXED_ARGS]}; + names[TABLE_SWITCH] = new Name(getFunction(NF_tableSwitch), tfArgs); + } + + { + MethodHandle invokeBasic = MethodHandles.basicInvoker(MethodType.methodType(basicType.rtype(), Object.class)); + Object[] unboxArgs = new Object[]{names[GET_UNBOX_RESULT], names[TABLE_SWITCH]}; + names[UNBOXED_RESULT] = new Name(invokeBasic, unboxArgs); + } + + lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.TABLE_SWITCH); + LambdaForm prev = TableSwitchCacheKey.CACHE.putIfAbsent(key, lform); + return prev != null ? prev : lform; + } + + @Hidden + static Object tableSwitch(int input, MethodHandle defaultCase, CasesHolder holder, Object[] args) throws Throwable { + MethodHandle[] caseActions = holder.cases; + MethodHandle selectedCase; + if (input < 0 || input >= caseActions.length) { + selectedCase = defaultCase; + } else { + selectedCase = caseActions[input]; + } + return selectedCase.invokeWithArguments(args); + } + // Indexes into constant method handles: static final int MH_cast = 0, 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 b89dcef0cb0..6e4f33affda 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -28,7 +28,6 @@ import jdk.internal.access.SharedSecrets; import jdk.internal.misc.Unsafe; import jdk.internal.misc.VM; -import jdk.internal.module.IllegalAccessLogger; import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.Type; @@ -262,13 +261,6 @@ public static Lookup privateLookupIn(Class targetClass, Lookup caller) throws // M2 != M1, set previous lookup class to M1 and drop MODULE access newPreviousClass = callerClass; newModes &= ~Lookup.MODULE; - - if (!callerModule.isNamed() && targetModule.isNamed()) { - IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger(); - if (logger != null) { - logger.logIfOpenedForIllegalAccess(caller, targetClass); - } - } } return Lookup.newLookup(targetClass, newPreviousClass, newModes); } @@ -7759,4 +7751,90 @@ private static void tryFinallyChecks(MethodHandle target, MethodHandle cleanup) } } + /** + * Creates a table switch method handle, which can be used to switch over a set of target + * method handles, based on a given target index, called selector. + *

+ * For a selector value of {@code n}, where {@code n} falls in the range {@code [0, N)}, + * and where {@code N} is the number of target method handles, the table switch method + * handle will invoke the n-th target method handle from the list of target method handles. + *

+ * For a selector value that does not fall in the range {@code [0, N)}, the table switch + * method handle will invoke the given fallback method handle. + *

+ * All method handles passed to this method must have the same type, with the additional + * requirement that the leading parameter be of type {@code int}. The leading parameter + * represents the selector. + *

+ * Any trailing parameters present in the type will appear on the returned table switch + * method handle as well. Any arguments assigned to these parameters will be forwarded, + * together with the selector value, to the selected method handle when invoking it. + * + * @apiNote Example: + * The cases each drop the {@code selector} value they are given, and take an additional + * {@code String} argument, which is concatenated (using {@link String#concat(String)}) + * to a specific constant label string for each case: + *

{@code
+     * MethodHandles.Lookup lookup = MethodHandles.lookup();
+     * MethodHandle caseMh = lookup.findVirtual(String.class, "concat",
+     *         MethodType.methodType(String.class, String.class));
+     * caseMh = MethodHandles.dropArguments(caseMh, 0, int.class);
+     *
+     * MethodHandle caseDefault = MethodHandles.insertArguments(caseMh, 1, "default: ");
+     * MethodHandle case0 = MethodHandles.insertArguments(caseMh, 1, "case 0: ");
+     * MethodHandle case1 = MethodHandles.insertArguments(caseMh, 1, "case 1: ");
+     *
+     * MethodHandle mhSwitch = MethodHandles.tableSwitch(
+     *     caseDefault,
+     *     case0,
+     *     case1
+     * );
+     *
+     * assertEquals("default: data", (String) mhSwitch.invokeExact(-1, "data"));
+     * assertEquals("case 0: data", (String) mhSwitch.invokeExact(0, "data"));
+     * assertEquals("case 1: data", (String) mhSwitch.invokeExact(1, "data"));
+     * assertEquals("default: data", (String) mhSwitch.invokeExact(2, "data"));
+     * }
+ * + * @param fallback the fallback method handle that is called when the selector is not + * within the range {@code [0, N)}. + * @param targets array of target method handles. + * @return the table switch method handle. + * @throws NullPointerException if {@code fallback}, the {@code targets} array, or any + * any of the elements of the {@code targets} array are + * {@code null}. + * @throws IllegalArgumentException if the {@code targets} array is empty, if the leading + * parameter of the fallback handle or any of the target + * handles is not {@code int}, or if the types of + * the fallback handle and all of target handles are + * not the same. + */ + public static MethodHandle tableSwitch(MethodHandle fallback, MethodHandle... targets) { + Objects.requireNonNull(fallback); + Objects.requireNonNull(targets); + targets = targets.clone(); + MethodType type = tableSwitchChecks(fallback, targets); + return MethodHandleImpl.makeTableSwitch(type, fallback, targets); + } + + private static MethodType tableSwitchChecks(MethodHandle defaultCase, MethodHandle[] caseActions) { + if (caseActions.length == 0) + throw new IllegalArgumentException("Not enough cases: " + Arrays.toString(caseActions)); + + MethodType expectedType = defaultCase.type(); + + if (!(expectedType.parameterCount() >= 1) || expectedType.parameterType(0) != int.class) + throw new IllegalArgumentException( + "Case actions must have int as leading parameter: " + Arrays.toString(caseActions)); + + for (MethodHandle mh : caseActions) { + Objects.requireNonNull(mh); + if (mh.type() != expectedType) + throw new IllegalArgumentException( + "Case actions must have the same type: " + Arrays.toString(caseActions)); + } + + return expectedType; + } + } diff --git a/src/java.base/share/classes/java/lang/invoke/VarForm.java b/src/java.base/share/classes/java/lang/invoke/VarForm.java index ecbd1c1b31d..7b118dbe470 100644 --- a/src/java.base/share/classes/java/lang/invoke/VarForm.java +++ b/src/java.base/share/classes/java/lang/invoke/VarForm.java @@ -49,8 +49,8 @@ final class VarForm { final @Stable MemberName[] memberName_table; VarForm(Class implClass, Class receiver, Class value, Class... intermediate) { - this.methodType_table = new MethodType[VarHandle.AccessType.values().length]; - this.memberName_table = new MemberName[VarHandle.AccessMode.values().length]; + this.methodType_table = new MethodType[VarHandle.AccessType.COUNT]; + this.memberName_table = new MemberName[VarHandle.AccessMode.COUNT]; this.implClass = implClass; if (receiver == null) { initMethodTypes(value, intermediate); @@ -64,7 +64,7 @@ final class VarForm { // Used by IndirectVarHandle VarForm(Class value, Class[] coordinates) { - this.methodType_table = new MethodType[VarHandle.AccessType.values().length]; + this.methodType_table = new MethodType[VarHandle.AccessType.COUNT]; this.memberName_table = null; this.implClass = null; initMethodTypes(value, coordinates); diff --git a/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/src/java.base/share/classes/java/lang/invoke/VarHandle.java index a43a78d0ce2..0dfd2e850ee 100644 --- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java @@ -40,6 +40,7 @@ import java.util.function.Function; import jdk.internal.util.Preconditions; +import jdk.internal.vm.annotation.DontInline; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.IntrinsicCandidate; import jdk.internal.vm.annotation.Stable; @@ -1636,6 +1637,10 @@ enum AccessType { COMPARE_AND_EXCHANGE(Object.class), GET_AND_UPDATE(Object.class); + static final int COUNT = GET_AND_UPDATE.ordinal() + 1; + static { + assert (COUNT == values().length); + } final Class returnType; final boolean isMonomorphicInReturnType; @@ -1890,6 +1895,10 @@ public enum AccessMode { GET_AND_BITWISE_XOR_ACQUIRE("getAndBitwiseXorAcquire", AccessType.GET_AND_UPDATE), ; + static final int COUNT = GET_AND_BITWISE_XOR_ACQUIRE.ordinal() + 1; + static { + assert (COUNT == values().length); + } final String methodName; final AccessType at; @@ -2028,6 +2037,19 @@ public final MethodType accessModeType(AccessMode accessMode) { return accessModeType(accessMode.at.ordinal()); } + @ForceInline + final void checkExactAccessMode(VarHandle.AccessDescriptor ad) { + if (exact && accessModeType(ad.type) != ad.symbolicMethodTypeExact) { + throwWrongMethodTypeException(ad); + } + } + + @DontInline + private final void throwWrongMethodTypeException(VarHandle.AccessDescriptor ad) { + throw new WrongMethodTypeException("expected " + accessModeType(ad.type) + " but found " + + ad.symbolicMethodTypeExact); + } + @ForceInline final MethodType accessModeType(int accessTypeOrdinal) { TypesAndInvokers tis = getTypesAndInvokers(); @@ -2112,12 +2134,10 @@ public Optional describeConstable() { static class TypesAndInvokers { final @Stable - MethodType[] methodType_table = - new MethodType[VarHandle.AccessType.values().length]; + MethodType[] methodType_table = new MethodType[VarHandle.AccessType.COUNT]; final @Stable - MethodHandle[] methodHandle_table = - new MethodHandle[AccessMode.values().length]; + MethodHandle[] methodHandle_table = new MethodHandle[AccessMode.COUNT]; } @ForceInline diff --git a/src/java.base/share/classes/java/lang/invoke/VarHandleGuards.java b/src/java.base/share/classes/java/lang/invoke/VarHandleGuards.java index ee3a27b4a83..85b53789164 100644 --- a/src/java.base/share/classes/java/lang/invoke/VarHandleGuards.java +++ b/src/java.base/share/classes/java/lang/invoke/VarHandleGuards.java @@ -34,10 +34,7 @@ final class VarHandleGuards { @LambdaForm.Compiled @Hidden static final Object guard_L_L(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -51,10 +48,7 @@ static final Object guard_L_L(VarHandle handle, Object arg0, VarHandle.AccessDes @LambdaForm.Compiled @Hidden static final void guard_LL_V(VarHandle handle, Object arg0, Object arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -69,10 +63,7 @@ static final void guard_LL_V(VarHandle handle, Object arg0, Object arg1, VarHand @LambdaForm.Compiled @Hidden static final boolean guard_LLL_Z(VarHandle handle, Object arg0, Object arg1, Object arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -85,10 +76,7 @@ static final boolean guard_LLL_Z(VarHandle handle, Object arg0, Object arg1, Obj @LambdaForm.Compiled @Hidden static final Object guard_LLL_L(VarHandle handle, Object arg0, Object arg1, Object arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -102,10 +90,7 @@ static final Object guard_LLL_L(VarHandle handle, Object arg0, Object arg1, Obje @LambdaForm.Compiled @Hidden static final Object guard_LL_L(VarHandle handle, Object arg0, Object arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -119,10 +104,7 @@ static final Object guard_LL_L(VarHandle handle, Object arg0, Object arg1, VarHa @LambdaForm.Compiled @Hidden static final int guard_L_I(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -135,10 +117,7 @@ static final int guard_L_I(VarHandle handle, Object arg0, VarHandle.AccessDescri @LambdaForm.Compiled @Hidden static final void guard_LI_V(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -153,10 +132,7 @@ static final void guard_LI_V(VarHandle handle, Object arg0, int arg1, VarHandle. @LambdaForm.Compiled @Hidden static final boolean guard_LII_Z(VarHandle handle, Object arg0, int arg1, int arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -169,10 +145,7 @@ static final boolean guard_LII_Z(VarHandle handle, Object arg0, int arg1, int ar @LambdaForm.Compiled @Hidden static final int guard_LII_I(VarHandle handle, Object arg0, int arg1, int arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -185,10 +158,7 @@ static final int guard_LII_I(VarHandle handle, Object arg0, int arg1, int arg2, @LambdaForm.Compiled @Hidden static final int guard_LI_I(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -201,10 +171,7 @@ static final int guard_LI_I(VarHandle handle, Object arg0, int arg1, VarHandle.A @LambdaForm.Compiled @Hidden static final long guard_L_J(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -217,10 +184,7 @@ static final long guard_L_J(VarHandle handle, Object arg0, VarHandle.AccessDescr @LambdaForm.Compiled @Hidden static final void guard_LJ_V(VarHandle handle, Object arg0, long arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -235,10 +199,7 @@ static final void guard_LJ_V(VarHandle handle, Object arg0, long arg1, VarHandle @LambdaForm.Compiled @Hidden static final boolean guard_LJJ_Z(VarHandle handle, Object arg0, long arg1, long arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -251,10 +212,7 @@ static final boolean guard_LJJ_Z(VarHandle handle, Object arg0, long arg1, long @LambdaForm.Compiled @Hidden static final long guard_LJJ_J(VarHandle handle, Object arg0, long arg1, long arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -267,10 +225,7 @@ static final long guard_LJJ_J(VarHandle handle, Object arg0, long arg1, long arg @LambdaForm.Compiled @Hidden static final long guard_LJ_J(VarHandle handle, Object arg0, long arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -283,10 +238,7 @@ static final long guard_LJ_J(VarHandle handle, Object arg0, long arg1, VarHandle @LambdaForm.Compiled @Hidden static final float guard_L_F(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -299,10 +251,7 @@ static final float guard_L_F(VarHandle handle, Object arg0, VarHandle.AccessDesc @LambdaForm.Compiled @Hidden static final void guard_LF_V(VarHandle handle, Object arg0, float arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -317,10 +266,7 @@ static final void guard_LF_V(VarHandle handle, Object arg0, float arg1, VarHandl @LambdaForm.Compiled @Hidden static final boolean guard_LFF_Z(VarHandle handle, Object arg0, float arg1, float arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -333,10 +279,7 @@ static final boolean guard_LFF_Z(VarHandle handle, Object arg0, float arg1, floa @LambdaForm.Compiled @Hidden static final float guard_LFF_F(VarHandle handle, Object arg0, float arg1, float arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -349,10 +292,7 @@ static final float guard_LFF_F(VarHandle handle, Object arg0, float arg1, float @LambdaForm.Compiled @Hidden static final float guard_LF_F(VarHandle handle, Object arg0, float arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -365,10 +305,7 @@ static final float guard_LF_F(VarHandle handle, Object arg0, float arg1, VarHand @LambdaForm.Compiled @Hidden static final double guard_L_D(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -381,10 +318,7 @@ static final double guard_L_D(VarHandle handle, Object arg0, VarHandle.AccessDes @LambdaForm.Compiled @Hidden static final void guard_LD_V(VarHandle handle, Object arg0, double arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -399,10 +333,7 @@ static final void guard_LD_V(VarHandle handle, Object arg0, double arg1, VarHand @LambdaForm.Compiled @Hidden static final boolean guard_LDD_Z(VarHandle handle, Object arg0, double arg1, double arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -415,10 +346,7 @@ static final boolean guard_LDD_Z(VarHandle handle, Object arg0, double arg1, dou @LambdaForm.Compiled @Hidden static final double guard_LDD_D(VarHandle handle, Object arg0, double arg1, double arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -431,10 +359,7 @@ static final double guard_LDD_D(VarHandle handle, Object arg0, double arg1, doub @LambdaForm.Compiled @Hidden static final double guard_LD_D(VarHandle handle, Object arg0, double arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -447,10 +372,7 @@ static final double guard_LD_D(VarHandle handle, Object arg0, double arg1, VarHa @LambdaForm.Compiled @Hidden static final Object guard__L(VarHandle handle, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -464,10 +386,7 @@ static final Object guard__L(VarHandle handle, VarHandle.AccessDescriptor ad) th @LambdaForm.Compiled @Hidden static final void guard_L_V(VarHandle handle, Object arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -482,10 +401,7 @@ static final void guard_L_V(VarHandle handle, Object arg0, VarHandle.AccessDescr @LambdaForm.Compiled @Hidden static final boolean guard_LL_Z(VarHandle handle, Object arg0, Object arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -498,10 +414,7 @@ static final boolean guard_LL_Z(VarHandle handle, Object arg0, Object arg1, VarH @LambdaForm.Compiled @Hidden static final int guard__I(VarHandle handle, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, handle.vform.getMemberName(ad.mode)); } else { @@ -514,10 +427,7 @@ static final int guard__I(VarHandle handle, VarHandle.AccessDescriptor ad) throw @LambdaForm.Compiled @Hidden static final void guard_I_V(VarHandle handle, int arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -532,10 +442,7 @@ static final void guard_I_V(VarHandle handle, int arg0, VarHandle.AccessDescript @LambdaForm.Compiled @Hidden static final boolean guard_II_Z(VarHandle handle, int arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -548,10 +455,7 @@ static final boolean guard_II_Z(VarHandle handle, int arg0, int arg1, VarHandle. @LambdaForm.Compiled @Hidden static final int guard_II_I(VarHandle handle, int arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -564,10 +468,7 @@ static final int guard_II_I(VarHandle handle, int arg0, int arg1, VarHandle.Acce @LambdaForm.Compiled @Hidden static final int guard_I_I(VarHandle handle, int arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -580,10 +481,7 @@ static final int guard_I_I(VarHandle handle, int arg0, VarHandle.AccessDescripto @LambdaForm.Compiled @Hidden static final long guard__J(VarHandle handle, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, handle.vform.getMemberName(ad.mode)); } else { @@ -596,10 +494,7 @@ static final long guard__J(VarHandle handle, VarHandle.AccessDescriptor ad) thro @LambdaForm.Compiled @Hidden static final void guard_J_V(VarHandle handle, long arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -614,10 +509,7 @@ static final void guard_J_V(VarHandle handle, long arg0, VarHandle.AccessDescrip @LambdaForm.Compiled @Hidden static final boolean guard_JJ_Z(VarHandle handle, long arg0, long arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -630,10 +522,7 @@ static final boolean guard_JJ_Z(VarHandle handle, long arg0, long arg1, VarHandl @LambdaForm.Compiled @Hidden static final long guard_JJ_J(VarHandle handle, long arg0, long arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -646,10 +535,7 @@ static final long guard_JJ_J(VarHandle handle, long arg0, long arg1, VarHandle.A @LambdaForm.Compiled @Hidden static final long guard_J_J(VarHandle handle, long arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -662,10 +548,7 @@ static final long guard_J_J(VarHandle handle, long arg0, VarHandle.AccessDescrip @LambdaForm.Compiled @Hidden static final float guard__F(VarHandle handle, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, handle.vform.getMemberName(ad.mode)); } else { @@ -678,10 +561,7 @@ static final float guard__F(VarHandle handle, VarHandle.AccessDescriptor ad) thr @LambdaForm.Compiled @Hidden static final void guard_F_V(VarHandle handle, float arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -696,10 +576,7 @@ static final void guard_F_V(VarHandle handle, float arg0, VarHandle.AccessDescri @LambdaForm.Compiled @Hidden static final boolean guard_FF_Z(VarHandle handle, float arg0, float arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -712,10 +589,7 @@ static final boolean guard_FF_Z(VarHandle handle, float arg0, float arg1, VarHan @LambdaForm.Compiled @Hidden static final float guard_FF_F(VarHandle handle, float arg0, float arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -728,10 +602,7 @@ static final float guard_FF_F(VarHandle handle, float arg0, float arg1, VarHandl @LambdaForm.Compiled @Hidden static final float guard_F_F(VarHandle handle, float arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -744,10 +615,7 @@ static final float guard_F_F(VarHandle handle, float arg0, VarHandle.AccessDescr @LambdaForm.Compiled @Hidden static final double guard__D(VarHandle handle, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, handle.vform.getMemberName(ad.mode)); } else { @@ -760,10 +628,7 @@ static final double guard__D(VarHandle handle, VarHandle.AccessDescriptor ad) th @LambdaForm.Compiled @Hidden static final void guard_D_V(VarHandle handle, double arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -778,10 +643,7 @@ static final void guard_D_V(VarHandle handle, double arg0, VarHandle.AccessDescr @LambdaForm.Compiled @Hidden static final boolean guard_DD_Z(VarHandle handle, double arg0, double arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -794,10 +656,7 @@ static final boolean guard_DD_Z(VarHandle handle, double arg0, double arg1, VarH @LambdaForm.Compiled @Hidden static final double guard_DD_D(VarHandle handle, double arg0, double arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -810,10 +669,7 @@ static final double guard_DD_D(VarHandle handle, double arg0, double arg1, VarHa @LambdaForm.Compiled @Hidden static final double guard_D_D(VarHandle handle, double arg0, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, handle.vform.getMemberName(ad.mode)); } else { @@ -826,10 +682,7 @@ static final double guard_D_D(VarHandle handle, double arg0, VarHandle.AccessDes @LambdaForm.Compiled @Hidden static final Object guard_LI_L(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -843,10 +696,7 @@ static final Object guard_LI_L(VarHandle handle, Object arg0, int arg1, VarHandl @LambdaForm.Compiled @Hidden static final void guard_LIL_V(VarHandle handle, Object arg0, int arg1, Object arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -861,10 +711,7 @@ static final void guard_LIL_V(VarHandle handle, Object arg0, int arg1, Object ar @LambdaForm.Compiled @Hidden static final boolean guard_LILL_Z(VarHandle handle, Object arg0, int arg1, Object arg2, Object arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -877,10 +724,7 @@ static final boolean guard_LILL_Z(VarHandle handle, Object arg0, int arg1, Objec @LambdaForm.Compiled @Hidden static final Object guard_LILL_L(VarHandle handle, Object arg0, int arg1, Object arg2, Object arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -894,10 +738,7 @@ static final Object guard_LILL_L(VarHandle handle, Object arg0, int arg1, Object @LambdaForm.Compiled @Hidden static final Object guard_LIL_L(VarHandle handle, Object arg0, int arg1, Object arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { Object r = MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); return ad.returnType.cast(r); @@ -911,10 +752,7 @@ static final Object guard_LIL_L(VarHandle handle, Object arg0, int arg1, Object @LambdaForm.Compiled @Hidden static final void guard_LII_V(VarHandle handle, Object arg0, int arg1, int arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -929,10 +767,7 @@ static final void guard_LII_V(VarHandle handle, Object arg0, int arg1, int arg2, @LambdaForm.Compiled @Hidden static final boolean guard_LIII_Z(VarHandle handle, Object arg0, int arg1, int arg2, int arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -945,10 +780,7 @@ static final boolean guard_LIII_Z(VarHandle handle, Object arg0, int arg1, int a @LambdaForm.Compiled @Hidden static final int guard_LIII_I(VarHandle handle, Object arg0, int arg1, int arg2, int arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -961,10 +793,7 @@ static final int guard_LIII_I(VarHandle handle, Object arg0, int arg1, int arg2, @LambdaForm.Compiled @Hidden static final long guard_LI_J(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -977,10 +806,7 @@ static final long guard_LI_J(VarHandle handle, Object arg0, int arg1, VarHandle. @LambdaForm.Compiled @Hidden static final void guard_LIJ_V(VarHandle handle, Object arg0, int arg1, long arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -995,10 +821,7 @@ static final void guard_LIJ_V(VarHandle handle, Object arg0, int arg1, long arg2 @LambdaForm.Compiled @Hidden static final boolean guard_LIJJ_Z(VarHandle handle, Object arg0, int arg1, long arg2, long arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1011,10 +834,7 @@ static final boolean guard_LIJJ_Z(VarHandle handle, Object arg0, int arg1, long @LambdaForm.Compiled @Hidden static final long guard_LIJJ_J(VarHandle handle, Object arg0, int arg1, long arg2, long arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1027,10 +847,7 @@ static final long guard_LIJJ_J(VarHandle handle, Object arg0, int arg1, long arg @LambdaForm.Compiled @Hidden static final long guard_LIJ_J(VarHandle handle, Object arg0, int arg1, long arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -1043,10 +860,7 @@ static final long guard_LIJ_J(VarHandle handle, Object arg0, int arg1, long arg2 @LambdaForm.Compiled @Hidden static final float guard_LI_F(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -1059,10 +873,7 @@ static final float guard_LI_F(VarHandle handle, Object arg0, int arg1, VarHandle @LambdaForm.Compiled @Hidden static final void guard_LIF_V(VarHandle handle, Object arg0, int arg1, float arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -1077,10 +888,7 @@ static final void guard_LIF_V(VarHandle handle, Object arg0, int arg1, float arg @LambdaForm.Compiled @Hidden static final boolean guard_LIFF_Z(VarHandle handle, Object arg0, int arg1, float arg2, float arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1093,10 +901,7 @@ static final boolean guard_LIFF_Z(VarHandle handle, Object arg0, int arg1, float @LambdaForm.Compiled @Hidden static final float guard_LIFF_F(VarHandle handle, Object arg0, int arg1, float arg2, float arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1109,10 +914,7 @@ static final float guard_LIFF_F(VarHandle handle, Object arg0, int arg1, float a @LambdaForm.Compiled @Hidden static final float guard_LIF_F(VarHandle handle, Object arg0, int arg1, float arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (float) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -1125,10 +927,7 @@ static final float guard_LIF_F(VarHandle handle, Object arg0, int arg1, float ar @LambdaForm.Compiled @Hidden static final double guard_LI_D(VarHandle handle, Object arg0, int arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -1141,10 +940,7 @@ static final double guard_LI_D(VarHandle handle, Object arg0, int arg1, VarHandl @LambdaForm.Compiled @Hidden static final void guard_LID_V(VarHandle handle, Object arg0, int arg1, double arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -1159,10 +955,7 @@ static final void guard_LID_V(VarHandle handle, Object arg0, int arg1, double ar @LambdaForm.Compiled @Hidden static final boolean guard_LIDD_Z(VarHandle handle, Object arg0, int arg1, double arg2, double arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1175,10 +968,7 @@ static final boolean guard_LIDD_Z(VarHandle handle, Object arg0, int arg1, doubl @LambdaForm.Compiled @Hidden static final double guard_LIDD_D(VarHandle handle, Object arg0, int arg1, double arg2, double arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1191,10 +981,7 @@ static final double guard_LIDD_D(VarHandle handle, Object arg0, int arg1, double @LambdaForm.Compiled @Hidden static final double guard_LID_D(VarHandle handle, Object arg0, int arg1, double arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (double) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -1207,10 +994,7 @@ static final double guard_LID_D(VarHandle handle, Object arg0, int arg1, double @LambdaForm.Compiled @Hidden static final int guard_LJ_I(VarHandle handle, Object arg0, long arg1, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, handle.vform.getMemberName(ad.mode)); } else { @@ -1223,10 +1007,7 @@ static final int guard_LJ_I(VarHandle handle, Object arg0, long arg1, VarHandle. @LambdaForm.Compiled @Hidden static final void guard_LJI_V(VarHandle handle, Object arg0, long arg1, int arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -1241,10 +1022,7 @@ static final void guard_LJI_V(VarHandle handle, Object arg0, long arg1, int arg2 @LambdaForm.Compiled @Hidden static final boolean guard_LJII_Z(VarHandle handle, Object arg0, long arg1, int arg2, int arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1257,10 +1035,7 @@ static final boolean guard_LJII_Z(VarHandle handle, Object arg0, long arg1, int @LambdaForm.Compiled @Hidden static final int guard_LJII_I(VarHandle handle, Object arg0, long arg1, int arg2, int arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1273,10 +1048,7 @@ static final int guard_LJII_I(VarHandle handle, Object arg0, long arg1, int arg2 @LambdaForm.Compiled @Hidden static final int guard_LJI_I(VarHandle handle, Object arg0, long arg1, int arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (int) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else { @@ -1289,10 +1061,7 @@ static final int guard_LJI_I(VarHandle handle, Object arg0, long arg1, int arg2, @LambdaForm.Compiled @Hidden static final void guard_LJJ_V(VarHandle handle, Object arg0, long arg1, long arg2, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { MethodHandle.linkToStatic(handle, arg0, arg1, arg2, handle.vform.getMemberName(ad.mode)); } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { @@ -1307,10 +1076,7 @@ static final void guard_LJJ_V(VarHandle handle, Object arg0, long arg1, long arg @LambdaForm.Compiled @Hidden static final boolean guard_LJJJ_Z(VarHandle handle, Object arg0, long arg1, long arg2, long arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (boolean) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { @@ -1323,10 +1089,7 @@ static final boolean guard_LJJJ_Z(VarHandle handle, Object arg0, long arg1, long @LambdaForm.Compiled @Hidden static final long guard_LJJJ_J(VarHandle handle, Object arg0, long arg1, long arg2, long arg3, VarHandle.AccessDescriptor ad) throws Throwable { - if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { - throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " - + ad.symbolicMethodTypeExact); - } + handle.checkExactAccessMode(ad); if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { return (long) MethodHandle.linkToStatic(handle, arg0, arg1, arg2, arg3, handle.vform.getMemberName(ad.mode)); } else { diff --git a/src/java.base/share/classes/java/lang/invoke/VarHandles.java b/src/java.base/share/classes/java/lang/invoke/VarHandles.java index ed38e475207..fb86bfab0e8 100644 --- a/src/java.base/share/classes/java/lang/invoke/VarHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/VarHandles.java @@ -686,10 +686,7 @@ private static boolean isCheckedException(Class clazz) { // @LambdaForm.Compiled // @Hidden // static final throws Throwable { -// if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { -// throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " -// + ad.symbolicMethodTypeExact); -// } +// handle.checkExactAccessMode(ad); // if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { // MethodHandle.linkToStatic(); // } else { @@ -704,10 +701,7 @@ private static boolean isCheckedException(Class clazz) { // @LambdaForm.Compiled // @Hidden // static final throws Throwable { -// if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) { -// throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found " -// + ad.symbolicMethodTypeExact); -// } +// handle.checkExactAccessMode(ad); // if (handle.isDirect() && handle.vform.methodType_table[ad.type] == ad.symbolicMethodTypeErased) { // MethodHandle.linkToStatic(); // } else if (handle.isDirect() && handle.vform.getMethodType_V(ad.type) == ad.symbolicMethodTypeErased) { diff --git a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java index a3346b8c3f8..e87b431ec5c 100644 --- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java +++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -32,7 +32,6 @@ import jdk.internal.access.SharedSecrets; import jdk.internal.misc.VM; -import jdk.internal.module.IllegalAccessLogger; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; import jdk.internal.reflect.ReflectionFactory; @@ -324,7 +323,6 @@ private boolean checkCanSetAccessible(Class caller, if (isClassPublic && declaringModule.isExported(pn, callerModule)) { // member is public if (Modifier.isPublic(modifiers)) { - logIfExportedForIllegalAccess(caller, declaringClass); return true; } @@ -332,14 +330,12 @@ private boolean checkCanSetAccessible(Class caller, if (Modifier.isProtected(modifiers) && Modifier.isStatic(modifiers) && isSubclassOf(caller, declaringClass)) { - logIfExportedForIllegalAccess(caller, declaringClass); return true; } } // package is open to caller if (declaringModule.isOpen(pn, callerModule)) { - logIfOpenedForIllegalAccess(caller, declaringClass); return true; } @@ -373,30 +369,6 @@ private boolean isSubclassOf(Class queryClass, Class ofClass) { return false; } - private void logIfOpenedForIllegalAccess(Class caller, Class declaringClass) { - Module callerModule = caller.getModule(); - Module targetModule = declaringClass.getModule(); - // callerModule is null during early startup - if (callerModule != null && !callerModule.isNamed() && targetModule.isNamed()) { - IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger(); - if (logger != null) { - logger.logIfOpenedForIllegalAccess(caller, declaringClass, this::toShortString); - } - } - } - - private void logIfExportedForIllegalAccess(Class caller, Class declaringClass) { - Module callerModule = caller.getModule(); - Module targetModule = declaringClass.getModule(); - // callerModule is null during early startup - if (callerModule != null && !callerModule.isNamed() && targetModule.isNamed()) { - IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger(); - if (logger != null) { - logger.logIfExportedForIllegalAccess(caller, declaringClass, this::toShortString); - } - } - } - /** * Returns a short descriptive string to describe this object in log messages. */ @@ -497,6 +469,7 @@ public final boolean canAccess(Object obj) { /** * Constructor: only used by the Java Virtual Machine. */ + @Deprecated(since="17") protected AccessibleObject() {} // Indicates whether language-level access checks are overridden @@ -520,12 +493,16 @@ protected AccessibleObject() {} *

Note that any annotation returned by this method is a * declaration annotation. * + * @implSpec + * The default implementation throws {@link + * UnsupportedOperationException}; subclasses should override this method. + * * @throws NullPointerException {@inheritDoc} * @since 1.5 */ @Override public T getAnnotation(Class annotationClass) { - throw new AssertionError("All subclasses should override this method"); + throw new UnsupportedOperationException("All subclasses should override this method"); } /** @@ -545,12 +522,16 @@ public boolean isAnnotationPresent(Class annotationClass) *

Note that any annotations returned by this method are * declaration annotations. * + * @implSpec + * The default implementation throws {@link + * UnsupportedOperationException}; subclasses should override this method. + * * @throws NullPointerException {@inheritDoc} * @since 1.8 */ @Override public T[] getAnnotationsByType(Class annotationClass) { - throw new AssertionError("All subclasses should override this method"); + throw new UnsupportedOperationException("All subclasses should override this method"); } /** @@ -606,11 +587,15 @@ public T[] getDeclaredAnnotationsByType(Class annotati *

Note that any annotations returned by this method are * declaration annotations. * + * @implSpec + * The default implementation throws {@link + * UnsupportedOperationException}; subclasses should override this method. + * * @since 1.5 */ @Override public Annotation[] getDeclaredAnnotations() { - throw new AssertionError("All subclasses should override this method"); + throw new UnsupportedOperationException("All subclasses should override this method"); } // Shared access checking logic. @@ -730,9 +715,6 @@ private boolean slowVerifyAccess(Class caller, Class memberClass, return false; } - // access okay - logIfExportedForIllegalAccess(caller, memberClass); - // Success: Update the cache. Object cache = (targetClass != null && Modifier.isProtected(modifiers) diff --git a/src/java.base/share/classes/java/lang/reflect/Executable.java b/src/java.base/share/classes/java/lang/reflect/Executable.java index ad399cb86d9..d86a454c751 100644 --- a/src/java.base/share/classes/java/lang/reflect/Executable.java +++ b/src/java.base/share/classes/java/lang/reflect/Executable.java @@ -47,11 +47,12 @@ * * @since 1.8 */ -public abstract class Executable extends AccessibleObject - implements Member, GenericDeclaration { +public abstract sealed class Executable extends AccessibleObject + implements Member, GenericDeclaration permits Constructor, Method { /* * Only grant package-visibility to the constructor. */ + @SuppressWarnings("deprecation") Executable() {} /** diff --git a/src/java.base/share/classes/java/lang/reflect/Field.java b/src/java.base/share/classes/java/lang/reflect/Field.java index 3513fb676ba..9cbca96942f 100644 --- a/src/java.base/share/classes/java/lang/reflect/Field.java +++ b/src/java.base/share/classes/java/lang/reflect/Field.java @@ -116,6 +116,7 @@ private FieldRepository getGenericInfo() { /** * Package-private constructor */ + @SuppressWarnings("deprecation") Field(Class declaringClass, String name, Class type, diff --git a/src/java.base/share/classes/java/util/AbstractMap.java b/src/java.base/share/classes/java/util/AbstractMap.java index fcec5cd44bc..fc02c977f8a 100644 --- a/src/java.base/share/classes/java/util/AbstractMap.java +++ b/src/java.base/share/classes/java/util/AbstractMap.java @@ -476,9 +476,8 @@ public boolean equals(Object o) { if (o == this) return true; - if (!(o instanceof Map)) + if (!(o instanceof Map m)) return false; - Map m = (Map) o; if (m.size() != size()) return false; @@ -688,10 +687,9 @@ public V setValue(V value) { * @see #hashCode */ public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - return eq(key, e.getKey()) && eq(value, e.getValue()); + return o instanceof Map.Entry e + && eq(key, e.getKey()) + && eq(value, e.getValue()); } /** @@ -822,10 +820,9 @@ public V setValue(V value) { * @see #hashCode */ public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - return eq(key, e.getKey()) && eq(value, e.getValue()); + return o instanceof Map.Entry e + && eq(key, e.getKey()) + && eq(value, e.getValue()); } /** diff --git a/src/java.base/share/classes/java/util/BitSet.java b/src/java.base/share/classes/java/util/BitSet.java index 7eb4fb7425d..e0dc042bce6 100644 --- a/src/java.base/share/classes/java/util/BitSet.java +++ b/src/java.base/share/classes/java/util/BitSet.java @@ -1066,13 +1066,11 @@ public int size() { * @see #size() */ public boolean equals(Object obj) { - if (!(obj instanceof BitSet)) + if (!(obj instanceof BitSet set)) return false; if (this == obj) return true; - BitSet set = (BitSet) obj; - checkInvariants(); set.checkInvariants(); diff --git a/src/java.base/share/classes/java/util/Collections.java b/src/java.base/share/classes/java/util/Collections.java index 618edddaeee..473de05f9e5 100644 --- a/src/java.base/share/classes/java/util/Collections.java +++ b/src/java.base/share/classes/java/util/Collections.java @@ -1775,12 +1775,9 @@ public boolean equals(Object o) { if (o == this) return true; - if (!(o instanceof Set)) - return false; - Set s = (Set) o; - if (s.size() != c.size()) - return false; - return containsAll(s); // Invokes safe containsAll() above + return o instanceof Set s + && s.size() == c.size() + && containsAll(s); // Invokes safe containsAll() above } /** @@ -1805,11 +1802,9 @@ public V setValue(V value) { public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof Map.Entry)) - return false; - Map.Entry t = (Map.Entry)o; - return eq(e.getKey(), t.getKey()) && - eq(e.getValue(), t.getValue()); + return o instanceof Map.Entry t + && eq(e.getKey(), t.getKey()) + && eq(e.getValue(), t.getValue()); } public String toString() {return e.toString();} } @@ -3933,11 +3928,8 @@ public T[] toArray(T[] a) { * setValue method. */ public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry) o; - return s.contains( - (e instanceof CheckedEntry) ? e : checkedEntry(e, valueType)); + return o instanceof Map.Entry e + && s.contains((e instanceof CheckedEntry) ? e : checkedEntry(e, valueType)); } /** @@ -3981,11 +3973,9 @@ private boolean batchRemove(Collection c, boolean complement) { public boolean equals(Object o) { if (o == this) return true; - if (!(o instanceof Set)) - return false; - Set that = (Set) o; - return that.size() == s.size() - && containsAll(that); // Invokes safe containsAll() above + return o instanceof Set that + && that.size() == s.size() + && containsAll(that); // Invokes safe containsAll() above } static CheckedEntry checkedEntry(Map.Entry e, @@ -5251,8 +5241,7 @@ public int hashCode() { public boolean equals(Object o) { if (o == this) return true; - if (o instanceof CopiesList) { - CopiesList other = (CopiesList) o; + if (o instanceof CopiesList other) { return n == other.n && (n == 0 || eq(element, other.element)); } if (!(o instanceof List)) diff --git a/src/java.base/share/classes/java/util/EnumMap.java b/src/java.base/share/classes/java/util/EnumMap.java index 9b8697dab4d..f9e0fda832c 100644 --- a/src/java.base/share/classes/java/util/EnumMap.java +++ b/src/java.base/share/classes/java/util/EnumMap.java @@ -328,8 +328,7 @@ private boolean isValidKey(Object key) { * one or more keys in the specified map are null */ public void putAll(Map m) { - if (m instanceof EnumMap) { - EnumMap em = (EnumMap)m; + if (m instanceof EnumMap em) { if (em.keyType != keyType) { if (em.isEmpty()) return; @@ -473,16 +472,12 @@ public Iterator> iterator() { } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - return containsMapping(entry.getKey(), entry.getValue()); + return o instanceof Map.Entry entry + && containsMapping(entry.getKey(), entry.getValue()); } public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - return removeMapping(entry.getKey(), entry.getValue()); + return o instanceof Map.Entry entry + && removeMapping(entry.getKey(), entry.getValue()); } public int size() { return size; @@ -606,10 +601,9 @@ public boolean equals(Object o) { if (index < 0) return o == this; - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry e)) return false; - Map.Entry e = (Map.Entry)o; V ourValue = unmaskNull(vals[index]); Object hisValue = e.getValue(); return (e.getKey() == keyUniverse[index] && @@ -655,10 +649,9 @@ public boolean equals(Object o) { return true; if (o instanceof EnumMap) return equals((EnumMap)o); - if (!(o instanceof Map)) + if (!(o instanceof Map m)) return false; - Map m = (Map)o; if (size != m.size()) return false; diff --git a/src/java.base/share/classes/java/util/HashMap.java b/src/java.base/share/classes/java/util/HashMap.java index 77743d680cc..9715b6ea9b1 100644 --- a/src/java.base/share/classes/java/util/HashMap.java +++ b/src/java.base/share/classes/java/util/HashMap.java @@ -307,13 +307,10 @@ public final V setValue(V newValue) { public final boolean equals(Object o) { if (o == this) return true; - if (o instanceof Map.Entry) { - Map.Entry e = (Map.Entry)o; - if (Objects.equals(key, e.getKey()) && - Objects.equals(value, e.getValue())) - return true; - } - return false; + + return o instanceof Map.Entry e + && Objects.equals(key, e.getKey()) + && Objects.equals(value, e.getValue()); } } @@ -1100,16 +1097,14 @@ public final Iterator> iterator() { return new EntryIterator(); } public final boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry e)) return false; - Map.Entry e = (Map.Entry) o; Object key = e.getKey(); Node candidate = getNode(key); return candidate != null && candidate.equals(e); } public final boolean remove(Object o) { - if (o instanceof Map.Entry) { - Map.Entry e = (Map.Entry) o; + if (o instanceof Map.Entry e) { Object key = e.getKey(); Object value = e.getValue(); return removeNode(hash(key), key, value, true, true) != null; diff --git a/src/java.base/share/classes/java/util/Hashtable.java b/src/java.base/share/classes/java/util/Hashtable.java index 54ee3461670..c103df55790 100644 --- a/src/java.base/share/classes/java/util/Hashtable.java +++ b/src/java.base/share/classes/java/util/Hashtable.java @@ -714,9 +714,8 @@ public boolean add(Map.Entry o) { } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry entry)) return false; - Map.Entry entry = (Map.Entry)o; Object key = entry.getKey(); Entry[] tab = table; int hash = key.hashCode(); @@ -729,9 +728,8 @@ public boolean contains(Object o) { } public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry entry)) return false; - Map.Entry entry = (Map.Entry) o; Object key = entry.getKey(); Entry[] tab = table; int hash = key.hashCode(); @@ -816,9 +814,8 @@ public synchronized boolean equals(Object o) { if (o == this) return true; - if (!(o instanceof Map)) + if (!(o instanceof Map t)) return false; - Map t = (Map) o; if (t.size() != size()) return false; @@ -1393,9 +1390,8 @@ public V setValue(V value) { } public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry e)) return false; - Map.Entry e = (Map.Entry)o; return (key==null ? e.getKey()==null : key.equals(e.getKey())) && (value==null ? e.getValue()==null : value.equals(e.getValue())); diff --git a/src/java.base/share/classes/java/util/IdentityHashMap.java b/src/java.base/share/classes/java/util/IdentityHashMap.java index e7704d39281..34d6722ac09 100644 --- a/src/java.base/share/classes/java/util/IdentityHashMap.java +++ b/src/java.base/share/classes/java/util/IdentityHashMap.java @@ -642,8 +642,7 @@ public void clear() { public boolean equals(Object o) { if (o == this) { return true; - } else if (o instanceof IdentityHashMap) { - IdentityHashMap m = (IdentityHashMap) o; + } else if (o instanceof IdentityHashMap m) { if (m.size() != size) return false; @@ -654,8 +653,7 @@ public boolean equals(Object o) { return false; } return true; - } else if (o instanceof Map) { - Map m = (Map)o; + } else if (o instanceof Map m) { return entrySet().equals(m.entrySet()); } else { return false; // o is not a Map @@ -888,11 +886,9 @@ public boolean equals(Object o) { if (index < 0) return super.equals(o); - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - return (e.getKey() == unmaskNull(traversalTable[index]) && - e.getValue() == traversalTable[index+1]); + return o instanceof Map.Entry e + && e.getKey() == unmaskNull(traversalTable[index]) + && e.getValue() == traversalTable[index+1]; } public int hashCode() { @@ -1189,16 +1185,12 @@ public Iterator> iterator() { return new EntryIterator(); } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - return containsMapping(entry.getKey(), entry.getValue()); + return o instanceof Entry entry + && containsMapping(entry.getKey(), entry.getValue()); } public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - return removeMapping(entry.getKey(), entry.getValue()); + return o instanceof Entry entry + && removeMapping(entry.getKey(), entry.getValue()); } public int size() { return size; diff --git a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java index bd1cb51c660..19374b2e43f 100644 --- a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java +++ b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -886,7 +886,7 @@ public void roll(int field, int amount) { } else if (nfd >= (month1 + monthLength)) { nfd = month1 + monthLength - 1; } - set(DAY_OF_MONTH, (int)(nfd - month1) + 1); + set(DAY_OF_MONTH, getCalendarDate(nfd).getDayOfMonth()); return; } @@ -1458,7 +1458,7 @@ public int getActualMaximum(int field) { CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), date.getMonth(), 1); int dayOfWeek = gcal.getDayOfWeek(d); - int monthLength = gcal.getMonthLength(d); + int monthLength = actualMonthLength(); dayOfWeek -= getFirstDayOfWeek(); if (dayOfWeek < 0) { dayOfWeek += 7; @@ -2239,7 +2239,7 @@ private int monthLength(int month) { private int actualMonthLength() { int length = jcal.getMonthLength(jdate); int eraIndex = getTransitionEraIndex(jdate); - if (eraIndex == -1) { + if (eraIndex != -1) { long transitionFixedDate = sinceFixedDates[eraIndex]; CalendarDate d = eras[eraIndex].getSinceDate(); if (transitionFixedDate <= cachedFixedDate) { diff --git a/src/java.base/share/classes/java/util/JumboEnumSet.java b/src/java.base/share/classes/java/util/JumboEnumSet.java index ee2f3047660..f80e5056803 100644 --- a/src/java.base/share/classes/java/util/JumboEnumSet.java +++ b/src/java.base/share/classes/java/util/JumboEnumSet.java @@ -248,10 +248,9 @@ public boolean remove(Object e) { * @throws NullPointerException if the specified collection is null */ public boolean containsAll(Collection c) { - if (!(c instanceof JumboEnumSet)) + if (!(c instanceof JumboEnumSet es)) return super.containsAll(c); - JumboEnumSet es = (JumboEnumSet)c; if (es.elementType != elementType) return es.isEmpty(); @@ -270,10 +269,9 @@ public boolean containsAll(Collection c) { * its elements are null */ public boolean addAll(Collection c) { - if (!(c instanceof JumboEnumSet)) + if (!(c instanceof JumboEnumSet es)) return super.addAll(c); - JumboEnumSet es = (JumboEnumSet)c; if (es.elementType != elementType) { if (es.isEmpty()) return false; @@ -296,10 +294,9 @@ public boolean addAll(Collection c) { * @throws NullPointerException if the specified collection is null */ public boolean removeAll(Collection c) { - if (!(c instanceof JumboEnumSet)) + if (!(c instanceof JumboEnumSet es)) return super.removeAll(c); - JumboEnumSet es = (JumboEnumSet)c; if (es.elementType != elementType) return false; @@ -317,10 +314,9 @@ public boolean removeAll(Collection c) { * @throws NullPointerException if the specified collection is null */ public boolean retainAll(Collection c) { - if (!(c instanceof JumboEnumSet)) + if (!(c instanceof JumboEnumSet es)) return super.retainAll(c); - JumboEnumSet es = (JumboEnumSet)c; if (es.elementType != elementType) { boolean changed = (size != 0); clear(); @@ -350,10 +346,9 @@ public void clear() { * @return {@code true} if the specified object is equal to this set */ public boolean equals(Object o) { - if (!(o instanceof JumboEnumSet)) + if (!(o instanceof JumboEnumSet es)) return super.equals(o); - JumboEnumSet es = (JumboEnumSet)o; if (es.elementType != elementType) return size == 0 && es.size == 0; diff --git a/src/java.base/share/classes/java/util/KeyValueHolder.java b/src/java.base/share/classes/java/util/KeyValueHolder.java index 2333257f59b..9dbce9585e7 100644 --- a/src/java.base/share/classes/java/util/KeyValueHolder.java +++ b/src/java.base/share/classes/java/util/KeyValueHolder.java @@ -101,10 +101,9 @@ public V setValue(V value) { */ @Override public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - return key.equals(e.getKey()) && value.equals(e.getValue()); + return o instanceof Map.Entry e + && key.equals(e.getKey()) + && value.equals(e.getValue()); } /** diff --git a/src/java.base/share/classes/java/util/LinkedHashMap.java b/src/java.base/share/classes/java/util/LinkedHashMap.java index ee0d5546a13..92c5ff847ed 100644 --- a/src/java.base/share/classes/java/util/LinkedHashMap.java +++ b/src/java.base/share/classes/java/util/LinkedHashMap.java @@ -681,16 +681,14 @@ public final Iterator> iterator() { return new LinkedEntryIterator(); } public final boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry e)) return false; - Map.Entry e = (Map.Entry) o; Object key = e.getKey(); Node candidate = getNode(key); return candidate != null && candidate.equals(e); } public final boolean remove(Object o) { - if (o instanceof Map.Entry) { - Map.Entry e = (Map.Entry) o; + if (o instanceof Map.Entry e) { Object key = e.getKey(); Object value = e.getValue(); return removeNode(hash(key), key, value, true, true) != null; diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java index 44a4b8803dc..38e74eeb715 100644 --- a/src/java.base/share/classes/java/util/Locale.java +++ b/src/java.base/share/classes/java/util/Locale.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -444,18 +444,26 @@ * in Special Cases, only * for the two cases th_TH_TH and ja_JP_JP. * - *

Legacy language codes

+ *

Legacy language codes

* *

Locale's constructor has always converted three language codes to * their earlier, obsoleted forms: {@code he} maps to {@code iw}, * {@code yi} maps to {@code ji}, and {@code id} maps to - * {@code in}. This continues to be the case, in order to not break - * backwards compatibility. + * {@code in}. Since Java SE 17, this is no longer the case. Each + * language maps to its new form; {@code iw} maps to {@code he}, {@code ji} + * maps to {@code yi}, and {@code in} maps to {@code id}. + * + *

For the backward compatible behavior, the system property + * {@systemProperty java.locale.useOldISOCodes} reverts the behavior + * back to prior to Java SE 17 one. If the system property is set + * to {@code true}, those three current language codes are mapped to their + * backward compatible forms. * *

The APIs added in 1.7 map between the old and new language codes, - * maintaining the old codes internal to Locale (so that - * {@code getLanguage} and {@code toString} reflect the old - * code), but using the new codes in the BCP 47 language tag APIs (so + * maintaining the mapped codes internal to Locale (so that + * {@code getLanguage} and {@code toString} reflect the mapped + * code, which depends on the {@code java.locale.useOldISOCodes} system + * property), but using the new codes in the BCP 47 language tag APIs (so * that {@code toLanguageTag} reflects the new one). This * preserves the equivalence between Locales no matter which code or * API is used to construct them. Java's default resource bundle @@ -720,13 +728,11 @@ private Locale(BaseLocale baseLocale, LocaleExtensions extensions) { * Construct a locale from language, country and variant. * This constructor normalizes the language value to lowercase and * the country value to uppercase. - *

- * Note: + * @implNote *

    - *
  • ISO 639 is not a stable standard; some of the language codes it defines - * (specifically "iw", "ji", and "in") have changed. This constructor accepts both the - * old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other - * API on Locale will return only the OLD codes. + *
  • Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to + * their current forms. See Legacy language + * codes for more information. *
  • For backward compatibility reasons, this constructor does not make * any syntactic checks on the input. *
  • The two cases ("ja", "JP", "JP") and ("th", "TH", "TH") are handled specially, @@ -754,13 +760,11 @@ public Locale(String language, String country, String variant) { * Construct a locale from language and country. * This constructor normalizes the language value to lowercase and * the country value to uppercase. - *

    - * Note: + * @implNote *

      - *
    • ISO 639 is not a stable standard; some of the language codes it defines - * (specifically "iw", "ji", and "in") have changed. This constructor accepts both the - * old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other - * API on Locale will return only the OLD codes. + *
    • Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to + * their current forms. See Legacy language + * codes for more information. *
    • For backward compatibility reasons, this constructor does not make * any syntactic checks on the input. *
    @@ -779,13 +783,11 @@ public Locale(String language, String country) { /** * Construct a locale from a language code. * This constructor normalizes the language value to lowercase. - *

    - * Note: + * @implNote *

      - *
    • ISO 639 is not a stable standard; some of the language codes it defines - * (specifically "iw", "ji", and "in") have changed. This constructor accepts both the - * old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other - * API on Locale will return only the OLD codes. + *
    • Obsolete ISO 639 codes ("iw", "ji", and "in") are mapped to + * their current forms. See Legacy language + * codes for more information. *
    • For backward compatibility reasons, this constructor does not make * any syntactic checks on the input. *
    @@ -885,10 +887,9 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (!(obj instanceof LocaleKey)) { + if (!(obj instanceof LocaleKey other)) { return false; } - LocaleKey other = (LocaleKey)obj; if (hash != other.hash || !base.equals(other.base)) { return false; } @@ -1208,19 +1209,10 @@ private static String[] getISO2Table(String table) { /** * Returns the language code of this Locale. * - *

    Note: ISO 639 is not a stable standard— some languages' codes have changed. - * Locale's constructor recognizes both the new and the old codes for the languages - * whose codes have changed, but this function always returns the old code. If you - * want to check for a specific language whose code has changed, don't do - *

    -     * if (locale.getLanguage().equals("he")) // BAD!
    -     *    ...
    -     * 
    - * Instead, do - *
    -     * if (locale.getLanguage().equals(new Locale("he").getLanguage()))
    -     *    ...
    -     * 
    + * @implNote This method returns the new forms for the obsolete ISO 639 + * codes ("iw", "ji", and "in"). See + * Legacy language codes for more information. + * * @return The language code, or the empty string if none is defined. * @see #getDisplayLanguage */ @@ -1608,9 +1600,11 @@ public String toLanguageTag() { * *
  • The language code "und" is mapped to language "". * - *
  • The language codes "he", "yi", and "id" are mapped to "iw", - * "ji", and "in" respectively. (This is the same canonicalization - * that's done in Locale's constructors.) + *
  • The language codes "iw", "ji", and "in" are mapped to "he", + * "yi", and "id" respectively. (This is the same canonicalization + * that's done in Locale's constructors.) See + * Legacy language codes + * for more information. * *
  • The portion of a private use subtag prefixed by "lvariant", * if any, is removed and appended to the variant field in the @@ -2397,17 +2391,9 @@ private Object readResolve() throws java.io.ObjectStreamException { private static String convertOldISOCodes(String language) { // we accept both the old and the new ISO codes for the languages whose ISO - // codes have changed, but we always store the OLD code, for backward compatibility - language = LocaleUtils.toLowerString(language).intern(); - if (language == "he") { - return "iw"; - } else if (language == "yi") { - return "ji"; - } else if (language == "id") { - return "in"; - } else { - return language; - } + // codes have changed, but we always store the NEW code, unless the property + // java.locale.useOldISOCodes is set to "true" + return BaseLocale.convertOldISOCodes(LocaleUtils.toLowerString(language).intern()); } private static LocaleExtensions getCompatibilityExtensions(String language, @@ -3341,12 +3327,9 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (!(obj instanceof LanguageRange)) { - return false; - } - LanguageRange other = (LanguageRange)obj; - return range.equals(other.range) - && weight == other.weight; + return obj instanceof LanguageRange other + && range.equals(other.range) + && weight == other.weight; } /** diff --git a/src/java.base/share/classes/java/util/Optional.java b/src/java.base/share/classes/java/util/Optional.java index efb5bac4dce..64647ee49d5 100644 --- a/src/java.base/share/classes/java/util/Optional.java +++ b/src/java.base/share/classes/java/util/Optional.java @@ -423,12 +423,8 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof Optional)) { - return false; - } - - Optional other = (Optional) obj; - return Objects.equals(value, other.value); + return obj instanceof Optional other + && Objects.equals(value, other.value); } /** diff --git a/src/java.base/share/classes/java/util/OptionalDouble.java b/src/java.base/share/classes/java/util/OptionalDouble.java index 4e645c1aa79..61e54cfec29 100644 --- a/src/java.base/share/classes/java/util/OptionalDouble.java +++ b/src/java.base/share/classes/java/util/OptionalDouble.java @@ -295,14 +295,10 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof OptionalDouble)) { - return false; - } - - OptionalDouble other = (OptionalDouble) obj; - return (isPresent && other.isPresent) - ? Double.compare(value, other.value) == 0 - : isPresent == other.isPresent; + return obj instanceof OptionalDouble other + && (isPresent && other.isPresent + ? Double.compare(value, other.value) == 0 + : isPresent == other.isPresent); } /** diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java index 457273ca4ec..d693a3ddba2 100644 --- a/src/java.base/share/classes/java/util/OptionalInt.java +++ b/src/java.base/share/classes/java/util/OptionalInt.java @@ -293,14 +293,10 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof OptionalInt)) { - return false; - } - - OptionalInt other = (OptionalInt) obj; - return (isPresent && other.isPresent) + return obj instanceof OptionalInt other + && (isPresent && other.isPresent ? value == other.value - : isPresent == other.isPresent; + : isPresent == other.isPresent); } /** diff --git a/src/java.base/share/classes/java/util/OptionalLong.java b/src/java.base/share/classes/java/util/OptionalLong.java index 817b4b6f058..f92c5bdff17 100644 --- a/src/java.base/share/classes/java/util/OptionalLong.java +++ b/src/java.base/share/classes/java/util/OptionalLong.java @@ -293,14 +293,10 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof OptionalLong)) { - return false; - } - - OptionalLong other = (OptionalLong) obj; - return (isPresent && other.isPresent) + return obj instanceof OptionalLong other + && (isPresent && other.isPresent ? value == other.value - : isPresent == other.isPresent; + : isPresent == other.isPresent); } /** diff --git a/src/java.base/share/classes/java/util/PropertyPermission.java b/src/java.base/share/classes/java/util/PropertyPermission.java index 2124e9e8212..d3cd1a1226a 100644 --- a/src/java.base/share/classes/java/util/PropertyPermission.java +++ b/src/java.base/share/classes/java/util/PropertyPermission.java @@ -187,15 +187,11 @@ public PropertyPermission(String name, String actions) { */ @Override public boolean implies(Permission p) { - if (!(p instanceof PropertyPermission)) - return false; - - PropertyPermission that = (PropertyPermission) p; - // we get the effective mask. i.e., the "and" of this and that. // They must be equal to that.mask for implies to return true. - - return ((this.mask & that.mask) == that.mask) && super.implies(that); + return p instanceof PropertyPermission that + && ((this.mask & that.mask) == that.mask) + && super.implies(that); } /** @@ -211,13 +207,9 @@ public boolean equals(Object obj) { if (obj == this) return true; - if (! (obj instanceof PropertyPermission)) - return false; - - PropertyPermission that = (PropertyPermission) obj; - - return (this.mask == that.mask) && - (this.getName().equals(that.getName())); + return obj instanceof PropertyPermission that + && this.mask == that.mask + && this.getName().equals(that.getName()); } /** @@ -471,14 +463,13 @@ public PropertyPermissionCollection() { */ @Override public void add(Permission permission) { - if (! (permission instanceof PropertyPermission)) + if (! (permission instanceof PropertyPermission pp)) throw new IllegalArgumentException("invalid permission: "+ permission); if (isReadOnly()) throw new SecurityException( "attempt to add a Permission to a readonly PermissionCollection"); - PropertyPermission pp = (PropertyPermission) permission; String propName = pp.getName(); // Add permission to map if it is absent, or replace with new @@ -523,10 +514,9 @@ public PropertyPermission apply(PropertyPermission existingVal, */ @Override public boolean implies(Permission permission) { - if (! (permission instanceof PropertyPermission)) + if (! (permission instanceof PropertyPermission pp)) return false; - PropertyPermission pp = (PropertyPermission) permission; PropertyPermission x; int desired = pp.getMask(); diff --git a/src/java.base/share/classes/java/util/RegularEnumSet.java b/src/java.base/share/classes/java/util/RegularEnumSet.java index 98faa964aa7..1deda8a2935 100644 --- a/src/java.base/share/classes/java/util/RegularEnumSet.java +++ b/src/java.base/share/classes/java/util/RegularEnumSet.java @@ -196,10 +196,9 @@ public boolean remove(Object e) { * @throws NullPointerException if the specified collection is null */ public boolean containsAll(Collection c) { - if (!(c instanceof RegularEnumSet)) + if (!(c instanceof RegularEnumSet es)) return super.containsAll(c); - RegularEnumSet es = (RegularEnumSet)c; if (es.elementType != elementType) return es.isEmpty(); @@ -215,10 +214,9 @@ public boolean containsAll(Collection c) { * of its elements are null */ public boolean addAll(Collection c) { - if (!(c instanceof RegularEnumSet)) + if (!(c instanceof RegularEnumSet es)) return super.addAll(c); - RegularEnumSet es = (RegularEnumSet)c; if (es.elementType != elementType) { if (es.isEmpty()) return false; @@ -241,10 +239,9 @@ public boolean addAll(Collection c) { * @throws NullPointerException if the specified collection is null */ public boolean removeAll(Collection c) { - if (!(c instanceof RegularEnumSet)) + if (!(c instanceof RegularEnumSet es)) return super.removeAll(c); - RegularEnumSet es = (RegularEnumSet)c; if (es.elementType != elementType) return false; @@ -262,10 +259,9 @@ public boolean removeAll(Collection c) { * @throws NullPointerException if the specified collection is null */ public boolean retainAll(Collection c) { - if (!(c instanceof RegularEnumSet)) + if (!(c instanceof RegularEnumSet es)) return super.retainAll(c); - RegularEnumSet es = (RegularEnumSet)c; if (es.elementType != elementType) { boolean changed = (elements != 0); elements = 0; @@ -294,10 +290,9 @@ public void clear() { * @return {@code true} if the specified object is equal to this set */ public boolean equals(Object o) { - if (!(o instanceof RegularEnumSet)) + if (!(o instanceof RegularEnumSet es)) return super.equals(o); - RegularEnumSet es = (RegularEnumSet)o; if (es.elementType != elementType) return elements == 0 && es.elements == 0; return es.elements == elements; diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index 2b22140311c..d00837881f5 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -72,6 +72,8 @@ import sun.security.action.GetPropertyAction; import sun.util.locale.BaseLocale; import sun.util.locale.LocaleObjectCache; +import sun.util.resources.Bundles; + import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION; @@ -3098,6 +3100,12 @@ public Locale getFallbackLocale(String baseName, Locale locale) { * nor {@code "java.properties"}, an * {@code IllegalArgumentException} is thrown.
  • * + *
  • If the {@code locale}'s language is one of the + * Legacy language + * codes, either old or new, then repeat the loading process + * if needed, with the bundle name with the other language. + * For example, "iw" for "he" and vice versa. + * *
* * @param baseName @@ -3152,6 +3160,21 @@ public ResourceBundle newBundle(String baseName, Locale locale, String format, * that is visible to the given loader and accessible to the given caller. */ String bundleName = toBundleName(baseName, locale); + var bundle = newBundle0(bundleName, format, loader, reload); + if (bundle == null) { + // Try loading legacy ISO language's other bundles + var otherBundleName = Bundles.toOtherBundleName(baseName, bundleName, locale); + if (!bundleName.equals(otherBundleName)) { + bundle = newBundle0(otherBundleName, format, loader, reload); + } + } + + return bundle; + } + + private ResourceBundle newBundle0(String bundleName, String format, + ClassLoader loader, boolean reload) + throws IllegalAccessException, InstantiationException, IOException { ResourceBundle bundle = null; if (format.equals("java.class")) { try { diff --git a/src/java.base/share/classes/java/util/Scanner.java b/src/java.base/share/classes/java/util/Scanner.java index 60290b94e10..9ad509935c0 100644 --- a/src/java.base/share/classes/java/util/Scanner.java +++ b/src/java.base/share/classes/java/util/Scanner.java @@ -2664,9 +2664,8 @@ public BigInteger nextBigInteger() { */ public BigInteger nextBigInteger(int radix) { // Check cached result - if ((typeCache != null) && (typeCache instanceof BigInteger) + if ((typeCache != null) && (typeCache instanceof BigInteger val) && this.radix == radix) { - BigInteger val = (BigInteger)typeCache; useTypeCache(); return val; } @@ -2730,8 +2729,7 @@ public boolean hasNextBigDecimal() { */ public BigDecimal nextBigDecimal() { // Check cached result - if ((typeCache != null) && (typeCache instanceof BigDecimal)) { - BigDecimal val = (BigDecimal)typeCache; + if ((typeCache != null) && (typeCache instanceof BigDecimal val)) { useTypeCache(); return val; } diff --git a/src/java.base/share/classes/java/util/ServiceLoader.java b/src/java.base/share/classes/java/util/ServiceLoader.java index 559b441006c..8cf86bccb7c 100644 --- a/src/java.base/share/classes/java/util/ServiceLoader.java +++ b/src/java.base/share/classes/java/util/ServiceLoader.java @@ -818,11 +818,8 @@ public int hashCode() { @Override public boolean equals(Object ob) { - if (!(ob instanceof ProviderImpl)) - return false; - @SuppressWarnings("unchecked") - ProviderImpl that = (ProviderImpl)ob; - return this.service == that.service + return ob instanceof @SuppressWarnings("unchecked")ProviderImpl that + && this.service == that.service && this.type == that.type && Objects.equals(this.acc, that.acc); } diff --git a/src/java.base/share/classes/java/util/SimpleTimeZone.java b/src/java.base/share/classes/java/util/SimpleTimeZone.java index e2e1567306f..d85fea6439c 100644 --- a/src/java.base/share/classes/java/util/SimpleTimeZone.java +++ b/src/java.base/share/classes/java/util/SimpleTimeZone.java @@ -878,19 +878,14 @@ public int hashCode() * @return True if the given {@code obj} is the same as this * {@code SimpleTimeZone} object; false otherwise. */ - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (this == obj) { return true; } - if (!(obj instanceof SimpleTimeZone)) { - return false; - } - SimpleTimeZone that = (SimpleTimeZone) obj; - - return getID().equals(that.getID()) && - hasSameRules(that); + return obj instanceof SimpleTimeZone that + && getID().equals(that.getID()) + && hasSameRules(that); } /** @@ -904,28 +899,26 @@ public boolean hasSameRules(TimeZone other) { if (this == other) { return true; } - if (!(other instanceof SimpleTimeZone)) { - return false; - } - SimpleTimeZone that = (SimpleTimeZone) other; - return rawOffset == that.rawOffset && - useDaylight == that.useDaylight && - (!useDaylight - // Only check rules if using DST - || (dstSavings == that.dstSavings && - startMode == that.startMode && - startMonth == that.startMonth && - startDay == that.startDay && - startDayOfWeek == that.startDayOfWeek && - startTime == that.startTime && - startTimeMode == that.startTimeMode && - endMode == that.endMode && - endMonth == that.endMonth && - endDay == that.endDay && - endDayOfWeek == that.endDayOfWeek && - endTime == that.endTime && - endTimeMode == that.endTimeMode && - startYear == that.startYear)); + return other instanceof SimpleTimeZone that + && rawOffset == that.rawOffset + && useDaylight == that.useDaylight + && (!useDaylight || + // Only check rules if using DST + (dstSavings == that.dstSavings + && startMode == that.startMode + && startMonth == that.startMonth + && startDay == that.startDay + && startDayOfWeek == that.startDayOfWeek + && startTime == that.startTime + && startTimeMode == that.startTimeMode + && endMode == that.endMode + && endMonth == that.endMonth + && endDay == that.endDay + && endDayOfWeek == that.endDayOfWeek + && endTime == that.endTime + && endTimeMode == that.endTimeMode + && startYear == that.startYear) + ); } /** diff --git a/src/java.base/share/classes/java/util/Spliterators.java b/src/java.base/share/classes/java/util/Spliterators.java index 3b5fe860535..c5d9bd7c85d 100644 --- a/src/java.base/share/classes/java/util/Spliterators.java +++ b/src/java.base/share/classes/java/util/Spliterators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -688,8 +688,22 @@ public T next() { throw new NoSuchElementException(); else { valueReady = false; - return nextElement; + T t = nextElement; + nextElement = null; + return t; + } + } + + @Override + public void forEachRemaining(Consumer action) { + Objects.requireNonNull(action); + if (valueReady) { + valueReady = false; + T t = nextElement; + nextElement = null; + action.accept(t); } + spliterator.forEachRemaining(action); } } @@ -736,6 +750,16 @@ public int nextInt() { return nextElement; } } + + @Override + public void forEachRemaining(IntConsumer action) { + Objects.requireNonNull(action); + if (valueReady) { + valueReady = false; + action.accept(nextElement); + } + spliterator.forEachRemaining(action); + } } return new Adapter(); @@ -781,6 +805,16 @@ public long nextLong() { return nextElement; } } + + @Override + public void forEachRemaining(LongConsumer action) { + Objects.requireNonNull(action); + if (valueReady) { + valueReady = false; + action.accept(nextElement); + } + spliterator.forEachRemaining(action); + } } return new Adapter(); @@ -826,6 +860,16 @@ public double nextDouble() { return nextElement; } } + + @Override + public void forEachRemaining(DoubleConsumer action) { + Objects.requireNonNull(action); + if (valueReady) { + valueReady = false; + action.accept(nextElement); + } + spliterator.forEachRemaining(action); + } } return new Adapter(); @@ -1843,7 +1887,7 @@ public Comparator getComparator() { static final class IntIteratorSpliterator implements Spliterator.OfInt { static final int BATCH_UNIT = IteratorSpliterator.BATCH_UNIT; static final int MAX_BATCH = IteratorSpliterator.MAX_BATCH; - private PrimitiveIterator.OfInt it; + private final PrimitiveIterator.OfInt it; private final int characteristics; private long est; // size estimate private int batch; // batch size for splits @@ -1937,7 +1981,7 @@ public Comparator getComparator() { static final class LongIteratorSpliterator implements Spliterator.OfLong { static final int BATCH_UNIT = IteratorSpliterator.BATCH_UNIT; static final int MAX_BATCH = IteratorSpliterator.MAX_BATCH; - private PrimitiveIterator.OfLong it; + private final PrimitiveIterator.OfLong it; private final int characteristics; private long est; // size estimate private int batch; // batch size for splits @@ -2031,7 +2075,7 @@ public Comparator getComparator() { static final class DoubleIteratorSpliterator implements Spliterator.OfDouble { static final int BATCH_UNIT = IteratorSpliterator.BATCH_UNIT; static final int MAX_BATCH = IteratorSpliterator.MAX_BATCH; - private PrimitiveIterator.OfDouble it; + private final PrimitiveIterator.OfDouble it; private final int characteristics; private long est; // size estimate private int batch; // batch size for splits diff --git a/src/java.base/share/classes/java/util/TreeMap.java b/src/java.base/share/classes/java/util/TreeMap.java index a8830216d78..a0ab02df9e6 100644 --- a/src/java.base/share/classes/java/util/TreeMap.java +++ b/src/java.base/share/classes/java/util/TreeMap.java @@ -1341,18 +1341,16 @@ public Iterator> iterator() { } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry entry)) return false; - Map.Entry entry = (Map.Entry) o; Object value = entry.getValue(); Entry p = getEntry(entry.getKey()); return p != null && valEquals(p.getValue(), value); } public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry entry)) return false; - Map.Entry entry = (Map.Entry) o; Object value = entry.getValue(); Entry p = getEntry(entry.getKey()); if (p != null && valEquals(p.getValue(), value)) { @@ -1963,9 +1961,8 @@ public boolean isEmpty() { } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Entry entry)) return false; - Map.Entry entry = (Map.Entry) o; Object key = entry.getKey(); if (!inRange(key)) return false; @@ -1975,9 +1972,8 @@ public boolean contains(Object o) { } public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Entry entry)) return false; - Map.Entry entry = (Map.Entry) o; Object key = entry.getKey(); if (!inRange(key)) return false; @@ -2425,11 +2421,9 @@ public V setValue(V value) { } public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - - return valEquals(key,e.getKey()) && valEquals(value,e.getValue()); + return o instanceof Map.Entry e + && valEquals(key,e.getKey()) + && valEquals(value,e.getValue()); } public int hashCode() { diff --git a/src/java.base/share/classes/java/util/TreeSet.java b/src/java.base/share/classes/java/util/TreeSet.java index 1dc96daf1ae..f189bb4a9f2 100644 --- a/src/java.base/share/classes/java/util/TreeSet.java +++ b/src/java.base/share/classes/java/util/TreeSet.java @@ -299,9 +299,8 @@ public boolean addAll(Collection c) { // Use linear-time version if applicable if (m.size()==0 && c.size() > 0 && c instanceof SortedSet && - m instanceof TreeMap) { + m instanceof TreeMap map) { SortedSet set = (SortedSet) c; - TreeMap map = (TreeMap) m; if (Objects.equals(set.comparator(), map.comparator())) { map.addAllForTreeSet(set, PRESENT); return true; diff --git a/src/java.base/share/classes/java/util/WeakHashMap.java b/src/java.base/share/classes/java/util/WeakHashMap.java index 1f4a445eb12..03aee09e992 100644 --- a/src/java.base/share/classes/java/util/WeakHashMap.java +++ b/src/java.base/share/classes/java/util/WeakHashMap.java @@ -619,10 +619,9 @@ public V remove(Object key) { /** Special version of remove needed by Entry set */ boolean removeMapping(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry entry)) return false; Entry[] tab = getTable(); - Map.Entry entry = (Map.Entry)o; Object k = maskNull(entry.getKey()); int h = hash(k); int i = indexFor(h, tab.length); @@ -737,9 +736,8 @@ public V setValue(V newValue) { } public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) + if (!(o instanceof Map.Entry e)) return false; - Map.Entry e = (Map.Entry)o; K k1 = getKey(); Object k2 = e.getKey(); if (k1 == k2 || (k1 != null && k1.equals(k2))) { @@ -977,11 +975,9 @@ public Iterator> iterator() { } public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - Entry candidate = getEntry(e.getKey()); - return candidate != null && candidate.equals(e); + return o instanceof Map.Entry e + && getEntry(e.getKey()) != null + && getEntry(e.getKey()).equals(e); } public boolean remove(Object o) { diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index 1699771992c..b68ada2fea0 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -40,7 +40,6 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.Objects; import java.util.function.IntBinaryOperator; import java.util.function.IntUnaryOperator; import jdk.internal.misc.Unsafe; @@ -456,7 +455,7 @@ private static boolean isAncestor(ClassLoader first, ClassLoader second) { */ private static boolean isSamePackage(Class class1, Class class2) { return class1.getClassLoader() == class2.getClassLoader() - && Objects.equals(class1.getPackageName(), class2.getPackageName()); + && class1.getPackageName() == class2.getPackageName(); } /** diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index cd8565492dc..9ded377a92a 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -40,7 +40,6 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.Objects; import java.util.function.LongBinaryOperator; import java.util.function.LongUnaryOperator; import jdk.internal.misc.Unsafe; @@ -656,6 +655,6 @@ static boolean isAncestor(ClassLoader first, ClassLoader second) { */ static boolean isSamePackage(Class class1, Class class2) { return class1.getClassLoader() == class2.getClassLoader() - && Objects.equals(class1.getPackageName(), class2.getPackageName()); + && class1.getPackageName() == class2.getPackageName(); } } diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index fea91ff0ab2..4339ed98976 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -40,7 +40,6 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.Objects; import java.util.function.BinaryOperator; import java.util.function.UnaryOperator; import jdk.internal.misc.Unsafe; @@ -397,7 +396,7 @@ private static boolean isAncestor(ClassLoader first, ClassLoader second) { */ private static boolean isSamePackage(Class class1, Class class2) { return class1.getClassLoader() == class2.getClassLoader() - && Objects.equals(class1.getPackageName(), class2.getPackageName()); + && class1.getPackageName() == class2.getPackageName(); } /** diff --git a/src/java.base/share/classes/java/util/jar/Attributes.java b/src/java.base/share/classes/java/util/jar/Attributes.java index d2cd77d5a3b..a33d1086285 100644 --- a/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/src/java.base/share/classes/java/util/jar/Attributes.java @@ -514,12 +514,8 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (o instanceof Name) { - Name other = (Name)o; - return other.name.equalsIgnoreCase(name); - } else { - return false; - } + return o instanceof Name other + && other.name.equalsIgnoreCase(name); } /** diff --git a/src/java.base/share/classes/java/util/jar/JarVerifier.java b/src/java.base/share/classes/java/util/jar/JarVerifier.java index 4387cc1dd43..1c110166754 100644 --- a/src/java.base/share/classes/java/util/jar/JarVerifier.java +++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java @@ -551,10 +551,9 @@ private CodeSource[] mapSignersToCodeSources(URL url, List signers * Match CodeSource to a CodeSigner[] in the signer cache. */ private CodeSigner[] findMatchingSigners(CodeSource cs) { - if (cs instanceof VerifierCodeSource) { - VerifierCodeSource vcs = (VerifierCodeSource) cs; + if (cs instanceof VerifierCodeSource vcs) { if (vcs.isSameDomain(csdomain)) { - return ((VerifierCodeSource) cs).getPrivateSigners(); + return vcs.getPrivateSigners(); } } @@ -617,8 +616,7 @@ public boolean equals(Object obj) { if (obj == this) { return true; } - if (obj instanceof VerifierCodeSource) { - VerifierCodeSource that = (VerifierCodeSource) obj; + if (obj instanceof VerifierCodeSource that) { /* * Only compare against other per-signer singletons constructed diff --git a/src/java.base/share/classes/java/util/jar/Manifest.java b/src/java.base/share/classes/java/util/jar/Manifest.java index fc2e5f03d88..d20d6121f47 100644 --- a/src/java.base/share/classes/java/util/jar/Manifest.java +++ b/src/java.base/share/classes/java/util/jar/Manifest.java @@ -379,13 +379,9 @@ private int toLower(int c) { * the same main Attributes and entries */ public boolean equals(Object o) { - if (o instanceof Manifest) { - Manifest m = (Manifest)o; - return attr.equals(m.getMainAttributes()) && - entries.equals(m.getEntries()); - } else { - return false; - } + return o instanceof Manifest m + && attr.equals(m.getMainAttributes()) + && entries.equals(m.getEntries()); } /** diff --git a/src/java.base/share/classes/java/util/regex/Pattern.java b/src/java.base/share/classes/java/util/regex/Pattern.java index 33b31d5d3e8..13bc0f60c8b 100644 --- a/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/src/java.base/share/classes/java/util/regex/Pattern.java @@ -3083,8 +3083,7 @@ private Node group0() { if (saveTCNCount < topClosureNodes.size()) topClosureNodes.subList(saveTCNCount, topClosureNodes.size()).clear(); - if (node instanceof Ques) { - Ques ques = (Ques) node; + if (node instanceof Ques ques) { if (ques.type == Qtype.POSSESSIVE) { root = node; return node; @@ -3098,8 +3097,7 @@ private Node group0() { } root = tail; return head; - } else if (node instanceof Curly) { - Curly curly = (Curly) node; + } else if (node instanceof Curly curly) { if (curly.type == Qtype.POSSESSIVE) { root = node; return node; diff --git a/src/java.base/share/classes/java/util/regex/PrintPattern.java b/src/java.base/share/classes/java/util/regex/PrintPattern.java index 40ef4eec496..5dc585d2a22 100644 --- a/src/java.base/share/classes/java/util/regex/PrintPattern.java +++ b/src/java.base/share/classes/java/util/regex/PrintPattern.java @@ -131,21 +131,18 @@ static void walk(Pattern.Node node, int depth) { node = loop; } else if (node instanceof Pattern.Loop) { return; // stop here, body.next -> loop - } else if (node instanceof Pattern.Curly) { - Pattern.Curly c = (Pattern.Curly)node; + } else if (node instanceof Pattern.Curly c) { str = "Curly " + c.type + " " + toStringRange(c.cmin, c.cmax); print(node, str, depth); walk(c.atom, depth); print("/Curly", depth); - } else if (node instanceof Pattern.GroupCurly) { - Pattern.GroupCurly gc = (Pattern.GroupCurly)node; + } else if (node instanceof Pattern.GroupCurly gc) { str = "GroupCurly " + gc.groupIndex / 2 + ", " + gc.type + " " + toStringRange(gc.cmin, gc.cmax); print(node, str, depth); walk(gc.atom, depth); print("/GroupCurly", depth); - } else if (node instanceof Pattern.GroupHead) { - Pattern.GroupHead head = (Pattern.GroupHead)node; + } else if (node instanceof Pattern.GroupHead head) { Pattern.GroupTail tail = head.tail; print(head, "Group.head " + (tail.groupIndex / 2), depth); walk(head.next, depth); @@ -157,8 +154,7 @@ static void walk(Pattern.Node node, int depth) { print(node, "Ques " + ((Pattern.Ques)node).type, depth); walk(((Pattern.Ques)node).atom, depth); print("/Ques", depth); - } else if (node instanceof Pattern.Branch) { - Pattern.Branch b = (Pattern.Branch)node; + } else if (node instanceof Pattern.Branch b) { print(b, name, depth); int i = 0; while (true) { @@ -186,8 +182,7 @@ static void walk(Pattern.Node node, int depth) { str = name + " \"" + toStringCPS(((Pattern.SliceNode)node).buffer) + "\""; print(node, str, depth); - } else if (node instanceof Pattern.CharPropertyGreedy) { - Pattern.CharPropertyGreedy gcp = (Pattern.CharPropertyGreedy)node; + } else if (node instanceof Pattern.CharPropertyGreedy gcp) { String pstr = pmap.get(gcp.predicate); if (pstr == null) pstr = gcp.predicate.toString(); diff --git a/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java b/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java index b43a886a710..11ddf7b4283 100644 --- a/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java +++ b/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,6 +27,7 @@ import jdk.internal.access.JavaUtilResourceBundleAccess; import jdk.internal.access.SharedSecrets; +import sun.util.resources.Bundles; import java.io.IOException; import java.io.InputStream; @@ -187,6 +188,17 @@ protected String toBundleName(String baseName, Locale locale) { public ResourceBundle getBundle(String baseName, Locale locale) { Module module = this.getClass().getModule(); String bundleName = toBundleName(baseName, locale); + var bundle = getBundle0(module, bundleName); + if (bundle == null) { + var otherBundleName = Bundles.toOtherBundleName(baseName, bundleName, locale); + if (!bundleName.equals(otherBundleName)) { + bundle = getBundle0(module, Bundles.toOtherBundleName(baseName, bundleName, locale)); + } + } + return bundle; + } + + private ResourceBundle getBundle0(Module module, String bundleName) { ResourceBundle bundle = null; for (String format : formats) { diff --git a/src/java.base/share/classes/java/util/stream/AbstractPipeline.java b/src/java.base/share/classes/java/util/stream/AbstractPipeline.java index a313b64589d..2e18ef02094 100644 --- a/src/java.base/share/classes/java/util/stream/AbstractPipeline.java +++ b/src/java.base/share/classes/java/util/stream/AbstractPipeline.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -466,7 +466,32 @@ final StreamShape getSourceShape() { @Override final long exactOutputSizeIfKnown(Spliterator spliterator) { - return StreamOpFlag.SIZED.isKnown(getStreamAndOpFlags()) ? spliterator.getExactSizeIfKnown() : -1; + int flags = getStreamAndOpFlags(); + long size = StreamOpFlag.SIZED.isKnown(flags) ? spliterator.getExactSizeIfKnown() : -1; + // Currently, we have no stateless SIZE_ADJUSTING intermediate operations, + // so we can simply ignore SIZE_ADJUSTING in parallel streams, since adjustments + // are already accounted in the input spliterator. + // + // If we ever have a stateless SIZE_ADJUSTING intermediate operation, + // we would need step back until depth == 0, then call exactOutputSize() for + // the subsequent stages. + if (size != -1 && StreamOpFlag.SIZE_ADJUSTING.isKnown(flags) && !isParallel()) { + // Skip the source stage as it's never SIZE_ADJUSTING + for (AbstractPipeline stage = sourceStage.nextStage; stage != null; stage = stage.nextStage) { + size = stage.exactOutputSize(size); + } + } + return size; + } + + /** + * Returns the exact output size of the pipeline given the exact size reported by the previous stage. + * + * @param previousSize the exact size reported by the previous stage + * @return the output size of this stage + */ + long exactOutputSize(long previousSize) { + return previousSize; } @Override diff --git a/src/java.base/share/classes/java/util/stream/PipelineHelper.java b/src/java.base/share/classes/java/util/stream/PipelineHelper.java index 8d989930386..7503bb6bf56 100644 --- a/src/java.base/share/classes/java/util/stream/PipelineHelper.java +++ b/src/java.base/share/classes/java/util/stream/PipelineHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -82,7 +82,8 @@ abstract class PipelineHelper { * The exact output size is known if the {@code Spliterator} has the * {@code SIZED} characteristic, and the operation flags * {@link StreamOpFlag#SIZED} is known on the combined stream and operation - * flags. + * flags. The exact output size may differ from spliterator size, + * if pipeline contains a slice operation. * * @param spliterator the spliterator describing the relevant portion of the * source data diff --git a/src/java.base/share/classes/java/util/stream/ReduceOps.java b/src/java.base/share/classes/java/util/stream/ReduceOps.java index e1778225b3a..64c94ef35fd 100644 --- a/src/java.base/share/classes/java/util/stream/ReduceOps.java +++ b/src/java.base/share/classes/java/util/stream/ReduceOps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -252,16 +252,18 @@ public ReducingSink makeSink() { @Override public Long evaluateSequential(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateSequential(helper, spliterator); } @Override public Long evaluateParallel(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateParallel(helper, spliterator); } @@ -426,16 +428,18 @@ public ReducingSink makeSink() { @Override public Long evaluateSequential(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateSequential(helper, spliterator); } @Override public Long evaluateParallel(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateParallel(helper, spliterator); } @@ -600,16 +604,18 @@ public ReducingSink makeSink() { @Override public Long evaluateSequential(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateSequential(helper, spliterator); } @Override public Long evaluateParallel(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateParallel(helper, spliterator); } @@ -774,16 +780,18 @@ public ReducingSink makeSink() { @Override public Long evaluateSequential(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateSequential(helper, spliterator); } @Override public Long evaluateParallel(PipelineHelper helper, Spliterator spliterator) { - if (StreamOpFlag.SIZED.isKnown(helper.getStreamAndOpFlags())) - return spliterator.getExactSizeIfKnown(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size != -1) + return size; return super.evaluateParallel(helper, spliterator); } diff --git a/src/java.base/share/classes/java/util/stream/SliceOps.java b/src/java.base/share/classes/java/util/stream/SliceOps.java index e771b1f00f6..7dbc2e52edb 100644 --- a/src/java.base/share/classes/java/util/stream/SliceOps.java +++ b/src/java.base/share/classes/java/util/stream/SliceOps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -50,7 +50,7 @@ private SliceOps() { } * @return the sliced size */ private static long calcSize(long size, long skip, long limit) { - return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1; + return size >= 0 ? Math.max(0, Math.min(size - skip, limit)) : -1; } /** @@ -72,28 +72,23 @@ private static long calcSliceFence(long skip, long limit) { * spliterator type. Requires that the underlying Spliterator * be SUBSIZED. */ - @SuppressWarnings("unchecked") private static Spliterator sliceSpliterator(StreamShape shape, Spliterator s, long skip, long limit) { assert s.hasCharacteristics(Spliterator.SUBSIZED); long sliceFence = calcSliceFence(skip, limit); - switch (shape) { - case REFERENCE: - return new StreamSpliterators - .SliceSpliterator.OfRef<>(s, skip, sliceFence); - case INT_VALUE: - return (Spliterator) new StreamSpliterators - .SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence); - case LONG_VALUE: - return (Spliterator) new StreamSpliterators - .SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence); - case DOUBLE_VALUE: - return (Spliterator) new StreamSpliterators - .SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence); - default: - throw new IllegalStateException("Unknown shape " + shape); - } + @SuppressWarnings("unchecked") + Spliterator sliceSpliterator = (Spliterator) switch (shape) { + case REFERENCE + -> new StreamSpliterators.SliceSpliterator.OfRef<>(s, skip, sliceFence); + case INT_VALUE + -> new StreamSpliterators.SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence); + case LONG_VALUE + -> new StreamSpliterators.SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence); + case DOUBLE_VALUE + -> new StreamSpliterators.SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence); + }; + return sliceSpliterator; } /** @@ -110,9 +105,15 @@ public static Stream makeRef(AbstractPipeline upstream, long skip, long limit) { if (skip < 0) throw new IllegalArgumentException("Skip must be non-negative: " + skip); + long normalizedLimit = limit >= 0 ? limit : Long.MAX_VALUE; return new ReferencePipeline.StatefulOp(upstream, StreamShape.REFERENCE, flags(limit)) { + @Override + long exactOutputSize(long previousSize) { + return calcSize(previousSize, skip, normalizedLimit); + } + Spliterator unorderedSkipLimitSpliterator(Spliterator s, long skip, long limit, long sizeIfKnown) { if (skip <= sizeIfKnown) { @@ -182,9 +183,9 @@ Node opEvaluateParallel(PipelineHelper helper, @Override Sink opWrapSink(int flags, Sink sink) { - return new Sink.ChainedReference(sink) { + return new Sink.ChainedReference<>(sink) { long n = skip; - long m = limit >= 0 ? limit : Long.MAX_VALUE; + long m = normalizedLimit; @Override public void begin(long size) { @@ -226,9 +227,15 @@ public static IntStream makeInt(AbstractPipeline upstream, long skip, long limit) { if (skip < 0) throw new IllegalArgumentException("Skip must be non-negative: " + skip); + long normalizedLimit = limit >= 0 ? limit : Long.MAX_VALUE; return new IntPipeline.StatefulOp(upstream, StreamShape.INT_VALUE, flags(limit)) { + @Override + long exactOutputSize(long previousSize) { + return calcSize(previousSize, skip, normalizedLimit); + } + Spliterator.OfInt unorderedSkipLimitSpliterator( Spliterator.OfInt s, long skip, long limit, long sizeIfKnown) { if (skip <= sizeIfKnown) { @@ -291,9 +298,9 @@ Node opEvaluateParallel(PipelineHelper helper, @Override Sink opWrapSink(int flags, Sink sink) { - return new Sink.ChainedInt(sink) { + return new Sink.ChainedInt<>(sink) { long n = skip; - long m = limit >= 0 ? limit : Long.MAX_VALUE; + long m = normalizedLimit; @Override public void begin(long size) { @@ -335,9 +342,15 @@ public static LongStream makeLong(AbstractPipeline upstream, long skip, long limit) { if (skip < 0) throw new IllegalArgumentException("Skip must be non-negative: " + skip); + long normalizedLimit = limit >= 0 ? limit : Long.MAX_VALUE; return new LongPipeline.StatefulOp(upstream, StreamShape.LONG_VALUE, flags(limit)) { + @Override + long exactOutputSize(long previousSize) { + return calcSize(previousSize, skip, normalizedLimit); + } + Spliterator.OfLong unorderedSkipLimitSpliterator( Spliterator.OfLong s, long skip, long limit, long sizeIfKnown) { if (skip <= sizeIfKnown) { @@ -400,9 +413,9 @@ Node opEvaluateParallel(PipelineHelper helper, @Override Sink opWrapSink(int flags, Sink sink) { - return new Sink.ChainedLong(sink) { + return new Sink.ChainedLong<>(sink) { long n = skip; - long m = limit >= 0 ? limit : Long.MAX_VALUE; + long m = normalizedLimit; @Override public void begin(long size) { @@ -444,9 +457,15 @@ public static DoubleStream makeDouble(AbstractPipeline upstream, long skip, long limit) { if (skip < 0) throw new IllegalArgumentException("Skip must be non-negative: " + skip); + long normalizedLimit = limit >= 0 ? limit : Long.MAX_VALUE; return new DoublePipeline.StatefulOp(upstream, StreamShape.DOUBLE_VALUE, flags(limit)) { + @Override + long exactOutputSize(long previousSize) { + return calcSize(previousSize, skip, normalizedLimit); + } + Spliterator.OfDouble unorderedSkipLimitSpliterator( Spliterator.OfDouble s, long skip, long limit, long sizeIfKnown) { if (skip <= sizeIfKnown) { @@ -509,9 +528,9 @@ Node opEvaluateParallel(PipelineHelper helper, @Override Sink opWrapSink(int flags, Sink sink) { - return new Sink.ChainedDouble(sink) { + return new Sink.ChainedDouble<>(sink) { long n = skip; - long m = limit >= 0 ? limit : Long.MAX_VALUE; + long m = normalizedLimit; @Override public void begin(long size) { @@ -541,7 +560,7 @@ public boolean cancellationRequested() { } private static int flags(long limit) { - return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0); + return StreamOpFlag.IS_SIZE_ADJUSTING | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0); } /** diff --git a/src/java.base/share/classes/java/util/stream/StreamOpFlag.java b/src/java.base/share/classes/java/util/stream/StreamOpFlag.java index a8e06b2f7ce..df98125cbc0 100644 --- a/src/java.base/share/classes/java/util/stream/StreamOpFlag.java +++ b/src/java.base/share/classes/java/util/stream/StreamOpFlag.java @@ -325,12 +325,24 @@ enum StreamOpFlag { */ // 12, 0x01000000 SHORT_CIRCUIT(12, - set(Type.OP).set(Type.TERMINAL_OP)); + set(Type.OP).set(Type.TERMINAL_OP)), + + /** + * Characteristic value signifying that an operation may adjust the + * total size of the stream. + *

+ * The flag, if present, is only valid when SIZED is present; + * and is only valid for sequential streams. + *

+ * An intermediate operation can preserve or inject this value. + */ + // 13, 0x04000000 + SIZE_ADJUSTING(13, + set(Type.OP)); // The following 2 flags are currently undefined and a free for any further // stream flags if/when required // - // 13, 0x04000000 // 14, 0x10000000 // 15, 0x40000000 @@ -629,6 +641,11 @@ private static int createFlagMask() { */ static final int IS_SHORT_CIRCUIT = SHORT_CIRCUIT.set; + /** + * The bit value to inject {@link #SIZE_ADJUSTING}. + */ + static final int IS_SIZE_ADJUSTING = SIZE_ADJUSTING.set; + private static int getMask(int flags) { return (flags == 0) ? FLAG_MASK diff --git a/src/java.base/share/classes/java/util/stream/StreamSpliterators.java b/src/java.base/share/classes/java/util/stream/StreamSpliterators.java index 7c44076f5af..01ba72d1950 100644 --- a/src/java.base/share/classes/java/util/stream/StreamSpliterators.java +++ b/src/java.base/share/classes/java/util/stream/StreamSpliterators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -217,19 +217,17 @@ private boolean fillBuffer() { @Override public final long estimateSize() { - init(); + long exactSizeIfKnown = getExactSizeIfKnown(); // Use the estimate of the wrapped spliterator // Note this may not be accurate if there are filter/flatMap // operations filtering or adding elements to the stream - return spliterator.estimateSize(); + return exactSizeIfKnown == -1 ? spliterator.estimateSize() : exactSizeIfKnown; } @Override public final long getExactSizeIfKnown() { init(); - return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags()) - ? spliterator.getExactSizeIfKnown() - : -1; + return ph.exactOutputSizeIfKnown(spliterator); } @Override diff --git a/src/java.base/share/classes/java/util/zip/ZipFile.java b/src/java.base/share/classes/java/util/zip/ZipFile.java index 2e7eea4b7e3..9ae13371d0e 100644 --- a/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -1218,8 +1218,7 @@ public int hashCode() { } public boolean equals(Object obj) { - if (obj instanceof Key) { - Key key = (Key)obj; + if (obj instanceof Key key) { if (key.utf8 != utf8) { return false; } diff --git a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java index 812cecf8672..0102c17f2e2 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -224,7 +224,7 @@ *

{@code
  *   SSLEngineResult r = engine.unwrap(src, dst);
  *   switch (r.getStatus()) {
- *   BUFFER_OVERFLOW:
+ *   case BUFFER_OVERFLOW:
  *       // Could attempt to drain the dst buffer of any already obtained
  *       // data, but we'll just increase it to the size needed.
  *       int appSize = engine.getSession().getApplicationBufferSize();
@@ -234,7 +234,7 @@
  *       dst = b;
  *       // retry the operation.
  *       break;
- *   BUFFER_UNDERFLOW:
+ *   case BUFFER_UNDERFLOW:
  *       int netSize = engine.getSession().getPacketBufferSize();
  *       // Resize buffer if needed.
  *       if (netSize > src.capacity()) {
diff --git a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java
index 04a50686064..b156a8a5dac 100644
--- a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java
+++ b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -660,11 +660,11 @@ public String[] getApplicationProtocols() {
      *     String HUK_UN_I = new String(bytes, StandardCharsets.ISO_8859_1);
      *
      *     // 0x00-0xFF:  1 byte
-     *     String rfc7301Grease8F = "\u005c008F\u005c008F";
+     *     String rfc7301Grease8A = "\u005cu008A\u005cu008A";
      *
      *     SSLParameters p = sslSocket.getSSLParameters();
      *     p.setApplicationProtocols(new String[] {
-     *             "h2", "http/1.1", rfc7301Grease8F, HUK_UN_I});
+     *             "h2", "http/1.1", rfc7301Grease8A, HUK_UN_I});
      *     sslSocket.setSSLParameters(p);
      * 
* diff --git a/src/java.base/share/classes/jdk/internal/module/ExplodedSystemModules.java b/src/java.base/share/classes/jdk/internal/module/ExplodedSystemModules.java index 5f241913e70..c276647e3b1 100644 --- a/src/java.base/share/classes/jdk/internal/module/ExplodedSystemModules.java +++ b/src/java.base/share/classes/jdk/internal/module/ExplodedSystemModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -68,14 +68,4 @@ public ModuleResolution[] moduleResolutions() { public Map> moduleReads() { throw new InternalError(); } - - @Override - public Map> concealedPackagesToOpen() { - return Map.of(); - } - - @Override - public Map> exportedPackagesToOpen() { - return Map.of(); - } } diff --git a/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java b/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java deleted file mode 100644 index ebbcffd77d9..00000000000 --- a/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 2017, 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. 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.module; - -import java.io.PrintStream; -import java.lang.invoke.MethodHandles; -import java.net.URL; -import java.security.AccessController; -import java.security.CodeSource; -import java.security.PrivilegedAction; -import java.security.ProtectionDomain; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.StringJoiner; -import java.util.WeakHashMap; -import java.util.function.Supplier; -import static java.util.Collections.*; - -import jdk.internal.access.JavaLangAccess; -import jdk.internal.access.SharedSecrets; - -/** - * Supports logging of access to members of exported and concealed packages - * that are opened to code in unnamed modules for illegal access. - */ - -public final class IllegalAccessLogger { - - /** - * Logger modes - */ - public enum Mode { - /** - * Prints a warning when an illegal access succeeds and then - * discards the logger so that there is no further output. - */ - ONESHOT, - /** - * Print warnings when illegal access succeeds - */ - WARN, - /** - * Prints warnings and a stack trace when illegal access succeeds - */ - DEBUG, - } - - /** - * A builder for IllegalAccessLogger objects. - */ - public static class Builder { - private final Mode mode; - private final PrintStream warningStream; - private final Map> moduleToConcealedPackages; - private final Map> moduleToExportedPackages; - private boolean complete; - - private void ensureNotComplete() { - if (complete) throw new IllegalStateException(); - } - - /** - * Creates a builder. - */ - public Builder(Mode mode, PrintStream warningStream) { - this.mode = mode; - this.warningStream = warningStream; - this.moduleToConcealedPackages = new HashMap<>(); - this.moduleToExportedPackages = new HashMap<>(); - } - - /** - * Adding logging of reflective-access to any member of a type in - * otherwise concealed packages. - */ - public Builder logAccessToConcealedPackages(Module m, Set packages) { - ensureNotComplete(); - moduleToConcealedPackages.put(m, unmodifiableSet(packages)); - return this; - } - - /** - * Adding logging of reflective-access to non-public members/types in - * otherwise exported (not open) packages. - */ - public Builder logAccessToExportedPackages(Module m, Set packages) { - ensureNotComplete(); - moduleToExportedPackages.put(m, unmodifiableSet(packages)); - return this; - } - - /** - * Builds the IllegalAccessLogger and sets it as the system-wide logger. - */ - public void complete() { - Map> map1 = unmodifiableMap(moduleToConcealedPackages); - Map> map2 = unmodifiableMap(moduleToExportedPackages); - logger = new IllegalAccessLogger(mode, warningStream, map1, map2); - complete = true; - } - } - - // need access to java.lang.Module - private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); - - // system-wide IllegalAccessLogger - private static volatile IllegalAccessLogger logger; - - // logger mode - private final Mode mode; - - // the print stream to send the warnings - private final PrintStream warningStream; - - // module -> packages open for illegal access - private final Map> moduleToConcealedPackages; - private final Map> moduleToExportedPackages; - - // caller -> usages - private final Map, Usages> callerToUsages = new WeakHashMap<>(); - - private IllegalAccessLogger(Mode mode, - PrintStream warningStream, - Map> moduleToConcealedPackages, - Map> moduleToExportedPackages) - { - this.mode = mode; - this.warningStream = warningStream; - this.moduleToConcealedPackages = moduleToConcealedPackages; - this.moduleToExportedPackages = moduleToExportedPackages; - } - - /** - * Returns the system-wide IllegalAccessLogger or {@code null} if there is - * no logger. - */ - public static IllegalAccessLogger illegalAccessLogger() { - return logger; - } - - /** - * Returns true if the module exports a concealed package for illegal - * access. - */ - public boolean isExportedForIllegalAccess(Module module, String pn) { - Set packages = moduleToConcealedPackages.get(module); - if (packages != null && packages.contains(pn)) - return true; - return false; - } - - /** - * Returns true if the module opens a concealed or exported package for - * illegal access. - */ - public boolean isOpenForIllegalAccess(Module module, String pn) { - if (isExportedForIllegalAccess(module, pn)) - return true; - Set packages = moduleToExportedPackages.get(module); - if (packages != null && packages.contains(pn)) - return true; - return false; - } - - /** - * Logs access to the member of a target class by a caller class if the class - * is in a package that is exported for illegal access. - * - * The {@code whatSupplier} supplies the message that describes the member. - */ - public void logIfExportedForIllegalAccess(Class caller, - Class target, - Supplier whatSupplier) { - Module targetModule = target.getModule(); - String targetPackage = target.getPackageName(); - if (isExportedForIllegalAccess(targetModule, targetPackage)) { - Module callerModule = caller.getModule(); - if (!JLA.isReflectivelyExported(targetModule, targetPackage, callerModule)) { - log(caller, whatSupplier.get()); - } - } - } - - /** - * Logs access to the member of a target class by a caller class if the class - * is in a package that is opened for illegal access. - * - * The {@code what} parameter supplies the message that describes the member. - */ - public void logIfOpenedForIllegalAccess(Class caller, - Class target, - Supplier whatSupplier) { - Module targetModule = target.getModule(); - String targetPackage = target.getPackageName(); - if (isOpenForIllegalAccess(targetModule, targetPackage)) { - Module callerModule = caller.getModule(); - if (!JLA.isReflectivelyOpened(targetModule, targetPackage, callerModule)) { - log(caller, whatSupplier.get()); - } - } - } - - /** - * Logs access by caller lookup if the target class is in a package that is - * opened for illegal access. - */ - public void logIfOpenedForIllegalAccess(MethodHandles.Lookup caller, Class target) { - Module targetModule = target.getModule(); - String targetPackage = target.getPackageName(); - if (isOpenForIllegalAccess(targetModule, targetPackage)) { - Class callerClass = caller.lookupClass(); - Module callerModule = callerClass.getModule(); - if (!JLA.isReflectivelyOpened(targetModule, targetPackage, callerModule)) { - URL url = codeSource(callerClass); - final String source; - if (url == null) { - source = callerClass.getName(); - } else { - source = callerClass.getName() + " (" + url + ")"; - } - log(callerClass, target.getName(), () -> - "WARNING: Illegal reflective access using Lookup on " + source - + " to " + target); - } - } - } - - /** - * Logs access by a caller class. The {@code what} parameter describes - * the member being accessed. - */ - private void log(Class caller, String what) { - log(caller, what, () -> { - URL url = codeSource(caller); - String source = caller.getName(); - if (url != null) - source += " (" + url + ")"; - return "WARNING: Illegal reflective access by " + source + " to " + what; - }); - } - - /** - * Log access by a caller. The {@code what} parameter describes the class or - * member that is being accessed. The {@code msgSupplier} supplies the log - * message. - * - * To reduce output, this method only logs the access if it hasn't been seen - * previously. "Seen previously" is implemented as a map of caller class -> Usage, - * where a Usage is the "what" and a hash of the stack trace. The map has weak - * keys so it can be expunged when the caller is GC'ed/unloaded. - */ - private void log(Class caller, String what, Supplier msgSupplier) { - if (mode == Mode.ONESHOT) { - synchronized (IllegalAccessLogger.class) { - // discard the system wide logger - if (logger == null) - return; - logger = null; - } - warningStream.println(loudWarning(caller, msgSupplier)); - return; - } - - // stack trace without the top-most frames in java.base - List stack = StackWalkerHolder.INSTANCE.walk(s -> - s.dropWhile(this::isJavaBase) - .limit(32) - .toList() - ); - - // record usage if this is the first (or not recently recorded) - Usage u = new Usage(what, hash(stack)); - boolean added; - synchronized (this) { - added = callerToUsages.computeIfAbsent(caller, k -> new Usages()).add(u); - } - - // print warning if this is the first (or not a recent) usage - if (added) { - String msg = msgSupplier.get(); - if (mode == Mode.DEBUG) { - StringBuilder sb = new StringBuilder(msg); - stack.forEach(f -> - sb.append(System.lineSeparator()).append("\tat " + f) - ); - msg = sb.toString(); - } - warningStream.println(msg); - } - } - - /** - * Returns the code source for the given class or null if there is no code source - */ - private URL codeSource(Class clazz) { - PrivilegedAction pa = clazz::getProtectionDomain; - CodeSource cs = AccessController.doPrivileged(pa).getCodeSource(); - return (cs != null) ? cs.getLocation() : null; - } - - private String loudWarning(Class caller, Supplier msgSupplier) { - StringJoiner sj = new StringJoiner(System.lineSeparator()); - sj.add("WARNING: An illegal reflective access operation has occurred"); - sj.add(msgSupplier.get()); - sj.add("WARNING: Please consider reporting this to the maintainers of " - + caller.getName()); - sj.add("WARNING: Use --illegal-access=warn to enable warnings of further" - + " illegal reflective access operations"); - sj.add("WARNING: All illegal access operations will be denied in a" - + " future release"); - return sj.toString(); - } - - private static class StackWalkerHolder { - static final StackWalker INSTANCE; - static { - PrivilegedAction pa = () -> - StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); - INSTANCE = AccessController.doPrivileged(pa); - } - } - - /** - * Returns true if the stack frame is for a class in java.base. - */ - private boolean isJavaBase(StackWalker.StackFrame frame) { - Module caller = frame.getDeclaringClass().getModule(); - return "java.base".equals(caller.getName()); - } - - /** - * Computes a hash code for the give stack frames. The hash code is based - * on the class, method name, and BCI. - */ - private int hash(List stack) { - int hash = 0; - for (StackWalker.StackFrame frame : stack) { - hash = (31 * hash) + Objects.hash(frame.getDeclaringClass(), - frame.getMethodName(), - frame.getByteCodeIndex()); - } - return hash; - } - - private static class Usage { - private final String what; - private final int stack; - Usage(String what, int stack) { - this.what = what; - this.stack = stack; - } - @Override - public int hashCode() { - return what.hashCode() ^ stack; - } - @Override - public boolean equals(Object ob) { - if (ob instanceof Usage) { - Usage that = (Usage)ob; - return what.equals(that.what) && stack == (that.stack); - } else { - return false; - } - } - } - - @SuppressWarnings("serial") - private static class Usages extends LinkedHashMap { - Usages() { } - boolean add(Usage u) { - return (putIfAbsent(u, Boolean.TRUE) == null); - } - @Override - protected boolean removeEldestEntry(Map.Entry oldest) { - // prevent map growing too big, say where a utility class - // is used by generated code to do illegal access - return size() > 16; - } - } -} diff --git a/src/java.base/share/classes/jdk/internal/module/IllegalAccessMaps.java b/src/java.base/share/classes/jdk/internal/module/IllegalAccessMaps.java deleted file mode 100644 index bec2841af83..00000000000 --- a/src/java.base/share/classes/jdk/internal/module/IllegalAccessMaps.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * 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.module; - -import sun.nio.cs.UTF_8; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UncheckedIOException; -import java.lang.module.ModuleDescriptor; -import java.lang.module.ModuleFinder; -import java.lang.module.ModuleReference; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * Generates the maps of concealed and exported packages to open at run-time. - * - * This is used at run-time for exploded builds, and at link-time to generate - * the maps for the system modules in the run-time image. - */ - -public class IllegalAccessMaps { - private final Map> concealedPackagesToOpen; - private final Map> exportedPackagesToOpen; - - private IllegalAccessMaps(Map> map1, - Map> map2) { - this.concealedPackagesToOpen = map1; - this.exportedPackagesToOpen = map2; - } - - /** - * Returns the map of concealed packages to open. The map key is the - * module name, the value is the set of concealed packages to open. - */ - public Map> concealedPackagesToOpen() { - return concealedPackagesToOpen; - } - - /** - * Returns the map of exported packages to open. The map key is the - * module name, the value is the set of exported packages to open. - */ - public Map> exportedPackagesToOpen() { - return exportedPackagesToOpen; - } - - /** - * Generate the maps of module to concealed and exported packages for - * the system modules that are observable with the given module finder. - */ - public static IllegalAccessMaps generate(ModuleFinder finder) { - Map map = new HashMap<>(); - finder.findAll().stream() - .map(ModuleReference::descriptor) - .forEach(md -> md.packages().forEach(pn -> map.putIfAbsent(pn, md))); - - Map> concealedPackagesToOpen = new HashMap<>(); - Map> exportedPackagesToOpen = new HashMap<>(); - - String rn = "jdk8_packages.dat"; - InputStream in = IllegalAccessMaps.class.getResourceAsStream(rn); - if (in == null) { - throw new InternalError(rn + " not found"); - } - try (BufferedReader br = new BufferedReader( - new InputStreamReader(in, UTF_8.INSTANCE))) - { - br.lines() - .filter(line -> !line.isEmpty() && !line.startsWith("#")) - .forEach(pn -> { - ModuleDescriptor descriptor = map.get(pn); - if (descriptor != null && !isOpen(descriptor, pn)) { - String name = descriptor.name(); - if (isExported(descriptor, pn)) { - exportedPackagesToOpen.computeIfAbsent(name, - k -> new HashSet<>()).add(pn); - } else { - concealedPackagesToOpen.computeIfAbsent(name, - k -> new HashSet<>()).add(pn); - } - } - }); - - } catch (IOException ioe) { - throw new UncheckedIOException(ioe); - } - - return new IllegalAccessMaps(concealedPackagesToOpen, exportedPackagesToOpen); - } - - private static boolean isExported(ModuleDescriptor descriptor, String pn) { - return descriptor.exports() - .stream() - .anyMatch(e -> e.source().equals(pn) && !e.isQualified()); - } - - private static boolean isOpen(ModuleDescriptor descriptor, String pn) { - return descriptor.opens() - .stream() - .anyMatch(e -> e.source().equals(pn) && !e.isQualified()); - } -} diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java index 013dec42976..b6b3dd7f086 100644 --- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java +++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -38,7 +38,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -147,8 +146,7 @@ private static boolean canUseArchivedBootLayer() { getProperty("jdk.module.limitmods") == null && // --limit-modules getProperty("jdk.module.addreads.0") == null && // --add-reads getProperty("jdk.module.addexports.0") == null && // --add-exports - getProperty("jdk.module.addopens.0") == null && // --add-opens - getProperty("jdk.module.illegalAccess") == null; // --illegal-access + getProperty("jdk.module.addopens.0") == null; // --add-opens } /** @@ -189,7 +187,6 @@ private static ModuleLayer boot2() { String mainModule = System.getProperty("jdk.module.main"); Set addModules = addModules(); Set limitModules = limitModules(); - String illegalAccess = getAndRemoveProperty("jdk.module.illegalAccess"); PrintStream traceOutput = null; String trace = getAndRemoveProperty("jdk.module.showModuleResolution"); @@ -221,8 +218,7 @@ private static ModuleLayer boot2() { && !haveModulePath && addModules.isEmpty() && limitModules.isEmpty() - && !isPatched - && illegalAccess == null) { + && !isPatched) { systemModuleFinder = archivedModuleGraph.finder(); hasSplitPackages = archivedModuleGraph.hasSplitPackages(); hasIncubatorModules = archivedModuleGraph.hasIncubatorModules(); @@ -455,19 +451,10 @@ private static ModuleLayer boot2() { checkIncubatingStatus(cf); } - // --add-reads, --add-exports/--add-opens, and --illegal-access + // --add-reads, --add-exports/--add-opens addExtraReads(bootLayer); boolean extraExportsOrOpens = addExtraExportsAndOpens(bootLayer); - if (illegalAccess != null) { - assert systemModules != null; - addIllegalAccess(illegalAccess, - systemModules, - upgradeModulePath, - bootLayer, - extraExportsOrOpens); - } - Counters.add("jdk.module.boot.7.adjustModulesTime"); // save module finders for later use @@ -779,96 +766,6 @@ private static void addExtraExportsOrOpens(ModuleLayer bootLayer, } } - /** - * Process the --illegal-access option to open packages of system modules - * in the boot layer to code in unnamed modules. - */ - private static void addIllegalAccess(String illegalAccess, - SystemModules systemModules, - ModuleFinder upgradeModulePath, - ModuleLayer bootLayer, - boolean extraExportsOrOpens) { - - if (illegalAccess.equals("deny")) - return; // nothing to do - - IllegalAccessLogger.Mode mode = switch (illegalAccess) { - case "permit" -> IllegalAccessLogger.Mode.ONESHOT; - case "warn" -> IllegalAccessLogger.Mode.WARN; - case "debug" -> IllegalAccessLogger.Mode.DEBUG; - default -> { - fail("Value specified to --illegal-access not recognized:" - + " '" + illegalAccess + "'"); - yield null; - } - }; - - var builder = new IllegalAccessLogger.Builder(mode, System.err); - Map> concealedPackagesToOpen = systemModules.concealedPackagesToOpen(); - Map> exportedPackagesToOpen = systemModules.exportedPackagesToOpen(); - if (concealedPackagesToOpen.isEmpty() && exportedPackagesToOpen.isEmpty()) { - // need to generate (exploded build) - IllegalAccessMaps maps = IllegalAccessMaps.generate(limitedFinder()); - concealedPackagesToOpen = maps.concealedPackagesToOpen(); - exportedPackagesToOpen = maps.exportedPackagesToOpen(); - } - - // open specific packages in the system modules - Set emptySet = Set.of(); - for (Module m : bootLayer.modules()) { - ModuleDescriptor descriptor = m.getDescriptor(); - String name = m.getName(); - - // skip open modules - if (descriptor.isOpen()) { - continue; - } - - // skip modules loaded from the upgrade module path - if (upgradeModulePath != null - && upgradeModulePath.find(name).isPresent()) { - continue; - } - - Set concealedPackages = concealedPackagesToOpen.getOrDefault(name, emptySet); - Set exportedPackages = exportedPackagesToOpen.getOrDefault(name, emptySet); - - // refresh the set of concealed and exported packages if needed - if (extraExportsOrOpens) { - concealedPackages = new HashSet<>(concealedPackages); - exportedPackages = new HashSet<>(exportedPackages); - Iterator iterator = concealedPackages.iterator(); - while (iterator.hasNext()) { - String pn = iterator.next(); - if (m.isExported(pn, BootLoader.getUnnamedModule())) { - // concealed package is exported to ALL-UNNAMED - iterator.remove(); - exportedPackages.add(pn); - } - } - iterator = exportedPackages.iterator(); - while (iterator.hasNext()) { - String pn = iterator.next(); - if (m.isOpen(pn, BootLoader.getUnnamedModule())) { - // exported package is opened to ALL-UNNAMED - iterator.remove(); - } - } - } - - // log reflective access to all types in concealed packages - builder.logAccessToConcealedPackages(m, concealedPackages); - - // log reflective access to non-public members/types in exported packages - builder.logAccessToExportedPackages(m, exportedPackages); - - // open the packages to unnamed modules - JLA.addOpensToAllUnnamed(m, concealedPackages, exportedPackages); - } - - builder.complete(); - } - /** * Decodes the values of --add-reads, -add-exports, --add-opens or * --patch-modules options that are encoded in system properties. diff --git a/src/java.base/share/classes/jdk/internal/module/SystemModules.java b/src/java.base/share/classes/jdk/internal/module/SystemModules.java index 8f6b8daa33c..4c74068acc8 100644 --- a/src/java.base/share/classes/jdk/internal/module/SystemModules.java +++ b/src/java.base/share/classes/jdk/internal/module/SystemModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -83,16 +83,4 @@ interface SystemModules { * by this SystemModules object. */ Map> moduleReads(); - - /** - * Returns the map of module concealed packages to open. The map key is the - * module name, the value is the set of concealed packages to open. - */ - Map> concealedPackagesToOpen(); - - /** - * Returns the map of module exported packages to open. The map key is the - * module name, the value is the set of exported packages to open. - */ - Map> exportedPackagesToOpen(); } diff --git a/src/java.base/share/classes/jdk/internal/module/jdk8_packages.dat b/src/java.base/share/classes/jdk/internal/module/jdk8_packages.dat deleted file mode 100644 index 2774f2bb492..00000000000 --- a/src/java.base/share/classes/jdk/internal/module/jdk8_packages.dat +++ /dev/null @@ -1,1340 +0,0 @@ -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# -apple.applescript -apple.laf -apple.launcher -apple.security -com.apple.concurrent -com.apple.eawt -com.apple.eawt.event -com.apple.eio -com.apple.laf -com.apple.laf.resources -com.oracle.jrockit.jfr -com.oracle.jrockit.jfr.client -com.oracle.jrockit.jfr.management -com.oracle.security.ucrypto -com.oracle.util -com.oracle.webservices.internal.api -com.oracle.webservices.internal.api.databinding -com.oracle.webservices.internal.api.message -com.oracle.webservices.internal.impl.encoding -com.oracle.webservices.internal.impl.internalspi.encoding -com.oracle.xmlns.internal.webservices.jaxws_databinding -com.sun.accessibility.internal.resources -com.sun.activation.registries -com.sun.awt -com.sun.beans -com.sun.beans.decoder -com.sun.beans.editors -com.sun.beans.finder -com.sun.beans.infos -com.sun.beans.util -com.sun.codemodel.internal -com.sun.codemodel.internal.fmt -com.sun.codemodel.internal.util -com.sun.codemodel.internal.writer -com.sun.corba.se.impl.activation -com.sun.corba.se.impl.copyobject -com.sun.corba.se.impl.corba -com.sun.corba.se.impl.dynamicany -com.sun.corba.se.impl.encoding -com.sun.corba.se.impl.interceptors -com.sun.corba.se.impl.io -com.sun.corba.se.impl.ior -com.sun.corba.se.impl.ior.iiop -com.sun.corba.se.impl.javax.rmi -com.sun.corba.se.impl.javax.rmi.CORBA -com.sun.corba.se.impl.legacy.connection -com.sun.corba.se.impl.logging -com.sun.corba.se.impl.monitoring -com.sun.corba.se.impl.naming.cosnaming -com.sun.corba.se.impl.naming.namingutil -com.sun.corba.se.impl.naming.pcosnaming -com.sun.corba.se.impl.oa -com.sun.corba.se.impl.oa.poa -com.sun.corba.se.impl.oa.toa -com.sun.corba.se.impl.orb -com.sun.corba.se.impl.orbutil -com.sun.corba.se.impl.orbutil.closure -com.sun.corba.se.impl.orbutil.concurrent -com.sun.corba.se.impl.orbutil.fsm -com.sun.corba.se.impl.orbutil.graph -com.sun.corba.se.impl.orbutil.threadpool -com.sun.corba.se.impl.presentation.rmi -com.sun.corba.se.impl.protocol -com.sun.corba.se.impl.protocol.giopmsgheaders -com.sun.corba.se.impl.resolver -com.sun.corba.se.impl.transport -com.sun.corba.se.impl.util -com.sun.corba.se.internal.CosNaming -com.sun.corba.se.internal.Interceptors -com.sun.corba.se.internal.POA -com.sun.corba.se.internal.corba -com.sun.corba.se.internal.iiop -com.sun.corba.se.org.omg.CORBA -com.sun.corba.se.pept.broker -com.sun.corba.se.pept.encoding -com.sun.corba.se.pept.protocol -com.sun.corba.se.pept.transport -com.sun.corba.se.spi.activation -com.sun.corba.se.spi.activation.InitialNameServicePackage -com.sun.corba.se.spi.activation.LocatorPackage -com.sun.corba.se.spi.activation.RepositoryPackage -com.sun.corba.se.spi.copyobject -com.sun.corba.se.spi.encoding -com.sun.corba.se.spi.extension -com.sun.corba.se.spi.ior -com.sun.corba.se.spi.ior.iiop -com.sun.corba.se.spi.legacy.connection -com.sun.corba.se.spi.legacy.interceptor -com.sun.corba.se.spi.logging -com.sun.corba.se.spi.monitoring -com.sun.corba.se.spi.oa -com.sun.corba.se.spi.orb -com.sun.corba.se.spi.orbutil.closure -com.sun.corba.se.spi.orbutil.fsm -com.sun.corba.se.spi.orbutil.proxy -com.sun.corba.se.spi.orbutil.threadpool -com.sun.corba.se.spi.presentation.rmi -com.sun.corba.se.spi.protocol -com.sun.corba.se.spi.resolver -com.sun.corba.se.spi.servicecontext -com.sun.corba.se.spi.transport -com.sun.crypto.provider -com.sun.demo.jvmti.hprof -com.sun.deploy.uitoolkit.impl.fx -com.sun.deploy.uitoolkit.impl.fx.ui -com.sun.deploy.uitoolkit.impl.fx.ui.resources -com.sun.glass.events -com.sun.glass.events.mac -com.sun.glass.ui -com.sun.glass.ui.delegate -com.sun.glass.ui.gtk -com.sun.glass.ui.mac -com.sun.glass.ui.win -com.sun.glass.utils -com.sun.image.codec.jpeg -com.sun.imageio.plugins.bmp -com.sun.imageio.plugins.common -com.sun.imageio.plugins.gif -com.sun.imageio.plugins.jpeg -com.sun.imageio.plugins.png -com.sun.imageio.plugins.wbmp -com.sun.imageio.spi -com.sun.imageio.stream -com.sun.istack.internal -com.sun.istack.internal.localization -com.sun.istack.internal.logging -com.sun.istack.internal.tools -com.sun.jarsigner -com.sun.java.accessibility -com.sun.java.accessibility.util -com.sun.java.accessibility.util.java.awt -com.sun.java.browser.dom -com.sun.java.browser.net -com.sun.java.swing -com.sun.java.swing.plaf.gtk -com.sun.java.swing.plaf.gtk.resources -com.sun.java.swing.plaf.motif -com.sun.java.swing.plaf.motif.resources -com.sun.java.swing.plaf.nimbus -com.sun.java.swing.plaf.windows -com.sun.java.swing.plaf.windows.resources -com.sun.java.util.jar.pack -com.sun.java_cup.internal.runtime -com.sun.javadoc -com.sun.javafx -com.sun.javafx.animation -com.sun.javafx.applet -com.sun.javafx.application -com.sun.javafx.beans -com.sun.javafx.beans.event -com.sun.javafx.binding -com.sun.javafx.charts -com.sun.javafx.collections -com.sun.javafx.css -com.sun.javafx.css.converters -com.sun.javafx.css.parser -com.sun.javafx.cursor -com.sun.javafx.effect -com.sun.javafx.embed -com.sun.javafx.event -com.sun.javafx.font -com.sun.javafx.font.coretext -com.sun.javafx.font.directwrite -com.sun.javafx.font.freetype -com.sun.javafx.font.t2k -com.sun.javafx.fxml -com.sun.javafx.fxml.builder -com.sun.javafx.fxml.expression -com.sun.javafx.geom -com.sun.javafx.geom.transform -com.sun.javafx.geometry -com.sun.javafx.iio -com.sun.javafx.iio.bmp -com.sun.javafx.iio.common -com.sun.javafx.iio.gif -com.sun.javafx.iio.ios -com.sun.javafx.iio.jpeg -com.sun.javafx.iio.png -com.sun.javafx.image -com.sun.javafx.image.impl -com.sun.javafx.jmx -com.sun.javafx.logging -com.sun.javafx.media -com.sun.javafx.menu -com.sun.javafx.perf -com.sun.javafx.print -com.sun.javafx.property -com.sun.javafx.property.adapter -com.sun.javafx.robot -com.sun.javafx.robot.impl -com.sun.javafx.runtime -com.sun.javafx.runtime.async -com.sun.javafx.runtime.eula -com.sun.javafx.scene -com.sun.javafx.scene.control -com.sun.javafx.scene.control.behavior -com.sun.javafx.scene.control.skin -com.sun.javafx.scene.control.skin.resources -com.sun.javafx.scene.input -com.sun.javafx.scene.layout.region -com.sun.javafx.scene.paint -com.sun.javafx.scene.shape -com.sun.javafx.scene.text -com.sun.javafx.scene.transform -com.sun.javafx.scene.traversal -com.sun.javafx.scene.web -com.sun.javafx.scene.web.behavior -com.sun.javafx.scene.web.skin -com.sun.javafx.sg.prism -com.sun.javafx.sg.prism.web -com.sun.javafx.stage -com.sun.javafx.text -com.sun.javafx.tk -com.sun.javafx.tk.quantum -com.sun.javafx.util -com.sun.javafx.webkit -com.sun.javafx.webkit.drt -com.sun.javafx.webkit.prism -com.sun.javafx.webkit.prism.theme -com.sun.javafx.webkit.theme -com.sun.jdi -com.sun.jdi.connect -com.sun.jdi.connect.spi -com.sun.jdi.event -com.sun.jdi.request -com.sun.jmx.defaults -com.sun.jmx.interceptor -com.sun.jmx.mbeanserver -com.sun.jmx.remote.internal -com.sun.jmx.remote.protocol.iiop -com.sun.jmx.remote.protocol.rmi -com.sun.jmx.remote.security -com.sun.jmx.remote.util -com.sun.jmx.snmp -com.sun.jmx.snmp.IPAcl -com.sun.jmx.snmp.agent -com.sun.jmx.snmp.daemon -com.sun.jmx.snmp.defaults -com.sun.jmx.snmp.internal -com.sun.jmx.snmp.mpm -com.sun.jmx.snmp.tasks -com.sun.jndi.cosnaming -com.sun.jndi.dns -com.sun.jndi.ldap -com.sun.jndi.ldap.ext -com.sun.jndi.ldap.pool -com.sun.jndi.ldap.sasl -com.sun.jndi.rmi.registry -com.sun.jndi.toolkit.corba -com.sun.jndi.toolkit.ctx -com.sun.jndi.toolkit.dir -com.sun.jndi.toolkit.url -com.sun.jndi.url.corbaname -com.sun.jndi.url.dns -com.sun.jndi.url.iiop -com.sun.jndi.url.iiopname -com.sun.jndi.url.ldap -com.sun.jndi.url.ldaps -com.sun.jndi.url.rmi -com.sun.management -com.sun.management.jmx -com.sun.media.jfxmedia -com.sun.media.jfxmedia.control -com.sun.media.jfxmedia.effects -com.sun.media.jfxmedia.events -com.sun.media.jfxmedia.locator -com.sun.media.jfxmedia.logging -com.sun.media.jfxmedia.track -com.sun.media.jfxmediaimpl -com.sun.media.jfxmediaimpl.platform -com.sun.media.jfxmediaimpl.platform.gstreamer -com.sun.media.jfxmediaimpl.platform.ios -com.sun.media.jfxmediaimpl.platform.java -com.sun.media.jfxmediaimpl.platform.osx -com.sun.media.sound -com.sun.naming.internal -com.sun.net.httpserver -com.sun.net.httpserver.spi -com.sun.net.ssl -com.sun.net.ssl.internal.ssl -com.sun.net.ssl.internal.www.protocol.https -com.sun.nio.file -com.sun.nio.sctp -com.sun.nio.zipfs -com.sun.openpisces -com.sun.org.apache.bcel.internal -com.sun.org.apache.bcel.internal.classfile -com.sun.org.apache.bcel.internal.generic -com.sun.org.apache.bcel.internal.util -com.sun.org.apache.regexp.internal -com.sun.org.apache.xalan.internal -com.sun.org.apache.xalan.internal.extensions -com.sun.org.apache.xalan.internal.lib -com.sun.org.apache.xalan.internal.res -com.sun.org.apache.xalan.internal.templates -com.sun.org.apache.xalan.internal.utils -com.sun.org.apache.xalan.internal.xslt -com.sun.org.apache.xalan.internal.xsltc -com.sun.org.apache.xalan.internal.xsltc.cmdline -com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt -com.sun.org.apache.xalan.internal.xsltc.compiler -com.sun.org.apache.xalan.internal.xsltc.compiler.util -com.sun.org.apache.xalan.internal.xsltc.dom -com.sun.org.apache.xalan.internal.xsltc.runtime -com.sun.org.apache.xalan.internal.xsltc.runtime.output -com.sun.org.apache.xalan.internal.xsltc.trax -com.sun.org.apache.xalan.internal.xsltc.util -com.sun.org.apache.xerces.internal.dom -com.sun.org.apache.xerces.internal.dom.events -com.sun.org.apache.xerces.internal.impl -com.sun.org.apache.xerces.internal.impl.dtd -com.sun.org.apache.xerces.internal.impl.dtd.models -com.sun.org.apache.xerces.internal.impl.dv -com.sun.org.apache.xerces.internal.impl.dv.dtd -com.sun.org.apache.xerces.internal.impl.dv.util -com.sun.org.apache.xerces.internal.impl.dv.xs -com.sun.org.apache.xerces.internal.impl.io -com.sun.org.apache.xerces.internal.impl.msg -com.sun.org.apache.xerces.internal.impl.validation -com.sun.org.apache.xerces.internal.impl.xpath -com.sun.org.apache.xerces.internal.impl.xpath.regex -com.sun.org.apache.xerces.internal.impl.xs -com.sun.org.apache.xerces.internal.impl.xs.identity -com.sun.org.apache.xerces.internal.impl.xs.models -com.sun.org.apache.xerces.internal.impl.xs.opti -com.sun.org.apache.xerces.internal.impl.xs.traversers -com.sun.org.apache.xerces.internal.impl.xs.util -com.sun.org.apache.xerces.internal.jaxp -com.sun.org.apache.xerces.internal.jaxp.datatype -com.sun.org.apache.xerces.internal.jaxp.validation -com.sun.org.apache.xerces.internal.parsers -com.sun.org.apache.xerces.internal.util -com.sun.org.apache.xerces.internal.utils -com.sun.org.apache.xerces.internal.xinclude -com.sun.org.apache.xerces.internal.xni -com.sun.org.apache.xerces.internal.xni.grammars -com.sun.org.apache.xerces.internal.xni.parser -com.sun.org.apache.xerces.internal.xpointer -com.sun.org.apache.xerces.internal.xs -com.sun.org.apache.xerces.internal.xs.datatypes -com.sun.org.apache.xml.internal.dtm -com.sun.org.apache.xml.internal.dtm.ref -com.sun.org.apache.xml.internal.dtm.ref.dom2dtm -com.sun.org.apache.xml.internal.dtm.ref.sax2dtm -com.sun.org.apache.xml.internal.res -com.sun.org.apache.xml.internal.resolver -com.sun.org.apache.xml.internal.resolver.helpers -com.sun.org.apache.xml.internal.resolver.readers -com.sun.org.apache.xml.internal.resolver.tools -com.sun.org.apache.xml.internal.security -com.sun.org.apache.xml.internal.security.algorithms -com.sun.org.apache.xml.internal.security.algorithms.implementations -com.sun.org.apache.xml.internal.security.c14n -com.sun.org.apache.xml.internal.security.c14n.helper -com.sun.org.apache.xml.internal.security.c14n.implementations -com.sun.org.apache.xml.internal.security.encryption -com.sun.org.apache.xml.internal.security.exceptions -com.sun.org.apache.xml.internal.security.keys -com.sun.org.apache.xml.internal.security.keys.content -com.sun.org.apache.xml.internal.security.keys.content.keyvalues -com.sun.org.apache.xml.internal.security.keys.content.x509 -com.sun.org.apache.xml.internal.security.keys.keyresolver -com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations -com.sun.org.apache.xml.internal.security.keys.storage -com.sun.org.apache.xml.internal.security.keys.storage.implementations -com.sun.org.apache.xml.internal.security.signature -com.sun.org.apache.xml.internal.security.signature.reference -com.sun.org.apache.xml.internal.security.transforms -com.sun.org.apache.xml.internal.security.transforms.implementations -com.sun.org.apache.xml.internal.security.transforms.params -com.sun.org.apache.xml.internal.security.utils -com.sun.org.apache.xml.internal.security.utils.resolver -com.sun.org.apache.xml.internal.security.utils.resolver.implementations -com.sun.org.apache.xml.internal.serialize -com.sun.org.apache.xml.internal.serializer -com.sun.org.apache.xml.internal.serializer.utils -com.sun.org.apache.xml.internal.utils -com.sun.org.apache.xml.internal.utils.res -com.sun.org.apache.xpath.internal -com.sun.org.apache.xpath.internal.axes -com.sun.org.apache.xpath.internal.compiler -com.sun.org.apache.xpath.internal.domapi -com.sun.org.apache.xpath.internal.functions -com.sun.org.apache.xpath.internal.jaxp -com.sun.org.apache.xpath.internal.objects -com.sun.org.apache.xpath.internal.operations -com.sun.org.apache.xpath.internal.patterns -com.sun.org.apache.xpath.internal.res -com.sun.org.glassfish.external.amx -com.sun.org.glassfish.external.arc -com.sun.org.glassfish.external.probe.provider -com.sun.org.glassfish.external.probe.provider.annotations -com.sun.org.glassfish.external.statistics -com.sun.org.glassfish.external.statistics.annotations -com.sun.org.glassfish.external.statistics.impl -com.sun.org.glassfish.gmbal -com.sun.org.glassfish.gmbal.util -com.sun.org.omg.CORBA -com.sun.org.omg.CORBA.ValueDefPackage -com.sun.org.omg.CORBA.portable -com.sun.org.omg.SendingContext -com.sun.org.omg.SendingContext.CodeBasePackage -com.sun.pisces -com.sun.prism -com.sun.prism.d3d -com.sun.prism.es2 -com.sun.prism.image -com.sun.prism.impl -com.sun.prism.impl.packrect -com.sun.prism.impl.paint -com.sun.prism.impl.ps -com.sun.prism.impl.shape -com.sun.prism.j2d -com.sun.prism.j2d.paint -com.sun.prism.j2d.print -com.sun.prism.paint -com.sun.prism.ps -com.sun.prism.shader -com.sun.prism.shape -com.sun.prism.sw -com.sun.rmi.rmid -com.sun.rowset -com.sun.rowset.internal -com.sun.rowset.providers -com.sun.scenario -com.sun.scenario.animation -com.sun.scenario.animation.shared -com.sun.scenario.effect -com.sun.scenario.effect.impl -com.sun.scenario.effect.impl.es2 -com.sun.scenario.effect.impl.hw -com.sun.scenario.effect.impl.hw.d3d -com.sun.scenario.effect.impl.prism -com.sun.scenario.effect.impl.prism.ps -com.sun.scenario.effect.impl.prism.sw -com.sun.scenario.effect.impl.state -com.sun.scenario.effect.impl.sw -com.sun.scenario.effect.impl.sw.java -com.sun.scenario.effect.impl.sw.sse -com.sun.scenario.effect.light -com.sun.security.auth -com.sun.security.auth.callback -com.sun.security.auth.login -com.sun.security.auth.module -com.sun.security.cert.internal.x509 -com.sun.security.jgss -com.sun.security.ntlm -com.sun.security.sasl -com.sun.security.sasl.digest -com.sun.security.sasl.gsskerb -com.sun.security.sasl.ntlm -com.sun.security.sasl.util -com.sun.source.doctree -com.sun.source.tree -com.sun.source.util -com.sun.swing.internal.plaf.basic.resources -com.sun.swing.internal.plaf.metal.resources -com.sun.swing.internal.plaf.synth.resources -com.sun.tools.attach -com.sun.tools.attach.spi -com.sun.tools.classfile -com.sun.tools.corba.se.idl -com.sun.tools.corba.se.idl.constExpr -com.sun.tools.corba.se.idl.som.cff -com.sun.tools.corba.se.idl.som.idlemit -com.sun.tools.corba.se.idl.toJavaPortable -com.sun.tools.doclets -com.sun.tools.doclets.formats.html -com.sun.tools.doclets.formats.html.markup -com.sun.tools.doclets.formats.html.resources -com.sun.tools.doclets.internal.toolkit -com.sun.tools.doclets.internal.toolkit.builders -com.sun.tools.doclets.internal.toolkit.resources -com.sun.tools.doclets.internal.toolkit.taglets -com.sun.tools.doclets.internal.toolkit.util -com.sun.tools.doclets.internal.toolkit.util.links -com.sun.tools.doclets.standard -com.sun.tools.doclint -com.sun.tools.doclint.resources -com.sun.tools.example.debug.expr -com.sun.tools.example.debug.tty -com.sun.tools.extcheck -com.sun.tools.hat -com.sun.tools.hat.internal.model -com.sun.tools.hat.internal.oql -com.sun.tools.hat.internal.parser -com.sun.tools.hat.internal.server -com.sun.tools.hat.internal.util -com.sun.tools.internal.jxc -com.sun.tools.internal.jxc.ap -com.sun.tools.internal.jxc.api -com.sun.tools.internal.jxc.api.impl.j2s -com.sun.tools.internal.jxc.gen.config -com.sun.tools.internal.jxc.model.nav -com.sun.tools.internal.ws -com.sun.tools.internal.ws.api -com.sun.tools.internal.ws.api.wsdl -com.sun.tools.internal.ws.processor -com.sun.tools.internal.ws.processor.generator -com.sun.tools.internal.ws.processor.model -com.sun.tools.internal.ws.processor.model.exporter -com.sun.tools.internal.ws.processor.model.java -com.sun.tools.internal.ws.processor.model.jaxb -com.sun.tools.internal.ws.processor.modeler -com.sun.tools.internal.ws.processor.modeler.annotation -com.sun.tools.internal.ws.processor.modeler.wsdl -com.sun.tools.internal.ws.processor.util -com.sun.tools.internal.ws.resources -com.sun.tools.internal.ws.spi -com.sun.tools.internal.ws.util -com.sun.tools.internal.ws.util.xml -com.sun.tools.internal.ws.wscompile -com.sun.tools.internal.ws.wscompile.plugin.at_generated -com.sun.tools.internal.ws.wsdl.document -com.sun.tools.internal.ws.wsdl.document.http -com.sun.tools.internal.ws.wsdl.document.jaxws -com.sun.tools.internal.ws.wsdl.document.mime -com.sun.tools.internal.ws.wsdl.document.schema -com.sun.tools.internal.ws.wsdl.document.soap -com.sun.tools.internal.ws.wsdl.framework -com.sun.tools.internal.ws.wsdl.parser -com.sun.tools.internal.xjc -com.sun.tools.internal.xjc.addon.accessors -com.sun.tools.internal.xjc.addon.at_generated -com.sun.tools.internal.xjc.addon.code_injector -com.sun.tools.internal.xjc.addon.episode -com.sun.tools.internal.xjc.addon.locator -com.sun.tools.internal.xjc.addon.sync -com.sun.tools.internal.xjc.api -com.sun.tools.internal.xjc.api.impl.s2j -com.sun.tools.internal.xjc.api.util -com.sun.tools.internal.xjc.generator.annotation.spec -com.sun.tools.internal.xjc.generator.bean -com.sun.tools.internal.xjc.generator.bean.field -com.sun.tools.internal.xjc.generator.util -com.sun.tools.internal.xjc.model -com.sun.tools.internal.xjc.model.nav -com.sun.tools.internal.xjc.outline -com.sun.tools.internal.xjc.reader -com.sun.tools.internal.xjc.reader.dtd -com.sun.tools.internal.xjc.reader.dtd.bindinfo -com.sun.tools.internal.xjc.reader.gbind -com.sun.tools.internal.xjc.reader.internalizer -com.sun.tools.internal.xjc.reader.relaxng -com.sun.tools.internal.xjc.reader.xmlschema -com.sun.tools.internal.xjc.reader.xmlschema.bindinfo -com.sun.tools.internal.xjc.reader.xmlschema.ct -com.sun.tools.internal.xjc.reader.xmlschema.parser -com.sun.tools.internal.xjc.runtime -com.sun.tools.internal.xjc.util -com.sun.tools.internal.xjc.writer -com.sun.tools.javac -com.sun.tools.javac.api -com.sun.tools.javac.code -com.sun.tools.javac.comp -com.sun.tools.javac.file -com.sun.tools.javac.jvm -com.sun.tools.javac.main -com.sun.tools.javac.model -com.sun.tools.javac.nio -com.sun.tools.javac.parser -com.sun.tools.javac.processing -com.sun.tools.javac.resources -com.sun.tools.javac.sym -com.sun.tools.javac.tree -com.sun.tools.javac.util -com.sun.tools.javadoc -com.sun.tools.javadoc.api -com.sun.tools.javadoc.resources -com.sun.tools.javah -com.sun.tools.javah.resources -com.sun.tools.javap -com.sun.tools.javap.resources -com.sun.tools.jconsole -com.sun.tools.jdeps -com.sun.tools.jdeps.resources -com.sun.tools.jdi -com.sun.tools.jdi.resources -com.sun.tools.script.shell -com.sun.tracing -com.sun.tracing.dtrace -com.sun.webkit -com.sun.webkit.dom -com.sun.webkit.event -com.sun.webkit.graphics -com.sun.webkit.network -com.sun.webkit.network.about -com.sun.webkit.network.data -com.sun.webkit.perf -com.sun.webkit.plugin -com.sun.webkit.text -com.sun.xml.internal.bind -com.sun.xml.internal.bind.annotation -com.sun.xml.internal.bind.api -com.sun.xml.internal.bind.api.impl -com.sun.xml.internal.bind.marshaller -com.sun.xml.internal.bind.unmarshaller -com.sun.xml.internal.bind.util -com.sun.xml.internal.bind.v2 -com.sun.xml.internal.bind.v2.bytecode -com.sun.xml.internal.bind.v2.model.annotation -com.sun.xml.internal.bind.v2.model.core -com.sun.xml.internal.bind.v2.model.impl -com.sun.xml.internal.bind.v2.model.nav -com.sun.xml.internal.bind.v2.model.runtime -com.sun.xml.internal.bind.v2.model.util -com.sun.xml.internal.bind.v2.runtime -com.sun.xml.internal.bind.v2.runtime.output -com.sun.xml.internal.bind.v2.runtime.property -com.sun.xml.internal.bind.v2.runtime.reflect -com.sun.xml.internal.bind.v2.runtime.reflect.opt -com.sun.xml.internal.bind.v2.runtime.unmarshaller -com.sun.xml.internal.bind.v2.schemagen -com.sun.xml.internal.bind.v2.schemagen.episode -com.sun.xml.internal.bind.v2.schemagen.xmlschema -com.sun.xml.internal.bind.v2.util -com.sun.xml.internal.dtdparser -com.sun.xml.internal.fastinfoset -com.sun.xml.internal.fastinfoset.algorithm -com.sun.xml.internal.fastinfoset.alphabet -com.sun.xml.internal.fastinfoset.dom -com.sun.xml.internal.fastinfoset.org.apache.xerces.util -com.sun.xml.internal.fastinfoset.sax -com.sun.xml.internal.fastinfoset.stax -com.sun.xml.internal.fastinfoset.stax.events -com.sun.xml.internal.fastinfoset.stax.factory -com.sun.xml.internal.fastinfoset.stax.util -com.sun.xml.internal.fastinfoset.tools -com.sun.xml.internal.fastinfoset.util -com.sun.xml.internal.fastinfoset.vocab -com.sun.xml.internal.messaging.saaj -com.sun.xml.internal.messaging.saaj.client.p2p -com.sun.xml.internal.messaging.saaj.packaging.mime -com.sun.xml.internal.messaging.saaj.packaging.mime.internet -com.sun.xml.internal.messaging.saaj.packaging.mime.util -com.sun.xml.internal.messaging.saaj.soap -com.sun.xml.internal.messaging.saaj.soap.dynamic -com.sun.xml.internal.messaging.saaj.soap.impl -com.sun.xml.internal.messaging.saaj.soap.name -com.sun.xml.internal.messaging.saaj.soap.ver1_1 -com.sun.xml.internal.messaging.saaj.soap.ver1_2 -com.sun.xml.internal.messaging.saaj.util -com.sun.xml.internal.messaging.saaj.util.transform -com.sun.xml.internal.org.jvnet.fastinfoset -com.sun.xml.internal.org.jvnet.fastinfoset.sax -com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers -com.sun.xml.internal.org.jvnet.fastinfoset.stax -com.sun.xml.internal.org.jvnet.mimepull -com.sun.xml.internal.org.jvnet.staxex -com.sun.xml.internal.rngom.ast.builder -com.sun.xml.internal.rngom.ast.om -com.sun.xml.internal.rngom.ast.util -com.sun.xml.internal.rngom.binary -com.sun.xml.internal.rngom.binary.visitor -com.sun.xml.internal.rngom.digested -com.sun.xml.internal.rngom.dt -com.sun.xml.internal.rngom.dt.builtin -com.sun.xml.internal.rngom.nc -com.sun.xml.internal.rngom.parse -com.sun.xml.internal.rngom.parse.compact -com.sun.xml.internal.rngom.parse.host -com.sun.xml.internal.rngom.parse.xml -com.sun.xml.internal.rngom.util -com.sun.xml.internal.rngom.xml.sax -com.sun.xml.internal.rngom.xml.util -com.sun.xml.internal.stream -com.sun.xml.internal.stream.buffer -com.sun.xml.internal.stream.buffer.sax -com.sun.xml.internal.stream.buffer.stax -com.sun.xml.internal.stream.dtd -com.sun.xml.internal.stream.dtd.nonvalidating -com.sun.xml.internal.stream.events -com.sun.xml.internal.stream.util -com.sun.xml.internal.stream.writers -com.sun.xml.internal.txw2 -com.sun.xml.internal.txw2.annotation -com.sun.xml.internal.txw2.output -com.sun.xml.internal.ws -com.sun.xml.internal.ws.addressing -com.sun.xml.internal.ws.addressing.model -com.sun.xml.internal.ws.addressing.policy -com.sun.xml.internal.ws.addressing.v200408 -com.sun.xml.internal.ws.api -com.sun.xml.internal.ws.api.addressing -com.sun.xml.internal.ws.api.client -com.sun.xml.internal.ws.api.config.management -com.sun.xml.internal.ws.api.config.management.policy -com.sun.xml.internal.ws.api.databinding -com.sun.xml.internal.ws.api.fastinfoset -com.sun.xml.internal.ws.api.ha -com.sun.xml.internal.ws.api.handler -com.sun.xml.internal.ws.api.message -com.sun.xml.internal.ws.api.message.saaj -com.sun.xml.internal.ws.api.message.stream -com.sun.xml.internal.ws.api.model -com.sun.xml.internal.ws.api.model.soap -com.sun.xml.internal.ws.api.model.wsdl -com.sun.xml.internal.ws.api.model.wsdl.editable -com.sun.xml.internal.ws.api.pipe -com.sun.xml.internal.ws.api.pipe.helper -com.sun.xml.internal.ws.api.policy -com.sun.xml.internal.ws.api.policy.subject -com.sun.xml.internal.ws.api.server -com.sun.xml.internal.ws.api.streaming -com.sun.xml.internal.ws.api.wsdl.parser -com.sun.xml.internal.ws.api.wsdl.writer -com.sun.xml.internal.ws.assembler -com.sun.xml.internal.ws.assembler.dev -com.sun.xml.internal.ws.assembler.jaxws -com.sun.xml.internal.ws.binding -com.sun.xml.internal.ws.client -com.sun.xml.internal.ws.client.dispatch -com.sun.xml.internal.ws.client.sei -com.sun.xml.internal.ws.commons.xmlutil -com.sun.xml.internal.ws.config.management.policy -com.sun.xml.internal.ws.config.metro.dev -com.sun.xml.internal.ws.config.metro.util -com.sun.xml.internal.ws.db -com.sun.xml.internal.ws.db.glassfish -com.sun.xml.internal.ws.developer -com.sun.xml.internal.ws.dump -com.sun.xml.internal.ws.encoding -com.sun.xml.internal.ws.encoding.fastinfoset -com.sun.xml.internal.ws.encoding.policy -com.sun.xml.internal.ws.encoding.soap -com.sun.xml.internal.ws.encoding.soap.streaming -com.sun.xml.internal.ws.encoding.xml -com.sun.xml.internal.ws.fault -com.sun.xml.internal.ws.handler -com.sun.xml.internal.ws.message -com.sun.xml.internal.ws.message.jaxb -com.sun.xml.internal.ws.message.saaj -com.sun.xml.internal.ws.message.source -com.sun.xml.internal.ws.message.stream -com.sun.xml.internal.ws.model -com.sun.xml.internal.ws.model.soap -com.sun.xml.internal.ws.model.wsdl -com.sun.xml.internal.ws.org.objectweb.asm -com.sun.xml.internal.ws.policy -com.sun.xml.internal.ws.policy.jaxws -com.sun.xml.internal.ws.policy.jaxws.spi -com.sun.xml.internal.ws.policy.privateutil -com.sun.xml.internal.ws.policy.sourcemodel -com.sun.xml.internal.ws.policy.sourcemodel.attach -com.sun.xml.internal.ws.policy.sourcemodel.wspolicy -com.sun.xml.internal.ws.policy.spi -com.sun.xml.internal.ws.policy.subject -com.sun.xml.internal.ws.protocol.soap -com.sun.xml.internal.ws.protocol.xml -com.sun.xml.internal.ws.resources -com.sun.xml.internal.ws.runtime.config -com.sun.xml.internal.ws.server -com.sun.xml.internal.ws.server.provider -com.sun.xml.internal.ws.server.sei -com.sun.xml.internal.ws.spi -com.sun.xml.internal.ws.spi.db -com.sun.xml.internal.ws.streaming -com.sun.xml.internal.ws.transport -com.sun.xml.internal.ws.transport.http -com.sun.xml.internal.ws.transport.http.client -com.sun.xml.internal.ws.transport.http.server -com.sun.xml.internal.ws.util -com.sun.xml.internal.ws.util.exception -com.sun.xml.internal.ws.util.pipe -com.sun.xml.internal.ws.util.xml -com.sun.xml.internal.ws.wsdl -com.sun.xml.internal.ws.wsdl.parser -com.sun.xml.internal.ws.wsdl.writer -com.sun.xml.internal.ws.wsdl.writer.document -com.sun.xml.internal.ws.wsdl.writer.document.http -com.sun.xml.internal.ws.wsdl.writer.document.soap -com.sun.xml.internal.ws.wsdl.writer.document.soap12 -com.sun.xml.internal.ws.wsdl.writer.document.xsd -com.sun.xml.internal.xsom -com.sun.xml.internal.xsom.impl -com.sun.xml.internal.xsom.impl.parser -com.sun.xml.internal.xsom.impl.parser.state -com.sun.xml.internal.xsom.impl.scd -com.sun.xml.internal.xsom.impl.util -com.sun.xml.internal.xsom.parser -com.sun.xml.internal.xsom.util -com.sun.xml.internal.xsom.visitor -java.applet -java.awt -java.awt.color -java.awt.datatransfer -java.awt.dnd -java.awt.dnd.peer -java.awt.event -java.awt.font -java.awt.geom -java.awt.im -java.awt.im.spi -java.awt.image -java.awt.image.renderable -java.awt.peer -java.awt.print -java.beans -java.beans.beancontext -java.io -java.lang -java.lang.annotation -java.lang.instrument -java.lang.invoke -java.lang.management -java.lang.ref -java.lang.reflect -java.math -java.net -java.nio -java.nio.channels -java.nio.channels.spi -java.nio.charset -java.nio.charset.spi -java.nio.file -java.nio.file.attribute -java.nio.file.spi -java.rmi -java.rmi.activation -java.rmi.dgc -java.rmi.registry -java.rmi.server -java.security -java.security.acl -java.security.cert -java.security.interfaces -java.security.spec -java.sql -java.text -java.text.spi -java.time -java.time.chrono -java.time.format -java.time.temporal -java.time.zone -java.util -java.util.concurrent -java.util.concurrent.atomic -java.util.concurrent.locks -java.util.function -java.util.jar -java.util.logging -java.util.prefs -java.util.regex -java.util.spi -java.util.stream -java.util.zip -javafx.animation -javafx.application -javafx.beans -javafx.beans.binding -javafx.beans.property -javafx.beans.property.adapter -javafx.beans.value -javafx.collections -javafx.collections.transformation -javafx.concurrent -javafx.css -javafx.embed.swing -javafx.embed.swt -javafx.event -javafx.fxml -javafx.geometry -javafx.print -javafx.scene -javafx.scene.canvas -javafx.scene.chart -javafx.scene.control -javafx.scene.control.cell -javafx.scene.effect -javafx.scene.image -javafx.scene.input -javafx.scene.layout -javafx.scene.media -javafx.scene.paint -javafx.scene.shape -javafx.scene.text -javafx.scene.transform -javafx.scene.web -javafx.stage -javafx.util -javafx.util.converter -javax.accessibility -javax.activation -javax.activity -javax.annotation -javax.annotation.processing -javax.crypto -javax.crypto.interfaces -javax.crypto.spec -javax.imageio -javax.imageio.event -javax.imageio.metadata -javax.imageio.plugins.bmp -javax.imageio.plugins.jpeg -javax.imageio.spi -javax.imageio.stream -javax.jws -javax.jws.soap -javax.lang.model -javax.lang.model.element -javax.lang.model.type -javax.lang.model.util -javax.management -javax.management.loading -javax.management.modelmbean -javax.management.monitor -javax.management.openmbean -javax.management.relation -javax.management.remote -javax.management.remote.rmi -javax.management.timer -javax.naming -javax.naming.directory -javax.naming.event -javax.naming.ldap -javax.naming.spi -javax.net -javax.net.ssl -javax.print -javax.print.attribute -javax.print.attribute.standard -javax.print.event -javax.rmi -javax.rmi.CORBA -javax.rmi.ssl -javax.script -javax.security.auth -javax.security.auth.callback -javax.security.auth.kerberos -javax.security.auth.login -javax.security.auth.spi -javax.security.auth.x500 -javax.security.cert -javax.security.sasl -javax.smartcardio -javax.sound.midi -javax.sound.midi.spi -javax.sound.sampled -javax.sound.sampled.spi -javax.sql -javax.sql.rowset -javax.sql.rowset.serial -javax.sql.rowset.spi -javax.swing -javax.swing.border -javax.swing.colorchooser -javax.swing.event -javax.swing.filechooser -javax.swing.plaf -javax.swing.plaf.basic -javax.swing.plaf.metal -javax.swing.plaf.multi -javax.swing.plaf.nimbus -javax.swing.plaf.synth -javax.swing.table -javax.swing.text -javax.swing.text.html -javax.swing.text.html.parser -javax.swing.text.rtf -javax.swing.tree -javax.swing.undo -javax.tools -javax.transaction -javax.transaction.xa -javax.xml -javax.xml.bind -javax.xml.bind.annotation -javax.xml.bind.annotation.adapters -javax.xml.bind.attachment -javax.xml.bind.helpers -javax.xml.bind.util -javax.xml.crypto -javax.xml.crypto.dom -javax.xml.crypto.dsig -javax.xml.crypto.dsig.dom -javax.xml.crypto.dsig.keyinfo -javax.xml.crypto.dsig.spec -javax.xml.datatype -javax.xml.namespace -javax.xml.parsers -javax.xml.soap -javax.xml.stream -javax.xml.stream.events -javax.xml.stream.util -javax.xml.transform -javax.xml.transform.dom -javax.xml.transform.sax -javax.xml.transform.stax -javax.xml.transform.stream -javax.xml.validation -javax.xml.ws -javax.xml.ws.handler -javax.xml.ws.handler.soap -javax.xml.ws.http -javax.xml.ws.soap -javax.xml.ws.spi -javax.xml.ws.spi.http -javax.xml.ws.wsaddressing -javax.xml.xpath -jdk -jdk.internal.cmm -jdk.internal.dynalink -jdk.internal.dynalink.beans -jdk.internal.dynalink.linker -jdk.internal.dynalink.support -jdk.internal.instrumentation -jdk.internal.org.objectweb.asm -jdk.internal.org.objectweb.asm.commons -jdk.internal.org.objectweb.asm.signature -jdk.internal.org.objectweb.asm.tree -jdk.internal.org.objectweb.asm.tree.analysis -jdk.internal.org.objectweb.asm.util -jdk.internal.org.xml.sax -jdk.internal.org.xml.sax.helpers -jdk.internal.util.xml -jdk.internal.util.xml.impl -jdk.jfr.events -jdk.management.cmm -jdk.management.resource -jdk.management.resource.internal -jdk.management.resource.internal.inst -jdk.nashorn.api.scripting -jdk.nashorn.internal -jdk.nashorn.internal.codegen -jdk.nashorn.internal.codegen.types -jdk.nashorn.internal.ir -jdk.nashorn.internal.ir.annotations -jdk.nashorn.internal.ir.debug -jdk.nashorn.internal.ir.visitor -jdk.nashorn.internal.lookup -jdk.nashorn.internal.objects -jdk.nashorn.internal.objects.annotations -jdk.nashorn.internal.parser -jdk.nashorn.internal.runtime -jdk.nashorn.internal.runtime.arrays -jdk.nashorn.internal.runtime.events -jdk.nashorn.internal.runtime.linker -jdk.nashorn.internal.runtime.logging -jdk.nashorn.internal.runtime.options -jdk.nashorn.internal.runtime.regexp -jdk.nashorn.internal.runtime.regexp.joni -jdk.nashorn.internal.runtime.regexp.joni.ast -jdk.nashorn.internal.runtime.regexp.joni.constants -jdk.nashorn.internal.runtime.regexp.joni.encoding -jdk.nashorn.internal.runtime.regexp.joni.exception -jdk.nashorn.internal.scripts -jdk.nashorn.tools -jdk.net -netscape.javascript -oracle.jrockit.jfr -oracle.jrockit.jfr.events -oracle.jrockit.jfr.jdkevents -oracle.jrockit.jfr.jdkevents.throwabletransform -oracle.jrockit.jfr.openmbean -oracle.jrockit.jfr.parser -oracle.jrockit.jfr.settings -oracle.jrockit.jfr.tools -org.ietf.jgss -org.jcp.xml.dsig.internal -org.jcp.xml.dsig.internal.dom -org.omg.CORBA -org.omg.CORBA.DynAnyPackage -org.omg.CORBA.ORBPackage -org.omg.CORBA.TypeCodePackage -org.omg.CORBA.portable -org.omg.CORBA_2_3 -org.omg.CORBA_2_3.portable -org.omg.CosNaming -org.omg.CosNaming.NamingContextExtPackage -org.omg.CosNaming.NamingContextPackage -org.omg.Dynamic -org.omg.DynamicAny -org.omg.DynamicAny.DynAnyFactoryPackage -org.omg.DynamicAny.DynAnyPackage -org.omg.IOP -org.omg.IOP.CodecFactoryPackage -org.omg.IOP.CodecPackage -org.omg.Messaging -org.omg.PortableInterceptor -org.omg.PortableInterceptor.ORBInitInfoPackage -org.omg.PortableServer -org.omg.PortableServer.CurrentPackage -org.omg.PortableServer.POAManagerPackage -org.omg.PortableServer.POAPackage -org.omg.PortableServer.ServantLocatorPackage -org.omg.PortableServer.portable -org.omg.SendingContext -org.omg.stub.java.rmi -org.omg.stub.javax.management.remote.rmi -org.relaxng.datatype -org.relaxng.datatype.helpers -org.w3c.dom -org.w3c.dom.bootstrap -org.w3c.dom.css -org.w3c.dom.events -org.w3c.dom.html -org.w3c.dom.ls -org.w3c.dom.ranges -org.w3c.dom.stylesheets -org.w3c.dom.traversal -org.w3c.dom.views -org.w3c.dom.xpath -org.xml.sax -org.xml.sax.ext -org.xml.sax.helpers -sun.applet -sun.applet.resources -sun.audio -sun.awt -sun.awt.X11 -sun.awt.datatransfer -sun.awt.dnd -sun.awt.event -sun.awt.geom -sun.awt.im -sun.awt.image -sun.awt.image.codec -sun.awt.motif -sun.awt.resources -sun.awt.shell -sun.awt.util -sun.awt.windows -sun.corba -sun.dc -sun.dc.path -sun.dc.pr -sun.font -sun.instrument -sun.invoke -sun.invoke.empty -sun.invoke.util -sun.io -sun.java2d -sun.java2d.cmm -sun.java2d.cmm.kcms -sun.java2d.cmm.lcms -sun.java2d.d3d -sun.java2d.jules -sun.java2d.loops -sun.java2d.opengl -sun.java2d.pipe -sun.java2d.pipe.hw -sun.java2d.pisces -sun.java2d.windows -sun.java2d.x11 -sun.java2d.xr -sun.jvmstat.monitor -sun.jvmstat.monitor.event -sun.jvmstat.monitor.remote -sun.jvmstat.perfdata.monitor -sun.jvmstat.perfdata.monitor.protocol.file -sun.jvmstat.perfdata.monitor.protocol.local -sun.jvmstat.perfdata.monitor.protocol.rmi -sun.jvmstat.perfdata.monitor.v1_0 -sun.jvmstat.perfdata.monitor.v2_0 -sun.launcher -sun.launcher.resources -sun.lwawt -sun.lwawt.macosx -sun.management -sun.management.counter -sun.management.counter.perf -sun.management.jdp -sun.management.jmxremote -sun.management.resources -sun.management.snmp -sun.management.snmp.jvminstr -sun.management.snmp.jvmmib -sun.management.snmp.util -sun.misc -sun.misc.resources -sun.net -sun.net.dns -sun.net.ftp -sun.net.ftp.impl -sun.net.httpserver -sun.net.idn -sun.net.sdp -sun.net.smtp -sun.net.spi -sun.net.spi.nameservice -sun.net.spi.nameservice.dns -sun.net.util -sun.net.www -sun.net.www.content.audio -sun.net.www.content.image -sun.net.www.content.text -sun.net.www.http -sun.net.www.protocol.file -sun.net.www.protocol.ftp -sun.net.www.protocol.http -sun.net.www.protocol.http.logging -sun.net.www.protocol.http.ntlm -sun.net.www.protocol.http.spnego -sun.net.www.protocol.https -sun.net.www.protocol.jar -sun.net.www.protocol.mailto -sun.net.www.protocol.netdoc -sun.nio -sun.nio.ch -sun.nio.ch.sctp -sun.nio.cs -sun.nio.cs.ext -sun.nio.fs -sun.print -sun.print.resources -sun.reflect -sun.reflect.annotation -sun.reflect.generics.factory -sun.reflect.generics.parser -sun.reflect.generics.reflectiveObjects -sun.reflect.generics.repository -sun.reflect.generics.scope -sun.reflect.generics.tree -sun.reflect.generics.visitor -sun.reflect.misc -sun.rmi.log -sun.rmi.registry -sun.rmi.rmic -sun.rmi.rmic.iiop -sun.rmi.rmic.newrmic -sun.rmi.rmic.newrmic.jrmp -sun.rmi.runtime -sun.rmi.server -sun.rmi.transport -sun.rmi.transport.proxy -sun.rmi.transport.tcp -sun.security.acl -sun.security.action -sun.security.ec -sun.security.internal.interfaces -sun.security.internal.spec -sun.security.jca -sun.security.jgss -sun.security.jgss.krb5 -sun.security.jgss.spi -sun.security.jgss.spnego -sun.security.jgss.wrapper -sun.security.krb5 -sun.security.krb5.internal -sun.security.krb5.internal.ccache -sun.security.krb5.internal.crypto -sun.security.krb5.internal.crypto.dk -sun.security.krb5.internal.ktab -sun.security.krb5.internal.rcache -sun.security.krb5.internal.tools -sun.security.krb5.internal.util -sun.security.mscapi -sun.security.pkcs -sun.security.pkcs10 -sun.security.pkcs11 -sun.security.pkcs11.wrapper -sun.security.pkcs12 -sun.security.provider -sun.security.provider.certpath -sun.security.provider.certpath.ldap -sun.security.provider.certpath.ssl -sun.security.rsa -sun.security.smartcardio -sun.security.ssl -sun.security.ssl.krb5 -sun.security.timestamp -sun.security.tools -sun.security.tools.jarsigner -sun.security.tools.keytool -sun.security.tools.policytool -sun.security.util -sun.security.validator -sun.security.x509 -sun.swing -sun.swing.icon -sun.swing.plaf -sun.swing.plaf.synth -sun.swing.plaf.windows -sun.swing.table -sun.swing.text -sun.swing.text.html -sun.text -sun.text.bidi -sun.text.normalizer -sun.text.resources -sun.text.resources.en -sun.tools.asm -sun.tools.attach -sun.tools.jar -sun.tools.jar.resources -sun.tools.java -sun.tools.javac -sun.tools.jcmd -sun.tools.jconsole -sun.tools.jconsole.inspector -sun.tools.jinfo -sun.tools.jmap -sun.tools.jps -sun.tools.jstack -sun.tools.jstat -sun.tools.jstatd -sun.tools.native2ascii -sun.tools.native2ascii.resources -sun.tools.serialver -sun.tools.tree -sun.tools.util -sun.tracing -sun.tracing.dtrace -sun.usagetracker -sun.util -sun.util.calendar -sun.util.cldr -sun.util.locale -sun.util.locale.provider -sun.util.logging -sun.util.logging.resources -sun.util.resources -sun.util.resources.en -sun.util.spi -sun.util.xml diff --git a/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java index e14cd288116..a73fa093f3a 100644 --- a/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java +++ b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java @@ -33,16 +33,14 @@ import java.io.Serializable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import java.lang.reflect.Field; +import java.lang.reflect.Constructor; import java.lang.reflect.Executable; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.security.PrivilegedAction; -import java.util.Objects; import java.util.Properties; - import jdk.internal.access.JavaLangReflectAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.misc.VM; @@ -684,7 +682,7 @@ private static boolean packageEquals(Class cl1, Class cl2) { } return cl1.getClassLoader() == cl2.getClassLoader() && - Objects.equals(cl1.getPackageName(), cl2.getPackageName()); + cl1.getPackageName() == cl2.getPackageName(); } } diff --git a/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java b/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java index eab3afae080..fd0a2a5e2bd 100644 --- a/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java +++ b/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java @@ -27,7 +27,6 @@ import java.lang.reflect.Modifier; import static java.lang.reflect.Modifier.*; -import java.util.Objects; import jdk.internal.reflect.Reflection; /** @@ -375,7 +374,7 @@ public static boolean isSamePackage(Class class1, Class class2) { return true; if (class1.getClassLoader() != class2.getClassLoader()) return false; - return Objects.equals(class1.getPackageName(), class2.getPackageName()); + return class1.getPackageName() == class2.getPackageName(); } /** diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/src/java.base/share/classes/sun/launcher/resources/launcher.properties index a6c443fa2bd..2ecb6b254cc 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 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 @@ -185,11 +185,6 @@ java.launcher.X.usage=\n\ \ --add-opens /=(,)*\n\ \ updates to open to\n\ \ , regardless of module declaration.\n\ -\ --illegal-access=\n\ -\ permit or deny access to members of types in named modules\n\ -\ by code in unnamed modules.\n\ -\ is one of "deny", "permit", "warn", or "debug"\n\ -\ This option will be removed in a future release.\n\ \ --limit-modules [,...]\n\ \ limit the universe of observable modules\n\ \ --patch-module =({0})*\n\ diff --git a/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java b/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java index 9a8eed2ab08..79cc6026e62 100644 --- a/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java +++ b/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java @@ -129,7 +129,7 @@ private static void privateCheckPackageAccess(SecurityManager s, Class clazz) } String pkg = clazz.getPackageName(); - if (pkg != null && !pkg.isEmpty()) { + if (!pkg.isEmpty()) { s.checkPackageAccess(pkg); } diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 940cbdc89e9..b3d466cf65d 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -2429,8 +2429,15 @@ private int doImportKeyStoreSingle(KeyStore srckeystore, String alias) newPass = destKeyPass; pp = new PasswordProtection(destKeyPass); } else if (objs.snd != null) { - newPass = P12KEYSTORE.equalsIgnoreCase(storetype) ? - storePass : objs.snd; + if (P12KEYSTORE.equalsIgnoreCase(storetype)) { + if (isPasswordlessKeyStore) { + newPass = objs.snd; + } else { + newPass = storePass; + } + } else { + newPass = objs.snd; + } pp = new PasswordProtection(newPass); } @@ -2442,7 +2449,7 @@ private int doImportKeyStoreSingle(KeyStore srckeystore, String alias) keyStore.setEntry(newAlias, entry, pp); // Place the check so that only successful imports are blocked. // For example, we don't block a failed SecretEntry import. - if (P12KEYSTORE.equalsIgnoreCase(storetype)) { + if (P12KEYSTORE.equalsIgnoreCase(storetype) && !isPasswordlessKeyStore) { if (newPass != null && !Arrays.equals(newPass, storePass)) { throw new Exception(rb.getString( "The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.")); diff --git a/src/java.base/share/classes/sun/util/locale/BaseLocale.java b/src/java.base/share/classes/sun/util/locale/BaseLocale.java index b520771f20a..e5bef6dceea 100644 --- a/src/java.base/share/classes/sun/util/locale/BaseLocale.java +++ b/src/java.base/share/classes/sun/util/locale/BaseLocale.java @@ -34,6 +34,7 @@ import jdk.internal.misc.CDS; import jdk.internal.vm.annotation.Stable; +import sun.security.action.GetPropertyAction; import java.lang.ref.SoftReference; import java.util.StringJoiner; @@ -98,6 +99,13 @@ public final class BaseLocale { private volatile int hash; + /** + * Boolean for the old ISO language code compatibility. + */ + private static final boolean OLD_ISO_CODES = GetPropertyAction.privilegedGetProperties() + .getProperty("java.locale.useOldISOCodes", "false") + .equalsIgnoreCase("true"); + // This method must be called with normalize = false only when creating the // Locale.* constants and non-normalized BaseLocale$Keys used for lookup. private BaseLocale(String language, String script, String region, String variant, @@ -153,19 +161,22 @@ public static BaseLocale getInstance(String language, String script, // JDK uses deprecated ISO639.1 language codes for he, yi and id if (!language.isEmpty()) { - if (language.equals("he")) { - language = "iw"; - } else if (language.equals("yi")) { - language = "ji"; - } else if (language.equals("id")) { - language = "in"; - } + language = convertOldISOCodes(language); } Key key = new Key(language, script, region, variant, false); return Cache.CACHE.get(key); } + public static String convertOldISOCodes(String language) { + return switch (language) { + case "he", "iw" -> OLD_ISO_CODES ? "iw" : "he"; + case "id", "in" -> OLD_ISO_CODES ? "in" : "id"; + case "yi", "ji" -> OLD_ISO_CODES ? "ji" : "yi"; + default -> language; + }; + } + public String getLanguage() { return language; } diff --git a/src/java.base/share/classes/sun/util/resources/Bundles.java b/src/java.base/share/classes/sun/util/resources/Bundles.java index 556e4132cb6..8f8809f4ae6 100644 --- a/src/java.base/share/classes/sun/util/resources/Bundles.java +++ b/src/java.base/share/classes/sun/util/resources/Bundles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -208,6 +208,17 @@ private static ResourceBundle findBundleOf(CacheKey cacheKey, Class bundleClass = (Class) c; bundle = bundleAccess.newResourceBundle(bundleClass); } + if (bundle == null) { + var otherBundleName = toOtherBundleName(baseName, bundleName, targetLocale); + if (!bundleName.equals(otherBundleName)) { + c = Class.forName(Bundles.class.getModule(), otherBundleName); + if (c != null && ResourceBundle.class.isAssignableFrom(c)) { + @SuppressWarnings("unchecked") + Class bundleClass = (Class) c; + bundle = bundleAccess.newResourceBundle(bundleClass); + } + } + } } catch (Exception e) { cacheKey.setCause(e); } @@ -345,27 +356,55 @@ private static ResourceBundle putBundleInCache(CacheKey cacheKey, return bundle; } + /** + * Generates the other bundle name for languages that have changed, + * i.e. "he", "id", and "yi" + * + * @param baseName ResourceBundle base name + * @param bundleName ResourceBundle bundle name + * @param locale locale + * @return the other bundle name, or the same name for non-legacy ISO languages + */ + public static String toOtherBundleName(String baseName, String bundleName, Locale locale) { + var simpleName= baseName.substring(baseName.lastIndexOf('.') + 1); + var suffix = bundleName.substring(bundleName.lastIndexOf(simpleName) + simpleName.length()); + var otherSuffix = switch(locale.getLanguage()) { + case "he" -> suffix.replaceFirst("^_he(_.*)?$", "_iw$1"); + case "id" -> suffix.replaceFirst("^_id(_.*)?$", "_in$1"); + case "yi" -> suffix.replaceFirst("^_yi(_.*)?$", "_ji$1"); + case "iw" -> suffix.replaceFirst("^_iw(_.*)?$", "_he$1"); + case "in" -> suffix.replaceFirst("^_in(_.*)?$", "_id$1"); + case "ji" -> suffix.replaceFirst("^_ji(_.*)?$", "_yi$1"); + default -> suffix; + }; + + if (suffix.equals(otherSuffix)) { + return bundleName; + } else { + return bundleName.substring(0, bundleName.lastIndexOf(suffix)) + otherSuffix; + } + } /** * The Strategy interface defines methods that are called by Bundles.of during * the resource bundle loading process. */ - public static interface Strategy { + public interface Strategy { /** * Returns a list of locales to be looked up for bundle loading. */ - public List getCandidateLocales(String baseName, Locale locale); + List getCandidateLocales(String baseName, Locale locale); /** * Returns the bundle name for the given baseName and locale. */ - public String toBundleName(String baseName, Locale locale); + String toBundleName(String baseName, Locale locale); /** * Returns the service provider type for the given baseName * and locale, or null if no service providers should be used. */ - public Class getResourceBundleProviderType(String baseName, + Class getResourceBundleProviderType(String baseName, Locale locale); } @@ -374,7 +413,7 @@ public Class getResourceBundleProviderType(Str * BundleReference. */ private static interface CacheKeyReference { - public CacheKey getCacheKey(); + CacheKey getCacheKey(); } /** diff --git a/src/java.base/share/classes/sun/util/resources/LocaleData.java b/src/java.base/share/classes/sun/util/resources/LocaleData.java index 429613413b8..22c1398cfc6 100644 --- a/src/java.base/share/classes/sun/util/resources/LocaleData.java +++ b/src/java.base/share/classes/sun/util/resources/LocaleData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -216,6 +216,13 @@ private static abstract class LocaleDataResourceBundleProvider protected String toBundleName(String baseName, Locale locale) { return LocaleDataStrategy.INSTANCE.toBundleName(baseName, locale); } + + /** + * Retrieves the other bundle name for legacy ISO 639 languages. + */ + protected String toOtherBundleName(String baseName, String bundleName, Locale locale) { + return Bundles.toOtherBundleName(baseName, bundleName, locale); + } } /** diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security index 378445ee175..2d7742a3b2a 100644 --- a/src/java.base/share/conf/security/java.security +++ b/src/java.base/share/conf/security/java.security @@ -1061,7 +1061,6 @@ jdk.xml.dsig.secureValidationPolicy=\ # sun.rmi.server.UnicastRef;\ # sun.rmi.server.RMIClientSocketFactory;\ # sun.rmi.server.RMIServerSocketFactory;\ -# java.rmi.activation.ActivationID;\ # java.rmi.server.UID # # RMI Distributed Garbage Collector (DGC) Serial Filter diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m index 1dd4c2fb4b5..33e838b070a 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m @@ -896,6 +896,14 @@ - (BOOL)accessibilityIsIndexAttributeSettable return NO; } +- (NSInteger)accessibilityIndex { + int index = 0; + if (fParent != NULL) { + index = [fParent accessibilityIndexOfChild:self]; + } + return index; +} + /* * The java/lang/Number concrete class could be for any of the Java primitive * numerical types or some other subclass. diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.h index 6ee1de13f6f..b4065511eb0 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.h @@ -31,6 +31,7 @@ @interface ButtonAccessibility : CommonComponentAccessibility { }; -- (nullable NSString *)accessibilityLabel; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (NSString * _Nullable)accessibilityLabel; - (BOOL)accessibilityPerformPress; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.m index 3c4a896b7a8..912cef1fa67 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ButtonAccessibility.m @@ -29,7 +29,12 @@ * Implementation of the accessibility peer for the pushbutton role */ @implementation ButtonAccessibility -- (nullable NSString *)accessibilityLabel +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityButtonRole; +} + +- (NSString * _Nullable)accessibilityLabel { return [self accessibilityTitleAttribute]; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.h index 835567c01c1..50c017299ad 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.h @@ -28,5 +28,6 @@ @interface CheckboxAccessibility : ButtonAccessibility { }; -- (id)accessibilityValue; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (id _Nonnull)accessibilityValue; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.m index c61d3a97a8a..bbfaf39fe66 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CheckboxAccessibility.m @@ -31,8 +31,12 @@ * Implementation of the accessibility peer for the checkbox role */ @implementation CheckboxAccessibility +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityCheckBoxRole; +} -- (id) accessibilityValue +- (id _Nonnull) accessibilityValue { AWT_ASSERT_APPKIT_THREAD; return [self accessibilityValueAttribute]; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.h index dadb8fca7ac..4140e0ea5f7 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.h @@ -41,7 +41,7 @@ + (void) initializeRolesMap; + (JavaComponentAccessibility * _Nullable) getComponentAccessibility:(NSString * _Nonnull)role; - (NSRect)accessibilityFrame; -- (nullable id)accessibilityParent; +- (id _Nullable)accessibilityParent; - (BOOL)performAccessibleAction:(int)index; - (BOOL)isAccessibilityElement; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m index 88b93800db7..e2ef999202c 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m @@ -48,7 +48,7 @@ + (void) initializeRolesMap { /* * Here we should keep all the mapping between the accessibility roles and implementing classes */ - rolesMap = [[NSMutableDictionary alloc] initWithCapacity:34]; + rolesMap = [[NSMutableDictionary alloc] initWithCapacity:36]; [rolesMap setObject:@"ButtonAccessibility" forKey:@"pushbutton"]; [rolesMap setObject:@"ImageAccessibility" forKey:@"icon"]; @@ -66,6 +66,8 @@ + (void) initializeRolesMap { [rolesMap setObject:@"GroupAccessibility" forKey:@"groupbox"]; [rolesMap setObject:@"GroupAccessibility" forKey:@"internalframe"]; [rolesMap setObject:@"GroupAccessibility" forKey:@"swingcomponent"]; + [rolesMap setObject:@"ToolbarAccessibility" forKey:@"toolbar"]; + [rolesMap setObject:@"SplitpaneAccessibility" forKey:@"splitpane"]; /* * All the components below should be ignored by the accessibility subsystem, @@ -163,7 +165,7 @@ - (NSRect)accessibilityFrame return NSMakeRect(point.x, point.y, size.width, size.height); } -- (nullable id)accessibilityParent +- (id _Nullable)accessibilityParent { return [self accessibilityParentAttribute]; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.h index c40467cf7bf..667e37f55cd 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.h @@ -34,9 +34,9 @@ @interface CommonTextAccessibility : CommonComponentAccessibility { } -- (nullable NSString *)accessibilityValueAttribute; +- (NSString * _Nullable)accessibilityValueAttribute; - (NSRange)accessibilityVisibleCharacterRangeAttribute; -- (nullable NSString *)accessibilityStringForRangeAttribute:(NSRange)parameter; +- (NSString * _Nullable)accessibilityStringForRangeAttribute:(NSRange)parameter; @end #endif diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.h index 2b4540f2892..e89e0179082 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.h @@ -31,6 +31,6 @@ @interface GroupAccessibility : CommonComponentAccessibility { }; - +- (NSAccessibilityRole _Nonnull)accessibilityRole; - (NSArray * _Nullable)accessibilityChildren; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.m index ac0b5a80b4c..1a33b6a003a 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/GroupAccessibility.m @@ -32,6 +32,10 @@ * classes reflecting the logic of the class. */ @implementation GroupAccessibility +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityGroupRole; +} /* * Return all non-ignored children. diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.h index fcfe9ef281c..5d4a53914ad 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.h @@ -31,5 +31,6 @@ @interface ImageAccessibility : CommonComponentAccessibility { }; -- (nullable NSString *)accessibilityLabel; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (NSString * _Nullable)accessibilityLabel; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.m index de6fcc951f7..4882d709a01 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ImageAccessibility.m @@ -29,7 +29,12 @@ * Implementation of the accessibility peer for the icon role */ @implementation ImageAccessibility -- (nullable NSString *)accessibilityLabel +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityImageRole; +} + +- (NSString * _Nullable)accessibilityLabel { return [self accessibilityTitleAttribute]; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.h index 80835d810b4..f178ed25949 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.h @@ -28,5 +28,6 @@ @interface RadiobuttonAccessibility : ButtonAccessibility { }; -- (id)accessibilityValue; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (id _Nonnull)accessibilityValue; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.m index 79325551fa9..8254b63df3d 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/RadiobuttonAccessibility.m @@ -31,8 +31,12 @@ * Implementation of the accessibility peer for the radiobutton role */ @implementation RadiobuttonAccessibility +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityRadioButtonRole; +} -- (id) accessibilityValue +- (id _Nonnull) accessibilityValue { AWT_ASSERT_APPKIT_THREAD; return [self accessibilityValueAttribute]; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.h index 803c83ba9fe..07837c8c967 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.h @@ -31,7 +31,7 @@ @interface ScrollAreaAccessibility : CommonComponentAccessibility { }; -- (NSString * _Nonnull)accessibilityRole; +- (NSAccessibilityRole _Nonnull)accessibilityRole; - (NSArray * _Nullable)accessibilityContents; - (id _Nullable)accessibilityHorizontalScrollBar; - (id _Nullable)accessibilityVerticalScrollBar; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.m index f1c94247650..71c8de3de6a 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollAreaAccessibility.m @@ -83,9 +83,9 @@ - (id _Nullable)getScrollBarwithOrientation:(enum NSAccessibilityOrientation)ori return nil; } -- (NSString * _Nonnull)accessibilityRole +- (NSAccessibilityRole _Nonnull)accessibilityRole { - return [self accessibilityRoleAttribute]; + return NSAccessibilityScrollAreaRole; } - (NSArray * _Nullable)accessibilityContents diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.h index 5ff537545ea..a188928f464 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.h @@ -31,6 +31,6 @@ @interface ScrollBarAccessibility : CommonComponentAccessibility { }; -- (NSString * _Nonnull)accessibilityRole; +- (NSAccessibilityRole _Nonnull)accessibilityRole; - (NSAccessibilityOrientation) accessibilityOrientation; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.m index b500425f50a..113e8336352 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ScrollBarAccessibility.m @@ -32,9 +32,9 @@ */ @implementation ScrollBarAccessibility -- (NSString * _Nonnull)accessibilityRole +- (NSAccessibilityRole _Nonnull)accessibilityRole { - return [self accessibilityRoleAttribute]; + return NSAccessibilityScrollBarRole; } - (NSAccessibilityOrientation) accessibilityOrientation diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.h index 41dc0951c5b..7af32d572e2 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.h @@ -31,9 +31,9 @@ @interface SliderAccessibility : CommonComponentAccessibility { }; - -- (nullable NSString *)accessibilityLabel; -- (nullable id)accessibilityValue; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (NSString * _Nullable)accessibilityLabel; +- (id _Nullable)accessibilityValue; - (BOOL)accessibilityPerformDecrement; - (BOOL)accessibilityPerformIncrement; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.m index 3d7b1ebc442..5324b7e1afd 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SliderAccessibility.m @@ -32,12 +32,17 @@ * Implementation of the accessibility peer for the slider role */ @implementation SliderAccessibility -- (nullable NSString *)accessibilityLabel +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilitySliderRole; +} + +- (NSString * _Nullable)accessibilityLabel { return [self accessibilityTitleAttribute]; } -- (nullable id)accessibilityValue +- (id _Nullable)accessibilityValue { return [self accessibilityValueAttribute]; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.h index 9476a7ed83a..5503dc43cec 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.h @@ -31,9 +31,9 @@ @interface SpinboxAccessibility : CommonComponentAccessibility { }; - -- (nullable NSString *)accessibilityLabel; -- (nullable id)accessibilityValue; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (NSString * _Nullable)accessibilityLabel; +- (id _Nullable)accessibilityValue; - (BOOL)accessibilityPerformDecrement; - (BOOL)accessibilityPerformIncrement; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m index 49e9e8cde30..7290a2ee848 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m @@ -32,12 +32,17 @@ * Implementation of the accessibility peer for the spinner role */ @implementation SpinboxAccessibility -- (nullable NSString *)accessibilityLabel +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityIncrementorRole; +} + +- (NSString * _Nullable)accessibilityLabel { return [self accessibilityTitleAttribute]; } -- (nullable id)accessibilityValue +- (id _Nullable)accessibilityValue { return [self accessibilityValueAttribute]; } diff --git a/test/jdk/tools/launcher/modules/illegalaccess/modules/m/p/Type.java b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.h similarity index 66% rename from test/jdk/tools/launcher/modules/illegalaccess/modules/m/p/Type.java rename to src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.h index b83e70be94c..09a7790dc80 100644 --- a/test/jdk/tools/launcher/modules/illegalaccess/modules/m/p/Type.java +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.h @@ -1,10 +1,12 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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. + * 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 @@ -21,11 +23,13 @@ * questions. */ -package p; +#import "JavaComponentAccessibility.h" +#import "GroupAccessibility.h" -public class Type { +#import - private Type(int x, int y) { } +@interface SplitpaneAccessibility : GroupAccessibility { - public Type(int x) { } -} +}; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +@end diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/ActivateMe.java b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.m similarity index 64% rename from test/jdk/java/rmi/activation/Activatable/checkActivateRef/ActivateMe.java rename to src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.m index 0e0bd2eb79b..253667fa9e1 100644 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/ActivateMe.java +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SplitpaneAccessibility.m @@ -1,10 +1,12 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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. + * 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 @@ -21,12 +23,16 @@ * questions. */ -/** - * +#import "SplitpaneAccessibility.h" + +/* + * Implementation of the accessibility peer for the Splitpane role */ -import java.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; +@implementation SplitpaneAccessibility + +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilitySplitGroupRole; } + +@end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.h index 39cc1227ec3..17fb3eb778c 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.h @@ -34,8 +34,9 @@ @interface StaticTextAccessibility : CommonTextAccessibility { }; -- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range; -- (nullable NSString *)accessibilityValue; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range; +- (NSString * _Nullable)accessibilityValue; - (NSRange)accessibilityVisibleCharacterRange; @end #endif diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.m index a22cb0bd14e..8e905c45c64 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/StaticTextAccessibility.m @@ -27,12 +27,17 @@ @implementation StaticTextAccessibility -- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityStaticTextRole; +} + +- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range { return [self accessibilityStringForRangeAttribute:range]; } -- (nullable NSString *)accessibilityValue +- (NSString * _Nullable)accessibilityValue { return [self accessibilityValueAttribute]; } diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/RegisteringActivatable.java b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.h similarity index 65% rename from test/jdk/java/rmi/activation/Activatable/shutdownGracefully/RegisteringActivatable.java rename to src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.h index c627bbbf479..88e48e13ba8 100644 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/RegisteringActivatable.java +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.h @@ -1,10 +1,12 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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. + * 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 @@ -21,12 +23,13 @@ * questions. */ -/** - * - */ -import java.rmi.Remote; -import java.rmi.RemoteException; +#import "JavaComponentAccessibility.h" +#import "CommonComponentAccessibility.h" + +#import + +@interface ToolbarAccessibility : CommonComponentAccessibility { -public interface RegisteringActivatable extends Remote { - public void shutdown() throws Exception; -} +}; +- (NSAccessibilityRole _Nonnull)accessibilityRole; +@end diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/MyRMI.java b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.m similarity index 65% rename from test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/MyRMI.java rename to src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.m index 3289981725f..8609324be8d 100644 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/MyRMI.java +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ToolbarAccessibility.m @@ -1,10 +1,12 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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. + * 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 @@ -21,13 +23,15 @@ * questions. */ -/** - * +#import "ToolbarAccessibility.h" + +/* + * Implementation of the accessibility peer for the Toolbar role */ -import java.rmi.Remote; -import java.rmi.RemoteException; +@implementation ToolbarAccessibility -public interface MyRMI extends java.rmi.Remote { - public boolean classLoaderOk() throws RemoteException; - public void shutdown() throws Exception; +- (NSAccessibilityRole _Nonnull)accessibilityRole +{ + return NSAccessibilityToolbarRole; } +@end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m index 7601aacfa62..bf55d8c8976 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m @@ -701,9 +701,6 @@ void copyFromMTLBuffer(void *pDst, id srcBuf, NSUInteger offset, NSUI pDst = PtrPixelsRow(pDst, dstx, dstInfo.pixelStride); pDst = PtrPixelsRow(pDst, dsty, dstInfo.scanStride); - // Metal texture is (0,0) at left-top - srcx = srcOps->xOffset + srcx; - srcy = srcOps->yOffset + srcy; NSUInteger byteLength = w * h * 4; // NOTE: assume that src format is MTLPixelFormatBGRA8Unorm // Create MTLBuffer (or use static) diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLPipelineStatesStorage.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLPipelineStatesStorage.m index c6a0e4828c2..0928f12d426 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLPipelineStatesStorage.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLPipelineStatesStorage.m @@ -265,13 +265,13 @@ - (void) dealloc { * The MTLBlendRule structure encapsulates the two enumerated values that * comprise a given Porter-Duff blending (compositing) rule. For example, * the "SrcOver" rule can be represented by: - * rule.src = GL_ONE; - * rule.dst = GL_ONE_MINUS_SRC_ALPHA; + * rule.src = MTLBlendFactorZero; + * rule.dst = MTLBlendFactorOneMinusSourceAlpha; * - * GLenum src; + * MTLBlendFactor src; * The constant representing the source factor in this Porter-Duff rule. * - * GLenum dst; + * MTLBlendFactor dst; * The constant representing the destination factor in this Porter-Duff rule. */ struct MTLBlendRule { diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m index 4ea91bc0591..b479ba6fbfd 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m @@ -46,10 +46,6 @@ jint mtlPreviousOp = MTL_OP_INIT; -/** - * The following methods are implemented in the windowing system (i.e. GLX - * and WGL) source files. - */ extern void MTLGC_DestroyMTLGraphicsConfig(jlong pConfigInfo); void MTLRenderQueue_CheckPreviousOp(jint op) { diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m index feb22105242..129ba99adcc 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m @@ -28,20 +28,11 @@ #import "sun_java2d_metal_MTLSurfaceData.h" #import "jni_util.h" -#import "MTLRenderQueue.h" #import "MTLGraphicsConfig.h" #import "MTLSurfaceData.h" -#import "ThreadUtilities.h" #include "jlong.h" -/** - * The following methods are implemented in the windowing system (i.e. GLX - * and WGL) source files. - */ -extern jlong MTLSD_GetNativeConfigInfo(BMTLSDOps *bmtlsdo); -extern jboolean MTLSD_InitMTLWindow(JNIEnv *env, BMTLSDOps *bmtlsdo); -extern void MTLSD_DestroyMTLSurface(JNIEnv *env, BMTLSDOps *bmtlsdo); - +jboolean MTLSD_InitMTLWindow(JNIEnv *env, BMTLSDOps *bmtlsdo); void MTLSD_SetNativeDimensions(JNIEnv *env, BMTLSDOps *bmtlsdo, jint w, jint h); static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque, jboolean rtt, jint width, jint height) { @@ -98,12 +89,8 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque stencilTextureDescriptor.storageMode = MTLStorageModePrivate; bmtlsdo->pStencilTexture = [ctx.device newTextureWithDescriptor:stencilTextureDescriptor]; bmtlsdo->isOpaque = isOpaque; - bmtlsdo->xOffset = 0; - bmtlsdo->yOffset = 0; bmtlsdo->width = width; bmtlsdo->height = height; - bmtlsdo->textureWidth = width; - bmtlsdo->textureHeight = height; bmtlsdo->drawableType = rtt ? MTLSD_RT_TEXTURE : MTLSD_TEXTURE; J2dTraceLn6(J2D_TRACE_VERBOSE, "MTLSurfaceData_initTexture: w=%d h=%d bp=%p [tex=%p] opaque=%d rtt=%d", width, height, bmtlsdo, bmtlsdo->pTexture, isOpaque, rtt); @@ -182,7 +169,7 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque { J2dTraceLn3(J2D_TRACE_VERBOSE, "MTLSD_Delete: type=%d %p [tex=%p]", bmtlsdo->drawableType, bmtlsdo, bmtlsdo->pTexture); if (bmtlsdo->drawableType == MTLSD_WINDOW) { - MTLSD_DestroyMTLSurface(env, bmtlsdo); + bmtlsdo->drawableType = MTLSD_UNDEFINED; } else if ( bmtlsdo->drawableType == MTLSD_RT_TEXTURE || bmtlsdo->drawableType == MTLSD_TEXTURE @@ -254,18 +241,6 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque JNU_ThrowInternalError(env, "MTLSD_Unlock not implemented!"); } -/** - * This function disposes of any native windowing system resources associated - * with this surface. - */ -void -MTLSD_DestroyMTLSurface(JNIEnv *env, BMTLSDOps * bmtlsdo) -{ - J2dTraceLn(J2D_TRACE_ERROR, "MTLSD_DestroyMTLSurface not implemented!"); - JNI_COCOA_ENTER(env); - bmtlsdo->drawableType = MTLSD_UNDEFINED; - JNI_COCOA_EXIT(env); -} /** * This function initializes a native window surface and caches the window @@ -346,10 +321,8 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque bmtlsdo->sdOps.GetRasInfo = MTLSD_GetRasInfo; bmtlsdo->sdOps.Unlock = MTLSD_Unlock; bmtlsdo->sdOps.Dispose = MTLSD_Dispose; - bmtlsdo->drawableType = MTLSD_UNDEFINED; - bmtlsdo->xOffset = xoff; - bmtlsdo->yOffset = yoff; + bmtlsdo->isOpaque = isOpaque; mtlsdo->peerData = (AWTView *)jlong_to_ptr(pPeerData); diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.h b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.h index 3f4d218ba16..261363f42e2 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceDataBase.h @@ -27,7 +27,6 @@ #define MTLSurfaceDataBase_h_Included #include "java_awt_image_AffineTransformOp.h" -#include "sun_java2d_metal_MTLSurfaceData.h" #include "sun_java2d_pipe_hw_AccelSurface.h" #include "SurfaceData.h" @@ -38,7 +37,7 @@ * information pertaining to the native surface. Some information about * the more important/different fields: * - * void *privOps; + * void* privOps; * Pointer to native-specific (Metal) SurfaceData info, such as the * native Drawable handle and GraphicsConfig data. * @@ -48,62 +47,44 @@ * * jboolean isOpaque; * If true, the surface should be treated as being fully opaque. If - * the underlying surface (e.g. pbuffer) has an alpha channel and isOpaque - * is true, then we should take appropriate action (i.e. call glColorMask() - * to disable writes into the alpha channel) to ensure that the surface - * remains fully opaque. - * - * jint x/yOffset - * The offset in pixels of the Metal viewport origin from the lower-left - * corner of the heavyweight drawable. For example, a top-level frame on - * Windows XP has lower-left insets of (4,4). The Metal viewport origin - * would typically begin at the lower-left corner of the client region (inside - * the frame decorations), but AWT/Swing will take the insets into account - * when rendering into that window. So in order to account for this, we - * need to adjust the Metal viewport origin by an x/yOffset of (-4,-4). On - * X11, top-level frames typically don't have this insets issue, so their - * x/yOffset would be (0,0) (the same applies to pbuffers). + * the underlying surface (e.g. MTLTexture/MTLBuffer) has an alpha channel and + * isOpaque is true, then we should take appropriate action to ensure that the + * surface remains fully opaque. * * jint width/height; - * The cached surface bounds. For offscreen surface types (MTLSD_FBOBJECT, - * MTLSD_TEXTURE, etc.) these values must remain constant. Onscreen window - * surfaces (MTLSD_WINDOW, MTLSD_FLIP_BACKBUFFER, etc.) may have their - * bounds changed in response to a programmatic or user-initiated event, so - * these values represent the last known dimensions. To determine the true - * current bounds of this surface, query the native Drawable through the + * The cached surface bounds. For offscreen surface types ( + * MTLSD_TEXTURE, MTLSD_RT_TEXTURE etc.) these values must remain constant. + * Onscreen window surfaces (MTLSD_WINDOW, MTLSD_FLIP_BACKBUFFER, etc.) may + * have their bounds changed in response to a programmatic or user-initiated + * event, so these values represent the last known dimensions. To determine the + * true current bounds of this surface, query the native Drawable through the * privOps field. * * void* pTexture; * The texture object handle, as generated by MTLTextureDescriptor(). If this * value is null, the texture has not yet been initialized. * - * jint textureWidth/Height; - * The actual bounds of the texture object for this surface. - * The texture image that we care about has dimensions specified by the width - * and height fields in this MTLSDOps structure. + * void* pStencilTexture; + * The byte buffer stencil mask used in rendering Metal rendering pass. */ typedef struct { SurfaceDataOps sdOps; - void *privOps; + void* privOps; jobject graphicsConfig; jint drawableType; jboolean isOpaque; - jint xOffset; - jint yOffset; jint width; jint height; void* pTexture; void* pStencilData; // stencil data to be rendered to this buffer void* pStencilTexture; // stencil texture byte buffer stencil mask used in main rendering - jint textureWidth; - jint textureHeight; } BMTLSDOps; #define MTLSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED #define MTLSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW #define MTLSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE #define MTLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER -#define MTLSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE +#define MTLSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE /** * These are shorthand names for the filtering method constants used by diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m index 06c3190fc61..5fa10d11021 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m @@ -422,8 +422,8 @@ void MTLTR_FreeGlyphCaches() { tx2 = cell->tx2; ty2 = cell->ty2; - J2dTraceLn4(J2D_TRACE_INFO, "tx1 %f, ty1 %f, tx2 %f, ty2 %f", tx1, ty1, tx2, ty2); - J2dTraceLn2(J2D_TRACE_INFO, "textureWidth %d textureHeight %d", dstOps->textureWidth, dstOps->textureHeight); + J2dTraceLn4(J2D_TRACE_INFO, "tx1 = %f, ty1 = %f, tx2 = %f, ty2 = %f", tx1, ty1, tx2, ty2); + J2dTraceLn2(J2D_TRACE_INFO, "width = %d height = %d", dstOps->width, dstOps->height); LCD_ADD_TRIANGLES(tx1, ty1, tx2, ty2, x, y, x+w, y+h); @@ -557,9 +557,7 @@ void MTLTR_FreeGlyphCaches() { tx2 = 1.0f; ty2 = 1.0f; - J2dTraceLn3(J2D_TRACE_INFO, "xOffset %d yOffset %d, dstOps->height %d", dstOps->xOffset, dstOps->yOffset, dstOps->height); - J2dTraceLn4(J2D_TRACE_INFO, "tx1 %f, ty1 %f, tx2 %f, ty2 %f", tx1, ty1, tx2, ty2); - J2dTraceLn2(J2D_TRACE_INFO, "textureWidth %d textureHeight %d", dstOps->textureWidth, dstOps->textureHeight); + J2dTraceLn2(J2D_TRACE_INFO, "MTLTR_DrawLCDGlyphNoCache : dstOps->width = %d, dstOps->height = %d", dstOps->width, dstOps->height); LCD_ADD_TRIANGLES(tx1, ty1, tx2, ty2, x, y, x+w, y+h); diff --git a/src/java.desktop/share/classes/java/awt/ComponentOrientation.java b/src/java.desktop/share/classes/java/awt/ComponentOrientation.java index abec1d907e7..afa1e8af94a 100644 --- a/src/java.desktop/share/classes/java/awt/ComponentOrientation.java +++ b/src/java.desktop/share/classes/java/awt/ComponentOrientation.java @@ -158,14 +158,10 @@ public static ComponentOrientation getOrientation(Locale locale) { // to find the appropriate orientation. Until pluggable locales // are introduced however, the flexibility isn't really needed. // So we choose efficiency instead. - String lang = locale.getLanguage(); - if( "iw".equals(lang) || "ar".equals(lang) - || "fa".equals(lang) || "ur".equals(lang) ) - { - return RIGHT_TO_LEFT; - } else { - return LEFT_TO_RIGHT; - } + return switch (locale.getLanguage()) { + case "ar", "fa", "he", "iw", "ji", "ur", "yi" -> RIGHT_TO_LEFT; + default -> LEFT_TO_RIGHT; + }; } /** diff --git a/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java b/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java index bdcdd8f3545..84b94ceeffe 100644 --- a/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java +++ b/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, 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 @@ -26,6 +26,7 @@ package javax.swing.filechooser; import java.awt.Image; +import java.awt.image.AbstractMultiResolutionImage; import java.beans.PropertyChangeListener; import java.io.File; import java.io.FileNotFoundException; @@ -225,7 +226,7 @@ public String getSystemTypeDescription(File f) { * Icon for a file, directory, or folder as it would be displayed in * a system file browser. Example from Windows: the "M:\" directory * displays a CD-ROM icon. - * + *

* The default implementation gets information from the ShellFolder class. * * @param f a File object @@ -255,6 +256,67 @@ public Icon getSystemIcon(File f) { } } + /** + * Returns an icon for a file, directory, or folder as it would be displayed + * in a system file browser for the requested size. + *

+ * Example:

+    *     FileSystemView fsv = FileSystemView.getFileSystemView();
+    *     Icon icon = fsv.getSystemIcon(new File("application.exe"), 64, 64);
+    *     JLabel label = new JLabel(icon);
+    * 
+ * + * @implSpec The available icons may be platform specific and so the + * available sizes determined by the platform. Therefore an exact match + * for the requested size may not be possible. + * + * The icon returned may be a multi-resolution icon image, + * which allows better support for High DPI environments + * with different scaling factors. + * + * @param f a {@code File} object for which the icon will be retrieved + * @param width width of the icon in user coordinate system. + * @param height height of the icon in user coordinate system. + * @return an icon as it would be displayed by a native file chooser + * or null for a non-existent or inaccessible file. + * @throws IllegalArgumentException if an invalid parameter such + * as a negative size or a null file reference is passed. + * @see JFileChooser#getIcon + * @see AbstractMultiResolutionImage + * @see FileSystemView#getSystemIcon(File) + * @since 17 + */ + public Icon getSystemIcon(File f, int width, int height) { + if (height < 1 || width < 1) { + throw new IllegalArgumentException("Icon size can not be below 1"); + } + + if (f == null) { + throw new IllegalArgumentException("The file reference should not be null"); + } + + if(!f.exists()) { + return null; + } + + ShellFolder sf; + + try { + sf = ShellFolder.getShellFolder(f); + } catch (FileNotFoundException e) { + return null; + } + + Image img = sf.getIcon(width, height); + + if (img != null) { + return new ImageIcon(img, sf.getFolderType()); + } else { + return UIManager.getIcon(f.isDirectory() ? "FileView.directoryIcon" + : "FileView.fileIcon"); + } + } + /** * On Windows, a file can appear in multiple folders, other than its * parent directory in the filesystem. Folder could for example be the diff --git a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java index 3c48e08d319..94402e08807 100644 --- a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java +++ b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java @@ -207,6 +207,16 @@ public Image getIcon(boolean getLargeIcon) { return null; } + /** + * Returns the icon of the specified size used to display this shell folder. + * + * @param width width of the icon > 0 + * @param height height of the icon > 0 + * @return The icon of the specified size used to display this shell folder + */ + public Image getIcon(int width, int height) { + return null; + } // Static diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java index eebe8e19d2a..b0f1251943d 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -82,6 +82,16 @@ @SuppressWarnings("serial") // JDK-implementation class final class Win32ShellFolder2 extends ShellFolder { + static final int SMALL_ICON_SIZE = 16; + static final int LARGE_ICON_SIZE = 32; + static final int MIN_QUALITY_ICON = 16; + static final int MAX_QUALITY_ICON = 256; + private final static int[] ICON_RESOLUTIONS + = {16, 24, 32, 48, 64, 72, 96, 128, 256}; + + static final int FILE_ICON_ID = 1; + static final int FOLDER_ICON_ID = 4; + private static native void initIDs(); static { @@ -991,14 +1001,15 @@ public String getExecutableType() { // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details private static native long extractIcon(long parentIShellFolder, long relativePIDL, - boolean getLargeIcon, boolean getDefaultIcon); + int size, boolean getDefaultIcon); + + // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details + private static native boolean hiResIconAvailable(long parentIShellFolder, long relativePIDL); // Returns an icon from the Windows system icon list in the form of an HICON private static native long getSystemIcon(int iconID); private static native long getIconResource(String libName, int iconID, - int cxDesired, int cyDesired, - boolean useVGAColors); - // Note: useVGAColors is ignored on XP and later + int cxDesired, int cyDesired); // Return the bits from an HICON. This has a side effect of setting // the imageHash variable for efficient caching / comparing. @@ -1018,20 +1029,17 @@ private long getIShellIcon() { return pIShellIcon; } - private static Image makeIcon(long hIcon, boolean getLargeIcon) { + private static Image makeIcon(long hIcon) { if (hIcon != 0L && hIcon != -1L) { // Get the bits. This has the side effect of setting the imageHash value for this object. final int[] iconBits = getIconBits(hIcon); if (iconBits != null) { // icons are always square - final int size = (int) Math.sqrt(iconBits.length); - final int baseSize = getLargeIcon ? 32 : 16; + final int iconSize = (int) Math.sqrt(iconBits.length); final BufferedImage img = - new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); - img.setRGB(0, 0, size, size, iconBits, 0, size); - return size == baseSize - ? img - : new MultiResolutionIconImage(baseSize, img); + new BufferedImage(iconSize, iconSize, BufferedImage.TYPE_INT_ARGB); + img.setRGB(0, 0, iconSize, iconSize, iconBits, 0, iconSize); + return img; } } return null; @@ -1043,11 +1051,13 @@ private static Image makeIcon(long hIcon, boolean getLargeIcon) { */ public Image getIcon(final boolean getLargeIcon) { Image icon = getLargeIcon ? largeIcon : smallIcon; + int size = getLargeIcon ? LARGE_ICON_SIZE : SMALL_ICON_SIZE; if (icon == null) { icon = invoke(new Callable() { public Image call() { Image newIcon = null; + Image newIcon2 = null; if (isLink()) { Win32ShellFolder2 folder = getLinkLocation(false); if (folder != null && folder.isLibrary()) { @@ -1072,33 +1082,40 @@ public Image call() { newIcon = imageCache.get(Integer.valueOf(index)); if (newIcon == null) { long hIcon = getIcon(getAbsolutePath(), getLargeIcon); - newIcon = makeIcon(hIcon, getLargeIcon); + newIcon = makeIcon(hIcon); disposeIcon(hIcon); if (newIcon != null) { imageCache.put(Integer.valueOf(index), newIcon); } } - } - } - - if (newIcon == null) { - // These are only cached per object - long hIcon = extractIcon(getParentIShellFolder(), - getRelativePIDL(), getLargeIcon, false); - // E_PENDING: loading can take time so get the default - if(hIcon <= 0) { - hIcon = extractIcon(getParentIShellFolder(), - getRelativePIDL(), getLargeIcon, true); - if(hIcon <= 0) { - if (isDirectory()) { - return getShell32Icon(4, getLargeIcon); + if (newIcon != null) { + if (isLink()) { + imageCache = getLargeIcon ? smallLinkedSystemImages + : largeLinkedSystemImages; } else { - return getShell32Icon(1, getLargeIcon); + imageCache = getLargeIcon ? smallSystemImages : largeSystemImages; + } + newIcon2 = imageCache.get(index); + if (newIcon2 == null) { + long hIcon = getIcon(getAbsolutePath(), !getLargeIcon); + newIcon2 = makeIcon(hIcon); + disposeIcon(hIcon); } } + + if (newIcon2 != null) { + Map bothIcons = new HashMap<>(2); + bothIcons.put(getLargeIcon ? LARGE_ICON_SIZE : SMALL_ICON_SIZE, newIcon); + bothIcons.put(getLargeIcon ? SMALL_ICON_SIZE : LARGE_ICON_SIZE, newIcon2); + newIcon = new MultiResolutionIconImage(getLargeIcon ? LARGE_ICON_SIZE + : SMALL_ICON_SIZE, bothIcons); + } } - newIcon = makeIcon(hIcon, getLargeIcon); - disposeIcon(hIcon); + } + + if (hiResIconAvailable(getParentIShellFolder(), getRelativePIDL()) || newIcon == null) { + int size = getLargeIcon ? LARGE_ICON_SIZE : SMALL_ICON_SIZE; + newIcon = getIcon(size, size); } if (newIcon == null) { @@ -1107,21 +1124,68 @@ public Image call() { return newIcon; } }); - if (getLargeIcon) { - largeIcon = icon; - } else { - smallIcon = icon; - } } return icon; } + /** + * @return The icon image of specified size used to display this shell folder + */ + public Image getIcon(int width, int height) { + int size = Math.max(width, height); + return invoke(() -> { + Image newIcon = null; + if (isLink()) { + Win32ShellFolder2 folder = getLinkLocation(false); + if (folder != null && folder.isLibrary()) { + return folder.getIcon(size, size); + } + } + Map multiResolutionIcon = new HashMap<>(); + int start = size > MAX_QUALITY_ICON ? ICON_RESOLUTIONS.length - 1 : 0; + int increment = size > MAX_QUALITY_ICON ? -1 : 1; + int end = size > MAX_QUALITY_ICON ? -1 : ICON_RESOLUTIONS.length; + for (int i = start; i != end; i += increment) { + int s = ICON_RESOLUTIONS[i]; + if (size < MIN_QUALITY_ICON || size > MAX_QUALITY_ICON + || (s >= size && s <= size*2)) { + long hIcon = extractIcon(getParentIShellFolder(), + getRelativePIDL(), s, false); + + // E_PENDING: loading can take time so get the default + if (hIcon <= 0) { + hIcon = extractIcon(getParentIShellFolder(), + getRelativePIDL(), s, true); + if (hIcon <= 0) { + if (isDirectory()) { + return getShell32Icon(FOLDER_ICON_ID, size); + } else { + return getShell32Icon(FILE_ICON_ID, size); + } + } + } + newIcon = makeIcon(hIcon); + disposeIcon(hIcon); + + multiResolutionIcon.put(s, newIcon); + if (size < MIN_QUALITY_ICON || size > MAX_QUALITY_ICON) { + break; + } + } + } + return new MultiResolutionIconImage(size, multiResolutionIcon); + }); + } + /** * Gets an icon from the Windows system icon list as an {@code Image} */ static Image getSystemIcon(SystemIcon iconType) { long hIcon = getSystemIcon(iconType.getIconID()); - Image icon = makeIcon(hIcon, true); + Image icon = makeIcon(hIcon); + if (LARGE_ICON_SIZE != icon.getWidth(null)) { + icon = new MultiResolutionIconImage(LARGE_ICON_SIZE, icon); + } disposeIcon(hIcon); return icon; } @@ -1129,20 +1193,13 @@ static Image getSystemIcon(SystemIcon iconType) { /** * Gets an icon from the Windows system icon list as an {@code Image} */ - static Image getShell32Icon(int iconID, boolean getLargeIcon) { - boolean useVGAColors = true; // Will be ignored on XP and later - - int size = getLargeIcon ? 32 : 16; - - Toolkit toolkit = Toolkit.getDefaultToolkit(); - String shellIconBPP = (String)toolkit.getDesktopProperty("win.icon.shellIconBPP"); - if (shellIconBPP != null) { - useVGAColors = shellIconBPP.equals("4"); - } - - long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors); + static Image getShell32Icon(int iconID, int size) { + long hIcon = getIconResource("shell32.dll", iconID, size, size); if (hIcon != 0) { - Image icon = makeIcon(hIcon, getLargeIcon); + Image icon = makeIcon(hIcon); + if (size != icon.getWidth(null)) { + icon = new MultiResolutionIconImage(size, icon); + } disposeIcon(hIcon); return icon; } @@ -1325,13 +1382,17 @@ public List call() throws Exception { } static class MultiResolutionIconImage extends AbstractMultiResolutionImage { - final int baseSize; - final Image resolutionVariant; + final Map resolutionVariants = new HashMap<>(); + + public MultiResolutionIconImage(int baseSize, Map resolutionVariants) { + this.baseSize = baseSize; + this.resolutionVariants.putAll(resolutionVariants); + } - public MultiResolutionIconImage(int baseSize, Image resolutionVariant) { + public MultiResolutionIconImage(int baseSize, Image image) { this.baseSize = baseSize; - this.resolutionVariant = resolutionVariant; + this.resolutionVariants.put(baseSize, image); } @Override @@ -1346,17 +1407,34 @@ public int getHeight(ImageObserver observer) { @Override protected Image getBaseImage() { - return resolutionVariant; + return getResolutionVariant(baseSize, baseSize); } @Override public Image getResolutionVariant(double width, double height) { - return resolutionVariant; + int dist = 0; + Image retVal = null; + // We only care about width since we don't support non-rectangular icons + int w = (int) width; + int retindex = 0; + for (Integer i : resolutionVariants.keySet()) { + if (retVal == null || dist > Math.abs(i - w) + || (dist == Math.abs(i - w) && i > retindex)) { + retindex = i; + dist = Math.abs(i - w); + retVal = resolutionVariants.get(i); + if (i == w) { + break; + } + } + } + return retVal; } @Override public List getResolutionVariants() { - return Arrays.asList(resolutionVariant); + return Collections.unmodifiableList( + new ArrayList(resolutionVariants.values())); } } } diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java index 8dd6cbbb38b..c9fdfcd4220 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -53,10 +53,12 @@ import static sun.awt.shell.Win32ShellFolder2.DESKTOP; import static sun.awt.shell.Win32ShellFolder2.DRIVES; import static sun.awt.shell.Win32ShellFolder2.Invoker; +import static sun.awt.shell.Win32ShellFolder2.LARGE_ICON_SIZE; import static sun.awt.shell.Win32ShellFolder2.MultiResolutionIconImage; import static sun.awt.shell.Win32ShellFolder2.NETWORK; import static sun.awt.shell.Win32ShellFolder2.PERSONAL; import static sun.awt.shell.Win32ShellFolder2.RECENT; +import static sun.awt.shell.Win32ShellFolder2.SMALL_ICON_SIZE; // NOTE: This class supersedes Win32ShellFolderManager, which was removed // from distribution after version 1.4.2. @@ -144,9 +146,9 @@ private static Image getStandardViewButton(int iconIndex) { new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); img.setRGB(0, 0, size, size, iconBits, 0, size); - STANDARD_VIEW_BUTTONS[iconIndex] = (size == 16) + STANDARD_VIEW_BUTTONS[iconIndex] = (size == SMALL_ICON_SIZE) ? img - : new MultiResolutionIconImage(16, img); + : new MultiResolutionIconImage(SMALL_ICON_SIZE, img); } return STANDARD_VIEW_BUTTONS[iconIndex]; @@ -408,7 +410,8 @@ public Object get(String key) { try { int i = Integer.parseInt(name); if (i >= 0) { - return Win32ShellFolder2.getShell32Icon(i, key.startsWith("shell32LargeIcon ")); + return Win32ShellFolder2.getShell32Icon(i, + key.startsWith("shell32LargeIcon ") ? LARGE_ICON_SIZE : SMALL_ICON_SIZE); } } catch (NumberFormatException ex) { } diff --git a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp index 6e6d5bd0210..bc0c27d069a 100644 --- a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp +++ b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -880,7 +880,7 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIcon LPCTSTR pathStr = JNU_GetStringPlatformChars(env, absolutePath, NULL); JNU_CHECK_EXCEPTION_RETURN(env, 0); if (fn_SHGetFileInfo(pathStr, 0L, &fileInfo, sizeof(fileInfo), - SHGFI_ICON | (getLargeIcon ? 0 : SHGFI_SMALLICON)) != 0) { + SHGFI_ICON | (getLargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON)) != 0) { hIcon = fileInfo.hIcon; } JNU_ReleaseStringPlatformChars(env, absolutePath, pathStr); @@ -912,15 +912,54 @@ JNIEXPORT jint JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconIndex return (jint)index; } +/* + * Class: sun.awt.shell.Win32ShellFolder2 + * Method: hiResIconAvailable + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_sun_awt_shell_Win32ShellFolder2_hiResIconAvailable + (JNIEnv* env, jclass cls, jlong pIShellFolderL, jlong relativePIDL) +{ + IShellFolder* pIShellFolder = (IShellFolder*)pIShellFolderL; + LPITEMIDLIST pidl = (LPITEMIDLIST)relativePIDL; + if (pIShellFolder == NULL || pidl == NULL) { + return FALSE; + } + HRESULT hres; + IExtractIconW* pIcon; + hres = pIShellFolder->GetUIObjectOf(NULL, 1, const_cast(&pidl), + IID_IExtractIconW, NULL, (void**)&pIcon); + if (SUCCEEDED(hres)) { + WCHAR szBuf[MAX_PATH]; + INT index; + UINT flags; + UINT uFlags = GIL_FORSHELL | GIL_ASYNC; + hres = pIcon->GetIconLocation(uFlags, szBuf, MAX_PATH, &index, &flags); + if (SUCCEEDED(hres)) { + pIcon->Release(); + return wcscmp(szBuf, L"*") != 0; + } else if (hres == E_PENDING) { + uFlags = GIL_DEFAULTICON; + hres = pIcon->GetIconLocation(uFlags, szBuf, MAX_PATH, &index, &flags); + if (SUCCEEDED(hres)) { + pIcon->Release(); + return wcscmp(szBuf, L"*") != 0; + } + } + pIcon->Release(); + } + return FALSE; +} + /* * Class: sun_awt_shell_Win32ShellFolder2 * Method: extractIcon - * Signature: (JJZZ)J + * Signature: (JJIZ)J */ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon (JNIEnv* env, jclass cls, jlong pIShellFolderL, jlong relativePIDL, - jboolean getLargeIcon, jboolean getDefaultIcon) + jint size, jboolean getDefaultIcon) { IShellFolder* pIShellFolder = (IShellFolder*)pIShellFolderL; LPITEMIDLIST pidl = (LPITEMIDLIST)relativePIDL; @@ -941,16 +980,10 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_extractIcon UINT uFlags = getDefaultIcon ? GIL_DEFAULTICON : GIL_FORSHELL | GIL_ASYNC; hres = pIcon->GetIconLocation(uFlags, szBuf, MAX_PATH, &index, &flags); if (SUCCEEDED(hres)) { - HICON hIconLarge; - hres = pIcon->Extract(szBuf, index, &hIconLarge, &hIcon, (16 << 16) + 32); - if (SUCCEEDED(hres)) { - if (getLargeIcon) { - fn_DestroyIcon((HICON)hIcon); - hIcon = hIconLarge; - } else { - fn_DestroyIcon((HICON)hIconLarge); - } + if (size < 24) { + size = 16; } + hres = pIcon->Extract(szBuf, index, &hIcon, NULL, size); } else if (hres == E_PENDING) { pIcon->Release(); return E_PENDING; @@ -980,7 +1013,7 @@ JNIEXPORT void JNICALL Java_sun_awt_shell_Win32ShellFolder2_disposeIcon JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits (JNIEnv* env, jclass cls, jlong hicon) { - const int MAX_ICON_SIZE = 128; + const int MAX_ICON_SIZE = 256; int iconSize = 0; jintArray iconBits = NULL; @@ -1121,11 +1154,11 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getSystemIcon /* * Class: sun_awt_shell_Win32ShellFolder2 * Method: getIconResource - * Signature: (Ljava/lang/String;IIIZ)J + * Signature: (Ljava/lang/String;III)J */ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconResource (JNIEnv* env, jclass cls, jstring libName, jint iconID, - jint cxDesired, jint cyDesired, jboolean useVGAColors) + jint cxDesired, jint cyDesired) { const char *pLibName = env->GetStringUTFChars(libName, NULL); JNU_CHECK_EXCEPTION_RETURN(env, 0); @@ -1134,10 +1167,9 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconResource env->ReleaseStringUTFChars(libName, pLibName); } if (libHandle != NULL) { - UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0; return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID), IMAGE_ICON, cxDesired, cyDesired, - fuLoad)); + 0)); } return 0; } diff --git a/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java b/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java deleted file mode 100644 index 2d11c630594..00000000000 --- a/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 2000, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.rmi.rmid; - -import java.security.*; -import java.io.*; -import java.util.*; - -/** - * The ExecOptionPermission class represents permission for rmid to use - * a specific command-line option when launching an activation group. - * - * @author Ann Wollrath - * - * @serial exclude - * @deprecated See the - * - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -public final class ExecOptionPermission extends Permission -{ - /** - * does this permission have a wildcard at the end? - */ - private transient boolean wildcard; - - /** - * the name without the wildcard on the end - */ - private transient String name; - - /** - * UID for serialization - */ - private static final long serialVersionUID = 5842294756823092756L; - - public ExecOptionPermission(String name) { - super(name); - init(name); - } - - public ExecOptionPermission(String name, String actions) { - this(name); - } - - /** - * Checks if the specified permission is "implied" by - * this object. - *

- * More specifically, this method returns true if: - *

    - *
  • p's class is the same as this object's class, and - *
  • p's name equals or (in the case of wildcards) - * is implied by this object's - * name. For example, "a.b.*" implies "a.b.c", and - * "a.b=*" implies "a.b=c" - *
- * - * @param p the permission to check against. - * - * @return true if the passed permission is equal to or - * implied by this permission, false otherwise. - */ - public boolean implies(Permission p) { - if (!(p instanceof ExecOptionPermission)) - return false; - - ExecOptionPermission that = (ExecOptionPermission) p; - - if (this.wildcard) { - if (that.wildcard) { - // one wildcard can imply another - return that.name.startsWith(name); - } else { - // make sure p.name is longer so a.b.* doesn't imply a.b - return (that.name.length() > this.name.length()) && - that.name.startsWith(this.name); - } - } else { - if (that.wildcard) { - // a non-wildcard can't imply a wildcard - return false; - } else { - return this.name.equals(that.name); - } - } - } - - /** - * Checks two ExecOptionPermission objects for equality. - * Checks that obj's class is the same as this object's class - * and has the same name as this object. - * - * @param obj the object we are testing for equality with this object. - * @return true if obj is an ExecOptionPermission, and has the same - * name as this ExecOptionPermission object, false otherwise. - */ - public boolean equals(Object obj) { - if (obj == this) - return true; - - if ((obj == null) || (obj.getClass() != getClass())) - return false; - - ExecOptionPermission that = (ExecOptionPermission) obj; - - return this.getName().equals(that.getName()); - } - - - /** - * Returns the hash code value for this object. - * The hash code used is the hash code of the name, that is, - * getName().hashCode(), where getName is - * from the Permission superclass. - * - * @return a hash code value for this object. - */ - public int hashCode() { - return this.getName().hashCode(); - } - - /** - * Returns the canonical string representation of the actions. - * - * @return the canonical string representation of the actions. - */ - public String getActions() { - return ""; - } - - /** - * Returns a new PermissionCollection object for storing - * ExecOptionPermission objects. - *

- * An ExecOptionPermissionCollection stores a collection of - * ExecOptionPermission permissions. - * - *

ExecOptionPermission objects must be stored in a manner that allows - * them to be inserted in any order, but that also enables the - * PermissionCollection implies method - * to be implemented in an efficient (and consistent) manner. - * - * @return a new PermissionCollection object suitable for - * storing ExecOptionPermissions. - */ - public PermissionCollection newPermissionCollection() { - return new ExecOptionPermissionCollection(); - } - - /** - * readObject is called to restore the state of the ExecOptionPermission - * from a stream. - */ - private synchronized void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException - { - s.defaultReadObject(); - // init is called to initialize the rest of the values. - init(getName()); - } - - /** - * Initialize a ExecOptionPermission object. Common to all constructors. - * Also called during de-serialization. - */ - private void init(String name) - { - if (name == null) - throw new NullPointerException("name can't be null"); - - if (name.isEmpty()) { - throw new IllegalArgumentException("name can't be empty"); - } - - if (name.endsWith(".*") || name.endsWith("=*") || name.equals("*")) { - wildcard = true; - if (name.length() == 1) { - this.name = ""; - } else { - this.name = name.substring(0, name.length()-1); - } - } else { - this.name = name; - } - } - - /** - * A ExecOptionPermissionCollection stores a collection - * of ExecOptionPermission permissions. ExecOptionPermission objects - * must be stored in a manner that allows them to be inserted in any - * order, but enable the implies function to evaluate the implies - * method in an efficient (and consistent) manner. - * - * A ExecOptionPermissionCollection handles comparing a permission like - * "a.b.c.d.e" * with a Permission such as "a.b.*", or "*". - * - * @serial include - */ - private static class ExecOptionPermissionCollection - extends PermissionCollection - implements java.io.Serializable - { - - private Hashtable permissions; - private boolean all_allowed; // true if "*" is in the collection - private static final long serialVersionUID = -1242475729790124375L; - - /** - * Create an empty ExecOptionPermissionCollection. - */ - public ExecOptionPermissionCollection() { - permissions = new Hashtable<>(11); - all_allowed = false; - } - - /** - * Adds a permission to the collection. The key for the hash is - * permission.name. - * - * @param permission the Permission object to add. - * - * @exception IllegalArgumentException - if the permission is not a - * ExecOptionPermission - * - * @exception SecurityException - if this ExecOptionPermissionCollection - * object has been marked readonly - */ - - public void add(Permission permission) - { - if (! (permission instanceof ExecOptionPermission)) - throw new IllegalArgumentException("invalid permission: "+ - permission); - if (isReadOnly()) - throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection"); - - ExecOptionPermission p = (ExecOptionPermission) permission; - - permissions.put(p.getName(), permission); - if (!all_allowed) { - if (p.getName().equals("*")) - all_allowed = true; - } - } - - /** - * Check and see if this set of permissions implies the permissions - * expressed in "permission". - * - * @param p the Permission object to compare - * - * @return true if "permission" is a proper subset of a permission in - * the set, false if not. - */ - public boolean implies(Permission permission) - { - if (! (permission instanceof ExecOptionPermission)) - return false; - - ExecOptionPermission p = (ExecOptionPermission) permission; - - // short circuit if the "*" Permission was added - if (all_allowed) - return true; - - // strategy: - // Check for full match first. Then work our way up the - // name looking for matches on a.b.* - - String pname = p.getName(); - - Permission x = permissions.get(pname); - - if (x != null) - // we have a direct hit! - return x.implies(permission); - - - // work our way up the tree... - int last, offset; - - offset = pname.length() - 1; - - while ((last = pname.lastIndexOf('.', offset)) != -1) { - - pname = pname.substring(0, last+1) + "*"; - x = permissions.get(pname); - - if (x != null) { - return x.implies(permission); - } - offset = last - 1; - } - - // check for "=*" wildcard match - pname = p.getName(); - offset = pname.length() - 1; - - while ((last = pname.lastIndexOf('=', offset)) != -1) { - - pname = pname.substring(0, last+1) + "*"; - x = permissions.get(pname); - - if (x != null) { - return x.implies(permission); - } - offset = last - 1; - } - - // we don't have to check for "*" as it was already checked - // at the top (all_allowed), so we just return false - return false; - } - - /** - * Returns an enumeration of all the ExecOptionPermission objects in the - * container. - * - * @return an enumeration of all the ExecOptionPermission objects. - */ - - public Enumeration elements() - { - return permissions.elements(); - } - } -} diff --git a/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecPermission.java b/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecPermission.java deleted file mode 100644 index aca8e5597a4..00000000000 --- a/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecPermission.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2000, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.rmi.rmid; - -import java.security.*; -import java.io.*; -import java.util.*; - -/** - * The ExecPermission class represents permission for rmid to execute - * a specific command to launch an activation group. An ExecPermission - * consists of a pathname of a command to launch an activation group. - *

- * Pathname is the pathname of the file or directory to grant rmid - * execute permission. A pathname that ends in "/*" (where "/" is - * the file separator character, File.separatorChar) indicates - * all the files and directories contained in that directory. A pathname - * that ends with "/-" indicates (recursively) all files - * and subdirectories contained in that directory. A pathname consisting of - * the special token "{@code <>}" matches any file. - *

- * Note: A pathname consisting of a single "*" indicates all the files - * in the current directory, while a pathname consisting of a single "-" - * indicates all the files in the current directory and - * (recursively) all files and subdirectories contained in the current - * directory. - * - * - * @author Ann Wollrath - * - * @serial exclude - * @deprecated See the - * - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -public final class ExecPermission extends Permission -{ - /** - * UID for serialization - */ - private static final long serialVersionUID = -6208470287358147919L; - - private transient FilePermission fp; - - /** - * Creates a new ExecPermission object with the specified path. - * path is the pathname of a file or directory. - * - *

A pathname that ends in "/*" (where "/" is - * the file separator character, File.separatorChar) indicates - * a directory and all the files contained in that directory. A pathname - * that ends with "/-" indicates a directory and (recursively) all files - * and subdirectories contained in that directory. The special pathname - * "{@code <>}" matches all files. - * - *

A pathname consisting of a single "*" indicates all the files - * in the current directory, while a pathname consisting of a single "-" - * indicates all the files in the current directory and - * (recursively) all files and subdirectories contained in the current - * directory. - * - * @param path the pathname of the file/directory. - */ - public ExecPermission(String path) { - super(path); - init(path); - } - - /** - * Creates a new ExecPermission object with the specified path. - * path is the pathname of a file or directory. - * - *

A pathname that ends in "/*" (where "/" is - * the file separator character, File.separatorChar) indicates - * a directory and all the files contained in that directory. A pathname - * that ends with "/-" indicates a directory and (recursively) all files - * and subdirectories contained in that directory. The special pathname - * "{@code <>}" matches all files. - * - *

A pathname consisting of a single "*" indicates all the files - * in the current directory, while a pathname consisting of a single "-" - * indicates all the files in the current directory and - * (recursively) all files and subdirectories contained in the current - * directory. - * - * @param path the pathname of the file/directory. - * @param actions the action string (unused) - */ - public ExecPermission(String path, String actions) { - this(path); - } - - /** - * Checks if this ExecPermission object "implies" the specified permission. - *

- * More specifically, this method returns true if: - *

    - *
  • p is an instanceof ExecPermission, and - *
  • p's pathname is implied by this object's - * pathname. For example, "/tmp/*" implies "/tmp/foo", since - * "/tmp/*" encompasses the "/tmp" directory and all files in that - * directory, including the one named "foo". - *
- * @param p the permission to check against. - * - * @return true if the specified permission is implied by this object, - * false if not. - */ - public boolean implies(Permission p) { - if (!(p instanceof ExecPermission)) - return false; - - ExecPermission that = (ExecPermission) p; - - return fp.implies(that.fp); - } - - /** - * Checks two ExecPermission objects for equality. - * Checks that obj's class is the same as this object's class - * and has the same name as this object. - * - * @param obj the object we are testing for equality with this object. - * @return true if obj is an ExecPermission, and has the same - * pathname as this ExecPermission object, false otherwise. - */ - public boolean equals(Object obj) { - if (obj == this) - return true; - - if (! (obj instanceof ExecPermission)) - return false; - - ExecPermission that = (ExecPermission) obj; - - return fp.equals(that.fp); - } - - /** - * Returns the hash code value for this object. - * - * @return a hash code value for this object. - */ - public int hashCode() { - return this.fp.hashCode(); - } - - /** - * Returns the canonical string representation of the actions. - * - * @return the canonical string representation of the actions. - */ - public String getActions() { - return ""; - } - - /** - * Returns a new PermissionCollection object for storing - * ExecPermission objects. - *

- * A ExecPermissionCollection stores a collection of - * ExecPermission permissions. - * - *

ExecPermission objects must be stored in a manner that allows - * them to be inserted in any order, but that also enables the - * PermissionCollection implies method - * to be implemented in an efficient (and consistent) manner. - * - * @return a new PermissionCollection object suitable for - * storing ExecPermissions. - */ - public PermissionCollection newPermissionCollection() { - return new ExecPermissionCollection(); - } - - /** - * readObject is called to restore the state of the ExecPermission - * from a stream. - */ - private synchronized void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException - { - s.defaultReadObject(); - // init is called to initialize the rest of the values. - init(getName()); - } - - /** - * Initialize a ExecPermission object. Common to all constructors. - * Also called during de-serialization. - */ - private void init(String path) { - this.fp = new FilePermission(path, "execute"); - } - - /** - * A ExecPermissionCollection stores a collection - * of ExecPermission permissions. ExecPermission objects - * must be stored in a manner that allows them to be inserted in any - * order, but enable the implies function to evaluate the implies - * method in an efficient (and consistent) manner. - * - * @serial include - */ - private static class ExecPermissionCollection - extends PermissionCollection - implements java.io.Serializable - { - private Vector permissions; - - private static final long serialVersionUID = -3352558508888368273L; - - /** - * Create an empty ExecPermissionCollection. - */ - public ExecPermissionCollection() { - permissions = new Vector<>(); - } - - /** - * Adds a permission to the collection. - * - * @param permission the Permission object to add. - * - * @exception IllegalArgumentException - if the permission is not a - * ExecPermission - * - * @exception SecurityException - if this ExecPermissionCollection - * object has been marked readonly - */ - public void add(Permission permission) - { - if (! (permission instanceof ExecPermission)) - throw new IllegalArgumentException("invalid permission: "+ - permission); - if (isReadOnly()) - throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection"); - - permissions.addElement(permission); - } - - /** - * Check and see if this set of permissions implies the permissions - * expressed in "permission". - * - * @param p the Permission object to compare - * - * @return true if "permission" is a proper subset of a permission in - * the set, false if not. - */ - public boolean implies(Permission permission) - { - if (! (permission instanceof ExecPermission)) - return false; - - Enumeration e = permissions.elements(); - - while (e.hasMoreElements()) { - ExecPermission x = (ExecPermission)e.nextElement(); - if (x.implies(permission)) { - return true; - } - } - return false; - } - - /** - * Returns an enumeration of all the ExecPermission objects in the - * container. - * - * @return an enumeration of all the ExecPermission objects. - */ - public Enumeration elements() - { - return permissions.elements(); - } - } -} diff --git a/src/java.rmi/share/classes/java/rmi/AccessException.java b/src/java.rmi/share/classes/java/rmi/AccessException.java index f6244f2e4d6..4ec935a1f06 100644 --- a/src/java.rmi/share/classes/java/rmi/AccessException.java +++ b/src/java.rmi/share/classes/java/rmi/AccessException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -28,8 +28,7 @@ /** * An AccessException is thrown by certain methods of the * java.rmi.Naming class (specifically bind, - * rebind, and unbind) and methods of the - * java.rmi.activation.ActivationSystem interface to + * rebind, and unbind) to * indicate that the caller does not have permission to perform the action * requested by the method call. If the method was invoked from a non-local * host, then an AccessException is thrown. @@ -38,7 +37,6 @@ * @author Roger Riggs * @since 1.1 * @see java.rmi.Naming - * @see java.rmi.activation.ActivationSystem */ public class AccessException extends java.rmi.RemoteException { diff --git a/src/java.rmi/share/classes/java/rmi/NoSuchObjectException.java b/src/java.rmi/share/classes/java/rmi/NoSuchObjectException.java index 4767c39bb8d..0777eb81c91 100644 --- a/src/java.rmi/share/classes/java/rmi/NoSuchObjectException.java +++ b/src/java.rmi/share/classes/java/rmi/NoSuchObjectException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -35,14 +35,12 @@ * A NoSuchObjectException is also thrown by the method * java.rmi.server.RemoteObject.toStub and by the * unexportObject methods of - * java.rmi.server.UnicastRemoteObject and - * java.rmi.activation.Activatable and + * java.rmi.server.UnicastRemoteObject. * * @author Ann Wollrath * @since 1.1 * @see java.rmi.server.RemoteObject#toStub(Remote) * @see java.rmi.server.UnicastRemoteObject#unexportObject(Remote,boolean) - * @see java.rmi.activation.Activatable#unexportObject(Remote,boolean) */ public class NoSuchObjectException extends RemoteException { diff --git a/src/java.rmi/share/classes/java/rmi/Remote.java b/src/java.rmi/share/classes/java/rmi/Remote.java index 57814d24c53..2dedfe66f86 100644 --- a/src/java.rmi/share/classes/java/rmi/Remote.java +++ b/src/java.rmi/share/classes/java/rmi/Remote.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -33,11 +33,10 @@ * extends java.rmi.Remote are available remotely. * *

Implementation classes can implement any number of remote interfaces and - * can extend other remote implementation classes. RMI provides some - * convenience classes that remote object implementations can extend which - * facilitate remote object creation. These classes are - * java.rmi.server.UnicastRemoteObject and - * java.rmi.activation.Activatable. + * can extend other remote implementation classes. RMI provides a convenience + * class {@link java.rmi.server.UnicastRemoteObject UnicastRemoteObject} + * that remote object implementations can extend and that facilitates remote + * object creation. * *

For complete details on RMI, see the RMI Specification which @@ -45,7 +44,5 @@ * * @since 1.1 * @author Ann Wollrath - * @see java.rmi.server.UnicastRemoteObject - * @see java.rmi.activation.Activatable */ public interface Remote {} diff --git a/src/java.rmi/share/classes/java/rmi/StubNotFoundException.java b/src/java.rmi/share/classes/java/rmi/StubNotFoundException.java index 1d9c5ec5b9d..1d43f82fd10 100644 --- a/src/java.rmi/share/classes/java/rmi/StubNotFoundException.java +++ b/src/java.rmi/share/classes/java/rmi/StubNotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -28,14 +28,10 @@ /** * A StubNotFoundException is thrown if a valid stub class * could not be found for a remote object when it is exported. - * A StubNotFoundException may also be - * thrown when an activatable object is registered via the - * java.rmi.activation.Activatable.register method. * * @author Roger Riggs * @since 1.1 * @see java.rmi.server.UnicastRemoteObject - * @see java.rmi.activation.Activatable */ public class StubNotFoundException extends RemoteException { diff --git a/src/java.rmi/share/classes/java/rmi/activation/Activatable.java b/src/java.rmi/share/classes/java/rmi/activation/Activatable.java deleted file mode 100644 index 175b469995a..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/Activatable.java +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.MarshalledObject; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.UnknownGroupException; -import java.rmi.activation.UnknownObjectException; -import java.rmi.server.RMIClientSocketFactory; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.RemoteServer; -import sun.rmi.server.ActivatableServerRef; - -/** - * The Activatable class provides support for remote - * objects that require persistent access over time and that - * can be activated by the system. - * - *

For the constructors and static exportObject methods, - * the stub for a remote object being exported is obtained as described in - * {@link java.rmi.server.UnicastRemoteObject}. - * - *

An attempt to serialize explicitly an instance of this class will - * fail. - * - * @author Ann Wollrath - * @since 1.2 - * @serial exclude - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public abstract class Activatable extends RemoteServer { - - private ActivationID id; - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = -3120617863591563455L; - - /** - * Constructs an activatable remote object by registering - * an activation descriptor (with the specified location, data, and - * restart mode) for this object, and exporting the object with the - * specified port. - * - *

Note: Using the Activatable - * constructors that both register and export an activatable remote - * object is strongly discouraged because the actions of registering - * and exporting the remote object are not guaranteed to be - * atomic. Instead, an application should register an activation - * descriptor and export a remote object separately, so that exceptions - * can be handled properly. - * - *

This method invokes the {@link - * #exportObject(Remote,String,MarshalledObject,boolean,int) - * exportObject} method with this object, and the specified location, - * data, restart mode, and port. Subsequent calls to {@link #getID} - * will return the activation identifier returned from the call to - * exportObject. - * - * @param location the location for classes for this object - * @param data the object's initialization data - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @throws ActivationException if object registration fails. - * @throws RemoteException if either of the following fails: - * a) registering the object with the activation system or b) exporting - * the object to the RMI runtime. - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation. - * @since 1.2 - **/ - protected Activatable(String location, - MarshalledObject data, - boolean restart, - int port) - throws ActivationException, RemoteException - { - super(); - id = exportObject(this, location, data, restart, port); - } - - /** - * Constructs an activatable remote object by registering - * an activation descriptor (with the specified location, data, and - * restart mode) for this object, and exporting the object with the - * specified port, and specified client and server socket factories. - * - *

Note: Using the Activatable - * constructors that both register and export an activatable remote - * object is strongly discouraged because the actions of registering - * and exporting the remote object are not guaranteed to be - * atomic. Instead, an application should register an activation - * descriptor and export a remote object separately, so that exceptions - * can be handled properly. - * - *

This method invokes the {@link - * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory) - * exportObject} method with this object, and the specified location, - * data, restart mode, port, and client and server socket factories. - * Subsequent calls to {@link #getID} will return the activation - * identifier returned from the call to exportObject. - * - * @param location the location for classes for this object - * @param data the object's initialization data - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @param csf the client-side socket factory for making calls to the - * remote object - * @param ssf the server-side socket factory for receiving remote calls - * @throws ActivationException if object registration fails. - * @throws RemoteException if either of the following fails: - * a) registering the object with the activation system or b) exporting - * the object to the RMI runtime. - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation. - * @since 1.2 - **/ - protected Activatable(String location, - MarshalledObject data, - boolean restart, - int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf) - throws ActivationException, RemoteException - { - super(); - id = exportObject(this, location, data, restart, port, csf, ssf); - } - - /** - * Constructor used to activate/export the object on a specified - * port. An "activatable" remote object must have a constructor that - * takes two arguments:

    - *
  • the object's activation identifier (ActivationID), and - *
  • the object's initialization data (a MarshalledObject). - *

- * - * A concrete subclass of this class must call this constructor when it is - * activated via the two parameter constructor described above. As - * a side-effect of construction, the remote object is "exported" - * to the RMI runtime (on the specified port) and is - * available to accept incoming calls from clients. - * - * @param id activation identifier for the object - * @param port the port number on which the object is exported - * @throws RemoteException if exporting the object to the RMI - * runtime fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - protected Activatable(ActivationID id, int port) - throws RemoteException - { - super(); - this.id = id; - exportObject(this, id, port); - } - - /** - * Constructor used to activate/export the object on a specified - * port. An "activatable" remote object must have a constructor that - * takes two arguments:

    - *
  • the object's activation identifier (ActivationID), and - *
  • the object's initialization data (a MarshalledObject). - *

- * - * A concrete subclass of this class must call this constructor when it is - * activated via the two parameter constructor described above. As - * a side-effect of construction, the remote object is "exported" - * to the RMI runtime (on the specified port) and is - * available to accept incoming calls from clients. - * - * @param id activation identifier for the object - * @param port the port number on which the object is exported - * @param csf the client-side socket factory for making calls to the - * remote object - * @param ssf the server-side socket factory for receiving remote calls - * @throws RemoteException if exporting the object to the RMI - * runtime fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - protected Activatable(ActivationID id, int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf) - throws RemoteException - { - super(); - this.id = id; - exportObject(this, id, port, csf, ssf); - } - - /** - * Returns the object's activation identifier. The method is - * protected so that only subclasses can obtain an object's - * identifier. - * @return the object's activation identifier - * @since 1.2 - */ - protected ActivationID getID() { - return id; - } - - /** - * Register an object descriptor for an activatable remote - * object so that is can be activated on demand. - * - * @param desc the object's descriptor - * @return the stub for the activatable remote object - * @throws UnknownGroupException if group id in desc - * is not registered with the activation system - * @throws ActivationException if activation system is not running - * @throws RemoteException if remote call fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static Remote register(ActivationDesc desc) - throws UnknownGroupException, ActivationException, RemoteException - { - // register object with activator. - ActivationID id = - ActivationGroup.getSystem().registerObject(desc); - return sun.rmi.server.ActivatableRef.getStub(desc, id); - } - - /** - * Informs the system that the object with the corresponding activation - * id is currently inactive. If the object is currently - * active, the object is "unexported" from the RMI runtime (only if - * there are no pending or in-progress calls) - * so the that it can no longer receive incoming calls. This call - * informs this VM's ActivationGroup that the object is inactive, - * that, in turn, informs its ActivationMonitor. If this call - * completes successfully, a subsequent activate request to the activator - * will cause the object to reactivate. The operation may still - * succeed if the object is considered active but has already - * unexported itself. - * - * @param id the object's activation identifier - * @return true if the operation succeeds (the operation will - * succeed if the object in currently known to be active and is - * either already unexported or is currently exported and has no - * pending/executing calls); false is returned if the object has - * pending/executing calls in which case it cannot be deactivated - * @throws UnknownObjectException if object is not known (it may - * already be inactive) - * @throws ActivationException if group is not active - * @throws RemoteException if call informing monitor fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static boolean inactive(ActivationID id) - throws UnknownObjectException, ActivationException, RemoteException - { - return ActivationGroup.currentGroup().inactiveObject(id); - } - - /** - * Revokes previous registration for the activation descriptor - * associated with id. An object can no longer be - * activated via that id. - * - * @param id the object's activation identifier - * @throws UnknownObjectException if object (id) is unknown - * @throws ActivationException if activation system is not running - * @throws RemoteException if remote call to activation system fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static void unregister(ActivationID id) - throws UnknownObjectException, ActivationException, RemoteException - { - ActivationGroup.getSystem().unregisterObject(id); - } - - /** - * Registers an activation descriptor (with the specified location, - * data, and restart mode) for the specified object, and exports that - * object with the specified port. - * - *

Note: Using this method (as well as the - * Activatable constructors that both register and export - * an activatable remote object) is strongly discouraged because the - * actions of registering and exporting the remote object are - * not guaranteed to be atomic. Instead, an application should - * register an activation descriptor and export a remote object - * separately, so that exceptions can be handled properly. - * - *

This method invokes the {@link - * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory) - * exportObject} method with the specified object, location, data, - * restart mode, and port, and null for both client and - * server socket factories, and then returns the resulting activation - * identifier. - * - * @param obj the object being exported - * @param location the object's code location - * @param data the object's bootstrapping data - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @return the activation identifier obtained from registering the - * descriptor, desc, with the activation system - * the wrong group - * @throws ActivationException if activation group is not active - * @throws RemoteException if object registration or export fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - **/ - public static ActivationID exportObject(Remote obj, - String location, - MarshalledObject data, - boolean restart, - int port) - throws ActivationException, RemoteException - { - return exportObject(obj, location, data, restart, port, null, null); - } - - /** - * Registers an activation descriptor (with the specified location, - * data, and restart mode) for the specified object, and exports that - * object with the specified port, and the specified client and server - * socket factories. - * - *

Note: Using this method (as well as the - * Activatable constructors that both register and export - * an activatable remote object) is strongly discouraged because the - * actions of registering and exporting the remote object are - * not guaranteed to be atomic. Instead, an application should - * register an activation descriptor and export a remote object - * separately, so that exceptions can be handled properly. - * - *

This method first registers an activation descriptor for the - * specified object as follows. It obtains the activation system by - * invoking the method {@link ActivationGroup#getSystem - * ActivationGroup.getSystem}. This method then obtains an {@link - * ActivationID} for the object by invoking the activation system's - * {@link ActivationSystem#registerObject registerObject} method with - * an {@link ActivationDesc} constructed with the specified object's - * class name, and the specified location, data, and restart mode. If - * an exception occurs obtaining the activation system or registering - * the activation descriptor, that exception is thrown to the caller. - * - *

Next, this method exports the object by invoking the {@link - * #exportObject(Remote,ActivationID,int,RMIClientSocketFactory,RMIServerSocketFactory) - * exportObject} method with the specified remote object, the - * activation identifier obtained from registration, the specified - * port, and the specified client and server socket factories. If an - * exception occurs exporting the object, this method attempts to - * unregister the activation identifier (obtained from registration) by - * invoking the activation system's {@link - * ActivationSystem#unregisterObject unregisterObject} method with the - * activation identifier. If an exception occurs unregistering the - * identifier, that exception is ignored, and the original exception - * that occurred exporting the object is thrown to the caller. - * - *

Finally, this method invokes the {@link - * ActivationGroup#activeObject activeObject} method on the activation - * group in this VM with the activation identifier and the specified - * remote object, and returns the activation identifier to the caller. - * - * @param obj the object being exported - * @param location the object's code location - * @param data the object's bootstrapping data - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @param csf the client-side socket factory for making calls to the - * remote object - * @param ssf the server-side socket factory for receiving remote calls - * @return the activation identifier obtained from registering the - * descriptor with the activation system - * @throws ActivationException if activation group is not active - * @throws RemoteException if object registration or export fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - **/ - public static ActivationID exportObject(Remote obj, - String location, - MarshalledObject data, - boolean restart, - int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf) - throws ActivationException, RemoteException - { - ActivationDesc desc = new ActivationDesc(obj.getClass().getName(), - location, data, restart); - /* - * Register descriptor. - */ - ActivationSystem system = ActivationGroup.getSystem(); - ActivationID id = system.registerObject(desc); - - /* - * Export object. - */ - try { - exportObject(obj, id, port, csf, ssf); - } catch (RemoteException e) { - /* - * Attempt to unregister activation descriptor because export - * failed and register/export should be atomic (see 4323621). - */ - try { - system.unregisterObject(id); - } catch (Exception ex) { - } - /* - * Report original exception. - */ - throw e; - } - - /* - * This call can't fail (it is a local call, and the only possible - * exception, thrown if the group is inactive, will not be thrown - * because the group is not inactive). - */ - ActivationGroup.currentGroup().activeObject(id, obj); - - return id; - } - - /** - * Export the activatable remote object to the RMI runtime to make - * the object available to receive incoming calls. The object is - * exported on an anonymous port, if port is zero.

- * - * During activation, this exportObject method should - * be invoked explicitly by an "activatable" object, that does not - * extend the Activatable class. There is no need for objects - * that do extend the Activatable class to invoke this - * method directly because the object is exported during construction. - * - * @return the stub for the activatable remote object - * @param obj the remote object implementation - * @param id the object's activation identifier - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @throws RemoteException if object export fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static Remote exportObject(Remote obj, - ActivationID id, - int port) - throws RemoteException - { - return exportObject(obj, new ActivatableServerRef(id, port)); - } - - /** - * Export the activatable remote object to the RMI runtime to make - * the object available to receive incoming calls. The object is - * exported on an anonymous port, if port is zero.

- * - * During activation, this exportObject method should - * be invoked explicitly by an "activatable" object, that does not - * extend the Activatable class. There is no need for objects - * that do extend the Activatable class to invoke this - * method directly because the object is exported during construction. - * - * @return the stub for the activatable remote object - * @param obj the remote object implementation - * @param id the object's activation identifier - * @param port the port on which the object is exported (an anonymous - * port is used if port=0) - * @param csf the client-side socket factory for making calls to the - * remote object - * @param ssf the server-side socket factory for receiving remote calls - * @throws RemoteException if object export fails - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static Remote exportObject(Remote obj, - ActivationID id, - int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf) - throws RemoteException - { - return exportObject(obj, new ActivatableServerRef(id, port, csf, ssf)); - } - - /** - * Remove the remote object, obj, from the RMI runtime. If - * successful, the object can no longer accept incoming RMI calls. - * If the force parameter is true, the object is forcibly unexported - * even if there are pending calls to the remote object or the - * remote object still has calls in progress. If the force - * parameter is false, the object is only unexported if there are - * no pending or in progress calls to the object. - * - * @param obj the remote object to be unexported - * @param force if true, unexports the object even if there are - * pending or in-progress calls; if false, only unexports the object - * if there are no pending or in-progress calls - * @return true if operation is successful, false otherwise - * @throws NoSuchObjectException if the remote object is not - * currently exported - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public static boolean unexportObject(Remote obj, boolean force) - throws NoSuchObjectException - { - return sun.rmi.transport.ObjectTable.unexportObject(obj, force); - } - - /** - * Exports the specified object using the specified server ref. - */ - private static Remote exportObject(Remote obj, ActivatableServerRef sref) - throws RemoteException - { - // if obj extends Activatable, set its ref. - if (obj instanceof Activatable) { - ((Activatable) obj).ref = sref; - - } - return sref.exportObject(obj, null, false); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivateFailedException.java b/src/java.rmi/share/classes/java/rmi/activation/ActivateFailedException.java deleted file mode 100644 index 654b716265e..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivateFailedException.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1998, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -/** - * This exception is thrown by the RMI runtime when activation - * fails during a remote call to an activatable object. - * - * @author Ann Wollrath - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -public class ActivateFailedException extends java.rmi.RemoteException { - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = 4863550261346652506L; - - /** - * Constructs an ActivateFailedException with the specified - * detail message. - * - * @param s the detail message - * @since 1.2 - */ - public ActivateFailedException(String s) { - super(s); - } - - /** - * Constructs an ActivateFailedException with the specified - * detail message and nested exception. - * - * @param s the detail message - * @param ex the nested exception - * @since 1.2 - */ - public ActivateFailedException(String s, Exception ex) { - super(s, ex); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationDesc.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationDesc.java deleted file mode 100644 index d62f4af1fe8..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationDesc.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.io.Serializable; -import java.rmi.MarshalledObject; - -/** - * An activation descriptor contains the information necessary to - * activate an object:

    - *
  • the object's group identifier, - *
  • the object's fully-qualified class name, - *
  • the object's code location (the location of the class), a codebase URL - * path, - *
  • the object's restart "mode", and, - *
  • a "marshalled" object that can contain object specific - * initialization data.
- * - *

A descriptor registered with the activation system can be used to - * recreate/activate the object specified by the descriptor. The - * MarshalledObject in the object's descriptor is passed - * as the second argument to the remote object's constructor for - * object to use during reinitialization/activation. - * - * @author Ann Wollrath - * @since 1.2 - * @see java.rmi.activation.Activatable - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public final class ActivationDesc implements Serializable { - - /** - * @serial the group's identifier - */ - private ActivationGroupID groupID; - - /** - * @serial the object's class name - */ - private String className; - - /** - * @serial the object's code location - */ - private String location; - - /** - * @serial the object's initialization data - */ - private MarshalledObject data; - - /** - * @serial indicates whether the object should be restarted - */ - private boolean restart; - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = 7455834104417690957L; - - /** - * Constructs an object descriptor for an object whose class name - * is className, that can be loaded from the - * code location and whose initialization - * information is data. If this form of the constructor - * is used, the groupID defaults to the current id for - * ActivationGroup for this VM. All objects with the - * same ActivationGroupID are activated in the same VM. - * - *

Note that objects specified by a descriptor created with this - * constructor will only be activated on demand (by default, the restart - * mode is false). If an activatable object requires restart - * services, use one of the ActivationDesc constructors that - * takes a boolean parameter, restart. - * - *

This constructor will throw ActivationException if - * there is no current activation group for this VM. To create an - * ActivationGroup use the - * ActivationGroup.createGroup method. - * - * @param className the object's fully package qualified class name - * @param location the object's code location (from where the class is - * loaded) - * @param data the object's initialization (activation) data contained - * in marshalled form. - * @throws ActivationException if the current group is nonexistent - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationDesc(String className, - String location, - MarshalledObject data) - throws ActivationException - { - this(ActivationGroup.internalCurrentGroupID(), - className, location, data, false); - } - - /** - * Constructs an object descriptor for an object whose class name - * is className, that can be loaded from the - * code location and whose initialization - * information is data. If this form of the constructor - * is used, the groupID defaults to the current id for - * ActivationGroup for this VM. All objects with the - * same ActivationGroupID are activated in the same VM. - * - *

This constructor will throw ActivationException if - * there is no current activation group for this VM. To create an - * ActivationGroup use the - * ActivationGroup.createGroup method. - * - * @param className the object's fully package qualified class name - * @param location the object's code location (from where the class is - * loaded) - * @param data the object's initialization (activation) data contained - * in marshalled form. - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @throws ActivationException if the current group is nonexistent - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationDesc(String className, - String location, - MarshalledObject data, - boolean restart) - throws ActivationException - { - this(ActivationGroup.internalCurrentGroupID(), - className, location, data, restart); - } - - /** - * Constructs an object descriptor for an object whose class name - * is className that can be loaded from the - * code location and whose initialization - * information is data. All objects with the same - * groupID are activated in the same Java VM. - * - *

Note that objects specified by a descriptor created with this - * constructor will only be activated on demand (by default, the restart - * mode is false). If an activatable object requires restart - * services, use one of the ActivationDesc constructors that - * takes a boolean parameter, restart. - * - * @param groupID the group's identifier (obtained from registering - * ActivationSystem.registerGroup method). The group - * indicates the VM in which the object should be activated. - * @param className the object's fully package-qualified class name - * @param location the object's code location (from where the class is - * loaded) - * @param data the object's initialization (activation) data contained - * in marshalled form. - * @throws IllegalArgumentException if groupID is null - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationDesc(ActivationGroupID groupID, - String className, - String location, - MarshalledObject data) - { - this(groupID, className, location, data, false); - } - - /** - * Constructs an object descriptor for an object whose class name - * is className that can be loaded from the - * code location and whose initialization - * information is data. All objects with the same - * groupID are activated in the same Java VM. - * - * @param groupID the group's identifier (obtained from registering - * ActivationSystem.registerGroup method). The group - * indicates the VM in which the object should be activated. - * @param className the object's fully package-qualified class name - * @param location the object's code location (from where the class is - * loaded) - * @param data the object's initialization (activation) data contained - * in marshalled form. - * @param restart if true, the object is restarted (reactivated) when - * either the activator is restarted or the object's activation group - * is restarted after an unexpected crash; if false, the object is only - * activated on demand. Specifying restart to be - * true does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @throws IllegalArgumentException if groupID is null - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationDesc(ActivationGroupID groupID, - String className, - String location, - MarshalledObject data, - boolean restart) - { - if (groupID == null) - throw new IllegalArgumentException("groupID can't be null"); - this.groupID = groupID; - this.className = className; - this.location = location; - this.data = data; - this.restart = restart; - } - - /** - * Returns the group identifier for the object specified by this - * descriptor. A group provides a way to aggregate objects into a - * single Java virtual machine. RMI creates/activates objects with - * the same groupID in the same virtual machine. - * - * @return the group identifier - * @since 1.2 - */ - public ActivationGroupID getGroupID() { - return groupID; - } - - /** - * Returns the class name for the object specified by this - * descriptor. - * @return the class name - * @since 1.2 - */ - public String getClassName() { - return className; - } - - /** - * Returns the code location for the object specified by - * this descriptor. - * @return the code location - * @since 1.2 - */ - public String getLocation() { - return location; - } - - /** - * Returns a "marshalled object" containing intialization/activation - * data for the object specified by this descriptor. - * @return the object specific "initialization" data - * @since 1.2 - */ - public MarshalledObject getData() { - return data; - } - - /** - * Returns the "restart" mode of the object associated with - * this activation descriptor. - * - * @return true if the activatable object associated with this - * activation descriptor is restarted via the activation - * daemon when either the daemon comes up or the object's group - * is restarted after an unexpected crash; otherwise it returns false, - * meaning that the object is only activated on demand via a - * method call. Note that if the restart mode is true, the - * activator does not force an initial immediate activation of - * a newly registered object; initial activation is lazy. - * @since 1.2 - */ - public boolean getRestartMode() { - return restart; - } - - /** - * Compares two activation descriptors for content equality. - * - * @param obj the Object to compare with - * @return true if these Objects are equal; false otherwise. - * @see java.util.Hashtable - * @since 1.2 - */ - public boolean equals(Object obj) { - - if (obj instanceof ActivationDesc) { - ActivationDesc desc = (ActivationDesc) obj; - return - ((groupID == null ? desc.groupID == null : - groupID.equals(desc.groupID)) && - (className == null ? desc.className == null : - className.equals(desc.className)) && - (location == null ? desc.location == null: - location.equals(desc.location)) && - (data == null ? desc.data == null : - data.equals(desc.data)) && - (restart == desc.restart)); - - } else { - return false; - } - } - - /** - * Return the same hashCode for similar ActivationDescs. - * @return an integer - * @see java.util.Hashtable - */ - public int hashCode() { - return ((location == null - ? 0 - : location.hashCode() << 24) ^ - (groupID == null - ? 0 - : groupID.hashCode() << 16) ^ - (className == null - ? 0 - : className.hashCode() << 9) ^ - (data == null - ? 0 - : data.hashCode() << 1) ^ - (restart - ? 1 - : 0)); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationException.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationException.java deleted file mode 100644 index 645a5e7bd86..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationException.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -/** - * General exception used by the activation interfaces. - * - *

As of release 1.4, this exception has been retrofitted to conform to - * the general purpose exception-chaining mechanism. The "detail exception" - * that may be provided at construction time and accessed via the public - * {@link #detail} field is now known as the cause, and may be - * accessed via the {@link Throwable#getCause()} method, as well as - * the aforementioned "legacy field." - * - *

Invoking the method {@link Throwable#initCause(Throwable)} on an - * instance of {@code ActivationException} always throws {@link - * IllegalStateException}. - * - * @author Ann Wollrath - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -public class ActivationException extends Exception { - - /** - * The cause of the activation exception. - * - *

This field predates the general-purpose exception chaining facility. - * The {@link Throwable#getCause()} method is now the preferred means of - * obtaining this information. - * - * @serial - */ - public Throwable detail; - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = -4320118837291406071L; - - /** - * Constructs an {@code ActivationException}. - */ - public ActivationException() { - initCause(null); // Disallow subsequent initCause - } - - /** - * Constructs an {@code ActivationException} with the specified - * detail message. - * - * @param s the detail message - */ - public ActivationException(String s) { - super(s); - initCause(null); // Disallow subsequent initCause - } - - /** - * Constructs an {@code ActivationException} with the specified - * detail message and cause. This constructor sets the {@link #detail} - * field to the specified {@code Throwable}. - * - * @param s the detail message - * @param cause the cause - */ - public ActivationException(String s, Throwable cause) { - super(s); - initCause(null); // Disallow subsequent initCause - detail = cause; - } - - /** - * Returns the detail message, including the message from the cause, if - * any, of this exception. - * - * @return the detail message - */ - public String getMessage() { - if (detail == null) - return super.getMessage(); - else - return super.getMessage() + - "; nested exception is: \n\t" + - detail.toString(); - } - - /** - * Returns the cause of this exception. This method returns the value - * of the {@link #detail} field. - * - * @return the cause, which may be {@code null}. - * @since 1.4 - */ - public Throwable getCause() { - return detail; - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java deleted file mode 100644 index bcfe3e336ad..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.rmi.MarshalledObject; -import java.rmi.Naming; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.UnknownGroupException; -import java.rmi.activation.UnknownObjectException; -import java.rmi.server.RMIClassLoader; -import java.rmi.server.UnicastRemoteObject; -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * An ActivationGroup is responsible for creating new - * instances of "activatable" objects in its group, informing its - * ActivationMonitor when either: its object's become - * active or inactive, or the group as a whole becomes inactive.

- * - * An ActivationGroup is initially created in one - * of several ways:

    - *
  • as a side-effect of creating an ActivationDesc - * without an explicit ActivationGroupID for the - * first activatable object in the group, or - *
  • via the ActivationGroup.createGroup method - *
  • as a side-effect of activating the first object in a group - * whose ActivationGroupDesc was only registered.

- * - * Only the activator can recreate an - * ActivationGroup. The activator spawns, as needed, a - * separate VM (as a child process, for example) for each registered - * activation group and directs activation requests to the appropriate - * group. It is implementation specific how VMs are spawned. An - * activation group is created via the - * ActivationGroup.createGroup static method. The - * createGroup method has two requirements on the group - * to be created: 1) the group must be a concrete subclass of - * ActivationGroup, and 2) the group must have a - * constructor that takes two arguments: - * - *

    - *
  • the group's ActivationGroupID, and - *
  • the group's initialization data (in a - * java.rmi.MarshalledObject)

- * - * When created, the default implementation of - * ActivationGroup will override the system properties - * with the properties requested when its - * ActivationGroupDesc was created, and will set a - * {@link SecurityManager} as the default system - * security manager. If your application requires specific properties - * to be set when objects are activated in the group, the application - * should create a special Properties object containing - * these properties, then create an ActivationGroupDesc - * with the Properties object, and use - * ActivationGroup.createGroup before creating any - * ActivationDescs (before the default - * ActivationGroupDesc is created). If your application - * requires the use of a security manager other than - * {@link SecurityManager}, in the - * ActivativationGroupDescriptor properties list you can set - * java.security.manager property to the name of the security - * manager you would like to install. - * - * @author Ann Wollrath - * @see ActivationInstantiator - * @see ActivationGroupDesc - * @see ActivationGroupID - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public abstract class ActivationGroup - extends UnicastRemoteObject - implements ActivationInstantiator -{ - /** - * @serial the group's identifier - */ - private ActivationGroupID groupID; - - /** - * @serial the group's monitor - */ - @SuppressWarnings("serial") // Not statically typed as Serializable - private ActivationMonitor monitor; - - /** - * @serial the group's incarnation number - */ - private long incarnation; - - /** the current activation group for this VM */ - private static ActivationGroup currGroup; - /** the current group's identifier */ - private static ActivationGroupID currGroupID; - /** the current group's activation system */ - private static ActivationSystem currSystem; - /** used to control a group being created only once */ - private static boolean canCreate = true; - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = -7696947875314805420L; - - /** - * Constructs an activation group with the given activation group - * identifier. The group is exported as a - * java.rmi.server.UnicastRemoteObject. - * - * @param groupID the group's identifier - * @throws RemoteException if this group could not be exported - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - protected ActivationGroup(ActivationGroupID groupID) - throws RemoteException - { - // call super constructor to export the object - super(); - this.groupID = groupID; - } - - /** - * The group's inactiveObject method is called - * indirectly via a call to the Activatable.inactive - * method. A remote object implementation must call - * Activatable's inactive method when - * that object deactivates (the object deems that it is no longer - * active). If the object does not call - * Activatable.inactive when it deactivates, the - * object will never be garbage collected since the group keeps - * strong references to the objects it creates. - * - *

The group's inactiveObject method unexports the - * remote object from the RMI runtime so that the object can no - * longer receive incoming RMI calls. An object will only be unexported - * if the object has no pending or executing calls. - * The subclass of ActivationGroup must override this - * method and unexport the object. - * - *

After removing the object from the RMI runtime, the group - * must inform its ActivationMonitor (via the monitor's - * inactiveObject method) that the remote object is - * not currently active so that the remote object will be - * re-activated by the activator upon a subsequent activation - * request. - * - *

This method simply informs the group's monitor that the object - * is inactive. It is up to the concrete subclass of ActivationGroup - * to fulfill the additional requirement of unexporting the object. - * - * @param id the object's activation identifier - * @return true if the object was successfully deactivated; otherwise - * returns false. - * @throws UnknownObjectException if object is unknown (may already - * be inactive) - * @throws RemoteException if call informing monitor fails - * @throws ActivationException if group is inactive - * @since 1.2 - */ - public boolean inactiveObject(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException - { - getMonitor().inactiveObject(id); - return true; - } - - /** - * The group's activeObject method is called when an - * object is exported (either by Activatable object - * construction or an explicit call to - * Activatable.exportObject. The group must inform its - * ActivationMonitor that the object is active (via - * the monitor's activeObject method) if the group - * hasn't already done so. - * - * @param id the object's identifier - * @param obj the remote object implementation - * @throws UnknownObjectException if object is not registered - * @throws RemoteException if call informing monitor fails - * @throws ActivationException if group is inactive - * @since 1.2 - */ - public abstract void activeObject(ActivationID id, Remote obj) - throws ActivationException, UnknownObjectException, RemoteException; - - /** - * Create and set the activation group for the current VM. The - * activation group can only be set if it is not currently set. - * An activation group is set using the createGroup - * method when the Activator initiates the - * re-creation of an activation group in order to carry out - * incoming activate requests. A group must first be - * registered with the ActivationSystem before it can - * be created via this method. - * - *

The group class specified by the - * ActivationGroupDesc must be a concrete subclass of - * ActivationGroup and have a public constructor that - * takes two arguments: the ActivationGroupID for the - * group and the MarshalledObject containing the - * group's initialization data (obtained from the - * ActivationGroupDesc. - * - *

If the group class name specified in the - * ActivationGroupDesc is null, then - * this method will behave as if the group descriptor contained - * the name of the default activation group implementation class. - * - *

Note that if your application creates its own custom - * activation group, a security manager must be set for that - * group. Otherwise objects cannot be activated in the group. - * {@link SecurityManager} is set by default. - * - *

If a security manager is already set in the group VM, this - * method first calls the security manager's - * checkSetFactory method. This could result in a - * SecurityException. If your application needs to - * set a different security manager, you must ensure that the - * policy file specified by the group's - * ActivationGroupDesc grants the group the necessary - * permissions to set a new security manager. (Note: This will be - * necessary if your group downloads and sets a security manager). - * - *

After the group is created, the - * ActivationSystem is informed that the group is - * active by calling the activeGroup method which - * returns the ActivationMonitor for the group. The - * application need not call activeGroup - * independently since it is taken care of by this method. - * - *

Once a group is created, subsequent calls to the - * currentGroupID method will return the identifier - * for this group until the group becomes inactive. - * - * @param id the activation group's identifier - * @param desc the activation group's descriptor - * @param incarnation the group's incarnation number (zero on group's - * initial creation) - * @return the activation group for the VM - * @throws ActivationException if group already exists or if error - * occurs during group creation - * @throws SecurityException if permission to create group is denied. - * (Note: The default implementation of the security manager - * checkSetFactory - * method requires the RuntimePermission "setFactory") - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @see SecurityManager#checkSetFactory - * @since 1.2 - */ - public static synchronized - ActivationGroup createGroup(ActivationGroupID id, - final ActivationGroupDesc desc, - long incarnation) - throws ActivationException - { - SecurityManager security = System.getSecurityManager(); - if (security != null) - security.checkSetFactory(); - - if (currGroup != null) - throw new ActivationException("group already exists"); - - if (canCreate == false) - throw new ActivationException("group deactivated and " + - "cannot be recreated"); - - try { - // load group's class - String groupClassName = desc.getClassName(); - Class cl; - Class defaultGroupClass = - sun.rmi.server.ActivationGroupImpl.class; - if (groupClassName == null || // see 4252236 - groupClassName.equals(defaultGroupClass.getName())) - { - cl = defaultGroupClass; - } else { - Class cl0; - try { - cl0 = RMIClassLoader.loadClass(desc.getLocation(), - groupClassName); - } catch (Exception ex) { - throw new ActivationException( - "Could not load group implementation class", ex); - } - if (ActivationGroup.class.isAssignableFrom(cl0)) { - cl = cl0.asSubclass(ActivationGroup.class); - } else { - throw new ActivationException("group not correct class: " + - cl0.getName()); - } - } - - // create group - Constructor constructor = - cl.getConstructor(ActivationGroupID.class, - MarshalledObject.class); - ActivationGroup newGroup = - constructor.newInstance(id, desc.getData()); - currSystem = id.getSystem(); - newGroup.incarnation = incarnation; - newGroup.monitor = - currSystem.activeGroup(id, newGroup, incarnation); - currGroup = newGroup; - currGroupID = id; - canCreate = false; - } catch (InvocationTargetException e) { - e.getTargetException().printStackTrace(); - throw new ActivationException("exception in group constructor", - e.getTargetException()); - - } catch (ActivationException e) { - throw e; - - } catch (Exception e) { - throw new ActivationException("exception creating group", e); - } - - return currGroup; - } - - /** - * Returns the current activation group's identifier. Returns null - * if no group is currently active for this VM. - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @return the activation group's identifier - * @since 1.2 - */ - public static synchronized ActivationGroupID currentGroupID() { - return currGroupID; - } - - /** - * Returns the activation group identifier for the VM. If an - * activation group does not exist for this VM, a default - * activation group is created. A group can be created only once, - * so if a group has already become active and deactivated. - * - * @return the activation group identifier - * @throws ActivationException if error occurs during group - * creation, if security manager is not set, or if the group - * has already been created and deactivated. - */ - static synchronized ActivationGroupID internalCurrentGroupID() - throws ActivationException - { - if (currGroupID == null) - throw new ActivationException("nonexistent group"); - - return currGroupID; - } - - /** - * Set the activation system for the VM. The activation system can - * only be set it if no group is currently active. If the activation - * system is not set via this call, then the getSystem - * method attempts to obtain a reference to the - * ActivationSystem by looking up the name - * "java.rmi.activation.ActivationSystem" in the Activator's - * registry. By default, the port number used to look up the - * activation system is defined by - * ActivationSystem.SYSTEM_PORT. This port can be overridden - * by setting the property java.rmi.activation.port. - * - *

If there is a security manager, this method first - * calls the security manager's checkSetFactory method. - * This could result in a SecurityException. - * - * @param system remote reference to the ActivationSystem - * @throws ActivationException if activation system is already set - * @throws SecurityException if permission to set the activation system is denied. - * (Note: The default implementation of the security manager - * checkSetFactory - * method requires the RuntimePermission "setFactory") - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @see #getSystem - * @see SecurityManager#checkSetFactory - * @since 1.2 - */ - public static synchronized void setSystem(ActivationSystem system) - throws ActivationException - { - SecurityManager security = System.getSecurityManager(); - if (security != null) - security.checkSetFactory(); - - if (currSystem != null) - throw new ActivationException("activation system already set"); - - currSystem = system; - } - - /** - * Returns the activation system for the VM. The activation system - * may be set by the setSystem method. If the - * activation system is not set via the setSystem - * method, then the getSystem method attempts to - * obtain a reference to the ActivationSystem by - * looking up the name "java.rmi.activation.ActivationSystem" in - * the Activator's registry. By default, the port number used to - * look up the activation system is defined by - * ActivationSystem.SYSTEM_PORT. This port can be - * overridden by setting the property - * java.rmi.activation.port. - * - * @return the activation system for the VM/group - * @throws ActivationException if activation system cannot be - * obtained or is not bound - * (means that it is not running) - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @see #setSystem - * @since 1.2 - */ - public static synchronized ActivationSystem getSystem() - throws ActivationException - { - if (currSystem == null) { - try { - int port = AccessController.doPrivileged((PrivilegedAction) () -> - Integer.getInteger("java.rmi.activation.port", ActivationSystem.SYSTEM_PORT)); - currSystem = (ActivationSystem) - Naming.lookup("//:" + port + - "/java.rmi.activation.ActivationSystem"); - } catch (Exception e) { - throw new ActivationException( - "unable to obtain ActivationSystem", e); - } - } - return currSystem; - } - - /** - * This protected method is necessary for subclasses to - * make the activeObject callback to the group's - * monitor. The call is simply forwarded to the group's - * ActivationMonitor. - * - * @param id the object's identifier - * @param mobj a marshalled object containing the remote object's stub - * @throws UnknownObjectException if object is not registered - * @throws RemoteException if call informing monitor fails - * @throws ActivationException if an activation error occurs - * @since 1.2 - */ - protected void activeObject(ActivationID id, - MarshalledObject mobj) - throws ActivationException, UnknownObjectException, RemoteException - { - getMonitor().activeObject(id, mobj); - } - - /** - * This protected method is necessary for subclasses to - * make the inactiveGroup callback to the group's - * monitor. The call is simply forwarded to the group's - * ActivationMonitor. Also, the current group - * for the VM is set to null. - * - * @throws UnknownGroupException if group is not registered - * @throws RemoteException if call informing monitor fails - * @since 1.2 - */ - protected void inactiveGroup() - throws UnknownGroupException, RemoteException - { - try { - getMonitor().inactiveGroup(groupID, incarnation); - } finally { - destroyGroup(); - } - } - - /** - * Returns the monitor for the activation group. - */ - private ActivationMonitor getMonitor() throws RemoteException { - synchronized (ActivationGroup.class) { - if (monitor != null) { - return monitor; - } - } - throw new RemoteException("monitor not received"); - } - - /** - * Destroys the current group. - */ - private static synchronized void destroyGroup() { - currGroup = null; - currGroupID = null; - // NOTE: don't set currSystem to null since it may be needed - } - - /** - * Returns the current group for the VM. - * @throws ActivationException if current group is null (not active) - */ - static synchronized ActivationGroup currentGroup() - throws ActivationException - { - if (currGroup == null) { - throw new ActivationException("group is not active"); - } - return currGroup; - } - -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupDesc.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupDesc.java deleted file mode 100644 index 4a40f6054df..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupDesc.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.rmi.MarshalledObject; -import java.util.Arrays; -import java.util.Properties; - -/** - * An activation group descriptor contains the information necessary to - * create/recreate an activation group in which to activate objects. - * Such a descriptor contains:

    - *
  • the group's class name, - *
  • the group's code location (the location of the group's class), and - *
  • a "marshalled" object that can contain group specific - * initialization data.

- * - * The group's class must be a concrete subclass of - * ActivationGroup. A subclass of - * ActivationGroup is created/recreated via the - * ActivationGroup.createGroup static method that invokes - * a special constructor that takes two arguments:

    - * - *
  • the group's ActivationGroupID, and - *
  • the group's initialization data (in a - * java.rmi.MarshalledObject)
- * - * @author Ann Wollrath - * @since 1.2 - * @see ActivationGroup - * @see ActivationGroupID - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -public final class ActivationGroupDesc implements Serializable { - - /** - * @serial The group's fully package qualified class name. - */ - private String className; - - /** - * @serial The location from where to load the group's class. - */ - private String location; - - /** - * @serial The group's initialization data. - */ - private MarshalledObject data; - - /** - * @serial The controlling options for executing the VM in - * another process. - */ - private CommandEnvironment env; - - /** - * @serial A properties map which will override those set - * by default in the subprocess environment. - */ - private Properties props; - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - @java.io.Serial - private static final long serialVersionUID = -4936225423168276595L; - - /** - * Constructs a group descriptor that uses the system defaults for group - * implementation and code location. Properties specify Java - * environment overrides (which will override system properties in - * the group implementation's VM). The command - * environment can control the exact command/options used in - * starting the child VM, or can be null to accept - * rmid's default. - * - *

This constructor will create an ActivationGroupDesc - * with a null group class name, which indicates the system's - * default ActivationGroup implementation. - * - * @param overrides the set of properties to set when the group is - * recreated. - * @param cmd the controlling options for executing the VM in - * another process (or null). - * @since 1.2 - */ - public ActivationGroupDesc(Properties overrides, - CommandEnvironment cmd) - { - this(null, null, null, overrides, cmd); - } - - /** - * Specifies an alternate group implementation and execution - * environment to be used for the group. - * - * @param className the group's package qualified class name or - * null. A null group class name indicates - * the system's default ActivationGroup implementation. - * @param location the location from where to load the group's - * class - * @param data the group's initialization data contained in - * marshalled form (could contain properties, for example) - * @param overrides a properties map which will override those set - * by default in the subprocess environment (will be translated - * into -D options), or null. - * @param cmd the controlling options for executing the VM in - * another process (or null). - * @since 1.2 - */ - public ActivationGroupDesc(String className, - String location, - MarshalledObject data, - Properties overrides, - CommandEnvironment cmd) - { - this.props = overrides; - this.env = cmd; - this.data = data; - this.location = location; - this.className = className; - } - - /** - * Returns the group's class name (possibly null). A - * null group class name indicates the system's default - * ActivationGroup implementation. - * @return the group's class name - * @since 1.2 - */ - public String getClassName() { - return className; - } - - /** - * Returns the group's code location. - * @return the group's code location - * @since 1.2 - */ - public String getLocation() { - return location; - } - - /** - * Returns the group's initialization data. - * @return the group's initialization data - * @since 1.2 - */ - public MarshalledObject getData() { - return data; - } - - /** - * Returns the group's property-override list. - * @return the property-override list, or null - * @since 1.2 - */ - public Properties getPropertyOverrides() { - return (props != null) ? (Properties) props.clone() : null; - } - - /** - * Returns the group's command-environment control object. - * @return the command-environment object, or null - * @since 1.2 - */ - public CommandEnvironment getCommandEnvironment() { - return this.env; - } - - - /** - * Startup options for ActivationGroup implementations. - * - * This class allows overriding default system properties and - * specifying implementation-defined options for ActivationGroups. - * @since 1.2 - */ - public static class CommandEnvironment implements Serializable { - @java.io.Serial - private static final long serialVersionUID = 6165754737887770191L; - - /** - * @serial - */ - private String command; - - /** - * @serial - */ - private String[] options; - - /** - * Create a CommandEnvironment with all the necessary - * information. - * - * @param cmdpath the name of the java executable, including - * the full path, or null, meaning "use rmid's default". - * The named program must be able to accept multiple - * -Dpropname=value options (as documented for the - * "java" tool) - * - * @param argv extra options which will be used in creating the - * ActivationGroup. Null has the same effect as an empty - * list. - * @since 1.2 - */ - public CommandEnvironment(String cmdpath, - String[] argv) - { - this.command = cmdpath; // might be null - - // Hold a safe copy of argv in this.options - if (argv == null) { - this.options = new String[0]; - } else { - this.options = new String[argv.length]; - System.arraycopy(argv, 0, this.options, 0, argv.length); - } - } - - /** - * Fetch the configured path-qualified java command name. - * - * @return the configured name, or null if configured to - * accept the default - * @since 1.2 - */ - public String getCommandPath() { - return (this.command); - } - - /** - * Fetch the configured java command options. - * - * @return An array of the command options which will be passed - * to the new child command by rmid. - * Note that rmid may add other options before or after these - * options, or both. - * Never returns null. - * @since 1.2 - */ - public String[] getCommandOptions() { - return options.clone(); - } - - /** - * Compares two command environments for content equality. - * - * @param obj the Object to compare with - * @return true if these Objects are equal; false otherwise. - * @see java.util.Hashtable - * @since 1.2 - */ - public boolean equals(Object obj) { - - if (obj instanceof CommandEnvironment) { - CommandEnvironment env = (CommandEnvironment) obj; - return - ((command == null ? env.command == null : - command.equals(env.command)) && - Arrays.equals(options, env.options)); - } else { - return false; - } - } - - /** - * Return identical values for similar - * CommandEnvironments. - * @return an integer - * @see java.util.Hashtable - */ - public int hashCode() - { - // hash command and ignore possibly expensive options - return (command == null ? 0 : command.hashCode()); - } - - /** - * readObject for custom serialization. - * - *

This method reads this object's serialized form for this - * class as follows: - *

This method first invokes defaultReadObject on - * the specified object input stream, and if options - * is null, then options is set to a - * zero-length array of String. - * - * @param in the {@code ObjectInputStream} from which data is read - * @throws IOException if an I/O error occurs - * @throws ClassNotFoundException if a serialized class cannot be loaded - * - */ - @java.io.Serial - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - if (options == null) { - options = new String[0]; - } - } - } - - /** - * Compares two activation group descriptors for content equality. - * - * @param obj the Object to compare with - * @return true if these Objects are equal; false otherwise. - * @see java.util.Hashtable - * @since 1.2 - */ - public boolean equals(Object obj) { - - if (obj instanceof ActivationGroupDesc) { - ActivationGroupDesc desc = (ActivationGroupDesc) obj; - return - ((className == null ? desc.className == null : - className.equals(desc.className)) && - (location == null ? desc.location == null : - location.equals(desc.location)) && - (data == null ? desc.data == null : data.equals(desc.data)) && - (env == null ? desc.env == null : env.equals(desc.env)) && - (props == null ? desc.props == null : - props.equals(desc.props))); - } else { - return false; - } - } - - /** - * Produce identical numbers for similar ActivationGroupDescs. - * @return an integer - * @see java.util.Hashtable - */ - public int hashCode() { - // hash location, className, data, and env - // but omit props (may be expensive) - return ((location == null - ? 0 - : location.hashCode() << 24) ^ - (env == null - ? 0 - : env.hashCode() << 16) ^ - (className == null - ? 0 - : className.hashCode() << 8) ^ - (data == null - ? 0 - : data.hashCode())); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java deleted file mode 100644 index 0ef0fc958c9..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.server.UID; - -/** - * The identifier for a registered activation group serves several - * purposes:

    - *
  • identifies the group uniquely within the activation system, and - *
  • contains a reference to the group's activation system so that the - * group can contact its activation system when necessary.

- * - * The ActivationGroupID is returned from the call to - * ActivationSystem.registerGroup and is used to identify - * the group within the activation system. This group id is passed - * as one of the arguments to the activation group's special constructor - * when an activation group is created/recreated. - * - * @author Ann Wollrath - * @see ActivationGroup - * @see ActivationGroupDesc - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public class ActivationGroupID implements java.io.Serializable { - /** - * @serial The group's activation system. - */ - @SuppressWarnings("serial") // Not statically typed as Serializable - private ActivationSystem system; - - /** - * @serial The group's unique id. - */ - private UID uid = new UID(); - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = -1648432278909740833L; - - /** - * Constructs a unique group id. - * - * @param system the group's activation system - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationGroupID(ActivationSystem system) { - this.system = system; - } - - /** - * Returns the group's activation system. - * @return the group's activation system - * @since 1.2 - */ - public ActivationSystem getSystem() { - return system; - } - - /** - * Returns a hashcode for the group's identifier. Two group - * identifiers that refer to the same remote group will have the - * same hash code. - * - * @see java.util.Hashtable - * @since 1.2 - */ - public int hashCode() { - return uid.hashCode(); - } - - /** - * Compares two group identifiers for content equality. - * Returns true if both of the following conditions are true: - * 1) the unique identifiers are equivalent (by content), and - * 2) the activation system specified in each - * refers to the same remote object. - * - * @param obj the Object to compare with - * @return true if these Objects are equal; false otherwise. - * @see java.util.Hashtable - * @since 1.2 - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } else if (obj instanceof ActivationGroupID) { - ActivationGroupID id = (ActivationGroupID)obj; - return (uid.equals(id.uid) && system.equals(id.system)); - } else { - return false; - } - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup_Stub.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup_Stub.java deleted file mode 100644 index f378437b92d..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup_Stub.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.lang.reflect.Method; -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.UnexpectedException; -import java.rmi.server.RemoteRef; -import java.rmi.server.RemoteStub; - -/** - * {@code ActivationGroup_Stub} is a stub class for the subclasses of {@code java.rmi.activation.ActivationGroup} - * that are exported as a {@code java.rmi.server.UnicastRemoteObject}. - * - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings({"rawtypes", "removal", "unchecked"}) -public final class ActivationGroup_Stub - extends RemoteStub - implements ActivationInstantiator, Remote { - - @java.io.Serial - private static final long serialVersionUID = 2; - - private static Method $method_newInstance_0; - - static { - try { - $method_newInstance_0 = - ActivationInstantiator.class.getMethod("newInstance", - new Class[] {ActivationID.class, ActivationDesc.class}); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError( - "stub class initialization failed"); - } - } - - /** - * Constructs a stub for the {@code ActivationGroup} class. - * It invokes the superclass {@code RemoteStub(RemoteRef)} - * constructor with its argument, {@code ref}. - * - * @param ref a remote ref - */ - public ActivationGroup_Stub(RemoteRef ref) { - super(ref); - } - - /** - * Stub method for {@code ActivationGroup.newInstance}. Invokes - * the {@code invoke} method on this instance's - * {@code RemoteObject.ref} field, with {@code this} as the - * first argument, a two-element {@code Object[]} as the second - * argument (with {@code id} as the first element and - * {@code desc} as the second element), and -5274445189091581345L - * as the third argument, and returns the result. If that invocation - * throws a {@code RuntimeException}, {@code RemoteException}, - * or an {@code ActivationException}, then that exception is - * thrown to the caller. If that invocation throws any other - * {@code java.lang.Exception}, then a - * {@code java.rmi.UnexpectedException} is thrown to the caller - * with the original exception as the cause. - * - * @param id an activation identifier - * @param desc an activation descriptor - * @return the result of the invocation - * @throws RemoteException if invocation results in a {@code RemoteException} - * @throws ActivationException if invocation results in an {@code ActivationException} - */ - public MarshalledObject newInstance(ActivationID id, - ActivationDesc desc) - throws RemoteException, ActivationException { - try { - Object $result = ref.invoke(this, $method_newInstance_0, - new Object[]{id, desc}, -5274445189091581345L); - return ((MarshalledObject) $result); - } catch (RuntimeException | RemoteException | ActivationException e) { - throw e; - } catch (Exception e) { - throw new UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java deleted file mode 100644 index 832c40fbbbf..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.UnmarshalException; -import java.rmi.server.RemoteObject; -import java.rmi.server.RemoteObjectInvocationHandler; -import java.rmi.server.RemoteRef; -import java.rmi.server.UID; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.Permissions; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.security.ProtectionDomain; - -/** - * Activation makes use of special identifiers to denote remote - * objects that can be activated over time. An activation identifier - * (an instance of the class ActivationID) contains several - * pieces of information needed for activating an object: - *

    - *
  • a remote reference to the object's activator (a {@link - * java.rmi.server.RemoteRef RemoteRef} - * instance), and - *
  • a unique identifier (a {@link java.rmi.server.UID UID} - * instance) for the object.

- * - * An activation identifier for an object can be obtained by registering - * an object with the activation system. Registration is accomplished - * in a few ways:

    - *
  • via the Activatable.register method - *
  • via the first Activatable constructor (that takes - * three arguments and both registers and exports the object, and - *
  • via the first Activatable.exportObject method - * that takes the activation descriptor, object and port as arguments; - * this method both registers and exports the object.
- * - * @author Ann Wollrath - * @see Activatable - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public class ActivationID implements Serializable { - /** - * the object's activator - */ - private transient Activator activator; - - /** - * the object's unique id - */ - private transient UID uid = new UID(); - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - @java.io.Serial - private static final long serialVersionUID = -4608673054848209235L; - - /** an AccessControlContext with no permissions */ - private static final AccessControlContext NOPERMS_ACC; - static { - Permissions perms = new Permissions(); - ProtectionDomain[] pd = { new ProtectionDomain(null, perms) }; - NOPERMS_ACC = new AccessControlContext(pd); - } - - /** - * The constructor for ActivationID takes a single - * argument, activator, that specifies a remote reference to the - * activator responsible for activating the object associated with - * this identifier. An instance of ActivationID is globally - * unique. - * - * @param activator reference to the activator responsible for - * activating the object - * @throws UnsupportedOperationException if and only if activation is - * not supported by this implementation - * @since 1.2 - */ - public ActivationID(Activator activator) { - this.activator = activator; - } - - /** - * Activate the object for this id. - * - * @param force if true, forces the activator to contact the group - * when activating the object (instead of returning a cached reference); - * if false, returning a cached value is acceptable. - * @return the reference to the active remote object - * @throws ActivationException if activation fails - * @throws UnknownObjectException if the object is unknown - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public Remote activate(boolean force) - throws ActivationException, UnknownObjectException, RemoteException - { - try { - MarshalledObject mobj = - activator.activate(this, force); - return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Remote run() throws IOException, ClassNotFoundException { - return mobj.get(); - } - }, NOPERMS_ACC); - } catch (PrivilegedActionException pae) { - Exception ex = pae.getException(); - if (ex instanceof RemoteException) { - throw (RemoteException) ex; - } else { - throw new UnmarshalException("activation failed", ex); - } - } - - } - - /** - * Returns a hashcode for the activation id. Two identifiers that - * refer to the same remote object will have the same hash code. - * - * @see java.util.Hashtable - * @since 1.2 - */ - public int hashCode() { - return uid.hashCode(); - } - - /** - * Compares two activation ids for content equality. - * Returns true if both of the following conditions are true: - * 1) the unique identifiers equivalent (by content), and - * 2) the activator specified in each identifier - * refers to the same remote object. - * - * @param obj the Object to compare with - * @return true if these Objects are equal; false otherwise. - * @see java.util.Hashtable - * @since 1.2 - */ - public boolean equals(Object obj) { - if (obj instanceof ActivationID) { - ActivationID id = (ActivationID) obj; - return (uid.equals(id.uid) && activator.equals(id.activator)); - } else { - return false; - } - } - - /** - * writeObject for custom serialization. - * - *

This method writes this object's serialized form for - * this class as follows: - * - *

The writeObject method is invoked on - * out passing this object's unique identifier - * (a {@link java.rmi.server.UID UID} instance) as the argument. - * - *

Next, the {@link - * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) - * getRefClass} method is invoked on the activator's - * RemoteRef instance to obtain its external ref - * type name. Next, the writeUTF method is - * invoked on out with the value returned by - * getRefClass, and then the - * writeExternal method is invoked on the - * RemoteRef instance passing out - * as the argument. - * - * @serialData The serialized data for this class comprises a - * java.rmi.server.UID (written with - * ObjectOutput.writeObject) followed by the - * external ref type name of the activator's - * RemoteRef instance (a string written with - * ObjectOutput.writeUTF), followed by the - * external form of the RemoteRef instance as - * written by its writeExternal method. - * - *

The external ref type name of the - * RemoteRef instance is - * determined using the definitions of external ref type - * names specified in the {@link java.rmi.server.RemoteObject - * RemoteObject} writeObject method - * serialData specification. Similarly, the data - * written by the writeExternal method and read - * by the readExternal method of - * RemoteRef implementation classes - * corresponding to each of the defined external ref type - * names is specified in the {@link - * java.rmi.server.RemoteObject RemoteObject} - * writeObject method serialData - * specification. - * - * @param out the {@code ObjectOutputStream} to which data is written - * @throws IOException if an I/O error occurs - **/ - @java.io.Serial - private void writeObject(ObjectOutputStream out) - throws IOException - { - out.writeObject(uid); - - RemoteRef ref; - if (activator instanceof RemoteObject) { - ref = ((RemoteObject) activator).getRef(); - } else if (Proxy.isProxyClass(activator.getClass())) { - InvocationHandler handler = Proxy.getInvocationHandler(activator); - if (!(handler instanceof RemoteObjectInvocationHandler)) { - throw new InvalidObjectException( - "unexpected invocation handler"); - } - ref = ((RemoteObjectInvocationHandler) handler).getRef(); - - } else { - throw new InvalidObjectException("unexpected activator type"); - } - out.writeUTF(ref.getRefClass(out)); - ref.writeExternal(out); - } - - /** - * readObject for custom serialization. - * - *

This method reads this object's serialized form for this - * class as follows: - * - *

The readObject method is invoked on - * in to read this object's unique identifier - * (a {@link java.rmi.server.UID UID} instance). - * - *

Next, the readUTF method is invoked on - * in to read the external ref type name of the - * RemoteRef instance for this object's - * activator. Next, the RemoteRef - * instance is created of an implementation-specific class - * corresponding to the external ref type name (returned by - * readUTF), and the readExternal - * method is invoked on that RemoteRef instance - * to read the external form corresponding to the external - * ref type name. - * - *

Note: If the external ref type name is - * "UnicastRef", "UnicastServerRef", - * "UnicastRef2", "UnicastServerRef2", - * or "ActivatableRef", a corresponding - * implementation-specific class must be found, and its - * readExternal method must read the serial data - * for that external ref type name as specified to be written - * in the serialData documentation for this class. - * If the external ref type name is any other string (of non-zero - * length), a ClassNotFoundException will be thrown, - * unless the implementation provides an implementation-specific - * class corresponding to that external ref type name, in which - * case the RemoteRef will be an instance of - * that implementation-specific class. - * - * @param in the {@code ObjectInputStream} from which data is read - * @throws IOException if an I/O error occurs - * @throws ClassNotFoundException if a serialized class cannot be loaded - * - */ - @java.io.Serial - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - uid = (UID)in.readObject(); - - try { - Class refClass = - Class.forName(RemoteRef.packagePrefix + "." + in.readUTF()) - .asSubclass(RemoteRef.class); - @SuppressWarnings("deprecation") - RemoteRef ref = refClass.newInstance(); - ref.readExternal(in); - activator = (Activator) - Proxy.newProxyInstance(Activator.class.getClassLoader(), - new Class[] { Activator.class }, - new RemoteObjectInvocationHandler(ref)); - } catch (InstantiationException e) { - throw (IOException) - new InvalidObjectException( - "Unable to create remote reference").initCause(e); - } catch (IllegalAccessException e) { - throw (IOException) - new InvalidObjectException( - "Unable to create remote reference").initCause(e); - } - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java deleted file mode 100644 index 9c2c6f43538..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * An ActivationInstantiator is responsible for creating - * instances of "activatable" objects. A concrete subclass of - * ActivationGroup implements the newInstance - * method to handle creating objects within the group. - * - * @author Ann Wollrath - * @see ActivationGroup - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public interface ActivationInstantiator extends Remote { - - /** - * The activator calls an instantiator's newInstance - * method in order to recreate in that group an object with the - * activation identifier, id, and descriptor, - * desc. The instantiator is responsible for:

    - * - *
  • determining the class for the object using the descriptor's - * getClassName method, - * - *
  • loading the class from the code location obtained from the - * descriptor (using the getLocation method), - * - *
  • creating an instance of the class by invoking the special - * "activation" constructor of the object's class that takes two - * arguments: the object's ActivationID, and the - * MarshalledObject containing object specific - * initialization data, and - * - *
  • returning a MarshalledObject containing the stub for the - * remote object it created.
- * - *

In order for activation to be successful, one of the following requirements - * must be met, otherwise {@link ActivationException} is thrown: - * - *

  • The class to be activated and the special activation constructor are both public, - * and the class resides in a package that is - * {@linkplain Module#isExported(String,Module) exported} - * to at least the {@code java.rmi} module; or - * - *
  • The class to be activated resides in a package that is - * {@linkplain Module#isOpen(String,Module) open} - * to at least the {@code java.rmi} module. - *
- * - * @param id the object's activation identifier - * @param desc the object's descriptor - * @return a marshalled object containing the serialized - * representation of remote object's stub - * @throws ActivationException if object activation fails - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public MarshalledObject newInstance(ActivationID id, - ActivationDesc desc) - throws ActivationException, RemoteException; -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationMonitor.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationMonitor.java deleted file mode 100644 index f9e8385a2ac..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationMonitor.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.UnknownGroupException; -import java.rmi.activation.UnknownObjectException; - -/** - * An ActivationMonitor is specific to an - * ActivationGroup and is obtained when a group is - * reported active via a call to - * ActivationSystem.activeGroup (this is done - * internally). An activation group is responsible for informing its - * ActivationMonitor when either: its objects become active or - * inactive, or the group as a whole becomes inactive. - * - * @author Ann Wollrath - * @see Activator - * @see ActivationSystem - * @see ActivationGroup - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public interface ActivationMonitor extends Remote { - - /** - * An activation group calls its monitor's - * inactiveObject method when an object in its group - * becomes inactive (deactivates). An activation group discovers - * that an object (that it participated in activating) in its VM - * is no longer active, via calls to the activation group's - * inactiveObject method.

- * - * The inactiveObject call informs the - * ActivationMonitor that the remote object reference - * it holds for the object with the activation identifier, - * id, is no longer valid. The monitor considers the - * reference associated with id as a stale reference. - * Since the reference is considered stale, a subsequent - * activate call for the same activation identifier - * results in re-activating the remote object. - * - * @param id the object's activation identifier - * @throws UnknownObjectException if object is unknown - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public void inactiveObject(ActivationID id) - throws UnknownObjectException, RemoteException; - - /** - * Informs that an object is now active. An ActivationGroup - * informs its monitor if an object in its group becomes active by - * other means than being activated directly (i.e., the object - * is registered and "activated" itself). - * - * @param id the active object's id - * @param obj the marshalled form of the object's stub - * @throws UnknownObjectException if object is unknown - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public void activeObject(ActivationID id, - MarshalledObject obj) - throws UnknownObjectException, RemoteException; - - /** - * Informs that the group is now inactive. The group will be - * recreated upon a subsequent request to activate an object - * within the group. A group becomes inactive when all objects - * in the group report that they are inactive. - * - * @param id the group's id - * @param incarnation the group's incarnation number - * @throws UnknownGroupException if group is unknown - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public void inactiveGroup(ActivationGroupID id, - long incarnation) - throws UnknownGroupException, RemoteException; - -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/ActivationSystem.java b/src/java.rmi/share/classes/java/rmi/activation/ActivationSystem.java deleted file mode 100644 index 2a7da67ab3c..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationSystem.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.UnknownGroupException; -import java.rmi.activation.UnknownObjectException; - -/** - * The ActivationSystem provides a means for registering - * groups and "activatable" objects to be activated within those groups. - * The ActivationSystem works closely with the - * Activator, which activates objects registered via the - * ActivationSystem, and the ActivationMonitor, - * which obtains information about active and inactive objects, - * and inactive groups. - * - * @author Ann Wollrath - * @see Activator - * @see ActivationMonitor - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public interface ActivationSystem extends Remote { - - /** The port to lookup the activation system. */ - public static final int SYSTEM_PORT = 1098; - - /** - * The registerObject method is used to register an - * activation descriptor, desc, and obtain an - * activation identifier for a activatable remote object. The - * ActivationSystem creates an - * ActivationID (a activation identifier) for the - * object specified by the descriptor, desc, and - * records, in stable storage, the activation descriptor and its - * associated identifier for later use. When the Activator - * receives an activate request for a specific identifier, it - * looks up the activation descriptor (registered previously) for - * the specified identifier and uses that information to activate - * the object. - * - * @param desc the object's activation descriptor - * @return the activation id that can be used to activate the object - * @throws ActivationException if registration fails (e.g., database - * update failure, etc). - * @throws UnknownGroupException if group referred to in - * desc is not registered with this system - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public ActivationID registerObject(ActivationDesc desc) - throws ActivationException, UnknownGroupException, RemoteException; - - /** - * Remove the activation id and associated descriptor previously - * registered with the ActivationSystem; the object - * can no longer be activated via the object's activation id. - * - * @param id the object's activation id (from previous registration) - * @throws ActivationException if unregister fails (e.g., database - * update failure, etc). - * @throws UnknownObjectException if object is unknown (not registered) - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public void unregisterObject(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException; - - /** - * Register the activation group. An activation group must be - * registered with the ActivationSystem before objects - * can be registered within that group. - * - * @param desc the group's descriptor - * @return an identifier for the group - * @throws ActivationException if group registration fails - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public ActivationGroupID registerGroup(ActivationGroupDesc desc) - throws ActivationException, RemoteException; - - /** - * Callback to inform activation system that group is now - * active. This call is made internally by the - * ActivationGroup.createGroup method to inform - * the ActivationSystem that the group is now - * active. - * - * @param id the activation group's identifier - * @param group the group's instantiator - * @param incarnation the group's incarnation number - * @return monitor for activation group - * @throws UnknownGroupException if group is not registered - * @throws ActivationException if a group for the specified - * id is already active and that group is not equal - * to the specified group or that group has a different - * incarnation than the specified group - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public ActivationMonitor activeGroup(ActivationGroupID id, - ActivationInstantiator group, - long incarnation) - throws UnknownGroupException, ActivationException, RemoteException; - - /** - * Remove the activation group. An activation group makes this call back - * to inform the activator that the group should be removed (destroyed). - * If this call completes successfully, objects can no longer be - * registered or activated within the group. All information of the - * group and its associated objects is removed from the system. - * - * @param id the activation group's identifier - * @throws ActivationException if unregister fails (e.g., database - * update failure, etc). - * @throws UnknownGroupException if group is not registered - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public void unregisterGroup(ActivationGroupID id) - throws ActivationException, UnknownGroupException, RemoteException; - - /** - * Shutdown the activation system. Destroys all groups spawned by - * the activation daemon and exits the activation daemon. - * @throws RemoteException if failed to contact/shutdown the activation - * daemon - * @since 1.2 - */ - public void shutdown() throws RemoteException; - - /** - * Set the activation descriptor, desc for the object with - * the activation identifier, id. The change will take - * effect upon subsequent activation of the object. - * - * @param id the activation identifier for the activatable object - * @param desc the activation descriptor for the activatable object - * @throws UnknownGroupException the group associated with - * desc is not a registered group - * @throws UnknownObjectException the activation id - * is not registered - * @throws ActivationException for general failure (e.g., unable - * to update log) - * @throws RemoteException if remote call fails - * @return the previous value of the activation descriptor - * @see #getActivationDesc - * @since 1.2 - */ - public ActivationDesc setActivationDesc(ActivationID id, - ActivationDesc desc) - throws ActivationException, UnknownObjectException, - UnknownGroupException, RemoteException; - - /** - * Set the activation group descriptor, desc for the object - * with the activation group identifier, id. The change will - * take effect upon subsequent activation of the group. - * - * @param id the activation group identifier for the activation group - * @param desc the activation group descriptor for the activation group - * @throws UnknownGroupException the group associated with - * id is not a registered group - * @throws ActivationException for general failure (e.g., unable - * to update log) - * @throws RemoteException if remote call fails - * @return the previous value of the activation group descriptor - * @see #getActivationGroupDesc - * @since 1.2 - */ - public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID id, - ActivationGroupDesc desc) - throws ActivationException, UnknownGroupException, RemoteException; - - /** - * Returns the activation descriptor, for the object with the activation - * identifier, id. - * - * @param id the activation identifier for the activatable object - * @throws UnknownObjectException if id is not registered - * @throws ActivationException for general failure - * @throws RemoteException if remote call fails - * @return the activation descriptor - * @see #setActivationDesc - * @since 1.2 - */ - public ActivationDesc getActivationDesc(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException; - - /** - * Returns the activation group descriptor, for the group - * with the activation group identifier, id. - * - * @param id the activation group identifier for the group - * @throws UnknownGroupException if id is not registered - * @throws ActivationException for general failure - * @throws RemoteException if remote call fails - * @return the activation group descriptor - * @see #setActivationGroupDesc - * @since 1.2 - */ - public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id) - throws ActivationException, UnknownGroupException, RemoteException; -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/Activator.java b/src/java.rmi/share/classes/java/rmi/activation/Activator.java deleted file mode 100644 index b80ee6fa7b0..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/Activator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.UnknownObjectException; - -/** - * The Activator facilitates remote object activation. A - * "faulting" remote reference calls the activator's - * activate method to obtain a "live" reference to a - * "activatable" remote object. Upon receiving a request for activation, - * the activator looks up the activation descriptor for the activation - * identifier, id, determines the group in which the - * object should be activated initiates object re-creation via the - * group's ActivationInstantiator (via a call to the - * newInstance method). The activator initiates the - * execution of activation groups as necessary. For example, if an - * activation group for a specific group identifier is not already - * executing, the activator initiates the execution of a VM for the - * group.

- * - * The Activator works closely with - * ActivationSystem, which provides a means for registering - * groups and objects within those groups, and ActivationMonitor, - * which receives information about active and inactive objects and inactive - * groups.

- * - * The activator is responsible for monitoring and detecting when - * activation groups fail so that it can remove stale remote references - * to groups and active object's within those groups. - * - * @author Ann Wollrath - * @see ActivationInstantiator - * @see ActivationGroupDesc - * @see ActivationGroupID - * @since 1.2 - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public interface Activator extends Remote { - /** - * Activate the object associated with the activation identifier, - * id. If the activator knows the object to be active - * already, and force is false , the stub with a - * "live" reference is returned immediately to the caller; - * otherwise, if the activator does not know that corresponding - * the remote object is active, the activator uses the activation - * descriptor information (previously registered) to determine the - * group (VM) in which the object should be activated. If an - * ActivationInstantiator corresponding to the - * object's group descriptor already exists, the activator invokes - * the activation group's newInstance method passing - * it the object's id and descriptor.

- * - * If the activation group for the object's group descriptor does - * not yet exist, the activator starts an - * ActivationInstantiator executing (by spawning a - * child process, for example). When the activator receives the - * activation group's call back (via the - * ActivationSystem's activeGroup - * method) specifying the activation group's reference, the - * activator can then invoke that activation instantiator's - * newInstance method to forward each pending - * activation request to the activation group and return the - * result (a marshalled remote object reference, a stub) to the - * caller.

- * - * Note that the activator receives a "marshalled" object instead of a - * Remote object so that the activator does not need to load the - * code for that object, or participate in distributed garbage - * collection for that object. If the activator kept a strong - * reference to the remote object, the activator would then - * prevent the object from being garbage collected under the - * normal distributed garbage collection mechanism. - * - * @param id the activation identifier for the object being activated - * @param force if true, the activator contacts the group to obtain - * the remote object's reference; if false, returning the cached value - * is allowed. - * @return the remote object (a stub) in a marshalled form - * @throws ActivationException if object activation fails - * @throws UnknownObjectException if object is unknown (not registered) - * @throws RemoteException if remote call fails - * @since 1.2 - */ - public MarshalledObject activate(ActivationID id, - boolean force) - throws ActivationException, UnknownObjectException, RemoteException; - -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/UnknownGroupException.java b/src/java.rmi/share/classes/java/rmi/activation/UnknownGroupException.java deleted file mode 100644 index 09579abcbc9..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/UnknownGroupException.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -/** - * An UnknownGroupException is thrown by methods of classes and - * interfaces in the java.rmi.activation package when the - * ActivationGroupID parameter to the method is determined to be - * invalid, i.e., not known by the ActivationSystem. An - * UnknownGroupException is also thrown if the - * ActivationGroupID in an ActivationDesc refers to - * a group that is not registered with the ActivationSystem - * - * @author Ann Wollrath - * @since 1.2 - * @see java.rmi.activation.Activatable - * @see java.rmi.activation.ActivationGroup - * @see java.rmi.activation.ActivationGroupID - * @see java.rmi.activation.ActivationMonitor - * @see java.rmi.activation.ActivationSystem - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public class UnknownGroupException extends ActivationException { - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = 7056094974750002460L; - - /** - * Constructs an UnknownGroupException with the specified - * detail message. - * - * @param s the detail message - * @since 1.2 - */ - public UnknownGroupException(String s) { - super(s); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/UnknownObjectException.java b/src/java.rmi/share/classes/java/rmi/activation/UnknownObjectException.java deleted file mode 100644 index b3da527259b..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/UnknownObjectException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package java.rmi.activation; - -/** - * An UnknownObjectException is thrown by methods of classes and - * interfaces in the java.rmi.activation package when the - * ActivationID parameter to the method is determined to be - * invalid. An ActivationID is invalid if it is not currently - * known by the ActivationSystem. An ActivationID - * is obtained by the ActivationSystem.registerObject method. - * An ActivationID is also obtained during the - * Activatable.register call. - * - * @author Ann Wollrath - * @since 1.2 - * @see java.rmi.activation.Activatable - * @see java.rmi.activation.ActivationGroup - * @see java.rmi.activation.ActivationID - * @see java.rmi.activation.ActivationMonitor - * @see java.rmi.activation.ActivationSystem - * @see java.rmi.activation.Activator - * @deprecated - * See the - * {@code java.rmi.activation} package specification for further information. - */ -@Deprecated(forRemoval=true, since="15") -@SuppressWarnings("removal") -public class UnknownObjectException extends ActivationException { - - /** indicate compatibility with the Java 2 SDK v1.2 version of class */ - private static final long serialVersionUID = 3425547551622251430L; - - /** - * Constructs an UnknownObjectException with the specified - * detail message. - * - * @param s the detail message - * @since 1.2 - */ - public UnknownObjectException(String s) { - super(s); - } -} diff --git a/src/java.rmi/share/classes/java/rmi/activation/package-info.java b/src/java.rmi/share/classes/java/rmi/activation/package-info.java deleted file mode 100644 index 1c5a862fbf4..00000000000 --- a/src/java.rmi/share/classes/java/rmi/activation/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1998, 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. 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. - */ - -/** - * Provides support for RMI Object Activation. A remote - * object's reference can be made ``persistent'' and later activated into a - * ``live'' object using the RMI activation mechanism. - * - *

Implementations are not required to support the activation - * mechanism. If activation is not supported by this implementation, - * several specific activation API methods are all required to throw - * {@code UnsupportedOperationException}. If activation is supported by this - * implementation, these methods must never throw {@code - * UnsupportedOperationException}. These methods are denoted by the - * presence of an entry for {@code UnsupportedOperationException} in the - * Throws section of each method's specification. - * - * @since 1.2 - * @deprecated The RMI Activation mechanism has been deprecated and may - * be removed from a future version of the Java Platform. All of the classes - * and interfaces in this package have been terminally deprecated. The - * {@code rmid} tool has also been terminally deprecated. There is no - * replacement for the RMI Activation mechanism in the Java Platform. Users of - * RMI Activation are advised to migrate their applications to other technologies. - */ -package java.rmi.activation; diff --git a/src/java.rmi/share/classes/java/rmi/server/ExportException.java b/src/java.rmi/share/classes/java/rmi/server/ExportException.java index 6f5714c7f9f..eaa293264fc 100644 --- a/src/java.rmi/share/classes/java/rmi/server/ExportException.java +++ b/src/java.rmi/share/classes/java/rmi/server/ExportException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -29,13 +29,11 @@ * An ExportException is a RemoteException * thrown if an attempt to export a remote object fails. A remote object is * exported via the constructors and exportObject methods of - * java.rmi.server.UnicastRemoteObject and - * java.rmi.activation.Activatable. + * java.rmi.server.UnicastRemoteObject. * * @author Ann Wollrath * @since 1.1 * @see java.rmi.server.UnicastRemoteObject - * @see java.rmi.activation.Activatable */ public class ExportException extends java.rmi.RemoteException { diff --git a/src/java.rmi/share/classes/java/rmi/server/RMIClientSocketFactory.java b/src/java.rmi/share/classes/java/rmi/server/RMIClientSocketFactory.java index 4616fad9eac..576345f74b7 100644 --- a/src/java.rmi/share/classes/java/rmi/server/RMIClientSocketFactory.java +++ b/src/java.rmi/share/classes/java/rmi/server/RMIClientSocketFactory.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 @@ -33,8 +33,7 @@ * in order to obtain client sockets for RMI calls. A remote object can be * associated with an RMIClientSocketFactory when it is * created/exported via the constructors or exportObject methods - * of java.rmi.server.UnicastRemoteObject and - * java.rmi.activation.Activatable . + * of java.rmi.server.UnicastRemoteObject. * *

An RMIClientSocketFactory instance associated with a remote * object will be downloaded to clients when the remote object's reference is @@ -56,7 +55,6 @@ * @author Peter Jones * @since 1.2 * @see java.rmi.server.UnicastRemoteObject - * @see java.rmi.activation.Activatable * @see java.rmi.registry.LocateRegistry */ public interface RMIClientSocketFactory { diff --git a/src/java.rmi/share/classes/java/rmi/server/RMIServerSocketFactory.java b/src/java.rmi/share/classes/java/rmi/server/RMIServerSocketFactory.java index 9cadf5501fb..7cda09a5992 100644 --- a/src/java.rmi/share/classes/java/rmi/server/RMIServerSocketFactory.java +++ b/src/java.rmi/share/classes/java/rmi/server/RMIServerSocketFactory.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 @@ -33,8 +33,7 @@ * in order to obtain server sockets for RMI calls. A remote object can be * associated with an RMIServerSocketFactory when it is * created/exported via the constructors or exportObject methods - * of java.rmi.server.UnicastRemoteObject and - * java.rmi.activation.Activatable . + * of java.rmi.server.UnicastRemoteObject. * *

An RMIServerSocketFactory instance associated with a remote * object is used to obtain the ServerSocket used to accept @@ -55,7 +54,6 @@ * @author Peter Jones * @since 1.2 * @see java.rmi.server.UnicastRemoteObject - * @see java.rmi.activation.Activatable * @see java.rmi.registry.LocateRegistry */ public interface RMIServerSocketFactory { diff --git a/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java b/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java index 98df3e716c4..4bf8367865e 100644 --- a/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java +++ b/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -212,12 +212,6 @@ public String toString() { * * If this object is an instance of * RemoteStub or RemoteObjectInvocationHandler - * that was returned from any of - * the java.rmi.activation.Activatable.exportObject methods, - * the external ref type name is "ActivatableRef". - * - * If this object is an instance of - * RemoteStub or RemoteObjectInvocationHandler * that was returned from * the RemoteObject.toStub method (and the argument passed * to toStub was not itself a RemoteStub), @@ -318,43 +312,6 @@ public String toString() { * * * - *

For "ActivatableRef" with a - * null nested remote reference: - * - *

    - * - *
  • an instance of - * java.rmi.activation.ActivationID, - * written by passing it to an invocation of - * writeObject on the stream instance - * - *
  • a zero-length string (""), - * written by {@link java.io.ObjectOutput#writeUTF(String)} - * - *
- * - *

For "ActivatableRef" with a - * non-null nested remote reference: - * - *

    - * - *
  • an instance of - * java.rmi.activation.ActivationID, - * written by passing it to an invocation of - * writeObject on the stream instance - * - *
  • the external ref type name of the nested remote reference, - * which must be "UnicastRef2", - * written by {@link java.io.ObjectOutput#writeUTF(String)} - * - *
  • the external form of the nested remote reference, - * written by invoking its writeExternal method - * with the stream instance - * (see the description of the external form for - * "UnicastRef2" above) - * - *
- * *

For "UnicastServerRef" and * "UnicastServerRef2", no data is written by the * writeExternal method or read by the @@ -412,8 +369,8 @@ private void writeObject(java.io.ObjectOutputStream out) * *

If the external ref type name is * "UnicastRef", "UnicastServerRef", - * "UnicastRef2", "UnicastServerRef2", - * or "ActivatableRef", a corresponding + * "UnicastRef2", or "UnicastServerRef2", + * a corresponding * implementation-specific class must be found, and its * readExternal method must read the serial data * for that external ref type name as specified to be written diff --git a/src/java.rmi/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java b/src/java.rmi/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java index e1944f618ac..68d04f10e40 100644 --- a/src/java.rmi/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java +++ b/src/java.rmi/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -31,7 +31,6 @@ import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.UnexpectedException; -import java.rmi.activation.Activatable; import java.util.Map; import java.util.WeakHashMap; import sun.rmi.server.Util; @@ -45,8 +44,7 @@ * *

Applications are not expected to use this class directly. A remote * object exported to use a dynamic proxy with {@link UnicastRemoteObject} - * or {@link Activatable} has an instance of this class as that proxy's - * invocation handler. + * has an instance of this class as that proxy's invocation handler. * * @author Ann Wollrath * @since 1.5 diff --git a/src/java.rmi/share/classes/module-info.java b/src/java.rmi/share/classes/module-info.java index 99da4f73c5c..96b61a172ff 100644 --- a/src/java.rmi/share/classes/module-info.java +++ b/src/java.rmi/share/classes/module-info.java @@ -28,16 +28,9 @@ * *

The JDK implementation of this module includes * the {@index rmiregistry rmiregistry tool} tool to start a remote - * object registry, and the {@index rmid rmid tool} tool to start - * the activation system daemon. - * - *

Deprecation Notice: The RMI Activation mechanism has been - * deprecated and may be removed from a future version of the Java Platform. See the - * - * {@code java.rmi.activation} package specification for further information. + * object registry. * * @toolGuide rmiregistry - * @toolGuide rmid * * @uses java.rmi.server.RMIClassLoaderSpi * @@ -48,15 +41,11 @@ requires java.logging; exports java.rmi; - exports java.rmi.activation; exports java.rmi.dgc; exports java.rmi.registry; exports java.rmi.server; exports javax.rmi.ssl; - // com.sun.rmi.rmid contains permissions classes that must be - // accessible to the security manager at initialization time - exports com.sun.rmi.rmid to java.base; exports sun.rmi.registry to jdk.management.agent; exports sun.rmi.server to diff --git a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java index 223986f4c27..95f4a9f72c3 100644 --- a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java +++ b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -464,7 +464,6 @@ private static ObjectInputFilter.Status registryFilter(ObjectInputFilter.FilterI || UnicastRef.class.isAssignableFrom(clazz) || RMIClientSocketFactory.class.isAssignableFrom(clazz) || RMIServerSocketFactory.class.isAssignableFrom(clazz) - || java.rmi.activation.ActivationID.class.isAssignableFrom(clazz) || java.rmi.server.UID.class.isAssignableFrom(clazz)) { return ObjectInputFilter.Status.ALLOWED; } else { diff --git a/src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java b/src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java deleted file mode 100644 index 14f4c211800..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Proxy; -import java.net.MalformedURLException; -import java.net.URL; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.Operation; -import java.rmi.server.RMIClassLoader; -import java.rmi.server.RemoteCall; -import java.rmi.server.RemoteObject; -import java.rmi.server.RemoteObjectInvocationHandler; -import java.rmi.server.RemoteRef; -import java.rmi.server.RemoteStub; - -@SuppressWarnings({"deprecation", "removal"}) -public class ActivatableRef implements RemoteRef { - - private static final long serialVersionUID = 7579060052569229166L; - - protected ActivationID id; - protected RemoteRef ref; - transient boolean force = false; - - private static final int MAX_RETRIES = 3; - private static final String versionComplaint = - "activation requires 1.2 stubs"; - - /** - * Create a new (empty) ActivatableRef - */ - public ActivatableRef() - {} - - /** - * Create a ActivatableRef with the specified id - */ - public ActivatableRef(ActivationID id, RemoteRef ref) - { - this.id = id; - this.ref = ref; - } - - /** - * Returns the stub for the remote object whose class is - * specified in the activation descriptor. The ActivatableRef - * in the resulting stub has its activation id set to the - * activation id supplied as the second argument. - */ - public static Remote getStub(ActivationDesc desc, ActivationID id) - throws StubNotFoundException - { - String className = desc.getClassName(); - - try { - Class cl = - RMIClassLoader.loadClass(desc.getLocation(), className); - RemoteRef clientRef = new ActivatableRef(id, null); - return Util.createProxy(cl, clientRef, false); - - } catch (IllegalArgumentException e) { - throw new StubNotFoundException( - "class implements an illegal remote interface", e); - - } catch (ClassNotFoundException e) { - throw new StubNotFoundException("unable to load class: " + - className, e); - } catch (MalformedURLException e) { - throw new StubNotFoundException("malformed URL", e); - } - } - - /** - * Invoke method on remote object. This method delegates remote - * method invocation to the underlying ref type. If the - * underlying reference is not known (is null), then the object - * must be activated first. If an attempt at method invocation - * fails, the object should force reactivation. Method invocation - * must preserve "at most once" call semantics. In RMI, "at most - * once" applies to parameter deserialization at the remote site - * and the remote object's method execution. "At most once" does - * not apply to parameter serialization at the client so the - * parameters of a call don't need to be buffered in anticipation - * of call retry. Thus, a method call is only be retried if the - * initial method invocation does not execute at all at the server - * (including parameter deserialization). - */ - public Object invoke(Remote obj, - java.lang.reflect.Method method, - Object[] params, - long opnum) - throws Exception - { - - boolean force = false; - RemoteRef localRef; - Exception exception = null; - - /* - * Attempt object activation if active ref is unknown. - * Throws a RemoteException if object can't be activated. - */ - synchronized (this) { - if (ref == null) { - localRef = activate(force); - force = true; - } else { - localRef = ref; - } - } - - for (int retries = MAX_RETRIES; retries > 0; retries--) { - - try { - return localRef.invoke(obj, method, params, opnum); - } catch (NoSuchObjectException e) { - /* - * Object is not active in VM; retry call - */ - exception = e; - } catch (ConnectException e) { - /* - * Failure during connection setup; retry call - */ - exception = e; - } catch (UnknownHostException e) { - /* - * Failure during connection setup; retry call. - */ - exception = e; - } catch (ConnectIOException e) { - /* - * Failure reusing cached connection; retry call - */ - exception = e; - } catch (MarshalException e) { - /* - * Failure during parameter serialization; call may - * have reached server, so call retry not possible. - */ - throw e; - } catch (ServerError e) { - /* - * Call reached server; propagate remote exception. - */ - throw e; - } catch (ServerException e) { - /* - * Call reached server; propagate remote exception - */ - throw e; - } catch (RemoteException e) { - /* - * This is a catch-all for other RemoteExceptions. - * UnmarshalException being the only one relevant. - * - * StubNotFoundException should never show up because - * it is generally thrown when attempting to locate - * a stub. - * - * UnexpectedException should never show up because - * it is only thrown by a stub and would be wrapped - * in a ServerException if it was propagated by a - * remote call. - */ - synchronized (this) { - if (localRef == ref) { - ref = null; // this may be overly conservative - } - } - - throw e; - } - - if (retries > 1) { - /* - * Activate object, since object could not be reached. - */ - synchronized (this) { - if (localRef.remoteEquals(ref) || ref == null) { - RemoteRef newRef = activate(force); - - if (newRef.remoteEquals(localRef) && - exception instanceof NoSuchObjectException && - force == false) { - /* - * If last exception was NoSuchObjectException, - * then old value of ref is definitely wrong, - * so make sure that it is different. - */ - newRef = activate(true); - } - - localRef = newRef; - force = true; - } else { - localRef = ref; - force = false; - } - } - } - } - - /* - * Retries unsuccessful, so throw last exception - */ - throw exception; - } - - /** - * private method to obtain the ref for a call. - */ - private synchronized RemoteRef getRef() - throws RemoteException - { - if (ref == null) { - ref = activate(false); - } - - return ref; - } - - /** - * private method to activate the remote object. - * - * NOTE: the caller must be synchronized on "this" before - * calling this method. - */ - private RemoteRef activate(boolean force) - throws RemoteException - { - assert Thread.holdsLock(this); - - ref = null; - try { - /* - * Activate the object and retrieve the remote reference - * from inside the stub returned as the result. Then - * set this activatable ref's internal ref to be the - * ref inside the ref of the stub. In more clear terms, - * the stub returned from the activate call contains an - * ActivatableRef. We need to set the ref in *this* - * ActivatableRef to the ref inside the ActivatableRef - * retrieved from the stub. The ref type embedded in the - * ActivatableRef is typically a UnicastRef. - */ - - Remote proxy = id.activate(force); - ActivatableRef newRef = null; - - if (proxy instanceof RemoteStub) { - newRef = (ActivatableRef) ((RemoteStub) proxy).getRef(); - } else { - /* - * Assume that proxy is an instance of a dynamic proxy - * class. If that assumption is not correct, or either of - * the casts below fails, the resulting exception will be - * wrapped in an ActivateFailedException below. - */ - RemoteObjectInvocationHandler handler = - (RemoteObjectInvocationHandler) - Proxy.getInvocationHandler(proxy); - newRef = (ActivatableRef) handler.getRef(); - } - ref = newRef.ref; - return ref; - - } catch (ConnectException e) { - throw new ConnectException("activation failed", e); - } catch (RemoteException e) { - throw new ConnectIOException("activation failed", e); - } catch (UnknownObjectException e) { - throw new NoSuchObjectException("object not registered"); - } catch (ActivationException e) { - throw new ActivateFailedException("activation failed", e); - } - } - - /** - * This call is used by the old 1.1 stub protocol and is - * unsupported since activation requires 1.2 stubs. - */ - public synchronized RemoteCall newCall(RemoteObject obj, - Operation[] ops, - int opnum, - long hash) - throws RemoteException - { - throw new UnsupportedOperationException(versionComplaint); - } - - /** - * This call is used by the old 1.1 stub protocol and is - * unsupported since activation requires 1.2 stubs. - */ - public void invoke(RemoteCall call) throws Exception - { - throw new UnsupportedOperationException(versionComplaint); - } - - /** - * This call is used by the old 1.1 stub protocol and is - * unsupported since activation requires 1.2 stubs. - */ - public void done(RemoteCall call) throws RemoteException { - throw new UnsupportedOperationException(versionComplaint); - } - - /** - * Returns the class of the ref type to be serialized - */ - public String getRefClass(ObjectOutput out) - { - return "ActivatableRef"; - } - - /** - * Write out external representation for remote ref. - */ - public void writeExternal(ObjectOutput out) throws IOException - { - RemoteRef localRef = ref; - - out.writeObject(id); - if (localRef == null) { - out.writeUTF(""); - } else { - out.writeUTF(localRef.getRefClass(out)); - localRef.writeExternal(out); - } - } - - /** - * Read in external representation for remote ref. - * @exception ClassNotFoundException If the class for an object - * being restored cannot be found. - */ - public void readExternal(ObjectInput in) - throws IOException, ClassNotFoundException - { - id = (ActivationID)in.readObject(); - ref = null; - String className = in.readUTF(); - - if (className.isEmpty()) return; - - try { - Class refClass = Class.forName(RemoteRef.packagePrefix + "." + - className); - ref = (RemoteRef)refClass.newInstance(); - ref.readExternal(in); - } catch (InstantiationException e) { - throw new UnmarshalException("Unable to create remote reference", - e); - } catch (IllegalAccessException e) { - throw new UnmarshalException("Illegal access creating remote reference"); - } - } - - //----------------------------------------------------------------------; - /** - * Method from object, forward from RemoteObject - */ - public String remoteToString() { - return Util.getUnqualifiedName(getClass()) + - " [remoteRef: " + ref + "]"; - } - - /** - * default implementation of hashCode for remote objects - */ - public int remoteHashCode() { - return id.hashCode(); - } - - /** default implementation of equals for remote objects - */ - public boolean remoteEquals(RemoteRef ref) { - if (ref instanceof ActivatableRef) - return id.equals(((ActivatableRef)ref).id); - return false; - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java b/src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java deleted file mode 100644 index 4640994f0a9..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.io.IOException; -import java.io.NotSerializableException; -import java.io.ObjectOutput; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.ActivationID; -import sun.rmi.transport.LiveRef; - -/** - * Server-side ref for a persistent remote impl. - * - * @author Ann Wollrath - */ -@SuppressWarnings({"removal", "serial"}) // Externalizable class w/o no-arg c'tor -public class ActivatableServerRef extends UnicastServerRef2 { - - private static final long serialVersionUID = 2002967993223003793L; - - private ActivationID id; - - /** - * Construct a Unicast server remote reference to be exported - * on the specified port. - */ - public ActivatableServerRef(ActivationID id, int port) - { - this(id, port, null, null); - } - - /** - * Construct a Unicast server remote reference to be exported - * on the specified port. - */ - public ActivatableServerRef(ActivationID id, int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf) - { - super(new LiveRef(port, csf, ssf)); - this.id = id; - } - - /** - * Returns the class of the ref type to be serialized - */ - public String getRefClass(ObjectOutput out) - { - return "ActivatableServerRef"; - } - - /** - * Return the client remote reference for this remoteRef. - * In the case of a client RemoteRef "this" is the answer. - * For a server remote reference, a client side one will have to - * found or created. - */ - protected RemoteRef getClientRef() { - return new ActivatableRef(id, new UnicastRef2(ref)); - } - - /** - * Prevents serialization (because deserializaion is impossible). - */ - public void writeExternal(ObjectOutput out) throws IOException { - throw new NotSerializableException( - "ActivatableServerRef not serializable"); - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/Activation$ActivationSystemImpl_Stub.java b/src/java.rmi/share/classes/sun/rmi/server/Activation$ActivationSystemImpl_Stub.java deleted file mode 100644 index 5b988ee963f..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/Activation$ActivationSystemImpl_Stub.java +++ /dev/null @@ -1,239 +0,0 @@ -/* -* Copyright (c) 1997, 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. 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. -*/ -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -package sun.rmi.server; - -/** - * Activation$ActivationSystemImpl_Stub. - */ -@SuppressWarnings({"deprecation", "rawtypes", "removal", "unchecked"}) -public final class Activation$ActivationSystemImpl_Stub - extends java.rmi.server.RemoteStub - implements java.rmi.activation.ActivationSystem, java.rmi.Remote { - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_activeGroup_0; - private static java.lang.reflect.Method $method_getActivationDesc_1; - private static java.lang.reflect.Method $method_getActivationGroupDesc_2; - private static java.lang.reflect.Method $method_registerGroup_3; - private static java.lang.reflect.Method $method_registerObject_4; - private static java.lang.reflect.Method $method_setActivationDesc_5; - private static java.lang.reflect.Method $method_setActivationGroupDesc_6; - private static java.lang.reflect.Method $method_shutdown_7; - private static java.lang.reflect.Method $method_unregisterGroup_8; - private static java.lang.reflect.Method $method_unregisterObject_9; - - static { - try { - $method_activeGroup_0 = java.rmi.activation.ActivationSystem.class.getMethod("activeGroup", new java.lang.Class[]{java.rmi.activation.ActivationGroupID.class, java.rmi.activation.ActivationInstantiator.class, long.class}); - $method_getActivationDesc_1 = java.rmi.activation.ActivationSystem.class.getMethod("getActivationDesc", new java.lang.Class[]{java.rmi.activation.ActivationID.class}); - $method_getActivationGroupDesc_2 = java.rmi.activation.ActivationSystem.class.getMethod("getActivationGroupDesc", new java.lang.Class[]{java.rmi.activation.ActivationGroupID.class}); - $method_registerGroup_3 = java.rmi.activation.ActivationSystem.class.getMethod("registerGroup", new java.lang.Class[]{java.rmi.activation.ActivationGroupDesc.class}); - $method_registerObject_4 = java.rmi.activation.ActivationSystem.class.getMethod("registerObject", new java.lang.Class[]{java.rmi.activation.ActivationDesc.class}); - $method_setActivationDesc_5 = java.rmi.activation.ActivationSystem.class.getMethod("setActivationDesc", new java.lang.Class[]{java.rmi.activation.ActivationID.class, java.rmi.activation.ActivationDesc.class}); - $method_setActivationGroupDesc_6 = java.rmi.activation.ActivationSystem.class.getMethod("setActivationGroupDesc", new java.lang.Class[]{java.rmi.activation.ActivationGroupID.class, java.rmi.activation.ActivationGroupDesc.class}); - $method_shutdown_7 = java.rmi.activation.ActivationSystem.class.getMethod("shutdown", new java.lang.Class[]{}); - $method_unregisterGroup_8 = java.rmi.activation.ActivationSystem.class.getMethod("unregisterGroup", new java.lang.Class[]{java.rmi.activation.ActivationGroupID.class}); - $method_unregisterObject_9 = java.rmi.activation.ActivationSystem.class.getMethod("unregisterObject", new java.lang.Class[]{java.rmi.activation.ActivationID.class}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public Activation$ActivationSystemImpl_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of activeGroup(ActivationGroupID, ActivationInstantiator, long) - public java.rmi.activation.ActivationMonitor activeGroup(java.rmi.activation.ActivationGroupID $param_ActivationGroupID_1, java.rmi.activation.ActivationInstantiator $param_ActivationInstantiator_2, long $param_long_3) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException { - try { - Object $result = ref.invoke(this, $method_activeGroup_0, new java.lang.Object[]{$param_ActivationGroupID_1, $param_ActivationInstantiator_2, new java.lang.Long($param_long_3)}, -4575843150759415294L); - return ((java.rmi.activation.ActivationMonitor) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of getActivationDesc(ActivationID) - public java.rmi.activation.ActivationDesc getActivationDesc(java.rmi.activation.ActivationID $param_ActivationID_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownObjectException { - try { - Object $result = ref.invoke(this, $method_getActivationDesc_1, new java.lang.Object[]{$param_ActivationID_1}, 4830055440982622087L); - return ((java.rmi.activation.ActivationDesc) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of getActivationGroupDesc(ActivationGroupID) - public java.rmi.activation.ActivationGroupDesc getActivationGroupDesc(java.rmi.activation.ActivationGroupID $param_ActivationGroupID_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException { - try { - Object $result = ref.invoke(this, $method_getActivationGroupDesc_2, new java.lang.Object[]{$param_ActivationGroupID_1}, -8701843806548736528L); - return ((java.rmi.activation.ActivationGroupDesc) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of registerGroup(ActivationGroupDesc) - public java.rmi.activation.ActivationGroupID registerGroup(java.rmi.activation.ActivationGroupDesc $param_ActivationGroupDesc_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException { - try { - Object $result = ref.invoke(this, $method_registerGroup_3, new java.lang.Object[]{$param_ActivationGroupDesc_1}, 6921515268192657754L); - return ((java.rmi.activation.ActivationGroupID) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of registerObject(ActivationDesc) - public java.rmi.activation.ActivationID registerObject(java.rmi.activation.ActivationDesc $param_ActivationDesc_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException { - try { - Object $result = ref.invoke(this, $method_registerObject_4, new java.lang.Object[]{$param_ActivationDesc_1}, -3006759798994351347L); - return ((java.rmi.activation.ActivationID) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of setActivationDesc(ActivationID, ActivationDesc) - public java.rmi.activation.ActivationDesc setActivationDesc(java.rmi.activation.ActivationID $param_ActivationID_1, java.rmi.activation.ActivationDesc $param_ActivationDesc_2) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException, java.rmi.activation.UnknownObjectException { - try { - Object $result = ref.invoke(this, $method_setActivationDesc_5, new java.lang.Object[]{$param_ActivationID_1, $param_ActivationDesc_2}, 7128043237057180796L); - return ((java.rmi.activation.ActivationDesc) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of setActivationGroupDesc(ActivationGroupID, ActivationGroupDesc) - public java.rmi.activation.ActivationGroupDesc setActivationGroupDesc(java.rmi.activation.ActivationGroupID $param_ActivationGroupID_1, java.rmi.activation.ActivationGroupDesc $param_ActivationGroupDesc_2) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException { - try { - Object $result = ref.invoke(this, $method_setActivationGroupDesc_6, new java.lang.Object[]{$param_ActivationGroupID_1, $param_ActivationGroupDesc_2}, 1213918527826541191L); - return ((java.rmi.activation.ActivationGroupDesc) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.rmi.RemoteException { - try { - ref.invoke(this, $method_shutdown_7, null, -7207851917985848402L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of unregisterGroup(ActivationGroupID) - public void unregisterGroup(java.rmi.activation.ActivationGroupID $param_ActivationGroupID_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownGroupException { - try { - ref.invoke(this, $method_unregisterGroup_8, new java.lang.Object[]{$param_ActivationGroupID_1}, 3768097077835970701L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of unregisterObject(ActivationID) - public void unregisterObject(java.rmi.activation.ActivationID $param_ActivationID_1) - throws java.rmi.RemoteException, java.rmi.activation.ActivationException, java.rmi.activation.UnknownObjectException { - try { - ref.invoke(this, $method_unregisterObject_9, new java.lang.Object[]{$param_ActivationID_1}, -6843850585331411084L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.rmi.activation.ActivationException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/Activation.java b/src/java.rmi/share/classes/sun/rmi/server/Activation.java deleted file mode 100644 index 9d615b95576..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/Activation.java +++ /dev/null @@ -1,2605 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInput; -import java.io.ObjectInputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.lang.Process; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.SocketException; -import java.nio.file.Files; -import java.nio.channels.Channel; -import java.nio.channels.ServerSocketChannel; -import java.rmi.AccessException; -import java.rmi.AlreadyBoundException; -import java.rmi.ConnectException; -import java.rmi.ConnectIOException; -import java.rmi.MarshalledObject; -import java.rmi.NoSuchObjectException; -import java.rmi.NotBoundException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.ActivationDesc; -import java.rmi.activation.ActivationException; -import java.rmi.activation.ActivationGroupDesc; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationID; -import java.rmi.activation.ActivationInstantiator; -import java.rmi.activation.ActivationMonitor; -import java.rmi.activation.ActivationSystem; -import java.rmi.activation.Activator; -import java.rmi.activation.UnknownGroupException; -import java.rmi.activation.UnknownObjectException; -import java.rmi.registry.Registry; -import java.rmi.server.ObjID; -import java.rmi.server.RMIClassLoader; -import java.rmi.server.RMIClientSocketFactory; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.RemoteObject; -import java.rmi.server.RemoteServer; -import java.rmi.server.UnicastRemoteObject; -import java.security.AccessControlException; -import java.security.AccessController; -import java.security.AllPermission; -import java.security.CodeSource; -import java.security.Permission; -import java.security.PermissionCollection; -import java.security.Permissions; -import java.security.Policy; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.cert.Certificate; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.Properties; -import java.util.ResourceBundle; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import sun.rmi.log.LogHandler; -import sun.rmi.log.ReliableLog; -import sun.rmi.registry.RegistryImpl; -import sun.rmi.runtime.NewThreadAction; -import sun.rmi.transport.LiveRef; -import sun.security.provider.PolicyFile; -import com.sun.rmi.rmid.ExecPermission; -import com.sun.rmi.rmid.ExecOptionPermission; - -/** - * The Activator facilitates remote object activation. A "faulting" - * remote reference calls the activator's activate method - * to obtain a "live" reference to a activatable remote object. Upon - * receiving a request for activation, the activator looks up the - * activation descriptor for the activation identifier, id, determines - * the group in which the object should be activated and invokes the - * activate method on the object's activation group (described by the - * remote interface ActivationInstantiator). The - * activator initiates the execution of activation groups as - * necessary. For example, if an activation group for a specific group - * identifier is not already executing, the activator will spawn a - * child process for the activation group.

- * - * The activator is responsible for monitoring and detecting when - * activation groups fail so that it can remove stale remote references - * from its internal tables.

- * - * @author Ann Wollrath - * @since 1.2 - */ -@SuppressWarnings("removal") -public class Activation implements Serializable { - - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 2921265612698155191L; - private static final byte MAJOR_VERSION = 1; - private static final byte MINOR_VERSION = 0; - - /** exec policy object */ - private static Object execPolicy; - private static Method execPolicyMethod; - private static boolean debugExec; - - /** maps activation id to its respective group id */ - @SuppressWarnings("serial") // Conditionally serializable - private Map idTable = - new ConcurrentHashMap<>(); - /** maps group id to its GroupEntry groups */ - @SuppressWarnings("serial") // Conditionally serializable - private Map groupTable = - new ConcurrentHashMap<>(); - - private byte majorVersion = MAJOR_VERSION; - private byte minorVersion = MINOR_VERSION; - - /** number of simultaneous group exec's */ - private transient int groupSemaphore; - /** counter for numbering groups */ - private transient int groupCounter; - /** reliable log to hold descriptor table */ - private transient ReliableLog log; - /** number of updates since last snapshot */ - private transient int numUpdates; - - /** the java command */ - // accessed by GroupEntry - private transient String[] command; - /** timeout on wait for child process to be created or destroyed */ - private static final long groupTimeout = - getInt("sun.rmi.activation.groupTimeout", 60000); - /** take snapshot after this many updates */ - private static final int snapshotInterval = - getInt("sun.rmi.activation.snapshotInterval", 200); - /** timeout on wait for child process to be created */ - private static final long execTimeout = - getInt("sun.rmi.activation.execTimeout", 30000); - - private static final Object initLock = new Object(); - private static boolean initDone = false; - - // this should be a *private* method since it is privileged - private static int getInt(String name, int def) { - return AccessController.doPrivileged( - (PrivilegedAction) () -> Integer.getInteger(name, def)); - } - - private transient Activator activator; - private transient Activator activatorStub; - private transient ActivationSystem system; - private transient ActivationSystem systemStub; - private transient ActivationMonitor monitor; - private transient Registry registry; - private transient volatile boolean shuttingDown = false; - private transient volatile Object startupLock; - private transient Thread shutdownHook; - - private static ResourceBundle resources = null; - - /** - * Create an uninitialized instance of Activation that can be - * populated with log data. This is only called when the initial - * snapshot is taken during the first incarnation of rmid. - */ - private Activation() {} - - /** - * Recover activation state from the reliable log and initialize - * activation services. - */ - private static void startActivation(int port, - RMIServerSocketFactory ssf, - String logName, - String[] childArgs) - throws Exception - { - ReliableLog log = new ReliableLog(logName, new ActLogHandler()); - Activation state = (Activation) log.recover(); - state.init(port, ssf, log, childArgs); - } - - /** - * Initialize the Activation instantiation; start activation - * services. - */ - private void init(int port, - RMIServerSocketFactory ssf, - ReliableLog log, - String[] childArgs) - throws Exception - { - // initialize - this.log = log; - numUpdates = 0; - shutdownHook = new ShutdownHook(); - groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3); - groupCounter = 0; - Runtime.getRuntime().addShutdownHook(shutdownHook); - - // Use array size of 0, since the value from calling size() - // may be out of date by the time toArray() is called. - ActivationGroupID[] gids = - groupTable.keySet().toArray(new ActivationGroupID[0]); - - synchronized (startupLock = new Object()) { - // all the remote methods briefly synchronize on startupLock - // (via checkShutdown) to make sure they don't happen in the - // middle of this block. This block must not cause any such - // incoming remote calls to happen, or deadlock would result! - activator = new ActivatorImpl(port, ssf); - activatorStub = (Activator) RemoteObject.toStub(activator); - system = new ActivationSystemImpl(port, ssf); - systemStub = (ActivationSystem) RemoteObject.toStub(system); - monitor = new ActivationMonitorImpl(port, ssf); - initCommand(childArgs); - registry = new SystemRegistryImpl(port, null, ssf, systemStub); - - if (ssf != null) { - synchronized (initLock) { - initDone = true; - initLock.notifyAll(); - } - } - } - startupLock = null; - - // restart services - for (int i = gids.length; --i >= 0; ) { - try { - getGroupEntry(gids[i]).restartServices(); - } catch (UnknownGroupException e) { - System.err.println( - getTextResource("rmid.restart.group.warning")); - e.printStackTrace(); - } - } - } - - /** - * Previous versions used HashMap instead of ConcurrentHashMap. - * Replace any HashMaps found during deserialization with - * ConcurrentHashMaps. - */ - private void readObject(ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - ois.defaultReadObject(); - if (! (groupTable instanceof ConcurrentHashMap)) { - groupTable = new ConcurrentHashMap<>(groupTable); - } - if (! (idTable instanceof ConcurrentHashMap)) { - idTable = new ConcurrentHashMap<>(idTable); - } - } - - private static class SystemRegistryImpl extends RegistryImpl { - - private static final String NAME = ActivationSystem.class.getName(); - private static final long serialVersionUID = 4877330021609408794L; - @SuppressWarnings("serial") // Not statically typed as Serializable - private ActivationSystem systemStub = null; - - SystemRegistryImpl(int port, - RMIClientSocketFactory csf, - RMIServerSocketFactory ssf, - ActivationSystem systemStub) - throws RemoteException - { - super(port, csf, ssf); - assert systemStub != null; - synchronized (this) { - this.systemStub = systemStub; - notifyAll(); - } - } - - /** - * Waits for systemStub to be initialized and returns its - * initialized value. Any remote call that uses systemStub must - * call this method to get it instead of using direct field - * access. This is necessary because the super() call in the - * constructor exports this object before systemStub is initialized - * (see JDK-8023541), allowing remote calls to come in during this - * time. We can't use checkShutdown() like other nested classes - * because this is a static class. - */ - private synchronized ActivationSystem getSystemStub() { - boolean interrupted = false; - - while (systemStub == null) { - try { - wait(); - } catch (InterruptedException ie) { - interrupted = true; - } - } - - if (interrupted) { - Thread.currentThread().interrupt(); - } - - return systemStub; - } - - /** - * Returns the activation system stub if the specified name - * matches the activation system's class name, otherwise - * returns the result of invoking super.lookup with the specified - * name. - */ - public Remote lookup(String name) - throws RemoteException, NotBoundException - { - if (name.equals(NAME)) { - return getSystemStub(); - } else { - return super.lookup(name); - } - } - - public String[] list() throws RemoteException { - String[] list1 = super.list(); - int length = list1.length; - String[] list2 = new String[length + 1]; - if (length > 0) { - System.arraycopy(list1, 0, list2, 0, length); - } - list2[length] = NAME; - return list2; - } - - public void bind(String name, Remote obj) - throws RemoteException, AlreadyBoundException, AccessException - { - if (name.equals(NAME)) { - throw new AccessException( - "binding ActivationSystem is disallowed"); - } else { - RegistryImpl.checkAccess("ActivationSystem.bind"); - super.bind(name, obj); - } - } - - public void unbind(String name) - throws RemoteException, NotBoundException, AccessException - { - if (name.equals(NAME)) { - throw new AccessException( - "unbinding ActivationSystem is disallowed"); - } else { - RegistryImpl.checkAccess("ActivationSystem.unbind"); - super.unbind(name); - } - } - - - public void rebind(String name, Remote obj) - throws RemoteException, AccessException - { - if (name.equals(NAME)) { - throw new AccessException( - "binding ActivationSystem is disallowed"); - } else { - RegistryImpl.checkAccess("ActivationSystem.rebind"); - super.rebind(name, obj); - } - } - } - - - class ActivatorImpl extends RemoteServer implements Activator { - // Because ActivatorImpl has a fixed ObjID, it can be - // called by clients holding stale remote references. Each of - // its remote methods, then, must check startupLock (calling - // checkShutdown() is easiest). - - private static final long serialVersionUID = -3654244726254566136L; - - /** - * Construct a new Activator on a specified port. - */ - ActivatorImpl(int port, RMIServerSocketFactory ssf) - throws RemoteException - { - /* Server ref must be created and assigned before remote object - * 'this' can be exported. - */ - LiveRef lref = - new LiveRef(new ObjID(ObjID.ACTIVATOR_ID), port, null, ssf); - UnicastServerRef uref = new UnicastServerRef(lref); - ref = uref; - uref.exportObject(this, null, false); - } - - public MarshalledObject activate(ActivationID id, - boolean force) - throws ActivationException, UnknownObjectException, RemoteException - { - checkShutdown(); - return getGroupEntry(id).activate(id, force); - } - } - - class ActivationMonitorImpl extends UnicastRemoteObject - implements ActivationMonitor - { - private static final long serialVersionUID = -6214940464757948867L; - - ActivationMonitorImpl(int port, RMIServerSocketFactory ssf) - throws RemoteException - { - super(port, null, ssf); - } - - public void inactiveObject(ActivationID id) - throws UnknownObjectException, RemoteException - { - try { - checkShutdown(); - } catch (ActivationException e) { - return; - } - RegistryImpl.checkAccess("Activator.inactiveObject"); - getGroupEntry(id).inactiveObject(id); - } - - public void activeObject(ActivationID id, - MarshalledObject mobj) - throws UnknownObjectException, RemoteException - { - try { - checkShutdown(); - } catch (ActivationException e) { - return; - } - RegistryImpl.checkAccess("ActivationSystem.activeObject"); - getGroupEntry(id).activeObject(id, mobj); - } - - public void inactiveGroup(ActivationGroupID id, - long incarnation) - throws UnknownGroupException, RemoteException - { - try { - checkShutdown(); - } catch (ActivationException e) { - return; - } - RegistryImpl.checkAccess("ActivationMonitor.inactiveGroup"); - getGroupEntry(id).inactiveGroup(incarnation, false); - } - } - - - /** - * SameHostOnlyServerRef checks that access is from a local client - * before the parameters are deserialized. The unmarshalCustomCallData - * hook is used to check the network address of the caller - * with RegistryImpl.checkAccess(). - * The kind of access is retained for an exception if one is thrown. - */ - @SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor - static class SameHostOnlyServerRef extends UnicastServerRef { - private static final long serialVersionUID = 1234L; - private String accessKind; // an exception message - - /** - * Construct a new SameHostOnlyServerRef from a LiveRef. - * @param lref a LiveRef - */ - SameHostOnlyServerRef(LiveRef lref, String accessKind) { - super(lref); - this.accessKind = accessKind; - } - - @Override - protected void unmarshalCustomCallData(ObjectInput in) throws IOException, ClassNotFoundException { - RegistryImpl.checkAccess(accessKind); - super.unmarshalCustomCallData(in); - } - } - - class ActivationSystemImpl - extends RemoteServer - implements ActivationSystem - { - private static final long serialVersionUID = 9100152600327688967L; - - // Because ActivationSystemImpl has a fixed ObjID, it can be - // called by clients holding stale remote references. Each of - // its remote methods, then, must check startupLock (calling - // checkShutdown() is easiest). - ActivationSystemImpl(int port, RMIServerSocketFactory ssf) - throws RemoteException - { - /* Server ref must be created and assigned before remote object - * 'this' can be exported. - */ - LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf); - UnicastServerRef uref = new SameHostOnlyServerRef(lref, - "ActivationSystem.nonLocalAccess"); - ref = uref; - uref.exportObject(this, null); - } - - public ActivationID registerObject(ActivationDesc desc) - throws ActivationException, UnknownGroupException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - ActivationGroupID groupID = desc.getGroupID(); - ActivationID id = new ActivationID(activatorStub); - getGroupEntry(groupID).registerObject(id, desc, true); - return id; - } - - public void unregisterObject(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - getGroupEntry(id).unregisterObject(id, true); - } - - public ActivationGroupID registerGroup(ActivationGroupDesc desc) - throws ActivationException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - checkArgs(desc, null); - - ActivationGroupID id = new ActivationGroupID(systemStub); - GroupEntry entry = new GroupEntry(id, desc); - // table insertion must take place before log update - groupTable.put(id, entry); - addLogRecord(new LogRegisterGroup(id, desc)); - return id; - } - - public ActivationMonitor activeGroup(ActivationGroupID id, - ActivationInstantiator group, - long incarnation) - throws ActivationException, UnknownGroupException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - getGroupEntry(id).activeGroup(group, incarnation); - return monitor; - } - - public void unregisterGroup(ActivationGroupID id) - throws ActivationException, UnknownGroupException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - // remove entry before unregister so state is updated before - // logged - removeGroupEntry(id).unregisterGroup(true); - } - - public ActivationDesc setActivationDesc(ActivationID id, - ActivationDesc desc) - throws ActivationException, UnknownObjectException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - if (!getGroupID(id).equals(desc.getGroupID())) { - throw new ActivationException( - "ActivationDesc contains wrong group"); - } - return getGroupEntry(id).setActivationDesc(id, desc, true); - } - - public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID id, - ActivationGroupDesc desc) - throws ActivationException, UnknownGroupException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - checkArgs(desc, null); - return getGroupEntry(id).setActivationGroupDesc(id, desc, true); - } - - public ActivationDesc getActivationDesc(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - return getGroupEntry(id).getActivationDesc(id); - } - - public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id) - throws ActivationException, UnknownGroupException, RemoteException - { - checkShutdown(); - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - return getGroupEntry(id).desc; - } - - /** - * Shutdown the activation system. Destroys all groups spawned by - * the activation daemon and exits the activation daemon. - */ - public void shutdown() throws AccessException { - // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef - // during unmarshallCustomData and is not applicable to local access. - - Object lock = startupLock; - if (lock != null) { - synchronized (lock) { - // nothing - } - } - - synchronized (Activation.this) { - if (!shuttingDown) { - shuttingDown = true; - (new Shutdown()).start(); - } - } - } - } - - private void checkShutdown() throws ActivationException { - // if the startup critical section is running, wait until it - // completes/fails before continuing with the remote call. - Object lock = startupLock; - if (lock != null) { - synchronized (lock) { - // nothing - } - } - - if (shuttingDown == true) { - throw new ActivationException( - "activation system shutting down"); - } - } - - private static void unexport(Remote obj) { - for (;;) { - try { - if (UnicastRemoteObject.unexportObject(obj, false) == true) { - break; - } else { - Thread.sleep(100); - } - } catch (Exception e) { - continue; - } - } - } - - /** - * Thread to shutdown rmid. - */ - private class Shutdown extends Thread { - Shutdown() { - super("rmid Shutdown"); - } - - public void run() { - try { - /* - * Unexport activation system services - */ - unexport(activator); - unexport(system); - - // destroy all child processes (groups) - for (GroupEntry groupEntry : groupTable.values()) { - groupEntry.shutdown(); - } - - Runtime.getRuntime().removeShutdownHook(shutdownHook); - - /* - * Unexport monitor safely since all processes are destroyed. - */ - unexport(monitor); - - /* - * Close log file, fix for 4243264: rmid shutdown thread - * interferes with remote calls in progress. Make sure - * the log file is only closed when it is impossible for - * its closure to interfere with any pending remote calls. - * We close the log when all objects in the rmid VM are - * unexported. - */ - try { - synchronized (log) { - log.close(); - } - } catch (IOException e) { - } - - } finally { - /* - * Now exit... A System.exit should only be done if - * the RMI activation system daemon was started up - * by the main method below (in which should always - * be the case since the Activation constructor is private). - */ - System.err.println(getTextResource("rmid.daemon.shutdown")); - System.exit(0); - } - } - } - - /** Thread to destroy children in the event of abnormal termination. */ - private class ShutdownHook extends Thread { - ShutdownHook() { - super("rmid ShutdownHook"); - } - - public void run() { - synchronized (Activation.this) { - shuttingDown = true; - } - - // destroy all child processes (groups) quickly - for (GroupEntry groupEntry : groupTable.values()) { - groupEntry.shutdownFast(); - } - } - } - - /** - * Returns the groupID for a given id of an object in the group. - * Throws UnknownObjectException if the object is not registered. - */ - private ActivationGroupID getGroupID(ActivationID id) - throws UnknownObjectException - { - ActivationGroupID groupID = idTable.get(id); - if (groupID != null) { - return groupID; - } - throw new UnknownObjectException("unknown object: " + id); - } - - /** - * Returns the group entry for the group id, optionally removing it. - * Throws UnknownGroupException if the group is not registered. - */ - private GroupEntry getGroupEntry(ActivationGroupID id, boolean rm) - throws UnknownGroupException - { - if (id.getClass() == ActivationGroupID.class) { - GroupEntry entry; - if (rm) { - entry = groupTable.remove(id); - } else { - entry = groupTable.get(id); - } - if (entry != null && !entry.removed) { - return entry; - } - } - throw new UnknownGroupException("group unknown"); - } - - /** - * Returns the group entry for the group id. Throws - * UnknownGroupException if the group is not registered. - */ - private GroupEntry getGroupEntry(ActivationGroupID id) - throws UnknownGroupException - { - return getGroupEntry(id, false); - } - - /** - * Removes and returns the group entry for the group id. Throws - * UnknownGroupException if the group is not registered. - */ - private GroupEntry removeGroupEntry(ActivationGroupID id) - throws UnknownGroupException - { - return getGroupEntry(id, true); - } - - /** - * Returns the group entry for the object's id. Throws - * UnknownObjectException if the object is not registered or the - * object's group is not registered. - */ - private GroupEntry getGroupEntry(ActivationID id) - throws UnknownObjectException - { - ActivationGroupID gid = getGroupID(id); - GroupEntry entry = groupTable.get(gid); - if (entry != null && !entry.removed) { - return entry; - } - throw new UnknownObjectException("object's group removed"); - } - - /** - * Container for group information: group's descriptor, group's - * instantiator, flag to indicate pending group creation, and - * table of the objects that are activated in the group. - * - * WARNING: GroupEntry objects should not be written into log file - * updates. GroupEntrys are inner classes of Activation and they - * can not be serialized independent of this class. If the - * complete Activation system is written out as a log update, the - * point of having updates is nullified. - */ - private class GroupEntry implements Serializable { - - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 7222464070032993304L; - private static final int MAX_TRIES = 2; - private static final int NORMAL = 0; - private static final int CREATING = 1; - private static final int TERMINATE = 2; - private static final int TERMINATING = 3; - - ActivationGroupDesc desc = null; - ActivationGroupID groupID = null; - long incarnation = 0; - @SuppressWarnings("serial") // Conditionally serializable - Map objects = new HashMap<>(); - @SuppressWarnings("serial") // Conditionally serializable - Set restartSet = new HashSet<>(); - - transient ActivationInstantiator group = null; - transient int status = NORMAL; - transient long waitTime = 0; - transient String groupName = null; - transient Process child = null; - transient boolean removed = false; - transient Watchdog watchdog = null; - - GroupEntry(ActivationGroupID groupID, ActivationGroupDesc desc) { - this.groupID = groupID; - this.desc = desc; - } - - void restartServices() { - Iterator iter = null; - - synchronized (this) { - if (restartSet.isEmpty()) { - return; - } - - /* - * Clone the restartSet so the set does not have to be locked - * during iteration. Locking the restartSet could cause - * deadlock if an object we are restarting caused another - * object in this group to be activated. - */ - iter = (new HashSet(restartSet)).iterator(); - } - - while (iter.hasNext()) { - ActivationID id = iter.next(); - try { - activate(id, true); - } catch (Exception e) { - if (shuttingDown) { - return; - } - System.err.println( - getTextResource("rmid.restart.service.warning")); - e.printStackTrace(); - } - } - } - - synchronized void activeGroup(ActivationInstantiator inst, - long instIncarnation) - throws ActivationException, UnknownGroupException - { - if (incarnation != instIncarnation) { - throw new ActivationException("invalid incarnation"); - } - - if (group != null) { - if (group.equals(inst)) { - return; - } else { - throw new ActivationException("group already active"); - } - } - - if (child != null && status != CREATING) { - throw new ActivationException("group not being created"); - } - - group = inst; - status = NORMAL; - notifyAll(); - } - - private void checkRemoved() throws UnknownGroupException { - if (removed) { - throw new UnknownGroupException("group removed"); - } - } - - private ObjectEntry getObjectEntry(ActivationID id) - throws UnknownObjectException - { - if (removed) { - throw new UnknownObjectException("object's group removed"); - } - ObjectEntry objEntry = objects.get(id); - if (objEntry == null) { - throw new UnknownObjectException("object unknown"); - } - return objEntry; - } - - synchronized void registerObject(ActivationID id, - ActivationDesc desc, - boolean addRecord) - throws UnknownGroupException, ActivationException - { - checkRemoved(); - objects.put(id, new ObjectEntry(desc)); - if (desc.getRestartMode() == true) { - restartSet.add(id); - } - - // table insertion must take place before log update - idTable.put(id, groupID); - - if (addRecord) { - addLogRecord(new LogRegisterObject(id, desc)); - } - } - - synchronized void unregisterObject(ActivationID id, boolean addRecord) - throws UnknownGroupException, ActivationException - { - ObjectEntry objEntry = getObjectEntry(id); - objEntry.removed = true; - objects.remove(id); - if (objEntry.desc.getRestartMode() == true) { - restartSet.remove(id); - } - - // table removal must take place before log update - idTable.remove(id); - if (addRecord) { - addLogRecord(new LogUnregisterObject(id)); - } - } - - synchronized void unregisterGroup(boolean addRecord) - throws UnknownGroupException, ActivationException - { - checkRemoved(); - removed = true; - for (Map.Entry entry : - objects.entrySet()) - { - ActivationID id = entry.getKey(); - idTable.remove(id); - ObjectEntry objEntry = entry.getValue(); - objEntry.removed = true; - } - objects.clear(); - restartSet.clear(); - reset(); - childGone(); - - // removal should be recorded before log update - if (addRecord) { - addLogRecord(new LogUnregisterGroup(groupID)); - } - } - - synchronized ActivationDesc setActivationDesc(ActivationID id, - ActivationDesc desc, - boolean addRecord) - throws UnknownObjectException, UnknownGroupException, - ActivationException - { - ObjectEntry objEntry = getObjectEntry(id); - ActivationDesc oldDesc = objEntry.desc; - objEntry.desc = desc; - if (desc.getRestartMode() == true) { - restartSet.add(id); - } else { - restartSet.remove(id); - } - // restart information should be recorded before log update - if (addRecord) { - addLogRecord(new LogUpdateDesc(id, desc)); - } - - return oldDesc; - } - - synchronized ActivationDesc getActivationDesc(ActivationID id) - throws UnknownObjectException, UnknownGroupException - { - return getObjectEntry(id).desc; - } - - synchronized ActivationGroupDesc setActivationGroupDesc( - ActivationGroupID id, - ActivationGroupDesc desc, - boolean addRecord) - throws UnknownGroupException, ActivationException - { - checkRemoved(); - ActivationGroupDesc oldDesc = this.desc; - this.desc = desc; - // state update should occur before log update - if (addRecord) { - addLogRecord(new LogUpdateGroupDesc(id, desc)); - } - return oldDesc; - } - - synchronized void inactiveGroup(long incarnation, boolean failure) - throws UnknownGroupException - { - checkRemoved(); - if (this.incarnation != incarnation) { - throw new UnknownGroupException("invalid incarnation"); - } - - reset(); - if (failure) { - terminate(); - } else if (child != null && status == NORMAL) { - status = TERMINATE; - watchdog.noRestart(); - } - } - - synchronized void activeObject(ActivationID id, - MarshalledObject mobj) - throws UnknownObjectException - { - getObjectEntry(id).stub = mobj; - } - - synchronized void inactiveObject(ActivationID id) - throws UnknownObjectException - { - getObjectEntry(id).reset(); - } - - private synchronized void reset() { - group = null; - for (ObjectEntry objectEntry : objects.values()) { - objectEntry.reset(); - } - } - - private void childGone() { - if (child != null) { - child = null; - watchdog.dispose(); - watchdog = null; - status = NORMAL; - notifyAll(); - } - } - - private void terminate() { - if (child != null && status != TERMINATING) { - child.destroy(); - status = TERMINATING; - waitTime = System.currentTimeMillis() + groupTimeout; - notifyAll(); - } - } - - /* - * Fallthrough from TERMINATE to TERMINATING - * is intentional - */ - @SuppressWarnings("fallthrough") - private void await() { - while (true) { - switch (status) { - case NORMAL: - return; - case TERMINATE: - terminate(); - case TERMINATING: - try { - child.exitValue(); - } catch (IllegalThreadStateException e) { - long now = System.currentTimeMillis(); - if (waitTime > now) { - try { - wait(waitTime - now); - } catch (InterruptedException ee) { - } - continue; - } - // REMIND: print message that group did not terminate? - } - childGone(); - return; - case CREATING: - try { - wait(); - } catch (InterruptedException e) { - } - } - } - } - - // no synchronization to avoid delay wrt getInstantiator - void shutdownFast() { - Process p = child; - if (p != null) { - p.destroy(); - } - } - - synchronized void shutdown() { - reset(); - terminate(); - await(); - } - - MarshalledObject activate(ActivationID id, - boolean force) - throws ActivationException - { - Exception detail = null; - - /* - * Attempt to activate object and reattempt (several times) - * if activation fails due to communication problems. - */ - for (int tries = MAX_TRIES; tries > 0; tries--) { - ActivationInstantiator inst; - long currentIncarnation; - - // look up object to activate - ObjectEntry objEntry; - synchronized (this) { - objEntry = getObjectEntry(id); - // if not forcing activation, return cached stub - if (!force && objEntry.stub != null) { - return objEntry.stub; - } - inst = getInstantiator(groupID); - currentIncarnation = incarnation; - } - - boolean groupInactive = false; - boolean failure = false; - // activate object - try { - return objEntry.activate(id, force, inst); - } catch (NoSuchObjectException e) { - groupInactive = true; - detail = e; - } catch (ConnectException e) { - groupInactive = true; - failure = true; - detail = e; - } catch (ConnectIOException e) { - groupInactive = true; - failure = true; - detail = e; - } catch (InactiveGroupException e) { - groupInactive = true; - detail = e; - } catch (RemoteException e) { - // REMIND: wait some here before continuing? - if (detail == null) { - detail = e; - } - } - - if (groupInactive) { - // group has failed or is inactive; mark inactive - try { - System.err.println( - MessageFormat.format( - getTextResource("rmid.group.inactive"), - detail.toString())); - detail.printStackTrace(); - getGroupEntry(groupID). - inactiveGroup(currentIncarnation, failure); - } catch (UnknownGroupException e) { - // not a problem - } - } - } - - /** - * signal that group activation failed, nested exception - * specifies what exception occurred when the group did not - * activate - */ - throw new ActivationException("object activation failed after " + - MAX_TRIES + " tries", detail); - } - - /** - * Returns the instantiator for the group specified by id and - * entry. If the group is currently inactive, exec some - * bootstrap code to create the group. - */ - private ActivationInstantiator getInstantiator(ActivationGroupID id) - throws ActivationException - { - assert Thread.holdsLock(this); - - await(); - if (group != null) { - return group; - } - checkRemoved(); - boolean acquired = false; - - try { - groupName = Pstartgroup(); - acquired = true; - String[] argv = activationArgs(desc); - checkArgs(desc, argv); - - if (debugExec) { - StringBuilder sb = new StringBuilder(argv[0]); - int j; - for (j = 1; j < argv.length; j++) { - sb.append(' '); - sb.append(argv[j]); - } - System.err.println( - MessageFormat.format( - getTextResource("rmid.exec.command"), - sb.toString())); - } - - try { - child = Runtime.getRuntime().exec(argv); - status = CREATING; - ++incarnation; - watchdog = new Watchdog(); - watchdog.start(); - addLogRecord(new LogGroupIncarnation(id, incarnation)); - - // handle child I/O streams before writing to child - PipeWriter.plugTogetherPair - (child.getInputStream(), System.out, - child.getErrorStream(), System.err); - try (MarshalOutputStream out = - new MarshalOutputStream(child.getOutputStream())) { - out.writeObject(id); - out.writeObject(desc); - out.writeLong(incarnation); - out.flush(); - } - - - } catch (IOException e) { - terminate(); - throw new ActivationException( - "unable to create activation group", e); - } - - try { - long now = System.currentTimeMillis(); - long stop = now + execTimeout; - do { - wait(stop - now); - if (group != null) { - return group; - } - now = System.currentTimeMillis(); - } while (status == CREATING && now < stop); - } catch (InterruptedException e) { - } - - terminate(); - throw new ActivationException( - (removed ? - "activation group unregistered" : - "timeout creating child process")); - } finally { - if (acquired) { - Vstartgroup(); - } - } - } - - /** - * Waits for process termination and then restarts services. - */ - private class Watchdog extends Thread { - private final Process groupProcess = child; - private final long groupIncarnation = incarnation; - private boolean canInterrupt = true; - private boolean shouldQuit = false; - private boolean shouldRestart = true; - - Watchdog() { - super("WatchDog-" + groupName + "-" + incarnation); - setDaemon(true); - } - - public void run() { - - if (shouldQuit) { - return; - } - - /* - * Wait for the group to crash or exit. - */ - try { - groupProcess.waitFor(); - } catch (InterruptedException exit) { - return; - } - - boolean restart = false; - synchronized (GroupEntry.this) { - if (shouldQuit) { - return; - } - canInterrupt = false; - interrupted(); // clear interrupt bit - /* - * Since the group crashed, we should - * reset the entry before activating objects - */ - if (groupIncarnation == incarnation) { - restart = shouldRestart && !shuttingDown; - reset(); - childGone(); - } - } - - /* - * Activate those objects that require restarting - * after a crash. - */ - if (restart) { - restartServices(); - } - } - - /** - * Marks this thread as one that is no longer needed. - * If the thread is in a state in which it can be interrupted, - * then the thread is interrupted. - */ - void dispose() { - shouldQuit = true; - if (canInterrupt) { - interrupt(); - } - } - - /** - * Marks this thread as no longer needing to restart objects. - */ - void noRestart() { - shouldRestart = false; - } - } - } - - private String[] activationArgs(ActivationGroupDesc desc) { - ActivationGroupDesc.CommandEnvironment cmdenv; - cmdenv = desc.getCommandEnvironment(); - - // argv is the literal command to exec - List argv = new ArrayList<>(); - - // Command name/path - argv.add((cmdenv != null && cmdenv.getCommandPath() != null) - ? cmdenv.getCommandPath() - : command[0]); - - // Group-specific command options - if (cmdenv != null && cmdenv.getCommandOptions() != null) { - argv.addAll(Arrays.asList(cmdenv.getCommandOptions())); - } - - // Properties become -D parameters - Properties props = desc.getPropertyOverrides(); - if (props != null) { - for (Enumeration p = props.propertyNames(); - p.hasMoreElements();) - { - String name = (String) p.nextElement(); - /* Note on quoting: it would be wrong - * here, since argv will be passed to - * Runtime.exec, which should not parse - * arguments or split on whitespace. - */ - argv.add("-D" + name + "=" + props.getProperty(name)); - } - } - - /* Finally, rmid-global command options (e.g. -C options) - * and the classname - */ - for (int i = 1; i < command.length; i++) { - argv.add(command[i]); - } - - String[] realArgv = new String[argv.size()]; - System.arraycopy(argv.toArray(), 0, realArgv, 0, realArgv.length); - - return realArgv; - } - - private void checkArgs(ActivationGroupDesc desc, String[] cmd) - throws SecurityException, ActivationException - { - /* - * Check exec command using execPolicy object - */ - if (execPolicyMethod != null) { - if (cmd == null) { - cmd = activationArgs(desc); - } - try { - execPolicyMethod.invoke(execPolicy, desc, cmd); - } catch (InvocationTargetException e) { - Throwable targetException = e.getCause(); - if (targetException instanceof SecurityException) { - throw (SecurityException) targetException; - } else { - throw new ActivationException( - execPolicyMethod.getName() + ": unexpected exception", - e); - } - } catch (Exception e) { - throw new ActivationException( - execPolicyMethod.getName() + ": unexpected exception", e); - } - } - } - - private static class ObjectEntry implements Serializable { - - private static final long serialVersionUID = -5500114225321357856L; - - /** descriptor for object */ - ActivationDesc desc; - /** the stub (if active) */ - volatile transient MarshalledObject stub = null; - volatile transient boolean removed = false; - - ObjectEntry(ActivationDesc desc) { - this.desc = desc; - } - - synchronized MarshalledObject - activate(ActivationID id, - boolean force, - ActivationInstantiator inst) - throws RemoteException, ActivationException - { - MarshalledObject nstub = stub; - if (removed) { - throw new UnknownObjectException("object removed"); - } else if (!force && nstub != null) { - return nstub; - } - - nstub = inst.newInstance(id, desc); - stub = nstub; - /* - * stub could be set to null by a group reset, so return - * the newstub here to prevent returning null. - */ - return nstub; - } - - void reset() { - stub = null; - } - } - - /** - * Add a record to the activation log. If the number of updates - * passes a predetermined threshold, record a snapshot. - */ - private void addLogRecord(LogRecord rec) throws ActivationException { - synchronized (log) { - checkShutdown(); - try { - log.update(rec, true); - } catch (Exception e) { - numUpdates = snapshotInterval; - System.err.println(getTextResource("rmid.log.update.warning")); - e.printStackTrace(); - } - if (++numUpdates < snapshotInterval) { - return; - } - try { - log.snapshot(this); - numUpdates = 0; - } catch (Exception e) { - System.err.println( - getTextResource("rmid.log.snapshot.warning")); - e.printStackTrace(); - try { - // shutdown activation system because snapshot failed - system.shutdown(); - } catch (RemoteException ignore) { - // can't happen - } - // warn the client of the original update problem - throw new ActivationException("log snapshot failed", e); - } - } - } - - /** - * Handler for the log that knows how to take the initial snapshot - * and apply an update (a LogRecord) to the current state. - */ - private static class ActLogHandler extends LogHandler { - - ActLogHandler() { - } - - public Object initialSnapshot() - { - /** - * Return an empty Activation object. Log will update - * this object with recovered state. - */ - return new Activation(); - } - - public Object applyUpdate(Object update, Object state) - throws Exception - { - return ((LogRecord) update).apply(state); - } - - } - - /** - * Abstract class for all log records. The subclass contains - * specific update information and implements the apply method - * that applys the update information contained in the record - * to the current state. - */ - private static abstract class LogRecord implements Serializable { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 8395140512322687529L; - abstract Object apply(Object state) throws Exception; - } - - /** - * Log record for registering an object. - */ - private static class LogRegisterObject extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = -6280336276146085143L; - private ActivationID id; - private ActivationDesc desc; - - LogRegisterObject(ActivationID id, ActivationDesc desc) { - this.id = id; - this.desc = desc; - } - - Object apply(Object state) { - try { - ((Activation) state).getGroupEntry(desc.getGroupID()). - registerObject(id, desc, false); - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogRegisterObject")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Log record for unregistering an object. - */ - private static class LogUnregisterObject extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 6269824097396935501L; - private ActivationID id; - - LogUnregisterObject(ActivationID id) { - this.id = id; - } - - Object apply(Object state) { - try { - ((Activation) state).getGroupEntry(id). - unregisterObject(id, false); - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogUnregisterObject")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Log record for registering a group. - */ - private static class LogRegisterGroup extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = -1966827458515403625L; - private ActivationGroupID id; - private ActivationGroupDesc desc; - - LogRegisterGroup(ActivationGroupID id, ActivationGroupDesc desc) { - this.id = id; - this.desc = desc; - } - - Object apply(Object state) { - // modify state directly; cant ask a nonexistent GroupEntry - // to register itself. - ((Activation) state).groupTable.put(id, ((Activation) state).new - GroupEntry(id, desc)); - return state; - } - } - - /** - * Log record for udpating an activation desc - */ - private static class LogUpdateDesc extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 545511539051179885L; - - private ActivationID id; - private ActivationDesc desc; - - LogUpdateDesc(ActivationID id, ActivationDesc desc) { - this.id = id; - this.desc = desc; - } - - Object apply(Object state) { - try { - ((Activation) state).getGroupEntry(id). - setActivationDesc(id, desc, false); - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogUpdateDesc")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Log record for unregistering a group. - */ - private static class LogUpdateGroupDesc extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = -1271300989218424337L; - private ActivationGroupID id; - private ActivationGroupDesc desc; - - LogUpdateGroupDesc(ActivationGroupID id, ActivationGroupDesc desc) { - this.id = id; - this.desc = desc; - } - - Object apply(Object state) { - try { - ((Activation) state).getGroupEntry(id). - setActivationGroupDesc(id, desc, false); - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogUpdateGroupDesc")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Log record for unregistering a group. - */ - private static class LogUnregisterGroup extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = -3356306586522147344L; - private ActivationGroupID id; - - LogUnregisterGroup(ActivationGroupID id) { - this.id = id; - } - - Object apply(Object state) { - GroupEntry entry = ((Activation) state).groupTable.remove(id); - try { - entry.unregisterGroup(false); - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogUnregisterGroup")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Log record for an active group incarnation - */ - private static class LogGroupIncarnation extends LogRecord { - /** indicate compatibility with JDK 1.2 version of class */ - private static final long serialVersionUID = 4146872747377631897L; - private ActivationGroupID id; - private long inc; - - LogGroupIncarnation(ActivationGroupID id, long inc) { - this.id = id; - this.inc = inc; - } - - Object apply(Object state) { - try { - GroupEntry entry = ((Activation) state).getGroupEntry(id); - entry.incarnation = inc; - } catch (Exception ignore) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.log.recover.warning"), - "LogGroupIncarnation")); - ignore.printStackTrace(); - } - return state; - } - } - - /** - * Initialize command to exec a default group. - */ - private void initCommand(String[] childArgs) { - command = new String[childArgs.length + 2]; - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - try { - command[0] = System.getProperty("java.home") + - File.separator + "bin" + File.separator + "java"; - } catch (Exception e) { - System.err.println( - getTextResource("rmid.unfound.java.home.property")); - command[0] = "java"; - } - return null; - } - }); - System.arraycopy(childArgs, 0, command, 1, childArgs.length); - command[command.length-1] = "sun.rmi.server.ActivationGroupInit"; - } - - private static void bomb(String error) { - System.err.println("rmid: " + error); // $NON-NLS$ - System.err.println(MessageFormat.format(getTextResource("rmid.usage"), - "rmid")); - System.exit(1); - } - - /** - * The default policy for checking a command before it is executed - * makes sure the appropriate com.sun.rmi.rmid.ExecPermission and - * set of com.sun.rmi.rmid.ExecOptionPermissions have been granted. - */ - public static class DefaultExecPolicy { - - public void checkExecCommand(ActivationGroupDesc desc, String[] cmd) - throws SecurityException - { - PermissionCollection perms = getExecPermissions(); - - /* - * Check properties overrides. - */ - Properties props = desc.getPropertyOverrides(); - if (props != null) { - Enumeration p = props.propertyNames(); - while (p.hasMoreElements()) { - String name = (String) p.nextElement(); - String value = props.getProperty(name); - String option = "-D" + name + "=" + value; - try { - checkPermission(perms, - new ExecOptionPermission(option)); - } catch (AccessControlException e) { - if (value.isEmpty()) { - checkPermission(perms, - new ExecOptionPermission("-D" + name)); - } else { - throw e; - } - } - } - } - - /* - * Check group class name (allow nothing but the default), - * code location (must be null), and data (must be null). - */ - String groupClassName = desc.getClassName(); - if ((groupClassName != null && - !groupClassName.equals( - ActivationGroupImpl.class.getName())) || - (desc.getLocation() != null) || - (desc.getData() != null)) - { - throw new AccessControlException( - "access denied (custom group implementation not allowed)"); - } - - /* - * If group descriptor has a command environment, check - * command and options. - */ - ActivationGroupDesc.CommandEnvironment cmdenv; - cmdenv = desc.getCommandEnvironment(); - if (cmdenv != null) { - String path = cmdenv.getCommandPath(); - if (path != null) { - checkPermission(perms, new ExecPermission(path)); - } - - String[] options = cmdenv.getCommandOptions(); - if (options != null) { - for (String option : options) { - checkPermission(perms, - new ExecOptionPermission(option)); - } - } - } - } - - /** - * Prints warning message if installed Policy is the default Policy - * implementation and globally granted permissions do not include - * AllPermission or any ExecPermissions/ExecOptionPermissions. - */ - static void checkConfiguration() { - Policy policy = - AccessController.doPrivileged(new PrivilegedAction() { - public Policy run() { - return Policy.getPolicy(); - } - }); - if (!(policy instanceof PolicyFile)) { - return; - } - PermissionCollection perms = getExecPermissions(); - for (Enumeration e = perms.elements(); - e.hasMoreElements();) - { - Permission p = e.nextElement(); - if (p instanceof AllPermission || - p instanceof ExecPermission || - p instanceof ExecOptionPermission) - { - return; - } - } - System.err.println(getTextResource("rmid.exec.perms.inadequate")); - } - - private static PermissionCollection getExecPermissions() { - /* - * The approach used here is taken from the similar method - * getLoaderAccessControlContext() in the class - * sun.rmi.server.LoaderHandler. - */ - - // obtain permissions granted to all code in current policy - PermissionCollection perms = AccessController.doPrivileged( - new PrivilegedAction() { - public PermissionCollection run() { - CodeSource codesource = - new CodeSource(null, (Certificate[]) null); - Policy p = Policy.getPolicy(); - if (p != null) { - return p.getPermissions(codesource); - } else { - return new Permissions(); - } - } - }); - - return perms; - } - - private static void checkPermission(PermissionCollection perms, - Permission p) - throws AccessControlException - { - if (!perms.implies(p)) { - throw new AccessControlException( - "access denied " + p.toString()); - } - } - } - - /** - * Main program to start the activation system.
- * The usage is as follows: rmid [-port num] [-log dir]. - */ - public static void main(String[] args) { - boolean stop = false; - - // Create and install the security manager if one is not installed - // already. - if (System.getSecurityManager() == null) { - System.setSecurityManager(new SecurityManager()); - } - - try { - int port = ActivationSystem.SYSTEM_PORT; - RMIServerSocketFactory ssf = null; - - /* - * If rmid has an inherited channel (meaning that it was - * launched from inetd), set the server socket factory to - * return the inherited server socket. - **/ - Channel inheritedChannel = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Channel run() throws IOException { - return System.inheritedChannel(); - } - }); - - if (inheritedChannel != null && - inheritedChannel instanceof ServerSocketChannel) - { - /* - * Redirect System.err output to a file. - */ - AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Void run() throws IOException { - boolean disable = Boolean.getBoolean( - "sun.rmi.server.activation.disableErrRedirect"); - if (disable) - return null; - - File file = - Files.createTempFile("rmid-err", null).toFile(); - PrintStream errStream = - new PrintStream(new FileOutputStream(file)); - System.setErr(errStream); - return null; - } - }); - - ServerSocket serverSocket = - ((ServerSocketChannel) inheritedChannel).socket(); - port = serverSocket.getLocalPort(); - ssf = new ActivationServerSocketFactory(serverSocket); - - System.err.println(new Date()); - System.err.println(getTextResource( - "rmid.inherited.channel.info") + - ": " + inheritedChannel); - } - - String log = null; - List childArgs = new ArrayList<>(); - - /* - * Parse arguments - */ - for (int i = 0; i < args.length; i++) { - if (args[i].equals("-port")) { - if (ssf != null) { - bomb(getTextResource("rmid.syntax.port.badarg")); - } - if ((i + 1) < args.length) { - try { - port = Integer.parseInt(args[++i]); - } catch (NumberFormatException nfe) { - bomb(getTextResource("rmid.syntax.port.badnumber")); - } - } else { - bomb(getTextResource("rmid.syntax.port.missing")); - } - - } else if (args[i].equals("-log")) { - if ((i + 1) < args.length) { - log = args[++i]; - } else { - bomb(getTextResource("rmid.syntax.log.missing")); - } - - } else if (args[i].equals("-stop")) { - stop = true; - - } else if (args[i].startsWith("-C")) { - childArgs.add(args[i].substring(2)); - - } else { - bomb(MessageFormat.format( - getTextResource("rmid.syntax.illegal.option"), - args[i])); - } - } - - if (log == null) { - if (ssf != null) { - bomb(getTextResource("rmid.syntax.log.required")); - } else { - log = "log"; - } - } - - debugExec = AccessController.doPrivileged( - (PrivilegedAction) () -> Boolean.getBoolean("sun.rmi.server.activation.debugExec")); - - /** - * Determine class name for activation exec policy (if any). - */ - String execPolicyClassName = AccessController.doPrivileged( - (PrivilegedAction) () -> System.getProperty("sun.rmi.activation.execPolicy")); - if (execPolicyClassName == null) { - if (!stop) { - DefaultExecPolicy.checkConfiguration(); - } - execPolicyClassName = "default"; - } - - /** - * Initialize method for activation exec policy. - */ - if (!execPolicyClassName.equals("none")) { - if (execPolicyClassName.isEmpty() || - execPolicyClassName.equals("default")) - { - execPolicyClassName = DefaultExecPolicy.class.getName(); - } - - try { - Class execPolicyClass = getRMIClass(execPolicyClassName); - @SuppressWarnings("deprecation") - Object tmp = execPolicyClass.newInstance(); - execPolicy = tmp; - execPolicyMethod = - execPolicyClass.getMethod("checkExecCommand", - ActivationGroupDesc.class, - String[].class); - } catch (Exception e) { - if (debugExec) { - System.err.println( - getTextResource("rmid.exec.policy.exception")); - e.printStackTrace(); - } - bomb(getTextResource("rmid.exec.policy.invalid")); - } - } - - if (stop == true) { - final int finalPort = port; - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - System.setProperty("java.rmi.activation.port", - Integer.toString(finalPort)); - return null; - } - }); - ActivationSystem system = ActivationGroup.getSystem(); - system.shutdown(); - System.exit(0); - } - - System.err.println(getTextResource("rmid.deprecation.warning")); - - /* - * Fix for 4173960: Create and initialize activation using - * a static method, startActivation, which will build the - * Activation state in two ways: if when rmid is run, no - * log file is found, the ActLogHandler.recover(...) - * method will create a new Activation instance. - * Alternatively, if a logfile is available, a serialized - * instance of activation will be read from the log's - * snapshot file. Log updates will be applied to this - * Activation object until rmid's state has been fully - * recovered. In either case, only one instance of - * Activation is created. - */ - startActivation(port, ssf, log, - childArgs.toArray(new String[childArgs.size()])); - - // prevent activator from exiting - while (true) { - try { - Thread.sleep(Long.MAX_VALUE); - } catch (InterruptedException e) { - } - } - } catch (Exception e) { - System.err.println( - MessageFormat.format( - getTextResource("rmid.unexpected.exception"), e)); - e.printStackTrace(); - } - System.exit(1); - } - - /** - * Retrieves text resources from the locale-specific properties file. - */ - private static String getTextResource(String key) { - if (Activation.resources == null) { - try { - Activation.resources = ResourceBundle.getBundle( - "sun.rmi.server.resources.rmid"); - } catch (MissingResourceException mre) { - } - if (Activation.resources == null) { - // throwing an Error is a bit extreme, methinks - return ("[missing resource file: " + key + "]"); - } - } - - String val = null; - try { - val = Activation.resources.getString (key); - } catch (MissingResourceException mre) { - } - - if (val == null) { - return ("[missing resource: " + key + "]"); - } else { - return val; - } - } - - @SuppressWarnings("deprecation") - private static Class getRMIClass(String execPolicyClassName) throws Exception { - return RMIClassLoader.loadClass(execPolicyClassName); - } - /* - * Dijkstra semaphore operations to limit the number of subprocesses - * rmid attempts to make at once. - */ - /** - * Acquire the group semaphore and return a group name. Each - * Pstartgroup must be followed by a Vstartgroup. The calling thread - * will wait until there are fewer than N other threads - * holding the group semaphore. The calling thread will then acquire - * the semaphore and return. - */ - private synchronized String Pstartgroup() throws ActivationException { - while (true) { - checkShutdown(); - // Wait until positive, then decrement. - if (groupSemaphore > 0) { - groupSemaphore--; - return "Group-" + groupCounter++; - } - - try { - wait(); - } catch (InterruptedException e) { - } - } - } - - /** - * Release the group semaphore. Every P operation must be - * followed by a V operation. This may cause another thread to - * wake up and return from its P operation. - */ - private synchronized void Vstartgroup() { - // Increment and notify a waiter (not necessarily FIFO). - groupSemaphore++; - notifyAll(); - } - - /** - * A server socket factory to use when rmid is launched via 'inetd' - * with 'wait' status. This socket factory's 'createServerSocket' - * method returns the server socket specified during construction that - * is specialized to delay accepting requests until the - * 'initDone' flag is 'true'. The server socket supplied to - * the constructor should be the server socket obtained from the - * ServerSocketChannel returned from the 'System.inheritedChannel' - * method. - **/ - private static class ActivationServerSocketFactory - implements RMIServerSocketFactory - { - private final ServerSocket serverSocket; - - /** - * Constructs an 'ActivationServerSocketFactory' with the specified - * 'serverSocket'. - **/ - ActivationServerSocketFactory(ServerSocket serverSocket) { - this.serverSocket = serverSocket; - } - - /** - * Returns the server socket specified during construction wrapped - * in a 'DelayedAcceptServerSocket'. - **/ - public ServerSocket createServerSocket(int port) - throws IOException - { - return new DelayedAcceptServerSocket(serverSocket); - } - - } - - /** - * A server socket that delegates all public methods to the underlying - * server socket specified at construction. The accept method is - * overridden to delay calling accept on the underlying server socket - * until the 'initDone' flag is 'true'. - **/ - private static class DelayedAcceptServerSocket extends ServerSocket { - - private final ServerSocket serverSocket; - - DelayedAcceptServerSocket(ServerSocket serverSocket) - throws IOException - { - this.serverSocket = serverSocket; - } - - public void bind(SocketAddress endpoint) throws IOException { - serverSocket.bind(endpoint); - } - - public void bind(SocketAddress endpoint, int backlog) - throws IOException - { - serverSocket.bind(endpoint, backlog); - } - - public InetAddress getInetAddress() { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public InetAddress run() { - return serverSocket.getInetAddress(); - } - }); - } - - public int getLocalPort() { - return serverSocket.getLocalPort(); - } - - public SocketAddress getLocalSocketAddress() { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public SocketAddress run() { - return serverSocket.getLocalSocketAddress(); - } - }); - } - - /** - * Delays calling accept on the underlying server socket until the - * remote service is bound in the registry. - **/ - public Socket accept() throws IOException { - synchronized (initLock) { - try { - while (!initDone) { - initLock.wait(); - } - } catch (InterruptedException ignore) { - throw new AssertionError(ignore); - } - } - return serverSocket.accept(); - } - - public void close() throws IOException { - serverSocket.close(); - } - - public ServerSocketChannel getChannel() { - return serverSocket.getChannel(); - } - - public boolean isBound() { - return serverSocket.isBound(); - } - - public boolean isClosed() { - return serverSocket.isClosed(); - } - - public void setSoTimeout(int timeout) - throws SocketException - { - serverSocket.setSoTimeout(timeout); - } - - public int getSoTimeout() throws IOException { - return serverSocket.getSoTimeout(); - } - - public void setReuseAddress(boolean on) throws SocketException { - serverSocket.setReuseAddress(on); - } - - public boolean getReuseAddress() throws SocketException { - return serverSocket.getReuseAddress(); - } - - public String toString() { - return serverSocket.toString(); - } - - public void setReceiveBufferSize(int size) - throws SocketException - { - serverSocket.setReceiveBufferSize(size); - } - - public int getReceiveBufferSize() - throws SocketException - { - return serverSocket.getReceiveBufferSize(); - } - } -} - -/** - * PipeWriter plugs together two pairs of input and output streams by - * providing readers for input streams and writing through to - * appropriate output streams. Both output streams are annotated on a - * per-line basis. - * - * @author Laird Dornin, much code borrowed from Peter Jones, Ken - * Arnold and Ann Wollrath. - */ -class PipeWriter implements Runnable { - - /** stream used for buffering lines */ - private ByteArrayOutputStream bufOut; - - /** count since last separator */ - private int cLast; - - /** current chunk of input being compared to lineSeparator.*/ - private byte[] currSep; - - private PrintWriter out; - private InputStream in; - - private String pipeString; - private String execString; - - private static String lineSeparator; - private static int lineSeparatorLength; - - private static int numExecs = 0; - - static { - lineSeparator = AccessController.doPrivileged( - (PrivilegedAction) () -> System.getProperty("line.separator")); - lineSeparatorLength = lineSeparator.length(); - } - - /** - * Create a new PipeWriter object. All methods of PipeWriter, - * except plugTogetherPair, are only accesible to PipeWriter - * itself. Synchronization is unnecessary on functions that will - * only be used internally in PipeWriter. - * - * @param in input stream from which pipe input flows - * @param out output stream to which log messages will be sent - * @param dest String which tags output stream as 'out' or 'err' - * @param nExecs number of execed processes, Activation groups. - */ - private PipeWriter - (InputStream in, OutputStream out, String tag, int nExecs) { - - this.in = in; - this.out = new PrintWriter(out); - - bufOut = new ByteArrayOutputStream(); - currSep = new byte[lineSeparatorLength]; - - /* set unique pipe/pair annotations */ - execString = ":ExecGroup-" + - Integer.toString(nExecs) + ':' + tag + ':'; - } - - /** - * Create a thread to listen and read from input stream, in. buffer - * the data that is read until a marker which equals lineSeparator - * is read. Once such a string has been discovered; write out an - * annotation string followed by the buffered data and a line - * separator. - */ - public void run() { - byte[] buf = new byte[256]; - int count; - - try { - /* read bytes till there are no more. */ - while ((count = in.read(buf)) != -1) { - write(buf, 0, count); - } - - /* flush internal buffer... may not have ended on a line - * separator, we also need a last annotation if - * something was left. - */ - String lastInBuffer = bufOut.toString(); - bufOut.reset(); - if (lastInBuffer.length() > 0) { - out.println (createAnnotation() + lastInBuffer); - out.flush(); // add a line separator - // to make output nicer - } - - } catch (IOException e) { - } - } - - /** - * Write a subarray of bytes. Pass each through write byte method. - */ - private void write(byte b[], int off, int len) throws IOException { - - if (len < 0) { - throw new ArrayIndexOutOfBoundsException(len); - } - for (int i = 0; i < len; ++ i) { - write(b[off + i]); - } - } - - /** - * Write a byte of data to the stream. If we have not matched a - * line separator string, then the byte is appended to the internal - * buffer. If we have matched a line separator, then the currently - * buffered line is sent to the output writer with a prepended - * annotation string. - */ - private void write(byte b) throws IOException { - int i = 0; - - /* shift current to the left */ - for (i = 1 ; i < (currSep.length); i ++) { - currSep[i-1] = currSep[i]; - } - currSep[i-1] = b; - bufOut.write(b); - - /* enough characters for a separator? */ - if ( (cLast >= (lineSeparatorLength - 1)) && - (lineSeparator.equals(new String(currSep))) ) { - - cLast = 0; - - /* write prefix through to underlying byte stream */ - out.print(createAnnotation() + bufOut.toString()); - out.flush(); - bufOut.reset(); - - if (out.checkError()) { - throw new IOException - ("PipeWriter: IO Exception when"+ - " writing to output stream."); - } - - } else { - cLast++; - } - } - - /** - * Create an annotation string to be printed out after - * a new line and end of stream. - */ - private String createAnnotation() { - - /* construct prefix for log messages: - * date/time stamp... - */ - return ((new Date()).toString() + - /* ... print pair # ... */ - (execString)); - } - - /** - * Allow plugging together two pipes at a time, to associate - * output from an execed process. This is the only publicly - * accessible method of this object; this helps ensure that - * synchronization will not be an issue in the annotation - * process. - * - * @param in input stream from which pipe input comes - * @param out output stream to which log messages will be sent - * @param in1 input stream from which pipe input comes - * @param out1 output stream to which log messages will be sent - */ - static void plugTogetherPair(InputStream in, - OutputStream out, - InputStream in1, - OutputStream out1) { - Thread inThread = null; - Thread outThread = null; - - int nExecs = getNumExec(); - - /* start RMI threads to read output from child process */ - inThread = AccessController.doPrivileged( - new NewThreadAction(new PipeWriter(in, out, "out", nExecs), - "out", true)); - outThread = AccessController.doPrivileged( - new NewThreadAction(new PipeWriter(in1, out1, "err", nExecs), - "err", true)); - inThread.start(); - outThread.start(); - } - - private static synchronized int getNumExec() { - return numExecs++; - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java b/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java deleted file mode 100644 index f1d950e3887..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.net.ServerSocket; -import java.rmi.MarshalledObject; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.Activatable; -import java.rmi.activation.ActivationDesc; -import java.rmi.activation.ActivationException; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationID; -import java.rmi.activation.UnknownObjectException; -import java.rmi.server.RMIClassLoader; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.RMISocketFactory; -import java.rmi.server.UnicastRemoteObject; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; -import sun.rmi.registry.RegistryImpl; - -/** - * The default activation group implementation. - * - * @author Ann Wollrath - * @since 1.2 - * @see java.rmi.activation.ActivationGroup - */ -@SuppressWarnings("removal") -public class ActivationGroupImpl extends ActivationGroup { - - // use serialVersionUID from JDK 1.2.2 for interoperability - private static final long serialVersionUID = 5758693559430427303L; - - /** maps persistent IDs to activated remote objects */ - private final Hashtable active = - new Hashtable<>(); - private boolean groupInactive = false; - private final ActivationGroupID groupID; - @SuppressWarnings("serial") // Conditionally serializable - private final List lockedIDs = new ArrayList<>(); - - /** - * Creates a default activation group implementation. - * - * @param id the group's identifier - * @param data ignored - */ - public ActivationGroupImpl(ActivationGroupID id, MarshalledObject data) - throws RemoteException - { - super(id); - groupID = id; - - /* - * Unexport activation group impl and attempt to export it on - * an unshared anonymous port. See 4692286. - */ - unexportObject(this, true); - RMIServerSocketFactory ssf = new ServerSocketFactoryImpl(); - UnicastRemoteObject.exportObject(this, 0, null, ssf); - - if (System.getSecurityManager() == null) { - try { - // Provide a default security manager. - System.setSecurityManager(new SecurityManager()); - - } catch (Exception e) { - throw new RemoteException("unable to set security manager", e); - } - } - } - - /** - * Trivial server socket factory used to export the activation group - * impl on an unshared port. - */ - private static class ServerSocketFactoryImpl - implements RMIServerSocketFactory - { - public ServerSocket createServerSocket(int port) throws IOException - { - RMISocketFactory sf = RMISocketFactory.getSocketFactory(); - if (sf == null) { - sf = RMISocketFactory.getDefaultSocketFactory(); - } - return sf.createServerSocket(port); - } - } - - /* - * Obtains a lock on the ActivationID id before returning. Allows only one - * thread at a time to hold a lock on a particular id. If the lock for id - * is in use, all requests for an equivalent (in the Object.equals sense) - * id will wait for the id to be notified and use the supplied id as the - * next lock. The caller of "acquireLock" must execute the "releaseLock" - * method" to release the lock and "notifyAll" waiters for the id lock - * obtained from this method. The typical usage pattern is as follows: - * - * try { - * acquireLock(id); - * // do stuff pertaining to id... - * } finally { - * releaseLock(id); - * checkInactiveGroup(); - * } - */ - private void acquireLock(ActivationID id) { - - ActivationID waitForID; - - for (;;) { - - synchronized (lockedIDs) { - int index = lockedIDs.indexOf(id); - if (index < 0) { - lockedIDs.add(id); - return; - } else { - waitForID = lockedIDs.get(index); - } - } - - synchronized (waitForID) { - synchronized (lockedIDs) { - int index = lockedIDs.indexOf(waitForID); - if (index < 0) continue; - ActivationID actualID = lockedIDs.get(index); - if (actualID != waitForID) - /* - * don't wait on an id that won't be notified. - */ - continue; - } - - try { - waitForID.wait(); - } catch (InterruptedException ignore) { - } - } - } - - } - - /* - * Releases the id lock obtained via the "acquireLock" method and then - * notifies all threads waiting on the lock. - */ - private void releaseLock(ActivationID id) { - synchronized (lockedIDs) { - id = lockedIDs.remove(lockedIDs.indexOf(id)); - } - - synchronized (id) { - id.notifyAll(); - } - } - - /** - * Creates a new instance of an activatable remote object. The - * Activator calls this method to create an activatable - * object in this group. This method should be idempotent; a call to - * activate an already active object should return the previously - * activated object. - * - * Note: this method assumes that the Activator will only invoke - * newInstance for the same object in a serial fashion (i.e., - * the activator will not allow the group to see concurrent requests - * to activate the same object. - * - * @param id the object's activation identifier - * @param desc the object's activation descriptor - * @return a marshalled object containing the activated object's stub - */ - public MarshalledObject - newInstance(final ActivationID id, - final ActivationDesc desc) - throws ActivationException, RemoteException - { - RegistryImpl.checkAccess("ActivationInstantiator.newInstance"); - - if (!groupID.equals(desc.getGroupID())) - throw new ActivationException("newInstance in wrong group"); - - try { - acquireLock(id); - synchronized (this) { - if (groupInactive == true) - throw new InactiveGroupException("group is inactive"); - } - - ActiveEntry entry = active.get(id); - if (entry != null) - return entry.mobj; - - String className = desc.getClassName(); - - final Class cl = - RMIClassLoader.loadClass(desc.getLocation(), className) - .asSubclass(Remote.class); - Remote impl = null; - - final Thread t = Thread.currentThread(); - final ClassLoader savedCcl = t.getContextClassLoader(); - ClassLoader objcl = cl.getClassLoader(); - final ClassLoader ccl = covers(objcl, savedCcl) ? objcl : savedCcl; - - /* - * Fix for 4164971: allow non-public activatable class - * and/or constructor, create the activatable object in a - * privileged block - */ - try { - /* - * The code below is in a doPrivileged block to - * protect against user code which code might have set - * a global socket factory (in which case application - * code would be on the stack). - */ - impl = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Remote run() throws InstantiationException, - NoSuchMethodException, IllegalAccessException, - InvocationTargetException - { - Constructor constructor = - cl.getDeclaredConstructor( - ActivationID.class, MarshalledObject.class); - constructor.setAccessible(true); - try { - /* - * Fix for 4289544: make sure to set the - * context class loader to be the class - * loader of the impl class before - * constructing that class. - */ - t.setContextClassLoader(ccl); - return constructor.newInstance(id, - desc.getData()); - } finally { - t.setContextClassLoader(savedCcl); - } - } - }); - } catch (PrivilegedActionException pae) { - Throwable e = pae.getException(); - - // narrow the exception's type and rethrow it - if (e instanceof InstantiationException) { - throw (InstantiationException) e; - } else if (e instanceof NoSuchMethodException) { - throw (NoSuchMethodException) e; - } else if (e instanceof IllegalAccessException) { - throw (IllegalAccessException) e; - } else if (e instanceof InvocationTargetException) { - throw (InvocationTargetException) e; - } else if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } else if (e instanceof Error) { - throw (Error) e; - } - } - - entry = new ActiveEntry(impl); - active.put(id, entry); - return entry.mobj; - - } catch (NoSuchMethodException | NoSuchMethodError e) { - /* user forgot to provide activatable constructor? - * or code recompiled and user forgot to provide - * activatable constructor? - */ - throw new ActivationException - ("Activatable object must provide an activation"+ - " constructor", e ); - - } catch (InvocationTargetException e) { - throw new ActivationException("exception in object constructor", - e.getCause()); - - } catch (Exception e) { - throw new ActivationException("unable to activate object", e); - } finally { - releaseLock(id); - checkInactiveGroup(); - } - } - - - /** - * The group's inactiveObject method is called - * indirectly via a call to the Activatable.inactive - * method. A remote object implementation must call - * Activatable's inactive method when - * that object deactivates (the object deems that it is no longer - * active). If the object does not call - * Activatable.inactive when it deactivates, the - * object will never be garbage collected since the group keeps - * strong references to the objects it creates.

- * - * The group's inactiveObject method - * unexports the remote object from the RMI runtime so that the - * object can no longer receive incoming RMI calls. This call will - * only succeed if the object has no pending/executing calls. If - * the object does have pending/executing RMI calls, then false - * will be returned. - * - * If the object has no pending/executing calls, the object is - * removed from the RMI runtime and the group informs its - * ActivationMonitor (via the monitor's - * inactiveObject method) that the remote object is - * not currently active so that the remote object will be - * re-activated by the activator upon a subsequent activation - * request. - * - * @param id the object's activation identifier - * @return true if the operation succeeds (the operation will - * succeed if the object in currently known to be active and is - * either already unexported or is currently exported and has no - * pending/executing calls); false is returned if the object has - * pending/executing calls in which case it cannot be deactivated - * @exception UnknownObjectException if object is unknown (may already - * be inactive) - * @exception RemoteException if call informing monitor fails - */ - public boolean inactiveObject(ActivationID id) - throws ActivationException, UnknownObjectException, RemoteException - { - - try { - acquireLock(id); - synchronized (this) { - if (groupInactive == true) - throw new ActivationException("group is inactive"); - } - - ActiveEntry entry = active.get(id); - if (entry == null) { - // REMIND: should this be silent? - throw new UnknownObjectException("object not active"); - } - - try { - if (Activatable.unexportObject(entry.impl, false) == false) - return false; - } catch (NoSuchObjectException allowUnexportedObjects) { - } - - try { - super.inactiveObject(id); - } catch (UnknownObjectException allowUnregisteredObjects) { - } - - active.remove(id); - - } finally { - releaseLock(id); - checkInactiveGroup(); - } - - return true; - } - - /* - * Determines if the group has become inactive and - * marks it as such. - */ - private void checkInactiveGroup() { - boolean groupMarkedInactive = false; - synchronized (this) { - if (active.size() == 0 && lockedIDs.size() == 0 && - groupInactive == false) - { - groupInactive = true; - groupMarkedInactive = true; - } - } - - if (groupMarkedInactive) { - try { - super.inactiveGroup(); - } catch (Exception ignoreDeactivateFailure) { - } - - try { - UnicastRemoteObject.unexportObject(this, true); - } catch (NoSuchObjectException allowUnexportedGroup) { - } - } - } - - /** - * The group's activeObject method is called when an - * object is exported (either by Activatable object - * construction or an explicit call to - * Activatable.exportObject. The group must inform its - * ActivationMonitor that the object is active (via - * the monitor's activeObject method) if the group - * hasn't already done so. - * - * @param id the object's identifier - * @param impl the remote object implementation - * @exception UnknownObjectException if object is not registered - * @exception RemoteException if call informing monitor fails - */ - public void activeObject(ActivationID id, Remote impl) - throws ActivationException, UnknownObjectException, RemoteException - { - - try { - acquireLock(id); - synchronized (this) { - if (groupInactive == true) - throw new ActivationException("group is inactive"); - } - if (!active.containsKey(id)) { - ActiveEntry entry = new ActiveEntry(impl); - active.put(id, entry); - // created new entry, so inform monitor of active object - try { - super.activeObject(id, entry.mobj); - } catch (RemoteException e) { - // daemon can still find it by calling newInstance - } - } - } finally { - releaseLock(id); - checkInactiveGroup(); - } - } - - /** - * Entry in table for active object. - */ - private static class ActiveEntry { - Remote impl; - MarshalledObject mobj; - - ActiveEntry(Remote impl) throws ActivationException { - this.impl = impl; - try { - this.mobj = new MarshalledObject(impl); - } catch (IOException e) { - throw new - ActivationException("failed to marshal remote object", e); - } - } - } - - /** - * Returns true if the first argument is either equal to, or is a - * descendant of, the second argument. Null is treated as the root of - * the tree. - */ - private static boolean covers(ClassLoader sub, ClassLoader sup) { - if (sup == null) { - return true; - } else if (sub == null) { - return false; - } - do { - if (sub == sup) { - return true; - } - sub = sub.getParent(); - } while (sub != null); - return false; - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupInit.java b/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupInit.java deleted file mode 100644 index 24257772112..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupInit.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1997, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.rmi.activation.ActivationGroupDesc; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationGroup; - -/** - * This is the bootstrap code to start a VM executing an activation - * group. - * - * The activator spawns (as a child process) an activation group as needed - * and directs activation requests to the appropriate activation - * group. After spawning the VM, the activator passes some - * information to the bootstrap code via its stdin: - *

    - *
  • the activation group's id, - *
  • the activation group's descriptor (an instance of the class - * java.rmi.activation.ActivationGroupDesc) for the group, adn - *
  • the group's incarnation number. - *

- * - * When the bootstrap VM starts executing, it reads group id and - * descriptor from its stdin so that it can create the activation - * group for the VM. - * - * @author Ann Wollrath - */ -@SuppressWarnings("removal") -public abstract class ActivationGroupInit -{ - /** - * Main program to start a VM for an activation group. - */ - public static void main(String args[]) - { - try { - if (System.getSecurityManager() == null) { - System.setSecurityManager(new SecurityManager()); - } - // read group id, descriptor, and incarnation number from stdin - MarshalInputStream in = new MarshalInputStream(System.in); - ActivationGroupID id = (ActivationGroupID)in.readObject(); - ActivationGroupDesc desc = (ActivationGroupDesc)in.readObject(); - long incarnation = in.readLong(); - - // create and set group for the VM - ActivationGroup.createGroup(id, desc, incarnation); - } catch (Exception e) { - System.err.println("Exception in starting ActivationGroupInit:"); - e.printStackTrace(); - } finally { - try { - System.in.close(); - // note: system out/err shouldn't be closed - // since the parent may want to read them. - } catch (Exception ex) { - // ignore exceptions - } - } - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/InactiveGroupException.java b/src/java.rmi/share/classes/sun/rmi/server/InactiveGroupException.java deleted file mode 100644 index 71cd793b92a..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/InactiveGroupException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.rmi.server; - -import java.rmi.activation.ActivationException; - -/** - * Thrown if a local or remote call is made on a group implementation - * instance that is inactive. - * - * @author Sun Microsystems, Inc. - * - * @since 1.6 - */ -@SuppressWarnings("removal") -public class InactiveGroupException extends ActivationException { - - private static final long serialVersionUID = -7491041778450214975L; - - /** - * Constructs an instance with the specified detail message. - * - * @param s the detail message - */ - public InactiveGroupException(String s) { - super(s); - } -} diff --git a/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java b/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java index d04e9292fd5..032ee3c3e3a 100644 --- a/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java +++ b/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java @@ -86,28 +86,13 @@ public class MarshalInputStream extends ObjectInputStream { private boolean useCodebaseOnly = useCodebaseOnlyProperty; /* - * Fix for 4179055: The remote object services inside the - * activation daemon use stubs that are in the package - * sun.rmi.server. Classes for these stubs should be loaded from - * the classpath by RMI system code and not by the normal - * unmarshalling process as applications should not need to have - * permission to access the sun implementation classes. - * - * Note: this fix should be redone when API changes may be - * integrated - * * During parameter unmarshalling RMI needs to explicitly permit - * access to three sun.* stub classes + * access to sun.* stub classes */ static { try { - String system = - "sun.rmi.server.Activation$ActivationSystemImpl_Stub"; String registry = "sun.rmi.registry.RegistryImpl_Stub"; - - permittedSunClasses.put(system, Class.forName(system)); permittedSunClasses.put(registry, Class.forName(registry)); - } catch (ClassNotFoundException e) { throw new NoClassDefFoundError("Missing system class: " + e.getMessage()); diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid.properties deleted file mode 100644 index 54d6fc9a774..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid.properties +++ /dev/null @@ -1,136 +0,0 @@ -# -# -# Copyright (c) 1998, 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. 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=\ - rmid was launched from inetd with an invalid status (must be wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=\ - port cannot be specified if rmid is launched from inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=\ - port is not a number - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=\ - -port option requires argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=\ - -log option requires argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=\ - -log option required - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=\ - invalid option: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=\ - Activation.main: an exception occurred: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=\ - ActivatorImpl: unable to locate java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=\ - rmid startup with inherited channel - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=\ - Activation.main: invalid exec policy class - -# "rmid" should not be translated -rmid.exec.policy.exception=\ - rmid: attempt to obtain exec policy throws: - -# "rmid" should not be translated -rmid.exec.command=\ - rmid: debugExec: running "{0}" - -# "rmid" should not be translated -rmid.group.inactive=\ - rmid: activation group inactive: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=\ - Activation.main: warning: sun.rmi.activation.execPolicy system\n\ - property unspecified and no ExecPermissions/ExecOptionPermissions\n\ - granted; subsequent activation attempts may fail due to unsuccessful\n\ - ExecPermission/ExecOptionPermission permission checks. \n\ - To configure security, refer to the rmid documentation.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Usage: {0} \ -\n\ -\nwhere include:\ -\n -port Specify port for rmid to use\ -\n -log Specify directory in which rmid writes log\ -\n -stop Stop current invocation of rmid (for specified port)\ -\n -C Pass argument to each child process (activation group)\ -\n -J Pass argument to the java interpreter\ -\n\ - -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=\ - activation daemon shut down - -# "rmid" should not be translated -rmid.restart.group.warning=\ -\nrmid: (WARNING) restart group throws: - -# "rmid" should not be translated -rmid.restart.service.warning=\ -\nrmid: (WARNING) restart service throws: - -# "rmid" should not be translated -rmid.log.update.warning=\ -\nrmid: (WARNING) log update throws: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\ -\nrmid: (SEVERE) log snapshot throws: - -# "rmid" should not be translated -rmid.log.recover.warning=\ -\nrmid: (WARNING) {0}: skipping log record during recovery: - -# "rmid" should not be translated -rmid.deprecation.warning=\ - rmid: (WARNING) The RMI Activation mechanism and the rmid tool\n\ - have been deprecated for removal. They may be removed from a future\n\ - version of the Java Platform. diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_de.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_de.properties deleted file mode 100644 index 757228cc3cb..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_de.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid wurde mit einem ung\u00FCltigen Status (muss "wait" sein) von inetd gestartet - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=Port kann nicht angegeben werden, wenn rmid von inetd gestartet wird - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=Port ist keine Zahl - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=F\u00FCr Option -port ist ein Argument erforderlich - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=F\u00FCr Option -log ist ein Argument erforderlich - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=Option -log ist erforderlich - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=Ung\u00FCltige Option: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: Es ist eine Ausnahme aufgetreten: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: java.home konnte nicht gefunden werden - -# "rmid" should not be translated -rmid.inherited.channel.info=rmid-Start mit \u00FCbernommenem Kanal - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: Ung\u00FCltige exec-Policy-Klasse - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: Versuch, die exec-Policy abzurufen, l\u00F6st Folgendes aus: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: "{0}" wird ausgef\u00FChrt - -# "rmid" should not be translated -rmid.group.inactive=rmid: Aktivierungsgruppe inaktiv: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: Warnung: Es wurde keine Systemeigenschaft sun.rmi.activation.execPolicy\nangegeben und keine ExecPermissions/ExecOptionPermissions\nerteilt. Nachfolgende Aktivierungsversuche scheitern m\u00F6glicherweise aufgrund\nnicht erfolgreicher Berechtigungspr\u00FCfungen ExecPermission/ExecOptionPermission. \nInformationen zur Sicherheitskonfiguration finden Sie in der rmid-Dokumentation.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -port Port f\u00FCr rmid angeben\n -log Verzeichnis, in das rmid die Logdatei schreibt, angeben\n -stop Aktuellen Aufruf von rmid stoppen (f\u00FCr den angegebenen Port)\n -C Argument an jeden untergeordneten Prozess (Aktivierungsgruppe) \u00FCbergeben\n -J Argument an den Java-Interpreter \u00FCbergeben\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=Aktivierungsdaemon heruntergefahren - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (WARNUNG) Neustart der Gruppe l\u00F6st Folgendes aus: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (WARNUNG) Neustart des Service l\u00F6st Folgendes aus: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (WARNUNG) Logupdate l\u00F6st Folgendes aus: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (SCHWERWIEGEND) Log-Snapshot l\u00F6st Folgendes aus: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (WARNUNG) {0}: Logdatensatz wird bei Wiederherstellung \u00FCbersprungen: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_es.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_es.properties deleted file mode 100644 index 1cc1b6477b8..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_es.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid se ha iniciado desde inetd con un estado no v\u00E1lido (debe ser wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=no se puede especificar el puerto si rmid se ha iniciado desde inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=el puerto no es un n\u00FAmero - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=la opci\u00F3n -port requiere un argumento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=la opci\u00F3n -log requiere un argumento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=la opci\u00F3n -log es obligatoria - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=opci\u00F3n no permitida: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: se ha producido una excepci\u00F3n: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: no se ha encontrado java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=inicio de rmid con canal heredado - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: clase de pol\u00EDtica de ejecuci\u00F3n no v\u00E1lida - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: el intento de obtener la pol\u00EDtica de ejecuci\u00F3n devuelve: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: en ejecuci\u00F3n "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid: grupo de activaci\u00F3n inactivo: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: advertencia: no se han especificado las propiedades del sistema sun.rmi.activation.execPolicy\ny no se han otorgado ExecPermissions/ExecOptionPermissions;\nlos intentos de activaci\u00F3n posteriores pueden fallar debido a\ncomprobaciones de permiso ExecPermission/ExecOptionPermission incorrectas. \nPara configurar la seguridad, consulte la documentaci\u00F3n sobre rmid.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Sintaxis: {0} \n\ndonde incluye:\n -port Especificar puerto para uso de rmid\n -log Especificar directorio en el que rmid escribir\u00E1 el registro\n -stop Parar la llamada actual de rmid (para el puerto especificado)\n -C Pasar argumento a cada uno de los procesos secundarios (grupo de activaci\u00F3n)\n -J Pasar argumento al int\u00E9rprete de Java\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=daemon de activaci\u00F3n cerrado - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (ADVERTENCIA) el reinicio del grupo devuelve: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (ADVERTENCIA) el reinicio del servicio devuelve: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (ADVERTENCIA) la actualizaci\u00F3n del log indica: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (GRAVE) la instant\u00E1nea del log indica: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (ADVERTENCIA) {0}: se omitir\u00E1 el registro del log durante la recuperaci\u00F3n: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_fr.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_fr.properties deleted file mode 100644 index 807b24a16e4..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_fr.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid a \u00E9t\u00E9 lanc\u00E9 depuis inetd avec un statut non valide (doit \u00EAtre wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=impossible de sp\u00E9cifier port si rmid est lanc\u00E9 depuis inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=port n'est pas un num\u00E9ro - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=l'option -port exige un argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=l'option -log exige un argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=option -log obligatoire - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=option non admise : {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main : une exception s''est produite - {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl : impossible de localiser java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=d\u00E9marrage de rmid avec le canal existant - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main : classe de r\u00E8gle exec incorrecte - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid : tentative d'obtention des basculements de classes exec : - -# "rmid" should not be translated -rmid.exec.command=rmid : debugExec : ex\u00E9cution de "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid : groupe d''activation inactif : {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main : avertissement : propri\u00E9t\u00E9 syst\u00E8me sun.rmi.activation.execPolicy\nnon indiqu\u00E9e et ExecPermissions/ExecOptionPermissions\nnon accord\u00E9s ; les tentatives d'activation suivantes risquent d'\u00E9chouer en raison de la v\u00E9rification des droits\nExecPermission/ExecOptionPermission. \nPour configurer la s\u00E9curit\u00E9, reportez-vous \u00E0 la documentation rmid.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -port Port que rmid doit utiliser\n -log R\u00E9pertoire o\u00F9 rmid enregistre le journal\n -stop Arr\u00EAter l''appel en cours de rmid (pour le port sp\u00E9cifi\u00E9)\n -C Transmet l''argument \u00E0 chaque processus enfant (groupe d''activation)\n -J Transmet l''argument \u00E0 l''interpr\u00E9teur Java\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=d\u00E9mon d'activation arr\u00EAt\u00E9 - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid : (AVERTISSEMENT) red\u00E9marrer les basculements de groupes : - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid : (AVERTISSEMENT) red\u00E9marrer les basculements de services : - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid : (AVERTISSEMENT) consigner les basculements de mises \u00E0 jour : - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid : (GRAVE) consigner les basculements de clich\u00E9s : - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid : (AVERTISSEMENT) {0} : enregistrement du journal ignor\u00E9 lors de la r\u00E9cup\u00E9ration : diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_it.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_it.properties deleted file mode 100644 index 21c8b8f35c1..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_it.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid \u00E8 stato avviato da inetd con uno stato non valido (diverso da wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=non \u00E8 possibile specificare la porta se rmid viene avviato da inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=la porta non \u00E8 un numero - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=L'opzione -port richiede un argomento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=L'opzione -log richiede un argomento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=\u00C8 richiesta l'opzione -log - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=opzione non valida: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: si \u00E8 verificata un''eccezione: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: impossibile individuare java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=Avvio di rmid con canale ereditato - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: classe di criteri eseguibili non valida - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: il tentativo di ottenere i criteri di esecuzione ha restituito: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: esecuzione di "{0}" in corso - -# "rmid" should not be translated -rmid.group.inactive=rmid: gruppo attivazione inattivo: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: avvertenza: propriet\u00E0 di sistema sun.rmi.activation.execPolicy\nnon specificata e nessun ExecPermissions/ExecOptionPermissions\nconcesso. I tentativi di attivazione successivi potrebbero fallire a causa di \ncontrolli di autorizzazione ExecPermission/ExecOptionPermission non riusciti.\nPer configurare la sicurezza, fare riferimento alla documentazione rmid.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Uso: {0} \n\ndove include:\n -port Specifica la porta usata da rmid\n -log Specifica la directory in cui rmid scrive il log\n -stop Arresta l''invocazione corrente di rmid (per la porta specificata)\n -C Passa l''argomento a ciascun processo figlio (gruppo di attivazione)\n -J Passa l''argomento all''interprete java\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=daemon di attivazione terminato - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (AVVERTENZA) il riavvio del gruppo ha restituito: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (AVVERTENZA) il riavvio del servizio ha restituito: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (AVVERTENZA) il log dell'aggiornamento ha restituito: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (GRAVE) snapshot log ha restituito: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (AVVERTENZA) {0}: record del log ignorato durante il recupero: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ja.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ja.properties deleted file mode 100644 index 37badc64440..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ja.properties +++ /dev/null @@ -1,99 +0,0 @@ -# -# -# Copyright (c) 1998, 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. 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid\u304Cinetd\u304B\u3089\u7121\u52B9\u306A\u72B6\u614B\u3067\u8D77\u52D5\u3055\u308C\u307E\u3057\u305F(wait\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=rmid\u304Cinetd\u304B\u3089\u8D77\u52D5\u3055\u308C\u305F\u5834\u5408\u3001\u30DD\u30FC\u30C8\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093 - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=port\u306F\u756A\u53F7\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=-port\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=-log\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=-log\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u5FC5\u8981\u3067\u3059 - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=\u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: \u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: java.home\u3092\u691C\u51FA\u3067\u304D\u307E\u305B\u3093 - -# "rmid" should not be translated -rmid.inherited.channel.info=rmid\u306F\u7D99\u627F\u3055\u308C\u305F\u30C1\u30E3\u30CD\u30EB\u3067\u8D77\u52D5\u3057\u307E\u3059 - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: \u7121\u52B9\u306A\u5B9F\u884C\u30DD\u30EA\u30B7\u30FC\u30FB\u30AF\u30E9\u30B9\u3067\u3059 - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: \u5B9F\u884C\u30DD\u30EA\u30B7\u30FC\u306E\u53D6\u5F97\u3067\u6B21\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: "{0}"\u3092\u5B9F\u884C\u4E2D - -# "rmid" should not be translated -rmid.group.inactive=rmid: \u8D77\u52D5\u30B0\u30EB\u30FC\u30D7\u304C\u505C\u6B62\u3057\u3066\u3044\u307E\u3059: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: \u8B66\u544A:sun.rmi.activation.execPolicy\u30B7\u30B9\u30C6\u30E0\n\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u3001\u307E\u305F\u306FExecPermissions/ExecOptionPermissions\u304C\n\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002ExecPermissions/ExecOptionPermissions\u30A2\u30AF\u30BB\u30B9\u6A29\u691C\u67FB\u3067\u8A31\u53EF\u3055\u308C\n\u306A\u3044\u305F\u3081\u3001\u5F8C\u306B\u7D9A\u304F\u8D77\u52D5\u306F\u5931\u6557\u3059\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\n\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u3092\u78BA\u8A8D\u3059\u308B\u306B\u306F\u3001rmid\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=\u4F7F\u7528\u65B9\u6CD5: {0} \n\n\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -port rmid\u304C\u4F7F\u7528\u3059\u308B\u30DD\u30FC\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -log rmid\u304C\u30ED\u30B0\u3092\u66F8\u304D\u8FBC\u3080\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6307\u5B9A\u3059\u308B\n -stop \u6307\u5B9A\u30DD\u30FC\u30C8\u306B\u5BFE\u3059\u308Brmid\u306E\u73FE\u5728\u306E\u547C\u51FA\u3057\u3092\u4E2D\u6B62\u3059\u308B\n -C \u5404\u5B50\u30D7\u30ED\u30BB\u30B9(\u8D77\u52D5\u30B0\u30EB\u30FC\u30D7)\u306B\u5F15\u6570\u3092\u6E21\u3059\n -J java\u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u306B\u5F15\u6570\u3092\u6E21\u3059\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=\u8D77\u52D5\u30C7\u30FC\u30E2\u30F3\u304C\u505C\u6B62\u3057\u307E\u3057\u305F - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (\u8B66\u544A)\u30B0\u30EB\u30FC\u30D7\u306E\u518D\u8D77\u52D5\u3067\u6B21\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (\u8B66\u544A)\u30B5\u30FC\u30D3\u30B9\u306E\u518D\u8D77\u52D5\u3067\u6B21\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (\u8B66\u544A)\u30ED\u30B0\u66F4\u65B0\u3067\u6B21\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (\u91CD\u5927)\u30ED\u30B0\u30FB\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3067\u6B21\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (\u8B66\u544A){0}: \u56DE\u5FA9\u4E2D\u306E\u30ED\u30B0\u30FB\u30EC\u30B3\u30FC\u30C9\u306E\u30B9\u30AD\u30C3\u30D7: - -# "rmid" should not be translated -rmid.deprecation.warning=rmid: (\u8B66\u544A) RMI\u8D77\u52D5\u30E1\u30AB\u30CB\u30BA\u30E0\u304A\u3088\u3073rmid\u30C4\u30FC\u30EB\u306F\u524A\u9664\u4E88\u5B9A\u306E\u305F\u3081\n\u975E\u63A8\u5968\u306B\u306A\u308A\u307E\u3057\u305F\u3002\u3053\u308C\u3089\u306F\u3001Java\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u306E\u5C06\u6765\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\n\u304B\u3089\u524A\u9664\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002 diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ko.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ko.properties deleted file mode 100644 index da505f2c3d8..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_ko.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid\uAC00 \uBD80\uC801\uD569\uD55C \uC0C1\uD0DC\uC758 inetd\uC5D0\uC11C \uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC0C1\uD0DC\uB294 wait\uC5EC\uC57C \uD569\uB2C8\uB2E4. - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=rmid\uAC00 inetd\uC5D0\uC11C \uC2DC\uC791\uB41C \uACBD\uC6B0 \uD3EC\uD2B8\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=\uD3EC\uD2B8\uB294 \uC22B\uC790\uAC00 \uC544\uB2D9\uB2C8\uB2E4. - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=-port \uC635\uC158\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 \uC778\uC218\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=-log \uC635\uC158\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 \uC778\uC218\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=-log \uC635\uC158\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=\uC798\uBABB\uB41C \uC635\uC158: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: \uC608\uC678\uC0AC\uD56D \uBC1C\uC0DD: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: java.home\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# "rmid" should not be translated -rmid.inherited.channel.info=\uC0C1\uC18D\uB41C \uCC44\uB110\uC744 \uC0AC\uC6A9\uD558\uC5EC rmid \uC2DC\uC791 - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: \uC2E4\uD589 \uC815\uCC45 \uD074\uB798\uC2A4\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: \uC2E4\uD589 \uC815\uCC45\uC744 \uAC00\uC838\uC624\uB824\uB294 \uC2DC\uB3C4\uB85C \uBC1C\uC0DD\uD55C \uC608\uC678\uC0AC\uD56D: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: "{0}" \uC2E4\uD589 \uC911 - -# "rmid" should not be translated -rmid.group.inactive=rmid: \uD65C\uC131\uD654 \uADF8\uB8F9 \uBE44\uD65C\uC131: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: \uACBD\uACE0: sun.rmi.activation.execPolicy \uC2DC\uC2A4\uD15C \uC18D\uC131\uC774\n\uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC73C\uBA70 ExecPermissions/ExecOptionPermissions\uAC00 \uBD80\uC5EC\uB418\uC9C0\n\uC54A\uC558\uC2B5\uB2C8\uB2E4. \uD65C\uC131\uD654\uB97C \uACC4\uC18D \uC2DC\uB3C4\uD558\uBA74 ExecPermission/ExecOptionPermission\n\uAD8C\uD55C \uAC80\uC0AC \uC2E4\uD328\uB85C \uC778\uD574 \uC2E4\uD328\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\uBCF4\uC548\uC744 \uAD6C\uC131\uD558\uB824\uBA74 rmid \uC124\uBA85\uC11C\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=\uC0AC\uC6A9\uBC95: {0} \n\n\uC5EC\uAE30\uC11C \uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -port rmid\uAC00 \uC0AC\uC6A9\uD560 \uD3EC\uD2B8\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -log rmid\uAC00 \uB85C\uADF8\uB97C \uAE30\uB85D\uD560 \uB514\uB809\uD1A0\uB9AC\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -stop \uC9C0\uC815\uB41C \uD3EC\uD2B8\uC5D0 \uB300\uD574 rmid\uC758 \uD604\uC7AC \uD638\uCD9C\uC744 \uC815\uC9C0\uD569\uB2C8\uB2E4.\n -C \uAC01\uAC01\uC758 \uD558\uC704 \uD504\uB85C\uC138\uC2A4(\uD65C\uC131\uD654 \uADF8\uB8F9)\uC5D0 \uC778\uC218\uB97C \uC804\uB2EC\uD569\uB2C8\uB2E4.\n -J Java \uC778\uD130\uD504\uB9AC\uD130\uC5D0 \uC778\uC218\uB97C \uC804\uB2EC\uD569\uB2C8\uB2E4.\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=\uD65C\uC131 \uB370\uBAAC \uC885\uB8CC - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (\uACBD\uACE0) \uADF8\uB8F9 \uC7AC\uC2DC\uC791\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (\uACBD\uACE0) \uC11C\uBE44\uC2A4 \uC7AC\uC2DC\uC791\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (\uACBD\uACE0) \uB85C\uADF8 \uC5C5\uB370\uC774\uD2B8\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (\uC2EC\uAC01) \uB85C\uADF8 \uC2A4\uB0C5\uC0F7\uC73C\uB85C \uC778\uD574 \uBC1C\uC0DD\uD55C \uC624\uB958: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (\uACBD\uACE0) {0}: \uBCF5\uAD6C\uD558\uB294 \uB3D9\uC548 \uB808\uCF54\uB4DC \uAE30\uB85D\uC744 \uAC74\uB108 \uB6F0\uB294 \uC911: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties deleted file mode 100644 index a4e6087b3ae..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid foi acionado a partir de inetd com um status inv\u00E1lido (deve ser wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=a porta n\u00E3o poder\u00E1 ser especificada se rmid for acionado a partir de inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=a porta n\u00E3o \u00E9 um n\u00FAmero - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=a op\u00E7\u00E3o -port requer um argumento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=a op\u00E7\u00E3o -log requer um argumento - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=op\u00E7\u00E3o -log necess\u00E1ria - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=op\u00E7\u00E3o inv\u00E1lida: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: ocorreu uma exce\u00E7\u00E3o: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: n\u00E3o \u00E9 poss\u00EDvel localizar java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=inicializa\u00E7\u00E3o de rmid com canal herdado - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: classe de pol\u00EDtica de execu\u00E7\u00E3o inv\u00E1lida - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: a tentativa de obter a pol\u00EDtica de execu\u00E7\u00E3o gera: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: executando "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid: grupo de ativa\u00E7\u00E3o inativo: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: warning: sun.rmi.activation.execPolicy system\npropriedade n\u00E3o especificada e nenhuma permiss\u00E3o ExecPermissions/ExecOptionPermissions\nconcedida; as tentativas subsequentes de ativa\u00E7\u00E3o poder\u00E3o falhar por causa das\nverifica\u00E7\u00F5es malsucedidas da permiss\u00E3o ExecPermission/ExecOptionPermission. \nPara configurar a seguran\u00E7a, consulte a documenta\u00E7\u00E3o do rmid.\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Uso: {0} \n\nem que inclui:\n -port especifica a porta que rmid usar\u00E1\n -log especifica o diret\u00F3rio no qual o rmid grava o log\n -stop para a chamada atual de rmid (para a porta especificada)\n -C especifica o argumento para cada processo filho (grupo de ativa\u00E7\u00E3o)\n -J especifica o argumento para o int\u00E9rprete de java\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=shutdown do daemon de ativa\u00E7\u00E3o - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (ADVERT\u00CANCIA) a reinicializa\u00E7\u00E3o do grupo gera: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (ADVERT\u00CANCIA) a reinicializa\u00E7\u00E3o do servi\u00E7o gera: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (ADVERT\u00CANCIA) o registro da atualiza\u00E7\u00E3o gera: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (GRAVE) o registro do snapshot gera: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (ADVERT\u00CANCIA) {0}: ignorando registro de log durante a recupera\u00E7\u00E3o: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_sv.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_sv.properties deleted file mode 100644 index bfa7b84292f..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_sv.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid startades fr\u00E5n inetd med ogiltig status (m\u00E5ste vara wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=port kan inte anges om rmid startas fr\u00E5n inetd - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=port \u00E4r inte ett tal - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=alternativet -port kr\u00E4ver argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=alternativet -log kr\u00E4ver argument - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=alternativet -log kr\u00E4vs - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=otill\u00E5tet alternativ: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: ett undantag uppstod: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: hittar inte java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=start av rmid med \u00E4rvd kanal - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: ogiltig exec policy-klass - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: f\u00F6rs\u00F6k att h\u00E4mta throws f\u00F6r exec-policy: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: k\u00F6r "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid: aktiveringsgruppen \u00E4r inaktiv: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: Varning: Systemegenskapen sun.rmi.activation.execPolicy\nhar inte angetts och inga ExecPermissions/ExecOptionPermissions har\ntilldelats. Efterf\u00F6ljande aktiveringsf\u00F6rs\u00F6k kanske inte utf\u00F6rs p\u00E5 grund\nav ej utf\u00F6rda ExecPermission/ExecOptionPermission-beh\u00F6righetskontroller. \nOm du vill konfigurera s\u00E4kerhet l\u00E4ser du i dokumentationen f\u00F6r rmid. - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=Syntax: {0} \n\nd\u00E4r inkluderar:\n -port Ange porten f\u00F6r rmid\n -log Ange katalogen d\u00E4r rmid ska spara loggen\n -stop Stoppa p\u00E5g\u00E5ende rmid-anrop (f\u00F6r angiven port)\n -C Skicka argumentet till varje underordnad process (aktiveringsgrupp)\n -J Skicka argumentet till Javatolken\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=aktiveringsdemonen avslutas - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (Varning) starta om gruppkast: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (Varning) starta om tj\u00E4nstekast: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (Varning) logga uppdateringskast: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (Allvarligt) logga \u00F6gonblickskast: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (Varning) {0}: hoppar \u00F6ver loggpost under \u00E5terst\u00E4llning: diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties deleted file mode 100644 index a2d4844d4dd..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties +++ /dev/null @@ -1,99 +0,0 @@ -# -# -# Copyright (c) 1998, 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. 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid \u5DF2\u4ECE inetd \u542F\u52A8, \u4E14\u72B6\u6001\u65E0\u6548 (\u5FC5\u987B\u7B49\u5F85) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=\u5982\u679C rmid \u4ECE inetd \u542F\u52A8, \u5219\u65E0\u6CD5\u6307\u5B9A\u7AEF\u53E3 - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=\u7AEF\u53E3\u4E0D\u662F\u4E00\u4E2A\u6570\u5B57 - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=-port \u9009\u9879\u9700\u8981\u53C2\u6570 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=-log \u9009\u9879\u9700\u8981\u53C2\u6570 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=\u9700\u8981 -log \u9009\u9879 - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=\u65E0\u6548\u7684\u9009\u9879\uFF1A{0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: \u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: \u627E\u4E0D\u5230 java.home - -# "rmid" should not be translated -rmid.inherited.channel.info=rmid \u901A\u8FC7\u7EE7\u627F\u7684\u901A\u9053\u542F\u52A8 - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: \u65E0\u6548\u7684\u53EF\u6267\u884C policy \u7C7B - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: \u5C1D\u8BD5\u83B7\u53D6\u6267\u884C\u7B56\u7565\u629B\u51FA: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: \u6B63\u5728\u8FD0\u884C "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid: \u6FC0\u6D3B\u7EC4\u65E0\u6548: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: \u8B66\u544A: \u672A\u6307\u5B9A sun.rmi.activation.execPolicy\n\u7CFB\u7EDF\u5C5E\u6027\u5E76\u4E14\u672A\u6388\u4E88 ExecPermissions/ExecOptionPermissions\u3002\n\u7531\u4E8E\u5BF9 ExecPermission/ExecOptionPermission \u7684\n\u6743\u9650\u68C0\u67E5\u5931\u8D25, \u968F\u540E\u7684\u6FC0\u6D3B\u5C1D\u8BD5\u53EF\u80FD\u4F1A\u5931\u8D25\u3002\n\u8981\u914D\u7F6E\u5B89\u5168\u6027, \u8BF7\u53C2\u9605 rmid \u6587\u6863\u3002\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=\u7528\u6CD5: {0} \n\n\u5176\u4E2D, \u5305\u62EC:\n -port \u6307\u5B9A\u4F9B rmid \u4F7F\u7528\u7684\u7AEF\u53E3\n -log \u6307\u5B9A rmid \u5C06\u65E5\u5FD7\u5199\u5165\u7684\u76EE\u5F55\n -stop \u505C\u6B62\u5F53\u524D\u7684 rmid \u8C03\u7528 (\u5BF9\u6307\u5B9A\u7AEF\u53E3)\n -C \u5411\u6BCF\u4E2A\u5B50\u8FDB\u7A0B\u4F20\u9012\u53C2\u6570 (\u6FC0\u6D3B\u7EC4)\n -J \u5411 java \u89E3\u91CA\u5668\u4F20\u9012\u53C2\u6570\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=\u6FC0\u6D3B\u5B88\u62A4\u7A0B\u5E8F\u5DF2\u5173\u95ED - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (\u8B66\u544A) \u91CD\u65B0\u542F\u52A8\u7EC4\u629B\u51FA: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (\u8B66\u544A) \u91CD\u65B0\u542F\u52A8\u670D\u52A1\u629B\u51FA: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (\u8B66\u544A) \u65E5\u5FD7\u66F4\u65B0\u629B\u51FA: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (\u4E25\u91CD) \u65E5\u5FD7\u5FEB\u7167\u629B\u51FA: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (\u8B66\u544A) {0}: \u6062\u590D\u671F\u95F4\u8DF3\u8FC7\u65E5\u5FD7\u8BB0\u5F55: - -# "rmid" should not be translated -rmid.deprecation.warning=rmid\uFF1A\uFF08\u8B66\u544A\uFF09RMI \u6FC0\u6D3B\u673A\u5236\u548C rmid \u5DE5\u5177\n\u5DF2\u8FC7\u65F6\uFF0C\u5373\u5C06\u5220\u9664\u3002\u5728\u5C06\u6765\u7684\nJava \u5E73\u53F0\u7248\u672C\u4E2D\u53EF\u80FD\u4F1A\u5C06\u5176\u5220\u9664\u3002 diff --git a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties deleted file mode 100644 index e7f018d089a..00000000000 --- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties +++ /dev/null @@ -1,96 +0,0 @@ -# -# -# Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# "rmid", inetd", and "wait" should not be translated. -rmid.syntax.exec.invalid=rmid \u5DF2\u5F9E inetd \u555F\u52D5\uFF0C\u4F46\u72C0\u614B\u7121\u6548 (\u5FC5\u9808\u662F wait) - -# "rmid" and "inetd" should not be translated. -rmid.syntax.port.badarg=\u5982\u679C rmid \u5F9E inetd \u555F\u52D5\uFF0C\u5247\u7121\u6CD5\u6307\u5B9A\u9023\u63A5\u57E0 - -# "port" here refers to a TCP port for the server to listen on. -rmid.syntax.port.badnumber=port \u4E0D\u662F\u4E00\u500B\u6578\u5B57 - -# "-port" should not be translated, because it's part of command syntax. -rmid.syntax.port.missing=-port \u9078\u9805\u9700\u8981\u5F15\u6578 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.missing=-log \u9078\u9805\u9700\u8981\u5F15\u6578 - -# "-log" should not be translated, because it's part of command syntax. -rmid.syntax.log.required=-log \u9078\u9805\u662F\u5FC5\u9700\u7684 - -# {0} = the (string) illegal argument in question -rmid.syntax.illegal.option=\u7121\u6548\u7684\u9078\u9805: {0} - -# {0} = the (string) reason text that came with a thrown exception -# "Activation.main" should not be translated, because it's a codepoint -rmid.unexpected.exception=Activation.main: \u767C\u751F\u7570\u5E38\u72C0\u6CC1: {0} - -# "java.home" should not be translated, because it's a property name -# "ActivatorImpl" should not be translated, because it's a codepoint -rmid.unfound.java.home.property=ActivatorImpl: \u627E\u4E0D\u5230 java.home \u7684\u6240\u5728 - -# "rmid" should not be translated -rmid.inherited.channel.info=rmid \u4F7F\u7528\u7E7C\u627F\u7684\u901A\u9053\u555F\u52D5 - -# "Activation.main" should not be translated, because it's a codepoint -rmid.exec.policy.invalid=Activation.main: \u7121\u6548\u7684\u57F7\u884C\u539F\u5247\u985E\u5225 - -# "rmid" should not be translated -rmid.exec.policy.exception=rmid: \u5617\u8A66\u53D6\u5F97\u57F7\u884C\u539F\u5247\u62CB\u68C4: - -# "rmid" should not be translated -rmid.exec.command=rmid: debugExec: \u57F7\u884C "{0}" - -# "rmid" should not be translated -rmid.group.inactive=rmid: \u555F\u52D5\u7FA4\u7D44\u672A\u5728\u4F7F\u7528\u4E2D: {0} - -# "Activation.main", "sun.rmi.activation.execPolicy", "ExecPermission" and -# "ExecOptionPermission" should not be translated, since they refer to -# class/permission names. -rmid.exec.perms.inadequate=Activation.main: \u8B66\u544A: sun.rmi.activation.execPolicy \u7CFB\u7D71\n\u5C6C\u6027\u672A\u6307\u5B9A\uFF0C\u800C\u4E14\u672A\u6388\u4E88 ExecPermissions/ExecOptionPermissions;\n\u5F8C\u7E8C\u7684\u555F\u52D5\u5617\u8A66\u53EF\u80FD\u6703\u56E0\u70BA\u4E0D\u6210\u529F\u7684\nExecPermission/ExecOptionPermission \u6B0A\u9650\u6AA2\u67E5\u800C\u5931\u6557\u3002\n\u5982\u9700\u8A2D\u5B9A\u5B89\u5168\uFF0C\u8ACB\u53C3\u8003 rmid \u6587\u4EF6\u3002\n - -# "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated, -# because they are syntax -rmid.usage=\u7528\u6CD5: {0} \n\n\u5176\u4E2D \u5305\u62EC: \n -port \u6307\u5B9A\u4F9B rmid \u4F7F\u7528\u7684\u9023\u63A5\u57E0\n -log \u6307\u5B9A\u4F9B rmid \u5BEB\u5165\u65E5\u8A8C\u7684\u76EE\u9304\n -stop \u505C\u6B62\u76EE\u524D rmid \u7684\u547C\u53EB (\u91DD\u5C0D\u6307\u5B9A\u7684\u9023\u63A5\u57E0)\n -C \u50B3\u905E\u5F15\u6578\u81F3\u6BCF\u4E00\u5B50\u904E\u7A0B (\u4F5C\u7528\u7FA4\u7D44)\n -J \u50B3\u905E\u5F15\u6578\u81F3 java \u89E3\u8B6F\u7A0B\u5F0F\n -# This means "The currently running activation daemon has been shut down, -# and is about to exit". -rmid.daemon.shutdown=\u95DC\u9589 activation \u5354\u52A9\u7A0B\u5F0F - -# "rmid" should not be translated -rmid.restart.group.warning=\nrmid: (\u8B66\u544A) \u91CD\u65B0\u555F\u52D5\u7FA4\u7D44\u62CB\u68C4: - -# "rmid" should not be translated -rmid.restart.service.warning=\nrmid: (\u8B66\u544A) \u91CD\u65B0\u555F\u52D5\u670D\u52D9\u62CB\u68C4: - -# "rmid" should not be translated -rmid.log.update.warning=\nrmid: (\u8B66\u544A) \u8A18\u9304\u66F4\u65B0\u62CB\u68C4: - -# "rmid" should not be translated -rmid.log.snapshot.warning=\nrmid: (\u56B4\u91CD) \u8A18\u9304\u5FEB\u7167\u62CB\u68C4: - -# "rmid" should not be translated -rmid.log.recover.warning=\nrmid: (\u8B66\u544A) {0}: \u5728\u56DE\u5FA9\u904E\u7A0B\u4E2D\u7565\u904E\u65E5\u8A8C\u8A18\u9304: diff --git a/src/java.rmi/share/man/rmid.1 b/src/java.rmi/share/man/rmid.1 deleted file mode 100644 index 576fba50042..00000000000 --- a/src/java.rmi/share/man/rmid.1 +++ /dev/null @@ -1,413 +0,0 @@ -.\" Copyright (c) 1998, 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. -.\" -.\" Automatically generated by Pandoc 2.3.1 -.\" -.TH "RMID" "1" "2021" "JDK 17\-ea" "JDK Commands" -.hy -.SH NAME -.PP -rmid \- start the activation system daemon that enables objects to be -registered and activated in a Java Virtual Machine (JVM) -.SH SYNOPSIS -.PP -\f[CB]rmid\f[R] [\f[I]options\f[R]] -.TP -.B \f[I]options\f[R] -This represent the command\-line options for the \f[CB]rmid\f[R] command. -See \f[B]Options for rmid\f[R]. -.RS -.RE -.SH DESCRIPTION -.PP -\f[B]Deprecation Notice:\f[R] The rmid tool and the RMI Activation -mechanism have been deprecated and may be removed from a future version -of the platform. -See \f[B]JEP 385\f[R] [https://openjdk.java.net/jeps/385] for further -information. -.PP -The \f[CB]rmid\f[R] command starts the activation system daemon. -The activation system daemon must be started before objects that can be -activated are either registered with the activation system or activated -in a JVM. -.PP -Start the daemon by executing the \f[CB]rmid\f[R] command and specifying a -security policy file, as follows: -.RS -.PP -\f[CB]rmid\ \-J\-Djava.security.policy=rmid.policy\f[R] -.RE -.PP -When you run Oracle\[aq]s implementation of the \f[CB]rmid\f[R] command, -by default you must specify a security policy file so that the -\f[CB]rmid\f[R] command can verify whether or not the information in each -\f[CB]ActivationGroupDesc\f[R] is allowed to be used to start a JVM for an -activation group. -Specifically, the command and options specified by the -\f[CB]CommandEnvironment\f[R] and any properties passed to an -\f[CB]ActivationGroupDesc\f[R] constructor must now be explicitly allowed -in the security policy file for the \f[CB]rmid\f[R] command. -The value of the \f[CB]sun.rmi.activation.execPolicy\f[R] property -dictates the policy that the \f[CB]rmid\f[R] command uses to determine -whether or not the information in an \f[CB]ActivationGroupDesc\f[R] can be -used to start a JVM for an activation group. -For more information see the description of the -\f[CB]\-J\-Dsun.rmi.activation.execPolicy=policy\f[R] option. -.PP -Executing the \f[CB]rmid\f[R] command starts the \f[CB]Activator\f[R] and an -internal registry on the default port 1098 and binds an -\f[CB]ActivationSystem\f[R] to the name -\f[CB]java.rmi.activation.ActivationSystem\f[R] in this internal registry. -.PP -To specify an alternate port for the registry, you must specify the -\f[CB]\-port\f[R] option when you execute the \f[CB]rmid\f[R] command. -For example, the following command starts the activation system daemon -and a registry on the registry\[aq]s default port, 1099. -.RS -.PP -\f[CB]rmid\ \-J\-Djava.security.policy=rmid.policy\ \-port\ 1099\f[R] -.RE -.SH START RMID ON DEMAND (LINUX ONLY) -.PP -An alternative to starting \f[CB]rmid\f[R] from the command line is to -configure \f[CB]xinetd\f[R] (Linux) to start \f[CB]rmid\f[R] on demand. -.PP -When RMID starts, it attempts to obtain an inherited channel (inherited -from \f[CB]inetd\f[R]/\f[CB]xinetd\f[R]) by calling the -\f[CB]System.inheritedChannel\f[R] method. -If the inherited channel is null or not an instance of -\f[CB]java.nio.channels.ServerSocketChannel\f[R], then RMID assumes that -it wasn\[aq]t started by \f[CB]inetd\f[R]/\f[CB]xinetd\f[R], and it starts -as previously described. -.PP -If the inherited channel is a \f[CB]ServerSocketChannel\f[R] instance, -then RMID uses the \f[CB]java.net.ServerSocket\f[R] obtained from the -\f[CB]ServerSocketChannel\f[R] as the server socket that accepts requests -for the remote objects it exports: The registry in which the -\f[CB]java.rmi.activation.ActivationSystem\f[R] is bound and the -\f[CB]java.rmi.activation.Activator\f[R] remote object. -In this mode, RMID behaves the same as when it is started from the -command line, except in the following cases: -.IP \[bu] 2 -Output printed to \f[CB]System.err\f[R] is redirected to a file. -This file is located in the directory specified by the -\f[CB]java.io.tmpdir\f[R] system property (typically \f[CB]/var/tmp\f[R] or -\f[CB]/tmp\f[R]) with the prefix \f[CB]rmid\-err\f[R] and the suffix -\f[CB]tmp\f[R]. -.IP \[bu] 2 -The \f[CB]\-port\f[R] option isn\[aq]t allowed. -If this option is specified, then RMID exits with an error message. -.IP \[bu] 2 -The \f[CB]\-log\f[R] option is required. -If this option isn\[aq]t specified, then RMID exits with an error -message -.SH OPTIONS FOR RMID -.TP -.B \f[CB]\-C\f[R]\f[I]option\f[R] -Specifies an option that\[aq]s passed as a command\-line argument to -each child process (activation group) of the \f[CB]rmid\f[R] command when -that process is created. -For example, you could pass a property to each virtual machine spawned -by the activation system daemon: -.RS -.RS -.PP -\f[CB]rmid\ \-C\-Dsome.property=value\f[R] -.RE -.PP -This ability to pass command\-line arguments to child processes can be -useful for debugging. -For example, the following command enables server\-call logging in all -child JVMs. -.RS -.PP -\f[CB]rmid\ \-C\-Djava.rmi.server.logCalls=true\f[R] -.RE -.RE -.TP -.B \f[CB]\-J\f[R]\f[I]option\f[R] -Specifies an option that\[aq]s passed to the Java interpreter running -RMID command. -For example, to specify that the \f[CB]rmid\f[R] command use a policy file -named \f[CB]rmid.policy\f[R], the \f[CB]\-J\f[R] option can be used to -define the \f[CB]java.security.policy\f[R] property on the \f[CB]rmid\f[R] -command line, for example: -.RS -.RS -.PP -\f[CB]rmid\ \-J\-Djava.security.policy\-rmid.policy\f[R] -.RE -.RE -.TP -.B \f[CB]\-J\-Dsun.rmi.activation.execPolicy=\f[R]\f[I]policy\f[R] -Specifies the policy that the RMID command employs to check commands and -command\-line options used to start the JVM in which an activation group -runs. -This option exists only in Oracle\[aq]s implementation of the Java RMI -activation daemon. -If this property isn\[aq]t specified on the command line, then the -result is the same as though -\f[CB]\-J\-Dsun.rmi.activation.execPolicy=default\f[R] were specified. -.RS -.PP -The possible values of \f[I]policy\f[R] can be \f[CB]default\f[R], -\f[I]policyClassName\f[R], or \f[CB]none\f[R]. -.IP \[bu] 2 -\f[CB]default\f[R] -.RS 2 -.PP -The \f[CB]default\f[R] or unspecified value \f[CB]execPolicy\f[R] allows the -\f[CB]rmid\f[R] command to execute commands with specific command\-line -options only when the \f[CB]rmid\f[R] command was granted permission to -execute those commands and options in the security policy file that the -\f[CB]rmid\f[R] command uses. -Only the default activation group implementation can be used with the -default execution policy. -.PP -The \f[CB]rmid\f[R] command starts a JVM for an activation group with the -information in the group\[aq]s registered activation group descriptor, -\f[CB]ActivationGroupDesc\f[R]. -The group descriptor specifies an optional -\f[CB]ActivationGroupDesc.CommandEnvironment\f[R] that includes the -command to execute to start the activation group and any command\-line -options to be added to the command line. -By default, the \f[CB]rmid\f[R] command uses the \f[CB]java\f[R] command -found in \f[CB]java.home\f[R]. -The group descriptor also contains properties overrides that are added -to the command line as options defined as: -\f[CB]\-D\f[R]\f[I]property\f[R]\f[CB]=\f[R]\f[I]value\f[R]. -The \f[CB]com.sun.rmi.rmid.ExecPermission\f[R] permission grants the -\f[CB]rmid\f[R] command permission to execute a command that\[aq]s -specified in the group descriptor\[aq]s \f[CB]CommandEnvironment\f[R] to -start an activation group. -The \f[CB]com.sun.rmi.rmid.ExecOptionPermission\f[R] permission enables -the \f[CB]rmid\f[R] command to use command\-line options, specified as -properties overrides in the group descriptor or as options in the -\f[CB]CommandEnvironment\f[R] when starting the activation group. -When granting the \f[CB]rmid\f[R] command permission to execute various -commands and options, the permissions \f[CB]ExecPermission\f[R] and -\f[CB]ExecOptionPermission\f[R] must be granted to all code sources. -.PP -\f[CB]ExecPermission\f[R] class: Represents permission for the -\f[CB]rmid\f[R] command to execute a specific command to start an -activation group. -.PP -\f[CB]ExecPermission\f[R] syntax: The name of \f[CB]ExecPermission\f[R] is -the path name of a command to grant the \f[CB]rmid\f[R] command permission -to execute. -.PP -A path name that ends in a slash (\f[CB]/\f[R]) and an asterisk -(\f[CB]*\f[R]) indicates that all of the files are contained in that -directory where the slash is the file\-separator character, -\f[CB]File.separatorChar\f[R]. -.PP -A path name that ends in a slash (\f[CB]/\f[R]) and a minus sign -(\f[CB]\-\f[R]) indicates that all files and subdirectories are contained -in that directory (recursively). -.PP -A path name that consists of the special token \f[CB]<>\f[R] -matches any file. -.PP -A path name that consists of an asterisk (\f[CB]*\f[R]) indicates that all -the files are in the current directory. -.PP -A path name that consists of a minus sign (\f[CB]\-\f[R]) indicates that -all the files are in the current directory and (recursively) all files -and subdirectories are contained in the current directory. -.PP -\f[CB]ExecOptionPermission\f[R] class: Represents permission for the -\f[CB]rmid\f[R] command to use a specific command\-line option when -starting an activation group. -The name of \f[CB]ExecOptionPermission\f[R] is the value of a -command\-line option. -.PP -\f[CB]ExecOptionPermission\f[R] syntax: Options support a limited wild -card scheme. -An asterisk signifies a wild card match, and it can appear as the option -name itself (matches any option), or an asterisk (*) can appear at the -end of the option name only when the asterisk (\f[CB]*\f[R]) follows a dot -(\f[CB]\&.\f[R]) or an equals sign (\f[CB]=\f[R]). -.PP -For example: \f[CB]*\f[R] or \f[CB]\-Dmydir.*\f[R] or \f[CB]\-Da.b.c=*\f[R] is -valid, but \f[CB]*mydir\f[R] or \f[CB]\-Da*b\f[R] or \f[CB]ab*\f[R] isn\[aq]t -valid. -.PP -\f[B]Policy file for rmid\f[R] -.PP -When you grant the \f[CB]rmid\f[R] command permission to execute various -commands and options, the permissions \f[CB]ExecPermission\f[R] and -\f[CB]ExecOptionPermission\f[R] must be granted to all code sources -(universally). -It is safe to grant these permissions universally because only the -\f[CB]rmid\f[R] command checks these permissions. -.PP -An example policy file that grants various execute permissions to the -\f[CB]rmid\f[R] command is: -.IP \[bu] 2 -\f[B]Linux:\f[R] -.RS 2 -.IP -.nf -\f[CB] -grant\ { -\ \ \ \ permission\ com.sun.rmi.rmid.ExecPermission -\ \ \ \ \ \ \ \ "/files/apps/java/jdk1.7.0/linux/bin/java"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecPermission -\ \ \ \ \ \ \ \ "/files/apps/rmidcmds/*"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Djava.security.policy=/files/policies/group.policy"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Djava.security.debug=*"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Dsun.rmi.*"; -}; -\f[R] -.fi -.RE -.IP \[bu] 2 -\f[B]Windows:\f[R] -.RS 2 -.IP -.nf -\f[CB] -grant\ { -\ \ \ \ permission\ com.sun.rmi.rmid.ExecPermission -\ \ \ \ \ \ \ \ "c:\\\\files\\\\apps\\\\java\\\\jdk1.7.0\\\\win\\\\bin\\\\java"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecPermission -\ \ \ \ \ \ \ \ "c:\\\\files\\\\apps\\\\rmidcmds\\\\*"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Djava.security.policy=c:\\\\files\\\\policies\\\\group.policy"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Djava.security.debug=*"; - -\ \ \ \ permission\ com.sun.rmi.rmid.ExecOptionPermission -\ \ \ \ \ \ \ \ "\-Dsun.rmi.*"; -}; -\f[R] -.fi -.RE -.PP -The first permission granted allows the \f[CB]rmid\f[R] command to execute -the 1.7.0 release of the \f[CB]java\f[R] command, specified by its -explicit path name. -By default, the version of the \f[CB]java\f[R] command found in -\f[CB]java.home\f[R] is used (the same one that the \f[CB]rmid\f[R] command -uses), and doesn\[aq]t need to be specified in the policy file. -The second permission allows the \f[CB]rmid\f[R] command to execute any -command in either the directory \f[CB]/files/apps/rmidcmds\f[R] (Linux and -macOS) or the directory \f[CB]c:\\files\\apps\\rmidcmds\\\f[R] (Windows). -.PP -The third permission granted, \f[CB]ExecOptionPermission\f[R], allows the -\f[CB]rmid\f[R] command to start an activation group that defines the -security policy file to be either \f[CB]/files/policies/group.policy\f[R] -(Linux) or \f[CB]c:\\files\\policies\\group.policy\f[R] (Windows). -The next permission allows the \f[CB]java.security.debug\ property\f[R] to -be used by an activation group. -The last permission allows any property in the -\f[CB]sun.rmi\ property\f[R] name hierarchy to be used by activation -groups. -.PP -To start the \f[CB]rmid\f[R] command with a policy file, the -\f[CB]java.security.policy\f[R] property needs to be specified on the -\f[CB]rmid\f[R] command line, for example: -.PP -\f[CB]rmid\ \-J\-Djava.security.policy=rmid.policy\f[R]. -.RE -.IP \[bu] 2 -\f[I]policyClassName\f[R] -.RS 2 -.PP -If the default behavior isn\[aq]t flexible enough, then an administrator -can provide, when starting the \f[CB]rmid\f[R] command, the name of a -class whose \f[CB]checkExecCommand\f[R] method is executed to check -commands to be executed by the \f[CB]rmid\f[R] command. -.PP -The \f[CB]policyClassName\f[R] specifies a public class with a public, -no\-argument constructor and an implementation of the following -\f[CB]checkExecCommand\f[R] method: -.IP -.nf -\f[CB] -\ public\ void\ checkExecCommand(ActivationGroupDesc\ desc,\ String[]\ command) -\ \ \ \ \ \ \ \ throws\ SecurityException; -\f[R] -.fi -.PP -Before starting an activation group, the \f[CB]rmid\f[R] command calls the -policy\[aq]s \f[CB]checkExecCommand\f[R] method and passes to it the -activation group descriptor and an array that contains the complete -command to start the activation group. -If the \f[CB]checkExecCommand\f[R] throws a \f[CB]SecurityException\f[R], -then the \f[CB]rmid\f[R] command doesn\[aq]t start the activation group -and an \f[CB]ActivationException\f[R] is thrown to the caller attempting -to activate the object. -.RE -.IP \[bu] 2 -\f[CB]none\f[R] -.RS 2 -.PP -If the \f[CB]sun.rmi.activation.execPolicy\f[R] property value is -\f[CB]none\f[R], then the \f[CB]rmid\f[R] command doesn\[aq]t perform any -validation of commands to start activation groups. -.RE -.RE -.TP -.B \f[CB]\-log\f[R] \f[I]dir\f[R] -Specifies the name of the directory that the activation system daemon -uses to write its database and associated information. -The log directory defaults to creating a log, in the directory in which -the \f[CB]rmid\f[R] command was executed. -.RS -.RE -.TP -.B \f[CB]\-port\f[R] \f[I]port\f[R] -Specifies the port that the registry uses. -The activation system daemon binds \f[CB]ActivationSystem\f[R], with the -name \f[CB]java.rmi.activation.ActivationSystem\f[R], in this registry. -The \f[CB]ActivationSystem\f[R] on the local machine can be obtained using -the following \f[CB]Naming.lookup\f[R] method call: -.RS -.IP -.nf -\f[CB] -import\ java.rmi.*; -import\ java.rmi.activation.*; - -ActivationSystem\ system;\ system\ =\ (ActivationSystem) -Naming.lookup("//:port/java.rmi.activation.ActivationSystem"); -\f[R] -.fi -.RE -.TP -.B \f[CB]\-stop\f[R] -Stops the current invocation of the \f[CB]rmid\f[R] command for a port -specified by the \f[CB]\-port\f[R] option. -If no port is specified, then this option stops the \f[CB]rmid\f[R] -invocation running on port 1098. -.RS -.RE diff --git a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java index 4c98d10584a..2af3a549366 100644 --- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java @@ -106,7 +106,7 @@ public final class KerberosPrincipal * *

If the input name does not contain a realm, the default realm * is used. The default realm can be specified either in a Kerberos - * configuration file or via the {@systemProperty java.security.krb5.realm} + * configuration file or via the {@code java.security.krb5.realm} * system property. For more information, see the * {@extLink security_guide_jgss_tutorial Kerberos Requirements}. * @@ -155,7 +155,7 @@ public KerberosPrincipal(String name) { * *

If the input name does not contain a realm, the default realm * is used. The default realm can be specified either in a Kerberos - * configuration file or via the {@systemProperty java.security.krb5.realm} + * configuration file or via the {@code java.security.krb5.realm} * system property. For more information, see the * {@extLink security_guide_jgss_tutorial Kerberos Requirements}. * diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java index f6868e93091..61c8b6514dd 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -25,12 +25,13 @@ package com.sun.org.apache.xalan.internal.utils; -import com.sun.org.apache.xalan.internal.XalanConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; /** * This is the base class for features and properties * + * @LastModified: May 2021 */ public abstract class FeaturePropertyBase { @@ -113,9 +114,9 @@ public boolean setValue(String propertyName, State state, boolean value) { int index = getIndex(propertyName); if (index > -1) { if (value) { - setValue(index, state, XalanConstants.FEATURE_TRUE); + setValue(index, state, JdkConstants.FEATURE_TRUE); } else { - setValue(index, state, XalanConstants.FEATURE_FALSE); + setValue(index, state, JdkConstants.FEATURE_FALSE); } return true; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java index 30245d69ff0..910d8636888 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,8 +25,10 @@ package com.sun.org.apache.xalan.internal.utils; -import com.sun.org.apache.xalan.internal.XalanConstants; import java.util.concurrent.CopyOnWriteArrayList; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import jdk.xml.internal.JdkProperty.State; import jdk.xml.internal.SecuritySupport; import org.xml.sax.SAXException; @@ -41,51 +43,30 @@ */ public final class XMLSecurityManager { - /** - * States of the settings of a property, in the order: default value, value - * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system - * properties, and jaxp api properties - */ - public static enum State { - //this order reflects the overriding order - - DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), - JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"), - APIPROPERTY("property"); - - final String literal; - State(String literal) { - this.literal = literal; - } - - String literal() { - return literal; - } - } - /** * Limits managed by the security manager */ + @SuppressWarnings("deprecation") public static enum Limit { - ENTITY_EXPANSION_LIMIT("EntityExpansionLimit", XalanConstants.JDK_ENTITY_EXPANSION_LIMIT, - XalanConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), - MAX_OCCUR_NODE_LIMIT("MaxOccurLimit", XalanConstants.JDK_MAX_OCCUR_LIMIT, - XalanConstants.SP_MAX_OCCUR_LIMIT, 0, 5000), - ELEMENT_ATTRIBUTE_LIMIT("ElementAttributeLimit", XalanConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT, - XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), - TOTAL_ENTITY_SIZE_LIMIT("TotalEntitySizeLimit", XalanConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT, - XalanConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), - GENERAL_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", XalanConstants.JDK_GENERAL_ENTITY_SIZE_LIMIT, - XalanConstants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0), - PARAMETER_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", XalanConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, - XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000), - MAX_ELEMENT_DEPTH_LIMIT("MaxElementDepthLimit", XalanConstants.JDK_MAX_ELEMENT_DEPTH, - XalanConstants.SP_MAX_ELEMENT_DEPTH, 0, 0), - MAX_NAME_LIMIT("MaxXMLNameLimit", XalanConstants.JDK_XML_NAME_LIMIT, - XalanConstants.SP_XML_NAME_LIMIT, 1000, 1000), - ENTITY_REPLACEMENT_LIMIT("EntityReplacementLimit", XalanConstants.JDK_ENTITY_REPLACEMENT_LIMIT, - XalanConstants.SP_ENTITY_REPLACEMENT_LIMIT, 0, 3000000); + ENTITY_EXPANSION_LIMIT("EntityExpansionLimit", JdkConstants.JDK_ENTITY_EXPANSION_LIMIT, + JdkConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), + MAX_OCCUR_NODE_LIMIT("MaxOccurLimit", JdkConstants.JDK_MAX_OCCUR_LIMIT, + JdkConstants.SP_MAX_OCCUR_LIMIT, 0, 5000), + ELEMENT_ATTRIBUTE_LIMIT("ElementAttributeLimit", JdkConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT, + JdkConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), + TOTAL_ENTITY_SIZE_LIMIT("TotalEntitySizeLimit", JdkConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT, + JdkConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), + GENERAL_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", JdkConstants.JDK_GENERAL_ENTITY_SIZE_LIMIT, + JdkConstants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0), + PARAMETER_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", JdkConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, + JdkConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000), + MAX_ELEMENT_DEPTH_LIMIT("MaxElementDepthLimit", JdkConstants.JDK_MAX_ELEMENT_DEPTH, + JdkConstants.SP_MAX_ELEMENT_DEPTH, 0, 0), + MAX_NAME_LIMIT("MaxXMLNameLimit", JdkConstants.JDK_XML_NAME_LIMIT, + JdkConstants.SP_XML_NAME_LIMIT, 1000, 1000), + ENTITY_REPLACEMENT_LIMIT("EntityReplacementLimit", JdkConstants.JDK_ENTITY_REPLACEMENT_LIMIT, + JdkConstants.SP_ENTITY_REPLACEMENT_LIMIT, 0, 3000000); final String key; final String apiProperty; @@ -101,12 +82,36 @@ public static enum Limit { this.secureValue = secureValue; } - public boolean equalsAPIPropertyName(String propertyName) { - return (propertyName == null) ? false : apiProperty.equals(propertyName); + /** + * Checks whether the specified name is a limit. Checks both the + * property and System Property which is now the new property name. + * + * @param name the specified name + * @return true if there is a match, false otherwise + */ + public boolean is(String name) { + // current spec: new property name == systemProperty + return (systemProperty != null && systemProperty.equals(name)) || + // current spec: apiProperty is legacy + (apiProperty.equals(name)); } - public boolean equalsSystemPropertyName(String propertyName) { - return (propertyName == null) ? false : systemProperty.equals(propertyName); + /** + * Returns the state of a property name. By the specification as of JDK 17, + * the "jdk.xml." prefixed System property name is also the current API + * name. The URI-based qName is legacy. + * + * @param name the property name + * @return the state of the property name, null if no match + */ + public State getState(String name) { + if (systemProperty != null && systemProperty.equals(name)) { + return State.APIPROPERTY; + } else if (apiProperty.equals(name)) { + //the URI-style qName is legacy + return State.LEGACY_APIPROPERTY; + } + return null; } public String key() { @@ -117,7 +122,7 @@ public String apiProperty() { return apiProperty; } - String systemProperty() { + public String systemProperty() { return systemProperty; } @@ -135,12 +140,12 @@ int secureValue() { */ public static enum NameMap { - ENTITY_EXPANSION_LIMIT(XalanConstants.SP_ENTITY_EXPANSION_LIMIT, - XalanConstants.ENTITY_EXPANSION_LIMIT), - MAX_OCCUR_NODE_LIMIT(XalanConstants.SP_MAX_OCCUR_LIMIT, - XalanConstants.MAX_OCCUR_LIMIT), - ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, - XalanConstants.ELEMENT_ATTRIBUTE_LIMIT); + ENTITY_EXPANSION_LIMIT(JdkConstants.SP_ENTITY_EXPANSION_LIMIT, + JdkConstants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(JdkConstants.SP_MAX_OCCUR_LIMIT, + JdkConstants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(JdkConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, + JdkConstants.ELEMENT_ATTRIBUTE_LIMIT); final String newName; final String oldName; @@ -230,7 +235,11 @@ public void setSecureProcessing(boolean secure) { public boolean setLimit(String propertyName, State state, Object value) { int index = getIndex(propertyName); if (index > -1) { - setLimit(index, state, value); + State pState = state; + if (index != indexEntityCountInfo && state == State.APIPROPERTY) { + pState = (Limit.values()[index]).getState(propertyName); + } + setLimit(index, pState, value); return true; } return false; @@ -259,14 +268,17 @@ public void setLimit(int index, State state, Object value) { //if it's explicitly set, it's treated as yes no matter the value printEntityCountInfo = (String)value; } else { - int temp = 0; - try { + int temp; + if (value instanceof Integer) { + temp = (Integer)value; + } else { temp = Integer.parseInt((String) value); if (temp < 0) { temp = 0; } - } catch (NumberFormatException e) {} - setLimit(index, state, temp); } + } + setLimit(index, state, temp); + } } /** @@ -279,7 +291,7 @@ public void setLimit(int index, State state, Object value) { public void setLimit(int index, State state, int value) { if (index == indexEntityCountInfo) { //if it's explicitly set, it's treated as yes no matter the value - printEntityCountInfo = XalanConstants.JDK_YES; + printEntityCountInfo = JdkConstants.JDK_YES; } else { //only update if it shall override if (state.compareTo(states[index]) >= 0) { @@ -377,13 +389,14 @@ public String getStateLiteral(Limit limit) { */ public int getIndex(String propertyName) { for (Limit limit : Limit.values()) { - if (limit.equalsAPIPropertyName(propertyName)) { + // see JDK-8265248, accept both the URL and jdk.xml as prefix + if (limit.is(propertyName)) { //internally, ordinal is used as index return limit.ordinal(); } } //special property to return entity count info - if (propertyName.equals(XalanConstants.JDK_ENTITY_COUNT_INFO)) { + if (ImplPropMap.ENTITYCOUNT.is(propertyName)) { return indexEntityCountInfo; } return -1; @@ -399,7 +412,7 @@ public boolean isSet(int index) { } public boolean printEntityCountInfo() { - return printEntityCountInfo.equals(XalanConstants.JDK_YES); + return printEntityCountInfo.equals(JdkConstants.JDK_YES); } /** * Read from system properties, or those in jaxp.properties diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java index 611120baffc..0d5cfd17edc 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,9 +25,8 @@ package com.sun.org.apache.xalan.internal.utils; - -import com.sun.org.apache.xalan.internal.XalanConstants; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; /** * This class manages security related properties @@ -40,9 +39,9 @@ public final class XMLSecurityPropertyManager extends FeaturePropertyBase { */ public static enum Property { ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD, - XalanConstants.EXTERNAL_ACCESS_DEFAULT), + JdkConstants.EXTERNAL_ACCESS_DEFAULT), ACCESS_EXTERNAL_STYLESHEET(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, - XalanConstants.EXTERNAL_ACCESS_DEFAULT); + JdkConstants.EXTERNAL_ACCESS_DEFAULT); final String name; final String defaultValue; @@ -94,9 +93,9 @@ public int getIndex(String propertyName){ */ private void readSystemProperties() { getSystemProperty(Property.ACCESS_EXTERNAL_DTD, - XalanConstants.SP_ACCESS_EXTERNAL_DTD); + JdkConstants.SP_ACCESS_EXTERNAL_DTD); getSystemProperty(Property.ACCESS_EXTERNAL_STYLESHEET, - XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET); + JdkConstants.SP_ACCESS_EXTERNAL_STYLESHEET); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java index 667b8d215b2..098d3c8a260 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -23,7 +23,6 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; @@ -32,6 +31,7 @@ import com.sun.org.apache.xml.internal.utils.SystemIDResolver; import java.util.Iterator; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; @@ -41,7 +41,7 @@ * @author Morten Jorgensen * @author Erwin Bolwidt * @author Gunnlaugur Briem - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ final class Import extends TopLevelElement { @@ -85,7 +85,7 @@ public void parseContents(final Parser parser) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); String accessError = SecuritySupport.checkAccess(docToLoad, (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), - XalanConstants.ACCESS_EXTERNAL_ALL); + JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java index 9c638140e9e..ecb03df9f1c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -23,7 +23,6 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; @@ -32,6 +31,7 @@ import com.sun.org.apache.xml.internal.utils.SystemIDResolver; import java.util.Iterator; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; @@ -41,7 +41,7 @@ * @author Morten Jorgensen * @author Erwin Bolwidt * @author Gunnlaugur Briem - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ final class Include extends TopLevelElement { @@ -85,7 +85,7 @@ public void parseContents(final Parser parser) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); String accessError = SecuritySupport.checkAccess(docToLoad, (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), - XalanConstants.ACCESS_EXTERNAL_ALL); + JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java index a868485ddcd..f599b4a0990 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -21,7 +21,6 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler; import com.sun.java_cup.internal.runtime.Symbol; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -43,6 +42,7 @@ import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; import jdk.xml.internal.ErrorHandlerProxy; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; @@ -62,7 +62,7 @@ * @author G. Todd Miller * @author Morten Jorgensen * @author Erwin Bolwidt - * @LastModified: July 2019 + * @LastModified: May 2021 */ public class Parser implements Constants, ContentHandler { @@ -502,22 +502,22 @@ public SyntaxTreeNode parse(InputSource input) { String lastProperty = ""; try { XMLSecurityManager securityManager = - (XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER); + (XMLSecurityManager)_xsltc.getProperty(JdkConstants.SECURITY_MANAGER); for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { lastProperty = limit.apiProperty(); reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit)); } if (securityManager.printEntityCountInfo()) { - lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; - reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + lastProperty = JdkConstants.JDK_DEBUG_LIMIT; + reader.setProperty(lastProperty, JdkConstants.JDK_YES); } } catch (SAXException se) { XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se); } // try setting other JDK-impl properties, ignore if not supported - JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkXmlUtils.CDATA_CHUNK_SIZE, - _xsltc.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE), false); + JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkConstants.CDATA_CHUNK_SIZE, + _xsltc.getProperty(JdkConstants.CDATA_CHUNK_SIZE), false); return(parse(reader, input)); } @@ -591,7 +591,7 @@ private SyntaxTreeNode getStylesheet(SyntaxTreeNode root) path = SystemIDResolver.getAbsoluteURI(path); String accessError = SecuritySupport.checkAccess(path, (String)_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET), - XalanConstants.ACCESS_EXTERNAL_ALL); + JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR, SecuritySupport.sanitizePath(_target), accessError, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java index 2cae86c1b92..99d3681c0e7 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -21,7 +21,6 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler; import com.sun.org.apache.bcel.internal.classfile.JavaClass; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; @@ -46,6 +45,7 @@ import java.util.jar.Manifest; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; @@ -58,7 +58,7 @@ * @author G. Todd Miller * @author Morten Jorgensen * @author John Howard (johnh@schemasoft.com) - * @LastModified: July 2019 + * @LastModified: May 2021 */ public final class XSLTC { @@ -140,11 +140,11 @@ public final class XSLTC { /** * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element. */ - private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalStylesheet = JdkConstants.EXTERNAL_ACCESS_DEFAULT; /** * protocols allowed for external DTD references in source file and/or stylesheet. */ - private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalDTD = JdkConstants.EXTERNAL_ACCESS_DEFAULT; private XMLSecurityManager _xmlSecurityManager; @@ -218,13 +218,13 @@ public Object getProperty(String name) { } else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { return _accessExternalDTD; - } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + } else if (name.equals(JdkConstants.SECURITY_MANAGER)) { return _xmlSecurityManager; - } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { + } else if (name.equals(JdkConstants.JDK_EXT_CLASSLOADER)) { return _extensionClassLoader; } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) { return _catalogFeatures; - } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) { + } else if (JdkConstants.CDATA_CHUNK_SIZE.equals(name)) { return _cdataChunkSize; } return null; @@ -241,16 +241,16 @@ public void setProperty(String name, Object value) { } else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { _accessExternalDTD = (String)value; - } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + } else if (name.equals(JdkConstants.SECURITY_MANAGER)) { _xmlSecurityManager = (XMLSecurityManager)value; - } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { + } else if (name.equals(JdkConstants.JDK_EXT_CLASSLOADER)) { _extensionClassLoader = (ClassLoader) value; /* Clear the external extension functions HashMap if extension class loader was changed */ _externalExtensionFunctions.clear(); } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) { _catalogFeatures = (CatalogFeatures)value; - } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) { + } else if (JdkConstants.CDATA_CHUNK_SIZE.equals(name)) { _cdataChunkSize = Integer.parseInt((String)value); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java index e0aa231ff38..bc7194411f0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,6 @@ package com.sun.org.apache.xalan.internal.xsltc.dom; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.DOM; import com.sun.org.apache.xalan.internal.xsltc.DOMCache; import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; @@ -35,11 +34,12 @@ import com.sun.org.apache.xml.internal.utils.SystemIDResolver; import java.io.FileNotFoundException; import javax.xml.transform.stream.StreamSource; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; /** * @author Morten Jorgensen - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ public final class LoadDocument { @@ -194,7 +194,7 @@ private static DTMAxisIterator document(String uri, String base, throw new TransletException(e); } } else { - String accessError = SecuritySupport.checkAccess(uri, translet.getAllowedProtocols(), XalanConstants.ACCESS_EXTERNAL_ALL); + String accessError = SecuritySupport.checkAccess(uri, translet.getAllowedProtocols(), JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR, SecuritySupport.sanitizePath(uri), accessError); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java index 62c786b03ae..58b8f433e8e 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,6 @@ package com.sun.org.apache.xalan.internal.xsltc.runtime; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.DOM; import com.sun.org.apache.xalan.internal.xsltc.DOMCache; import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM; @@ -44,6 +43,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Templates; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -54,7 +54,7 @@ * @author Morten Jorgensen * @author G. Todd Miller * @author John Howard, JohnH@schemasoft.com - * @LastModified: Aug 2019 + * @LastModified: May 2021 */ public abstract class AbstractTranslet implements Translet { @@ -65,7 +65,7 @@ public abstract class AbstractTranslet implements Translet { public String _encoding = "UTF-8"; public boolean _omitHeader = false; public String _standalone = null; - //see OutputPropertiesFactory.ORACLE_IS_STANDALONE + //see JdkConstants.SP_XSLTC_IS_Standalone public boolean _isStandalone = false; public String _doctypePublic = null; public String _doctypeSystem = null; @@ -114,7 +114,7 @@ public abstract class AbstractTranslet implements Translet { /** * protocols allowed for external references set by the stylesheet processing instruction, Document() function, Import and Include element. */ - private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalStylesheet = JdkConstants.EXTERNAL_ACCESS_DEFAULT; /************************************************************************ * Debugging diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java index c903f9b42d5..6017ebe57eb 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException; import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser; import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader; @@ -36,6 +35,7 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.TemplatesHandler; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -47,7 +47,7 @@ * Implementation of a JAXP1.1 TemplatesHandler * @author Morten Jorgensen * @author Santiago Pericas-Geertsen - * @LastModified: July 2019 + * @LastModified: May 2021 */ public class TemplatesHandlerImpl implements ContentHandler, TemplatesHandler, SourceLoader @@ -107,8 +107,8 @@ protected TemplatesHandlerImpl(int indentNumber, TransformerFactoryImpl tfactory (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, (String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD)); - xsltc.setProperty(XalanConstants.SECURITY_MANAGER, - tfactory.getAttribute(XalanConstants.SECURITY_MANAGER)); + xsltc.setProperty(JdkConstants.SECURITY_MANAGER, + tfactory.getAttribute(JdkConstants.SECURITY_MANAGER)); if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING))) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java index c139c4b4fcf..2aba5af6041 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -23,7 +23,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.xsltc.DOM; import com.sun.org.apache.xalan.internal.xsltc.Translet; @@ -60,6 +59,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.URIResolver; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; @@ -68,7 +68,7 @@ * @author G. Todd Millerj * @author Jochen Cordes * @author Santiago Pericas-Geertsen - * @LastModified: May 2020 + * @LastModified: May 2021 */ public final class TemplatesImpl implements Templates, Serializable { static final long serialVersionUID = 673094361519270707L; @@ -149,7 +149,7 @@ public final class TemplatesImpl implements Templates, Serializable { /** * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element. */ - private transient String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private transient String _accessExternalStylesheet = JdkConstants.EXTERNAL_ACCESS_DEFAULT; /** * @serialField _name String The Name of the main class diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java index cc3bfcb5212..8ca1095e019 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,7 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; -import com.sun.org.apache.xalan.internal.XalanConstants; +import jdk.xml.internal.JdkConstants; import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; @@ -71,8 +71,11 @@ import javax.xml.transform.stax.*; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import jdk.xml.internal.JdkProperty; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import jdk.xml.internal.JdkProperty.State; import jdk.xml.internal.SecuritySupport; import jdk.xml.internal.TransformErrorListener; import org.xml.sax.InputSource; @@ -85,7 +88,7 @@ * @author G. Todd Miller * @author Morten Jorgensen * @author Santiago Pericas-Geertsen - * @LastModified: Aug 2019 + * @LastModified: May 2021 */ public class TransformerFactoryImpl extends SAXTransformerFactory implements SourceLoader @@ -230,18 +233,18 @@ public PIParamWrapper(String media, String title, String charset) { * protocols allowed for external references set by the stylesheet * processing instruction, Import and Include element. */ - private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalStylesheet = JdkConstants.EXTERNAL_ACCESS_DEFAULT; /** * protocols allowed for external DTD references in source file and/or stylesheet. */ - private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalDTD = JdkConstants.EXTERNAL_ACCESS_DEFAULT; private XMLSecurityPropertyManager _xmlSecurityPropertyMgr; private XMLSecurityManager _xmlSecurityManager; private final JdkXmlFeatures _xmlFeatures; - private ClassLoader _extensionClassLoader = null; + private JdkProperty _extensionClassLoader = null; // Unmodifiable view of external extension function from xslt compiler // It will be populated by user-specified extension functions during the @@ -257,7 +260,7 @@ public PIParamWrapper(String media, String title, String charset) { String _catalogPrefer = null; String _catalogResolve = null; - int _cdataChunkSize = JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT; + int _cdataChunkSize = JdkConstants.CDATA_CHUNK_SIZE_DEFAULT; /** * javax.xml.transform.sax.TransformerFactory implementation. @@ -282,6 +285,7 @@ public TransformerFactoryImpl() { _xmlSecurityManager = new XMLSecurityManager(true); //Unmodifiable hash map with loaded external extension functions _xsltcExtensionFunctions = null; + _extensionClassLoader = new JdkProperty<>(ImplPropMap.EXTCLSLOADER, null, State.DEFAULT); } public Map> getExternalExtensionsMap() { @@ -355,10 +359,10 @@ else if (name.equals(ENABLE_INLINING)) { return Boolean.TRUE; else return Boolean.FALSE; - } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + } else if (name.equals(JdkConstants.SECURITY_MANAGER)) { return _xmlSecurityManager; - } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { - return _extensionClassLoader; + } else if (ImplPropMap.EXTCLSLOADER.is(name)) { + return (_extensionClassLoader == null) ? null : _extensionClassLoader.getValue(); } else if (JdkXmlUtils.CATALOG_FILES.equals(name)) { return _catalogFiles; } else if (JdkXmlUtils.CATALOG_DEFER.equals(name)) { @@ -369,7 +373,7 @@ else if (name.equals(ENABLE_INLINING)) { return _catalogResolve; } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) { return buildCatalogFeatures(); - } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) { + } else if (ImplPropMap.CDATACHUNKSIZE.is(name)) { return _cdataChunkSize; } @@ -486,9 +490,9 @@ else if (value instanceof Integer) { return; } } - else if ( name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { + else if (ImplPropMap.EXTCLSLOADER.is(name)) { if (value instanceof ClassLoader) { - _extensionClassLoader = (ClassLoader) value; + _extensionClassLoader.setValue(name, (ClassLoader)value, State.APIPROPERTY); return; } else { final ErrorMsg err @@ -511,13 +515,13 @@ else if ( name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { _catalogResolve = (String) value; cfBuilder = CatalogFeatures.builder().with(Feature.RESOLVE, _catalogResolve); return; - } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) { + } else if (ImplPropMap.CDATACHUNKSIZE.is(name)) { _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize); return; } if (_xmlSecurityManager != null && - _xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + _xmlSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value)) { return; } @@ -558,6 +562,7 @@ else if ( name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { * @throws NullPointerException If the name parameter is null. */ @Override + @SuppressWarnings("deprecation") public void setFeature(String name, boolean value) throws TransformerConfigurationException { @@ -578,9 +583,9 @@ else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { // set external access restriction when FSP is explicitly set if (value) { _xmlSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_DTD, - FeaturePropertyBase.State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP); + FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); _xmlSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_STYLESHEET, - FeaturePropertyBase.State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP); + FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); _accessExternalDTD = _xmlSecurityPropertyMgr.getValue( Property.ACCESS_EXTERNAL_DTD); _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue( @@ -589,20 +594,19 @@ else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { if (value && _xmlFeatures != null) { _xmlFeatures.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION, - JdkXmlFeatures.State.FSP, false); + JdkProperty.State.FSP, false); } } else { - if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { + if (name.equals(JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { // for compatibility, in secure mode, useServicesMechanism is determined by the constructor if (_isSecureMode) { return; } } if (_xmlFeatures != null && - _xmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) { - if (name.equals(JdkXmlUtils.OVERRIDE_PARSER) || - name.equals(JdkXmlFeatures.ORACLE_FEATURE_SERVICE_MECHANISM)) { + _xmlFeatures.setFeature(name, JdkProperty.State.APIPROPERTY, value)) { + if (ImplPropMap.OVERRIDEPARSER.is(name)) { _overrideDefaultParser = _xmlFeatures.getFeature( JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER); } @@ -625,6 +629,7 @@ else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { * @return 'true' if feature is supported, 'false' if not */ @Override + @SuppressWarnings("deprecation") public boolean getFeature(String name) { // All supported features should be listed here String[] features = { @@ -638,7 +643,7 @@ public boolean getFeature(String name) { StreamResult.FEATURE, SAXTransformerFactory.FEATURE, SAXTransformerFactory.FEATURE_XMLFILTER, - XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM + JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM }; // feature name cannot be null @@ -966,8 +971,9 @@ public Templates newTemplates(Source source) if (!_isNotSecureProcessing) xsltc.setSecureProcessing(true); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet); xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); - xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager); - xsltc.setProperty(XalanConstants.JDK_EXTENSION_CLASSLOADER, _extensionClassLoader); + xsltc.setProperty(JdkConstants.SECURITY_MANAGER, _xmlSecurityManager); + xsltc.setProperty(JdkConstants.JDK_EXT_CLASSLOADER, + (_extensionClassLoader == null) ? null : _extensionClassLoader.getValue()); // set Catalog features buildCatalogFeatures(); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java index 58d49da59a6..2c146e71942 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java @@ -20,7 +20,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.DOM; import com.sun.org.apache.xalan.internal.xsltc.DOMCache; @@ -81,8 +80,13 @@ import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import jdk.xml.internal.JdkConstants; +import static jdk.xml.internal.JdkConstants.SP_XSLTC_IS_STANDALONE; +import jdk.xml.internal.JdkProperty; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import jdk.xml.internal.JdkProperty.State; import jdk.xml.internal.SecuritySupport; import jdk.xml.internal.TransformErrorListener; import org.xml.sax.ContentHandler; @@ -95,7 +99,7 @@ * @author Morten Jorgensen * @author G. Todd Miller * @author Santiago Pericas-Geertsen - * @LastModified: Feb 2021 + * @LastModified: May 2021 */ public final class TransformerImpl extends Transformer implements DOMCache @@ -211,7 +215,7 @@ public final class TransformerImpl extends Transformer /** * protocols allowed for external DTD references in source file and/or stylesheet. */ - private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalDTD = JdkConstants.EXTERNAL_ACCESS_DEFAULT; private XMLSecurityManager _securityManager; /** @@ -228,7 +232,10 @@ public final class TransformerImpl extends Transformer // Catalog is enabled by default boolean _useCatalog = true; - int _cdataChunkSize = JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT; + int _cdataChunkSize = JdkConstants.CDATA_CHUNK_SIZE_DEFAULT; + + // OutputProperty/Impl-specific property: xsltcIsStandalone + JdkProperty _xsltcIsStandalone; /** * This class wraps an ErrorListener into a MessageHandler in order to @@ -279,23 +286,23 @@ protected TransformerImpl(Translet translet, Properties outputProperties, _translet.setMessageHandler(new MessageHandler(_errorListener)); } _properties = createOutputProperties(outputProperties); - String v = SecuritySupport.getJAXPSystemProperty(OutputPropertiesFactory.SP_IS_STANDALONE); - if (v != null) { - _properties.setProperty(OutputPropertiesFactory.JDK_IS_STANDALONE, v); - } + String isStandalone = SecuritySupport.getJAXPSystemProperty( + String.class, SP_XSLTC_IS_STANDALONE, "no"); + _xsltcIsStandalone = new JdkProperty<>(ImplPropMap.XSLTCISSTANDALONE, + isStandalone, State.DEFAULT); _propertiesClone = (Properties) _properties.clone(); _indentNumber = indentNumber; _tfactory = tfactory; _overrideDefaultParser = _tfactory.overrideDefaultParser(); _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD); - _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER); + _securityManager = (XMLSecurityManager)_tfactory.getAttribute(JdkConstants.SECURITY_MANAGER); _readerManager = XMLReaderManager.getInstance(_overrideDefaultParser); _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD); _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing); - _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager); - _cdataChunkSize = JdkXmlUtils.getValue(_tfactory.getAttribute(JdkXmlUtils.CDATA_CHUNK_SIZE), - JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); - _readerManager.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, _cdataChunkSize); + _readerManager.setProperty(JdkConstants.SECURITY_MANAGER, _securityManager); + _cdataChunkSize = JdkXmlUtils.getValue(_tfactory.getAttribute(JdkConstants.CDATA_CHUNK_SIZE), + JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); + _readerManager.setProperty(JdkConstants.CDATA_CHUNK_SIZE, _cdataChunkSize); _useCatalog = _tfactory.getFeature(XMLConstants.USE_CATALOG); if (_useCatalog) { @@ -905,6 +912,9 @@ public Properties getOutputProperties() { public String getOutputProperty(String name) throws IllegalArgumentException { + if (ImplPropMap.XSLTCISSTANDALONE.is(name)) { + return _xsltcIsStandalone.getValue(); + } if (!validOutputProperty(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name); throw new IllegalArgumentException(err.toString()); @@ -966,7 +976,12 @@ public void setOutputProperty(String name, String value) ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name); throw new IllegalArgumentException(err.toString()); } - _properties.setProperty(name, value); + + if (ImplPropMap.XSLTCISSTANDALONE.is(name)) { + _xsltcIsStandalone.setValue(name, value, State.APIPROPERTY); + } else { + _properties.setProperty(name, value); + } } /** @@ -1037,11 +1052,9 @@ else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { } } } - else if (isStandaloneProperty(name)) { - if (value != null && value.equals("yes")) { - translet._isStandalone = true; - } - } + } + if (_xsltcIsStandalone.getValue().equals("yes")) { + translet._isStandalone = true; } } @@ -1101,11 +1114,6 @@ else if (name.equals(OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL +"in handler.setIndentAmount(Integer.parseInt(value)); } } - else if (isStandaloneProperty(name)) { - if (value != null && value.equals("yes")) { - handler.setIsStandalone(true); - } - } else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { if (value != null) { StringTokenizer e = new StringTokenizer(value); @@ -1144,6 +1152,10 @@ else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { if (doctypePublic != null || doctypeSystem != null) { handler.setDoctype(doctypeSystem, doctypePublic); } + + if (_xsltcIsStandalone.getValue().equals("yes")) { + handler.setIsStandalone(true); + } } /** @@ -1219,20 +1231,10 @@ private boolean validOutputProperty(String name) { name.equals(OutputKeys.OMIT_XML_DECLARATION) || name.equals(OutputKeys.STANDALONE) || name.equals(OutputKeys.VERSION) || - isStandaloneProperty(name) || + ImplPropMap.XSLTCISSTANDALONE.is(name) || name.charAt(0) == '{'); } - /** - * Checks whether the property requested is the isStandalone property. Both - * the new and legacy property names are supported. - * @param name the property name - * @return true if the property is "isStandalone", false otherwise - */ - private boolean isStandaloneProperty(String name) { - return (name.equals(OutputPropertiesFactory.JDK_IS_STANDALONE) || - name.equals(OutputPropertiesFactory.ORACLE_IS_STANDALONE)); - } /** * Checks if a given output property is default (2nd layer only) */ diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java index 8c6f10344d4..1f4b02a1264 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -37,9 +36,9 @@ import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; -import jdk.xml.internal.SecuritySupport; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -51,6 +50,8 @@ * @author Santiago Pericas-Geertsen * * Added Catalog Support for URI resolution + * + * @LastModified: May 2021 */ @SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory public final class Util { @@ -103,13 +104,13 @@ public static InputSource getInputSource(XSLTC xsltc, Source source) JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD, xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true); - JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkXmlUtils.CDATA_CHUNK_SIZE, - xsltc.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE), false); + JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkConstants.CDATA_CHUNK_SIZE, + xsltc.getProperty(JdkConstants.CDATA_CHUNK_SIZE), false); String lastProperty = ""; try { XMLSecurityManager securityManager = - (XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER); + (XMLSecurityManager)xsltc.getProperty(JdkConstants.SECURITY_MANAGER); if (securityManager != null) { for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) { lastProperty = limit.apiProperty(); @@ -117,8 +118,8 @@ public static InputSource getInputSource(XSLTC xsltc, Source source) securityManager.getLimitValueAsString(limit)); } if (securityManager.printEntityCountInfo()) { - lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; - reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + lastProperty = JdkConstants.JDK_DEBUG_LIMIT; + reader.setProperty(lastProperty, JdkConstants.JDK_YES); } } } catch (SAXException se) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java index ab3dc578d5a..e84c4fff97a 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java @@ -54,6 +54,7 @@ import java.util.StringTokenizer; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMErrorHandler; @@ -70,7 +71,7 @@ * * @author Elena Litani, IBM * @author Neeraj Bajaj, Sun Microsystems. - * @LastModified: Apr 2019 + * @LastModified: May 2021 */ public class DOMConfigurationImpl extends ParserConfigurationSettings implements XMLParserConfiguration, DOMConfiguration { @@ -213,7 +214,7 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; // // Data @@ -327,7 +328,7 @@ protected DOMConfigurationImpl(SymbolTable symbolTable, NAMESPACE_GROWTH, TOLERATE_DUPLICATES, XMLConstants.USE_CATALOG, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); @@ -351,7 +352,7 @@ protected DOMConfigurationImpl(SymbolTable symbolTable, setFeature(NAMESPACE_GROWTH, false); setFeature(TOLERATE_DUPLICATES, false); setFeature(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); - setFeature(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + setFeature(JdkConstants.OVERRIDE_PARSER, JdkConstants.OVERRIDE_PARSER_DEFAULT); // add default recognized properties final String[] recognizedProperties = { @@ -376,7 +377,7 @@ protected DOMConfigurationImpl(SymbolTable symbolTable, JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; addRecognizedProperties(recognizedProperties); @@ -415,7 +416,7 @@ protected DOMConfigurationImpl(SymbolTable symbolTable, setProperty(SECURITY_MANAGER, new XMLSecurityManager(true)); - setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, + setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); // add message formatters @@ -455,7 +456,7 @@ protected DOMConfigurationImpl(SymbolTable symbolTable, setProperty(f.getPropertyName(), null); } - setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + setProperty(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); } // (SymbolTable) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java index 85ed8281c6d..5efe9abee9b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -30,7 +30,7 @@ * * @author Andy Clark, IBM * - * @LastModified: Oct 2017 + * @LastModified: May 2021 */ public final class Constants { @@ -141,23 +141,6 @@ public final class Constants { public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing"; - // Oracle Feature: - /** - *

Use Service Mechanism

- * - *
    - *
  • - * {@code true} instruct an object to use service mechanism to - * find a service implementation. This is the default behavior. - *
  • - *
  • - * {@code false} instruct an object to skip service mechanism and - * use the default implementation for that service. - *
  • - *
- */ - public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism"; - /** Document XML version property ("document-xml-version"). */ public static final String DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version"; @@ -180,157 +163,6 @@ public final class Constants { public static final String JAXPAPI_PROPERTY_PREFIX = "http://javax.xml.XMLConstants/property/"; - /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ - public static final String ORACLE_JAXP_PROPERTY_PREFIX = - "http://www.oracle.com/xml/jaxp/properties/"; - - public static final String XML_SECURITY_PROPERTY_MANAGER = - ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; - - //System Properties corresponding to ACCESS_EXTERNAL_* properties - public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; - public static final String SP_ACCESS_EXTERNAL_SCHEMA = "javax.xml.accessExternalSchema"; - //all access keyword - public static final String ACCESS_EXTERNAL_ALL = "all"; - - /** - * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true - */ - public static final String EXTERNAL_ACCESS_DEFAULT_FSP = ""; - - /** - * FEATURE_SECURE_PROCESSING (FSP) is true by default - */ - public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; - - // - // Implementation limits: corresponding System Properties of the above - // API properties - // - /** - * JDK entity expansion limit; Note that the existing system property - * "entityExpansionLimit" with no prefix is still observed - */ - public static final String JDK_ENTITY_EXPANSION_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; - - /** - * JDK element attribute limit; Note that the existing system property - * "elementAttributeLimit" with no prefix is still observed - */ - public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; - - /** - * JDK maxOccur limit; Note that the existing system property - * "maxOccurLimit" with no prefix is still observed - */ - public static final String JDK_MAX_OCCUR_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit"; - - /** - * JDK total entity size limit - */ - public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit"; - - /** - * JDK maximum general entity size limit - */ - public static final String JDK_GENERAL_ENTITY_SIZE_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit"; - - /** - * JDK node count limit in entities that limits the total number of nodes - * in all of entity references. - */ - public static final String JDK_ENTITY_REPLACEMENT_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "entityReplacementLimit"; - - /** - * JDK maximum parameter entity size limit - */ - public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit"; - /** - * JDK maximum XML name limit - */ - public static final String JDK_XML_NAME_LIMIT = - ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit"; - - /** - * JDK maxElementDepth limit - */ - public static final String JDK_MAX_ELEMENT_DEPTH = - ORACLE_JAXP_PROPERTY_PREFIX + "maxElementDepth"; - - /** - * JDK property to allow printing out information from the limit analyzer - */ - public static final String JDK_ENTITY_COUNT_INFO = - ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo"; - - // - // Implementation limits: API properties - // - /** - * JDK entity expansion limit; Note that the existing system property - * "entityExpansionLimit" with no prefix is still observed - */ - public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit"; - - /** - * JDK element attribute limit; Note that the existing system property - * "elementAttributeLimit" with no prefix is still observed - */ - public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit"; - - /** - * JDK maxOccur limit; Note that the existing system property - * "maxOccurLimit" with no prefix is still observed - */ - public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit"; - - /** - * JDK total entity size limit - */ - public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit"; - - /** - * JDK maximum general entity size limit - */ - public static final String SP_GENERAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit"; - - /** - * JDK node count limit in entities that limits the total number of nodes - * in all of entity references. - */ - public static final String SP_ENTITY_REPLACEMENT_LIMIT = "jdk.xml.entityReplacementLimit"; - - /** - * JDK maximum parameter entity size limit - */ - public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit"; - /** - * JDK maximum XML name limit - */ - public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit"; - - /** - * JDK maxElementDepth limit - */ - public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth"; - - //legacy System Properties - public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; - public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; - public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; - - /** - * A string "yes" that can be used for properties such as getEntityCountInfo - */ - public static final String JDK_YES = "yes"; - // // DOM features // diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java index dfebb2c1e93..4fc9a71b157 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -34,6 +34,8 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLResolver; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import jdk.xml.internal.JdkXmlUtils; /** @@ -59,7 +61,7 @@ public class PropertyManager { /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; HashMap supportedProps = new HashMap<>(); @@ -144,7 +146,7 @@ private void initConfigurableReaderProperties(){ supportedProps.put(f.getPropertyName(), null); } - supportedProps.put(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + supportedProps.put(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); } private void initWriterProps(){ @@ -166,7 +168,10 @@ public boolean containsProperty(String property){ } public Object getProperty(String property){ - return supportedProps.get(property); + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (fSecurityManager != null) ? + fSecurityManager.getLimitAsString(property) : null; + return propertyValue != null ? propertyValue : supportedProps.get(property); } public void setProperty(String property, Object value){ @@ -198,19 +203,19 @@ else if(property.equals(XMLInputFactory.RESOLVER)){ supportedProps.put(Constants.SECURITY_MANAGER, fSecurityManager); return; } - if (property.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (property.equals(JdkConstants.XML_SECURITY_PROPERTY_MANAGER)) { if (value == null) { fSecurityPropertyMgr = new XMLSecurityPropertyManager(); } else { fSecurityPropertyMgr = (XMLSecurityPropertyManager)value; } - supportedProps.put(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + supportedProps.put(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); return; } //check if the property is managed by security manager if (fSecurityManager == null || - !fSecurityManager.setLimit(property, XMLSecurityManager.State.APIPROPERTY, value)) { + !fSecurityManager.setLimit(property, JdkProperty.State.APIPROPERTY, value)) { //check if the property is managed by security property manager if (fSecurityPropertyMgr == null || !fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index 02a6bd30c57..c7e2eb880fd 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. */ /* @@ -53,6 +53,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.events.XMLEvent; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; @@ -73,7 +74,7 @@ * @author Eric Ye, IBM * @author Sunitha Reddy, SUN Microsystems * - * @LastModified: Jan 2019 + * @LastModified: May 2021 */ public class XMLDocumentFragmentScannerImpl extends XMLScanner @@ -169,12 +170,12 @@ public class XMLDocumentFragmentScannerImpl /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** access external dtd: file protocol * For DOM/SAX, the secure feature is set to true by default */ - final static String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT; + final static String EXTERNAL_ACCESS_DEFAULT = JdkConstants.EXTERNAL_ACCESS_DEFAULT; // recognized features and properties @@ -208,7 +209,7 @@ public class XMLDocumentFragmentScannerImpl JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; /** Property defaults. */ @@ -221,7 +222,7 @@ public class XMLDocumentFragmentScannerImpl null, null, null, - JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT + JdkConstants.CDATA_CHUNK_SIZE_DEFAULT }; @@ -627,8 +628,8 @@ public void reset(XMLComponentManager componentManager) fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false); - fChunkSize = JdkXmlUtils.getValue(componentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE), - JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + fChunkSize = JdkXmlUtils.getValue(componentManager.getProperty(JdkConstants.CDATA_CHUNK_SIZE), + JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); resetCommon(); //fEntityManager.test(); @@ -674,8 +675,8 @@ public void reset(PropertyManager propertyManager){ fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER); - fChunkSize = JdkXmlUtils.getValue(propertyManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE), - JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + fChunkSize = JdkXmlUtils.getValue(propertyManager.getProperty(JdkConstants.CDATA_CHUNK_SIZE), + JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); resetCommon(); } // reset(XMLComponentManager) @@ -2012,7 +2013,7 @@ public String getDriverName(Driver driver) { String checkAccess(String systemId, String allowedProtocols) throws IOException { String baseSystemId = fEntityScanner.getBaseSystemId(); String expandedSystemId = XMLEntityManager.expandSystemId(systemId, baseSystemId, fStrictURI); - return SecuritySupport.checkAccess(expandedSystemId, allowedProtocols, Constants.ACCESS_EXTERNAL_ALL); + return SecuritySupport.checkAccess(expandedSystemId, allowedProtocols, JdkConstants.ACCESS_EXTERNAL_ALL); } // diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java index 38c32f1c489..7dbdf607513 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -58,6 +58,7 @@ import javax.xml.catalog.CatalogResolver; import javax.xml.stream.XMLInputFactory; import javax.xml.transform.Source; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; import org.xml.sax.InputSource; @@ -90,7 +91,7 @@ * @author K.Venugopal SUN Microsystems * @author Neeraj Bajaj SUN Microsystems * @author Sunitha Reddy SUN Microsystems - * @LastModified: Apr 2019 + * @LastModified: May 2021 */ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { @@ -178,10 +179,10 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** access external dtd: file protocol */ - static final String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT; + static final String EXTERNAL_ACCESS_DEFAULT = JdkConstants.EXTERNAL_ACCESS_DEFAULT; // recognized features and properties @@ -220,7 +221,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; /** Property defaults. */ @@ -236,7 +237,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { null, null, null, - JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT + JdkConstants.CDATA_CHUNK_SIZE_DEFAULT }; private static final String XMLEntity = "[xml]".intern(); @@ -1313,7 +1314,7 @@ public void startEntity(boolean isGE, String entityName, boolean literal) if (!fISCreatedByResolver) { //let the not-LoadExternalDTD or not-SupportDTD process to handle the situation if (fLoadExternalDTD) { - String accessError = SecuritySupport.checkAccess(expandedSystemId, fAccessExternalDTD, Constants.ACCESS_EXTERNAL_ALL); + String accessError = SecuritySupport.checkAccess(expandedSystemId, fAccessExternalDTD, JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { fErrorReporter.reportError(this.getEntityScanner(),XMLMessageFormatter.XML_DOMAIN, "AccessExternalEntity", @@ -1630,7 +1631,7 @@ public void reset(XMLComponentManager componentManager) fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null); fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null); fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); - entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT); + entityExpansionIndex = fSecurityManager.getIndex(JdkConstants.SP_ENTITY_EXPANSION_LIMIT); //StAX Property fSupportDTD = true; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java index 1abb1a9389d..7c141980c79 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -75,6 +75,7 @@ import java.util.StringTokenizer; import java.util.WeakHashMap; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; @@ -102,7 +103,7 @@ * @xerces.internal * * @author Neil Graham, IBM - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElementDeclHelper, @@ -161,7 +162,7 @@ public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElemen protected static final String SCHEMA_DV_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY; - protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER; + protected static final String OVERRIDE_PARSER = JdkConstants.OVERRIDE_PARSER; // recognized features: private static final String[] RECOGNIZED_FEATURES = { @@ -226,7 +227,7 @@ public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElemen /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Property identifier: access to external dtd */ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD; @@ -253,7 +254,7 @@ public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElemen JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; // Data @@ -283,7 +284,7 @@ public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElemen private final CMNodeFactory fNodeFactory = new CMNodeFactory(); //component mgr will be set later private CMBuilder fCMBuilder; private XSDDescription fXSDDescription = new XSDDescription(); - private String faccessExternalSchema = Constants.EXTERNAL_ACCESS_DEFAULT; + private String faccessExternalSchema = JdkConstants.EXTERNAL_ACCESS_DEFAULT; private WeakHashMap fJAXPCache; private Locale fLocale = Locale.getDefault(); @@ -607,7 +608,7 @@ SchemaGrammar loadSchema(XSDDescription desc, XMLInputSource source, } if (desc.isExternal() && !source.isCreatedByResolver()) { - String accessError = SecuritySupport.checkAccess(desc.getExpandedSystemId(), faccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL); + String accessError = SecuritySupport.checkAccess(desc.getExpandedSystemId(), faccessExternalSchema, JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { throw new XNIException(fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "schema_reference.access", diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java index f98baa2c91b..7bbfb573adb 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -87,6 +87,7 @@ import java.util.Stack; import java.util.Vector; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; /** @@ -111,7 +112,7 @@ * @author Elena Litani IBM * @author Andy Clark IBM * @author Neeraj Bajaj, Sun Microsystems, inc. - * @LastModified: Apr 2020 + * @LastModified: May 2021 */ public class XMLSchemaValidator implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler, XSElementDeclHelper { @@ -263,9 +264,9 @@ public class XMLSchemaValidator /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; - protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER; + protected static final String OVERRIDE_PARSER = JdkConstants.OVERRIDE_PARSER; protected static final String USE_CATALOG = XMLConstants.USE_CATALOG; @@ -323,7 +324,7 @@ public class XMLSchemaValidator null, null, null, - JdkXmlUtils.OVERRIDE_PARSER_DEFAULT, + JdkConstants.OVERRIDE_PARSER_DEFAULT, JdkXmlUtils.USE_CATALOG_DEFAULT }; @@ -346,13 +347,13 @@ public class XMLSchemaValidator JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; /** Property defaults. */ private static final Object[] PROPERTY_DEFAULTS = { null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT }; + null, null, null, null, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT }; // this is the number of valuestores of each kind // we expect an element to have. It's almost diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java index fdc8396d95c..e9d20096db2 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -50,15 +50,15 @@ import java.io.IOException; import java.util.Locale; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; -import jdk.xml.internal.SecuritySupport; /** * @xerces.internal * * @author Rahul Srivastava, Sun Microsystems Inc. * - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ public class SchemaParsingConfig extends BasicParserConfiguration implements XMLPullParserConfiguration { @@ -305,7 +305,7 @@ public SchemaParsingConfig(SymbolTable symbolTable, LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS, NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS, XMLConstants.USE_CATALOG, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); @@ -320,7 +320,7 @@ public SchemaParsingConfig(SymbolTable symbolTable, fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE); fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE); fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); - fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + fFeatures.put(JdkConstants.OVERRIDE_PARSER, JdkConstants.OVERRIDE_PARSER_DEFAULT); // add default recognized properties final String[] recognizedProperties = { @@ -339,7 +339,7 @@ public SchemaParsingConfig(SymbolTable symbolTable, JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; addRecognizedProperties(recognizedProperties); @@ -371,7 +371,7 @@ public SchemaParsingConfig(SymbolTable symbolTable, fValidationManager = new ValidationManager(); fProperties.put(VALIDATION_MANAGER, fValidationManager); - fProperties.put(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + fProperties.put(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); fVersionDetector = new XMLVersionDetector(); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java index 2faf06ea2da..911f39e5f71 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -106,6 +106,7 @@ import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; import org.w3c.dom.Document; @@ -130,7 +131,7 @@ * @author Neil Graham, IBM * @author Pavani Mukthipudi, Sun Microsystems * - * @LastModified: Apr 2019 + * @LastModified: May 2021 */ @SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory public class XSDHandler { @@ -225,7 +226,7 @@ public class XSDHandler { /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; protected static final boolean DEBUG_NODE_POOL = false; @@ -2214,7 +2215,7 @@ private Element getSchemaDocument(String schemaNamespace, XMLInputSource schemaS if ((!schemaSource.isCreatedByResolver()) && (referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE || referType == XSDDescription.CONTEXT_REDEFINE)) { - String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL); + String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, JdkConstants.ACCESS_EXTERNAL_ALL); if (accessError != null) { reportSchemaFatalError("schema_reference.access", new Object[] { SecuritySupport.sanitizePath(schemaId), accessError }, @@ -3665,9 +3666,9 @@ public void reset(XMLComponentManager componentManager) { fAccessExternalSchema = fSecurityPropertyMgr.getValue( XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA); - fOverrideDefaultParser = componentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER); - fSchemaParser.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser); - fEntityManager.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser); + fOverrideDefaultParser = componentManager.getFeature(JdkConstants.OVERRIDE_PARSER); + fSchemaParser.setFeature(JdkConstants.OVERRIDE_PARSER, fOverrideDefaultParser); + fEntityManager.setFeature(JdkConstants.OVERRIDE_PARSER, fOverrideDefaultParser); // Passing the Catalog settings to the parser fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG); fSchemaParser.setFeature(XMLConstants.USE_CATALOG, fUseCatalog); @@ -3685,10 +3686,10 @@ public void reset(XMLComponentManager componentManager) { componentManager.getProperty(f.getPropertyName())); } - fSchemaParser.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, - componentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE)); - fEntityManager.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, - componentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE)); + fSchemaParser.setProperty(JdkConstants.CDATA_CHUNK_SIZE, + componentManager.getProperty(JdkConstants.CDATA_CHUNK_SIZE)); + fEntityManager.setProperty(JdkConstants.CDATA_CHUNK_SIZE, + componentManager.getProperty(JdkConstants.CDATA_CHUNK_SIZE)); } // reset(XMLComponentManager) @@ -4013,8 +4014,7 @@ else if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) { ","+oldName:currSchema.fTargetNamespace+","+oldName; int attGroupRefsCount = changeRedefineGroup(processedBaseName, componentType, newName, child, currSchema); if (attGroupRefsCount > 1) { - reportSchemaError("src-redefine.7.1", - new Object []{attGroupRefsCount}, child); + reportSchemaError("src-redefine.7.1", new Object []{attGroupRefsCount}, child); } else if (attGroupRefsCount == 1) { // return true; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java index db5ab1c334f..69c0e5ea133 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,6 +22,8 @@ import com.sun.org.apache.xerces.internal.parsers.DOMParser; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; +import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; @@ -29,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.validation.Schema; +import jdk.xml.internal.JdkProperty; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; @@ -36,6 +39,7 @@ /** * @author Rajiv Mordani * @author Edwin Goei + * @LastModified: May 2021 */ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { /** These are DocumentBuilderFactory attributes not DOM attributes */ @@ -49,6 +53,10 @@ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { */ private boolean fSecureProcess = true; + // used to verify attributes + XMLSecurityManager fSecurityManager = new XMLSecurityManager(true); + XMLSecurityPropertyManager fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + /** * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder} * using the currently configured parameters. @@ -104,6 +112,20 @@ public void setAttribute(String name, Object value) attributes = new HashMap<>(); } + //check if the property is managed by security manager + String pName; + if ((pName = fSecurityManager.find(name)) != null) { + // as the qName is deprecated, let the manager decide whether the + // value shall be changed + fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value); + attributes.put(pName, fSecurityManager.getLimitAsString(pName)); + // no need to create a DocumentBuilderImpl + return; + } else if ((pName = fSecurityPropertyMgr.find(name)) != null) { + attributes.put(pName, value); + return; + } + attributes.put(name, value); // Test the attribute name by possibly throwing an exception @@ -122,6 +144,15 @@ public void setAttribute(String name, Object value) public Object getAttribute(String name) throws IllegalArgumentException { + + //check if the property is managed by security manager + String pName; + if ((pName = fSecurityManager.find(name)) != null) { + return attributes.get(pName); + } else if ((pName = fSecurityPropertyMgr.find(name)) != null) { + return attributes.get(pName); + } + // See if it's in the attributes Map if (attributes != null) { Object val = attributes.get(name); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java index 98f2daa3da5..d8783300539 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -45,6 +45,8 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.xml.sax.EntityResolver; @@ -57,6 +59,7 @@ /** * @author Rajiv Mordani * @author Edwin Goei + * @LastModified: May 2021 */ public class DocumentBuilderImpl extends DocumentBuilder implements JAXPConstants @@ -99,7 +102,7 @@ public class DocumentBuilderImpl extends DocumentBuilder /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** property identifier: access external dtd. */ public static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD; @@ -186,9 +189,9 @@ public class DocumentBuilderImpl extends DocumentBuilder Boolean temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING); if (temp != null && temp) { fSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_DTD, - State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); fSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_SCHEMA, - State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); } } } @@ -296,7 +299,7 @@ private void setDocumentBuilderFactoryAttributes( Map dbfAttrs) } else { //check if the property is managed by security manager if (fSecurityManager == null || - !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, val)) { + !fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, val)) { //check if the property is managed by security property manager if (fSecurityPropertyMgr == null || !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java index 48d8d873989..ff8e229d18d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -43,6 +43,8 @@ import java.util.Map; import javax.xml.XMLConstants; import javax.xml.validation.Schema; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.HandlerBase; @@ -61,7 +63,7 @@ * @author Rajiv Mordani * @author Edwin Goei * - * @LastModified: Oct 2017 + * @LastModified: May 2021 */ @SuppressWarnings("deprecation") public class SAXParserImpl extends javax.xml.parsers.SAXParser @@ -93,7 +95,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; private final JAXPSAXParser xmlReader; private String schemaLanguage = null; // null means DTD @@ -167,9 +169,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser Boolean temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING); if (temp != null && temp) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); } } } @@ -562,7 +564,7 @@ else if (JAXP_SCHEMA_SOURCE.equals(name)) { //check if the property is managed by security manager if (fSecurityManager == null || - !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + !fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value)) { //check if the property is managed by security property manager if (fSecurityPropertyMgr == null || !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java index ab6889989bc..d56524f49dc 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -45,6 +45,7 @@ import javax.xml.transform.Source; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; @@ -62,7 +63,7 @@ *

A validator helper for DOMSources.

* * @author Michael Glavassevich, IBM - * @LastModified: Oct 2017 + * @LastModified: May 2021 */ final class DOMValidatorHelper implements ValidatorHelper, EntityState { @@ -382,7 +383,7 @@ private void setupDOMResultHandler(DOMSource source, DOMResult result) throws SA if (result.getNode() == null) { try { DocumentBuilderFactory factory = JdkXmlUtils.getDOMFactory( - fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER)); + fComponentManager.getFeature(JdkConstants.OVERRIDE_PARSER)); DocumentBuilder builder = factory.newDocumentBuilder(); result.setNode(builder.newDocument()); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java index 05f7886bfeb..5b2757c5958 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -25,25 +25,21 @@ package com.sun.org.apache.xerces.internal.jaxp.validation; -import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import java.io.IOException; - import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stax.StAXResult; -import javax.xml.transform.stax.StAXSource; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; - import org.xml.sax.SAXException; /** @@ -73,7 +69,7 @@ public void validate(Source source, Result result) if( identityTransformer1==null ) { try { SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory( - fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER)); + fComponentManager.getFeature(JdkConstants.OVERRIDE_PARSER)); XMLSecurityManager securityManager = (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER); @@ -85,7 +81,7 @@ public void validate(Source source, Result result) } } if (securityManager.printEntityCountInfo()) { - tf.setAttribute(Constants.JDK_ENTITY_COUNT_INFO, "yes"); + tf.setAttribute(JdkConstants.JDK_DEBUG_LIMIT, "yes"); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java index 8cb30b50251..35ddd224fea 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -41,6 +41,7 @@ import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import org.xml.sax.SAXException; @@ -51,6 +52,7 @@ * * @author Michael Glavassevich, IBM * @author Sunitha Reddy + * @LastModified: May 2021 */ final class StreamValidatorHelper implements ValidatorHelper { @@ -139,7 +141,7 @@ public void validate(Source source, Result result) if (result != null) { try { SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory( - fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER)); + fComponentManager.getFeature(JdkConstants.OVERRIDE_PARSER)); identityTransformerHandler = tf.newTransformerHandler(); } catch (TransformerConfigurationException e) { @@ -207,16 +209,16 @@ private XMLParserConfiguration initialize() { config.setDocumentHandler(fSchemaValidator); config.setDTDHandler(null); config.setDTDContentModelHandler(null); - config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, - fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER)); + config.setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, + fComponentManager.getProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER)); config.setProperty(Constants.SECURITY_MANAGER, fComponentManager.getProperty(Constants.SECURITY_MANAGER)); // Passing on the CatalogFeatures settings JdkXmlUtils.catalogFeaturesConfig2Config(fComponentManager, config); - config.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, - fComponentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE)); + config.setProperty(JdkConstants.CDATA_CHUNK_SIZE, + fComponentManager.getProperty(JdkConstants.CDATA_CHUNK_SIZE)); fConfiguration = new SoftReference<>(config); return config; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java index a4ab594acf4..78b5f19994b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -70,6 +70,7 @@ import javax.xml.transform.sax.SAXSource; import javax.xml.validation.TypeInfoProvider; import javax.xml.validation.ValidatorHandler; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.TypeInfo; import org.w3c.dom.ls.LSInput; @@ -94,7 +95,7 @@ * @author Kohsuke Kawaguchi * @author Michael Glavassevich, IBM * - * @LastModified: Oct 2017 + * @LastModified: May 2021 */ final class ValidatorHandlerImpl extends ValidatorHandler implements DTDHandler, EntityState, PSVIProvider, ValidatorHelper, XMLDocumentHandler { @@ -137,7 +138,7 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; // // Data @@ -675,7 +676,7 @@ public void validate(Source source, Result result) XMLReader reader = saxSource.getXMLReader(); if( reader==null ) { // create one now - reader = JdkXmlUtils.getXMLReader(fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER), + reader = JdkXmlUtils.getXMLReader(fComponentManager.getFeature(JdkConstants.OVERRIDE_PARSER), fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); try { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java index b7fc01f5cbf..8b38b8a4a1b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -51,6 +51,9 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; +import jdk.xml.internal.JdkProperty.ImplPropMap; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.Node; @@ -66,6 +69,8 @@ * {@link SchemaFactory} for XML Schema. * * @author Kohsuke Kawaguchi + * + * @LastModified: May 2021 */ public final class XMLSchemaFactory extends SchemaFactory { @@ -94,7 +99,7 @@ public final class XMLSchemaFactory extends SchemaFactory { /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; // @@ -161,11 +166,11 @@ public XMLSchemaFactory() { fXMLSchemaLoader.setProperty(f.getPropertyName(), null); } - fXMLSchemaLoader.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + fXMLSchemaLoader.setProperty(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing()); fOverrideDefaultParser = fXmlFeatures.getFeature( JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER); - fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser); + fXMLSchemaLoader.setFeature(JdkConstants.OVERRIDE_PARSER, fOverrideDefaultParser); } /** @@ -400,7 +405,11 @@ else if (name.equals(XMLGRAMMAR_POOL)) { "property-not-supported", new Object [] {name})); } try { - return fXMLSchemaLoader.getProperty(name); + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (fSecurityManager != null) ? + fSecurityManager.getLimitAsString(name) : null; + return propertyValue != null ? propertyValue : + fXMLSchemaLoader.getProperty(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); @@ -417,6 +426,7 @@ else if (name.equals(XMLGRAMMAR_POOL)) { } } + @SuppressWarnings("deprecation") public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { @@ -443,9 +453,9 @@ public void setFeature(String name, boolean value) fSecurityManager.setSecureProcessing(value); if (value) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); } fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); @@ -455,16 +465,15 @@ else if (name.equals(USE_GRAMMAR_POOL_ONLY)) { fUseGrammarPoolOnly = value; return; } - else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) { + else if (name.equals(JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { //in secure mode, let useServicesMechanism be determined by the constructor if (System.getSecurityManager() != null) return; } if ((fXmlFeatures != null) && - fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) { - if (name.equals(JdkXmlUtils.OVERRIDE_PARSER) - || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) + fXmlFeatures.setFeature(name, JdkProperty.State.APIPROPERTY, value)) { + if ((ImplPropMap.OVERRIDEPARSER.is(name)) || name.equals(JdkXmlUtils.USE_CATALOG)) { fXMLSchemaLoader.setFeature(name, value); } @@ -498,13 +507,13 @@ public void setProperty(String name, Object object) fSecurityManager = XMLSecurityManager.convert(object, fSecurityManager); fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); return; - } else if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + } else if (name.equals(JdkConstants.XML_SECURITY_PROPERTY_MANAGER)) { if (object == null) { fSecurityPropertyMgr = new XMLSecurityPropertyManager(); } else { fSecurityPropertyMgr = (XMLSecurityPropertyManager)object; } - fXMLSchemaLoader.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + fXMLSchemaLoader.setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); return; } else if (name.equals(XMLGRAMMAR_POOL)) { @@ -515,7 +524,7 @@ else if (name.equals(XMLGRAMMAR_POOL)) { try { //check if the property is managed by security manager if (fSecurityManager == null || - !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, object)) { + !fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, object)) { //check if the property is managed by security property manager if (fSecurityPropertyMgr == null || !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, object)) { @@ -542,7 +551,7 @@ else if (name.equals(XMLGRAMMAR_POOL)) { private void propagateFeatures(AbstractXMLSchema schema) { schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, (fSecurityManager != null && fSecurityManager.isSecureProcessing())); - schema.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser); + schema.setFeature(JdkConstants.OVERRIDE_PARSER, fOverrideDefaultParser); String[] features = fXMLSchemaLoader.getRecognizedFeatures(); for (int i = 0; i < features.length; ++i) { boolean state = fXMLSchemaLoader.getFeature(features[i]); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java index 238fd8d2aca..5b759fd2780 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -48,6 +48,8 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.ErrorHandler; @@ -56,6 +58,7 @@ *

An implementation of XMLComponentManager for a schema validator.

* * @author Michael Glavassevich, IBM + * @LastModified: May 2021 */ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettings implements XMLComponentManager { @@ -138,7 +141,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin /** Property identifier: security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Property identifier: symbol table. */ private static final String SYMBOL_TABLE = @@ -265,7 +268,7 @@ public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContaine SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI, XMLConstants.USE_CATALOG, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); fFeatures.put(DISALLOW_DOCTYPE_DECL_FEATURE, Boolean.FALSE); @@ -273,7 +276,7 @@ public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContaine fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.FALSE); fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE); fFeatures.put(XMLConstants.USE_CATALOG, grammarContainer.getFeature(XMLConstants.USE_CATALOG)); - fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, grammarContainer.getFeature(JdkXmlUtils.OVERRIDE_PARSER)); + fFeatures.put(JdkConstants.OVERRIDE_PARSER, grammarContainer.getFeature(JdkConstants.OVERRIDE_PARSER)); addRecognizedParamsAndSetDefaults(fEntityManager, grammarContainer); addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer); @@ -307,7 +310,7 @@ public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContaine //pass on properties set on SchemaFactory fSecurityPropertyMgr = (XMLSecurityPropertyManager) - grammarContainer.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER); + grammarContainer.getProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER); setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); //initialize Catalog properties @@ -315,8 +318,8 @@ public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContaine setProperty(f.getPropertyName(), grammarContainer.getProperty(f.getPropertyName())); } - setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, - grammarContainer.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE)); + setProperty(JdkConstants.CDATA_CHUNK_SIZE, + grammarContainer.getProperty(JdkConstants.CDATA_CHUNK_SIZE)); } /** @@ -379,9 +382,9 @@ else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly if (value) { fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA, - XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP); + XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP); setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); } @@ -456,7 +459,7 @@ else if (LOCALE.equals(propertyId)) { } //check if the property is managed by security manager if (fInitSecurityManager == null || - !fInitSecurityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) { + !fInitSecurityManager.setLimit(propertyId, JdkProperty.State.APIPROPERTY, value)) { //check if the property is managed by security property manager if (fSecurityPropertyMgr == null || !fSecurityPropertyMgr.setValue(propertyId, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java index 0186820ff7e..60125a60c71 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -41,6 +40,8 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; import java.io.CharConversionException; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import org.w3c.dom.Node; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; @@ -59,7 +60,7 @@ * * @author Arnaud Le Hors, IBM * @author Andy Clark, IBM - * + * @LastModified: May 2021 */ public class DOMParser extends AbstractDOMParser { @@ -79,7 +80,7 @@ public class DOMParser /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; // recognized features: private static final String[] RECOGNIZED_FEATURES = { @@ -546,13 +547,13 @@ public void setProperty(String propertyId, Object value) setProperty0(Constants.SECURITY_MANAGER, securityManager); return; } - if (propertyId.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (propertyId.equals(JdkConstants.XML_SECURITY_PROPERTY_MANAGER)) { if (value == null) { securityPropertyManager = new XMLSecurityPropertyManager(); } else { securityPropertyManager = (XMLSecurityPropertyManager)value; } - setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + setProperty0(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); return; } @@ -563,7 +564,7 @@ public void setProperty(String propertyId, Object value) if (securityPropertyManager == null) { securityPropertyManager = new XMLSecurityPropertyManager(); - setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + setProperty0(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } int index = securityPropertyManager.getIndex(propertyId); @@ -576,7 +577,7 @@ public void setProperty(String propertyId, Object value) securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); } else { //check if the property is managed by security manager - if (!securityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) { + if (!securityManager.setLimit(propertyId, JdkProperty.State.APIPROPERTY, value)) { //fall back to the default configuration to handle the property setProperty0(propertyId, value); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java index 98a38ca28bf..d8ed7175e15 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -50,6 +50,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; /** @@ -88,7 +89,7 @@ * @author Arnaud Le Hors, IBM * @author Andy Clark, IBM * @author Neil Graham, IBM - * + * @LastModified: May 2021 */ public class DTDConfiguration extends BasicParserConfiguration @@ -188,7 +189,7 @@ public class DTDConfiguration /** Property identifier: Security property manager. */ protected static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Property identifier: Security manager. */ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; @@ -311,7 +312,7 @@ public DTDConfiguration(SymbolTable symbolTable, //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl //WARN_ON_DUPLICATE_ENTITYDEF, // from XMLEntityManager XMLConstants.USE_CATALOG, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); @@ -325,7 +326,7 @@ public DTDConfiguration(SymbolTable symbolTable, //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); - fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + fFeatures.put(JdkConstants.OVERRIDE_PARSER, JdkConstants.OVERRIDE_PARSER_DEFAULT); // add default recognized properties final String[] recognizedProperties = { @@ -348,7 +349,7 @@ public DTDConfiguration(SymbolTable symbolTable, JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; addRecognizedProperties(recognizedProperties); @@ -433,7 +434,7 @@ public DTDConfiguration(SymbolTable symbolTable, setProperty(f.getPropertyName(), null); } - setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + setProperty(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); } // (SymbolTable,XMLGrammarPool) // diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java index 7c2dc6733dd..dda169efd83 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -49,6 +49,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; /** @@ -62,6 +63,7 @@ * include the replacement text of internal entities, and supply default attribute values". * * @author Elena Litani, IBM + * @LastModified: May 2021 */ public class NonValidatingConfiguration extends BasicParserConfiguration @@ -162,7 +164,7 @@ public class NonValidatingConfiguration /** Property identifier: Security property manager. */ protected static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Property identifier: Security manager. */ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; @@ -295,7 +297,7 @@ public NonValidatingConfiguration(SymbolTable symbolTable, //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl //WARN_ON_DUPLICATE_ENTITYDEF // from XMLEntityManager XMLConstants.USE_CATALOG, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); @@ -311,7 +313,7 @@ public NonValidatingConfiguration(SymbolTable symbolTable, //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); - fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + fFeatures.put(JdkConstants.OVERRIDE_PARSER, JdkConstants.OVERRIDE_PARSER_DEFAULT); // add default recognized properties final String[] recognizedProperties = { @@ -331,7 +333,7 @@ public NonValidatingConfiguration(SymbolTable symbolTable, JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; addRecognizedProperties(recognizedProperties); @@ -395,7 +397,7 @@ public NonValidatingConfiguration(SymbolTable symbolTable, setProperty(f.getPropertyName(), null); } - setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + setProperty(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); } // (SymbolTable,XMLGrammarPool) // diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/SAXParser.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/SAXParser.java index b61d12e551a..349cae0578d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/SAXParser.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/SAXParser.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -27,6 +26,8 @@ import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; @@ -38,6 +39,7 @@ * @author Arnaud Le Hors, IBM * @author Andy Clark, IBM * + * @LastModified: May 2021 */ public class SAXParser extends AbstractSAXParser { @@ -140,13 +142,13 @@ public void setProperty(String name, Object value) super.setProperty(Constants.SECURITY_MANAGER, securityManager); return; } - if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) { + if (name.equals(JdkConstants.XML_SECURITY_PROPERTY_MANAGER)) { if (value == null) { securityPropertyManager = new XMLSecurityPropertyManager(); } else { securityPropertyManager = (XMLSecurityPropertyManager)value; } - super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + super.setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); return; } @@ -157,7 +159,7 @@ public void setProperty(String name, Object value) if (securityPropertyManager == null) { securityPropertyManager = new XMLSecurityPropertyManager(); - super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + super.setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } int index = securityPropertyManager.getIndex(name); @@ -170,7 +172,7 @@ public void setProperty(String name, Object value) securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); } else { //check if the property is managed by security manager - if (!securityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { + if (!securityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value)) { //fall back to the default configuration to handle the property super.setProperty(name, value); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java index 120417e94b7..b85e0f319d0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -68,6 +68,7 @@ import java.util.Locale; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; /** @@ -77,7 +78,7 @@ * @author Neil Graham, IBM * @author Michael Glavassevich, IBM * - * @LastModified: Oct 2017 + * @LastModified: May 2021 */ public class XML11Configuration extends ParserConfigurationSettings implements XMLPullParserConfiguration, XML11Configurable { @@ -295,7 +296,7 @@ public class XML11Configuration extends ParserConfigurationSettings /** Property identifier: Security property manager. */ private static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Property identifier: Security manager. */ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER; @@ -508,8 +509,8 @@ public XML11Configuration( PARSER_SETTINGS, XMLConstants.FEATURE_SECURE_PROCESSING, XMLConstants.USE_CATALOG, - JdkXmlUtils.RESET_SYMBOL_TABLE, - JdkXmlUtils.OVERRIDE_PARSER + JdkConstants.RESET_SYMBOL_TABLE, + JdkConstants.OVERRIDE_PARSER }; addRecognizedFeatures(recognizedFeatures); // set state for default features @@ -535,8 +536,8 @@ public XML11Configuration( fFeatures.put(PARSER_SETTINGS, Boolean.TRUE); fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); - fFeatures.put(JdkXmlUtils.RESET_SYMBOL_TABLE, JdkXmlUtils.RESET_SYMBOL_TABLE_DEFAULT); - fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + fFeatures.put(JdkConstants.RESET_SYMBOL_TABLE, JdkConstants.RESET_SYMBOL_TABLE_DEFAULT); + fFeatures.put(JdkConstants.OVERRIDE_PARSER, JdkConstants.OVERRIDE_PARSER_DEFAULT); // add default recognized properties final String[] recognizedProperties = @@ -573,7 +574,7 @@ public XML11Configuration( JdkXmlUtils.CATALOG_FILES, JdkXmlUtils.CATALOG_PREFER, JdkXmlUtils.CATALOG_RESOLVE, - JdkXmlUtils.CDATA_CHUNK_SIZE + JdkConstants.CDATA_CHUNK_SIZE }; addRecognizedProperties(recognizedProperties); @@ -644,7 +645,7 @@ public XML11Configuration( fProperties.put(f.getPropertyName(), null); } - setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT); + setProperty(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT); fConfigUpdated = false; } // (SymbolTable,XMLGrammarPool) @@ -1582,7 +1583,7 @@ private void initXML11Components() { * and RESET_SYMBOL_TABLE feature is set to true */ private void resetSymbolTable() { - if (fFeatures.get(JdkXmlUtils.RESET_SYMBOL_TABLE) && !fSymbolTableProvided) { + if (fFeatures.get(JdkConstants.RESET_SYMBOL_TABLE) && !fSymbolTableProvided) { if (fSymbolTableJustInitialized) { // Skip symbol table reallocation for the first parsing process fSymbolTableJustInitialized = false; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLParser.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLParser.java index 636b25761d6..9b8bf22562d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLParser.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLParser.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -29,6 +28,7 @@ import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; +import jdk.xml.internal.JdkConstants; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXNotRecognizedException; @@ -49,7 +49,7 @@ * * @author Arnaud Le Hors, IBM * @author Andy Clark, IBM - * + * @LastModified: May 2021 */ public abstract class XMLParser { @@ -134,7 +134,7 @@ public void parse(XMLInputSource inputSource) } if (securityPropertyManager == null) { securityPropertyManager = new XMLSecurityPropertyManager(); - fConfiguration.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); + fConfiguration.setProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager); } reset(); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SecurityManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SecurityManager.java index a5df3999748..d9e0dffbf68 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SecurityManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SecurityManager.java @@ -1,8 +1,7 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ -/* + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -20,156 +19,167 @@ */ package com.sun.org.apache.xerces.internal.util; -import com.sun.org.apache.xerces.internal.impl.Constants; + +import jdk.xml.internal.JdkConstants; + /** - * This class is a container for parser settings that relate to - * security, or more specifically, it is intended to be used to prevent denial-of-service - * attacks from being launched against a system running Xerces. - * Any component that is aware of a denial-of-service attack that can arise - * from its processing of a certain kind of document may query its Component Manager - * for the property (http://apache.org/xml/properties/security-manager) - * whose value will be an instance of this class. - * If no value has been set for the property, the component should proceed in the "usual" (spec-compliant) - * manner. If a value has been set, then it must be the case that the component in - * question needs to know what method of this class to query. This class - * will provide defaults for all known security issues, but will also provide - * setters so that those values can be tailored by applications that care. - * - * @author Neil Graham, IBM + * This class is a container for parser settings that relate to security, or + * more specifically, it is intended to be used to prevent denial-of-service + * attacks from being launched against a system running Xerces. Any component + * that is aware of a denial-of-service attack that can arise from its + * processing of a certain kind of document may query its Component Manager for + * the property (http://apache.org/xml/properties/security-manager) whose value + * will be an instance of this class. If no value has been set for the property, + * the component should proceed in the "usual" (spec-compliant) manner. If a + * value has been set, then it must be the case that the component in question + * needs to know what method of this class to query. This class will provide + * defaults for all known security issues, but will also provide setters so that + * those values can be tailored by applications that care. * + * @author Neil Graham, IBM + * @LastModified: May 2021 */ public final class SecurityManager { // // Constants // - // default value for entity expansion limit private final static int DEFAULT_ENTITY_EXPANSION_LIMIT = 64000; - /** Default value of number of nodes created. **/ + /** + * Default value of number of nodes created. * + */ private final static int DEFAULT_MAX_OCCUR_NODE_LIMIT = 5000; // // Data // + private final static int DEFAULT_ELEMENT_ATTRIBUTE_LIMIT = 10000; - private final static int DEFAULT_ELEMENT_ATTRIBUTE_LIMIT = 10000; - - /** Entity expansion limit. **/ + /** + * Entity expansion limit. * + */ private int entityExpansionLimit; - /** W3C XML Schema maxOccurs limit. **/ + /** + * W3C XML Schema maxOccurs limit. * + */ private int maxOccurLimit; - private int fElementAttributeLimit; + private int fElementAttributeLimit; + // default constructor. Establishes default values for // all known security holes. /** - * Default constructor. Establishes default values - * for known security vulnerabilities. + * Default constructor. Establishes default values for known security + * vulnerabilities. */ public SecurityManager() { entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT ; - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - //We are reading system properties only once , - //at the time of creation of this object , - readSystemProperties(); + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + //We are reading system properties only once , + //at the time of creation of this object , + readSystemProperties(); } /** - *

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

+ *

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

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

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

+ *

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

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

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

+ *

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

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

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

+ *

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

* - * @return the maximum value for maxOccurs other - * than "unbounded" + * @return the maximum value for maxOccurs other than "unbounded" */ - public int getMaxOccurNodeLimit(){ + public int getMaxOccurNodeLimit() { return maxOccurLimit; } - public int getElementAttrLimit(){ - return fElementAttributeLimit; + public int getElementAttrLimit() { + return fElementAttributeLimit; + } + + public void setElementAttrLimit(int limit) { + fElementAttributeLimit = limit; + } + + private void readSystemProperties() { + + try { + String value = System.getProperty(JdkConstants.ENTITY_EXPANSION_LIMIT); + if (value != null && !value.equals("")) { + entityExpansionLimit = Integer.parseInt(value); + if (entityExpansionLimit < 0) { + entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; + } + } else { + entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; + } + } catch (Exception ex) { } - public void setElementAttrLimit(int limit){ - fElementAttributeLimit = limit; + try { + String value = System.getProperty(JdkConstants.MAX_OCCUR_LIMIT); + if (value != null && !value.equals("")) { + maxOccurLimit = Integer.parseInt(value); + if (maxOccurLimit < 0) { + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; + } + } else { + maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; + } + } catch (Exception ex) { } - private void readSystemProperties(){ - - try { - String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT); - if(value != null && !value.equals("")){ - entityExpansionLimit = Integer.parseInt(value); - if (entityExpansionLimit < 0) - entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - } - else - entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT; - }catch(Exception ex){} - - try { - String value = System.getProperty(Constants.MAX_OCCUR_LIMIT); - if(value != null && !value.equals("")){ - maxOccurLimit = Integer.parseInt(value); - if (maxOccurLimit < 0) - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; - } - else - maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT; - }catch(Exception ex){} - - try { - String value = System.getProperty(Constants.ELEMENT_ATTRIBUTE_LIMIT); - if(value != null && !value.equals("")){ - fElementAttributeLimit = Integer.parseInt(value); - if ( fElementAttributeLimit < 0) - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - } - else - fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; - - }catch(Exception ex){} + try { + String value = System.getProperty(JdkConstants.ELEMENT_ATTRIBUTE_LIMIT); + if (value != null && !value.equals("")) { + fElementAttributeLimit = Integer.parseInt(value); + if (fElementAttributeLimit < 0) { + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + } + } else { + fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT; + } + } catch (Exception ex) { } + } + } // class SecurityManager diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java index d4bb8f298af..3fad90958a4 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,11 +25,11 @@ package com.sun.org.apache.xerces.internal.utils; -import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; import java.util.Formatter; import java.util.HashMap; import java.util.Map; +import jdk.xml.internal.JdkConstants; /** * A helper for analyzing entity expansion limits @@ -43,9 +43,9 @@ public final class XMLLimitAnalyzer { * Map old property names with the new ones */ public static enum NameMap { - ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT), - MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT), - ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT); + ENTITY_EXPANSION_LIMIT(JdkConstants.SP_ENTITY_EXPANSION_LIMIT, JdkConstants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(JdkConstants.SP_MAX_OCCUR_LIMIT, JdkConstants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(JdkConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, JdkConstants.ELEMENT_ATTRIBUTE_LIMIT); final String newName; final String oldName; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java index d8f0444d2fb..f4140b8eb41 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,9 +25,11 @@ package com.sun.org.apache.xerces.internal.utils; -import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.SecurityManager; import java.util.concurrent.CopyOnWriteArrayList; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty.State; +import jdk.xml.internal.JdkProperty.ImplPropMap; import jdk.xml.internal.SecuritySupport; import org.xml.sax.SAXException; @@ -37,51 +39,30 @@ */ public final class XMLSecurityManager { - /** - * States of the settings of a property, in the order: default value, value - * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system - * properties, and jaxp api properties - */ - public static enum State { - //this order reflects the overriding order - - DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), - JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"), - APIPROPERTY("property"); - - final String literal; - State(String literal) { - this.literal = literal; - } - - String literal() { - return literal; - } - } - /** * Limits managed by the security manager */ + @SuppressWarnings("deprecation") public static enum Limit { ENTITY_EXPANSION_LIMIT("EntityExpansionLimit", - Constants.JDK_ENTITY_EXPANSION_LIMIT, Constants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), + JdkConstants.JDK_ENTITY_EXPANSION_LIMIT, JdkConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000), MAX_OCCUR_NODE_LIMIT("MaxOccurLimit", - Constants.JDK_MAX_OCCUR_LIMIT, Constants.SP_MAX_OCCUR_LIMIT, 0, 5000), + JdkConstants.JDK_MAX_OCCUR_LIMIT, JdkConstants.SP_MAX_OCCUR_LIMIT, 0, 5000), ELEMENT_ATTRIBUTE_LIMIT("ElementAttributeLimit", - Constants.JDK_ELEMENT_ATTRIBUTE_LIMIT, Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), + JdkConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT, JdkConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000), TOTAL_ENTITY_SIZE_LIMIT("TotalEntitySizeLimit", - Constants.JDK_TOTAL_ENTITY_SIZE_LIMIT, Constants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), + JdkConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT, JdkConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000), GENERAL_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", - Constants.JDK_GENERAL_ENTITY_SIZE_LIMIT, Constants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0), + JdkConstants.JDK_GENERAL_ENTITY_SIZE_LIMIT, JdkConstants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0), PARAMETER_ENTITY_SIZE_LIMIT("MaxEntitySizeLimit", - Constants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, Constants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000), + JdkConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, JdkConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000), MAX_ELEMENT_DEPTH_LIMIT("MaxElementDepthLimit", - Constants.JDK_MAX_ELEMENT_DEPTH, Constants.SP_MAX_ELEMENT_DEPTH, 0, 0), + JdkConstants.JDK_MAX_ELEMENT_DEPTH, JdkConstants.SP_MAX_ELEMENT_DEPTH, 0, 0), MAX_NAME_LIMIT("MaxXMLNameLimit", - Constants.JDK_XML_NAME_LIMIT, Constants.SP_XML_NAME_LIMIT, 1000, 1000), + JdkConstants.JDK_XML_NAME_LIMIT, JdkConstants.SP_XML_NAME_LIMIT, 1000, 1000), ENTITY_REPLACEMENT_LIMIT("EntityReplacementLimit", - Constants.JDK_ENTITY_REPLACEMENT_LIMIT, Constants.SP_ENTITY_REPLACEMENT_LIMIT, 0, 3000000); + JdkConstants.JDK_ENTITY_REPLACEMENT_LIMIT, JdkConstants.SP_ENTITY_REPLACEMENT_LIMIT, 0, 3000000); final String key; final String apiProperty; @@ -97,12 +78,36 @@ public static enum Limit { this.secureValue = secureValue; } - public boolean equalsAPIPropertyName(String propertyName) { - return (propertyName == null) ? false : apiProperty.equals(propertyName); + /** + * Checks whether the specified name is a limit. Checks both the + * property and System Property which is now the new property name. + * + * @param name the specified name + * @return true if there is a match, false otherwise + */ + public boolean is(String name) { + // current spec: new property name == systemProperty + return (systemProperty != null && systemProperty.equals(name)) || + // current spec: apiProperty is legacy + (apiProperty.equals(name)); } - public boolean equalsSystemPropertyName(String propertyName) { - return (propertyName == null) ? false : systemProperty.equals(propertyName); + /** + * Returns the state of a property name. By the specification as of JDK 17, + * the "jdk.xml." prefixed System property name is also the current API + * name. The URI-based qName is legacy. + * + * @param name the property name + * @return the state of the property name, null if no match + */ + public State getState(String name) { + if (systemProperty != null && systemProperty.equals(name)) { + return State.APIPROPERTY; + } else if (apiProperty.equals(name)) { + //the URI-style qName is legacy + return State.LEGACY_APIPROPERTY; + } + return null; } public String key() { @@ -113,7 +118,7 @@ public String apiProperty() { return apiProperty; } - String systemProperty() { + public String systemProperty() { return systemProperty; } @@ -131,9 +136,9 @@ int secureValue() { */ public static enum NameMap { - ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT), - MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT), - ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT); + ENTITY_EXPANSION_LIMIT(JdkConstants.SP_ENTITY_EXPANSION_LIMIT, JdkConstants.ENTITY_EXPANSION_LIMIT), + MAX_OCCUR_NODE_LIMIT(JdkConstants.SP_MAX_OCCUR_LIMIT, JdkConstants.MAX_OCCUR_LIMIT), + ELEMENT_ATTRIBUTE_LIMIT(JdkConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, JdkConstants.ELEMENT_ATTRIBUTE_LIMIT); final String newName; final String oldName; @@ -228,6 +233,24 @@ public boolean isSecureProcessing() { return secureProcessing; } + /** + * Finds a limit's new name with the given property name. + * @param propertyName the property name specified + * @return the limit's new name if found, null otherwise + */ + public String find(String propertyName) { + for (Limit limit : Limit.values()) { + if (limit.is(propertyName)) { + // current spec: new property name == systemProperty + return limit.systemProperty(); + } + } + //ENTITYCOUNT's new name is qName + if (ImplPropMap.ENTITYCOUNT.is(propertyName)) { + return ImplPropMap.ENTITYCOUNT.qName(); + } + return null; + } /** * Set limit by property name and state @@ -240,7 +263,11 @@ public boolean isSecureProcessing() { public boolean setLimit(String propertyName, State state, Object value) { int index = getIndex(propertyName); if (index > -1) { - setLimit(index, state, value); + State pState = state; + if (index != indexEntityCountInfo && state == State.APIPROPERTY) { + pState = (Limit.values()[index]).getState(propertyName); + } + setLimit(index, pState, value); return true; } return false; @@ -269,8 +296,8 @@ public void setLimit(int index, State state, Object value) { printEntityCountInfo = (String)value; } else { int temp; - if (Integer.class.isAssignableFrom(value.getClass())) { - temp = ((Integer)value).intValue(); + if (value instanceof Integer) { + temp = (Integer)value; } else { temp = Integer.parseInt((String) value); if (temp < 0) { @@ -291,7 +318,7 @@ public void setLimit(int index, State state, Object value) { public void setLimit(int index, State state, int value) { if (index == indexEntityCountInfo) { //if it's explicitly set, it's treated as yes no matter the value - printEntityCountInfo = Constants.JDK_YES; + printEntityCountInfo = JdkConstants.JDK_YES; } else { //only update if it shall override if (state.compareTo(states[index]) >= 0) { @@ -379,13 +406,14 @@ public String getStateLiteral(Limit limit) { */ public int getIndex(String propertyName) { for (Limit limit : Limit.values()) { - if (limit.equalsAPIPropertyName(propertyName)) { + // see JDK-8265248, accept both the URL and jdk.xml as prefix + if (limit.is(propertyName)) { //internally, ordinal is used as index return limit.ordinal(); } } //special property to return entity count info - if (propertyName.equals(Constants.JDK_ENTITY_COUNT_INFO)) { + if (ImplPropMap.ENTITYCOUNT.is(propertyName)) { return indexEntityCountInfo; } return -1; @@ -464,7 +492,7 @@ public boolean isOverLimit(int index, XMLLimitAnalyzer limitAnalyzer) { } public void debugPrint(XMLLimitAnalyzer limitAnalyzer) { - if (printEntityCountInfo.equals(Constants.JDK_YES)) { + if (printEntityCountInfo.equals(JdkConstants.JDK_YES)) { limitAnalyzer.debugPrint(this); } } @@ -480,7 +508,7 @@ public boolean isSet(int index) { } public boolean printEntityCountInfo() { - return printEntityCountInfo.equals(Constants.JDK_YES); + return printEntityCountInfo.equals(JdkConstants.JDK_YES); } /** @@ -557,20 +585,20 @@ private boolean getSystemProperty(Limit limit, String sysPropertyName) { * @param securityManager an instance of XMLSecurityManager * @return an instance of the new security manager XMLSecurityManager */ - static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) { + public static XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) { if (value == null) { if (securityManager == null) { securityManager = new XMLSecurityManager(true); } return securityManager; } - if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) { + if (value instanceof XMLSecurityManager) { return (XMLSecurityManager)value; } else { if (securityManager == null) { securityManager = new XMLSecurityManager(true); } - if (SecurityManager.class.isAssignableFrom(value.getClass())) { + if (value instanceof SecurityManager) { SecurityManager origSM = (SecurityManager)value; securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit()); securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit()); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java index 57ee163c729..24f4980348f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,8 +25,8 @@ package com.sun.org.apache.xerces.internal.utils; -import com.sun.org.apache.xerces.internal.impl.Constants; import javax.xml.XMLConstants; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.SecuritySupport; /** @@ -50,9 +50,9 @@ public static enum State { */ public static enum Property { ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD, - Constants.EXTERNAL_ACCESS_DEFAULT), + JdkConstants.EXTERNAL_ACCESS_DEFAULT), ACCESS_EXTERNAL_SCHEMA(XMLConstants.ACCESS_EXTERNAL_SCHEMA, - Constants.EXTERNAL_ACCESS_DEFAULT); + JdkConstants.EXTERNAL_ACCESS_DEFAULT); final String name; final String defaultValue; @@ -66,6 +66,10 @@ public boolean equalsName(String propertyName) { return (propertyName == null) ? false : name.equals(propertyName); } + public String propertyName() { + return name; + } + String defaultValue() { return defaultValue; } @@ -92,6 +96,19 @@ public XMLSecurityPropertyManager() { readSystemProperties(); } + /** + * Finds the property with the given name. + * @param propertyName the property name specified + * @return the property name if found, null otherwise + */ + public String find(String propertyName) { + for (Property property : Property.values()) { + if (property.equalsName(propertyName)) { + return property.propertyName(); + } + } + return null; + } /** * Set limit by property name and state @@ -194,9 +211,9 @@ public int getIndex(String propertyName){ */ private void readSystemProperties() { getSystemProperty(Property.ACCESS_EXTERNAL_DTD, - Constants.SP_ACCESS_EXTERNAL_DTD); + JdkConstants.SP_ACCESS_EXTERNAL_DTD); getSystemProperty(Property.ACCESS_EXTERNAL_SCHEMA, - Constants.SP_ACCESS_EXTERNAL_SCHEMA); + JdkConstants.SP_ACCESS_EXTERNAL_SCHEMA); } /** diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java index 86646bfeaf5..7312d211ac5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -78,6 +78,7 @@ import javax.xml.catalog.CatalogManager; import javax.xml.catalog.CatalogResolver; import javax.xml.transform.Source; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlUtils; import org.xml.sax.InputSource; @@ -127,7 +128,7 @@ * * * @see XIncludeNamespaceSupport - * @LastModified: Nov 2017 + * @LastModified: May 2021 */ public class XIncludeHandler implements XMLComponent, XMLDocumentFilter, XMLDTDFilter { @@ -246,7 +247,7 @@ public class XIncludeHandler /** property identifier: XML security property manager. */ protected static final String XML_SECURITY_PROPERTY_MANAGER = - Constants.XML_SECURITY_PROPERTY_MANAGER; + JdkConstants.XML_SECURITY_PROPERTY_MANAGER; /** Recognized features. */ private static final String[] RECOGNIZED_FEATURES = @@ -561,7 +562,7 @@ public void reset(XMLComponentManager componentManager) } fSecurityPropertyMgr = (XMLSecurityPropertyManager) - componentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER); + componentManager.getProperty(JdkConstants.XML_SECURITY_PROPERTY_MANAGER); //Use Catalog fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java index 3e5dd9825a7..9bd16cb86d7 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java @@ -20,7 +20,6 @@ package com.sun.org.apache.xml.internal.serializer; -import com.sun.org.apache.xerces.internal.impl.Constants; import java.util.Properties; import javax.xml.transform.OutputKeys; import jdk.xml.internal.SecuritySupport; @@ -71,7 +70,7 @@ * @see SerializerFactory * @see Method * @see Serializer - * @LastModified: Feb 2021 + * @LastModified: May 2021 */ public final class OutputPropertiesFactory { @@ -166,33 +165,6 @@ public final class OutputPropertiesFactory public static final int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN = S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL.length(); - /** - * This non-standard, Oracle-impl only property key is used as if - * OutputKeys.STANDALONE is specified but without writing it out in the declaration; - * It can be used to reverse the change by Xalan patch 1495. - * Since Xalan patch 1495 can cause incompatible behavior, this property is - * added for application to neutralize the effect of Xalan patch 1495 - */ - /** - *

Is Standalone

- * - *
    - *
  • - * yes to indicate the output is intended to be used as standalone - *
  • - *
  • - * no has no effect. - *
  • - *
- */ - public static final String ORACLE_IS_STANDALONE = "http://www.oracle.com/xml/is-standalone"; - - // standardized property, refer to the definition in java.xml module-info - public static final String JDK_IS_STANDALONE = Constants.ORACLE_JAXP_PROPERTY_PREFIX + - "xsltcIsStandalone"; - - // Corresponding System property - public static final String SP_IS_STANDALONE = "jdk.xml.xsltcIsStandalone"; //************************************************************ //* PRIVATE CONSTANTS @@ -220,8 +192,7 @@ public final class OutputPropertiesFactory "media-type", "{http://xml.apache.org/xalan}indent-amount", "{http://xml.apache.org/xalan}content-handler", - "{http://xml.apache.org/xalan}entities", - JDK_IS_STANDALONE + "{http://xml.apache.org/xalan}entities" }; private static final String[] PROP_XML_VALUE = { @@ -234,8 +205,7 @@ public final class OutputPropertiesFactory "text/xml", "0", "com.sun.org.apache.xml.internal.serializer.ToXMLStream", - "com/sun/org/apache/xml/internal/serializer/XMLEntities", - "no" + "com/sun/org/apache/xml/internal/serializer/XMLEntities" }; private static final String[] PROP_HTML = { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializationHandler.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializationHandler.java index 93331efc589..ac8ce355ad3 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializationHandler.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializationHandler.java @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one @@ -43,6 +42,7 @@ * it is not a public API. * * @xsl.usage internal + * @LastModified: May 2021 */ public interface SerializationHandler extends @@ -148,8 +148,8 @@ public interface SerializationHandler /** * Specify if the output will be treated as a standalone property - * @param isStandalone true if the http://www.oracle.com/xml/is-standalone is set to yes - * @see OutputPropertiesFactory ORACLE_IS_STANDALONE + * @param b true if the property "jdk.xml.xsltcIsStandalone" is set to yes + * @see JdkConstants.SP_XSLTC_IS_Standalone */ public void setIsStandalone(boolean b); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerBase.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerBase.java index ea6ed48a23f..a22417e817d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerBase.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,7 +42,7 @@ * It contains a number of common fields and methods. * * @xsl.usage internal - * @LastModified: Aug 2019 + * @LastModified: May 2021 */ public abstract class SerializerBase implements SerializationHandler, SerializerConstants @@ -679,9 +679,9 @@ public void setIndent(boolean doIndent) { } /** - * Sets the isStandalone property - * @param isStandalone true if the ORACLE_IS_STANDALONE is set to yes - * @see OutputPropertiesFactory ORACLE_IS_STANDALONE + * Sets the implementation specific property "isStandalone". + * @param isStandalone the value of the property + * @see JdkConstants.SP_XSLTC_IS_Standalone */ public void setIsStandalone(boolean isStandalone) { m_isStandalone = isStandalone; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java index b4edf277f39..135b8b5759a 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java @@ -42,6 +42,7 @@ import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; +import jdk.xml.internal.JdkConstants; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -52,7 +53,7 @@ * serializers (xml, html, text ...) that write output to a stream. * * @xsl.usage internal - * @LastModified: Jan 2021 + * @LastModified: May 2021 */ abstract public class ToStream extends SerializerBase { @@ -494,11 +495,10 @@ void setProp(String name, String val, boolean defaultVal) { setIndentAmount(Integer.parseInt(val)); } else if (OutputKeys.INDENT.equals(name)) { m_doIndent = val.endsWith("yes"); - } else if ((DOMConstants.NS_IS_STANDALONE) + } else if ((DOMConstants.S_JDK_PROPERTIES_NS + JdkConstants.S_IS_STANDALONE) .equals(name)) { m_isStandalone = val.endsWith("yes"); } - break; case 'l': if (OutputPropertiesFactory.S_KEY_LINE_SEPARATOR.equals(name)) { diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOMConstants.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOMConstants.java index b7c0d2ecef2..4076d32698e 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOMConstants.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/DOMConstants.java @@ -21,13 +21,13 @@ package com.sun.org.apache.xml.internal.serializer.dom3; -import com.sun.org.apache.xerces.internal.impl.Constants; +import static jdk.xml.internal.JdkConstants.S_IS_STANDALONE; /** * DOM Constants used by the DOM Level 3 LSSerializer implementation. * * @xsl.usage internal - * @LastModified: Jan 2021 + * @LastModified: May 2021 */ public final class DOMConstants { // @@ -120,25 +120,9 @@ public final class DOMConstants { // The xerces serializer specific 'omit-xml-declaration' property used in LSSerializer public static final String S_XML_VERSION = "xml-version"; - /** - * Indicates that the serializer should treat the output as a standalone document. - * The JDK specific standalone property controls whether a newline should be - * added after the XML header. - * - * @see similar property ORACLE_IS_STANDALONE in OutputPropertiesFactory. - */ - public static final String S_IS_STANDALONE = "isStandalone"; - - // Fully-qualified property name with the JDK Impl prefix - public static final String FQ_IS_STANDALONE = - Constants.ORACLE_JAXP_PROPERTY_PREFIX + S_IS_STANDALONE; - // The property with namespace as the internal DOMConfiguration format public static final String NS_IS_STANDALONE = S_JDK_PROPERTIES_NS + S_IS_STANDALONE; - // Corresponding System property - public static final String SP_IS_STANDALONE = "jdk.xml.isStandalone"; - // public static final String S_XSL_VALUE_ENTITIES = "com/sun/org/apache/xml/internal/serializer/XMLEntities"; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java index 238b7fc9828..1618a08f5c5 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java @@ -21,7 +21,6 @@ package com.sun.org.apache.xml.internal.serializer.dom3; -import com.sun.org.apache.xerces.internal.impl.Constants; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; @@ -39,10 +38,13 @@ import com.sun.org.apache.xml.internal.serializer.Serializer; import com.sun.org.apache.xml.internal.serializer.ToXMLStream; import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory; -import com.sun.org.apache.xml.internal.serializer.SerializerFactory; import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; import com.sun.org.apache.xml.internal.serializer.utils.Utils; import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import jdk.xml.internal.JdkProperty.State; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; @@ -68,7 +70,7 @@ * @version $Id: * * @xsl.usage internal - * @LastModified: Jan 2021 + * @LastModified: May 2021 */ final public class LSSerializerImpl implements DOMConfiguration, LSSerializer { @@ -99,6 +101,9 @@ final public class LSSerializerImpl implements DOMConfiguration, LSSerializer { // The encoding to use during serialization. private String fEncoding; + // The isStandalone property + private JdkProperty fIsStandalone; + // ************************************************************************ // DOM Level 3 DOM Configuration parameter names // ************************************************************************ @@ -167,6 +172,7 @@ final public class LSSerializerImpl implements DOMConfiguration, LSSerializer { // ************************************************************************ // Recognized parameters for which atleast one value can be set + @SuppressWarnings("deprecation") private String fRecognizedParameters [] = { DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM_CDATA_SECTIONS, @@ -187,7 +193,8 @@ final public class LSSerializerImpl implements DOMConfiguration, LSSerializer { DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, DOMConstants.DOM_XMLDECL, - DOMConstants.FQ_IS_STANDALONE, + JdkConstants.FQ_IS_STANDALONE, + JdkConstants.SP_IS_STANDALONE, DOMConstants.DOM_ERROR_HANDLER }; @@ -358,9 +365,12 @@ public void initializeSerializerProps () { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); // JDK specific property isStandalone - String p = SecuritySupport.getJAXPSystemProperty(DOMConstants.SP_IS_STANDALONE); + boolean isStandalone = SecuritySupport.getJAXPSystemProperty( + Boolean.class, JdkConstants.SP_IS_STANDALONE, "false"); + + fIsStandalone = new JdkProperty<>(ImplPropMap.ISSTANDALONE, isStandalone, State.DEFAULT); // the system property is true only if it is "true" and false otherwise - if (p != null && p.equals("true")) { + if (isStandalone) { fFeatures |= IS_STANDALONE; fDOMConfigProperties.setProperty(DOMConstants.NS_IS_STANDALONE, DOMConstants.DOM3_EXPLICIT_TRUE); @@ -382,6 +392,7 @@ public void initializeSerializerProps () { * @param name A String containing the DOMConfiguration parameter name. * @param value An Object specifying the value of the corresponding parameter. */ + @SuppressWarnings("deprecation") public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) @@ -396,7 +407,8 @@ public boolean canSetParameter(String name, Object value) { || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL) - || name.equalsIgnoreCase(DOMConstants.FQ_IS_STANDALONE)){ + || name.equalsIgnoreCase(JdkConstants.FQ_IS_STANDALONE) + || name.equalsIgnoreCase(JdkConstants.SP_IS_STANDALONE)){ // both values supported return true; } @@ -454,7 +466,7 @@ public Object getParameter(String name) throws DOMException { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE; - } else if (name.equalsIgnoreCase(DOMConstants.FQ_IS_STANDALONE)) { + } else if (ImplPropMap.ISSTANDALONE.is(name)) { return ((fFeatures & IS_STANDALONE) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE; @@ -517,13 +529,13 @@ public DOMStringList getParameterNames() { public void setParameter(String name, Object value) throws DOMException { // If the value is a boolean if (value instanceof Boolean) { - boolean state = ((Boolean) value).booleanValue(); + boolean bValue = ((Boolean) value); if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { - fFeatures = state ? fFeatures | COMMENTS : fFeatures + fFeatures = bValue ? fFeatures | COMMENTS : fFeatures & ~COMMENTS; // comments - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -531,10 +543,10 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { - fFeatures = state ? fFeatures | CDATA : fFeatures + fFeatures = bValue ? fFeatures | CDATA : fFeatures & ~CDATA; // cdata-sections - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -542,10 +554,10 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { - fFeatures = state ? fFeatures | ENTITIES : fFeatures + fFeatures = bValue ? fFeatures | ENTITIES : fFeatures & ~ENTITIES; // entities - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -553,10 +565,10 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { - fFeatures = state ? fFeatures | NAMESPACES : fFeatures + fFeatures = bValue ? fFeatures | NAMESPACES : fFeatures & ~NAMESPACES; // namespaces - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -565,10 +577,10 @@ public void setParameter(String name, Object value) throws DOMException { } } else if (name .equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { - fFeatures = state ? fFeatures | NAMESPACEDECLS + fFeatures = bValue ? fFeatures | NAMESPACEDECLS : fFeatures & ~NAMESPACEDECLS; // namespace-declarations - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -576,10 +588,10 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { - fFeatures = state ? fFeatures | SPLITCDATA : fFeatures + fFeatures = bValue ? fFeatures | SPLITCDATA : fFeatures & ~SPLITCDATA; // split-cdata-sections - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -587,10 +599,10 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { - fFeatures = state ? fFeatures | WELLFORMED : fFeatures + fFeatures = bValue ? fFeatures | WELLFORMED : fFeatures & ~WELLFORMED; // well-formed - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -599,10 +611,10 @@ public void setParameter(String name, Object value) throws DOMException { } } else if (name .equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { - fFeatures = state ? fFeatures | DISCARDDEFAULT + fFeatures = bValue ? fFeatures | DISCARDDEFAULT : fFeatures & ~DISCARDDEFAULT; // discard-default-content - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -610,31 +622,32 @@ public void setParameter(String name, Object value) throws DOMException { + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { - fFeatures = state ? fFeatures | PRETTY_PRINT : fFeatures + fFeatures = bValue ? fFeatures | PRETTY_PRINT : fFeatures & ~PRETTY_PRINT; - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_INDENT,DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, Integer.toString(4)); } else { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_INDENT,DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { - fFeatures = state ? fFeatures | XMLDECL : fFeatures + fFeatures = bValue ? fFeatures | XMLDECL : fFeatures & ~XMLDECL; - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); } else { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "yes"); } - } else if (name.equalsIgnoreCase(DOMConstants.FQ_IS_STANDALONE)) { - fFeatures = state ? fFeatures | IS_STANDALONE : fFeatures & ~IS_STANDALONE; - fDOMConfigProperties.setProperty(DOMConstants.NS_IS_STANDALONE, state ? "yes" : "no"); - + } else if (ImplPropMap.ISSTANDALONE.is(name)) { + fIsStandalone.setValue(name, bValue, State.APIPROPERTY); + fFeatures = fIsStandalone.getValue() ? fFeatures | IS_STANDALONE : fFeatures & ~IS_STANDALONE; + fDOMConfigProperties.setProperty(DOMConstants.NS_IS_STANDALONE, + fIsStandalone.getValue() ? DOMConstants.DOM3_EXPLICIT_TRUE : DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { - fFeatures = state ? fFeatures | ELEM_CONTENT_WHITESPACE : fFeatures + fFeatures = bValue ? fFeatures | ELEM_CONTENT_WHITESPACE : fFeatures & ~ELEM_CONTENT_WHITESPACE; // element-content-whitespace - if (state) { + if (bValue) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE); } else { @@ -643,7 +656,7 @@ public void setParameter(String name, Object value) throws DOMException { } } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported - if (!state) { + if (!bValue) { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, @@ -661,7 +674,7 @@ public void setParameter(String name, Object value) throws DOMException { // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported - if (state) { + if (bValue) { String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); @@ -688,7 +701,7 @@ public void setParameter(String name, Object value) throws DOMException { } */ } } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)) { - if (state) { + if (bValue) { fFeatures &= ~ENTITIES; fFeatures &= ~CDATA; fFeatures &= ~SCHEMAVALIDATE; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java index 6974f6059af..4dbb9472b67 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,11 +20,11 @@ package com.sun.org.apache.xml.internal.utils; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import java.util.HashMap; import javax.xml.XMLConstants; import javax.xml.catalog.CatalogFeatures; +import jdk.xml.internal.JdkConstants; import jdk.xml.internal.JdkXmlFeatures; import jdk.xml.internal.JdkXmlUtils; import jdk.xml.internal.SecuritySupport; @@ -37,7 +37,7 @@ * Creates XMLReader objects and caches them for re-use. * This class follows the singleton pattern. * - * @LastModified: Sep 2017 + * @LastModified: May 2021 */ public class XMLReaderManager { @@ -61,7 +61,7 @@ public class XMLReaderManager { /** * protocols allowed for external DTD references in source file and/or stylesheet. */ - private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT; + private String _accessExternalDTD = JdkConstants.EXTERNAL_ACCESS_DEFAULT; private XMLSecurityManager _xmlSecurityManager; @@ -136,7 +136,7 @@ public synchronized XMLReader getXMLReader() throws SAXException { JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD, true); - JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkXmlUtils.CDATA_CHUNK_SIZE, + JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, JdkConstants.CDATA_CHUNK_SIZE, _cdataChunkSize, false); String lastProperty = ""; @@ -148,8 +148,8 @@ public synchronized XMLReader getXMLReader() throws SAXException { _xmlSecurityManager.getLimitValueAsString(limit)); } if (_xmlSecurityManager.printEntityCountInfo()) { - lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO; - reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES); + lastProperty = JdkConstants.JDK_DEBUG_LIMIT; + reader.setProperty(lastProperty, JdkConstants.JDK_YES); } } } catch (SAXException se) { @@ -221,7 +221,7 @@ public void setFeature(String name, boolean value) { public Object getProperty(String name) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { return _accessExternalDTD; - } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + } else if (name.equals(JdkConstants.SECURITY_MANAGER)) { return _xmlSecurityManager; } return null; @@ -233,11 +233,11 @@ public Object getProperty(String name) { public void setProperty(String name, Object value) { if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) { _accessExternalDTD = (String)value; - } else if (name.equals(XalanConstants.SECURITY_MANAGER)) { + } else if (name.equals(JdkConstants.SECURITY_MANAGER)) { _xmlSecurityManager = (XMLSecurityManager)value; } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) { _catalogFeatures = (CatalogFeatures)value; - } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) { + } else if (JdkConstants.CDATA_CHUNK_SIZE.equals(name)) { _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/CachedXPathAPI.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/CachedXPathAPI.java index 2526b7c4606..30687f40b20 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/CachedXPathAPI.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/CachedXPathAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,7 +25,7 @@ import com.sun.org.apache.xml.internal.utils.PrefixResolver; import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault; import com.sun.org.apache.xpath.internal.objects.XObject; -import jdk.xml.internal.JdkXmlUtils; +import jdk.xml.internal.JdkConstants; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -54,6 +54,7 @@ * decide when to discard the cache. * * @see XPath Specification + * @LastModified: May 2021 * */ public class CachedXPathAPI { @@ -73,7 +74,7 @@ public class CachedXPathAPI */ public CachedXPathAPI() { - xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + xpathSupport = new XPathContext(JdkConstants.OVERRIDE_PARSER_DEFAULT); } /** @@ -328,7 +329,7 @@ public XObject eval( XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Execute the XPath, and have it return the result - XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + XPathContext xpathSupport = new XPathContext(JdkConstants.OVERRIDE_PARSER_DEFAULT); int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathAPI.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathAPI.java index b828e62f836..dce8f78f34e 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathAPI.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,7 +25,7 @@ import com.sun.org.apache.xml.internal.utils.PrefixResolver; import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault; import com.sun.org.apache.xpath.internal.objects.XObject; -import jdk.xml.internal.JdkXmlUtils; +import jdk.xml.internal.JdkConstants; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -49,6 +49,7 @@ * methods. * * @see XPath Specification + * @LastModified: May 2021 * */ public class XPathAPI { @@ -221,7 +222,7 @@ public static XObject eval(Node contextNode, String str, Node namespaceNode) // (Changed from: XPathContext xpathSupport = new XPathContext(); // because XPathContext is weak in a number of areas... perhaps // XPathContext should be done away with.) - XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + XPathContext xpathSupport = new XPathContext(JdkConstants.OVERRIDE_PARSER_DEFAULT); // Create an object to resolve namespace prefixes. // XPath namespaces are resolved from the input context node's document element @@ -276,7 +277,7 @@ public static XObject eval( XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Execute the XPath, and have it return the result - XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT); + XPathContext xpathSupport = new XPathContext(JdkConstants.OVERRIDE_PARSER_DEFAULT); int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java index 562f776de75..4516ce9816c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -20,7 +20,6 @@ package com.sun.org.apache.xpath.internal.jaxp; -import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import javax.xml.XMLConstants; @@ -28,12 +27,16 @@ import javax.xml.xpath.XPathFactoryConfigurationException; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathVariableResolver; +import jdk.xml.internal.JdkConstants; +import jdk.xml.internal.JdkProperty; import jdk.xml.internal.JdkXmlFeatures; /** * The XPathFactory builds XPaths. * * @author Ramesh Mandava + * + * @LastModified: May 2021 */ public class XPathFactoryImpl extends XPathFactory { @@ -153,6 +156,7 @@ public javax.xml.xpath.XPath newXPath() { * @throws NullPointerException if name is * null. */ + @SuppressWarnings("deprecation") public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException { @@ -176,20 +180,20 @@ public void setFeature(String name, boolean value) _isNotSecureProcessing = !value; if (value && _featureManager != null) { _featureManager.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION, - JdkXmlFeatures.State.FSP, false); + JdkProperty.State.FSP, false); } // all done processing feature return; } - if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { + if (name.equals(JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { // for compatibility, in secure mode, useServicesMechanism is determined by the constructor if (_isSecureMode) return; } if (_featureManager != null && - _featureManager.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) { + _featureManager.setFeature(name, JdkProperty.State.APIPROPERTY, value)) { return; } diff --git a/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java b/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java index c69c08e402b..a75ad6a4357 100644 --- a/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java +++ b/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -36,49 +36,9 @@ * Factory that creates new {@code javax.xml.datatype} {@code Object}s that map XML to/from Java {@code Object}s. *

* A new instance of the {@code DatatypeFactory} is created through the {@link #newInstance()} method - * that uses the following implementation resolution mechanisms to determine an implementation: - *

    - *
  1. - * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "{@code javax.xml.datatype.DatatypeFactory}", - * exists, a class with the name of the property value is instantiated. - * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. - *
  2. - *
  3. - *

    - * Use the configuration file "jaxp.properties". The file is in standard - * {@link java.util.Properties} format and typically located in the - * {@code conf} directory of the Java installation. It contains the fully qualified - * name of the implementation class with the key being the system property - * defined above. - *

    - * The jaxp.properties file is read only once by the JAXP implementation - * and its values are then cached for future use. If the file does not exist - * when the first attempt is made to read from it, no further attempts are - * made to check for its existence. It is not possible to change the value - * of any property in jaxp.properties after it has been read for the first time. - *

  4. - *
  5. - *

    - * Use the service-provider loading facility, defined by the {@link java.util.ServiceLoader} class, to attempt - * to locate and load an implementation of the service using the {@linkplain - * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: - * the service-provider loading facility will use the {@linkplain - * java.lang.Thread#getContextClassLoader() current thread's context class loader} - * to attempt to load the service. If the context class - * loader is null, the {@linkplain - * ClassLoader#getSystemClassLoader() system class loader} will be used. - *

    - * In case of {@link java.util.ServiceConfigurationError service - * configuration error}, a {@link javax.xml.datatype.DatatypeConfigurationException} - * will be thrown. - *

  6. - *
  7. - *

    - * The final mechanism is to attempt to instantiate the {@code Class} specified by - * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}. - * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. - *

  8. - *
+ * that uses the + * JAXP Lookup Mechanism + * to determine the {@code DatatypeFactory} implementation class to load. * * @author Joseph Fialli * @author Jeff Suttor @@ -152,9 +112,9 @@ public static DatatypeFactory newDefaultInstance() { /** * Obtain a new instance of a {@code DatatypeFactory}. - * - *

The implementation resolution mechanisms are defined in this - * {@code Class}'s documentation. + * This method uses the + * JAXP Lookup Mechanism + * to determine the {@code DatatypeFactory} implementation class to load. * * @return New instance of a {@code DatatypeFactory} * diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java b/src/java.xml/share/classes/jdk/xml/internal/JdkConstants.java similarity index 50% rename from src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java rename to src/java.xml/share/classes/jdk/xml/internal/JdkConstants.java index 82caed9fe88..c4c54a65d63 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkConstants.java @@ -1,6 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. - * @LastModified: Sep 2017 + * Copyright (c) 2011, 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 @@ -24,17 +23,14 @@ * questions. */ -package com.sun.org.apache.xalan.internal; - -import jdk.xml.internal.SecuritySupport; +package jdk.xml.internal; /** - * Commonly used constants. - * - * @author Huizhe Wang, Oracle - * + * This class holds constants shared across XML components. Historically, there + * had been a component boundary within which some constants were duplicated for + * each component, such as Xerces and Xalan. */ -public final class XalanConstants { +public final class JdkConstants { // // Constants @@ -46,77 +42,120 @@ public final class XalanConstants { // // Implementation limits: API properties // - /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ + + /** + * Oracle JAXP property prefix. + * + * @deprecated Use {@code jdk.xml.} instead. Refer to specifications in + * the module summary. + */ + @Deprecated (since="17") public static final String ORACLE_JAXP_PROPERTY_PREFIX = "http://www.oracle.com/xml/jaxp/properties/"; + /** - * JDK entity expansion limit; Note that the existing system property - * "entityExpansionLimit" with no prefix is still observed + * JDK entity expansion limit. Note that the existing system property + * "entityExpansionLimit" with no prefix is still observed. + * + * @deprecated Use {@link #SP_ENTITY_EXPANSION_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_ENTITY_EXPANSION_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; /** - * JDK element attribute limit; Note that the existing system property - * "elementAttributeLimit" with no prefix is still observed + * JDK element attribute limit. Note that the existing system property + * "elementAttributeLimit" with no prefix is still observed. + * + * @deprecated Use {@link #SP_ELEMENT_ATTRIBUTE_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; /** - * JDK maxOccur limit; Note that the existing system property + * JDK maxOccur limit. Note that the existing system property * "maxOccurLimit" with no prefix is still observed + * + * @deprecated Use {@link #SP_ENTITY_EXPANSION_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_MAX_OCCUR_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit"; /** - * JDK total entity size limit + * JDK total entity size limit. + * + * @deprecated Use {@link #SP_TOTAL_ENTITY_SIZE_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit"; /** - * JDK maximum general entity size limit + * JDK maximum general entity size limit. + * + * @deprecated Use {@link #SP_GENERAL_ENTITY_SIZE_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_GENERAL_ENTITY_SIZE_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit"; /** * JDK node count limit in entities that limits the total number of nodes * in all of entity references. + * + * @deprecated Use {@link #SP_ENTITY_REPLACEMENT_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_ENTITY_REPLACEMENT_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "entityReplacementLimit"; /** - * JDK maximum parameter entity size limit + * JDK maximum parameter entity size limit. + * + * @deprecated Use {@link #SP_PARAMETER_ENTITY_SIZE_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit"; /** - * JDK maximum XML name limit + * JDK maximum XML name limit. + * + * @deprecated Use {@link #SP_XML_NAME_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_XML_NAME_LIMIT = ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit"; /** - * JDK maxElementDepth limit + * JDK maxElementDepth limit. + * + * @deprecated Use {@link #SP_MAX_ELEMENT_DEPTH} instead. */ + @Deprecated (since="17") public static final String JDK_MAX_ELEMENT_DEPTH = ORACLE_JAXP_PROPERTY_PREFIX + "maxElementDepth"; /** * JDK property indicating whether the parser shall print out entity - * count information + * count information. * Value: a string "yes" means print, "no" or any other string means not. + * + * @deprecated Use {@link #JDK_DEBUG_LIMIT} instead. */ + @Deprecated (since="17") public static final String JDK_ENTITY_COUNT_INFO = ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo"; + public static final String JDK_DEBUG_LIMIT = "jdk.xml.getEntityCountInfo"; + // // Implementation limits: corresponding System Properties of the above - // API properties + // API properties. + // + // Note: as of JDK 17, properties and System properties now share the same + // name with a prefix "jdk.xml.". // /** * JDK entity expansion limit; Note that the existing system property @@ -175,6 +214,8 @@ public final class XalanConstants { * for extension functions loading during translation process */ public static final String JDK_EXTENSION_CLASSLOADER = "jdk.xml.transform.extensionClassLoader"; + // spec-compatible name with a prefix "jdk.xml" + public static final String JDK_EXT_CLASSLOADER = "jdk.xml.extensionClassLoader"; //legacy System Properties public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; @@ -192,21 +233,24 @@ public final class XalanConstants { * *

    *
  • - * {@code true} instruct an object to use service mechanism to - * find a service implementation. This is the default behavior. - *
  • - *
  • - * {@code false} instruct an object to skip service mechanism and - * use the default implementation for that service. - *
  • - *
- */ - public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism"; - + * {@code true} instruct an object to use service mechanism to + * find a service implementation. This is the default behavior. + * + *
  • + * {@code false} instruct an object to skip service mechanism and + * use the default implementation for that service. + *
  • + * + * @deprecated Use {@link jdk.xml.internal.JdkXmlUtils#OVERRIDE_PARSER} instead. + */ + @Deprecated (since="17") + public static final String ORACLE_FEATURE_SERVICE_MECHANISM = + "http://www.oracle.com/feature/use-service-mechanism"; //System Properties corresponding to ACCESS_EXTERNAL_* properties public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet"; public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; + public static final String SP_ACCESS_EXTERNAL_SCHEMA = "javax.xml.accessExternalSchema"; //all access keyword public static final String ACCESS_EXTERNAL_ALL = "all"; @@ -222,8 +266,7 @@ public final class XalanConstants { public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; public static final String XML_SECURITY_PROPERTY_MANAGER = - ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; - + "jdk.xml.xmlSecurityPropertyManager"; /** * Values for a feature @@ -231,4 +274,104 @@ public final class XalanConstants { public static final String FEATURE_TRUE = "true"; public static final String FEATURE_FALSE = "false"; -} // class Constants + /** + * For DOM Serializer. + * + * Indicates that the serializer should treat the output as a standalone document. + * The JDK specific standalone property controls whether a newline should be + * added after the XML header. + * + * @see similar property xsltcIsStandalone for XSLTC. + */ + public static final String S_IS_STANDALONE = "isStandalone"; + + /** + * Fully-qualified property name with the JDK Impl prefix. + * + * @deprecated Use {@link #SP_IS_STANDALONE} instead. + */ + @Deprecated (since="17") + public static final String FQ_IS_STANDALONE = ORACLE_JAXP_PROPERTY_PREFIX + S_IS_STANDALONE; + + // Corresponding System property + public static final String SP_IS_STANDALONE = "jdk.xml.isStandalone"; + + /** + * For XSLTC. + * + * Instructs the processor to act as if OutputKeys.STANDALONE is specified + * but without writing it out in the declaration. + * This property may be used to mitigate the effect of Xalan patch 1495 that + * has caused incompatible behaviors. + */ + /** + *

    Is Standalone

    + * + *
      + *
    • + * yes to indicate the output is intended to be used as standalone + *
    • + *
    • + * no has no effect. + *
    • + *
    + * + * @deprecated Use {@link #SP_XSLTC_IS_STANDALONE} instead. + */ + @Deprecated (since="17") + public static final String ORACLE_IS_STANDALONE = "http://www.oracle.com/xml/is-standalone"; + + /** + * This property was added to align with those that used ORACLE_JAXP_PROPERTY_PREFIX + * as prefix. + * @deprecated Use {@link #SP_XSLTC_IS_STANDALONE} instead. + */ + @Deprecated (since="17") + public static final String JDK_IS_STANDALONE = ORACLE_JAXP_PROPERTY_PREFIX + + "xsltcIsStandalone"; + + // Corresponding System property + public static final String SP_XSLTC_IS_STANDALONE = "jdk.xml.xsltcIsStandalone"; + + /** + * Feature enableExtensionFunctions + */ + public static final String ORACLE_ENABLE_EXTENSION_FUNCTION = + ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions"; + public static final String SP_ENABLE_EXTENSION_FUNCTION = + "javax.xml.enableExtensionFunctions"; + // This is the correct name by the spec + public static final String SP_ENABLE_EXTENSION_FUNCTION_SPEC = + "jdk.xml.enableExtensionFunctions"; + + /** + * Reset SymbolTable feature System property name is identical to feature + * name + */ + public final static String RESET_SYMBOL_TABLE = "jdk.xml.resetSymbolTable"; + /** + * Default value of RESET_SYMBOL_TABLE. This will read the System property + */ + public static final boolean RESET_SYMBOL_TABLE_DEFAULT + = SecuritySupport.getJAXPSystemProperty(Boolean.class, RESET_SYMBOL_TABLE, "false"); + + /** + * jdk.xml.overrideDefaultParser: enables the use of a 3rd party's parser + * implementation to override the system-default parser. + */ + public static final String OVERRIDE_PARSER = "jdk.xml.overrideDefaultParser"; + public static final boolean OVERRIDE_PARSER_DEFAULT = SecuritySupport.getJAXPSystemProperty( + Boolean.class, OVERRIDE_PARSER, "false"); + + /** + * instructs the parser to return the data in a CData section in a single chunk + * when the property is zero or unspecified, or in multiple chunks when it is + * greater than zero. The parser shall split the data by linebreaks, and any + * chunks that are larger than the specified size to ones that are equal to + * or smaller than the size. + */ + public final static String CDATA_CHUNK_SIZE = "jdk.xml.cdataChunkSize"; + public static final int CDATA_CHUNK_SIZE_DEFAULT + = SecuritySupport.getJAXPSystemProperty(Integer.class, CDATA_CHUNK_SIZE, "0"); + +} diff --git a/src/java.xml/share/classes/jdk/xml/internal/JdkProperty.java b/src/java.xml/share/classes/jdk/xml/internal/JdkProperty.java new file mode 100644 index 00000000000..2294659f9c7 --- /dev/null +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkProperty.java @@ -0,0 +1,254 @@ +/* + * Copyright (c) 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. 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.xml.internal; + +import static jdk.xml.internal.JdkConstants.FQ_IS_STANDALONE; +import static jdk.xml.internal.JdkConstants.JDK_DEBUG_LIMIT; +import static jdk.xml.internal.JdkConstants.JDK_ENTITY_COUNT_INFO; +import static jdk.xml.internal.JdkConstants.JDK_EXTENSION_CLASSLOADER; +import static jdk.xml.internal.JdkConstants.JDK_EXT_CLASSLOADER; +import static jdk.xml.internal.JdkConstants.JDK_IS_STANDALONE; +import static jdk.xml.internal.JdkConstants.ORACLE_IS_STANDALONE; +import static jdk.xml.internal.JdkConstants.SP_IS_STANDALONE; +import static jdk.xml.internal.JdkConstants.SP_XSLTC_IS_STANDALONE; +import static jdk.xml.internal.JdkConstants.ORACLE_ENABLE_EXTENSION_FUNCTION; +import static jdk.xml.internal.JdkConstants.ORACLE_FEATURE_SERVICE_MECHANISM; +import static jdk.xml.internal.JdkConstants.SP_ENABLE_EXTENSION_FUNCTION; +import static jdk.xml.internal.JdkConstants.SP_ENABLE_EXTENSION_FUNCTION_SPEC; +import static jdk.xml.internal.JdkConstants.CDATA_CHUNK_SIZE; +import static jdk.xml.internal.JdkConstants.OVERRIDE_PARSER; +import static jdk.xml.internal.JdkConstants.RESET_SYMBOL_TABLE; + +/** + * Represents a JDK Implementation Specific Property. This class holds the name + * and value of a property along with a state indicating the means through which + * the property has been set. The value may change only if the setter has a state + * that represents an equal or higher overriding order. + * + * @param the type of the property value. + */ +public final class JdkProperty { + + private ImplPropMap pName; + private T pValue; + private State pState = State.DEFAULT; + + /** + * Constructs a JDkProperty. + * @param name the name of the property + * @param value the initial value + * @param state the state of the property + */ + public JdkProperty(ImplPropMap name, T value, State state) { + this.pName = name; + this.pValue = value; + this.pState = state; + } + + /** + * Returns the property value. + * @return the property value + */ + public T getValue() { + return pValue; + } + + /** + * Sets the property value. The value is set only if the setter has a higher + * overriding order. + * @param name the property name + * @param value the value + * @param state the state of the specified property + * @return true if the value is set successfully (because the setter has a + * higher order); false otherwise. + */ + public boolean setValue(String name, T value, State state) { + State pState1; + if ((pState1 = pName.getState(name)) != null) { + if (pState1.compareTo(this.pState) >= 0) { + this.pState = pState1; + pValue = value; + return true; + } + } + return false; + } + + /** + * Properties Name Map that includes Implementation-Specific Features and + * Properties except the limits that are defined in XMLSecurityManager. + * The purpose of the map is to provide a map between the new property names + * with a prefix "jdk.xml" as defined in the module summary and legacy names + * with URL style prefixes. The new names are the same as those of their + * System Properties. + */ + @SuppressWarnings("deprecation") + public static enum ImplPropMap { + + ISSTANDALONE("isStandalone", FQ_IS_STANDALONE, SP_IS_STANDALONE, true, null, null), + XSLTCISSTANDALONE("xsltcIsStandalone", JDK_IS_STANDALONE, SP_XSLTC_IS_STANDALONE, + true, ORACLE_IS_STANDALONE, null), + CDATACHUNKSIZE("cdataChunkSize", CDATA_CHUNK_SIZE, CDATA_CHUNK_SIZE, false, null, null), + EXTCLSLOADER("extensionClassLoader", JDK_EXT_CLASSLOADER, null, + true, JDK_EXTENSION_CLASSLOADER, null), + ENABLEEXTFUNC("enableExtensionFunctions", ORACLE_ENABLE_EXTENSION_FUNCTION, + SP_ENABLE_EXTENSION_FUNCTION_SPEC, true, null, SP_ENABLE_EXTENSION_FUNCTION), + OVERRIDEPARSER("overrideDefaultParser", OVERRIDE_PARSER, OVERRIDE_PARSER, + false, ORACLE_FEATURE_SERVICE_MECHANISM, ORACLE_FEATURE_SERVICE_MECHANISM), + RESETSYMBOLTABLE("resetSymbolTable", RESET_SYMBOL_TABLE, RESET_SYMBOL_TABLE, + false, null, null), + ENTITYCOUNT("getEntityCountInfo", JDK_DEBUG_LIMIT, null, true, JDK_ENTITY_COUNT_INFO, null) + ; + + private final String name; + private final String qName; + private final String spName; + private final boolean differ; + private final String oldQName; + private final String oldSPName; + + /** + * Constructs an instance. + * @param name the property name + * @param qName the qualified property name + * @param spName the corresponding System Property + * @param differ a flag indicating whether qName and spName are the same + * @param oldName the legacy property name, null if N/A + * @param oldSPName the legacy System Property name, null if N/A + */ + ImplPropMap(String name, String qName, String spName, boolean differ, + String oldQName, String oldSPName) { + this.name = name; + this.qName = qName; + this.spName = spName; + this.differ = differ; + this.oldQName = oldQName; + this.oldSPName = oldSPName; + } + + /** + * Checks whether the specified name is the property. Checks both the + * property and System Property if they differ. Checks also the legacy + * name if applicable. + * + * @param name the specified name + * @return true if there is a match, false otherwise + */ + public boolean is(String name) { + // current spec calls for using a name same as spName + return (spName != null && spName.equals(name)) || + // check qName only if it differs from spName + (differ && qName.equals(name)) || + // check the legacy name if applicable + (oldQName != null && oldQName.equals(name)); + } + + /** + * Returns the value indicating whether the qName and spName are different. + * @return the value indicating whether the qName and spName are different + */ + public boolean isNameDiffer() { + return differ; + } + + /** + * Returns the state of a property name. By the specification as of JDK 17, + * the "jdk.xml." prefixed System property name is also the current API + * name. Both the URI-based qName and old name if any are legacy. + * + * @param name the property name + * @return the state of the property name, null if no match + */ + public State getState(String name) { + if ((spName != null && spName.equals(name)) || + (spName == null && qName.equals(name))) { + return State.APIPROPERTY; + } else if ((differ && qName.equals(name)) || + (oldQName != null && oldQName.equals(name))) { + //both the URI-style qName and an old name if any are legacy + return State.LEGACY_APIPROPERTY; + } + return null; + } + + /** + * Returns the qualified name of the property. + * + * @return the qualified name of the property + */ + public String qName() { + return qName; + } + + /** + * Returns the legacy name of the property. + * + * @return the legacy name of the property + */ + public String qNameOld() { + return oldQName; + } + + /** + * Returns the name of the corresponding System Property. + * + * @return the name of the System Property + */ + public String systemProperty() { + return spName; + } + + /** + * Returns the name of the legacy System Property. + * + * @return the name of the legacy System Property + */ + public String systemPropertyOld() { + return oldSPName; + } + } + + /** + * Represents the state of the settings of a property. The states are in + * descending order: the default value, value set by FEATURE_SECURE_PROCESSING (FSP), + * in jaxp.properties, by legacy or new system property, and on factories + * using legacy or new property names. + */ + public static enum State { + //this order reflects the overriding order + DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), JAXPDOTPROPERTIES("jaxp.properties"), + LEGACY_SYSTEMPROPERTY("legacy system property"), SYSTEMPROPERTY("system property"), + LEGACY_APIPROPERTY("legacy property"), APIPROPERTY("property"); + + final String literal; + State(String literal) { + this.literal = literal; + } + + public String literal() { + return literal; + } + } +} diff --git a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java index 471c6e644dd..524c5f95ee4 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -26,9 +26,9 @@ package jdk.xml.internal; import javax.xml.XMLConstants; -import static jdk.xml.internal.JdkXmlUtils.OVERRIDE_PARSER; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import jdk.xml.internal.JdkProperty.State; import static jdk.xml.internal.JdkXmlUtils.SP_USE_CATALOG; -import static jdk.xml.internal.JdkXmlUtils.RESET_SYMBOL_TABLE; /** * This class manages JDK's XML Features. Previously added features and properties @@ -41,19 +41,6 @@ public class JdkXmlFeatures { public static final String XML_FEATURE_MANAGER = ORACLE_JAXP_PROPERTY_PREFIX + "XmlFeatureManager"; - public static final String ORACLE_FEATURE_SERVICE_MECHANISM = - "http://www.oracle.com/feature/use-service-mechanism"; - - /** - * Feature enableExtensionFunctions - */ - public static final String ORACLE_ENABLE_EXTENSION_FUNCTION = - ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions"; - public static final String SP_ENABLE_EXTENSION_FUNCTION = - "javax.xml.enableExtensionFunctions"; - // This is the correct name by the spec - public static final String SP_ENABLE_EXTENSION_FUNCTION_SPEC = - "jdk.xml.enableExtensionFunctions"; public static final String CATALOG_FEATURES = "javax.xml.catalog.catalogFeatures"; public final static String PROPERTY_USE_CATALOG = XMLConstants.USE_CATALOG; @@ -64,35 +51,33 @@ public static enum XmlFeature { * FSP: extension function is enforced by FSP. When FSP is on, extension * function is disabled. */ - ENABLE_EXTENSION_FUNCTION(ORACLE_ENABLE_EXTENSION_FUNCTION, SP_ENABLE_EXTENSION_FUNCTION_SPEC, - ORACLE_ENABLE_EXTENSION_FUNCTION, SP_ENABLE_EXTENSION_FUNCTION, - true, false, true, true), + ENABLE_EXTENSION_FUNCTION(ImplPropMap.ENABLEEXTFUNC, null, null, true, + null, null, true, false, true, true), /** * The {@link javax.xml.XMLConstants.USE_CATALOG} feature. * FSP: USE_CATALOG is not enforced by FSP. */ - USE_CATALOG(PROPERTY_USE_CATALOG, SP_USE_CATALOG, - null, null, - true, false, true, false), + USE_CATALOG(null, PROPERTY_USE_CATALOG, SP_USE_CATALOG, false, + null, null, true, false, true, false), /** * Feature resetSymbolTable * FSP: RESET_SYMBOL_TABLE_FEATURE is not enforced by FSP. */ - RESET_SYMBOL_TABLE_FEATURE(RESET_SYMBOL_TABLE, RESET_SYMBOL_TABLE, - null, null, - false, false, true, false), + RESET_SYMBOL_TABLE_FEATURE(ImplPropMap.RESETSYMBOLTABLE, null, null, false, + null, null, false, false, true, false), /** * Feature overrideDefaultParser * FSP: not enforced by FSP. */ - JDK_OVERRIDE_PARSER(OVERRIDE_PARSER, OVERRIDE_PARSER, - ORACLE_FEATURE_SERVICE_MECHANISM, ORACLE_FEATURE_SERVICE_MECHANISM, - false, false, true, false); + JDK_OVERRIDE_PARSER(ImplPropMap.OVERRIDEPARSER, null, null, false, + null, null, false, false, true, false); + private final ImplPropMap implMap; private final String name; private final String nameSP; + private final boolean differ; private final String nameOld; private final String nameOldSP; private final boolean valueDefault; @@ -102,6 +87,9 @@ public static enum XmlFeature { /** * Constructs an XmlFeature instance. + * @param implMap the Implementation specific properties map. When the + * map is specified, there is no need to repeat or enter other name + * parameters. * @param name the name of the feature * @param nameSP the name of the System Property * @param nameOld the name of the corresponding legacy property @@ -112,12 +100,22 @@ public static enum XmlFeature { * FSP (Feature_Secure_Processing) enforced * with a System property */ - XmlFeature(String name, String nameSP, String nameOld, String nameOldSP, - boolean value, boolean valueEnforced, boolean hasSystem, boolean enforced) { - this.name = name; - this.nameSP = nameSP; - this.nameOld = nameOld; - this.nameOldSP = nameOldSP; + XmlFeature(ImplPropMap implMap, String name, String nameSP, boolean differ, + String nameOld, String nameOldSP, boolean value, boolean valueEnforced, + boolean hasSystem, boolean enforced) { + this.implMap = implMap; + if (implMap != null) { + this.name = implMap.qName(); + this.nameSP = implMap.systemProperty(); + this.nameOld = implMap.qNameOld(); + this.nameOldSP = implMap.systemPropertyOld(); + } else { + this.name = name; + this.nameSP = nameSP; + this.nameOld = nameOld; + this.nameOldSP = nameOldSP; + } + this.differ = differ; this.valueDefault = value; this.valueEnforced = valueEnforced; this.hasSystem = hasSystem; @@ -131,6 +129,9 @@ public static enum XmlFeature { * otherwise */ boolean equalsPropertyName(String propertyName) { + if (implMap != null) { + return implMap.is(propertyName); + } return name.equals(propertyName) || (nameOld != null && nameOld.equals(propertyName)); } @@ -194,28 +195,23 @@ boolean enforced() { return enforced; } - } - - /** - * States of the settings of a property, in the order: default value, value - * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system - * properties, and jaxp api properties - */ - public static enum State { - //this order reflects the overriding order - - DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"), - JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"), - APIPROPERTY("property"); - - final String literal; - State(String literal) { - this.literal = literal; + /** + * Returns the state of a property name. By the specification as of JDK 17, + * the "jdk.xml." prefixed System property name is also the current API + * name. Both the URI-based qName and old name if any are legacy. + * + * @param name the property name + * @return the state of the property name, null if no match + */ + public State getState(String name) { + if (implMap != null) { + return implMap.getState(name); + } else if (this.name.equals(name)) { + return State.APIPROPERTY; + } + return null; } - String literal() { - return literal; - } } /** @@ -272,10 +268,18 @@ public void update() { * false otherwise. */ public boolean setFeature(String propertyName, State state, Object value) { - int index = getIndex(propertyName); - if (index > -1) { - setFeature(index, state, value); - return true; + State pState = state; + XmlFeature f = findByName(propertyName); + // if the feature is managed by JdkXmlFeatures + if (f != null) { + // if it's set from an API, get the correct state + if (state == State.APIPROPERTY) { + pState = f.getState(propertyName); + } + if (pState != null) { + setFeature(f.ordinal(), pState, value); + return true; + } } return false; } @@ -342,6 +346,21 @@ public void setFeature(int index, State state, boolean value) { } } + /** + * Finds the feature by string name. + * + * @param propertyName property name + * @return the feature if found; null otherwise + */ + public XmlFeature findByName(String propertyName) { + for (XmlFeature feature : XmlFeature.values()) { + if (feature.equalsPropertyName(propertyName)) { + return feature; + } + } + return null; + } + /** * Get the index by property name * diff --git a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java index 6c79fab47da..bacaf88c306 100644 --- a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java +++ b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -40,6 +40,7 @@ import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.sax.SAXTransformerFactory; +import static jdk.xml.internal.JdkConstants.OVERRIDE_PARSER; import org.w3c.dom.Document; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; @@ -73,25 +74,7 @@ public class JdkXmlUtils { public final static String CATALOG_PREFER = CatalogFeatures.Feature.PREFER.getPropertyName(); public final static String CATALOG_RESOLVE = CatalogFeatures.Feature.RESOLVE.getPropertyName(); - /** - * Reset SymbolTable feature System property name is identical to feature - * name - */ - public final static String RESET_SYMBOL_TABLE = "jdk.xml.resetSymbolTable"; - - /** - * jdk.xml.overrideDefaultParser: enables the use of a 3rd party's parser - * implementation to override the system-default parser. - */ - public static final String OVERRIDE_PARSER = "jdk.xml.overrideDefaultParser"; - public static final boolean OVERRIDE_PARSER_DEFAULT = SecuritySupport.getJAXPSystemProperty( - Boolean.class, OVERRIDE_PARSER, "false"); - /** - * Values for a feature - */ - public static final String FEATURE_TRUE = "true"; - public static final String FEATURE_FALSE = "false"; /** * Default value of USE_CATALOG. This will read the System property @@ -99,18 +82,6 @@ public class JdkXmlUtils { public static final boolean USE_CATALOG_DEFAULT = SecuritySupport.getJAXPSystemProperty(Boolean.class, SP_USE_CATALOG, "true"); - /** - * Default value of RESET_SYMBOL_TABLE. This will read the System property - */ - public static final boolean RESET_SYMBOL_TABLE_DEFAULT - = SecuritySupport.getJAXPSystemProperty(Boolean.class, RESET_SYMBOL_TABLE, "false"); - - /** - * JDK features (will be consolidated in the next major feature revamp - */ - public final static String CDATA_CHUNK_SIZE = "jdk.xml.cdataChunkSize"; - public static final int CDATA_CHUNK_SIZE_DEFAULT - = SecuritySupport.getJAXPSystemProperty(Integer.class, CDATA_CHUNK_SIZE, "0"); /** * The system-default factory diff --git a/src/java.xml/share/classes/module-info.java b/src/java.xml/share/classes/module-info.java index 350744377b4..253ea709f45 100644 --- a/src/java.xml/share/classes/module-info.java +++ b/src/java.xml/share/classes/module-info.java @@ -47,85 +47,94 @@ * * * + * + * {@link javax.xml.datatype.DatatypeFactory DatatypeFactory} + * + * {@link javax.xml.datatype.DatatypeFactory#newInstance() newInstance()} + * {@code javax.xml.datatype.DatatypeFactory} + * jaxp.properties + * {@link javax.xml.datatype.DatatypeFactory#newDefaultInstance() newDefaultInstance()} + * + * * * {@link javax.xml.parsers.DocumentBuilderFactory DocumentBuilderFactory} * - * {@link javax.xml.parsers.DocumentBuilderFactory#newInstance() newInstance()} - * {@code javax.xml.parsers.DocumentBuilderFactory} - * jaxp.properties - * {@link javax.xml.parsers.DocumentBuilderFactory#newDefaultInstance() newDefaultInstance()} + * {@link javax.xml.parsers.DocumentBuilderFactory#newInstance() newInstance()} + * {@code javax.xml.parsers.DocumentBuilderFactory} + * jaxp.properties + * {@link javax.xml.parsers.DocumentBuilderFactory#newDefaultInstance() newDefaultInstance()} * * * * {@link javax.xml.parsers.SAXParserFactory SAXParserFactory} * - * {@link javax.xml.parsers.SAXParserFactory#newInstance() newInstance()} - * {@code javax.xml.parsers.SAXParserFactory} - * jaxp.properties - * {@link javax.xml.parsers.SAXParserFactory#newDefaultInstance() newDefaultInstance()} + * {@link javax.xml.parsers.SAXParserFactory#newInstance() newInstance()} + * {@code javax.xml.parsers.SAXParserFactory} + * jaxp.properties + * {@link javax.xml.parsers.SAXParserFactory#newDefaultInstance() newDefaultInstance()} * * * * {@link javax.xml.stream.XMLEventFactory XMLEventFactory} * - * {@link javax.xml.stream.XMLEventFactory#newFactory() newFactory()} - * {@code javax.xml.stream.XMLEventFactory} - * + * {@link javax.xml.stream.XMLEventFactory#newFactory() newFactory()} + * {@code javax.xml.stream.XMLEventFactory} + * * stax.properties and then * jaxp.properties * - * {@link javax.xml.stream.XMLEventFactory#newDefaultFactory() newDefaultFactory()} + * {@link javax.xml.stream.XMLEventFactory#newDefaultFactory() newDefaultFactory()} * * * * {@link javax.xml.stream.XMLInputFactory XMLInputFactory} * - * {@link javax.xml.stream.XMLInputFactory#newFactory() newFactory()} - * {@code javax.xml.stream.XMLInputFactory} - * + * {@link javax.xml.stream.XMLInputFactory#newFactory() newFactory()} + * {@code javax.xml.stream.XMLInputFactory} + * * stax.properties and then * jaxp.properties * - * {@link javax.xml.stream.XMLInputFactory#newDefaultFactory() newDefaultFactory()} + * {@link javax.xml.stream.XMLInputFactory#newDefaultFactory() newDefaultFactory()} * * * * {@link javax.xml.stream.XMLOutputFactory XMLOutputFactory} * - * {@link javax.xml.stream.XMLOutputFactory#newFactory() newFactory()} - * {@code javax.xml.stream.XMLOutputFactory} - * + * {@link javax.xml.stream.XMLOutputFactory#newFactory() newFactory()} + * {@code javax.xml.stream.XMLOutputFactory} + * * stax.properties and then * jaxp.properties * - * {@link javax.xml.stream.XMLOutputFactory#newDefaultFactory() newDefaultFactory()} + * {@link javax.xml.stream.XMLOutputFactory#newDefaultFactory() newDefaultFactory()} * * * * {@link javax.xml.transform.TransformerFactory TransformerFactory} * - * {@link javax.xml.transform.TransformerFactory#newInstance() newInstance()} - * {@code javax.xml.transform.TransformerFactory} - * jaxp.properties - * {@link javax.xml.transform.TransformerFactory#newDefaultInstance() newDefaultInstance()} + * {@link javax.xml.transform.TransformerFactory#newInstance() newInstance()} + * {@code javax.xml.transform.TransformerFactory} + * jaxp.properties + * {@link javax.xml.transform.TransformerFactory#newDefaultInstance() newDefaultInstance()} * * * * {@link javax.xml.validation.SchemaFactory SchemaFactory} * - * {@link javax.xml.validation.SchemaFactory#newInstance(java.lang.String) newInstance(schemaLanguage)} - * {@code javax.xml.validation.SchemaFactory:}schemaLanguage[1] - * jaxp.properties - * {@link javax.xml.validation.SchemaFactory#newDefaultInstance() newDefaultInstance()} + * {@link javax.xml.validation.SchemaFactory#newInstance(java.lang.String) newInstance(schemaLanguage)} + * {@code javax.xml.validation.SchemaFactory:}schemaLanguage[1] + * jaxp.properties + * {@link javax.xml.validation.SchemaFactory#newDefaultInstance() newDefaultInstance()} * * * * {@link javax.xml.xpath.XPathFactory XPathFactory} * - * {@link javax.xml.xpath.XPathFactory#newInstance(java.lang.String) newInstance(uri)} - * {@link javax.xml.xpath.XPathFactory#DEFAULT_PROPERTY_NAME DEFAULT_PROPERTY_NAME} + ":uri"[2] - * jaxp.properties - * {@link javax.xml.xpath.XPathFactory#newDefaultInstance() newDefaultInstance()} + * {@link javax.xml.xpath.XPathFactory#newInstance(java.lang.String) newInstance(uri)} + * {@link javax.xml.xpath.XPathFactory#DEFAULT_PROPERTY_NAME DEFAULT_PROPERTY_NAME} + ":uri"[2] + * jaxp.properties + * {@link javax.xml.xpath.XPathFactory#newDefaultInstance() newDefaultInstance()} * * * @@ -231,22 +240,13 @@ * specific features and properties which the implementation currently supports * can be found at the end of this note. * - *

    Naming Convention

    + *

    Naming Convention

    * The names of the features and properties are fully qualified, composed of a * prefix and name. * *

    Prefix

    - * The prefix for JDK properties is defined as: - *
    - *     {@code http://www.oracle.com/xml/jaxp/properties/}
    - * 
    - * - * The prefix for features: - *
    - *     {@code http://www.oracle.com/xml/jaxp/features/}
    - * 
    - * - * The prefix for System Properties: + * The prefix for JDK features and properties, as well as their corresponding + * System Properties if any, is defined as: *
      *     {@code jdk.xml.}
      * 
    @@ -259,7 +259,7 @@ * An example of a property that indicates whether an XML document is standalone * would thus have a format: *
    - *     {@code http://www.oracle.com/xml/jaxp/properties/isStandalone}
    + *     {@code jdk.xml.isStandalone}
      * 
    * and a corresponding System Property: *
    @@ -267,9 +267,9 @@
      * 
    * *

    System Properties

    - * A property may have a corresponding System Property that has the same name - * except for the prefix as shown above. A System Property should be set prior - * to the creation of a processor and may be cleared afterwards. + * A property may have a corresponding System Property with the same name. + * A System Property should be set prior to the creation of a processor and + * may be cleared afterwards. * *

    jaxp.properties

    * A system property can be specified in the jaxp.properties @@ -282,13 +282,15 @@ *

    Scope and Order

    * The {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature * (hereafter referred to as secure processing) is required for XML processors - * including DOM, SAX, Schema Validation, XSLT, and XPath. Any properties flagged + * including DOM, SAX, Schema Validation, XSLT, and XPath. When secure processing + * is set to true, security related features and properties, such as those flagged * as {@code "security: yes"} (hereafter referred to as security properties) in - * table Implementation Specific Properties - * are enforced when secure processing is set to true. Such enforcement includes - * setting security features to true and limits to the defined values shown in - * the table. The property values will not be affected, however, when setting - * secure processing to false. + * table Implementation Specific Features and + * Properties, + * are enforced. Such enforcement includes setting security properties and features + * to more restrictive values and limits as shown in {@code "Value"}'s + * subcolumn {@code "Enforced"} in the tables. When secure processing + * is set to false, however, the property values will not be affected. *

    * When the Java Security Manager is present, secure processing is set to true * and can not be turned off. The security properties are therefore enforced. @@ -316,30 +318,43 @@ * ID * Name * How to set the property + * How to set the feature * * * * * * DOM - * DOM Parser + * DOM Parser * * {@code DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();}
    * {@code dbf.setAttribute(name, value);} * + * + * {@code DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();}
    + * {@code dbf.setFeature(name, value);} + * * * * SAX - * SAX Parser + * SAX Parser * * {@code SAXParserFactory spf = SAXParserFactory.newInstance();}
    * {@code SAXParser parser = spf.newSAXParser();}
    * {@code parser.setProperty(name, value);} * + * + * {@code SAXParserFactory spf = SAXParserFactory.newInstance();}
    + * {@code spf.setFeature(name, value);}
    + * * * * StAX - * StAX Parser + * StAX Parser + * + * {@code XMLInputFactory xif = XMLInputFactory.newInstance();}
    + * {@code xif.setProperty(name, value);} + * * * {@code XMLInputFactory xif = XMLInputFactory.newInstance();}
    * {@code xif.setProperty(name, value);} @@ -347,35 +362,57 @@ * * * Validation - * XML Validation API + * XML Validation API * * {@code SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);}
    * {@code schemaFactory.setProperty(name, value);} * + * + * {@code SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);}
    + * {@code schemaFactory.setFeature(name, value);} + * * * * Transform - * XML Transform API + * XML Transform API * * {@code TransformerFactory factory = TransformerFactory.newInstance();}
    * {@code factory.setAttribute(name, value);} * + * + * {@code TransformerFactory factory = TransformerFactory.newInstance();}
    + * {@code factory.setFeature(name, value);} + * * * * XSLTC Serializer - * XSLTC Serializer + * XSLTC Serializer * * {@code Transformer transformer = TransformerFactory.newInstance().newTransformer();}
    * {@code transformer.setOutputProperty(name, value);} * + * + * * * * DOMLS - * DOM Load and Save + * DOM Load and Save * * {@code LSSerializer serializer = domImplementation.createLSSerializer();}
    * {@code serializer.getDomConfig().setParameter(name, value);} * + * + * + * + * + * XPath + * XPath + * + * + * + * {@code XPathFactory factory = XPathFactory.newInstance();}
    + * {@code factory.setFeature(name, value);} + * * * * @@ -392,120 +429,132 @@ * Implementation Specific Properties * * - * Name [1] + * Full Name (prefix + name) + * [1] * Description - * System Property [2] - * jaxp.properties [2] - * Value [3] - * Security [4] - * Supported Processor [5] - * Since [6] + * System Property [2] + * jaxp.properties [2] + * Value [3] + * Security [4] + * Supported Processor [5] + * Since [6] * * * Type * Value * Default + * Enforced * * * * * * - * entityExpansionLimit + * {@systemProperty jdk.xml.entityExpansionLimit} * Limits the number of entity expansions. * - * yes - * yes - * Integer - * + * yes + * yes + * Integer + * * A positive integer. A value less than or equal to 0 indicates no limit. * If the value is not an integer, a NumberFormatException is thrown. - * - * 64000 - * Yes - * + * + * 64000 + * 64000 + * Yes + * * DOM
    * SAX
    * StAX
    * Validation
    * Transform * - * 8 + * 8 * * - * elementAttributeLimit + * {@systemProperty jdk.xml.elementAttributeLimit} * Limits the number of attributes an element can have. * - * 10000 + * 10000 + * 10000 * * - * maxOccurLimit + * {@systemProperty jdk.xml.maxOccurLimit} * Limits the number of content model nodes that may be created when building * a grammar for a W3C XML Schema that contains maxOccurs attributes with values * other than "unbounded". * - * 5000 + * 5000 + * 5000 * * - * totalEntitySizeLimit + * {@systemProperty jdk.xml.totalEntitySizeLimit} * Limits the total size of all entities that include general and parameter * entities. The size is calculated as an aggregation of all entities. * - * 5x10^7 + * 5x10^7 + * 5x10^7 * * - * maxGeneralEntitySizeLimit + * {@systemProperty jdk.xml.maxGeneralEntitySizeLimit} * Limits the maximum size of any general entities. * - * 0 + * 0 + * 0 * * - * maxParameterEntitySizeLimit + * {@systemProperty jdk.xml.maxParameterEntitySizeLimit} * Limits the maximum size of any parameter entities, including the result * of nesting multiple parameter entities. * - * 10^6 + * 10^6 + * 10^6 * * - * entityReplacementLimit + * {@systemProperty jdk.xml.entityReplacementLimit} * Limits the total number of nodes in all entity references. * - * 3x10^6 + * 3x10^6 + * 3x10^6 * * - * maxElementDepth + * {@systemProperty jdk.xml.maxElementDepth} * Limits the maximum element depth. * - * 0 + * 0 + * 0 * * - * maxXMLNameLimit + * {@systemProperty jdk.xml.maxXMLNameLimit} * Limits the maximum size of XML names, including element name, attribute * name and namespace prefix and URI. * - * 1000 + * 1000 + * 1000 * * * - * isStandalone - * indicates that the serializer should treat the output as a + * {@systemProperty jdk.xml.isStandalone} + * Indicates that the serializer should treat the output as a * standalone document. The property can be used to ensure a newline is written * after the XML declaration. Unlike the property * {@link org.w3c.dom.ls.LSSerializer#getDomConfig() xml-declaration}, this property * does not have an effect on whether an XML declaration should be written out. * - * yes - * yes - * boolean - * true/false - * false - * No - * DOMLS - * 17 + * yes + * yes + * boolean + * true/false + * false + * N/A + * No + * DOMLS + * 17 * * - * xsltcIsStandalone - * indicates that the XSLTC serializer should + * {@systemProperty jdk.xml.xsltcIsStandalone} + * Indicates that the XSLTC serializer should * treat the output as a standalone document. The property can be used to ensure * a newline is written after the XML declaration. Unlike the property * {@link javax.xml.transform.OutputKeys#OMIT_XML_DECLARATION OMIT_XML_DECLARATION}, @@ -516,25 +565,145 @@ * except that it is for the XSLTC Serializer * and its value is a String. * - * yes - * yes - * String - * yes/no - * no - * No - * XSLTC Serializer - * 17 + * yes + * yes + * String + * yes/no + * no + * N/A + * No + * XSLTC Serializer + * 17 + * + * + * {@systemProperty jdk.xml.cdataChunkSize} + * Instructs the parser to return the data in a CData section in a single chunk + * when the property is zero or unspecified, or in multiple chunks when it is greater + * than zero. The parser shall split the data by linebreaks, and any chunks that are + * larger than the specified size to ones that are equal to or smaller than the size. + * + * yes + * yes + * Integer + * A positive integer. A value less than + * or equal to 0 indicates that the property is not specified. If the value is not + * an integer, a NumberFormatException is thrown. + * 0 + * N/A + * No + * SAX
    StAX + * 9 + * + * + * jdk.xml.extensionClassLoader + * Sets a non-null ClassLoader instance to be used for loading XSLTC java + * extension functions. + * + * no + * no + * Object + * A reference to a ClassLoader object. Null if the value is not specified. + * null + * N/A + * No + * Transform + * 9 * * * *

    - * [1] The name of a property. The fully-qualified name, prefix + name, - * should be used when setting the property. - *

    + * The table below lists the Implementation Specific Features currently supported + * by the JDK. More features may be added in the future if necessary. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Implementation Specific Features
    Full Name (prefix + name) + * [1]DescriptionSystem Property [2]jaxp.properties [2]Value [3]Security [4]Supported Processor [5]Since [6]
    TypeValueDefaultEnforced
    {@systemProperty jdk.xml.enableExtensionFunctions}Determines if XSLT and XPath extension functions are to be allowed. + * yesyesBoolean + * true or false. True indicates that extension functions are allowed; False otherwise. + * truefalseYes + * Transform
    + * XPath + *
    8
    {@systemProperty jdk.xml.overrideDefaultParser}Enables the use of a 3rd party's parser implementation to override the + * system-default parser for the JDK's Transform, Validation and XPath implementations. + * + * true or false. True enables the use of 3rd party's parser implementations + * to override the system-default implementation during XML Transform, Validation + * or XPath operation. False disables the use of 3rd party's parser + * implementations. + * falsefalseYes + * Transform
    + * Validation
    + * XPath + *
    9
    {@systemProperty jdk.xml.resetSymbolTable}Instructs the parser to reset its internal symbol table during each parse operation. + * + * true or false. True indicates that the SymbolTable associated with a parser needs to be + * reallocated during each parse operation.
    + * False indicates that the parser's SymbolTable instance shall be reused + * during subsequent parse operations. + *
    falseN/ANo + * SAX + * 9
    + *

    + * [1] The full name of a property should be used to set the property. + *

    * [2] A value "yes" indicates there is a corresponding System Property * for the property, "no" otherwise. * - *

    + *

    * [3] The value must be exactly as listed in this table, case-sensitive. * The value of the corresponding System Property is the String representation of * the property value. If the type is boolean, the system property is true only @@ -544,17 +713,99 @@ * is Integer, the value of the System Property is the String representation of * the value (e.g. "64000" for {@code entityExpansionLimit}). * - *

    + *

    * [4] A value "yes" indicates the property is a Security Property. Refer * to the Scope and Order on how secure processing * may affect the value of a Security Property. - *

    + *

    * [5] One or more processors that support the property. The values of the * field are IDs described in table Processors. - *

    + *

    * [6] Indicates the initial release the property is introduced. * + *

    Legacy Property Names (deprecated)

    + * JDK releases prior to JDK 17 support the use of URI style prefix for properties. + * These legacy property names are deprecated as of JDK 17 and may be removed + * in future releases. If both new and legacy properties are set, the new property + * names take precedence regardless of how and where they are set. The overriding order + * as defined in Scope and Order thus becomes, in + * descending order: * + *
      + *
    • The default value;
    • + *
    • Value set by FEATURE_SECURE_PROCESSING;
    • + *
    • Value set in jaxp.properties;
    • + *
    • Value set as System Property;
    • + *
    • Value set on factories or processors using legacy property names;
    • + *
    • Value set on factories or processors using new property names.
    • + *
    + *

    + * The following table lists the properties and their corresponding legacy names. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Legacy Property Names (deprecated since 17)
    PropertyLegacy Property Name(s)
    {@systemProperty jdk.xml.entityExpansionLimit}{@code http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit}
    {@systemProperty jdk.xml.elementAttributeLimit}{@code http://www.oracle.com/xml/jaxp/properties/elementAttributeLimit}
    {@systemProperty jdk.xml.maxOccurLimit}{@code http://www.oracle.com/xml/jaxp/properties/maxOccurLimit}
    {@systemProperty jdk.xml.totalEntitySizeLimit}{@code http://www.oracle.com/xml/jaxp/properties/totalEntitySizeLimit}
    {@systemProperty jdk.xml.maxGeneralEntitySizeLimit}{@code http://www.oracle.com/xml/jaxp/properties/maxGeneralEntitySizeLimit}
    {@systemProperty jdk.xml.maxParameterEntitySizeLimit}{@code http://www.oracle.com/xml/jaxp/properties/maxParameterEntitySizeLimit}
    {@systemProperty jdk.xml.entityReplacementLimit}{@code http://www.oracle.com/xml/jaxp/properties/entityReplacementLimit}
    {@systemProperty jdk.xml.maxElementDepth}{@code http://www.oracle.com/xml/jaxp/properties/maxElementDepth}
    {@systemProperty jdk.xml.maxXMLNameLimit}{@code http://www.oracle.com/xml/jaxp/properties/maxXMLNameLimit}
    {@systemProperty jdk.xml.isStandalone}{@code http://www.oracle.com/xml/jaxp/properties/isStandalone}
    {@systemProperty jdk.xml.xsltcIsStandalone}{@code http://www.oracle.com/xml/is-standalone}
    + * {@code http://www.oracle.com/xml/jaxp/properties/xsltcIsStandalone}
    {@code jdk.xml.extensionClassLoader}{@code jdk.xml.transform.extensionClassLoader}
    {@systemProperty jdk.xml.enableExtensionFunctions}{@code http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions}
    * * @uses javax.xml.datatype.DatatypeFactory * @uses javax.xml.parsers.DocumentBuilderFactory diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java index 0ed59fe31b4..7a66a7891e9 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -40,13 +40,13 @@ *

      *
    • If the node being visited has no children, the result will be {@code null}. *
    • If the node being visited has one child, the result will be the - * result of calling {@code scan} on that child. The child may be a simple node + * result of calling {@code scan} with that child. The child may be a simple node * or itself a list of nodes. - *
    • If the node being visited has more than one child, the result will - * be determined by calling {@code scan} each child in turn, and then combining the + *
    • If the node being visited has more than one child, the result will + * be determined by calling {@code scan} with each child in turn, and then combining the * result of each scan after the first with the cumulative result * so far, as determined by the {@link #reduce} method. Each child may be either - * a simple node of a list of nodes. The default behavior of the {@code reduce} + * a simple node or a list of nodes. The default behavior of the {@code reduce} * method is such that the result of the visitXYZ method will be the result of * the last child scanned. *
    diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java b/src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java index 26c857721a3..4dea9914516 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/TreePath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -33,7 +33,7 @@ /** * A path of tree nodes, typically used to represent the sequence of ancestor - * nodes of a tree node up to the top level CompilationUnitTree node. + * nodes of a tree node up to the top-level {@code CompilationUnitTree} node. * * @author Jonathan Gibbons * @since 1.6 diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java b/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java index d78d6f1ab15..dc4295fb96b 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -39,13 +39,13 @@ *
      *
    • If the node being visited has no children, the result will be {@code null}. *
    • If the node being visited has one child, the result will be the - * result of calling {@code scan} on that child. The child may be a simple node + * result of calling {@code scan} with that child. The child may be a simple node * or itself a list of nodes. - *
    • If the node being visited has more than one child, the result will - * be determined by calling {@code scan} each child in turn, and then combining the + *
    • If the node being visited has more than one child, the result will + * be determined by calling {@code scan} with each child in turn, and then combining the * result of each scan after the first with the cumulative result * so far, as determined by the {@link #reduce} method. Each child may be either - * a simple node of a list of nodes. The default behavior of the {@code reduce} + * a simple node or a list of nodes. The default behavior of the {@code reduce} * method is such that the result of the visitXYZ method will be the result of * the last child scanned. *
    diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java index d7012405d1e..ea46952d105 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -624,12 +624,10 @@ private Symbol attributeParamIdentifier(TreePath path, DCParam paramTag) { return null; } - /** @see com.sun.tools.javadoc.ClassDocImpl#findField */ private VarSymbol findField(ClassSymbol tsym, Name fieldName) { return searchField(tsym, fieldName, new HashSet<>()); } - /** @see com.sun.tools.javadoc.ClassDocImpl#searchField */ private VarSymbol searchField(ClassSymbol tsym, Name fieldName, Set searched) { if (searched.contains(tsym)) { return null; @@ -676,7 +674,6 @@ private VarSymbol searchField(ClassSymbol tsym, Name fieldName, Set return null; } - /** @see com.sun.tools.javadoc.ClassDocImpl#findConstructor */ MethodSymbol findConstructor(ClassSymbol tsym, List paramTypes) { for (Symbol sym : tsym.members().getSymbolsByName(names.init)) { if (sym.kind == MTH) { @@ -688,12 +685,10 @@ MethodSymbol findConstructor(ClassSymbol tsym, List paramTypes) { return null; } - /** @see com.sun.tools.javadoc.ClassDocImpl#findMethod */ private MethodSymbol findMethod(ClassSymbol tsym, Name methodName, List paramTypes) { return searchMethod(tsym, methodName, paramTypes, new HashSet<>()); } - /** @see com.sun.tools.javadoc.ClassDocImpl#searchMethod */ private MethodSymbol searchMethod(ClassSymbol tsym, Name methodName, List paramTypes, Set searched) { //### Note that this search is not necessarily what the compiler would do! @@ -775,7 +770,6 @@ private MethodSymbol searchMethod(ClassSymbol tsym, Name methodName, return null; } - /** @see com.sun.tools.javadoc.ClassDocImpl */ private boolean hasParameterTypes(MethodSymbol method, List paramTypes) { if (paramTypes == null) return true; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java index 2c593003312..fe0f1432305 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java @@ -36,7 +36,6 @@ import com.sun.tools.javac.comp.DeferredAttr.AttrMode; import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext; import com.sun.tools.javac.comp.DeferredAttr.DeferredType; -import com.sun.tools.javac.comp.DeferredAttr.DeferredTypeCompleter; import com.sun.tools.javac.comp.DeferredAttr.LambdaReturnScanner; import com.sun.tools.javac.comp.DeferredAttr.SwitchExpressionScanner; import com.sun.tools.javac.comp.Infer.PartiallyInferredMethodType; @@ -55,7 +54,6 @@ import com.sun.tools.javac.tree.JCTree.JCSwitchExpression; import com.sun.tools.javac.tree.TreeCopier; import com.sun.tools.javac.tree.TreeInfo; -import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DiagnosticSource; import com.sun.tools.javac.util.JCDiagnostic; @@ -336,7 +334,7 @@ public void visitNewClass(JCNewClass that) { * perform an overload check without the need of calling back to Attr. This extra information * is typically stored in the form of a speculative tree. */ - abstract class ArgumentType extends DeferredType implements DeferredTypeCompleter { + abstract class ArgumentType extends DeferredType { /** The speculative tree carrying type information. */ T speculativeTree; @@ -351,24 +349,18 @@ public ArgumentType(JCExpression tree, Env env, T speculativeTree, } @Override - final DeferredTypeCompleter completer() { - return this; - } - - @Override - public final Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { - Assert.check(dt == this); + public final Type complete(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { if (deferredAttrContext.mode == AttrMode.SPECULATIVE) { Type t = (resultInfo.pt == Type.recoveryType) ? - deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext) : + super.complete(resultInfo, deferredAttrContext) : overloadCheck(resultInfo, deferredAttrContext); speculativeTypes.put(resultInfo, t); return t; } else { if (!env.info.attributionMode.isSpeculative) { - argumentTypeCache.remove(new UniquePos(dt.tree)); + argumentTypeCache.remove(new UniquePos(tree)); } - return deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext); + return super.complete(resultInfo, deferredAttrContext); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index a3f8fa780e0..644b6f9ab24 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -167,9 +167,7 @@ protected Attr(Context context) { allowLambda = Feature.LAMBDA.allowedInSource(source); allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source); allowStaticInterfaceMethods = Feature.STATIC_INTERFACE_METHODS.allowedInSource(source); - allowReifiableTypesInInstanceof = - Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source) && - (!preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF) || preview.isEnabled()); + allowReifiableTypesInInstanceof = Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source); allowRecords = Feature.RECORDS.allowedInSource(source); sourceName = source.name; useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning"); @@ -3996,9 +3994,6 @@ public void visitTypeTest(JCInstanceOf tree) { if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) { boolean valid = false; if (allowReifiableTypesInInstanceof) { - if (preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF)) { - preview.warnPreview(tree.expr.pos(), Feature.REIFIABLE_TYPES_INSTANCEOF); - } Warner warner = new Warner(); if (!types.isCastable(exprtype, clazztype, warner)) { chk.basicHandler.report(tree.expr.pos(), diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 7fccced02ce..2822edd09e0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -306,8 +306,21 @@ JCTree speculativeTree(DeferredAttrContext deferredAttrContext) { return e != null ? e.speculativeTree : stuckTree; } - DeferredTypeCompleter completer() { - return basicCompleter; + public Type complete(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { + switch (deferredAttrContext.mode) { + case SPECULATIVE: + //Note: if a symbol is imported twice we might do two identical + //speculative rounds... + Assert.check(mode == null || mode == AttrMode.SPECULATIVE); + JCTree speculativeTree = attribSpeculative(tree, env, resultInfo); + speculativeCache.put(speculativeTree, resultInfo); + return speculativeTree.type; + case CHECK: + Assert.check(mode != null); + return attr.attribTree(tree, env, resultInfo); + } + Assert.error(); + return null; } /** @@ -327,21 +340,23 @@ Type check(ResultInfo resultInfo) { } else { deferredStuckPolicy = new CheckStuckPolicy(resultInfo, this); } - return check(resultInfo, deferredStuckPolicy, completer()); + return check(resultInfo, deferredStuckPolicy); } - private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy, - DeferredTypeCompleter deferredTypeCompleter) { + private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy) { DeferredAttrContext deferredAttrContext = resultInfo.checkContext.deferredAttrContext(); Assert.check(deferredAttrContext != emptyDeferredAttrContext); if (deferredStuckPolicy.isStuck()) { - notPertinentToApplicability.add(deferredAttrContext.msym); deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy); + if (deferredAttrContext.mode == AttrMode.SPECULATIVE) { + notPertinentToApplicability.add(deferredAttrContext.msym); + mode = AttrMode.SPECULATIVE; + } return Type.noType; } else { try { - return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext); + return complete(resultInfo, deferredAttrContext); } finally { mode = deferredAttrContext.mode; } @@ -349,44 +364,6 @@ private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolic } } - /** - * A completer for deferred types. Defines an entry point for type-checking - * a deferred type. - */ - interface DeferredTypeCompleter { - /** - * Entry point for type-checking a deferred type. Depending on the - * circumstances, type-checking could amount to full attribution - * or partial structural check (aka potential applicability). - */ - Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext); - } - - - /** - * A basic completer for deferred types. This completer type-checks a deferred type - * using attribution; depending on the attribution mode, this could be either standard - * or speculative attribution. - */ - DeferredTypeCompleter basicCompleter = new DeferredTypeCompleter() { - public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { - switch (deferredAttrContext.mode) { - case SPECULATIVE: - //Note: if a symbol is imported twice we might do two identical - //speculative rounds... - Assert.check(dt.mode == null || dt.mode == AttrMode.SPECULATIVE); - JCTree speculativeTree = attribSpeculative(dt.tree, dt.env, resultInfo); - dt.speculativeCache.put(speculativeTree, resultInfo); - return speculativeTree.type; - case CHECK: - Assert.check(dt.mode != null); - return attr.attribTree(dt.tree, dt.env, resultInfo); - } - Assert.error(); - return null; - } - }; - /** * Policy for detecting stuck expressions. Different criteria might cause * an expression to be judged as stuck, depending on whether the check @@ -781,7 +758,7 @@ boolean process(final DeferredAttrContext deferredAttrContext) { switch (deferredAttrContext.mode) { case SPECULATIVE: if (deferredStuckPolicy.isStuck()) { - dt.check(resultInfo, dummyStuckPolicy, new StructuralStuckChecker()); + new StructuralStuckChecker().check(dt, resultInfo, deferredAttrContext); return true; } else { Assert.error("Cannot get here"); @@ -813,7 +790,7 @@ public DeferredAttrContext deferredAttrContext() { "attribution shouldn't be happening here"); ResultInfo instResultInfo = resultInfo.dup(deferredAttrContext.inferenceContext.asInstType(resultInfo.pt)); - dt.check(instResultInfo, dummyStuckPolicy, basicCompleter); + dt.check(instResultInfo, dummyStuckPolicy); return true; } default: @@ -824,19 +801,18 @@ public DeferredAttrContext deferredAttrContext() { /** * Structural checker for stuck expressions */ - class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter { + class StructuralStuckChecker extends TreeScanner { ResultInfo resultInfo; InferenceContext inferenceContext; Env env; - public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { + public void check(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { this.resultInfo = resultInfo; this.inferenceContext = deferredAttrContext.inferenceContext; this.env = dt.env; dt.tree.accept(this); dt.speculativeCache.put(stuckTree, resultInfo); - return Type.noType; } @Override @@ -926,6 +902,11 @@ public void visitConditional(JCTree.JCConditional tree) { scan(tree.falsepart); } + @Override + public void visitSwitchExpression(JCSwitchExpression tree) { + scan(tree.cases); + } + @Override public void visitReference(JCMemberReference tree) { Assert.checkNonNull(tree.getOverloadKind()); @@ -1151,7 +1132,7 @@ void skip(JCTree tree) {} static class PolyScanner extends FilterScanner { PolyScanner() { - super(EnumSet.of(CONDEXPR, PARENS, LAMBDA, REFERENCE)); + super(EnumSet.of(CONDEXPR, PARENS, LAMBDA, REFERENCE, SWITCH_EXPRESSION)); } } @@ -1287,6 +1268,24 @@ public void visitReturn(JCReturn tree) { lambdaScanner.scan(lambda.body); } } + + @Override + public void visitSwitchExpression(JCSwitchExpression expr) { + SwitchExpressionScanner switchScanner = new SwitchExpressionScanner() { + @Override + public void visitYield(JCYield tree) { + Type prevPt = CheckStuckPolicy.this.pt; + try { + CheckStuckPolicy.this.pt = pt; + CheckStuckPolicy.this.scan(tree.value); + } finally { + CheckStuckPolicy.this.pt = prevPt; + } + } + }; + switchScanner.scan(expr.cases); + } + } /** diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index a325a08459f..dfb04b9b099 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -146,8 +146,7 @@ protected Resolve(Context context) { Target target = Target.instance(context); allowFunctionalInterfaceMostSpecific = Feature.FUNCTIONAL_INTERFACE_MOST_SPECIFIC.allowedInSource(source); allowLocalVariableTypeInference = Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source); - allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) && - Feature.SWITCH_EXPRESSION.allowedInSource(source); + allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source); checkVarargsAccessAfterResolution = Feature.POST_APPLICABILITY_VARARGS_ACCESS_CHECK.allowedInSource(source); polymorphicSignatureScope = WriteableScope.create(syms.noSymbol); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 1e7d8d5ecdc..d3ef9e7c1b1 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -2547,10 +2547,23 @@ void readClass(ClassSymbol c) { for (int i = 0; i < fieldCount; i++) enterMember(c, readField()); Assert.check(methodCount == nextChar()); for (int i = 0; i < methodCount; i++) enterMember(c, readMethod()); - + if (c.isRecord()) { + for (RecordComponent rc: c.getRecordComponents()) { + rc.accessor = lookupMethod(c, rc.name, List.nil()); + } + } typevars = typevars.leave(); } + private MethodSymbol lookupMethod(TypeSymbol tsym, Name name, List argtypes) { + for (Symbol s : tsym.members().getSymbolsByName(name, s -> s.kind == MTH)) { + if (types.isSameTypes(s.type.getParameterTypes(), argtypes)) { + return (MethodSymbol) s; + } + } + return null; + } + /** Read inner class info. For each inner/outer pair allocate a * member class. */ diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java index b99598aa4de..05b552745fa 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java @@ -342,12 +342,16 @@ private List getJavacOpts(String... runtimeArgs) throws Fault { } break; default: + if (opt.startsWith("-agentlib:jdwp=") || opt.startsWith("-Xrunjdwp:")) { + javacOpts.add("-g"); + } // ignore all other runtime args } } // add implicit options javacOpts.add("-proc:none"); + javacOpts.add("-Xdiags:verbose"); return javacOpts; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java index a08370b66cf..637eba879f4 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java @@ -448,6 +448,7 @@ public boolean validate() { // But also note that none of these options are supported in API mode. if (options.isSet(Option.HELP) || options.isSet(Option.X) + || options.isSet(Option.HELP_LINT) || options.isSet(Option.VERSION) || options.isSet(Option.FULLVERSION) || options.isSet(Option.MODULE)) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java index 2eae5da0b6c..a6d050b0a6f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -103,29 +103,7 @@ public void process(OptionHelper helper, String option) { XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC), - XLINT_CUSTOM("-Xlint:", "opt.arg.Xlint", "opt.Xlint.custom", EXTENDED, BASIC, ANYOF, getXLintChoices()) { - private final String LINT_KEY_FORMAT = LARGE_INDENT + " %-" + - (DEFAULT_SYNOPSIS_WIDTH + SMALL_INDENT.length() - LARGE_INDENT.length() - 2) + "s %s"; - @Override - protected void help(Log log) { - super.help(log); - log.printRawLines(WriterKind.STDOUT, - String.format(LINT_KEY_FORMAT, - "all", - log.localize(PrefixKind.JAVAC, "opt.Xlint.all"))); - for (LintCategory lc : LintCategory.values()) { - log.printRawLines(WriterKind.STDOUT, - String.format(LINT_KEY_FORMAT, - lc.option, - log.localize(PrefixKind.JAVAC, - "opt.Xlint.desc." + lc.option))); - } - log.printRawLines(WriterKind.STDOUT, - String.format(LINT_KEY_FORMAT, - "none", - log.localize(PrefixKind.JAVAC, "opt.Xlint.none"))); - } - }, + XLINT_CUSTOM("-Xlint:", "opt.arg.Xlint", "opt.Xlint.custom", EXTENDED, BASIC, ANYOF, getXLintChoices()), XDOCLINT("-Xdoclint", "opt.Xdoclint", EXTENDED, BASIC), @@ -499,6 +477,32 @@ public void process(OptionHelper helper, String option) throws InvalidValueExcep } }, + HELP_LINT("--help-lint", "opt.help.lint", EXTENDED, INFO) { + private final String LINT_KEY_FORMAT = SMALL_INDENT + SMALL_INDENT + "%-" + + (DEFAULT_SYNOPSIS_WIDTH - LARGE_INDENT.length()) + "s %s"; + @Override + public void process(OptionHelper helper, String option) throws InvalidValueException { + Log log = helper.getLog(); + log.printRawLines(WriterKind.STDOUT, log.localize(PrefixKind.JAVAC, "opt.help.lint.header")); + log.printRawLines(WriterKind.STDOUT, + String.format(LINT_KEY_FORMAT, + "all", + log.localize(PrefixKind.JAVAC, "opt.Xlint.all"))); + for (LintCategory lc : LintCategory.values()) { + log.printRawLines(WriterKind.STDOUT, + String.format(LINT_KEY_FORMAT, + lc.option, + log.localize(PrefixKind.JAVAC, + "opt.Xlint.desc." + lc.option))); + } + log.printRawLines(WriterKind.STDOUT, + String.format(LINT_KEY_FORMAT, + "none", + log.localize(PrefixKind.JAVAC, "opt.Xlint.none"))); + super.process(helper, option); + } + }, + // This option exists only for the purpose of documenting itself. // It's actually implemented by the launcher. J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO, ArgKind.ADJACENT) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java index 6ff91d543a8..09368424566 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -183,8 +183,7 @@ protected JavacParser(ParserFactory fac, this.keepLineMap = keepLineMap; this.errorTree = F.Erroneous(); endPosTable = newEndPosTable(keepEndPositions); - this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) && - Feature.SWITCH_EXPRESSION.allowedInSource(source); + this.allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source); this.allowRecords = Feature.RECORDS.allowedInSource(source); this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source); } @@ -309,8 +308,8 @@ protected boolean peekToken(Predicate... kinds) { @SuppressWarnings("unchecked") protected boolean peekToken(int lookahead, Predicate... kinds) { - for (; lookahead < kinds.length ; lookahead++) { - if (!kinds[lookahead].test(S.token(lookahead + 1).kind)) { + for (Predicate kind : kinds) { + if (!kind.test(S.token(++lookahead).kind)) { return false; } } @@ -4556,6 +4555,7 @@ private JCExpression insertAnnotationsToMostInner( if (createNewLevel) { mostInnerType = to(F.at(token.pos).TypeArray(mostInnerType)); + origEndPos = getEndPos(mostInnerType); } JCExpression mostInnerTypeToReturn = mostInnerType; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 1111a14c6e3..8cdd5ed91ba 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -2198,9 +2198,6 @@ compiler.err.enum.constant.not.expected=\ enum constant not expected here ## The following are related in form, but do not easily fit the above paradigm. -compiler.err.expected.module=\ - ''module'' expected - compiler.err.expected.module.or.open=\ ''module'' or ''open'' expected diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties index 4264a2e12a5..498e868589b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 @@ -172,7 +172,7 @@ javac.opt.arg.Xlint=\ javac.opt.Xlint.custom=\ Warnings to enable or disable, separated by comma.\n\ Precede a key by '-' to disable the specified warning.\n\ - Supported keys are: + Use --help-lint to see the supported keys. javac.opt.Xlint.desc.auxiliaryclass=\ Warn about an auxiliary class that is hidden in a source file, and is used from other files. @@ -241,7 +241,7 @@ javac.opt.Xlint.desc.requires-transitive-automatic=\ javac.opt.Xlint.desc.serial=\ Warn about Serializable classes that do not provide a serial version ID. \n\ -\ Also warn about access to non-public members from a serializable element. +\ Also warn about access to non-public members from a serializable element. javac.opt.Xlint.desc.static=\ Warn about accessing a static member using an instance. @@ -292,6 +292,10 @@ javac.opt.X=\ Print help on extra options javac.opt.help=\ Print this help message +javac.opt.help.lint=\ + Print the supported keys for -Xlint +javac.opt.help.lint.header=\ + The supported keys for -Xlint are: javac.opt.print=\ Print out a textual representation of specified types javac.opt.printRounds=\ diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java index 8bcf6fbaf57..8fe7f98df70 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java @@ -313,10 +313,9 @@ private static Map initWriters(PrintWriter out, PrintWr /** * Construct a log with given I/O redirections. * @deprecated - * This constructor is provided to support the supported but now-deprecated javadoc entry point - * com.sun.tools.javadoc.Main.execute(String programName, - * PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter, - * String defaultDocletClassName, String... args) + * This constructor is provided to support + * jdk.javadoc.internal.tool.Messager.Messager(com.sun.tools.javac.util.Context, + * java.lang.String, java.io.PrintWriter, java.io.PrintWriter) */ @Deprecated protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/DebugServer.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/DebugServer.java index cb5d21b7a3f..2cf8a81dca4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/DebugServer.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/DebugServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -103,11 +103,11 @@ private void run(String[] args) { try { if (usePid) { System.err.println("Attaching to process ID " + pid + " and starting RMI services, please wait..."); - agent.startServer(pid, serverID); + agent.startServer(pid, serverID, null); } else { System.err.println("Attaching to core " + coreFileName + " from executable " + javaExecutableName + " and starting RMI services, please wait..."); - agent.startServer(javaExecutableName, coreFileName, serverID); + agent.startServer(javaExecutableName, coreFileName, serverID, null); } } catch (DebuggerException e) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java index 3d339c819a0..aa021510567 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java @@ -90,6 +90,7 @@ public class HotSpotAgent { // All needed information for server side private String serverID; + private String serverName; private String[] jvmLibNames; @@ -203,7 +204,8 @@ public synchronized boolean detach() throws DebuggerException { to which the RMI connector is bound. If not specified a random available port is used. */ public synchronized void startServer(int processID, - String uniqueID, + String serverID, + String serverName, int rmiPort) { if (debugger != null) { throw new DebuggerException("Already attached"); @@ -211,7 +213,8 @@ public synchronized void startServer(int processID, pid = processID; startupMode = PROCESS_MODE; isServer = true; - serverID = uniqueID; + this.serverID = serverID; + this.serverName = serverName; this.rmiPort = rmiPort; go(); } @@ -220,8 +223,8 @@ public synchronized void startServer(int processID, starts a debug server, allowing remote machines to connect and examine this process. Uses specified name to uniquely identify a specific debuggee on the server */ - public synchronized void startServer(int processID, String uniqueID) { - startServer(processID, uniqueID, 0); + public synchronized void startServer(int processID, String serverID, String serverName) { + startServer(processID, serverID, serverName, 0); } /** This attaches to a process running on the local machine and @@ -229,7 +232,7 @@ public synchronized void startServer(int processID, String uniqueID) { examine this process. */ public synchronized void startServer(int processID) throws DebuggerException { - startServer(processID, null); + startServer(processID, null, null); } /** This opens a core file on the local machine and starts a debug @@ -239,7 +242,8 @@ public synchronized void startServer(int processID) is bound. If not specified a random available port is used. */ public synchronized void startServer(String javaExecutableName, String coreFileName, - String uniqueID, + String serverID, + String serverName, int rmiPort) { if (debugger != null) { throw new DebuggerException("Already attached"); @@ -251,7 +255,8 @@ public synchronized void startServer(String javaExecutableName, this.coreFileName = coreFileName; startupMode = CORE_FILE_MODE; isServer = true; - serverID = uniqueID; + this.serverID = serverID; + this.serverName = serverName; this.rmiPort = rmiPort; go(); } @@ -262,8 +267,9 @@ public synchronized void startServer(String javaExecutableName, debugee */ public synchronized void startServer(String javaExecutableName, String coreFileName, - String uniqueID) { - startServer(javaExecutableName, coreFileName, uniqueID, 0); + String serverID, + String serverName) { + startServer(javaExecutableName, coreFileName, serverID, serverName, 0); } /** This opens a core file on the local machine and starts a debug @@ -271,7 +277,7 @@ public synchronized void startServer(String javaExecutableName, core file. */ public synchronized void startServer(String javaExecutableName, String coreFileName) throws DebuggerException { - startServer(javaExecutableName, coreFileName, null); + startServer(javaExecutableName, coreFileName, null, null); } /** This may only be called on the server side after startServer() @@ -302,7 +308,7 @@ private boolean detachInternal() { DebuggerException ex = null; if (isServer) { try { - RMIHelper.unbind(serverID); + RMIHelper.unbind(serverID, serverName); } catch (DebuggerException de) { ex = de; @@ -377,7 +383,7 @@ private void setupDebugger() { catch (RemoteException rem) { throw new DebuggerException(rem); } - RMIHelper.rebind(serverID, remote); + RMIHelper.rebind(serverID, serverName, remote); } } else { // diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java index bbf3e394383..d44576a4a74 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java @@ -28,12 +28,14 @@ import java.net.*; import java.rmi.*; import java.rmi.registry.*; +import java.util.regex.*; import sun.jvm.hotspot.debugger.DebuggerException; public class RMIHelper { private static final boolean startRegistry; + private static final Pattern CONNECT_PATTERN = Pattern.compile("^((?.+?)@)?(?.+?)(/(?.+))?$"); + private static final String DEFAULT_RMI_OBJECT_NAME = "SARemoteDebugger"; private static int port; - private static String serverNamePrefix; static { String tmp = System.getProperty("sun.jvm.hotspot.rmi.startRegistry"); @@ -53,12 +55,10 @@ public class RMIHelper { System.err.println("invalid port supplied, assuming default"); } } - - serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix", "SARemoteDebugger"); } - public static void rebind(String uniqueID, Remote object) throws DebuggerException { - String name = getName(uniqueID); + public static void rebind(String serverID, String serverName, Remote object) throws DebuggerException { + String name = getName(serverID, serverName); try { Naming.rebind(name, object); } catch (RemoteException re) { @@ -78,8 +78,8 @@ public static void rebind(String uniqueID, Remote object) throws DebuggerExcepti } } - public static void unbind(String uniqueID) throws DebuggerException { - String name = getName(uniqueID); + public static void unbind(String serverID, String serverName) throws DebuggerException { + String name = getName(serverID, serverName); try { Naming.unbind(name); } catch (Exception exp) { @@ -87,25 +87,32 @@ public static void unbind(String uniqueID) throws DebuggerException { } } - public static Remote lookup(String debugServerID) throws DebuggerException { - // debugServerID follows the pattern [unique_id@]host[:port] - // we have to transform this as //host[:port]/['_'] + public static Remote lookup(String connectionString) throws DebuggerException { + // connectionString follows the pattern [serverid@]host[:port][/servername] + // we have to transform this as //host[:port]/['_'] + Matcher matcher = CONNECT_PATTERN.matcher(connectionString); + matcher.find(); - int index = debugServerID.indexOf('@'); - StringBuilder nameBuf = new StringBuilder("//"); - String uniqueID = null; - if (index != -1) { - nameBuf.append(debugServerID.substring(index + 1)); - uniqueID = debugServerID.substring(0, index); - } else { - nameBuf.append(debugServerID); + String serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix"); + String rmiObjectName = matcher.group("servername"); + if (serverNamePrefix != null) { + if (rmiObjectName == null) { + System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it in --connect."); + rmiObjectName = serverNamePrefix; + } else { + throw new DebuggerException("Cannot set both sun.jvm.hotspot.rmi.serverNamePrefix and servername in --connect together"); + } } - + if (rmiObjectName == null) { + rmiObjectName = DEFAULT_RMI_OBJECT_NAME; + } + StringBuilder nameBuf = new StringBuilder("//"); + nameBuf.append(matcher.group("host")); nameBuf.append('/'); - nameBuf.append(serverNamePrefix); - if (uniqueID != null) { + nameBuf.append(rmiObjectName); + if (matcher.group("serverid") != null) { nameBuf.append('_'); - nameBuf.append(uniqueID); + nameBuf.append(matcher.group("serverid")); } try { @@ -115,12 +122,22 @@ public static Remote lookup(String debugServerID) throws DebuggerException { } } - private static String getName(String uniqueID) { - String name = null; - if (uniqueID != null) { - name = serverNamePrefix + "_" + uniqueID; - } else { - name = serverNamePrefix; + private static String getName(String serverID, String serverName) { + String name = serverName; + String serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix"); + if (serverNamePrefix != null) { + if (serverName == null) { + System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it with --servername."); + name = serverNamePrefix; + } else { + throw new DebuggerException("Cannot set both sun.jvm.hotspot.rmi.serverNamePrefix and --servername together"); + } + } + if (name == null) { + name = DEFAULT_RMI_OBJECT_NAME; + } + if (serverID != null) { + name += "_" + serverID; } if (port != Registry.REGISTRY_PORT) { name = "//localhost:" + port + "/" + name; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java index a0cd1c12c9b..b873eb1e55b 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java @@ -68,7 +68,7 @@ private static boolean commonHelp(String mode, boolean canConnectToRemote) { System.out.println(" --core To operate on the given core file."); System.out.println(" --exe "); if (canConnectToRemote) { - System.out.println(" --connect [@][:registryport] To connect to a remote debug server (debugd)."); + System.out.println(" --connect [@][:registryport][/servername] To connect to a remote debug server (debugd)."); } System.out.println(); System.out.println(" The --core and --exe options must be set together to give the core"); @@ -85,15 +85,14 @@ private static boolean commonHelp(String mode, boolean canConnectToRemote) { System.out.println(" Examples: jhsdb " + mode + " --pid 1234"); System.out.println(" or jhsdb " + mode + " --core ./core.1234 --exe ./myexe"); if (canConnectToRemote) { - System.out.println(" or jhsdb " + mode + " --connect id@debugserver:1234"); + System.out.println(" or jhsdb " + mode + " --connect serverid@debugserver:1234/servername"); } return false; } private static boolean debugdHelp() { - // [options] [server-id] - // [options] [server-id] - System.out.println(" --serverid A unique identifier for this debug server."); + System.out.println(" --serverid A unique identifier for this debugd server."); + System.out.println(" --servername Instance name of debugd server."); System.out.println(" --rmiport Sets the port number to which the RMI connector is bound." + " If not specified a random available port is used."); System.out.println(" --registryport Sets the RMI registry port." + @@ -376,7 +375,8 @@ private static void runDEBUGD(String[] args) { "rmiport=", "rmiport", "registryport=", "registryport", "disable-registry", "disable-registry", - "hostname=", "hostname"); + "hostname=", "hostname", + "servername=", "servername"); Map argMap = parseOptions(args, longOptsMap); @@ -391,6 +391,7 @@ private static void runDEBUGD(String[] args) { String javaExecutableName = argMap.get("exe"); String coreFileName = argMap.get("core"); String pidString = argMap.get("pid"); + String serverName = argMap.get("servername"); // Set RMI registry port, if specified if (registryPort != null) { @@ -434,7 +435,7 @@ private static void runDEBUGD(String[] args) { System.err.println("Attaching to process ID " + pid + " and starting RMI services," + " please wait..."); try { - agent.startServer(pid, serverID, rmiPort); + agent.startServer(pid, serverID, serverName, rmiPort); } catch (DebuggerException e) { System.err.print("Error attaching to process or starting server: "); e.printStackTrace(); @@ -446,7 +447,7 @@ private static void runDEBUGD(String[] args) { System.err.println("Attaching to core " + coreFileName + " from executable " + javaExecutableName + " and starting RMI services, please wait..."); try { - agent.startServer(javaExecutableName, coreFileName, serverID, rmiPort); + agent.startServer(javaExecutableName, coreFileName, serverID, serverName, rmiPort); } catch (DebuggerException e) { System.err.print("Error attaching to core file or starting server: "); e.printStackTrace(); diff --git a/src/jdk.hotspot.agent/share/man/jhsdb.1 b/src/jdk.hotspot.agent/share/man/jhsdb.1 index 44782223f92..bed1f554ceb 100644 --- a/src/jdk.hotspot.agent/share/man/jhsdb.1 +++ b/src/jdk.hotspot.agent/share/man/jhsdb.1 @@ -32,11 +32,11 @@ analyze the content of a core dump from a crashed Java Virtual Machine .PP \f[CB]jhsdb\f[R] \f[CB]clhsdb\f[R] [\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] | -\f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]\] +\f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]\] .PP \f[CB]jhsdb\f[R] \f[CB]hsdb\f[R] [\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] | -\f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]\] +\f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]\] .PP \f[CB]jhsdb\f[R] \f[CB]debugd\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] @@ -44,22 +44,22 @@ analyze the content of a core dump from a crashed Java Virtual Machine .PP \f[CB]jhsdb\f[R] \f[CB]jstack\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] -| \f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]) +| \f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]) [\f[I]options\f[R]] .PP \f[CB]jhsdb\f[R] \f[CB]jmap\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] -| \f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]) +| \f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]) [\f[I]options\f[R]] .PP \f[CB]jhsdb\f[R] \f[CB]jinfo\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] -| \f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]) +| \f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]) [\f[I]options\f[R]] .PP \f[CB]jhsdb\f[R] \f[CB]jsnap\f[R] (\f[CB]\-\-pid\f[R] \f[I]pid\f[R] | \f[CB]\-\-exe\f[R] \f[I]executable\f[R] \f[CB]\-\-core\f[R] \f[I]coredump\f[R] -| \f[CB]\-\-connect\f[R] \f[I][server\-id\@]debugd\-host[:registryport]\f[R]) +| \f[CB]\-\-connect\f[R] \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R]) [\f[I]options\f[R]] .TP .B \f[I]pid\f[R] @@ -81,7 +81,7 @@ The core file to which the \f[CB]jhsdb\f[R] tool should attach. .RS .RE .TP -.B \f[I][server\-id\@]debugd\-host[:registryport]\f[R] +.B \f[I][serverid\@]debugd\-host[:registryport][/servername]\f[R] An optional server ID and the address of the remote debug server (debugd). .RS @@ -158,9 +158,10 @@ Displays the options available for the \f[I]command\f[R]. .RE .SH OPTIONS FOR THE DEBUGD MODE .TP -.B \f[CB]\-\-serverid\f[R] \f[I]server\-id\f[R] +.B \f[CB]\-\-serverid\f[R] \f[I]serverid\f[R] An optional unique ID for this debug server. -This is required if multiple debug servers are run on the same machine. +This is required if multiple debug servers are run on the same server instance. +It would be added to RMI object name for server instance. .RS .RE .TP @@ -198,6 +199,13 @@ If not specified, the system property is used. If the system property is not set, a system hostname is used. .RS .RE +.TP +.B \f[CB]\-\-servername\f[R] \f[I]servername\f[R] +Sets the instance name of debugd server to distinguish SA debugee. +It is used for RMI object name for server instance. +If not specified, "SARemoteDebugger" will be used. +.RS +.RE .SH OPTIONS FOR THE JINFO MODE .TP .B \f[CB]\-\-flags\f[R] diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java index fce28d1fda3..a5215b785b4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java @@ -599,31 +599,43 @@ Byte128Vector toVector() { return (Byte128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Byte128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java index 2c687ef5b89..6936059f5da 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java @@ -631,31 +631,43 @@ Byte256Vector toVector() { return (Byte256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Byte256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java index ce2eae9425c..96d852b1a80 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java @@ -695,31 +695,43 @@ Byte512Vector toVector() { return (Byte512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Byte512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java index 057da8e5478..f49b43e319e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java @@ -583,31 +583,43 @@ Byte64Vector toVector() { return (Byte64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Byte64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java index 7978a30ea18..502ee50f9e2 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java @@ -569,31 +569,43 @@ ByteMaxVector toVector() { return (ByteMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + ByteMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java index b5849d2cb4d..46c7be0eeda 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java @@ -567,31 +567,43 @@ Double128Vector toVector() { return (Double128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Double128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java index bf524f021df..1d774b0cb0c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java @@ -571,31 +571,43 @@ Double256Vector toVector() { return (Double256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Double256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java index 94d4db1510e..aec9bea4693 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java @@ -579,31 +579,43 @@ Double512Vector toVector() { return (Double512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Double512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java index 640f0acd25c..78b9284b770 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java @@ -565,31 +565,43 @@ Double64Vector toVector() { return (Double64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Double64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java index 392a796a4a0..df0e6d786da 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java @@ -564,31 +564,43 @@ DoubleMaxVector toVector() { return (DoubleMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + DoubleMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java index 18a755d0116..934605101b4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java @@ -571,31 +571,43 @@ Float128Vector toVector() { return (Float128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Float128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java index 6083b754d96..05cc833b238 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java @@ -579,31 +579,43 @@ Float256Vector toVector() { return (Float256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Float256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java index b9e233b1250..932fd6e5622 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java @@ -595,31 +595,43 @@ Float512Vector toVector() { return (Float512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Float512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java index 02a45a6c183..7676544236b 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java @@ -567,31 +567,43 @@ Float64Vector toVector() { return (Float64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Float64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java index 84a7ec7ddbe..b90a8c3cd5f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java @@ -564,31 +564,43 @@ FloatMaxVector toVector() { return (FloatMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + FloatMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java index 7cf81f6c6a6..a83a5120eee 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java @@ -575,31 +575,43 @@ Int128Vector toVector() { return (Int128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Int128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java index 17f2f1d4b4b..19d6ca4e68a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java @@ -583,31 +583,43 @@ Int256Vector toVector() { return (Int256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Int256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java index 3c50e941d1f..f711675e10f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java @@ -599,31 +599,43 @@ Int512Vector toVector() { return (Int512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Int512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java index 8c83c3f5350..1cc6217b53b 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java @@ -571,31 +571,43 @@ Int64Vector toVector() { return (Int64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Int64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java index 4904ff27dca..3f06a7b76cf 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java @@ -569,31 +569,43 @@ IntMaxVector toVector() { return (IntMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + IntMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java index 89a6fc666c8..78dd64147bc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java @@ -561,31 +561,43 @@ Long128Vector toVector() { return (Long128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Long128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java index f1d07749924..59a2656e361 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java @@ -565,31 +565,43 @@ Long256Vector toVector() { return (Long256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Long256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java index 38905798b8b..6a2a16e47b6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java @@ -573,31 +573,43 @@ Long512Vector toVector() { return (Long512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Long512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java index c61a13f834c..8471e72e35d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java @@ -559,31 +559,43 @@ Long64Vector toVector() { return (Long64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Long64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java index 502c183eb02..358a33d3ae9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java @@ -559,31 +559,43 @@ LongMaxVector toVector() { return (LongMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + LongMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java index 60c3985de88..32b1ac069a8 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java @@ -583,31 +583,43 @@ Short128Vector toVector() { return (Short128Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte128Vector.Byte128Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short128Vector.Short128Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int128Vector.Int128Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long128Vector.Long128Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float128Vector.Float128Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double128Vector.Double128Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Short128Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java index 16cab237e77..3def18c1cdc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java @@ -599,31 +599,43 @@ Short256Vector toVector() { return (Short256Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte256Vector.Byte256Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short256Vector.Short256Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int256Vector.Int256Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long256Vector.Long256Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float256Vector.Float256Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double256Vector.Double256Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Short256Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java index bfc74a349fb..a5bcc542238 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java @@ -631,31 +631,43 @@ Short512Vector toVector() { return (Short512Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte512Vector.Byte512Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short512Vector.Short512Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int512Vector.Int512Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long512Vector.Long512Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float512Vector.Float512Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double512Vector.Double512Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Short512Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java index 1da076aaa03..c4e9ce37234 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java @@ -575,31 +575,43 @@ Short64Vector toVector() { return (Short64Vector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte64Vector.Byte64Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short64Vector.Short64Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int64Vector.Int64Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long64Vector.Long64Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float64Vector.Float64Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double64Vector.Double64Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + Short64Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java index 8de1b464277..c696ed9ac95 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java @@ -569,31 +569,43 @@ ShortMaxVector toVector() { return (ShortMaxVector) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp); + case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp); + case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new ByteMaxVector.ByteMaxMask(maskArray).check(species); - case LaneType.SK_SHORT: - return new ShortMaxVector.ShortMaxMask(maskArray).check(species); - case LaneType.SK_INT: - return new IntMaxVector.IntMaxMask(maskArray).check(species); - case LaneType.SK_LONG: - return new LongMaxVector.LongMaxMask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new FloatMaxVector.FloatMaxMask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new DoubleMaxVector.DoubleMaxMask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + ShortMaxMask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template index 8303b28b933..82f24c339b7 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template @@ -842,31 +842,43 @@ final class $vectortype$ extends $abstractvectortype$ { return ($vectortype$) super.toVectorTemplate(); // specialize } + /** + * Helper function for lane-wise mask conversions. + * This function kicks in after intrinsic failure. + */ + @ForceInline + private final + VectorMask defaultMaskCast(AbstractSpecies dsp) { + assert(length() == dsp.laneCount()); + boolean[] maskArray = toArray(); + // enum-switches don't optimize properly JDK-8161245 + return switch (dsp.laneType.switchKey) { + case LaneType.SK_BYTE -> new Byte$bits$Vector.Byte$bits$Mask(maskArray).check(dsp); + case LaneType.SK_SHORT -> new Short$bits$Vector.Short$bits$Mask(maskArray).check(dsp); + case LaneType.SK_INT -> new Int$bits$Vector.Int$bits$Mask(maskArray).check(dsp); + case LaneType.SK_LONG -> new Long$bits$Vector.Long$bits$Mask(maskArray).check(dsp); + case LaneType.SK_FLOAT -> new Float$bits$Vector.Float$bits$Mask(maskArray).check(dsp); + case LaneType.SK_DOUBLE -> new Double$bits$Vector.Double$bits$Mask(maskArray).check(dsp); + default -> throw new AssertionError(dsp); + }; + } + @Override @ForceInline - public VectorMask cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; + public VectorMask cast(VectorSpecies dsp) { + AbstractSpecies species = (AbstractSpecies) dsp; if (length() != species.laneCount()) throw new IllegalArgumentException("VectorMask length and species length differ"); - boolean[] maskArray = toArray(); - // enum-switches don't optimize properly JDK-8161245 - switch (species.laneType.switchKey) { - case LaneType.SK_BYTE: - return new Byte$bits$Vector.Byte$bits$Mask(maskArray).check(species); - case LaneType.SK_SHORT: - return new Short$bits$Vector.Short$bits$Mask(maskArray).check(species); - case LaneType.SK_INT: - return new Int$bits$Vector.Int$bits$Mask(maskArray).check(species); - case LaneType.SK_LONG: - return new Long$bits$Vector.Long$bits$Mask(maskArray).check(species); - case LaneType.SK_FLOAT: - return new Float$bits$Vector.Float$bits$Mask(maskArray).check(species); - case LaneType.SK_DOUBLE: - return new Double$bits$Vector.Double$bits$Mask(maskArray).check(species); + if (VSIZE == species.vectorBitSize()) { + Class dtype = species.elementType(); + Class dmtype = species.maskType(); + return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, + this.getClass(), ETYPE, VLENGTH, + dmtype, dtype, VLENGTH, + this, species, + $Type$$bits$Mask::defaultMaskCast); } - - // Should not reach here. - throw new AssertionError(species); + return this.defaultMaskCast(species); } // Unary operations diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap index b6209fe1a16..9166170e50d 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap @@ -198,7 +198,7 @@ alias sun.cls.unloadedBytes // 1.5.0 b39 // sun.gc alias sun.gc.cause // 1.5.0 b39 - hotspot.gc.cause // 1.4.2_02 + hotspot.gc.cause // 1.4.2_02 // sun.gc.collector.0 alias sun.gc.collector.0.invocations // 1.5.0 b39 @@ -401,7 +401,7 @@ alias sun.gc.generation.2.spaces // 1.5.0 b39 // sun.gc alias sun.gc.lastCause // 1.5.0 b39 - hotspot.gc.last_cause // 1.4.2_02 + hotspot.gc.last_cause // 1.4.2_02 // sun.gc.policy alias sun.gc.policy.avgBaseFootprint // 1.5.0 b39 @@ -535,11 +535,13 @@ alias sun.gc.tlab.maxGcWaste // 1.5.0 b39 hotspot.gc.tlab.maxgcwaste // 1.5.0 b21 alias sun.gc.tlab.maxSlowAlloc // 1.5.0 b39 hotspot.gc.tlab.maxslowalloc // 1.5.0 b21 -alias sun.gc.tlab.maxSlowWaste // 1.5.0 b39 +alias sun.gc.tlab.maxRefillWaste // 17 + sun.gc.tlab.maxSlowWaste // 1.5.0 b39 hotspot.gc.tlab.maxslowwaste // 1.5.0 b21 alias sun.gc.tlab.slowAlloc // 1.5.0 b39 hotspot.gc.tlab.slowalloc // 1.5.0 b21 -alias sun.gc.tlab.slowWaste // 1.5.0 b39 +alias sun.gc.tlab.refillWaste // 17 + sun.gc.tlab.slowWaste // 1.5.0 b39 hotspot.gc.tlab.slowwaste // 1.5.0 b21 // sun.os diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java index 55e2fcdda0a..3dfd26383d0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/api/JavadocTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -113,15 +113,15 @@ public DocumentationTask getTask( if (out == null) context.put(Log.errKey, new PrintWriter(System.err, true)); - else if (out instanceof PrintWriter) - context.put(Log.errKey, ((PrintWriter) out)); + else if (out instanceof PrintWriter pout) + context.put(Log.errKey, pout); else context.put(Log.errKey, new PrintWriter(out, true)); if (fileManager == null) { fileManager = getStandardFileManager(diagnosticListener, null, null); - if (fileManager instanceof BaseFileManager) { - ((BaseFileManager) fileManager).autoClose = true; + if (fileManager instanceof BaseFileManager bfm) { + bfm.autoClose = true; } } fileManager = ccw.wrap(fileManager); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index 117c5fb7270..15e9f9cc73e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -470,9 +470,9 @@ private Content getClassLinks(HtmlLinkInfo.Kind context, Collection list) { isFirst = false; } // TODO: should we simply split this method up to avoid instanceof ? - if (type instanceof TypeElement) { + if (type instanceof TypeElement te) { Content link = getLink( - new HtmlLinkInfo(configuration, context, (TypeElement)(type))); + new HtmlLinkInfo(configuration, context, te)); content.add(HtmlTree.CODE(link)); } else { Content link = getLink( diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java index cc8dbf6c4dd..b99d33e4e99 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java @@ -407,10 +407,10 @@ public Content getContent(String key, Object o0, Object o1, Object o2) { if (o == null) { c.add("{" + m.group(1) + "}"); - } else if (o instanceof String) { - c.add((String) o); - } else if (o instanceof Content) { - c.add((Content) o); + } else if (o instanceof String str) { + c.add(str); + } else if (o instanceof Content con) { + c.add(con); } start = m.end(); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java index c0e3fb4a769..e3a4862dd16 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -354,8 +354,7 @@ public Locale getLocale() { @Override public JavaFileObject getOverviewPath() { String overviewpath = options.overviewPath(); - if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) { - StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager(); + if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager fm) { return fm.getJavaFileObjects(overviewpath).iterator().next(); } return null; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 4c7261f195c..151cc6e140a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -690,13 +690,6 @@ public Content getModuleLink(ModuleElement mdle, Content label) { return label; } - public Content interfaceName(TypeElement typeElement, boolean qual) { - Content name = Text.of((qual) - ? typeElement.getQualifiedName() - : utils.getSimpleName(typeElement)); - return (utils.isInterface(typeElement)) ? HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name; - } - /** * Add the link to the content tree. * @@ -1123,8 +1116,8 @@ public Content seeTagToContent(Element element, DocTree see, TagletWriterImpl.Co // documented, this must be an inherited link. Redirect it. // The current class either overrides the referenced member or // inherits it automatically. - if (this instanceof ClassWriterImpl) { - containing = ((ClassWriterImpl) this).getTypeElement(); + if (this instanceof ClassWriterImpl writer) { + containing = writer.getTypeElement(); } else if (!utils.isPublic(containing)) { messages.warning( ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible", @@ -2128,11 +2121,11 @@ Script getMainBodyScript() { List getLocalStylesheets(Element element) throws DocFileIOException { List stylesheets = new ArrayList<>(); DocPath basePath = null; - if (element instanceof PackageElement) { - stylesheets.addAll(getModuleStylesheets((PackageElement)element)); - basePath = docPaths.forPackage((PackageElement)element); - } else if (element instanceof ModuleElement) { - basePath = DocPaths.forModule((ModuleElement)element); + if (element instanceof PackageElement pkg) { + stylesheets.addAll(getModuleStylesheets(pkg)); + basePath = docPaths.forPackage(pkg); + } else if (element instanceof ModuleElement mdle) { + basePath = DocPaths.forModule(mdle); } for (DocPath stylesheet : getStylesheets(element)) { stylesheets.add(basePath.resolve(stylesheet.getPath())); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java index 770015caef0..f032f89bb4a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java @@ -175,9 +175,9 @@ public void convertModule(ModuleElement mdl, DocPath outputdir) return; } for (Element elem : mdl.getEnclosedElements()) { - if (elem instanceof PackageElement && configuration.docEnv.isIncluded(elem) + if (elem instanceof PackageElement pkg && configuration.docEnv.isIncluded(elem) && !(options.noDeprecated() && utils.isDeprecated(elem))) { - convertPackage((PackageElement) elem, outputdir); + convertPackage(pkg, outputdir); } } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java index 63ee5792105..89121697c7e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java @@ -155,8 +155,7 @@ private Content createLink(IndexItem i) { if (element instanceof OverviewElement) { return links.createLink(pathToRoot.resolve(i.getUrl()), resources.getText("doclet.Overview")); - } else if (element instanceof DocletElement) { - DocletElement e = (DocletElement) element; + } else if (element instanceof DocletElement e) { // Implementations of DocletElement do not override equals and // hashCode; putting instances of DocletElement in a map is not // incorrect, but might well be inefficient diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java index f18a6951ff3..caa4a80a914 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java @@ -318,12 +318,12 @@ public Content seeTagOutput(Element holder, List seeTags) { links.add(htmlWriter.seeTagToContent(holder, dt, context.within(dt))); } if (utils.isVariableElement(holder) && ((VariableElement)holder).getConstantValue() != null && - htmlWriter instanceof ClassWriterImpl) { + htmlWriter instanceof ClassWriterImpl writer) { //Automatically add link to constant values page for constant fields. DocPath constantsPath = htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES); String whichConstant = - ((ClassWriterImpl) htmlWriter).getTypeElement().getQualifiedName() + "." + + writer.getTypeElement().getQualifiedName() + "." + utils.getSimpleName(holder); DocLink link = constantsPath.fragment(whichConstant); links.add(htmlWriter.links.createLink(link, @@ -503,8 +503,7 @@ public String visitVariable(VariableElement e, Void p) { @Override public String visitUnknown(Element e, Void p) { - if (e instanceof DocletElement) { - DocletElement de = (DocletElement) e; + if (e instanceof DocletElement de) { return switch (de.getSubKind()) { case OVERVIEW -> resources.getText("doclet.Overview"); case DOCFILE -> getHolderName(de); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java index 012ee7eed5a..79d398f9c9e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/ContentBuilder.java @@ -52,8 +52,8 @@ public ContentBuilder(Content... contents) { public ContentBuilder add(Content content) { Objects.requireNonNull(content); ensureMutableContents(); - if (content instanceof ContentBuilder) { - contents.addAll(((ContentBuilder) content).contents); + if (content instanceof ContentBuilder cb) { + contents.addAll(cb.contents); } else contents.add(content); return this; @@ -65,8 +65,8 @@ public ContentBuilder add(CharSequence text) { ensureMutableContents(); Content c = contents.isEmpty() ? null : contents.get(contents.size() - 1); TextBuilder tb; - if (c != null && c instanceof TextBuilder) { - tb = (TextBuilder) c; + if (c instanceof TextBuilder tbi) { + tb = tbi; } else { contents.add(tb = new TextBuilder()); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java index 32e6b6931de..940924f1bea 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java @@ -55,10 +55,6 @@ public enum HtmlStyle { blockList, circle, classUses, - deprecatedLabel, - deprecationBlock, - deprecationComment, - descfrmTypeLabel, externalLink, hierarchy, horizontal, @@ -66,7 +62,6 @@ public enum HtmlStyle { index, inheritance, inheritedList, - interfaceName, legalCopy, memberNameLabel, memberNameLink, @@ -74,18 +69,11 @@ public enum HtmlStyle { packages, packageHierarchyLabel, packageUses, - permitsNote, - previewBlock, - previewComment, - previewLabel, - searchTagLink, - searchTagResult, serializedPackageContainer, sourceContainer, sourceLineNo, typeNameLabel, typeNameLink, - verticalSeparator, // // @@ -358,6 +346,57 @@ public enum HtmlStyle { // + // + // + // The following constants are used for the additional information that may be provided + // for a declaration, such as whether it is deprecated or is a "preview" feature. + + /** + * The class for the "Deprecated" label in a block describing the "deprecated" status + * of a declaration. + */ + deprecatedLabel, + + /** + * The class for a block describing the "deprecated" status of a declaration. + */ + deprecationBlock, + + /** + * The class for the details in a block describing the "deprecated" status of a declaration. + */ + deprecationComment, + + /** + * The class for a label indicating the element from which a description has been copied. + */ + // This should be renamed to something less cryptic + descfrmTypeLabel, + + /** + * The class for a note providing information about the permitted subtypes of a + * sealed class. + */ + permitsNote, + + /** + * The class for a block describing the "preview" status of a declaration. + */ + previewBlock, + + /** + * The class for the details in a block describing the "preview" status of a declaration. + */ + previewComment, + + /** + * The class for the "Preview" label in a block describing the "preview" status + * of a declaration. + */ + previewLabel, + + // + // // // The following constants are used for "summary" and "details" tables. @@ -621,6 +660,30 @@ public enum HtmlStyle { typeParametersLong, // + // + // + // The following constants are used for items in the static and interactive search indexes. + + /** + * The class for a link in the static "Index" pages to a custom searchable item, + * such as defined with an {@code @index} tag. + */ + searchTagLink, + + /** + * The class for a custom searchable item, + * such as defined with an {@code @index} tag. + */ + searchTagResult, + + /** + * The class for the separator in the list of pages given at the top of the + * static "Index" page(s). + */ + verticalSeparator, + + // + // // // The following constants are used for the class of the {@code } element @@ -707,7 +770,7 @@ public enum HtmlStyle { packageUsePage, /** - * The class of the {@code body} element for the page listing any deprecated items. + * The class of the {@code body} element for the page listing any preview items. */ previewListPage, @@ -732,10 +795,9 @@ public enum HtmlStyle { treePage, // - // + // // - // The following constants are used for the class of the {@code } element - // for the corresponding pages. + // The following constants are used for the contents of the "Help" page. /** * The class of the footnote at the bottom of the page. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java index 1e5352565ba..41561dd6a74 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java @@ -174,8 +174,8 @@ public HtmlTree addStyle(String style) { */ @Override public HtmlTree add(Content content) { - if (content instanceof ContentBuilder) { - ((ContentBuilder) content).contents.forEach(this::add); + if (content instanceof ContentBuilder cb) { + cb.contents.forEach(this::add); } else if (content == HtmlTree.EMPTY || content.isValid()) { // quietly avoid adding empty or invalid nodes (except EMPTY) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java index cf62bf17565..1380c432390 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -932,7 +932,7 @@ protected Option(Resources resources, String name, int argCount) { protected Option(Resources resources, String keyBase, String name, int argCount) { this.names = name.trim().split("\\s+"); if (keyBase == null) { - keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", ""); + keyBase = "doclet.usage." + Utils.toLowerCase(names[0]).replaceAll("^-+", ""); } String desc = getOptionsMessage(resources, keyBase + ".description"); if (desc.isEmpty()) { @@ -995,7 +995,7 @@ public boolean matches(String option) { } else if (matchCase) { return name.equals(option); } - return name.toLowerCase().equals(option.toLowerCase()); + return name.equalsIgnoreCase(option); } return false; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java index 1b8477aba7a..b03b145a541 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -368,7 +368,7 @@ private boolean hasParamForComponent(TypeElement elem, Name component) { } for (DocTree t : elemComment.getBlockTags()) { - if (t instanceof ParamTree && ((ParamTree) t).getName().getName() == component) { + if (t instanceof ParamTree pt && pt.getName().getName() == component) { return true; } } @@ -419,8 +419,7 @@ public DocCommentInfo getHtmlCommentInfo(Element e) { PackageElement pe = null; switch (e.getKind()) { case OTHER: - if (e instanceof DocletElement) { - DocletElement de = (DocletElement)e; + if (e instanceof DocletElement de) { fo = de.getFileObject(); pe = de.getPackageElement(); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java index 60afb6859e4..0c871f59cab 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java @@ -60,6 +60,7 @@ import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.model.JavacElements; import com.sun.tools.javac.util.Names; +import com.sun.tools.javac.util.Options; import jdk.javadoc.internal.doclets.toolkit.util.Utils; import jdk.javadoc.internal.tool.ToolEnvironment; @@ -536,4 +537,21 @@ public boolean isReflectivePreviewAPI(Element el) { return (sym.flags() & Flags.PREVIEW_REFLECTIVE) != 0; } + /** + * Returns whether or not to permit dynamically loaded components to access + * part of the javadoc internal API. The flag is the same (hidden) compiler + * option that allows javac plugins and annotation processors to access + * javac internal API. + * + * As with all workarounds, it is better to consider updating the public API, + * rather than relying on undocumented features like this, that may be withdrawn + * at any time, without notice. + * + * @return true if access is permitted to internal API + */ + public boolean accessInternalAPI() { + Options compilerOptions = Options.instance(toolEnv.context); + return compilerOptions.isSet("accessInternalAPI"); + } + } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java index 277e8dcb295..7aa0d29c8d2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java @@ -316,8 +316,8 @@ private void processProperty(Element member, fullBody.addAll(cmtutils.makeFirstSentenceTree(text)); } List propertyTags = utils.getBlockTags(property, - t -> (t instanceof UnknownBlockTagTree) - && ((UnknownBlockTagTree) t).getTagName().equals("propertyDescription")); + t -> (t instanceof UnknownBlockTagTree tree) + && (tree.getTagName().equals("propertyDescription"))); if (propertyTags.isEmpty()) { List comment = utils.getFullBody(property); blockTags.addAll(cmtutils.makePropertyDescriptionTree(comment)); @@ -331,8 +331,8 @@ private void processProperty(Element member, blockTags.addAll(tags); List bTags = utils.getBlockTags(property, - t -> (t instanceof UnknownBlockTagTree) - && ((UnknownBlockTagTree) t).getTagName().equals("defaultValue")); + t -> (t instanceof UnknownBlockTagTree tree) + && (tree.getTagName().equals("defaultValue"))); blockTags.addAll(bTags); //add @see tags diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index cb9c78934f3..23532555ee9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -552,7 +552,7 @@ h1.hidden { .package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label { font-weight:bold; } -.deprecation-comment, .help-footnote, .interface-name, .preview-comment { +.deprecation-comment, .help-footnote, .preview-comment { font-style:italic; } .deprecation-block { @@ -577,8 +577,7 @@ h1.hidden { margin-right:10px; display:inline-block; } -div.block div.deprecation-comment, div.block div.block span.emphasized-phrase, -div.block div.block span.interface-name { +div.block div.deprecation-comment { font-style:normal; } /* diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java index 1d2cf66646d..e806a627bfa 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -185,6 +185,8 @@ public class TagletManager { private final String tagletPath; + private final BaseConfiguration configuration; + /** * Constructs a new {@code TagletManager}. * @@ -197,6 +199,7 @@ public TagletManager(BaseConfiguration configuration) { standardTagsLowercase = new HashSet<>(); unseenCustomTags = new HashSet<>(); allTaglets = new LinkedHashMap<>(); + this.configuration = configuration; BaseOptions options = configuration.getOptions(); this.nosince = options.noSince(); this.showversion = options.showVersion(); @@ -223,8 +226,7 @@ public Set getAllTagletNames() { * @throws IOException if an error occurs while setting the location */ public void initTagletPath(JavaFileManager fileManager) throws IOException { - if (fileManager instanceof StandardJavaFileManager) { - StandardJavaFileManager sfm = (StandardJavaFileManager)fileManager; + if (fileManager instanceof StandardJavaFileManager sfm) { if (tagletPath != null) { List paths = new ArrayList<>(); for (String pathname : tagletPath.split(File.pathSeparator)) { @@ -251,6 +253,15 @@ public void addCustomTag(String classname, JavaFileManager fileManager) { try { ClassLoader tagClassLoader; tagClassLoader = fileManager.getClassLoader(TAGLET_PATH); + if (configuration.workArounds.accessInternalAPI()) { + Module thisModule = getClass().getModule(); + Module tagletLoaderUnnamedModule = tagClassLoader.getUnnamedModule(); + List pkgs = List.of( + "jdk.javadoc.doclet", + "jdk.javadoc.internal.doclets.toolkit", + "jdk.javadoc.internal.doclets.formats.html"); + pkgs.forEach(p -> thisModule.addOpens(p, tagletLoaderUnnamedModule)); + } Class customTagClass = tagClassLoader.loadClass(classname).asSubclass(jdk.javadoc.doclet.Taglet.class); jdk.javadoc.doclet.Taglet instance = customTagClass.getConstructor().newInstance(); @@ -552,8 +563,7 @@ public List getBlockTaglets(Element e) { case PACKAGE: return blockTagletsByLocation.get(Location.PACKAGE); case OTHER: - if (e instanceof DocletElement) { - DocletElement de = (DocletElement) e; + if (e instanceof DocletElement de) { switch (de.getSubKind()) { case DOCFILE: return blockTagletsByLocation.get(Location.PACKAGE); @@ -752,7 +762,7 @@ private void showTaglets(PrintStream out) { + format(t.inMethod(), "method") + " " + format(t.inField(), "field") + " " + format(t.isInlineTag(), "inline")+ " " - + format((t instanceof SimpleTaglet) && !((SimpleTaglet) t).enabled, "disabled")); + + format((t instanceof SimpleTaglet st) && !st.enabled, "disabled")); }); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java index c59f7a5f72f..1367cf0ba23 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -263,8 +263,7 @@ public Content getBlockTagOutput(TagletManager tagletManager, continue; } - if (element.getKind() == ElementKind.MODULE && taglet instanceof BaseTaglet) { - BaseTaglet t = (BaseTaglet) taglet; + if (element.getKind() == ElementKind.MODULE && taglet instanceof BaseTaglet t) { switch (t.getTagKind()) { // @uses and @provides are handled separately, so skip here. // See ModuleWriterImpl.computeModulesData @@ -280,7 +279,7 @@ public Content getBlockTagOutput(TagletManager tagletManager, continue; } - if (taglet instanceof SimpleTaglet && !((SimpleTaglet) taglet).enabled) { + if (taglet instanceof SimpleTaglet st && !st.enabled) { // taglet has been disabled continue; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ThrowsTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ThrowsTaglet.java index 7a60fabcfb4..88a947ffdc7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ThrowsTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ThrowsTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -74,8 +74,8 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) { Element exception; CommentHelper ch = utils.getCommentHelper(input.element); if (input.tagId == null) { - exception = input.docTreeInfo.docTree instanceof ThrowsTree - ? ch.getException((ThrowsTree) input.docTreeInfo.docTree) : null; + exception = input.docTreeInfo.docTree instanceof ThrowsTree tt + ? ch.getException(tt) : null; input.tagId = exception == null ? ch.getExceptionName(input.docTreeInfo.docTree).getSignature() : utils.getFullyQualifiedName(exception); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java index a8ccfbd7e74..4b571e3c581 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.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 @@ -63,7 +63,7 @@ protected DocPath(String p) { @Override public boolean equals(Object other) { - return (other instanceof DocPath) && path.equals(((DocPath)other).path); + return (other instanceof DocPath dp) && path.equals(dp.path); } @Override diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java index 78ff77bea9b..5fb1fc028d2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.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 @@ -396,14 +396,13 @@ private static class Fault extends Exception { */ private Item findElementItem(Element element) { Item item = null; - if (element instanceof ModuleElement) { - item = moduleItems.get(utils.getModuleName((ModuleElement)element)); + if (element instanceof ModuleElement me) { + item = moduleItems.get(utils.getModuleName(me)); } - else if (element instanceof PackageElement) { - PackageElement packageElement = (PackageElement)element; - ModuleElement moduleElement = utils.containingModule(packageElement); + else if (element instanceof PackageElement pkg) { + ModuleElement moduleElement = utils.containingModule(pkg); Map pkgMap = packageItems.get(utils.getModuleName(moduleElement)); - item = (pkgMap != null) ? pkgMap.get(utils.getPackageName(packageElement)) : null; + item = (pkgMap != null) ? pkgMap.get(utils.getPackageName(pkg)) : null; } return item; } @@ -624,8 +623,7 @@ private InputStream open(URL url) throws IOException { in = conn.getInputStream(); redir = false; - if (conn instanceof HttpURLConnection) { - HttpURLConnection http = (HttpURLConnection)conn; + if (conn instanceof HttpURLConnection http) { int stat = http.getResponseCode(); // See: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 0757dba2c61..a45229a419a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -93,6 +93,7 @@ import javax.tools.JavaFileManager.Location; import javax.tools.StandardLocation; +import com.sun.source.doctree.BlockTagTree; import com.sun.source.doctree.DeprecatedTree; import com.sun.source.doctree.DocCommentTree; import com.sun.source.doctree.DocTree; @@ -1737,11 +1738,11 @@ public int compare(String s1, String s2) { private Collator createCollator(Locale locale) { Collator baseCollator = Collator.getInstance(locale); - if (baseCollator instanceof RuleBasedCollator) { + if (baseCollator instanceof RuleBasedCollator rbc) { // Extend collator to sort signatures with additional args and var-args in a well-defined order: // () < (int) < (int, int) < (int...) try { - return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules() + return new RuleBasedCollator(rbc.getRules() + "& ')' < ',' < '.','['"); } catch (ParseException e) { throw new RuntimeException(e); @@ -2333,8 +2334,8 @@ public String visitPrimitiveAsLong(PrimitiveType t, Object val) { protected String defaultAction(TypeMirror e, Object val) { if (val == null) return null; - else if (val instanceof String) - return sourceForm((String) val); + else if (val instanceof String s) + return sourceForm(s); return val.toString(); // covers int, short } @@ -2632,10 +2633,10 @@ public List getBlockTags(Element element, DocTree.Kind kind, public List getBlockTags(Element element, Taglet taglet) { return getBlockTags(element, t -> { - if (taglet instanceof BaseTaglet) { - return ((BaseTaglet) taglet).accepts(t); - } else if (t instanceof UnknownBlockTagTree) { - return ((UnknownBlockTagTree) t).getTagName().equals(taglet.getName()); + if (taglet instanceof BaseTaglet baseTaglet) { + return baseTaglet.accepts(t); + } else if (t instanceof BlockTagTree blockTagTree) { + return blockTagTree.getTagName().equals(taglet.getName()); } else { return false; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java index 1150b43b854..3278614dfb6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -591,14 +591,14 @@ public Void visitEndElement(EndElementTree tree, Void ignore) { } void warnIfEmpty(TagStackItem tsi, DocTree endTree) { - if (tsi.tag != null && tsi.tree instanceof StartElementTree) { + if (tsi.tag != null && tsi.tree instanceof StartElementTree startTree) { if (tsi.tag.flags.contains(HtmlTag.Flag.EXPECT_CONTENT) && !tsi.flags.contains(Flag.HAS_TEXT) && !tsi.flags.contains(Flag.HAS_ELEMENT) && !tsi.flags.contains(Flag.HAS_INLINE_TAG) && !(tsi.tag.elemKind == ElemKind.HTML4)) { - DocTree tree = (endTree != null) ? endTree : tsi.tree; - Name treeName = ((StartElementTree) tsi.tree).getName(); + DocTree tree = (endTree != null) ? endTree : startTree; + Name treeName = startTree.getName(); env.messages.warning(HTML, tree, "dc.tag.empty", treeName); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java index acd1011f5ac..5e6204e42be 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java @@ -567,7 +567,7 @@ private Set getModuleRequires(ModuleElement mdle, boolean onlyTra if (!isMandated(mdle, rd) && onlyTransitive == rd.isTransitive()) { if (!haveModuleSources(dep)) { if (!warnedNoSources.contains(dep)) { - messager.printWarning(dep, "main.module_source_not_found", dep.getQualifiedName()); + messager.printWarningUsingKey(dep, "main.module_source_not_found", dep.getQualifiedName()); warnedNoSources.add(dep); } } @@ -1159,8 +1159,7 @@ boolean hasModule() { @Override public boolean equals(Object obj) { - if (obj instanceof ModulePackage) { - ModulePackage that = (ModulePackage)obj; + if (obj instanceof ModulePackage that) { return this.toString().equals(that.toString()); } return false; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java index c01a9f23ee8..0ec2b092a08 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -158,8 +158,8 @@ public DocletEnvironment getEnvironment(ToolOptions toolOptions, ListBuffer classTrees = new ListBuffer<>(); try { - StandardJavaFileManager fm = toolEnv.fileManager instanceof StandardJavaFileManager - ? (StandardJavaFileManager) toolEnv.fileManager + StandardJavaFileManager fm = toolEnv.fileManager instanceof StandardJavaFileManager sfm + ? sfm : null; Set packageNames = new LinkedHashSet<>(); // Normally, the args should be a series of package names or file names. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java index e7136f1c6d3..6636bd3ffec 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -25,32 +25,90 @@ package jdk.javadoc.internal.tool; - import java.io.PrintWriter; +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.EnumSet; +import java.util.LinkedHashMap; import java.util.Locale; +import java.util.Map; import java.util.ResourceBundle; +import java.util.Set; import javax.lang.model.element.Element; +import javax.tools.Diagnostic; import javax.tools.Diagnostic.Kind; +import javax.tools.JavaFileObject; -import com.sun.tools.javac.util.Context.Factory; import jdk.javadoc.doclet.Reporter; + +import com.sun.tools.javac.tree.EndPosTable; +import com.sun.tools.javac.util.Context.Factory; +import com.sun.tools.javac.util.DiagnosticSource; import com.sun.source.tree.CompilationUnitTree; import com.sun.source.util.DocSourcePositions; import com.sun.source.util.DocTreePath; import com.sun.source.util.TreePath; -import com.sun.tools.javac.api.JavacTrees; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; import com.sun.tools.javac.util.JavacMessages; import com.sun.tools.javac.util.Log; /** - * Utility for integrating with javadoc tools and for localization. - * Handle resources, access to error and warning counts and - * message formatting. + * Class for reporting diagnostics and other messages. + * + * The class leverages the javac support for reporting diagnostics, for stylistic consistency + * of diagnostic messages and to avoid code duplication. + * + * The class is a subtype of javac's Log, and is primarily an adapter between + * javadoc method signatures and the underlying javac methods. Within this class, + * the methods call down to a core {@code report} method which hands off to + * a similar method in the superclass ({@code Log.report}, which takes care + * of reporting the diagnostic (unless it has been suppressed), displaying + * the source line and a caret to indicate the position of the issue (if appropriate), + * counting errors and warnings, and so on. + * + * In general, the underlying javac layer is more powerful, whereas the javadoc methods are + * constrained by the public {@link jdk.javadoc.doclet.Doclet} API. + * + * In the underlying javac layer, the following abstractions are used: + *
      + *
    • {@code DiagnosticType} -- error, warning, note, etc. + *
    • {@code DiagnosticSource} -- a file object and a cache of its content + *
    • {@code DiagnosticPosition} -- a tuple of values (start, pos, end) for the position of a diagnostic + *
    • {@code DiagnosticFlag} -- additional flags related to the diagnostic + *
    + * + * The javadoc layer is defined by the methods on {@code Doclet.Reporter}, and by + * assorted methods defined in this class for use by the javadoc tool. + * The primary data types are: + *
      + *
    • {@code Diagnostic.Kind} -- maps to {@code DiagnosticType} and {@code Set} + *
    • {@code Element} -- maps to {@code DiagnosticSource} and {@code DiagnosticPosition} + *
    • {@code DocTreePath} -- maps to {@code DiagnosticSource} and {@code DiagnosticPosition} + *
    + * + * The reporting methods in the javac layer primarily take pre-localized (key, args) pairs, + * while the methods in the javadoc layer, especially the {@code Reporter} interface, take + * localized strings. To accommodate this, "wrapper" resources are used, whose value is {@code {0}}, + * to pass the localized string down to javac. A side-effect is that clients using a + * {@code DiagnosticListener} with a {@code DocumentationTask} cannot access the original resource + * key for the localized message. + * Given the limitations of the API, it is not possible to do any better. + * The javac Annotation Processing API has the same problem. + * + * There is a slight disparity between javac's use of streams and javadoc's use of streams. + * javac reports all diagnostics to the "error" stream, and provides a separate + * "output" stream for expected output, such as command-line help or the output from options + * like {@code -Xprint}. javadoc API, and {@code Reporter} in particular, does not specify + * the use of streams, and provides no support for identifying or specifying streams. JDK-8267204. + * The current implementation/workaround is to write errors and warnings to the "error" + * stream and notes to the "output" stream. + * * *

    This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -61,14 +119,26 @@ * @see java.text.MessageFormat */ public class Messager extends Log implements Reporter { - final Context context; + /** The overall context for the documentation run. */ + private final Context context; + + /** The tool environment, providing access to the tool's utility classes and tables. */ + private ToolEnvironment toolEnv; + + /** The utility class to access the positions of items in doc comments. */ + private DocSourcePositions sourcePositions; + + /** + * A memory-sensitive cache of recently used {@code DiagnosticSource} objects. + */ + private final LinkedHashMap> diagSourceCache; /** Get the current messager, which is also the compiler log. */ public static Messager instance0(Context context) { Log instance = context.get(logKey); - if (instance == null || !(instance instanceof Messager)) + if (!(instance instanceof Messager m)) throw new InternalError("no messager instance!"); - return (Messager)instance; + return m; } public static void preRegister(Context context, @@ -81,66 +151,16 @@ public static void preRegister(Context context, final String programName, context.put(logKey, (Factory)c -> new Messager(c, programName, outWriter, errWriter)); } - @Override - public void print(Kind kind, String msg) { - switch (kind) { - case ERROR: - printError(msg); - return; - case WARNING: - case MANDATORY_WARNING: - printWarning(msg); - return; - default: - printNotice(msg); - return; - } - } - - @Override - public void print(Kind kind, DocTreePath path, String msg) { - switch (kind) { - case ERROR: - printError(path, msg); - return; - case WARNING: - case MANDATORY_WARNING: - printWarning(path, msg); - return; - default: - printWarning(path, msg); - return; - } - } - - @Override - public void print(Kind kind, Element e, String msg) { - switch (kind) { - case ERROR: - printError(e, msg); - return; - case WARNING: - case MANDATORY_WARNING: - printWarning(e, msg); - return; - case NOTE: - printNotice(e, msg); - return; - default: - throw new IllegalArgumentException(String.format("unexpected option %s", kind)); - } - } - final String programName; private Locale locale; private final JavacMessages messages; private final JCDiagnostic.Factory javadocDiags; - /** The default writer for diagnostics - */ - static final PrintWriter defaultOutWriter = new PrintWriter(System.out); - static final PrintWriter defaultErrWriter = new PrintWriter(System.err); + /** The default writer for notes. */ + private static final PrintWriter defaultOutWriter = new PrintWriter(System.out); + /** The default writer for errors and warnings. */ + private static final PrintWriter defaultErrWriter = new PrintWriter(System.err); /** * Constructor @@ -166,6 +186,15 @@ public Messager(Context context, String programName, PrintWriter outWriter, Prin this.programName = programName; this.context = context; locale = Locale.getDefault(); + + diagSourceCache = new LinkedHashMap<>() { + private static final int MAX_ENTRIES = 5; + + @Override + protected boolean removeEldestEntry(Map.Entry> eldest) { + return size() > MAX_ENTRIES; + } + }; } public void setLocale(Locale locale) { @@ -173,183 +202,173 @@ public void setLocale(Locale locale) { } /** - * get and format message string from resource + * Returns the localized string from the tool's resource bundles. * - * @param key selects message from resource - * @param args arguments for the message + * @param key the resource key + * @param args arguments for the resource */ String getText(String key, Object... args) { return messages.getLocalizedString(locale, key, args); } - private String getDiagSource(DocTreePath path) { - if (path == null || path.getTreePath() == null) { - return programName; - } - JavacTrees trees = JavacTrees.instance(context); - DocSourcePositions sourcePositions = trees.getSourcePositions(); - CompilationUnitTree cu = path.getTreePath().getCompilationUnit(); - long spos = sourcePositions.getStartPosition(cu, path.getDocComment(), path.getLeaf()); - long lineNumber = cu.getLineMap().getLineNumber(spos); - String fname = cu.getSourceFile().getName(); - String posString = fname + ":" + lineNumber; - return posString; - } - - private String getDiagSource(Element e) { - if (e == null) { - return programName; - } - JavacTrees trees = JavacTrees.instance(context); - TreePath path = trees.getPath(e); - if (path == null) { - return programName; - } - DocSourcePositions sourcePositions = trees.getSourcePositions(); - JCTree tree = trees.getTree(e); - CompilationUnitTree cu = path.getCompilationUnit(); - long spos = sourcePositions.getStartPosition(cu, tree); - long lineNumber = cu.getLineMap().getLineNumber(spos); - String fname = cu.getSourceFile().getName(); - String posString = fname + ":" + lineNumber; - return posString; + @Override // Reporter + public void print(Kind kind, String message) { + report(kind, null, null, message); + } + + @Override // Reporter + public void print(Diagnostic.Kind kind, DocTreePath path, String message) { + DiagnosticType dt = getDiagnosticType(kind); + Set flags = getDiagnosticFlags(kind); + DiagnosticSource ds = getDiagnosticSource(path); + DiagnosticPosition dp = getDiagnosticPosition(path); + report(dt, flags, ds, dp, message); + } + + @Override // Reporter + public void print(Kind kind, Element element, String message) { + DiagnosticType dt = getDiagnosticType(kind); + Set flags = getDiagnosticFlags(kind); + DiagnosticSource ds = getDiagnosticSource(element); + DiagnosticPosition dp = getDiagnosticPosition(element); + report(dt, flags, ds, dp, message); } /** - * Print error message, increment error count. - * Part of DocErrorReporter. + * Prints an error message. * - * @param msg message to print + * @param message the message */ - public void printError(String msg) { - printError((DocTreePath)null, msg); + public void printError(String message) { + report(DiagnosticType.ERROR,null, null, message); } - public void printError(DocTreePath path, String msg) { - String prefix = getDiagSource(path); - if (diagListener != null) { - report(DiagnosticType.ERROR, prefix, msg); - return; - } - printError(prefix, msg); + /** + * Prints an error message for a given documentation tree node. + * + * @param path the path for the documentation tree node + * @param message the message + */ + public void printError(DocTreePath path, String message) { + DiagnosticSource ds = getDiagnosticSource(path); + DiagnosticPosition dp = getDiagnosticPosition(path); + report(DiagnosticType.ERROR, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } - public void printError(Element e, String msg) { - String prefix = getDiagSource(e); - if (diagListener != null) { - report(DiagnosticType.ERROR, prefix, msg); - return; - } - printError(prefix, msg); + /** + * Prints an error message for a given element. + * + * @param element the element + * @param message the message + */ + public void printError(Element element, String message) { + DiagnosticSource ds = getDiagnosticSource(element); + DiagnosticPosition dp = getDiagnosticPosition(element); + report(DiagnosticType.ERROR, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } + /** + * Prints an error message. + * + * @param key the resource key for the message + * @param args the arguments for the message + */ public void printErrorUsingKey(String key, Object... args) { - printError((Element)null, getText(key, args)); + printError(getText(key, args)); } - // print the error and increment count - private void printError(String prefix, String msg) { - if (nerrors < MaxErrors) { - PrintWriter errWriter = getWriter(WriterKind.ERROR); - printRawLines(errWriter, prefix + ": " + getText("javadoc.error") + " - " + msg); - errWriter.flush(); - prompt(); - nerrors++; - } + /** + * Prints a warning message. + * + * @param message the message + */ + public void printWarning(String message) { + report(DiagnosticType.WARNING, null, null, message); } /** - * Print warning message, increment warning count. - * Part of DocErrorReporter. + * Prints a warning message for a given documentation tree node. * - * @param msg message to print + * @param path the path for the documentation tree node + * @param message the message */ - public void printWarning(String msg) { - printWarning((DocTreePath)null, msg); + public void printWarning(DocTreePath path, String message) { + DiagnosticSource ds = getDiagnosticSource(path); + DiagnosticPosition dp = getDiagnosticPosition(path); + report(DiagnosticType.WARNING, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } - public void printWarningUsingKey(String key, Object... args) { - printWarning((Element)null, getText(key, args)); + /** + * Prints a warning message for a given element. + * + * @param element the element + * @param message the message + */ + public void printWarning(Element element, String message) { + DiagnosticSource ds = getDiagnosticSource(element); + DiagnosticPosition dp = getDiagnosticPosition(element); + report(DiagnosticType.WARNING, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } - public void printWarning(Element e, String key, Object... args) { + /** + * Prints a warning message. + * + * @param key the resource key for the message + * @param args the arguments for the message + */ + public void printWarningUsingKey(String key, Object... args) { printWarning(getText(key, args)); } - public void printWarning(DocTreePath path, String msg) { - String prefix = getDiagSource(path); - if (diagListener != null) { - report(DiagnosticType.WARNING, prefix, msg); - return; - } - printWarning(prefix, msg); - } - - public void printWarning(Element e, String msg) { - String prefix = getDiagSource(e); - if (diagListener != null) { - report(DiagnosticType.WARNING, prefix, msg); - return; - } - printWarning(prefix, msg); - } - - // print the warning and increment count - private void printWarning(String prefix, String msg) { - if (nwarnings < MaxWarnings) { - PrintWriter warnWriter = getWriter(WriterKind.WARNING); - printRawLines(warnWriter, prefix + ": " + getText("javadoc.warning") + " - " + msg); - warnWriter.flush(); - nwarnings++; - } + /** + * Prints a warning message for an element. + * + * @param element the element + * @param key the resource key for the message + * @param args the arguments for the message + */ + public void printWarningUsingKey(Element element, String key, Object... args) { + printWarning(element, getText(key, args)); } /** - * Print a message. - * Part of DocErrorReporter. + * Prints a "notice" message. * - * @param msg message to print + * @param message the message */ - public void printNotice(String msg) { - printNotice((DocTreePath)null, msg); + public void printNotice(String message) { + report(DiagnosticType.NOTE, null, null, message); } - public void printNotice(DocTreePath path, String msg) { - String prefix = getDiagSource(path); - if (diagListener != null) { - report(DiagnosticType.NOTE, null, prefix + ": " + msg); - return; - } - - PrintWriter noticeWriter = getWriter(WriterKind.NOTICE); - if (path == null) { - printRawLines(noticeWriter, msg); - } else { - printRawLines(noticeWriter, prefix + ": " + msg); - } - noticeWriter.flush(); + /** + * Prints a "notice" message for a given documentation tree node. + * + * @param path the path for the documentation tree node + * @param message the message + */ + public void printNotice(DocTreePath path, String message) { + DiagnosticSource ds = getDiagnosticSource(path); + DiagnosticPosition dp = getDiagnosticPosition(path); + report(DiagnosticType.NOTE, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } - public void printNotice(Element e, String msg) { - String pos = getDiagSource(e); - if (diagListener != null) { - report(DiagnosticType.NOTE, pos, msg); - return; - } - - PrintWriter noticeWriter = getWriter(WriterKind.NOTICE); - if (e == null) { - printRawLines(noticeWriter, msg); - } else { - printRawLines(noticeWriter, pos + ": " + msg); - } - noticeWriter.flush(); + /** + * Prints a "notice" message for a given element. + * + * @param element the element + * @param message the message + */ + public void printNotice(Element element, String message) { + DiagnosticSource ds = getDiagnosticSource(element); + DiagnosticPosition dp = getDiagnosticPosition(element); + report(DiagnosticType.NOTE, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); } /** - * Print a message. + * Prints a "notice" message. * - * @param key selects message from resource + * @param key the resource key for the message + * @param args the arguments for the message */ public void notice(String key, Object... args) { printNotice(getText(key, args)); @@ -370,7 +389,7 @@ public boolean hasWarnings() { } /** - * Print exit message. + * Prints the error and warning counts, if any. */ public void printErrorWarningCounts() { if (nerrors > 0) { @@ -383,21 +402,237 @@ public void printErrorWarningCounts() { } } - private void report(DiagnosticType type, String pos, String msg) { - switch (type) { - case ERROR: - case WARNING: - Object prefix = (pos == null) ? programName : pos; - report(javadocDiags.create(type, null, null, "msg", prefix, msg)); - break; + /** + * Reports a diagnostic message. + * + * @param kind the kind of diagnostic + * @param ds the diagnostic source + * @param dp the diagnostic position + * @param message the message + */ + private void report(Diagnostic.Kind kind, DiagnosticSource ds, DiagnosticPosition dp, String message) { + report(getDiagnosticType(kind), getDiagnosticFlags(kind), ds, dp, message); + } + + /** + * Reports a diagnostic message. + * + * @param dt the diagnostic type + * @param ds the diagnostic source + * @param dp the diagnostic position + * @param message the message + */ + private void report(DiagnosticType dt, DiagnosticSource ds, DiagnosticPosition dp, String message) { + report(dt, EnumSet.noneOf(DiagnosticFlag.class), ds, dp, message); + } + + /** + * Reports a diagnostic message, with diagnostic flags. + * For javadoc, the only flag that is used is {@code MANDATORY_WARNING}, and only + * because in principle the public API supports it via {@code Kind.MANDATORY_WARNING}. + * javadoc itself does generate mandatory warnings. + * + * This is the primary low-level wrapper around the underlying {@code Log.report}. + * Because we already have a localized message, we use wrapper resources (just {@code {0}}) + * to wrap the string. The current behavior is one wrapper per diagnostic type. + * We could improve this by subtyping {@code DiagnosticInfo} to modify the resource key used. + * + * {@code Log} reports all diagnostics to the corresponding writer, which defaults + * to the "error" stream, when using the two-stream constructor. That doesn't work + * for javadoc, which has historically written notes to the "output" stream, because + * the public API used by doclets does not provide for more detailed control. + * Therefore, for now, javadoc continues to use the (deprecated) three-stream + * constructor, with the {@code NOTE} stream set to the "output" stream. + * + * {@code Log} reports all notes with a "Note:" prefix. That's not good for the + * standard doclet, which uses notes to report the various "progress" messages, + * such as "Generating class ...". Therefore, for now, we detect and report those + * messages directly. (A better solution would be to expose access to the output + * and error streams via {@code Reporter}). + * + * Note: there is an intentional difference in behavior between the diagnostic source + * being set to {@code null} (no source intended) and {@code NO_SOURCE} (no source available). + * + * @param dt the diagnostic type + * @param ds the diagnostic source + * @param dp the diagnostic position + * @param message the message + */ + private void report(DiagnosticType dt, Set flags, DiagnosticSource ds, DiagnosticPosition dp, String message) { + if (dt == DiagnosticType.NOTE && ds == null && !hasDiagnosticListener()) { + printRawLines(WriterKind.STDOUT, message); + getWriter(WriterKind.STDOUT).flush(); + } else { + report(javadocDiags.create(dt, null, flags, ds, dp, "message", message)); + } + } + + /** + * Returns a diagnostic position for a documentation tree node. + * + * @param path the path for the documentation tree node + * @return the diagnostic position + */ + private DiagnosticPosition getDiagnosticPosition(DocTreePath path) { + DocSourcePositions posns = getSourcePositions(); + CompilationUnitTree compUnit = path.getTreePath().getCompilationUnit(); + int start = (int) posns.getStartPosition(compUnit, path.getDocComment(), path.getLeaf()); + int end = (int) posns.getEndPosition(compUnit, path.getDocComment(), path.getLeaf()); + return createDiagnosticPosition(null, start, start, end); + } + + /** + * Returns a diagnostic position for an element, or {@code null} if the source + * file is not available. + * + * @param element the element + * @return the diagnostic position + */ + private DiagnosticPosition getDiagnosticPosition(Element element) { + ToolEnvironment toolEnv = getToolEnv(); + DocSourcePositions posns = getSourcePositions(); + TreePath tp = toolEnv.elementToTreePath.get(element); + if (tp == null) { + return null; + } + CompilationUnitTree compUnit = tp.getCompilationUnit(); + JCTree tree = (JCTree) tp.getLeaf(); + int start = (int) posns.getStartPosition(compUnit, tree); + int pos = tree.getPreferredPosition(); + int end = (int) posns.getEndPosition(compUnit, tree); + return createDiagnosticPosition(tree, start, pos, end); + } + + /** + * Creates a diagnostic position. + * + * @param tree the tree node, or null if no tree is applicable + * @param start the start position + * @param pos the "preferred" position: this is used to position the caret in messages + * @param end the end position + * @return the diagnostic position + */ + private DiagnosticPosition createDiagnosticPosition(JCTree tree, int start, int pos, int end) { + return new DiagnosticPosition() { + @Override + public JCTree getTree() { + return tree; + } + + @Override + public int getStartPosition() { + return start; + } + + @Override + public int getPreferredPosition() { + return pos; + } + + @Override + public int getEndPosition(EndPosTable endPosTable) { + return end; + } + }; + } + + /** + * Returns the diagnostic type for a diagnostic kind. + * + * @param kind the diagnostic kind + * @return the diagnostic type + */ + private DiagnosticType getDiagnosticType(Diagnostic.Kind kind) { + return switch (kind) { + case ERROR -> DiagnosticType.ERROR; + case WARNING, MANDATORY_WARNING -> DiagnosticType.WARNING; + case NOTE -> DiagnosticType.NOTE; + case OTHER -> DiagnosticType.FRAGMENT; + }; + } + + /** + * Returns the diagnostic flags for a diagnostic kind. + * A diagnostic kind of {@code MANDATORY_WARNING} requires the {@code MANDATORY} flag. + * + * @param kind the diagnostic kind + * @return the flags + */ + private Set getDiagnosticFlags(Diagnostic.Kind kind) { + return kind == Kind.MANDATORY_WARNING + ? EnumSet.of(DiagnosticFlag.MANDATORY) + : EnumSet.noneOf(DiagnosticFlag.class); + } - case NOTE: - String key = (pos == null) ? "msg" : "pos.msg"; - report(javadocDiags.create(type, null, null, key, pos, msg)); - break; + /** + * Returns the diagnostic source for an documentation tree node. + * + * @param path the path for the documentation tree node + * @return the diagnostic source + */ + private DiagnosticSource getDiagnosticSource(DocTreePath path) { + return getDiagnosticSource(path.getTreePath().getCompilationUnit().getSourceFile()); + } - default: - throw new IllegalArgumentException(type.toString()); + /** + * Returns the diagnostic source for an element, or {@code NO_SOURCE} if the + * source file is not known (for example, if the element was read from a class file). + * + * @param element the element + * @return the diagnostic source + */ + private DiagnosticSource getDiagnosticSource(Element element) { + TreePath tp = getToolEnv().elementToTreePath.get(element); + return tp == null ? DiagnosticSource.NO_SOURCE + : getDiagnosticSource(tp.getCompilationUnit().getSourceFile()); + } + + /** + * Returns the diagnostic source for a file object. + * + * {@code DiagnosticSource} objects are moderately expensive because they maintain + * an internal copy of the content, to provide the line map. + * Therefore, we keep a small memory-sensitive cache of recently used objects. + * + * @param fo the file object + * @return the diagnostic source + */ + private DiagnosticSource getDiagnosticSource(JavaFileObject fo) { + Reference ref = diagSourceCache.get(fo); + DiagnosticSource ds = ref == null ? null : ref.get(); + if (ds == null) { + ds = new DiagnosticSource(fo, this); + diagSourceCache.put(fo, new SoftReference<>(ds)); + } + return ds; + } + + /** + * Returns the object for computing source positions. + * + * The value is determined lazily because the tool environment is computed lazily. + * + * @return the object for computing source positions + */ + private DocSourcePositions getSourcePositions() { + if (sourcePositions == null) { + sourcePositions = getToolEnv().docTrees.getSourcePositions(); + } + return sourcePositions; + } + + /** + * Returns the tool environment. + * + * The value is determined lazily, because creating it eagerly disrupts + * the overall initialization of objects in the context. + * + * @return the tool environment + */ + private ToolEnvironment getToolEnv() { + if (toolEnv == null) { + toolEnv = ToolEnvironment.instance(context); } + return toolEnv; } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java index 24cce42cf57..df71de3f858 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -140,8 +140,8 @@ public Start(Context context) { this.locale = Locale.getDefault(); Log log = context.get(Log.logKey); - if (log instanceof Messager) { - messager = (Messager) log; + if (log instanceof Messager m){ + messager = m; } else { PrintWriter out = context.get(Log.errKey); messager = (out == null) @@ -327,13 +327,7 @@ void showOption(List names, String parameters, String description) { /** - * Main program - external wrapper. In order to maintain backward - * CLI compatibility, the execution is dispatched to the appropriate - * Start mechanism, depending on the doclet variant. - * - * The doclet tests are performed in the begin method, further on, - * this is to minimize argument processing and most importantly the impact - * of class loader creation, needed to detect the doclet class variants. + * Main program - external wrapper. */ @SuppressWarnings("deprecation") Result begin(String... argv) { @@ -366,8 +360,8 @@ private Result begin(List options, Iterable fi if (fileManager == null) { JavacFileManager.preRegister(context); fileManager = context.get(JavaFileManager.class); - if (fileManager instanceof BaseFileManager) { - ((BaseFileManager) fileManager).autoClose = true; + if (fileManager instanceof BaseFileManager bfm) { + bfm.autoClose = true; } } @@ -398,11 +392,19 @@ private Result begin(List options, Iterable fi try { result = parseAndExecute(options, fileObjects); } catch (com.sun.tools.javac.main.Option.InvalidValueException e) { - messager.printError(e.getMessage()); + // The detail message from javac already includes a localized "error: " prefix, + // so print the message directly. + // It would be even better to rethrow this as IllegalArgumentException + // when invoked via the API. + // See javac Arguments.error(InvalidValueException) for an example + messager.printRawLines(e.getMessage()); Throwable t = e.getCause(); dumpStack(t == null ? e : t); return ERROR; } catch (OptionException oe) { + // It would be even better to rethrow this as IllegalArgumentException + // when invoked via the API. + // See javac Arguments.error(InvalidValueException) for an example if (oe.message != null) messager.printError(oe.message); @@ -433,9 +435,8 @@ private Result begin(List options, Iterable fi reportInternalError(ee); result = ABNORMAL; } finally { - if (fileManager != null - && fileManager instanceof BaseFileManager - && ((BaseFileManager) fileManager).autoClose) { + if (fileManager instanceof BaseFileManager bfm + && bfm.autoClose) { try { fileManager.close(); } catch (IOException ignore) {} @@ -518,8 +519,8 @@ private Result parseAndExecute(List argList, Iterable aClass) { if (aClass == null) { putLong(0L); } else { - putLong(JVM.getClassIdNonIntrinsic(aClass)); + putLong(JVM.getClassId(aClass)); } } 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 bf4c8b61552..a88b428dac3 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -142,9 +142,6 @@ private JVM() { @IntrinsicCandidate public static native long getClassId(Class clazz); - // temporary workaround until we solve intrinsics supporting epoch shift tagging - public static native long getClassIdNonIntrinsic(Class clazz); - /** * Return process identifier. * diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java index 229076c1f0c..3c7494452b4 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java @@ -129,7 +129,7 @@ public Option(boolean hasArg, String shortname, boolean isTerminal) { - this(hasArg, processing, false, name, shortname, "", isTerminal); + this(hasArg, processing, hidden, name, shortname, "", isTerminal); } public Option(boolean hasArg, Processing processing, String name, String shortname, boolean isTerminal) { diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java index 8ff4bfee78f..4d1129ac8dc 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -60,7 +60,6 @@ import jdk.internal.module.Checks; import jdk.internal.module.DefaultRoots; -import jdk.internal.module.IllegalAccessMaps; import jdk.internal.module.Modules; import jdk.internal.module.ModuleHashes; import jdk.internal.module.ModuleInfo.Attributes; @@ -622,9 +621,6 @@ public ClassWriter getClassWriter(Configuration cf) { // generate moduleReads genModuleReads(cw, cf); - // generate concealedPackagesToOpen and exportedPackagesToOpen - genXXXPackagesToOpenMethods(cw); - return cw; } @@ -855,16 +851,6 @@ private void genModuleReads(ClassWriter cw, Configuration cf) { generate(cw, "moduleReads", map, true); } - /** - * Generate concealedPackagesToOpen and exportedPackagesToOpen methods. - */ - private void genXXXPackagesToOpenMethods(ClassWriter cw) { - ModuleFinder finder = finderOf(moduleInfos); - IllegalAccessMaps maps = IllegalAccessMaps.generate(finder); - generate(cw, "concealedPackagesToOpen", maps.concealedPackagesToOpen(), false); - generate(cw, "exportedPackagesToOpen", maps.exportedPackagesToOpen(), false); - } - /** * Generate method to return {@code Map>}. * diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java index 8c643e23882..316afdbd659 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java @@ -674,7 +674,8 @@ Set findPackages(List classpath) { Set findPackages(Path dir) { try { return Files.find(dir, Integer.MAX_VALUE, - ((path, attrs) -> attrs.isRegularFile())) + ((path, attrs) -> attrs.isRegularFile()), + FileVisitOption.FOLLOW_LINKS) .map(dir::relativize) .filter(path -> isResource(path.toString())) .map(path -> toPackageName(path)) diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java index 4a0dcd5337a..2d436c244dc 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java @@ -451,7 +451,7 @@ private Path createPKG(Map params, "--analyze", cpl.toAbsolutePath().toString()); - IOUtils.exec(pb); + IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT); patchCPLFile(cpl); @@ -467,7 +467,7 @@ private Path createPKG(Map params, "--identifier", MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params), appPKG.toAbsolutePath().toString()); - IOUtils.exec(pb); + IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT); } else { preparePackageScripts(params); pb = new ProcessBuilder("/usr/bin/pkgbuild", @@ -483,7 +483,7 @@ private Path createPKG(Map params, "--identifier", MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params), appPKG.toAbsolutePath().toString()); - IOUtils.exec(pb); + IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT); } // build final package @@ -541,7 +541,7 @@ private Path createPKG(Map params, commandLine.add(finalPKG.toAbsolutePath().toString()); pb = new ProcessBuilder(commandLine); - IOUtils.exec(pb); + IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT); return finalPKG; } catch (Exception ignored) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java index b6689b4f7f2..0262ae1ac73 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java @@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; -import java.util.stream.Collectors; import java.util.stream.Stream; public final class Executor { @@ -182,7 +181,7 @@ int execute() throws IOException { code = p.waitFor(); } if (!quietCommand) { - Log.verbose(pb.command(), getOutput(), code); + Log.verbose(pb.command(), getOutput(), code, IOUtils.getPID(p)); } return code; } catch (InterruptedException ex) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java index dbc500c8a4f..bc32df6a9ba 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -243,7 +243,7 @@ public static int getProcessOutput(List result, String... args) t.start(); int ret = p.waitFor(); - Log.verbose(pb.command(), list, ret); + Log.verbose(pb.command(), list, ret, IOUtils.getPID(p)); result.clear(); result.addAll(list); @@ -335,6 +335,17 @@ public static Path getFileName(Path p) { return filename; } + public static long getPID(Process p) { + try { + return p.pid(); + } catch (UnsupportedOperationException ex) { + Log.verbose(ex); // Just log exception and ignore it. This method + // is used for verbose output, so not a problem + // if unsupported. + return -1; + } + } + private static class PrettyPrintHandler implements InvocationHandler { PrettyPrintHandler(XMLStreamWriter target) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java index 6b4def12811..62ddaa82219 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -192,7 +192,7 @@ private static void runJLink(Path output, List modulePath, String jlinkOut = writer.toString(); args.add(0, "jlink"); - Log.verbose(args, List.of(jlinkOut), retVal); + Log.verbose(args, List.of(jlinkOut), retVal, -1); if (retVal != 0) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java index 3bef0f0fee5..22e43b4311f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -106,9 +106,13 @@ public void verbose(String msg) { } public void verbose(List strings, - List output, int returnCode) { + List output, int returnCode, long pid) { if (verbose) { - StringBuffer sb = new StringBuffer("Command:\n "); + StringBuffer sb = new StringBuffer(); + sb.append("Command [PID: "); + sb.append(pid); + sb.append("]:\n "); + for (String s : strings) { sb.append(" " + s); } @@ -174,7 +178,8 @@ public static void verbose(Throwable t) { instance.get().verbose(t); } - public static void verbose(List strings, List out, int ret) { - instance.get().verbose(strings, out, ret); + public static void verbose(List strings, List out, + int ret, long pid) { + instance.get().verbose(strings, out, ret, pid); } } diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_iw.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_he.java similarity index 98% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_iw.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_he.java index 25fea11ef1e..b5bb06b35fd 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_iw.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/CollationData_he.java @@ -45,7 +45,7 @@ import java.util.ListResourceBundle; -public class CollationData_iw extends ListResourceBundle { +public class CollationData_he extends ListResourceBundle { protected final Object[][] getContents() { return new Object[][] { diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he.java similarity index 99% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he.java index 93441b49dfa..cfde6826e40 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he.java @@ -78,7 +78,7 @@ import sun.util.resources.ParallelListResourceBundle; -public class FormatData_iw extends ParallelListResourceBundle { +public class FormatData_he extends ParallelListResourceBundle { /** * Overrides ParallelListResourceBundle */ diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw_IL.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he_IL.java similarity index 97% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw_IL.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he_IL.java index 8fefe693a77..f03bae72d41 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_iw_IL.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_he_IL.java @@ -42,7 +42,7 @@ import sun.util.resources.ParallelListResourceBundle; -public class FormatData_iw_IL extends ParallelListResourceBundle { +public class FormatData_he_IL extends ParallelListResourceBundle { /** * Overrides ParallelListResourceBundle */ diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id.java similarity index 98% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id.java index 9b75e8ca1fc..c816077942a 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id.java @@ -63,7 +63,7 @@ import sun.util.resources.ParallelListResourceBundle; -public class FormatData_in extends ParallelListResourceBundle { +public class FormatData_id extends ParallelListResourceBundle { protected final Object[][] getContents() { return new Object[][] { { "MonthNames", diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in_ID.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id_ID.java similarity index 98% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in_ID.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id_ID.java index d9b14c201f8..ed3b6c77dce 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_in_ID.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_id_ID.java @@ -63,7 +63,7 @@ import sun.util.resources.ParallelListResourceBundle; -public class FormatData_in_ID extends ParallelListResourceBundle { +public class FormatData_id_ID extends ParallelListResourceBundle { protected final Object[][] getContents() { return new Object[][] { { "TimePatterns", diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_iw.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_he.java similarity index 99% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_iw.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_he.java index 3170efd769b..0b1df1c6b6d 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_iw.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_he.java @@ -69,7 +69,7 @@ import sun.util.resources.OpenListResourceBundle; -public class JavaTimeSupplementary_iw extends OpenListResourceBundle { +public class JavaTimeSupplementary_he extends OpenListResourceBundle { @Override protected final Object[][] getContents() { final String[] sharedQuarterNames = { diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_in.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_id.java similarity index 99% rename from src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_in.java rename to src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_id.java index 067027554c6..022a3b664b5 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_in.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_id.java @@ -69,7 +69,7 @@ import sun.util.resources.OpenListResourceBundle; -public class JavaTimeSupplementary_in extends OpenListResourceBundle { +public class JavaTimeSupplementary_id extends OpenListResourceBundle { @Override protected final Object[][] getContents() { final String[] sharedQuarterAbbreviations = { diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_iw.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_he.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_iw.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_he.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_in_ID.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_id_ID.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_in_ID.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/CalendarData_id_ID.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_iw_IL.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_he_IL.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_iw_IL.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_he_IL.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_in_ID.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_id_ID.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_in_ID.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_id_ID.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_iw.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_he.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_iw.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_he.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_in.properties b/src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_id.properties similarity index 100% rename from src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_in.properties rename to src/jdk.localedata/share/classes/sun/util/resources/ext/LocaleNames_id.properties diff --git a/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java b/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java index ed9f5b826d9..2ed2851a521 100644 --- a/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java +++ b/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -36,7 +36,15 @@ public class LocaleDataProvider extends LocaleData.CommonResourceBundleProvider { @Override public ResourceBundle getBundle(String baseName, Locale locale) { - return loadResourceBundle(toBundleName(baseName, locale)); + var bundleName = toBundleName(baseName, locale); + var rb = loadResourceBundle(bundleName); + if (rb == null) { + var otherBundleName = toOtherBundleName(baseName, bundleName, locale); + if (!bundleName.equals(otherBundleName)) { + rb = loadResourceBundle(otherBundleName); + } + } + return rb; } /** diff --git a/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java b/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java index 04d3c11b663..c214dedba20 100644 --- a/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java +++ b/src/jdk.localedata/share/classes/sun/util/resources/provider/SupplementaryLocaleDataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -35,6 +35,14 @@ public class SupplementaryLocaleDataProvider extends LocaleData.SupplementaryResourceBundleProvider { @Override public ResourceBundle getBundle(String baseName, Locale locale) { - return LocaleDataProvider.loadResourceBundle(toBundleName(baseName, locale)); + var bundleName = toBundleName(baseName, locale); + var rb = LocaleDataProvider.loadResourceBundle(bundleName); + if (rb == null) { + var otherBundleName = toOtherBundleName(baseName, bundleName, locale); + if (!bundleName.equals(otherBundleName)) { + rb = LocaleDataProvider.loadResourceBundle(otherBundleName); + } + } + return rb; } } diff --git a/src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c b/src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c index 01227414dc6..ebd298ede44 100644 --- a/src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c +++ b/src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c @@ -51,6 +51,13 @@ Java_com_sun_management_internal_OperatingSystemImpl_getSingleCpuLoad0 return -1.0; } +JNIEXPORT jlong JNICALL +Java_com_sun_management_internal_OperatingSystemImpl_getHostTotalCpuTicks0 +(JNIEnv *env, jobject mbean) +{ + return -1.0; +} + JNIEXPORT jint JNICALL Java_com_sun_management_internal_OperatingSystemImpl_getHostConfiguredCpuCount0 (JNIEnv *env, jobject mbean) diff --git a/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c b/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c index e27cc6605be..c4caa49a0e8 100644 --- a/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c +++ b/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c @@ -61,6 +61,7 @@ static struct perfbuf { } counters; #define DEC_64 "%"SCNd64 +#define NS_PER_SEC 1000000000 static void next_line(FILE *f) { while (fgetc(f) != '\n'); @@ -363,6 +364,31 @@ Java_com_sun_management_internal_OperatingSystemImpl_getHostConfiguredCpuCount0 } } +// Return the host cpu ticks since boot in nanoseconds +JNIEXPORT jlong JNICALL +Java_com_sun_management_internal_OperatingSystemImpl_getHostTotalCpuTicks0 +(JNIEnv *env, jobject mbean) +{ + if (perfInit() == 0) { + if (get_totalticks(-1, &counters.cpuTicks) < 0) { + return -1; + } else { + long ticks_per_sec = sysconf(_SC_CLK_TCK); + jlong result = (jlong)counters.cpuTicks.total; + if (ticks_per_sec <= NS_PER_SEC) { + long scale_factor = NS_PER_SEC/ticks_per_sec; + result = result * scale_factor; + } else { + long scale_factor = ticks_per_sec/NS_PER_SEC; + result = result / scale_factor; + } + return result; + } + } else { + return -1; + } +} + JNIEXPORT jint JNICALL Java_com_sun_management_internal_OperatingSystemImpl_getHostOnlineCpuCount0 (JNIEnv *env, jobject mbean) diff --git a/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c b/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c index 3f4ba6a75c2..8b6d00339cc 100644 --- a/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c +++ b/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c @@ -167,6 +167,13 @@ Java_com_sun_management_internal_OperatingSystemImpl_getSingleCpuLoad0 return -1.0; } +JNIEXPORT jlong JNICALL +Java_com_sun_management_internal_OperatingSystemImpl_getHostTotalCpuTicks0 +(JNIEnv *env, jobject mbean) +{ + return -1.0; +} + JNIEXPORT jint JNICALL Java_com_sun_management_internal_OperatingSystemImpl_getHostConfiguredCpuCount0 (JNIEnv *env, jobject mbean) diff --git a/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java b/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java index cfd34bb3ea8..05d59ba3985 100644 --- a/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java +++ b/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java @@ -42,6 +42,8 @@ class OperatingSystemImpl extends BaseOperatingSystemImpl private static final int MAX_ATTEMPTS_NUMBER = 10; private final Metrics containerMetrics; + private long usageTicks = 0; // used for cpu load calculation + private long totalTicks = 0; // used for cpu load calculation OperatingSystemImpl(VMManagement vm) { super(vm); @@ -132,24 +134,56 @@ public long getMaxFileDescriptorCount() { return getMaxFileDescriptorCount0(); } + private double getUsageDividesTotal(long usageTicks, long totalTicks) { + // If cpu quota or cpu shares are in effect calculate the cpu load + // based on the following formula (similar to how + // getCpuLoad0() is being calculated): + // + // | usageTicks - usageTicks' | + // ------------------------------ + // | totalTicks - totalTicks' | + // + // where usageTicks' and totalTicks' are historical values + // retrieved via an earlier call of this method. + // + // Total ticks should be scaled to the container effective number + // of cpus, if cpu shares are in effect. + if (usageTicks < 0 || totalTicks <= 0) { + return -1; + } + long distance = usageTicks - this.usageTicks; + this.usageTicks = usageTicks; + long totalDistance = totalTicks - this.totalTicks; + this.totalTicks = totalTicks; + + double systemLoad = 0.0; + if (distance > 0 && totalDistance > 0) { + systemLoad = ((double)distance) / totalDistance; + } + // Ensure the return value is in the range 0.0 -> 1.0 + systemLoad = Math.max(0.0, systemLoad); + systemLoad = Math.min(1.0, systemLoad); + return systemLoad; + } + public double getCpuLoad() { if (containerMetrics != null) { long quota = containerMetrics.getCpuQuota(); + long share = containerMetrics.getCpuShares(); + long usageNanos = containerMetrics.getCpuUsage(); if (quota > 0) { - long periodLength = containerMetrics.getCpuPeriod(); long numPeriods = containerMetrics.getCpuNumPeriods(); - long usageNanos = containerMetrics.getCpuUsage(); - if (periodLength > 0 && numPeriods > 0 && usageNanos > 0) { - long elapsedNanos = TimeUnit.MICROSECONDS.toNanos(periodLength * numPeriods); - double systemLoad = (double) usageNanos / elapsedNanos; - // Ensure the return value is in the range 0.0 -> 1.0 - systemLoad = Math.max(0.0, systemLoad); - systemLoad = Math.min(1.0, systemLoad); - return systemLoad; - } - return -1; + long quotaNanos = TimeUnit.MICROSECONDS.toNanos(quota * numPeriods); + return getUsageDividesTotal(usageNanos, quotaNanos); + } else if (share > 0) { + long hostTicks = getHostTotalCpuTicks0(); + int totalCPUs = getHostOnlineCpuCount0(); + int containerCPUs = getAvailableProcessors(); + // scale the total host load to the actual container cpus + hostTicks = hostTicks * containerCPUs / totalCPUs; + return getUsageDividesTotal(usageNanos, hostTicks); } else { - // If CPU quotas are not active then find the average system load for + // If CPU quotas and shares are not active then find the average system load for // all online CPUs that are allowed to run this container. // If the cpuset is the same as the host's one there is no need to iterate over each CPU @@ -208,6 +242,8 @@ private boolean isCpuSetSameAsHostCpuSet() { private native double getSingleCpuLoad0(int cpuNum); private native int getHostConfiguredCpuCount0(); private native int getHostOnlineCpuCount0(); + // CPU ticks since boot in nanoseconds + private native long getHostTotalCpuTicks0(); static { initialize0(); diff --git a/test/hotspot/gtest/aarch64/aarch64-asmtest.py b/test/hotspot/gtest/aarch64/aarch64-asmtest.py index f4f1112fd54..8acf74474b7 100644 --- a/test/hotspot/gtest/aarch64/aarch64-asmtest.py +++ b/test/hotspot/gtest/aarch64/aarch64-asmtest.py @@ -1461,11 +1461,17 @@ def generate(kind, names): ["maxv", "smax", "8B"], ["maxv", "smax", "16B"], ["maxv", "smax", "4H"], ["maxv", "smax", "8H"], ["maxv", "smax", "2S"], ["maxv", "smax", "4S"], + ["smaxp", "smaxp", "8B"], ["smaxp", "smaxp", "16B"], + ["smaxp", "smaxp", "4H"], ["smaxp", "smaxp", "8H"], + ["smaxp", "smaxp", "2S"], ["smaxp", "smaxp", "4S"], ["fmax", "fmax", "2S"], ["fmax", "fmax", "4S"], ["fmax", "fmax", "2D"], ["minv", "smin", "8B"], ["minv", "smin", "16B"], ["minv", "smin", "4H"], ["minv", "smin", "8H"], ["minv", "smin", "2S"], ["minv", "smin", "4S"], + ["sminp", "sminp", "8B"], ["sminp", "sminp", "16B"], + ["sminp", "sminp", "4H"], ["sminp", "sminp", "8H"], + ["sminp", "sminp", "2S"], ["sminp", "sminp", "4S"], ["fmin", "fmin", "2S"], ["fmin", "fmin", "4S"], ["fmin", "fmin", "2D"], ["cmeq", "cmeq", "8B"], ["cmeq", "cmeq", "16B"], diff --git a/test/hotspot/gtest/aarch64/asmtest.out.h b/test/hotspot/gtest/aarch64/asmtest.out.h index c549b050981..67993c138d5 100644 --- a/test/hotspot/gtest/aarch64/asmtest.out.h +++ b/test/hotspot/gtest/aarch64/asmtest.out.h @@ -632,48 +632,60 @@ __ maxv(v15, __ T8H, v16, v17); // smax v15.8H, v16.8H, v17.8H __ maxv(v17, __ T2S, v18, v19); // smax v17.2S, v18.2S, v19.2S __ maxv(v29, __ T4S, v30, v31); // smax v29.4S, v30.4S, v31.4S - __ fmax(v26, __ T2S, v27, v28); // fmax v26.2S, v27.2S, v28.2S - __ fmax(v28, __ T4S, v29, v30); // fmax v28.4S, v29.4S, v30.4S - __ fmax(v1, __ T2D, v2, v3); // fmax v1.2D, v2.2D, v3.2D - __ minv(v27, __ T8B, v28, v29); // smin v27.8B, v28.8B, v29.8B - __ minv(v0, __ T16B, v1, v2); // smin v0.16B, v1.16B, v2.16B - __ minv(v20, __ T4H, v21, v22); // smin v20.4H, v21.4H, v22.4H - __ minv(v28, __ T8H, v29, v30); // smin v28.8H, v29.8H, v30.8H - __ minv(v15, __ T2S, v16, v17); // smin v15.2S, v16.2S, v17.2S - __ minv(v12, __ T4S, v13, v14); // smin v12.4S, v13.4S, v14.4S + __ smaxp(v26, __ T8B, v27, v28); // smaxp v26.8B, v27.8B, v28.8B + __ smaxp(v28, __ T16B, v29, v30); // smaxp v28.16B, v29.16B, v30.16B + __ smaxp(v1, __ T4H, v2, v3); // smaxp v1.4H, v2.4H, v3.4H + __ smaxp(v27, __ T8H, v28, v29); // smaxp v27.8H, v28.8H, v29.8H + __ smaxp(v0, __ T2S, v1, v2); // smaxp v0.2S, v1.2S, v2.2S + __ smaxp(v20, __ T4S, v21, v22); // smaxp v20.4S, v21.4S, v22.4S + __ fmax(v28, __ T2S, v29, v30); // fmax v28.2S, v29.2S, v30.2S + __ fmax(v15, __ T4S, v16, v17); // fmax v15.4S, v16.4S, v17.4S + __ fmax(v12, __ T2D, v13, v14); // fmax v12.2D, v13.2D, v14.2D + __ minv(v10, __ T8B, v11, v12); // smin v10.8B, v11.8B, v12.8B + __ minv(v28, __ T16B, v29, v30); // smin v28.16B, v29.16B, v30.16B + __ minv(v28, __ T4H, v29, v30); // smin v28.4H, v29.4H, v30.4H + __ minv(v19, __ T8H, v20, v21); // smin v19.8H, v20.8H, v21.8H + __ minv(v22, __ T2S, v23, v24); // smin v22.2S, v23.2S, v24.2S + __ minv(v10, __ T4S, v11, v12); // smin v10.4S, v11.4S, v12.4S + __ sminp(v4, __ T8B, v5, v6); // sminp v4.8B, v5.8B, v6.8B + __ sminp(v30, __ T16B, v31, v0); // sminp v30.16B, v31.16B, v0.16B + __ sminp(v20, __ T4H, v21, v22); // sminp v20.4H, v21.4H, v22.4H + __ sminp(v8, __ T8H, v9, v10); // sminp v8.8H, v9.8H, v10.8H + __ sminp(v30, __ T2S, v31, v0); // sminp v30.2S, v31.2S, v0.2S + __ sminp(v17, __ T4S, v18, v19); // sminp v17.4S, v18.4S, v19.4S __ fmin(v10, __ T2S, v11, v12); // fmin v10.2S, v11.2S, v12.2S - __ fmin(v28, __ T4S, v29, v30); // fmin v28.4S, v29.4S, v30.4S - __ fmin(v28, __ T2D, v29, v30); // fmin v28.2D, v29.2D, v30.2D - __ cmeq(v19, __ T8B, v20, v21); // cmeq v19.8B, v20.8B, v21.8B - __ cmeq(v22, __ T16B, v23, v24); // cmeq v22.16B, v23.16B, v24.16B - __ cmeq(v10, __ T4H, v11, v12); // cmeq v10.4H, v11.4H, v12.4H - __ cmeq(v4, __ T8H, v5, v6); // cmeq v4.8H, v5.8H, v6.8H - __ cmeq(v30, __ T2S, v31, v0); // cmeq v30.2S, v31.2S, v0.2S - __ cmeq(v20, __ T4S, v21, v22); // cmeq v20.4S, v21.4S, v22.4S - __ cmeq(v8, __ T2D, v9, v10); // cmeq v8.2D, v9.2D, v10.2D - __ fcmeq(v30, __ T2S, v31, v0); // fcmeq v30.2S, v31.2S, v0.2S - __ fcmeq(v17, __ T4S, v18, v19); // fcmeq v17.4S, v18.4S, v19.4S - __ fcmeq(v10, __ T2D, v11, v12); // fcmeq v10.2D, v11.2D, v12.2D - __ cmgt(v27, __ T8B, v28, v29); // cmgt v27.8B, v28.8B, v29.8B - __ cmgt(v2, __ T16B, v3, v4); // cmgt v2.16B, v3.16B, v4.16B + __ fmin(v27, __ T4S, v28, v29); // fmin v27.4S, v28.4S, v29.4S + __ fmin(v2, __ T2D, v3, v4); // fmin v2.2D, v3.2D, v4.2D + __ cmeq(v24, __ T8B, v25, v26); // cmeq v24.8B, v25.8B, v26.8B + __ cmeq(v4, __ T16B, v5, v6); // cmeq v4.16B, v5.16B, v6.16B + __ cmeq(v3, __ T4H, v4, v5); // cmeq v3.4H, v4.4H, v5.4H + __ cmeq(v8, __ T8H, v9, v10); // cmeq v8.8H, v9.8H, v10.8H + __ cmeq(v22, __ T2S, v23, v24); // cmeq v22.2S, v23.2S, v24.2S + __ cmeq(v17, __ T4S, v18, v19); // cmeq v17.4S, v18.4S, v19.4S + __ cmeq(v13, __ T2D, v14, v15); // cmeq v13.2D, v14.2D, v15.2D + __ fcmeq(v4, __ T2S, v5, v6); // fcmeq v4.2S, v5.2S, v6.2S + __ fcmeq(v28, __ T4S, v29, v30); // fcmeq v28.4S, v29.4S, v30.4S + __ fcmeq(v23, __ T2D, v24, v25); // fcmeq v23.2D, v24.2D, v25.2D + __ cmgt(v21, __ T8B, v22, v23); // cmgt v21.8B, v22.8B, v23.8B + __ cmgt(v25, __ T16B, v26, v27); // cmgt v25.16B, v26.16B, v27.16B __ cmgt(v24, __ T4H, v25, v26); // cmgt v24.4H, v25.4H, v26.4H - __ cmgt(v4, __ T8H, v5, v6); // cmgt v4.8H, v5.8H, v6.8H - __ cmgt(v3, __ T2S, v4, v5); // cmgt v3.2S, v4.2S, v5.2S - __ cmgt(v8, __ T4S, v9, v10); // cmgt v8.4S, v9.4S, v10.4S - __ cmgt(v22, __ T2D, v23, v24); // cmgt v22.2D, v23.2D, v24.2D - __ fcmgt(v17, __ T2S, v18, v19); // fcmgt v17.2S, v18.2S, v19.2S - __ fcmgt(v13, __ T4S, v14, v15); // fcmgt v13.4S, v14.4S, v15.4S - __ fcmgt(v4, __ T2D, v5, v6); // fcmgt v4.2D, v5.2D, v6.2D - __ cmge(v28, __ T8B, v29, v30); // cmge v28.8B, v29.8B, v30.8B - __ cmge(v23, __ T16B, v24, v25); // cmge v23.16B, v24.16B, v25.16B - __ cmge(v21, __ T4H, v22, v23); // cmge v21.4H, v22.4H, v23.4H - __ cmge(v25, __ T8H, v26, v27); // cmge v25.8H, v26.8H, v27.8H - __ cmge(v24, __ T2S, v25, v26); // cmge v24.2S, v25.2S, v26.2S - __ cmge(v3, __ T4S, v4, v5); // cmge v3.4S, v4.4S, v5.4S - __ cmge(v23, __ T2D, v24, v25); // cmge v23.2D, v24.2D, v25.2D - __ fcmge(v26, __ T2S, v27, v28); // fcmge v26.2S, v27.2S, v28.2S - __ fcmge(v23, __ T4S, v24, v25); // fcmge v23.4S, v24.4S, v25.4S - __ fcmge(v14, __ T2D, v15, v16); // fcmge v14.2D, v15.2D, v16.2D + __ cmgt(v3, __ T8H, v4, v5); // cmgt v3.8H, v4.8H, v5.8H + __ cmgt(v23, __ T2S, v24, v25); // cmgt v23.2S, v24.2S, v25.2S + __ cmgt(v26, __ T4S, v27, v28); // cmgt v26.4S, v27.4S, v28.4S + __ cmgt(v23, __ T2D, v24, v25); // cmgt v23.2D, v24.2D, v25.2D + __ fcmgt(v14, __ T2S, v15, v16); // fcmgt v14.2S, v15.2S, v16.2S + __ fcmgt(v21, __ T4S, v22, v23); // fcmgt v21.4S, v22.4S, v23.4S + __ fcmgt(v3, __ T2D, v4, v5); // fcmgt v3.2D, v4.2D, v5.2D + __ cmge(v23, __ T8B, v24, v25); // cmge v23.8B, v24.8B, v25.8B + __ cmge(v8, __ T16B, v9, v10); // cmge v8.16B, v9.16B, v10.16B + __ cmge(v24, __ T4H, v25, v26); // cmge v24.4H, v25.4H, v26.4H + __ cmge(v19, __ T8H, v20, v21); // cmge v19.8H, v20.8H, v21.8H + __ cmge(v15, __ T2S, v16, v17); // cmge v15.2S, v16.2S, v17.2S + __ cmge(v16, __ T4S, v17, v18); // cmge v16.4S, v17.4S, v18.4S + __ cmge(v2, __ T2D, v3, v4); // cmge v2.2D, v3.2D, v4.2D + __ fcmge(v1, __ T2S, v2, v3); // fcmge v1.2S, v2.2S, v3.2S + __ fcmge(v0, __ T4S, v1, v2); // fcmge v0.4S, v1.4S, v2.4S + __ fcmge(v24, __ T2D, v25, v26); // fcmge v24.2D, v25.2D, v26.2D // SpecialCases __ ccmn(zr, zr, 3u, Assembler::LE); // ccmn xzr, xzr, #3, LE @@ -767,156 +779,156 @@ __ fmovd(v0, -1.0625); // fmov d0, #-1.0625 // LSEOp - __ swp(Assembler::xword, r21, r3, r24); // swp x21, x3, [x24] - __ ldadd(Assembler::xword, r8, r25, r20); // ldadd x8, x25, [x20] - __ ldbic(Assembler::xword, r16, r17, r2); // ldclr x16, x17, [x2] - __ ldeor(Assembler::xword, r1, r0, r24); // ldeor x1, x0, [x24] - __ ldorr(Assembler::xword, r4, r3, r12); // ldset x4, x3, [x12] - __ ldsmin(Assembler::xword, zr, r28, r10); // ldsmin xzr, x28, [x10] - __ ldsmax(Assembler::xword, r26, r2, r12); // ldsmax x26, x2, [x12] - __ ldumin(Assembler::xword, r16, zr, r1); // ldumin x16, xzr, [x1] - __ ldumax(Assembler::xword, r13, r29, r0); // ldumax x13, x29, [x0] + __ swp(Assembler::xword, r4, r3, r12); // swp x4, x3, [x12] + __ ldadd(Assembler::xword, zr, r28, r10); // ldadd xzr, x28, [x10] + __ ldbic(Assembler::xword, r26, r2, r12); // ldclr x26, x2, [x12] + __ ldeor(Assembler::xword, r16, zr, r1); // ldeor x16, xzr, [x1] + __ ldorr(Assembler::xword, r13, r29, r0); // ldset x13, x29, [x0] + __ ldsmin(Assembler::xword, r19, r12, r17); // ldsmin x19, x12, [x17] + __ ldsmax(Assembler::xword, r22, r13, r28); // ldsmax x22, x13, [x28] + __ ldumin(Assembler::xword, r30, zr, r1); // ldumin x30, xzr, [x1] + __ ldumax(Assembler::xword, r26, r28, r4); // ldumax x26, x28, [x4] // LSEOp - __ swpa(Assembler::xword, r19, r12, r17); // swpa x19, x12, [x17] - __ ldadda(Assembler::xword, r22, r13, r28); // ldadda x22, x13, [x28] - __ ldbica(Assembler::xword, r30, zr, r1); // ldclra x30, xzr, [x1] - __ ldeora(Assembler::xword, r26, r28, r4); // ldeora x26, x28, [x4] - __ ldorra(Assembler::xword, r30, r4, r6); // ldseta x30, x4, [x6] - __ ldsmina(Assembler::xword, r30, r26, r15); // ldsmina x30, x26, [x15] - __ ldsmaxa(Assembler::xword, r9, r8, r12); // ldsmaxa x9, x8, [x12] - __ ldumina(Assembler::xword, r0, r20, r1); // ldumina x0, x20, [x1] - __ ldumaxa(Assembler::xword, r24, r2, r0); // ldumaxa x24, x2, [x0] + __ swpa(Assembler::xword, r30, r4, r6); // swpa x30, x4, [x6] + __ ldadda(Assembler::xword, r30, r26, r15); // ldadda x30, x26, [x15] + __ ldbica(Assembler::xword, r9, r8, r12); // ldclra x9, x8, [x12] + __ ldeora(Assembler::xword, r0, r20, r1); // ldeora x0, x20, [x1] + __ ldorra(Assembler::xword, r24, r2, r0); // ldseta x24, x2, [x0] + __ ldsmina(Assembler::xword, r9, r24, r26); // ldsmina x9, x24, [x26] + __ ldsmaxa(Assembler::xword, r16, r30, r3); // ldsmaxa x16, x30, [x3] + __ ldumina(Assembler::xword, r10, r23, r10); // ldumina x10, x23, [x10] + __ ldumaxa(Assembler::xword, r4, r16, r2); // ldumaxa x4, x16, [x2] // LSEOp - __ swpal(Assembler::xword, r9, r24, r26); // swpal x9, x24, [x26] - __ ldaddal(Assembler::xword, r16, r30, r3); // ldaddal x16, x30, [x3] - __ ldbical(Assembler::xword, r10, r23, r10); // ldclral x10, x23, [x10] - __ ldeoral(Assembler::xword, r4, r16, r2); // ldeoral x4, x16, [x2] - __ ldorral(Assembler::xword, r11, r8, r10); // ldsetal x11, x8, [x10] - __ ldsminal(Assembler::xword, r15, r17, r2); // ldsminal x15, x17, [x2] - __ ldsmaxal(Assembler::xword, r10, r12, r12); // ldsmaxal x10, x12, [x12] - __ lduminal(Assembler::xword, r15, r13, r2); // lduminal x15, x13, [x2] - __ ldumaxal(Assembler::xword, r7, r20, r26); // ldumaxal x7, x20, [x26] + __ swpal(Assembler::xword, r11, r8, r10); // swpal x11, x8, [x10] + __ ldaddal(Assembler::xword, r15, r17, r2); // ldaddal x15, x17, [x2] + __ ldbical(Assembler::xword, r10, r12, r12); // ldclral x10, x12, [x12] + __ ldeoral(Assembler::xword, r15, r13, r2); // ldeoral x15, x13, [x2] + __ ldorral(Assembler::xword, r7, r20, r26); // ldsetal x7, x20, [x26] + __ ldsminal(Assembler::xword, r16, r4, r2); // ldsminal x16, x4, [x2] + __ ldsmaxal(Assembler::xword, r4, r12, r15); // ldsmaxal x4, x12, [x15] + __ lduminal(Assembler::xword, r21, r16, r15); // lduminal x21, x16, [x15] + __ ldumaxal(Assembler::xword, r11, r21, r23); // ldumaxal x11, x21, [x23] // LSEOp - __ swpl(Assembler::xword, r16, r4, r2); // swpl x16, x4, [x2] - __ ldaddl(Assembler::xword, r4, r12, r15); // ldaddl x4, x12, [x15] - __ ldbicl(Assembler::xword, r21, r16, r15); // ldclrl x21, x16, [x15] - __ ldeorl(Assembler::xword, r11, r21, r23); // ldeorl x11, x21, [x23] - __ ldorrl(Assembler::xword, r12, r26, r23); // ldsetl x12, x26, [x23] - __ ldsminl(Assembler::xword, r28, r14, r11); // ldsminl x28, x14, [x11] - __ ldsmaxl(Assembler::xword, r24, r1, r12); // ldsmaxl x24, x1, [x12] - __ lduminl(Assembler::xword, zr, r10, r16); // lduminl xzr, x10, [x16] - __ ldumaxl(Assembler::xword, r7, r2, r3); // ldumaxl x7, x2, [x3] + __ swpl(Assembler::xword, r12, r26, r23); // swpl x12, x26, [x23] + __ ldaddl(Assembler::xword, r28, r14, r11); // ldaddl x28, x14, [x11] + __ ldbicl(Assembler::xword, r24, r1, r12); // ldclrl x24, x1, [x12] + __ ldeorl(Assembler::xword, zr, r10, r16); // ldeorl xzr, x10, [x16] + __ ldorrl(Assembler::xword, r7, r2, r3); // ldsetl x7, x2, [x3] + __ ldsminl(Assembler::xword, r13, r19, r17); // ldsminl x13, x19, [x17] + __ ldsmaxl(Assembler::xword, r16, r3, r1); // ldsmaxl x16, x3, [x1] + __ lduminl(Assembler::xword, r11, r30, r5); // lduminl x11, x30, [x5] + __ ldumaxl(Assembler::xword, r8, r15, r29); // ldumaxl x8, x15, [x29] // LSEOp - __ swp(Assembler::word, r13, r19, r17); // swp w13, w19, [x17] - __ ldadd(Assembler::word, r16, r3, r1); // ldadd w16, w3, [x1] - __ ldbic(Assembler::word, r11, r30, r5); // ldclr w11, w30, [x5] - __ ldeor(Assembler::word, r8, r15, r29); // ldeor w8, w15, [x29] - __ ldorr(Assembler::word, r30, r0, r20); // ldset w30, w0, [x20] - __ ldsmin(Assembler::word, r7, r20, r23); // ldsmin w7, w20, [x23] - __ ldsmax(Assembler::word, r28, r21, r27); // ldsmax w28, w21, [x27] - __ ldumin(Assembler::word, r25, r5, r1); // ldumin w25, w5, [x1] - __ ldumax(Assembler::word, r23, r16, sp); // ldumax w23, w16, [sp] + __ swp(Assembler::word, r30, r0, r20); // swp w30, w0, [x20] + __ ldadd(Assembler::word, r7, r20, r23); // ldadd w7, w20, [x23] + __ ldbic(Assembler::word, r28, r21, r27); // ldclr w28, w21, [x27] + __ ldeor(Assembler::word, r25, r5, r1); // ldeor w25, w5, [x1] + __ ldorr(Assembler::word, r23, r16, sp); // ldset w23, w16, [sp] + __ ldsmin(Assembler::word, r5, r12, r9); // ldsmin w5, w12, [x9] + __ ldsmax(Assembler::word, r28, r15, r29); // ldsmax w28, w15, [x29] + __ ldumin(Assembler::word, r22, zr, r19); // ldumin w22, wzr, [x19] + __ ldumax(Assembler::word, zr, r5, r14); // ldumax wzr, w5, [x14] // LSEOp - __ swpa(Assembler::word, r5, r12, r9); // swpa w5, w12, [x9] - __ ldadda(Assembler::word, r28, r15, r29); // ldadda w28, w15, [x29] - __ ldbica(Assembler::word, r22, zr, r19); // ldclra w22, wzr, [x19] - __ ldeora(Assembler::word, zr, r5, r14); // ldeora wzr, w5, [x14] - __ ldorra(Assembler::word, r16, zr, r15); // ldseta w16, wzr, [x15] - __ ldsmina(Assembler::word, r27, r20, r16); // ldsmina w27, w20, [x16] - __ ldsmaxa(Assembler::word, r12, r11, r9); // ldsmaxa w12, w11, [x9] - __ ldumina(Assembler::word, r6, r30, r17); // ldumina w6, w30, [x17] - __ ldumaxa(Assembler::word, r27, r28, r30); // ldumaxa w27, w28, [x30] + __ swpa(Assembler::word, r16, zr, r15); // swpa w16, wzr, [x15] + __ ldadda(Assembler::word, r27, r20, r16); // ldadda w27, w20, [x16] + __ ldbica(Assembler::word, r12, r11, r9); // ldclra w12, w11, [x9] + __ ldeora(Assembler::word, r6, r30, r17); // ldeora w6, w30, [x17] + __ ldorra(Assembler::word, r27, r28, r30); // ldseta w27, w28, [x30] + __ ldsmina(Assembler::word, r7, r10, r20); // ldsmina w7, w10, [x20] + __ ldsmaxa(Assembler::word, r10, r4, r24); // ldsmaxa w10, w4, [x24] + __ ldumina(Assembler::word, r17, r17, r22); // ldumina w17, w17, [x22] + __ ldumaxa(Assembler::word, r3, r29, r15); // ldumaxa w3, w29, [x15] // LSEOp - __ swpal(Assembler::word, r7, r10, r20); // swpal w7, w10, [x20] - __ ldaddal(Assembler::word, r10, r4, r24); // ldaddal w10, w4, [x24] - __ ldbical(Assembler::word, r17, r17, r22); // ldclral w17, w17, [x22] - __ ldeoral(Assembler::word, r3, r29, r15); // ldeoral w3, w29, [x15] - __ ldorral(Assembler::word, r22, r19, r19); // ldsetal w22, w19, [x19] - __ ldsminal(Assembler::word, r22, r2, r15); // ldsminal w22, w2, [x15] - __ ldsmaxal(Assembler::word, r6, r12, r16); // ldsmaxal w6, w12, [x16] - __ lduminal(Assembler::word, r11, r13, r23); // lduminal w11, w13, [x23] - __ ldumaxal(Assembler::word, r1, r30, r19); // ldumaxal w1, w30, [x19] + __ swpal(Assembler::word, r22, r19, r19); // swpal w22, w19, [x19] + __ ldaddal(Assembler::word, r22, r2, r15); // ldaddal w22, w2, [x15] + __ ldbical(Assembler::word, r6, r12, r16); // ldclral w6, w12, [x16] + __ ldeoral(Assembler::word, r11, r13, r23); // ldeoral w11, w13, [x23] + __ ldorral(Assembler::word, r1, r30, r19); // ldsetal w1, w30, [x19] + __ ldsminal(Assembler::word, r5, r17, r2); // ldsminal w5, w17, [x2] + __ ldsmaxal(Assembler::word, r16, r22, r13); // ldsmaxal w16, w22, [x13] + __ lduminal(Assembler::word, r10, r21, r29); // lduminal w10, w21, [x29] + __ ldumaxal(Assembler::word, r27, r12, r27); // ldumaxal w27, w12, [x27] // LSEOp - __ swpl(Assembler::word, r5, r17, r2); // swpl w5, w17, [x2] - __ ldaddl(Assembler::word, r16, r22, r13); // ldaddl w16, w22, [x13] - __ ldbicl(Assembler::word, r10, r21, r29); // ldclrl w10, w21, [x29] - __ ldeorl(Assembler::word, r27, r12, r27); // ldeorl w27, w12, [x27] - __ ldorrl(Assembler::word, r3, r1, sp); // ldsetl w3, w1, [sp] - __ ldsminl(Assembler::word, r24, r19, r17); // ldsminl w24, w19, [x17] - __ ldsmaxl(Assembler::word, r9, r28, r27); // ldsmaxl w9, w28, [x27] - __ lduminl(Assembler::word, r15, r7, r21); // lduminl w15, w7, [x21] - __ ldumaxl(Assembler::word, r23, zr, r25); // ldumaxl w23, wzr, [x25] + __ swpl(Assembler::word, r3, r1, sp); // swpl w3, w1, [sp] + __ ldaddl(Assembler::word, r24, r19, r17); // ldaddl w24, w19, [x17] + __ ldbicl(Assembler::word, r9, r28, r27); // ldclrl w9, w28, [x27] + __ ldeorl(Assembler::word, r15, r7, r21); // ldeorl w15, w7, [x21] + __ ldorrl(Assembler::word, r23, zr, r25); // ldsetl w23, wzr, [x25] + __ ldsminl(Assembler::word, r2, zr, r27); // ldsminl w2, wzr, [x27] + __ ldsmaxl(Assembler::word, r16, r10, r23); // ldsmaxl w16, w10, [x23] + __ lduminl(Assembler::word, r19, r3, r15); // lduminl w19, w3, [x15] + __ ldumaxl(Assembler::word, r0, r25, r26); // ldumaxl w0, w25, [x26] // SHA3SIMDOp - __ bcax(v2, __ T16B, v30, v26, v17); // bcax v2.16B, v30.16B, v26.16B, v17.16B - __ eor3(v10, __ T16B, v22, v17, v2); // eor3 v10.16B, v22.16B, v17.16B, v2.16B - __ rax1(v17, __ T2D, v0, v24); // rax1 v17.2D, v0.2D, v24.2D - __ xar(v25, __ T2D, v22, v2, 37); // xar v25.2D, v22.2D, v2.2D, #37 + __ bcax(v22, __ T16B, v2, v17, v12); // bcax v22.16B, v2.16B, v17.16B, v12.16B + __ eor3(v3, __ T16B, v27, v29, v28); // eor3 v3.16B, v27.16B, v29.16B, v28.16B + __ rax1(v16, __ T2D, v26, v6); // rax1 v16.2D, v26.2D, v6.2D + __ xar(v9, __ T2D, v28, v17, 14); // xar v9.2D, v28.2D, v17.2D, #14 // SHA512SIMDOp - __ sha512h(v12, __ T2D, v3, v27); // sha512h q12, q3, v27.2D - __ sha512h2(v29, __ T2D, v28, v16); // sha512h2 q29, q28, v16.2D - __ sha512su0(v26, __ T2D, v6); // sha512su0 v26.2D, v6.2D - __ sha512su1(v9, __ T2D, v28, v17); // sha512su1 v9.2D, v28.2D, v17.2D + __ sha512h(v4, __ T2D, v7, v15); // sha512h q4, q7, v15.2D + __ sha512h2(v9, __ T2D, v22, v8); // sha512h2 q9, q22, v8.2D + __ sha512su0(v2, __ T2D, v27); // sha512su0 v2.2D, v27.2D + __ sha512su1(v20, __ T2D, v30, v5); // sha512su1 v20.2D, v30.2D, v5.2D // SVEVectorOp - __ sve_add(z7, __ H, z4, z7); // add z7.h, z4.h, z7.h - __ sve_sub(z9, __ B, z22, z8); // sub z9.b, z22.b, z8.b - __ sve_fadd(z27, __ S, z20, z30); // fadd z27.s, z20.s, z30.s - __ sve_fmul(z26, __ S, z0, z16); // fmul z26.s, z0.s, z16.s - __ sve_fsub(z3, __ D, z25, z8); // fsub z3.d, z25.d, z8.d - __ sve_abs(z21, __ D, p6, z26); // abs z21.d, p6/m, z26.d - __ sve_add(z22, __ B, p0, z4); // add z22.b, p0/m, z22.b, z4.b - __ sve_asr(z17, __ H, p0, z3); // asr z17.h, p0/m, z17.h, z3.h - __ sve_cnt(z1, __ B, p2, z6); // cnt z1.b, p2/m, z6.b - __ sve_lsl(z9, __ S, p7, z7); // lsl z9.s, p7/m, z9.s, z7.s - __ sve_lsr(z22, __ H, p5, z5); // lsr z22.h, p5/m, z22.h, z5.h - __ sve_mul(z8, __ B, p4, z30); // mul z8.b, p4/m, z8.b, z30.b - __ sve_neg(z17, __ D, p0, z11); // neg z17.d, p0/m, z11.d - __ sve_not(z28, __ S, p0, z26); // not z28.s, p0/m, z26.s - __ sve_smax(z28, __ D, p3, z13); // smax z28.d, p3/m, z28.d, z13.d - __ sve_smin(z16, __ B, p6, z5); // smin z16.b, p6/m, z16.b, z5.b - __ sve_sub(z13, __ H, p2, z15); // sub z13.h, p2/m, z13.h, z15.h - __ sve_fabs(z26, __ S, p5, z11); // fabs z26.s, p5/m, z11.s - __ sve_fadd(z22, __ S, p4, z4); // fadd z22.s, p4/m, z22.s, z4.s - __ sve_fdiv(z19, __ S, p4, z17); // fdiv z19.s, p4/m, z19.s, z17.s - __ sve_fmax(z14, __ D, p3, z2); // fmax z14.d, p3/m, z14.d, z2.d - __ sve_fmin(z3, __ S, p5, z23); // fmin z3.s, p5/m, z3.s, z23.s - __ sve_fmul(z6, __ S, p1, z17); // fmul z6.s, p1/m, z6.s, z17.s - __ sve_fneg(z27, __ S, p4, z16); // fneg z27.s, p4/m, z16.s - __ sve_frintm(z2, __ S, p7, z3); // frintm z2.s, p7/m, z3.s - __ sve_frintn(z6, __ S, p4, z19); // frintn z6.s, p4/m, z19.s - __ sve_frintp(z12, __ D, p5, z8); // frintp z12.d, p5/m, z8.d - __ sve_fsqrt(z19, __ S, p4, z0); // fsqrt z19.s, p4/m, z0.s - __ sve_fsub(z23, __ D, p1, z19); // fsub z23.d, p1/m, z23.d, z19.d - __ sve_fmla(z13, __ S, p4, z6, z0); // fmla z13.s, p4/m, z6.s, z0.s - __ sve_fmls(z14, __ S, p4, z25, z8); // fmls z14.s, p4/m, z25.s, z8.s - __ sve_fnmla(z22, __ S, p5, z22, z27); // fnmla z22.s, p5/m, z22.s, z27.s - __ sve_fnmls(z3, __ S, p3, z17, z20); // fnmls z3.s, p3/m, z17.s, z20.s - __ sve_mla(z4, __ H, p7, z7, z0); // mla z4.h, p7/m, z7.h, z0.h - __ sve_mls(z16, __ S, p5, z22, z4); // mls z16.s, p5/m, z22.s, z4.s - __ sve_and(z9, z22, z11); // and z9.d, z22.d, z11.d - __ sve_eor(z5, z30, z16); // eor z5.d, z30.d, z16.d - __ sve_orr(z22, z11, z1); // orr z22.d, z11.d, z1.d - __ sve_bic(z8, z20, z16); // bic z8.d, z20.d, z16.d + __ sve_add(z26, __ H, z0, z16); // add z26.h, z0.h, z16.h + __ sve_sub(z3, __ D, z25, z8); // sub z3.d, z25.d, z8.d + __ sve_fadd(z21, __ D, z26, z26); // fadd z21.d, z26.d, z26.d + __ sve_fmul(z22, __ S, z0, z4); // fmul z22.s, z0.s, z4.s + __ sve_fsub(z17, __ S, z0, z3); // fsub z17.s, z0.s, z3.s + __ sve_abs(z1, __ B, p2, z6); // abs z1.b, p2/m, z6.b + __ sve_add(z9, __ S, p7, z7); // add z9.s, p7/m, z9.s, z7.s + __ sve_asr(z22, __ H, p5, z5); // asr z22.h, p5/m, z22.h, z5.h + __ sve_cnt(z8, __ B, p4, z30); // cnt z8.b, p4/m, z30.b + __ sve_lsl(z17, __ D, p0, z11); // lsl z17.d, p0/m, z17.d, z11.d + __ sve_lsr(z28, __ S, p0, z26); // lsr z28.s, p0/m, z28.s, z26.s + __ sve_mul(z28, __ D, p3, z13); // mul z28.d, p3/m, z28.d, z13.d + __ sve_neg(z16, __ B, p6, z5); // neg z16.b, p6/m, z5.b + __ sve_not(z13, __ H, p2, z15); // not z13.h, p2/m, z15.h + __ sve_smax(z26, __ B, p5, z11); // smax z26.b, p5/m, z26.b, z11.b + __ sve_smin(z22, __ B, p4, z4); // smin z22.b, p4/m, z22.b, z4.b + __ sve_sub(z19, __ H, p4, z17); // sub z19.h, p4/m, z19.h, z17.h + __ sve_fabs(z14, __ D, p3, z2); // fabs z14.d, p3/m, z2.d + __ sve_fadd(z3, __ S, p5, z23); // fadd z3.s, p5/m, z3.s, z23.s + __ sve_fdiv(z6, __ S, p1, z17); // fdiv z6.s, p1/m, z6.s, z17.s + __ sve_fmax(z27, __ S, p4, z16); // fmax z27.s, p4/m, z27.s, z16.s + __ sve_fmin(z2, __ S, p7, z3); // fmin z2.s, p7/m, z2.s, z3.s + __ sve_fmul(z6, __ S, p4, z19); // fmul z6.s, p4/m, z6.s, z19.s + __ sve_fneg(z12, __ D, p5, z8); // fneg z12.d, p5/m, z8.d + __ sve_frintm(z19, __ S, p4, z0); // frintm z19.s, p4/m, z0.s + __ sve_frintn(z23, __ D, p1, z19); // frintn z23.d, p1/m, z19.d + __ sve_frintp(z13, __ S, p4, z6); // frintp z13.s, p4/m, z6.s + __ sve_fsqrt(z7, __ D, p3, z17); // fsqrt z7.d, p3/m, z17.d + __ sve_fsub(z8, __ D, p2, z22); // fsub z8.d, p2/m, z8.d, z22.d + __ sve_fmla(z22, __ S, p7, z2, z3); // fmla z22.s, p7/m, z2.s, z3.s + __ sve_fmls(z17, __ D, p5, z7, z4); // fmls z17.d, p5/m, z7.d, z4.d + __ sve_fnmla(z7, __ D, p0, z8, z16); // fnmla z7.d, p0/m, z8.d, z16.d + __ sve_fnmls(z22, __ D, p1, z15, z9); // fnmls z22.d, p1/m, z15.d, z9.d + __ sve_mla(z11, __ S, p6, z5, z30); // mla z11.s, p6/m, z5.s, z30.s + __ sve_mls(z13, __ H, p5, z11, z1); // mls z13.h, p5/m, z11.h, z1.h + __ sve_and(z8, z20, z16); // and z8.d, z20.d, z16.d + __ sve_eor(z15, z4, z4); // eor z15.d, z4.d, z4.d + __ sve_orr(z8, z6, z29); // orr z8.d, z6.d, z29.d + __ sve_bic(z28, z16, z29); // bic z28.d, z16.d, z29.d // SVEReductionOp - __ sve_andv(v15, __ S, p1, z4); // andv s15, p1, z4.s - __ sve_orv(v8, __ B, p1, z29); // orv b8, p1, z29.b - __ sve_eorv(v28, __ D, p4, z29); // eorv d28, p4, z29.d - __ sve_smaxv(v9, __ H, p3, z2); // smaxv h9, p3, z2.h - __ sve_sminv(v28, __ B, p0, z7); // sminv b28, p0, z7.b - __ sve_fminv(v26, __ S, p5, z17); // fminv s26, p5, z17.s - __ sve_fmaxv(v8, __ D, p4, z21); // fmaxv d8, p4, z21.d - __ sve_fadda(v5, __ D, p5, z21); // fadda d5, p5, d5, z21.d - __ sve_uaddv(v22, __ S, p4, z29); // uaddv d22, p4, z29.s + __ sve_andv(v9, __ H, p3, z2); // andv h9, p3, z2.h + __ sve_orv(v28, __ B, p0, z7); // orv b28, p0, z7.b + __ sve_eorv(v26, __ H, p5, z17); // eorv h26, p5, z17.h + __ sve_smaxv(v8, __ D, p4, z21); // smaxv d8, p4, z21.d + __ sve_sminv(v5, __ S, p5, z21); // sminv s5, p5, z21.s + __ sve_fminv(v22, __ D, p4, z29); // fminv d22, p4, z29.d + __ sve_fmaxv(v19, __ D, p0, z4); // fmaxv d19, p0, z4.d + __ sve_fadda(v23, __ S, p1, z19); // fadda s23, p1, s23, z19.s + __ sve_uaddv(v23, __ B, p6, z19); // uaddv d23, p6, z19.b __ bind(forth); @@ -935,30 +947,30 @@ 0x9101a1a0, 0xb10a5cc8, 0xd10810aa, 0xf10fd061, 0x120cb166, 0x321764bc, 0x52174681, 0x720c0227, 0x9241018e, 0xb25a2969, 0xd278b411, 0xf26aad01, - 0x14000000, 0x17ffffd7, 0x140002e1, 0x94000000, - 0x97ffffd4, 0x940002de, 0x3400000a, 0x34fffa2a, - 0x34005b6a, 0x35000008, 0x35fff9c8, 0x35005b08, - 0xb400000b, 0xb4fff96b, 0xb4005aab, 0xb500001d, - 0xb5fff91d, 0xb5005a5d, 0x10000013, 0x10fff8b3, - 0x100059f3, 0x90000013, 0x36300016, 0x3637f836, - 0x36305976, 0x3758000c, 0x375ff7cc, 0x3758590c, + 0x14000000, 0x17ffffd7, 0x140002ed, 0x94000000, + 0x97ffffd4, 0x940002ea, 0x3400000a, 0x34fffa2a, + 0x34005cea, 0x35000008, 0x35fff9c8, 0x35005c88, + 0xb400000b, 0xb4fff96b, 0xb4005c2b, 0xb500001d, + 0xb5fff91d, 0xb5005bdd, 0x10000013, 0x10fff8b3, + 0x10005b73, 0x90000013, 0x36300016, 0x3637f836, + 0x36305af6, 0x3758000c, 0x375ff7cc, 0x37585a8c, 0x128313a0, 0x528a32c7, 0x7289173b, 0x92ab3acc, 0xd2a0bf94, 0xf2c285e8, 0x9358722f, 0x330e652f, 0x53067f3b, 0x93577c53, 0xb34a1aac, 0xd35a4016, 0x13946c63, 0x93c3dbc8, 0x54000000, 0x54fff5a0, - 0x540056e0, 0x54000001, 0x54fff541, 0x54005681, - 0x54000002, 0x54fff4e2, 0x54005622, 0x54000002, - 0x54fff482, 0x540055c2, 0x54000003, 0x54fff423, - 0x54005563, 0x54000003, 0x54fff3c3, 0x54005503, - 0x54000004, 0x54fff364, 0x540054a4, 0x54000005, - 0x54fff305, 0x54005445, 0x54000006, 0x54fff2a6, - 0x540053e6, 0x54000007, 0x54fff247, 0x54005387, - 0x54000008, 0x54fff1e8, 0x54005328, 0x54000009, - 0x54fff189, 0x540052c9, 0x5400000a, 0x54fff12a, - 0x5400526a, 0x5400000b, 0x54fff0cb, 0x5400520b, - 0x5400000c, 0x54fff06c, 0x540051ac, 0x5400000d, - 0x54fff00d, 0x5400514d, 0x5400000e, 0x54ffefae, - 0x540050ee, 0x5400000f, 0x54ffef4f, 0x5400508f, + 0x54005860, 0x54000001, 0x54fff541, 0x54005801, + 0x54000002, 0x54fff4e2, 0x540057a2, 0x54000002, + 0x54fff482, 0x54005742, 0x54000003, 0x54fff423, + 0x540056e3, 0x54000003, 0x54fff3c3, 0x54005683, + 0x54000004, 0x54fff364, 0x54005624, 0x54000005, + 0x54fff305, 0x540055c5, 0x54000006, 0x54fff2a6, + 0x54005566, 0x54000007, 0x54fff247, 0x54005507, + 0x54000008, 0x54fff1e8, 0x540054a8, 0x54000009, + 0x54fff189, 0x54005449, 0x5400000a, 0x54fff12a, + 0x540053ea, 0x5400000b, 0x54fff0cb, 0x5400538b, + 0x5400000c, 0x54fff06c, 0x5400532c, 0x5400000d, + 0x54fff00d, 0x540052cd, 0x5400000e, 0x54ffefae, + 0x5400526e, 0x5400000f, 0x54ffef4f, 0x5400520f, 0xd40658e1, 0xd4014d22, 0xd4046543, 0xd4273f60, 0xd44cad80, 0xd503201f, 0xd69f03e0, 0xd6bf03e0, 0xd5033fdf, 0xd5033e9f, 0xd50332bf, 0xd61f0200, @@ -990,7 +1002,7 @@ 0x791f226d, 0xf95aa2f3, 0xb9587bb7, 0x395f7176, 0x795d9143, 0x399e7e08, 0x799a2697, 0x79df3422, 0xb99c2624, 0xfd5c2374, 0xbd5fa1d9, 0xfd1d595a, - 0xbd1b1869, 0x580040db, 0x1800000b, 0xf8945060, + 0xbd1b1869, 0x5800425b, 0x1800000b, 0xf8945060, 0xd8000000, 0xf8ae6ba0, 0xf99a0080, 0x1a070035, 0x3a0700a8, 0x5a0e0367, 0x7a11009b, 0x9a000380, 0xba1e030c, 0xda0f0320, 0xfa030301, 0x0b340b11, @@ -1055,17 +1067,20 @@ 0x2eb99717, 0x6ea29420, 0x0eb2ce30, 0x4eaccd6a, 0x4ee8cce6, 0x2e3effbc, 0x6e28fce6, 0x6e67fcc5, 0x0e2764c5, 0x4e3666b4, 0x0e736651, 0x4e71660f, - 0x0eb36651, 0x4ebf67dd, 0x0e3cf77a, 0x4e3ef7bc, - 0x4e63f441, 0x0e3d6f9b, 0x4e226c20, 0x0e766eb4, - 0x4e7e6fbc, 0x0eb16e0f, 0x4eae6dac, 0x0eacf56a, - 0x4ebef7bc, 0x4efef7bc, 0x2e358e93, 0x6e388ef6, - 0x2e6c8d6a, 0x6e668ca4, 0x2ea08ffe, 0x6eb68eb4, - 0x6eea8d28, 0x0e20e7fe, 0x4e33e651, 0x4e6ce56a, - 0x0e3d379b, 0x4e243462, 0x0e7a3738, 0x4e6634a4, - 0x0ea53483, 0x4eaa3528, 0x4ef836f6, 0x2eb3e651, - 0x6eafe5cd, 0x6ee6e4a4, 0x0e3e3fbc, 0x4e393f17, - 0x0e773ed5, 0x4e7b3f59, 0x0eba3f38, 0x4ea53c83, - 0x4ef93f17, 0x2e3ce77a, 0x6e39e717, 0x6e70e5ee, + 0x0eb36651, 0x4ebf67dd, 0x0e3ca77a, 0x4e3ea7bc, + 0x0e63a441, 0x4e7da79b, 0x0ea2a420, 0x4eb6a6b4, + 0x0e3ef7bc, 0x4e31f60f, 0x4e6ef5ac, 0x0e2c6d6a, + 0x4e3e6fbc, 0x0e7e6fbc, 0x4e756e93, 0x0eb86ef6, + 0x4eac6d6a, 0x0e26aca4, 0x4e20affe, 0x0e76aeb4, + 0x4e6aad28, 0x0ea0affe, 0x4eb3ae51, 0x0eacf56a, + 0x4ebdf79b, 0x4ee4f462, 0x2e3a8f38, 0x6e268ca4, + 0x2e658c83, 0x6e6a8d28, 0x2eb88ef6, 0x6eb38e51, + 0x6eef8dcd, 0x0e26e4a4, 0x4e3ee7bc, 0x4e79e717, + 0x0e3736d5, 0x4e3b3759, 0x0e7a3738, 0x4e653483, + 0x0eb93717, 0x4ebc377a, 0x4ef93717, 0x2eb0e5ee, + 0x6eb7e6d5, 0x6ee5e483, 0x0e393f17, 0x4e2a3d28, + 0x0e7a3f38, 0x4e753e93, 0x0eb13e0f, 0x4eb23e30, + 0x4ee43c62, 0x2e23e441, 0x6e22e420, 0x6e7ae738, 0xba5fd3e3, 0x3a5f03e5, 0xfa411be4, 0x7a42cbe2, 0x93df03ff, 0xc820ffff, 0x8822fc7f, 0xc8247cbf, 0x88267fff, 0x4e010fe0, 0x4e081fe1, 0x4e0c1fe1, @@ -1087,38 +1102,38 @@ 0x1e703000, 0x1e721000, 0x1e723000, 0x1e741000, 0x1e743000, 0x1e761000, 0x1e763000, 0x1e781000, 0x1e783000, 0x1e7a1000, 0x1e7a3000, 0x1e7c1000, - 0x1e7c3000, 0x1e7e1000, 0x1e7e3000, 0xf8358303, - 0xf8280299, 0xf8301051, 0xf8212300, 0xf8243183, - 0xf83f515c, 0xf83a4182, 0xf830703f, 0xf82d601d, - 0xf8b3822c, 0xf8b6038d, 0xf8be103f, 0xf8ba209c, - 0xf8be30c4, 0xf8be51fa, 0xf8a94188, 0xf8a07034, - 0xf8b86002, 0xf8e98358, 0xf8f0007e, 0xf8ea1157, - 0xf8e42050, 0xf8eb3148, 0xf8ef5051, 0xf8ea418c, - 0xf8ef704d, 0xf8e76354, 0xf8708044, 0xf86401ec, - 0xf87511f0, 0xf86b22f5, 0xf86c32fa, 0xf87c516e, - 0xf8784181, 0xf87f720a, 0xf8676062, 0xb82d8233, - 0xb8300023, 0xb82b10be, 0xb82823af, 0xb83e3280, - 0xb82752f4, 0xb83c4375, 0xb8397025, 0xb83763f0, - 0xb8a5812c, 0xb8bc03af, 0xb8b6127f, 0xb8bf21c5, - 0xb8b031ff, 0xb8bb5214, 0xb8ac412b, 0xb8a6723e, - 0xb8bb63dc, 0xb8e7828a, 0xb8ea0304, 0xb8f112d1, - 0xb8e321fd, 0xb8f63273, 0xb8f651e2, 0xb8e6420c, - 0xb8eb72ed, 0xb8e1627e, 0xb8658051, 0xb87001b6, - 0xb86a13b5, 0xb87b236c, 0xb86333e1, 0xb8785233, - 0xb869437c, 0xb86f72a7, 0xb877633f, 0xce3a47c2, - 0xce110aca, 0xce788c11, 0xce8296d9, 0xce7b806c, - 0xce70879d, 0xcec080da, 0xce718b89, 0x04670087, - 0x042806c9, 0x659e029b, 0x6590081a, 0x65c80723, - 0x04d6bb55, 0x04000096, 0x04508071, 0x041aa8c1, - 0x04939ce9, 0x045194b6, 0x041013c8, 0x04d7a171, - 0x049ea35c, 0x04c80dbc, 0x040a18b0, 0x044109ed, - 0x049cb57a, 0x65809096, 0x658d9233, 0x65c68c4e, - 0x658796e3, 0x65828626, 0x049db21b, 0x6582bc62, - 0x6580b266, 0x65c1b50c, 0x658db013, 0x65c18677, - 0x65a010cd, 0x65a8332e, 0x65bb56d6, 0x65b46e23, - 0x04405ce4, 0x048476d0, 0x042b32c9, 0x04b033c5, - 0x04613176, 0x04f03288, 0x049a248f, 0x041827a8, - 0x04d933bc, 0x04482c49, 0x040a20fc, 0x6587363a, - 0x65c632a8, 0x65d836a5, 0x048133b6, + 0x1e7c3000, 0x1e7e1000, 0x1e7e3000, 0xf8248183, + 0xf83f015c, 0xf83a1182, 0xf830203f, 0xf82d301d, + 0xf833522c, 0xf836438d, 0xf83e703f, 0xf83a609c, + 0xf8be80c4, 0xf8be01fa, 0xf8a91188, 0xf8a02034, + 0xf8b83002, 0xf8a95358, 0xf8b0407e, 0xf8aa7157, + 0xf8a46050, 0xf8eb8148, 0xf8ef0051, 0xf8ea118c, + 0xf8ef204d, 0xf8e73354, 0xf8f05044, 0xf8e441ec, + 0xf8f571f0, 0xf8eb62f5, 0xf86c82fa, 0xf87c016e, + 0xf8781181, 0xf87f220a, 0xf8673062, 0xf86d5233, + 0xf8704023, 0xf86b70be, 0xf86863af, 0xb83e8280, + 0xb82702f4, 0xb83c1375, 0xb8392025, 0xb83733f0, + 0xb825512c, 0xb83c43af, 0xb836727f, 0xb83f61c5, + 0xb8b081ff, 0xb8bb0214, 0xb8ac112b, 0xb8a6223e, + 0xb8bb33dc, 0xb8a7528a, 0xb8aa4304, 0xb8b172d1, + 0xb8a361fd, 0xb8f68273, 0xb8f601e2, 0xb8e6120c, + 0xb8eb22ed, 0xb8e1327e, 0xb8e55051, 0xb8f041b6, + 0xb8ea73b5, 0xb8fb636c, 0xb86383e1, 0xb8780233, + 0xb869137c, 0xb86f22a7, 0xb877333f, 0xb862537f, + 0xb87042ea, 0xb87371e3, 0xb8606359, 0xce313056, + 0xce1d7363, 0xce668f50, 0xce913b89, 0xce6f80e4, + 0xce6886c9, 0xcec08362, 0xce658bd4, 0x0470001a, + 0x04e80723, 0x65da0355, 0x65840816, 0x65830411, + 0x0416a8c1, 0x04801ce9, 0x045094b6, 0x041ab3c8, + 0x04d38171, 0x0491835c, 0x04d00dbc, 0x0417b8b0, + 0x045ea9ed, 0x0408157a, 0x040a1096, 0x04411233, + 0x04dcac4e, 0x658096e3, 0x658d8626, 0x6586921b, + 0x65879c62, 0x65829266, 0x04ddb50c, 0x6582b013, + 0x65c0a677, 0x6581b0cd, 0x65cdae27, 0x65c18ac8, + 0x65a31c56, 0x65e434f1, 0x65f04107, 0x65e965f6, + 0x049e58ab, 0x0441756d, 0x04303288, 0x04a4308f, + 0x047d30c8, 0x04fd321c, 0x045a2c49, 0x041820fc, + 0x0459363a, 0x04c832a8, 0x048a36a5, 0x65c733b6, + 0x65c62093, 0x65982677, 0x04013a77, }; // END Generated code -- do not edit diff --git a/test/hotspot/gtest/logging/logTestFixture.cpp b/test/hotspot/gtest/logging/logTestFixture.cpp index bc153b76fb9..c9d97423097 100644 --- a/test/hotspot/gtest/logging/logTestFixture.cpp +++ b/test/hotspot/gtest/logging/logTestFixture.cpp @@ -46,6 +46,7 @@ LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL } LogTestFixture::~LogTestFixture() { + AsyncLogWriter::flush(); restore_config(); clear_snapshot(); delete_file(TestLogFileName); diff --git a/test/hotspot/gtest/logging/logTestUtils.inline.hpp b/test/hotspot/gtest/logging/logTestUtils.inline.hpp index c1bc288a38d..e7f9f1daf89 100644 --- a/test/hotspot/gtest/logging/logTestUtils.inline.hpp +++ b/test/hotspot/gtest/logging/logTestUtils.inline.hpp @@ -22,6 +22,7 @@ */ #include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" #include "logging/logConfiguration.hpp" #include "logging/logStream.hpp" #include "memory/resourceArea.hpp" @@ -46,6 +47,7 @@ static inline bool file_exists(const char* filename) { } static inline void delete_file(const char* filename) { + AsyncLogWriter::flush(); if (!file_exists(filename)) { return; } @@ -135,6 +137,7 @@ static inline char* read_line(FILE* fp) { } static bool file_contains_substrings_in_order(const char* filename, const char* substrs[]) { + AsyncLogWriter::flush(); FILE* fp = fopen(filename, "r"); assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno)); diff --git a/test/hotspot/gtest/logging/test_asynclog.cpp b/test/hotspot/gtest/logging/test_asynclog.cpp new file mode 100644 index 00000000000..ffabbb524c2 --- /dev/null +++ b/test/hotspot/gtest/logging/test_asynclog.cpp @@ -0,0 +1,216 @@ +/* + * 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. + * + */ +#include "precompiled.hpp" +#include "jvm.h" +#include "logging/log.hpp" +#include "logging/logAsyncWriter.hpp" +#include "logging/logMessage.hpp" +#include "logTestFixture.hpp" +#include "logTestUtils.inline.hpp" +#include "unittest.hpp" + +class AsyncLogTest : public LogTestFixture { + public: + AsyncLogTest() { + if(!LogConfiguration::is_async_mode()) { + fprintf(stderr, "Warning: asynclog is OFF.\n"); + } + } + + void test_asynclog_ls() { + LogStream ls(Log(logging)::info()); + outputStream* os = &ls; + os->print_cr("LogStreamWithAsyncLogImpl"); + os->print_cr("LogStreamWithAsyncLogImpl secondline"); + + //multi-lines + os->print("logStream msg1-"); + os->print("msg2-"); + os->print("msg3\n"); + os->print_cr("logStream newline"); + } + + void test_asynclog_raw() { + Log(logging) logger; +#define LOG_LEVEL(level, name) logger.name("1" #level); +LOG_LEVEL_LIST +#undef LOG_LEVEL + + LogTarget(Trace, logging) t; + LogTarget(Debug, logging) d; + EXPECT_FALSE(t.is_enabled()); + EXPECT_TRUE(d.is_enabled()); + + d.print("AsyncLogTarget.print = %d", 1); + log_trace(logging)("log_trace-test"); + log_debug(logging)("log_debug-test"); + } +}; + +TEST_VM(AsyncLogBufferTest, fifo) { + LinkedListDeque fifo; + LinkedListImpl result; + + fifo.push_back(1); + EXPECT_EQ((size_t)1, fifo.size()); + EXPECT_EQ(1, *(fifo.back())); + + fifo.pop_all(&result); + EXPECT_EQ((size_t)0, fifo.size()); + EXPECT_EQ(NULL, fifo.back()); + EXPECT_EQ((size_t)1, result.size()); + EXPECT_EQ(1, *(result.head()->data())); + result.clear(); + + fifo.push_back(2); + fifo.push_back(1); + fifo.pop_all(&result); + EXPECT_EQ((size_t)2, result.size()); + EXPECT_EQ(2, *(result.head()->data())); + EXPECT_EQ(1, *(result.head()->next()->data())); + result.clear(); + const int N = 1000; + for (int i=0; i it(result.head()); + for (int i=0; i deque; + const int N = 10; + + EXPECT_EQ(NULL, deque.front()); + EXPECT_EQ(NULL, deque.back()); + for (int i = 0; i < N; ++i) { + deque.push_back(i); + } + + EXPECT_EQ(0, *(deque.front())); + EXPECT_EQ(N-1, *(deque.back())); + EXPECT_EQ((size_t)N, deque.size()); + + deque.pop_front(); + EXPECT_EQ((size_t)(N - 1), deque.size()); + EXPECT_EQ(1, *(deque.front())); + EXPECT_EQ(N - 1, *(deque.back())); + + deque.pop_front(); + EXPECT_EQ((size_t)(N - 2), deque.size()); + EXPECT_EQ(2, *(deque.front())); + EXPECT_EQ(N - 1, *(deque.back())); + + + for (int i=2; i < N-1; ++i) { + deque.pop_front(); + } + EXPECT_EQ((size_t)1, deque.size()); + EXPECT_EQ(N - 1, *(deque.back())); + EXPECT_EQ(deque.back(), deque.front()); + + deque.pop_front(); + EXPECT_EQ((size_t)0, deque.size()); +} + +TEST_VM_F(AsyncLogTest, asynclog) { + set_log_config(TestLogFileName, "logging=debug"); + + test_asynclog_ls(); + test_asynclog_raw(); + AsyncLogWriter::flush(); + + EXPECT_TRUE(file_contains_substring(TestLogFileName, "LogStreamWithAsyncLogImpl")); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "logStream msg1-msg2-msg3")); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "logStream newline")); + + EXPECT_TRUE(file_contains_substring(TestLogFileName, "1Debug")); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "1Info")); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "1Warning")); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "1Error")); + EXPECT_FALSE(file_contains_substring(TestLogFileName, "1Trace")); // trace message is masked out + + EXPECT_TRUE(file_contains_substring(TestLogFileName, "AsyncLogTarget.print = 1")); + EXPECT_FALSE(file_contains_substring(TestLogFileName, "log_trace-test")); // trace message is masked out + EXPECT_TRUE(file_contains_substring(TestLogFileName, "log_debug-test")); +} + +TEST_VM_F(AsyncLogTest, logMessage) { + set_log_config(TestLogFileName, "logging=debug"); + + const int MULTI_LINES = 20; + { + + LogMessage(logging) msg; + Log(logging) logger; + + for (int i = 0; i < MULTI_LINES; ++i) { + msg.debug("nonbreakable log message line-%02d", i); + + if (0 == (i % 4)) { + logger.debug("a noisy message from other logger"); + } + } + logger.debug("a noisy message from other logger"); + } + AsyncLogWriter::flush(); + + ResourceMark rm; + LogMessageBuffer buffer; + const char* strs[MULTI_LINES + 1]; + strs[MULTI_LINES] = NULL; + for (int i = 0; i < MULTI_LINES; ++i) { + stringStream ss; + ss.print_cr("nonbreakable log message line-%02d", i); + strs[i] = ss.as_string(); + } + // check nonbreakable log messages are consecutive + EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, strs)); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "a noisy message from other logger")); +} + +TEST_VM_F(AsyncLogTest, droppingMessage) { + set_log_config(TestLogFileName, "logging=debug"); + const size_t sz = 100; + + if (AsyncLogWriter::instance() != nullptr) { + // shrink async buffer. + AutoModifyRestore saver(AsyncLogBufferSize, sz * 1024 /*in byte*/); + LogMessage(logging) lm; + + // write 100x more messages than its capacity in burst + for (size_t i = 0; i < sz * 100; ++i) { + lm.debug("a lot of log..."); + } + lm.flush(); + AsyncLogWriter::flush(); + EXPECT_TRUE(file_contains_substring(TestLogFileName, "messages dropped due to async logging")); + } +} diff --git a/test/hotspot/gtest/logging/test_log.cpp b/test/hotspot/gtest/logging/test_log.cpp index 0700e202b70..ccd928474d4 100644 --- a/test/hotspot/gtest/logging/test_log.cpp +++ b/test/hotspot/gtest/logging/test_log.cpp @@ -58,6 +58,7 @@ TEST_VM_F(LogTest, large_message) { memset(big_msg, Xchar, sizeof(big_msg) - 1); log_trace(logging)("%s", big_msg); + AsyncLogWriter::flush(); ResourceMark rm; FILE* fp = fopen(TestLogFileName, "r"); ASSERT_NE((void*)NULL, fp); diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 7031d8afdcf..0392416e49f 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -154,7 +154,6 @@ vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8257761 ge vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all -vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java 8267404 linux-aarch64 vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all diff --git a/test/hotspot/jtreg/compiler/debug/TraceIterativeGVN.java b/test/hotspot/jtreg/compiler/debug/TraceIterativeGVN.java index 349c55c27aa..59d3de0d58e 100644 --- a/test/hotspot/jtreg/compiler/debug/TraceIterativeGVN.java +++ b/test/hotspot/jtreg/compiler/debug/TraceIterativeGVN.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. * 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 +24,7 @@ /* * @test - * + * @requires vm.debug == true & vm.compiler2.enabled * @run main/othervm -Xbatch -XX:-TieredCompilation * -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceIterativeGVN * compiler.debug.TraceIterativeGVN diff --git a/test/hotspot/jtreg/compiler/exceptions/ExceptionInInit.java b/test/hotspot/jtreg/compiler/exceptions/ExceptionInInit.java index 55389130054..a9ca2954a01 100644 --- a/test/hotspot/jtreg/compiler/exceptions/ExceptionInInit.java +++ b/test/hotspot/jtreg/compiler/exceptions/ExceptionInInit.java @@ -29,7 +29,7 @@ * @author Tom Rodriguez * * @modules java.rmi - * @run main compiler.exceptions.ExceptionInInit + * @run main/othervm -Djava.security.manager=allow compiler.exceptions.ExceptionInInit */ package compiler.exceptions; diff --git a/test/hotspot/jtreg/compiler/jvmci/SecurityRestrictionsTest.java b/test/hotspot/jtreg/compiler/jvmci/SecurityRestrictionsTest.java index d46f19025de..80c7d856836 100644 --- a/test/hotspot/jtreg/compiler/jvmci/SecurityRestrictionsTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/SecurityRestrictionsTest.java @@ -36,14 +36,17 @@ * NO_SEC_MAN * @run main/othervm -XX:+UnlockExperimentalVMOptions * -XX:+EnableJVMCI + * -Djava.security.manager=allow * compiler.jvmci.SecurityRestrictionsTest * NO_PERM * @run main/othervm -XX:+UnlockExperimentalVMOptions * -XX:+EnableJVMCI + * -Djava.security.manager=allow * compiler.jvmci.SecurityRestrictionsTest * ALL_PERM * @run main/othervm -XX:+UnlockExperimentalVMOptions * -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * -Djava.security.manager=allow * compiler.jvmci.SecurityRestrictionsTest * NO_JVMCI_ACCESS_PERM * @run main/othervm -XX:+UnlockExperimentalVMOptions diff --git a/test/hotspot/jtreg/compiler/types/TestMeetXor.java b/test/hotspot/jtreg/compiler/types/TestMeetXor.java new file mode 100644 index 00000000000..c25d22c73e1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/types/TestMeetXor.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 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 + * @key randomness + * @bug 8267332 + * @summary Test meet on xor + * @library /test/lib / + * @run main/othervm compiler.types.TestMeetXor -Xbatch -XX::CompileCommand=dontinline,*::test* + */ + +package compiler.types; + +import java.util.Random; +import jdk.test.lib.Asserts; + +public class TestMeetXor { + public static void main(String[] args) throws Exception { + for (int i = 0; i < 50_000; i++) { + testCase1E(); + testCase2E(); + testCase3E(); + testCase4E(); + + testCaseS(); + } + } + + static int[] count = new int[256]; + static Random r = jdk.test.lib.Utils.getRandomInstance(); + + public static void testCase1E() { + boolean aiobe = false; + try { + testBound1E(r.nextInt()); + } catch (ArrayIndexOutOfBoundsException e) { + aiobe = true; + } + Asserts.assertTrue(aiobe); + } + + public static void testBound1E(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ -1; + count[index]++; + } + + public static void testCase2E() { + boolean aiobe = false; + try { + testBound2E(r.nextInt()); + } catch (ArrayIndexOutOfBoundsException e) { + aiobe = true; + } + Asserts.assertTrue(aiobe); + } + + public static void testBound2E(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ 0x100; + count[index]++; + } + + public static void testCase3E() { + boolean aiobe = false; + try { + testBound3E(r.nextInt()); + } catch (ArrayIndexOutOfBoundsException e) { + aiobe = true; + } + Asserts.assertTrue(aiobe); + } + + public static void testBound3E(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ Integer.MIN_VALUE; + count[index]++; + } + + public static void testCase4E() { + boolean aiobe = false; + try { + testBound4E(r.nextInt(), 0xf0f0ff); + } catch (ArrayIndexOutOfBoundsException e) { + aiobe = true; + } + Asserts.assertTrue(aiobe); + } + + public static void testBound4E(int i1, int i2) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ i2; + count[index]++; + } + + public static void testCaseS() { + testBound1S(r.nextInt()); + testBound2S(r.nextInt()); + testBound3S(r.nextInt(), r.nextInt()); + testBound4S(r.nextInt()); + } + + public static void testBound1S(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ 0x80; + count[index]++; + } + + public static void testBound2S(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ 0xff; + count[index]++; + } + + public static void testBound3S(int i1, int i2) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ (i2 >>> 24); + count[index]++; + } + + public static void testBound4S(int i1) throws ArrayIndexOutOfBoundsException { + int index = (i1 >>> 24) ^ 0; + count[index]++; + } +} diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/ActivateMe.java b/test/hotspot/jtreg/gtest/AsyncLogGtest.java similarity index 64% rename from test/jdk/java/rmi/activation/Activatable/unregisterInactive/ActivateMe.java rename to test/hotspot/jtreg/gtest/AsyncLogGtest.java index 7a7ac2a8ffa..f85f6d5c7e2 100644 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/ActivateMe.java +++ b/test/hotspot/jtreg/gtest/AsyncLogGtest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -19,17 +19,20 @@ * 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. + * */ -/** - * +/* + * Note: This runs the unified logging part of gtest in async mode. + * The reason is that hotspot can't safely turn off asynclogging dyanmically. + * There's no TEST_OTHER_VM_F. */ -import java.rmi.Remote; -import java.rmi.RemoteException; -// TEMPORARY HACK!!! needed to make interface public until MIS is fixed. -public interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void unregister() throws Exception; - public void shutdown() throws Exception; -} +/* @test + * @summary Run logging gtest in async mode. + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.xml + * @run main/native GTestWrapper --gtest_filter=AsyncLogTest* -Xlog:async + * @run main/native GTestWrapper --gtest_filter=Log*Test* -Xlog:async + */ diff --git a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java index 0e5937b0980..bbb70f8067a 100644 --- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java +++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java @@ -48,6 +48,7 @@ public static void main(String args[]) throws Exception { "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.", + "-Djava.security.manager=allow", Test.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("protection domain added"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java index 0fc1e4d351d..26b53e9af33 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java @@ -25,6 +25,7 @@ * @test * @requires vm.cds * @summary Test class loader constraint checks for archived classes (dynamic archive) + * @bug 8267347 * @library /test/lib * /test/hotspot/jtreg/runtime/cds/appcds * /test/hotspot/jtreg/runtime/cds/appcds/test-classes @@ -40,6 +41,7 @@ import com.sun.net.httpserver.HttpHandler; import jdk.test.lib.Asserts; import jdk.test.lib.helpers.ClassFileInstaller; +import jdk.test.lib.Platform; public class DynamicLoaderConstraintsTest extends DynamicArchiveTestBase { static String mainClass = LoaderConstraintsApp.class.getName(); @@ -55,14 +57,27 @@ public class DynamicLoaderConstraintsTest extends DynamicArchiveTestBase { MyClassLoader.class.getName() }; + static String loaderMainClass = CustomAppLoader.class.getName(); + static String loaderJar = null; + static String loaderClasses[] = { + loaderMainClass + }; + public static void main(String[] args) throws Exception { runTest(DynamicLoaderConstraintsTest::doTest); } static void doTest() throws Exception { appJar = ClassFileInstaller.writeJar("loader_constraints.jar", appClasses); - doTest(false); - doTest(true); + doTest(false, false); + doTest(true, false); + + if (!Platform.isWindows()) { + // custom loaders are not supported on Windows yet. + loaderJar = ClassFileInstaller.writeJar("custom_app_loader.jar", loaderClasses); + doTest(false, true); + doTest(true, true); + } } /* @@ -74,21 +89,34 @@ static void doTest() throws Exception { * causing LinkageError. This ensures the test classes will be * archived so we can test CDS's handling of loader constraints during * run time. + * + * useCustomLoader: if true, load the LoaderConstraintsApp in a custom loader before executing it. + * if false, LoaderConstraintsApp will be loaded by the built-in AppClassLoader. */ - static void doTest(boolean errorInDump) throws Exception { + static void doTest(boolean errorInDump, boolean useCustomLoader) throws Exception { for (int i = 1; i <= 3; i++) { + System.out.println("========================================"); + System.out.println("errorInDump: " + errorInDump + ", useCustomLoader: " + useCustomLoader + ", case: " + i); + System.out.println("========================================"); String topArchiveName = getNewArchiveName(); String testCase = Integer.toString(i); String cmdLine[] = new String[] { - "-cp", appJar, "--add-modules", "java.base,jdk.httpserver", "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-Xlog:class+load,class+loader+constraints", - mainClass, testCase }; + if (useCustomLoader) { + cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar, + loaderMainClass, appJar); + } else { + cmdLine = TestCommon.concat(cmdLine, "-cp", appJar); + } + + cmdLine = TestCommon.concat(cmdLine, mainClass, testCase); + String[] dumpCmdLine = cmdLine; if (!errorInDump) { dumpCmdLine = TestCommon.concat(dumpCmdLine, "loadClassOnly"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsApp.java b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsApp.java index 5b81ca162c8..e0c88193676 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsApp.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -36,7 +36,7 @@ // then try to define HttpExchange in child (app) loader => fail. // 3. no LinkageError should be throw when linking a class that does not override/implement any // methods. -class LoaderConstraintsApp { +public class LoaderConstraintsApp { static void defineHttpExchangeWithAppLoader() throws Exception { Unsafe unsafe = Unsafe.getUnsafe(); URL url = new URL("jrt://modules/jdk.httpserver/com/sun/net/httpserver/HttpExchange.class"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java index 2fcdb750234..9c6d53e7092 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java @@ -25,6 +25,7 @@ * @test * @requires vm.cds * @summary Test class loader constraint checks for archived classes + * @bug 8267347 8267754 * @library /test/lib * /test/hotspot/jtreg/runtime/cds/appcds * /test/hotspot/jtreg/runtime/cds/appcds/test-classes @@ -37,14 +38,17 @@ import com.sun.net.httpserver.HttpHandler; import jdk.test.lib.Asserts; import jdk.test.lib.helpers.ClassFileInstaller; +import jdk.test.lib.Platform; public class LoaderConstraintsTest { static String mainClass = LoaderConstraintsApp.class.getName(); + static String httpHandlerClass = HttpHandler.class.getName().replace(".", "/"); + static String httpExchangeClass = HttpExchange.class.getName().replace(".", "/"); static String appJar = null; static String appClasses[] = { mainClass, - HttpHandler.class.getName(), - HttpExchange.class.getName(), + httpHandlerClass, + httpExchangeClass, Asserts.class.getName(), MyHttpHandler.class.getName(), MyHttpHandlerB.class.getName(), @@ -52,18 +56,50 @@ public class LoaderConstraintsTest { MyClassLoader.class.getName() }; + static String loaderMainClass = CustomAppLoader.class.getName(); + static String loaderJar = null; + static String loaderClasses[] = { + loaderMainClass + }; + static void doTest() throws Exception { - appJar = ClassFileInstaller.writeJar("loader_constraints.jar", appClasses); - TestCommon.dump(appJar, appClasses, "-Xlog:cds+load"); - String joptsMain[] = TestCommon.concat("-cp", appJar, - "-Xlog:cds", - "-Xlog:class+loader+constraints=debug", - "--add-exports", - "java.base/jdk.internal.misc=ALL-UNNAMED", - mainClass); - runWithArchive(joptsMain, "1"); - runWithArchive(joptsMain, "2"); - runWithArchive(joptsMain, "3"); + TestCommon.dump(appJar, appClasses, "-Xlog:cds"); + String cmdLine[] = + TestCommon.concat("-cp", appJar, + "-Xlog:cds", + "-Xlog:class+loader+constraints=debug", + "--add-exports", + "java.base/jdk.internal.misc=ALL-UNNAMED", + mainClass); + runWithArchive(cmdLine, "1"); + runWithArchive(cmdLine, "2"); + runWithArchive(cmdLine, "3"); + } + + // Same as doTest, except that LoaderConstraintsApp and MyHttpHandler* are loaded + // by a custom loader. This is test case for JDK-8267347. + static void doTestCustomLoader() throws Exception { + String src = " source: " + appJar; + String classList[] = + TestCommon.concat(loaderClasses, + "java/lang/Object id: 1", + mainClass + " id: 2 super: 1" + src, + httpHandlerClass + " id: 3", + "MyHttpHandler id: 5 super: 1 interfaces: 3" + src, + "MyHttpHandlerB id: 6 super: 1 interfaces: 3" + src, + "MyHttpHandlerC id: 7 super: 1 interfaces: 3" + src); + TestCommon.dump(loaderJar, classList, "-Xlog:cds"); + + String cmdLine[] = + TestCommon.concat("-cp", loaderJar, + "-Xlog:cds", + "-Xlog:class+loader+constraints=debug", + "--add-exports", + "java.base/jdk.internal.misc=ALL-UNNAMED", + loaderMainClass, appJar, mainClass); + runWithArchive(cmdLine, "1"); + runWithArchive(cmdLine, "2"); + runWithArchive(cmdLine, "3"); } static void runWithArchive(String[] optsMain, String arg) throws Exception { @@ -72,7 +108,12 @@ static void runWithArchive(String[] optsMain, String arg) throws Exception { } public static void main(String... args) throws Exception { + appJar = ClassFileInstaller.writeJar("loader_constraints.jar", appClasses); doTest(); + if (Platform.areCustomLoadersSupportedForCDS()) { + loaderJar = ClassFileInstaller.writeJar("custom_app_loader.jar", loaderClasses); + doTestCustomLoader(); + } } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/CustomAppLoader.java b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/CustomAppLoader.java new file mode 100644 index 00000000000..50e8c8a730b --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/CustomAppLoader.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 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. + * + */ + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; + + +// This is a handy class for running an application inside a custom class loader. This +// is used for testing CDS handling of unregistered classes (i.e., archived classes loaded +// by custom class loaders). +// +// See test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java +// for an example. +public class CustomAppLoader { + // args[0] = App JAR file + // args[1] = App main class + // args[2...] = arguments for the main class + public static void main(String args[]) throws Throwable { + File f = new File(args[0]); + URL[] classLoaderUrls = new URL[] {new URL("file://" + f.getCanonicalPath())}; + URLClassLoader loader = new URLClassLoader(classLoaderUrls, CustomAppLoader.class.getClassLoader()); + Class k = Class.forName(args[1], true, loader); + Class parameterTypes[] = new Class[] {String[].class}; + Method mainMethod = k.getDeclaredMethod("main", parameterTypes); + String appArgs[] = new String[args.length - 2]; + Object invokeArgs[] = new Object[] {appArgs}; + for (int i = 0; i < appArgs.length; i++) { + appArgs[i] = args[i + 2]; + } + mainMethod.invoke(null, invokeArgs); + } +} \ No newline at end of file diff --git a/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java b/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java index ae5bac3f265..051df57ad1e 100644 --- a/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java +++ b/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java @@ -30,6 +30,7 @@ /* * @test HandshakeTimeoutTest + * @bug 8262454 8267651 * @summary Test handshake timeout. * @requires vm.debug * @library /testlibrary /test/lib @@ -61,6 +62,7 @@ public static void main(String[] args) throws Exception { "-XX:CICompilerCount=2", "-XX:+UnlockExperimentalVMOptions", "-XX:HandshakeTimeout=50", + "-XX:-CreateCoredumpOnCrash", useJVMCICompilerStr, "HandshakeTimeoutTest$Test"); diff --git a/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java b/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java index 17bbc013ca3..06f46b6eef5 100644 --- a/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java +++ b/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java @@ -40,6 +40,7 @@ public static void main(String... args) throws Exception { // -Xlog:protectiondomain=trace ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace", "-Xmx128m", + "-Djava.security.manager=allow", Hello.class.getName(), "security_manager"); new OutputAnalyzer(pb.start()) .shouldHaveExitValue(0) @@ -49,6 +50,7 @@ public static void main(String... args) throws Exception { // -Xlog:protectiondomain=debug pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug", "-Xmx128m", + "-Djava.security.manager=allow", Hello.class.getName(), "security_manager"); new OutputAnalyzer(pb.start()) .shouldHaveExitValue(0) diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java new file mode 100644 index 00000000000..cc601147714 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java @@ -0,0 +1,102 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8267555 + * @requires vm.jvmti + * @summary Class redefinition with a different class file version + * @library /test/lib + * @compile TestClassOld.jasm TestClassNew.jasm + * @run main RedefineClassHelper + * @run main/othervm -javaagent:redefineagent.jar ClassVersionAfterRedefine + */ + +import java.io.InputStream; +import java.lang.reflect.Method; + +import static jdk.test.lib.Asserts.assertTrue; + +public class ClassVersionAfterRedefine extends ClassLoader { + + private static String myName = ClassVersionAfterRedefine.class.getName(); + + private static byte[] getBytecodes(String name) throws Exception { + InputStream is = ClassVersionAfterRedefine.class.getResourceAsStream(name + ".class"); + byte[] buf = is.readAllBytes(); + System.out.println("sizeof(" + name + ".class) == " + buf.length); + return buf; + } + + private static int getStringIndex(String needle, byte[] buf) { + return getStringIndex(needle, buf, 0); + } + + private static int getStringIndex(String needle, byte[] buf, int offset) { + outer: + for (int i = offset; i < buf.length - offset - needle.length(); i++) { + for (int j = 0; j < needle.length(); j++) { + if (buf[i + j] != (byte)needle.charAt(j)) continue outer; + } + return i; + } + return 0; + } + + private static void replaceString(byte[] buf, String name, int index) { + for (int i = index; i < index + name.length(); i++) { + buf[i] = (byte)name.charAt(i - index); + } + } + + private static void replaceAllStrings(byte[] buf, String oldString, String newString) throws Exception { + assertTrue(oldString.length() == newString.length(), "must have same length"); + int index = -1; + while ((index = getStringIndex(oldString, buf, index + 1)) != 0) { + replaceString(buf, newString, index); + } + } + + public static void main(String[] s) throws Exception { + + byte[] buf = getBytecodes("TestClassOld"); + // Poor man's renaming of class "TestClassOld" to "TestClassXXX" + replaceAllStrings(buf, "TestClassOld", "TestClassXXX"); + ClassVersionAfterRedefine cvar = new ClassVersionAfterRedefine(); + Class old = cvar.defineClass(null, buf, 0, buf.length); + Method foo = old.getMethod("foo"); + Object result = foo.invoke(null); + assertTrue("java-lang-String".equals(result)); + System.out.println(old.getSimpleName() + ".foo() = " + result); + + buf = getBytecodes("TestClassNew"); + // Rename class "TestClassNew" to "TestClassXXX" so we can use it for + // redefining the original version of "TestClassXXX" (i.e. "TestClassOld"). + replaceAllStrings(buf, "TestClassNew", "TestClassXXX"); + // Now redine the original version of "TestClassXXX" (i.e. "TestClassOld"). + RedefineClassHelper.redefineClass(old, buf); + result = foo.invoke(null); + assertTrue("java.lang.String".equals(result)); + System.out.println(old.getSimpleName() + ".foo() = " + result); + } +} diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassNew.jasm similarity index 55% rename from test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl.java rename to test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassNew.jasm index bc2986f3160..4d810f6f968 100644 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassNew.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -21,26 +21,25 @@ * questions. */ -import java.rmi.*; -import java.rmi.activation.*; +super public final class TestClassNew version 49:0 { -public class FooReceiverImpl implements DownloadParameterClass.FooReceiver { - - private ActivationID id; + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } - public FooReceiverImpl(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); + public static Method foo:"()Ljava/lang/String;" stack 1 locals 1 { + ldc class java/lang/String; + invokevirtual Method java/lang/Class.getName:"()Ljava/lang/String;"; + areturn; } - public void receiveFoo(Object obj) { - /* - * Cast argument to the type "Foo" as resolved from this activatble - * object's class; a ClassCastException will be thrown if the argument - * implements a type "Foo" loaded from a different class loader. - */ - Foo foo = (Foo) obj; + public static Method main:"([Ljava/lang/String;)V" stack 2 locals 2 { + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + invokestatic Method TestClassNew.foo:"()Ljava/lang/String;"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; } + } diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ShutdownThread.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassOld.jasm similarity index 57% rename from test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ShutdownThread.java rename to test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassOld.jasm index 4657b42ef95..f4d0510499d 100644 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ShutdownThread.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TestClassOld.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -21,30 +21,24 @@ * questions. */ -import java.rmi.*; -import java.rmi.activation.*; -import java.io.*; +super public final class TestClassOld version 48:0 { -public class ShutdownThread extends Thread implements Serializable { - - Remote remoteObject = null; - ActivationID activationID = null; - - public ShutdownThread(Remote remoteObject, ActivationID activationID) { - remoteObject = remoteObject; - activationID = activationID; + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; } - public void run() { - - try { - - Activatable.unexportObject(remoteObject, true); - Activatable.inactive(activationID); - - } catch (Exception e) { - } + public static Method foo:"()Ljava/lang/String;" stack 1 locals 1 { + ldc String "java-lang-String"; + areturn; + } + public static Method main:"([Ljava/lang/String;)V" stack 2 locals 2 { + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + invokestatic Method TestClassOld.foo:"()Ljava/lang/String;"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; } } diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbAttachToDebugServer.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbAttachToDebugServer.java index 1cfd493aacc..8103c395386 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbAttachToDebugServer.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbAttachToDebugServer.java @@ -54,7 +54,7 @@ public static void main(String[] args) throws Exception { try { theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid()); - debugd = new DebugdUtils(null); + debugd = new DebugdUtils(); debugd.attach(theApp.getPid()); JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbTestConnectArgument.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbTestConnectArgument.java index f7e59114936..c20ae6ec791 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbTestConnectArgument.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbTestConnectArgument.java @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { try { theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid()); - debugd = new DebugdUtils(null); + debugd = new DebugdUtils(); debugd.attach(theApp.getPid()); JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdConnectTest.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdConnectTest.java index a1c5e5a4af4..083462b7b83 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdConnectTest.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdConnectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -44,13 +44,13 @@ public class DebugdConnectTest { - private static OutputAnalyzer runJHSDB(String command, String id) throws IOException, InterruptedException { + private static OutputAnalyzer runJHSDB(String command, String serverID) throws IOException, InterruptedException { JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); jhsdbLauncher.addVMArgs(Utils.getFilteredTestJavaOpts("-showversion", "-Xcomp")); jhsdbLauncher.addToolArg(command); jhsdbLauncher.addToolArg("--connect"); - if (id != null) { - jhsdbLauncher.addToolArg(id + "@localhost"); + if (serverID != null) { + jhsdbLauncher.addToolArg(serverID + "@localhost"); } else { jhsdbLauncher.addToolArg("localhost"); } @@ -66,47 +66,50 @@ private static OutputAnalyzer runJHSDB(String command, String id) throws IOExcep return out; } - private static void runJSTACK(String id) throws IOException, InterruptedException { - OutputAnalyzer out = runJHSDB("jstack", id); + private static void runJSTACK(String serverID) throws IOException, InterruptedException { + OutputAnalyzer out = runJHSDB("jstack", serverID); out.shouldContain("LingeredApp"); out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); out.shouldHaveExitValue(0); } - private static void runJMAP(String id) throws IOException, InterruptedException { - OutputAnalyzer out = runJHSDB("jmap", id); + private static void runJMAP(String serverID) throws IOException, InterruptedException { + OutputAnalyzer out = runJHSDB("jmap", serverID); out.shouldContain("JVM version is"); out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); out.shouldHaveExitValue(0); } - private static void runJINFO(String id) throws IOException, InterruptedException { - OutputAnalyzer out = runJHSDB("jinfo", id); + private static void runJINFO(String serverID) throws IOException, InterruptedException { + OutputAnalyzer out = runJHSDB("jinfo", serverID); out.shouldContain("Java System Properties:"); out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); out.shouldHaveExitValue(0); } - private static void runJSNAP(String id) throws IOException, InterruptedException { - OutputAnalyzer out = runJHSDB("jsnap", id); + private static void runJSNAP(String serverID) throws IOException, InterruptedException { + OutputAnalyzer out = runJHSDB("jsnap", serverID); out.shouldContain("java.vm.name="); out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); out.shouldHaveExitValue(0); } - private static void runTests(String id, long debuggeePid) throws IOException, InterruptedException { - DebugdUtils debugd = new DebugdUtils(id); + private static void runTests(String serverID, long debuggeePid) throws IOException, InterruptedException { + DebugdUtils debugd = new DebugdUtils(); + if (serverID != null) { + debugd.setServerID(serverID); + } debugd.attach(debuggeePid); try { - runJSTACK(id); - runJMAP(id); - runJINFO(id); - runJSNAP(id); + runJSTACK(serverID); + runJMAP(serverID); + runJINFO(serverID); + runJSNAP(serverID); } finally { debugd.detach(); } diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdUtils.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdUtils.java index c518190a18b..9365275b915 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdUtils.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/DebugdUtils.java @@ -31,17 +31,17 @@ public class DebugdUtils { private static final String GOLDEN = "Debugger attached"; - private final String id; + private String serverID; private int registryPort; private boolean disableRegistry; - private String prefix; + private String serverName; private Process debugdProcess; - public DebugdUtils(String id) { - this.id = id; + public DebugdUtils() { + this.serverID = null; this.registryPort = 0; this.disableRegistry = false; - this.prefix = null; + this.serverName = null; debugdProcess = null; } @@ -53,22 +53,23 @@ public void setDisableRegistry(boolean disableRegistry) { this.disableRegistry = disableRegistry; } - public void setPrefix(String prefix) { - this.prefix = prefix; + public void setServerID(String serverID) { + this.serverID = serverID; + } + + public void setServerName(String serverName) { + this.serverName = serverName; } public void attach(long pid) throws IOException { JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); jhsdbLauncher.addVMArgs(Utils.getTestJavaOpts()); - if (prefix != null) { - jhsdbLauncher.addToolArg("-J-Dsun.jvm.hotspot.rmi.serverNamePrefix=" + prefix); - } jhsdbLauncher.addToolArg("debugd"); jhsdbLauncher.addToolArg("--pid"); jhsdbLauncher.addToolArg(Long.toString(pid)); - if (id != null) { + if (serverID != null) { jhsdbLauncher.addToolArg("--serverid"); - jhsdbLauncher.addToolArg(id); + jhsdbLauncher.addToolArg(serverID); } if (registryPort != 0) { jhsdbLauncher.addToolArg("--registryport"); @@ -77,6 +78,10 @@ public void attach(long pid) throws IOException { if (disableRegistry) { jhsdbLauncher.addToolArg("--disable-registry"); } + if (serverName != null) { + jhsdbLauncher.addToolArg("--servername"); + jhsdbLauncher.addToolArg(serverName); + } debugdProcess = (new ProcessBuilder(jhsdbLauncher.getCommand())).start(); // Wait until debug server attached diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/DisableRegistryTest.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/DisableRegistryTest.java index d36f64756a8..0cb6e90f253 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/DisableRegistryTest.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/DisableRegistryTest.java @@ -33,7 +33,7 @@ /** * @test - * @bug 8263636 + * @bug 8263636 8263635 * @summary Test to use already started RMI registry * @requires vm.hasSA * @requires os.family != "windows" @@ -46,23 +46,22 @@ public class DisableRegistryTest { private static final String PREFIX_1 = "app1"; private static final String PREFIX_2 = "app2"; - private static DebugdUtils attachWithDebugd(int pid, boolean disableRegistry, String prefix) throws IOException { - var debugd = new DebugdUtils(null); + private static DebugdUtils attachWithDebugd(int pid, boolean disableRegistry, String serverName) throws IOException { + var debugd = new DebugdUtils(); debugd.setRegistryPort(REGISTRY_PORT); debugd.setDisableRegistry(disableRegistry); - debugd.setPrefix(prefix); + debugd.setServerName(serverName); debugd.attach(pid); return debugd; } - private static void test(String prefix) throws IOException, InterruptedException { + private static void test(String serverName) throws IOException, InterruptedException { + assert serverName != null; + JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); - if (prefix != null) { - jhsdbLauncher.addToolArg("-J-Dsun.jvm.hotspot.rmi.serverNamePrefix=" + prefix); - } jhsdbLauncher.addToolArg("jinfo"); jhsdbLauncher.addToolArg("--connect"); - jhsdbLauncher.addToolArg("localhost:" + REGISTRY_PORT); + jhsdbLauncher.addToolArg("localhost:" + REGISTRY_PORT + "/" + serverName); Process jhsdb = (SATestUtils.createProcessBuilder(jhsdbLauncher)).start(); OutputAnalyzer out = new OutputAnalyzer(jhsdb); @@ -71,7 +70,7 @@ private static void test(String prefix) throws IOException, InterruptedException System.err.println(out.getStderr()); out.stderrShouldBeEmptyIgnoreDeprecatedWarnings(); - out.shouldContain("Attaching to remote server localhost:10000, please wait..."); + out.shouldContain("Attaching to remote server localhost:10000"); out.shouldContain("java.vm.version"); out.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/PmapOnDebugdTest.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/PmapOnDebugdTest.java index 52f86d955a2..0f3b54a3fa1 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/PmapOnDebugdTest.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/PmapOnDebugdTest.java @@ -49,7 +49,7 @@ public static void main(String[] args) throws Exception { try { theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid()); - debugd = new DebugdUtils(null); + debugd = new DebugdUtils(); debugd.attach(theApp.getPid()); JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); diff --git a/test/hotspot/jtreg/serviceability/sa/sadebugd/RunCommandOnServerTest.java b/test/hotspot/jtreg/serviceability/sa/sadebugd/RunCommandOnServerTest.java index 3ca483f5211..02ac4a2edda 100644 --- a/test/hotspot/jtreg/serviceability/sa/sadebugd/RunCommandOnServerTest.java +++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/RunCommandOnServerTest.java @@ -52,7 +52,7 @@ public static void main(String[] args) throws Exception { try { theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid()); - debugd = new DebugdUtils(null); + debugd = new DebugdUtils(); debugd.attach(theApp.getPid()); JDKToolLauncher jhsdbLauncher = JDKToolLauncher.createUsingTestJDK("jhsdb"); diff --git a/test/hotspot/jtreg/vmTestbase/gc/ArrayJuggle/Juggle11/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/ArrayJuggle/Juggle11/TestDescription.java index 96d9dee4603..a0e51ae8b28 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/ArrayJuggle/Juggle11/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/gc/ArrayJuggle/Juggle11/TestDescription.java @@ -31,6 +31,6 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm -Xlog:gc=debug:gc.log gc.ArrayJuggle.Juggle01.Juggle01 -gp charArr -ms medium + * @run main/othervm -Xlog:gc=debug:gc.log -Djava.security.manager=allow gc.ArrayJuggle.Juggle01.Juggle01 -gp charArr -ms medium */ diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/StringInternGC/StringInternGC.java b/test/hotspot/jtreg/vmTestbase/gc/gctests/StringInternGC/StringInternGC.java index 7ddf086e496..427c42bb05c 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/StringInternGC/StringInternGC.java +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/StringInternGC/StringInternGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -31,7 +31,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm gc.gctests.StringInternGC.StringInternGC + * @run main/othervm -XX:+ExplicitGCInvokesConcurrent gc.gctests.StringInternGC.StringInternGC */ package gc.gctests.StringInternGC; @@ -46,13 +46,19 @@ * String pool should not overflow. */ public class StringInternGC extends ThreadedGCTest { - private int maxLength = 1000; + private int maxLength = 1000; // Maximum number of characters to add per operation. + private int maxTotalLength = 128 * 1024; // Total maximum length of the string until a new StringBuffer will be allocated. + private long lastTime = System.currentTimeMillis(); private class StringGenerator implements Runnable { private StringBuffer sb = new StringBuffer(); private String generateString() { int length = LocalRandom.nextInt(maxLength); + if (sb.length() > maxTotalLength) { + sb = new StringBuffer(); + } + for (int i = 0; i < length; ++i) sb.append((char) LocalRandom.nextInt(Integer.MAX_VALUE)); return sb.toString(); @@ -60,6 +66,12 @@ private String generateString() { public void run() { + long currentTime = System.currentTimeMillis(); + if (currentTime - lastTime > 5000) { // Cause a full gc every 5s. + lastTime = currentTime; + System.gc(); + } + generateString().intern(); } } diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java index 980c9303f04..c68ba4dbd9e 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java @@ -24,69 +24,38 @@ /* * @test - * @modules java.base/jdk.internal.misc * * @summary converted from VM Testbase vm/mlvm/anonloader/stress/oome/metaspace. * VM Testbase keywords: [feature_mlvm, nonconcurrent] * - * @library /vmTestbase - * /test/lib + * @library /test/lib * - * @comment build test class and indify classes - * @build vm.mlvm.anonloader.stress.oome.metaspace.Test - * @run driver vm.mlvm.share.IndifiedClassesBuilder - * - * @run main/othervm -Xmx256m -XX:-UseGCOverheadLimit -XX:MaxMetaspaceSize=8m vm.mlvm.anonloader.stress.oome.metaspace.Test + * @run driver vm.mlvm.anonloader.stress.oome.metaspace.Test */ package vm.mlvm.anonloader.stress.oome.metaspace; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandles.Lookup; -import java.util.List; -import java.io.IOException; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; -import vm.mlvm.anonloader.share.AnonkTestee01; -import vm.mlvm.share.MlvmOOMTest; -import vm.mlvm.share.MlvmTestExecutor; -import vm.mlvm.share.Env; -import vm.share.FileUtils; +public class Test { -/** - * This test loads classes using defineHiddenClass and stores them, - * expecting Metaspace OOME. - * - */ -public class Test extends MlvmOOMTest { - @Override - protected void checkOOME(OutOfMemoryError oome) { - String message = oome.getMessage(); - if (!"Metaspace".equals(message) && !"Compressed class space".equals(message)) { - throw new RuntimeException("TEST FAIL : wrong OOME", oome); + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xshare:off", "-XX:MaxMetaspaceSize=512k", "-version"); + + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + + analyzer.shouldNotHaveExitValue(0); + + if (!analyzer.getStdout().contains("OutOfMemoryError")) { + throw new RuntimeException("TEST FAIL : no OOME"); } - } - @Override - protected void eatMemory(List list) { - byte[] classBytes = null; - try { - classBytes = FileUtils.readClass(AnonkTestee01.class.getName()); - } catch (IOException e) { - Env.throwAsUncheckedException(e); + if (!analyzer.getStdout().contains("Metaspace") && + !analyzer.getStdout().contains("Compressed class space")) { + throw new RuntimeException("TEST FAIL : wrong OOME"); } - try { - while (true) { - Lookup lookup = MethodHandles.lookup(); - Lookup ank_lookup = MethodHandles.privateLookupIn(AnonkTestee01.class, lookup); - Class c = ank_lookup.defineHiddenClass(classBytes, true).lookupClass(); - list.add(c.newInstance()); - } - } catch (InstantiationException | IllegalAccessException e) { - Env.throwAsUncheckedException(e); - } } - public static void main(String[] args) { - MlvmTestExecutor.launch(args); - } } diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java index 21a6780bb8d..0414d28502c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java @@ -35,7 +35,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.CatalogReferCircularityTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogReferCircularityTest * @run testng/othervm catalog.CatalogReferCircularityTest * @summary Via nextCatalog entry, the catalog reference chain may be * a (partial) closed circuit. For instance, a catalog may use itself diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java index 0cc05e97da0..4f59f77a58f 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java @@ -36,7 +36,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.DefaultFeaturesTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DefaultFeaturesTest * @run testng/othervm catalog.DefaultFeaturesTest * @summary This case tests if the default feature values are expected. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java index 2ee5dafa901..666bb91c786 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java @@ -48,7 +48,7 @@ * @bug 8077931 8176405 * @library /javax/xml/jaxp/libs * @modules java.xml/javax.xml.catalog:open - * @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DeferFeatureTest * @run testng/othervm catalog.DeferFeatureTest * @summary This case tests whether the catalogs specified in delegateSystem, * delegatePublic, delegateURI and nextCatalog entries are used lazily diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java index b20aba8dbf4..62aa2fbec17 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.DelegatePublicTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegatePublicTest * @run testng/othervm catalog.DelegatePublicTest * @summary Get matched URIs from DelegatePublic entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java index e8452622462..47cad5616c7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.DelegateSystemTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegateSystemTest * @run testng/othervm catalog.DelegateSystemTest * @summary Get matched URIs from delegateSystem entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateUriTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateUriTest.java index aa8d00efa1f..e576559dcc1 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateUriTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/DelegateUriTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.DelegateUriTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegateUriTest * @run testng/othervm catalog.DelegateUriTest * @summary Get matched URIs from delegateURI entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/GroupTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/GroupTest.java index 80772f98927..355fa68f0bd 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/GroupTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/GroupTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.GroupTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.GroupTest * @run testng/othervm catalog.GroupTest * @summary Get matched URIs from system, public and uri entries respectively, * and some of the entries are enclosed by group entries. diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java index b2fa3a94ce8..d12720c2391 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java @@ -42,7 +42,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.LoadCatalogTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.LoadCatalogTest * @run testng/othervm catalog.LoadCatalogTest * @summary When catalog resolver loads catalog files, the current catalog file * and the catalog files specified by the nextCatalog entries may not diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/NextCatalogTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/NextCatalogTest.java index 4dfc4d7186d..f134f0d4391 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/NextCatalogTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/NextCatalogTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.NextCatalogTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.NextCatalogTest * @run testng/othervm catalog.NextCatalogTest * @summary Get matched URIs from system, public and uri entries respectively, * but some of the entries are defined in none-current catalog files. diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/NormalizationTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/NormalizationTest.java index d66941940cf..33e91f6494e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/NormalizationTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/NormalizationTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.NormalizationTest * @run testng/othervm catalog.NormalizationTest * @summary Before matching identifiers and URI references, it has to normalize * the passed identifiers and URI references. And then the catalog diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java index 3f783bebbe7..61235a72579 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java @@ -40,7 +40,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.PreferFeatureTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PreferFeatureTest * @run testng/othervm catalog.PreferFeatureTest * @summary This case tests how does the feature affect the catalog resolution, * and tests the priority between this feature and attribute prefer diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/PreferTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/PreferTest.java index c9812ead83d..59a85622753 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/PreferTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/PreferTest.java @@ -36,7 +36,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.PreferTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PreferTest * @run testng/othervm catalog.PreferTest * @summary Get matched URIs from system and public family entries, which * specify the prefer attribute. It tests how does the prefer attribute diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java index 68081e29199..9c1894e14ce 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java @@ -37,7 +37,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.PublicFamilyTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PublicFamilyTest * @run testng/othervm catalog.PublicFamilyTest * @summary Get matched URIs from public and delegatePublic entries. * It tests the resolution priorities among the public family entries. diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/PublicTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/PublicTest.java index f7a3ebd4376..b99fe0be99c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/PublicTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/PublicTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.PublicTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PublicTest * @run testng/othervm catalog.PublicTest * @summary Get matched URIs from public entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java index 7714e66ea12..128d0982db7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java @@ -46,7 +46,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.ResolveFeatureTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.ResolveFeatureTest * @run testng/othervm catalog.ResolveFeatureTest * @summary This case tests how does resolve feature affect the catalog * resolution. diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java index c1a42668827..748a1577424 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.RewriteSystemTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.RewriteSystemTest * @run testng/othervm catalog.RewriteSystemTest * @summary Get matched URIs from rewriteSystem entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteUriTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteUriTest.java index f4777dbaaf0..60b4c950a62 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteUriTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/RewriteUriTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.RewriteUriTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.RewriteUriTest * @run testng/othervm catalog.RewriteUriTest * @summary Get matched URIs from rewriteURI entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java index e81a84b020b..82bdc8022f4 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java @@ -44,7 +44,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.SpecifyCatalogTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SpecifyCatalogTest * @run testng/othervm catalog.SpecifyCatalogTest * @summary This case tests how to specify the catalog files. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java index 0c62b7d72ac..c9480dd2db3 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.SystemFamilyTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemFamilyTest * @run testng/othervm catalog.SystemFamilyTest * @summary Get matched URIs from system, rewriteSystem, systemSuffix and * delegateSystem entries. It tests the resolution priorities among diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java index 6b83fdc306e..902b5237b86 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.SystemSuffixTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemSuffixTest * @run testng/othervm catalog.SystemSuffixTest * @summary Get matched URIs from systemSuffix entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemTest.java index 4be1e621e17..f0b6d4d26ad 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/SystemTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/SystemTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.SystemTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemTest * @run testng/othervm catalog.SystemTest * @summary Get matched URIs from system entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/UriFamilyTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/UriFamilyTest.java index 7e7d1c28e82..f96bc094780 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/UriFamilyTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/UriFamilyTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.UriFamilyTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriFamilyTest * @run testng/othervm catalog.UriFamilyTest * @summary Get matched URIs from uri, rewriteURI, uriSuffix and delegateURI * entries. It tests the resolution priorities among the uri family diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/UriSuffixTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/UriSuffixTest.java index c27094fda84..42bcb95e109 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/UriSuffixTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/UriSuffixTest.java @@ -38,7 +38,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.UriSuffixTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriSuffixTest * @run testng/othervm catalog.UriSuffixTest * @summary Get matched URIs from rewriteURI entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/UriTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/UriTest.java index 6b6976d6d9e..360539eda43 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/UriTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/UriTest.java @@ -41,7 +41,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.UriTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriTest * @run testng/othervm catalog.UriTest * @summary Get matched URIs from uri entries. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java index dbdcb446fa7..dd9ad54e8a1 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java @@ -36,7 +36,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.UrnUnwrappingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UrnUnwrappingTest * @run testng/othervm catalog.UrnUnwrappingTest * @summary If the passed public identifier is started with "urn:publicid:", * it has to be regarded as URN and normalized. And then the catalog diff --git a/test/jaxp/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java b/test/jaxp/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java index dc7bf7a7e7b..0ec655f5aa8 100644 --- a/test/jaxp/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java @@ -39,7 +39,7 @@ * @test * @bug 8077931 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true catalog.ValidateCatalogTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.ValidateCatalogTest * @run testng/othervm catalog.ValidateCatalogTest * @summary A legal catalog file must be well-formed XML, the root element * must be catalog, and the naming space of the root element must be diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java index 057414557a0..bdd6a4e78bf 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java @@ -53,7 +53,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.DurationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.DurationTest * @run testng/othervm javax.xml.datatype.ptests.DurationTest * @summary Class containing the test cases for Duration. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java index f00259f613b..06c1a847d53 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java @@ -42,7 +42,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.FactoryNewInstanceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.FactoryNewInstanceTest * @run testng/othervm javax.xml.datatype.ptests.FactoryNewInstanceTest * @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java index 2f0281013fa..a626c1ad02c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java @@ -49,7 +49,7 @@ * @test * @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.XMLGregorianCalendarTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.XMLGregorianCalendarTest * @run testng/othervm javax.xml.datatype.ptests.XMLGregorianCalendarTest * @summary Class containing the test cases for XMLGregorianCalendar */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java index be2dcba2f4e..65d42c83dc3 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DBFNamespaceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DBFNamespaceTest * @run testng/othervm javax.xml.parsers.ptests.DBFNamespaceTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java index c4d1aff87ff..2743b4bac53 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java @@ -74,7 +74,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DocumentBuilderFactoryTest * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderFactoryTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java index 65028a582fc..dfc7e2df9ec 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderImpl01 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DocumentBuilderImpl01 * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderImpl01 */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java index 43527cf721a..ea50b10364c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.FactoryConfErrorTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.FactoryConfErrorTest * @run testng/othervm javax.xml.parsers.ptests.FactoryConfErrorTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java index aa8ba1337bb..49264402764 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXFactoryNewInstanceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXFactoryNewInstanceTest * @run testng/othervm javax.xml.parsers.ptests.SAXFactoryNewInstanceTest * @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java index 2effec0126f..5bf37b24a14 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java @@ -40,7 +40,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserFactTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserFactTest * @run testng/othervm javax.xml.parsers.ptests.SAXParserFactTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java index 7a18ddba527..659af20492a 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserTest * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java index 1c7f410615f..3e7fc2ff5f6 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java @@ -45,7 +45,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest02 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserTest02 * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest02 */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java index 94273e722ee..33dc530e72e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest03 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserTest03 * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest03 */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java index 645a26e82ee..59f3cdc40f2 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java @@ -43,7 +43,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest * @run testng/othervm javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest * @summary Tests for XMLEventFactory.newFactory(factoryId , classLoader) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java index e747396ff9e..310ba0b6c20 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java @@ -43,7 +43,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest * @run testng/othervm javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest * @summary Tests for XMLInputFactory.newFactory(factoryId , classLoader) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLOutputFactoryNewInstanceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLOutputFactoryNewInstanceTest.java index e901977e968..f7fdaa30714 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLOutputFactoryNewInstanceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLOutputFactoryNewInstanceTest.java @@ -43,7 +43,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.stream.ptests.XMLOutputFactoryNewInstanceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.stream.ptests.XMLOutputFactoryNewInstanceTest * @run testng/othervm javax.xml.stream.ptests.XMLOutputFactoryNewInstanceTest * @summary Tests for XMLOutputFactory.newFactory(factoryId , classLoader) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java index e3e46791768..85b39d288fb 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java @@ -44,7 +44,7 @@ * @test * @bug 6384418 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.Bug6384418Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.Bug6384418Test * @run testng/othervm javax.xml.transform.ptests.Bug6384418Test * @summary verify the transforming won't throw any exception */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java index b1a65ec6e9e..897e6183f75 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java @@ -56,7 +56,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.DOMResultTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.DOMResultTest * @run testng/othervm javax.xml.transform.ptests.DOMResultTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java index eb9de80edc4..d274355f06d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.ErrorListenerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.ErrorListenerTest * @run testng/othervm javax.xml.transform.ptests.ErrorListenerTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java index 843b5571dbb..8ca1ae14c0c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXSourceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.SAXSourceTest * @run testng/othervm javax.xml.transform.ptests.SAXSourceTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java index 16f2ba1b0e5..e772e4e8892 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java @@ -62,7 +62,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXTFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.SAXTFactoryTest * @run testng/othervm javax.xml.transform.ptests.SAXTFactoryTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java index cfa6d59a587..224e6528ed3 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java @@ -54,7 +54,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.StreamResultTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.StreamResultTest * @run testng/othervm javax.xml.transform.ptests.StreamResultTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java index 10867c9f0d2..e9ebd33ea7d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TfClearParamTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TfClearParamTest * @run testng/othervm javax.xml.transform.ptests.TfClearParamTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java index b98272896cf..73cf9093506 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java @@ -71,7 +71,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformTest * @run testng/othervm javax.xml.transform.ptests.TransformTest * @summary Tests for variable combination of Transformer.transform(Source, Result) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java index cf70fdee7b3..027da107aff 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java @@ -45,7 +45,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerExcpTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformerExcpTest * @run testng/othervm javax.xml.transform.ptests.TransformerExcpTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java index ec5d2d4f387..9c6ea1ed7b5 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java @@ -60,7 +60,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformerFactoryTest * @run testng/othervm javax.xml.transform.ptests.TransformerFactoryTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java index 14d463e4dae..f4644546307 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java @@ -53,7 +53,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformerTest * @run testng/othervm javax.xml.transform.ptests.TransformerTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java index 57d47c2c72a..b658e13660e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest02 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformerTest02 * @run testng/othervm javax.xml.transform.ptests.TransformerTest02 */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java index 3ea3b1b8639..ff898fc5c62 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java @@ -52,7 +52,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest03 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.TransformerTest03 * @run testng/othervm javax.xml.transform.ptests.TransformerTest03 */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java index c7c7fc3ee13..db092c003e9 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java @@ -51,7 +51,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.URIResolverTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.URIResolverTest * @run testng/othervm javax.xml.transform.ptests.URIResolverTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java index e0471aeb160..db07644d989 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.othervm.TFCErrorTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.transform.ptests.othervm.TFCErrorTest * @run testng/othervm javax.xml.transform.ptests.othervm.TFCErrorTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java index 920723c4a56..11bc3dc1bab 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java @@ -71,7 +71,7 @@ * @test * @bug 8080907 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.SchemaFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.validation.ptests.SchemaFactoryTest * @run testng/othervm javax.xml.validation.ptests.SchemaFactoryTest * @summary Class containing the test cases for SchemaFactory */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java index bc2b818fba7..c3bfb0354cf 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.TypeInfoProviderTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.validation.ptests.TypeInfoProviderTest * @run testng/othervm javax.xml.validation.ptests.TypeInfoProviderTest * @summary test ValidatorHandler.getTypeInfoProvider() */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java index 686abe494c3..db3280f2ff7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java @@ -49,7 +49,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorHandlerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.validation.ptests.ValidatorHandlerTest * @run testng/othervm javax.xml.validation.ptests.ValidatorHandlerTest * @summary Class containing the test cases for ValidatorHandler API */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java index ec50dd50bb5..56cc6fee57b 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java @@ -60,7 +60,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.validation.ptests.ValidatorTest * @run testng/othervm javax.xml.validation.ptests.ValidatorTest * @summary Class containing the test cases for Validator API */ diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathEvaluationResultTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathEvaluationResultTest.java index aaedc697b46..8c387182865 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathEvaluationResultTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathEvaluationResultTest.java @@ -44,7 +44,7 @@ * @bug 8183266 * @summary verifies the specification of the XPathEvaluationResult API * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathEvaluationResultTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.xpath.ptests.XPathEvaluationResultTest * @run testng/othervm javax.xml.xpath.ptests.XPathEvaluationResultTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java index 4a7dca37be0..aa95e147e0d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java @@ -57,7 +57,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathExpressionTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.xpath.ptests.XPathExpressionTest * @run testng/othervm javax.xml.xpath.ptests.XPathExpressionTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java index b0e778204d2..67f3f03c0d4 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java @@ -49,7 +49,7 @@ * @test * @bug 8169778 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.xpath.ptests.XPathFactoryTest * @run testng/othervm javax.xml.xpath.ptests.XPathFactoryTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java index 6f5e80abb7a..20db15e01c9 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java @@ -39,7 +39,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFunctionResolverTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.xpath.ptests.XPathFunctionResolverTest * @run testng/othervm javax.xml.xpath.ptests.XPathFunctionResolverTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java index 86808d6b035..d98653c82c7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java @@ -61,7 +61,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.xpath.ptests.XPathTest * @run testng/othervm javax.xml.xpath.ptests.XPathTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java index 5c5405e63f0..32538102567 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.AttrTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.AttrTest * @run testng/othervm org.w3c.dom.ptests.AttrTest * @summary Test for the Attr Interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java index 8ded2ce6b51..600b4654549 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.CommentTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.CommentTest * @run testng/othervm org.w3c.dom.ptests.CommentTest * @summary Test for Comment implementation returned by Document.createComment(String) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java index aa4f6ee4759..56e5932bcba 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.DocumentTest * @run testng/othervm org.w3c.dom.ptests.DocumentTest * @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java index 9ac72f5c337..cc2c100042f 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTypeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.DocumentTypeTest * @run testng/othervm org.w3c.dom.ptests.DocumentTypeTest * @summary Test DocumentType */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java index ebfe9295ddd..cc9e3d09763 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DomImplementationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.DomImplementationTest * @run testng/othervm org.w3c.dom.ptests.DomImplementationTest * @summary Test DomImplementation API */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java index c67f32a840f..f9fd96dce6a 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java @@ -51,7 +51,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.ElementTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.ElementTest * @run testng/othervm org.w3c.dom.ptests.ElementTest * @summary Test for the methods of Element Interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java index 78473f793bc..2e6723f6fc7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java @@ -39,7 +39,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.EntityChildTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.EntityChildTest * @run testng/othervm org.w3c.dom.ptests.EntityChildTest * @summary Test DOM Parser: parsing an xml file that contains external entities. */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java index b83bcf75f0d..4e495fba159 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NamedNodeMapTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.NamedNodeMapTest * @run testng/othervm org.w3c.dom.ptests.NamedNodeMapTest * @summary Test for the methods of NamedNodeMap Interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java index 9d9cb491f2a..3b6c5e12640 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeListTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.NodeListTest * @run testng/othervm org.w3c.dom.ptests.NodeListTest * @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of * bound, the last element of a NodeList returns null. The bug has been fixed diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java index 264ad06a95f..c1ec36e320a 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java @@ -57,7 +57,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.NodeTest * @run testng/othervm org.w3c.dom.ptests.NodeTest * @summary Test Node interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java index 46bb3d25ca6..dca0dcea354 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java @@ -39,7 +39,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NotationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.NotationTest * @run testng/othervm org.w3c.dom.ptests.NotationTest * @summary Test for Notation interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java index 3b942942132..cf9e5a6e01f 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java @@ -33,7 +33,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.PITest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.PITest * @run testng/othervm org.w3c.dom.ptests.PITest * @summary Test for the methods of Processing Instruction */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java index 3131e8d3de1..87bdfdd0dcc 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TextTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.TextTest * @run testng/othervm org.w3c.dom.ptests.TextTest * @summary Test for Text implementation returned by Document.createTextNode(String) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java index ca3f174ce39..58241072b7c 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TypeInfoTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.w3c.dom.ptests.TypeInfoTest * @run testng/othervm org.w3c.dom.ptests.TypeInfoTest * @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface */ diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java index 9c4910bc904..6712f3a9ca6 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttrImplTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.AttrImplTest * @run testng/othervm org.xml.sax.ptests.AttrImplTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java index f3115757e0f..60344d29609 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java @@ -46,7 +46,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesNSTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.AttributesNSTest * @run testng/othervm org.xml.sax.ptests.AttributesNSTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java index e6259be3a76..5fe50e39447 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java @@ -47,7 +47,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.AttributesTest * @run testng/othervm org.xml.sax.ptests.AttributesTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java index 5ca0b94924a..5da3045fcd7 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java @@ -52,7 +52,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ContentHandlerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.ContentHandlerTest * @run testng/othervm org.xml.sax.ptests.ContentHandlerTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java index 6418fa264bd..173cfb9677e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java @@ -51,7 +51,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.DefaultHandlerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.DefaultHandlerTest * @run testng/othervm org.xml.sax.ptests.DefaultHandlerTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java index 173a5ca659f..0bd15eb507a 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java @@ -52,7 +52,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.EHFatalTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.EHFatalTest * @run testng/othervm org.xml.sax.ptests.EHFatalTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java index 695a3ec806a..d0f56627e53 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSSupportTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.NSSupportTest * @run testng/othervm org.xml.sax.ptests.NSSupportTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java index 7fd27ffbbf5..e137c427165 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java @@ -39,7 +39,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSTableTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.NSTableTest * @run testng/othervm org.xml.sax.ptests.NSTableTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java index 627134b5eaf..225265bbb20 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ParserAdapterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.ParserAdapterTest * @run testng/othervm org.xml.sax.ptests.ParserAdapterTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java index 6822a88034c..6dbc3d92e2f 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java @@ -55,7 +55,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ResolverTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.ResolverTest * @run testng/othervm org.xml.sax.ptests.ResolverTest */ @Test diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java index 71cad03dc9f..f4c5354ef0e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.SAXParserNSTableTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.SAXParserNSTableTest * @run testng/othervm org.xml.sax.ptests.SAXParserNSTableTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java index 91dd02f8fb9..6ca9abf190d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java @@ -52,7 +52,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterCBTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLFilterCBTest * @run testng/othervm org.xml.sax.ptests.XMLFilterCBTest */ @Test diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java index 4483942699f..a8d9adcf3ab 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLFilterTest * @run testng/othervm org.xml.sax.ptests.XMLFilterTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java index 350074fbf2c..bd526b4e105 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderAdapterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLReaderAdapterTest * @run testng/othervm org.xml.sax.ptests.XMLReaderAdapterTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java index 7ee49f39076..ad6951d7e2e 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLReaderFactoryTest * @run testng/othervm org.xml.sax.ptests.XMLReaderFactoryTest */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java index 518dbc0f8bb..02f4baee9b2 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java @@ -45,7 +45,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderNSTableTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLReaderNSTableTest * @run testng/othervm org.xml.sax.ptests.XMLReaderNSTableTest */ @Test diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java index 568548d919c..a7e1bc7a2b9 100644 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow org.xml.sax.ptests.XMLReaderTest * @run testng/othervm org.xml.sax.ptests.XMLReaderTest */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/AstroTest.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/AstroTest.java index 8712697a298..5f8f8d3be86 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/AstroTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/AstroTest.java @@ -43,7 +43,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.AstroTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.AstroTest * @run testng/othervm test.astro.AstroTest * @summary run astro application, test xslt * diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java index 673674b9e65..a17f5caae38 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java @@ -54,7 +54,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.DocumentLSTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.DocumentLSTest * @run testng/othervm test.astro.DocumentLSTest * @summary org.w3c.dom.ls tests */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java index 70771bfeacf..fb8d3935fbf 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.NamespaceContextTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.NamespaceContextTest * @run testng/othervm test.astro.NamespaceContextTest * @summary javax.xml.namespace.QName tests */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/SAX201Test.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/SAX201Test.java index 822140baccc..79245b28d7d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/SAX201Test.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/SAX201Test.java @@ -31,7 +31,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.SAX201Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.SAX201Test * @run testng/othervm test.astro.SAX201Test * @summary verify SAX 2.0.1 allows to use null in setters */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java index 6ba78e9d817..6e69fc10d34 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.SchemaValidationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.SchemaValidationTest * @run testng/othervm test.astro.SchemaValidationTest * @summary test parser sets schema related properties to do validation */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/astro/XPathAPITest.java b/test/jaxp/javax/xml/jaxp/functional/test/astro/XPathAPITest.java index 69ada828241..aad6d0f2ce4 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/astro/XPathAPITest.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/astro/XPathAPITest.java @@ -56,7 +56,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.astro.XPathAPITest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.astro.XPathAPITest * @run testng/othervm test.astro.XPathAPITest * @summary test XPath API */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java index 5d3ea0317c5..a8230b4a891 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java @@ -70,7 +70,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionController + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.auctionportal.AuctionController * @run testng/othervm test.auctionportal.AuctionController */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java index 2bab94a41aa..9c4a6b0d4ea 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java @@ -61,7 +61,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionItemRepository + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.auctionportal.AuctionItemRepository * @run testng/othervm test.auctionportal.AuctionItemRepository */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/UserController.java b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/UserController.java index 5c4ac7c9bc6..9147f317b8d 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/UserController.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/auctionportal/UserController.java @@ -59,7 +59,7 @@ /* * @test * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.auctionportal.UserController + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.auctionportal.UserController * @run testng/othervm test.auctionportal.UserController */ @Listeners({jaxp.library.FilePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java index 5c6c1b3e0be..ca03c241d91 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java @@ -36,7 +36,7 @@ * @test * @bug 4511326 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4511326 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4511326 * @run testng/othervm test.gaptest.Bug4511326 * @summary In forwards-compatible mode the attribute isn't ignored */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java index 1778a20a031..44c691c9336 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java @@ -41,7 +41,7 @@ * @test * @bug 4512806 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4512806 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4512806 * @run testng/othervm test.gaptest.Bug4512806 * @summary test transformer.setOutputProperties(null) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java index 7af1eb4235c..6c786ee796a 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java @@ -38,7 +38,7 @@ * @test * @bug 4515047 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515047 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4515047 * @run testng/othervm test.gaptest.Bug4515047 * @summary test transform an empty dom source */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java index 15626ab1e71..0c512db8259 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java @@ -54,7 +54,7 @@ * @test * @bug 4515660 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515660 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4515660 * @run testng/othervm test.gaptest.Bug4515660 * @summary verify property org.xml.sax.driver is used by SAXTransformerFactory */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java index f76670bd22e..0e14ebc4355 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java @@ -50,7 +50,7 @@ * @test * @bug 4693341 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4693341 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4693341 * @run testng/othervm test.gaptest.Bug4693341 * @summary test transforming to stream with external dtd */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java index 1ca0bcb77f3..ad805c7ff5f 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java @@ -44,7 +44,7 @@ * @test * @bug 4848653 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4848653 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4848653 * @run testng/othervm test.gaptest.Bug4848653 * @summary Verify JAXP schemaLanguage property is ignored if setValidating(false) */ diff --git a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java index f5deceb04f1..0da5ad75cfb 100644 --- a/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java +++ b/test/jaxp/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java @@ -47,7 +47,7 @@ * @test * @bug 4858685 4894410 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4858685 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow test.gaptest.Bug4858685 * @run testng/othervm test.gaptest.Bug4858685 * @summary test transforming text node */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogAccessTest.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogAccessTest.java index d2e7edee6f0..9b138f12708 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogAccessTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogAccessTest.java @@ -37,7 +37,7 @@ * @test * @bug 8171243 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogAccessTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogAccessTest * @summary the Catalog API grants no privilege to external resources. This test * verifies that SecurityException will be thrown if access to resources is denied * by the security manager. diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport.java index dc96ce2832e..8f487820d68 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport.java @@ -43,7 +43,7 @@ * @test * @bug 8158084 8162438 8162442 8166220 8166398 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport * @run testng/othervm catalog.CatalogSupport * @summary verifies the use of Catalog in SAX/DOM/StAX/Validation/Transform. * The two main scenarios for all processors are: diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java index 03a54ef82be..3daf3b6365d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java @@ -50,7 +50,7 @@ * @test * @bug 8158084 8162438 8162442 8166220 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport1 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport1 * @run testng/othervm catalog.CatalogSupport1 * @summary extends CatalogSupport, verifies that the catalog file can be set * using the System property. diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java index fc3908461fd..bef1339adf7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java @@ -54,7 +54,7 @@ * @test * @bug 8158084 8162438 8162442 8163535 8166220 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport2 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport2 * @run testng/othervm catalog.CatalogSupport2 * @summary extends CatalogSupport tests, verifies that the use of the Catalog may * be disabled through the System property. diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java index 83083a418ff..35582749fbd 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java @@ -54,7 +54,7 @@ * @test * @bug 8158084 8162438 8162442 8163535 8166220 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport3 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport3 * @run testng/othervm catalog.CatalogSupport3 * @summary extends CatalogSupport tests, verifies that the use of the Catalog may * be disabled through the API property. diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java index 2549b64c072..49e424f3845 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java @@ -48,7 +48,7 @@ * @test * @bug 8158084 8162438 8162442 8166220 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport4 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport4 * @run testng/othervm catalog.CatalogSupport4 * @summary verifies the overriding over of the USE_CATALOG feature. Extending * CatalogSupport tests, the USE_CATALOG is turned off system-wide, however, diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport5.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport5.java index 81da1749944..e6506b22e2b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport5.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport5.java @@ -47,7 +47,7 @@ * @test * @bug 8158084 8163232 8166220 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport5 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogSupport5 * @run testng/othervm catalog.CatalogSupport5 * @summary extends CatalogSupport tests, verifies that when errors occur, * relevant checked Exceptions are returned. diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogTest.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogTest.java index cd491ac8a1d..499a5b23e88 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogTest.java @@ -70,7 +70,7 @@ * @test * @bug 8081248 8144966 8146606 8146237 8150969 8151162 8152527 8154220 8163232 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true catalog.CatalogTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogTest * @run testng/othervm catalog.CatalogTest * @summary Tests basic Catalog functions. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/Bug6350682.java b/test/jaxp/javax/xml/jaxp/unittest/common/Bug6350682.java index c1706bf80dc..5ae453dbde8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/Bug6350682.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/Bug6350682.java @@ -35,7 +35,7 @@ * @test * @bug 6350682 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.Bug6350682 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.Bug6350682 * @run testng/othervm common.Bug6350682 * @summary Test SAXParserFactory and TransformerFactory can newInstance when setContextClassLoader(null). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/Bug6723276Test.java b/test/jaxp/javax/xml/jaxp/unittest/common/Bug6723276Test.java index 721e25a11c1..a34b268d793 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/Bug6723276Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/Bug6723276Test.java @@ -36,7 +36,7 @@ * @test * @bug 6723276 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.Bug6723276Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.Bug6723276Test * @run testng/othervm common.Bug6723276Test * @summary Test JAXP class can be loaded by bootstrap classloader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/Bug7143711Test.java b/test/jaxp/javax/xml/jaxp/unittest/common/Bug7143711Test.java index 33e81c1ea5d..8472a3bf5d3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/Bug7143711Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/Bug7143711Test.java @@ -38,7 +38,7 @@ * @test * @bug 7143711 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.Bug7143711Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.Bug7143711Test * @summary Test set use-service-mechanism shall not override what's set by the constructor in secure mode. */ @Listeners({ jaxp.library.BasePolicy.class }) diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/CDataChunkSizeTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/CDataChunkSizeTest.java index d733bc704ce..41584223322 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/CDataChunkSizeTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/CDataChunkSizeTest.java @@ -43,7 +43,7 @@ * @test * @bug 8158619 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.CDataChunkSizeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.CDataChunkSizeTest * @run testng/othervm common.CDataChunkSizeTest * @summary Verifies the support of property jdk.xml.cdataChunkSize */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/EncodingErrorsReportingTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/EncodingErrorsReportingTest.java index 42c64ef7bab..6559aef6146 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/EncodingErrorsReportingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/EncodingErrorsReportingTest.java @@ -25,7 +25,7 @@ * @bug 8038043 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng/othervm common.EncodingErrorsReportingTest - * @run testng/othervm -DrunSecMngr=true common.EncodingErrorsReportingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.EncodingErrorsReportingTest * @summary Verifies that parsers reports location of wrong UTF-8 symbols in * XML files parsed and included via xi:include element */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/ImplPropertyTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/ImplPropertyTest.java new file mode 100644 index 00000000000..3f08ed8b7ad --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/common/ImplPropertyTest.java @@ -0,0 +1,347 @@ +/* + * Copyright (c) 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. + */ +package common; + +import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; +import java.util.EnumSet; +import java.util.Set; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.validation.SchemaFactory; +import javax.xml.xpath.XPathFactory; +import jdk.xml.internal.JdkProperty.ImplPropMap; +import org.testng.Assert; +import org.testng.annotations.Test; +import org.w3c.dom.DOMConfiguration; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSSerializer; +import org.xml.sax.XMLReader; + + +/* + * @test + * @bug 8265248 + * @modules java.xml/com.sun.org.apache.xerces.internal.utils + * @modules java.xml/jdk.xml.internal + * @run testng common.ImplPropertyTest + * @summary Verifies Implementation-specific Features and Properties as specified + * in the java.xml module summary. + */ +public class ImplPropertyTest { + + private final DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance(); + private final XMLInputFactory xif = XMLInputFactory.newDefaultFactory(); + private final SchemaFactory sf = SchemaFactory.newDefaultInstance(); + + + private final XPathFactory xf = XPathFactory.newDefaultInstance(); + + // as in the Processors table in java.xml module summary + private enum Processor { + DOM, + SAX, + XMLREADER, + StAX, + VALIDATION, + TRANSFORM, + XSLTC, + DOMLS, + XPATH + }; + + /** + * Verifies both the new and legacy property names. This test runs two cases: + * a. sets legacy property first; + * b. sets new property first. Note the new property name is the same as that + * of the System property as of JDK 17. + * In both test cases, the expected return value shall be equal to the value + * set with the new property name. + * @throws Exception if the test fails + */ + @Test + public void testLimits() throws Exception { + // Supported processors for Limits + Set pLimit = EnumSet.of(Processor.DOM, Processor.SAX, Processor.XMLREADER, + Processor.StAX, Processor.VALIDATION, Processor.TRANSFORM); + + for (Limit limit : Limit.values()) { + for (Processor p : pLimit) { + testProperties(p, limit.apiProperty(), 100, limit.systemProperty(), 200, true); + } + } + } + + // Supported processor for isStandalone: DOMLS + @Test + public void testIsStandalone() throws Exception { + testProperties(Processor.DOMLS, ImplPropMap.ISSTANDALONE.qName(), true, + ImplPropMap.ISSTANDALONE.systemProperty(), false, true); + } + + // Supported processor for xsltcIsStandalone: XSLTC Serializer + @Test + public void testXSLTCIsStandalone() throws Exception { + testProperties(Processor.XSLTC, ImplPropMap.XSLTCISSTANDALONE.qName(), "no", + ImplPropMap.XSLTCISSTANDALONE.systemProperty(), "yes", true); + testProperties(Processor.XSLTC, ImplPropMap.XSLTCISSTANDALONE.qNameOld(), "no", + ImplPropMap.XSLTCISSTANDALONE.systemProperty(), "yes", true); + } + + // Supported processor for cdataChunkSize: SAX and StAX + @Test + public void testCData() throws Exception { + // Supported processors for CDATA + Set pCData = EnumSet.of(Processor.SAX, Processor.XMLREADER, + Processor.StAX); + ImplPropMap CDATA = ImplPropMap.CDATACHUNKSIZE; + for (Processor p : pCData) { + testProperties(p, CDATA.qName(), 100, CDATA.systemProperty(), 200, false); + } + } + + // Supported processor for extensionClassLoader: Transform + @Test + public void testExtensionClassLoader() throws Exception { + ImplPropMap ECL = ImplPropMap.EXTCLSLOADER; + TestCL cl1 = new TestCL("testClassLoader1"); + TestCL cl2 = new TestCL("testClassLoader2"); + testProperties(Processor.TRANSFORM, ECL.qNameOld(), cl1, ECL.qName(), cl2, true); + } + + // Supported processor for feature enableExtensionFunctions: Transform, XPath + @Test + public void testEnableExtensionFunctions() throws Exception { + Set pEEF = EnumSet.of(Processor.TRANSFORM, Processor.XPATH); + ImplPropMap EEF = ImplPropMap.ENABLEEXTFUNC; + for (Processor p : pEEF) { + testFeatures(p, EEF.qName(), true, EEF.systemProperty(), false, EEF.isNameDiffer()); + } + } + + // Supported processor for feature overrideDefaultParser: Transform, Validation, XPath + @Test + public void testOverrideDefaultParser() throws Exception { + Set pEEF = EnumSet.of(Processor.TRANSFORM, Processor.VALIDATION, Processor.XPATH); + ImplPropMap ODP = ImplPropMap.OVERRIDEPARSER; + for (Processor p : pEEF) { + testFeatures(p, ODP.qName(), true, ODP.systemProperty(), false, ODP.isNameDiffer()); + } + } + + // Supported processor for feature resetSymbolTable: SAX + @Test + public void testResetSymbolTable() throws Exception { + ImplPropMap RST = ImplPropMap.RESETSYMBOLTABLE; + testFeatures(Processor.SAX, RST.qName(), true, RST.systemProperty(), false, RST.isNameDiffer()); + } + + /** + * Tests properties. Two assertions: + * (1) verifies the old property is still supported; + * (2) verifies the new property name takes preference. + * + * @param processor the processor to be tested + * @param name1 the old property name + * @param value1 the value to be set with name1 + * @param name2 the new property name + * @param value2 the value to be set with name2 + * @param differ a flag indicating whether name1 and name2 differ + * @throws Exception if the test fails + */ + private void testProperties(Processor processor, String name1, Object value1, + String name2, Object value2, boolean differ) + throws Exception { + + Object ret1 = null; + Object ret2 = null; + switch (processor) { + case DOM: + dbf.setAttribute(name1, value1); + ret1 = dbf.getAttribute(name1); + if (differ) { + dbf.setAttribute(name2, value2); + dbf.setAttribute(name1, value1); + ret2 = dbf.getAttribute(name2); + } + break; + case SAX: + SAXParser sp = SAXParserFactory.newDefaultInstance().newSAXParser(); + sp.setProperty(name1, value1); + ret1 = sp.getProperty(name1); + if (differ) { + sp.setProperty(name2, value2); + sp.setProperty(name1, value1); + ret2 = sp.getProperty(name2); + } + break; + case XMLREADER: + XMLReader reader = SAXParserFactory.newDefaultInstance().newSAXParser().getXMLReader(); + reader.setProperty(name1, value1); + ret1 = reader.getProperty(name1); + if (differ) { + reader.setProperty(name2, value2); + reader.setProperty(name1, value1); + ret2 = reader.getProperty(name2); + } + break; + case StAX: + xif.setProperty(name1, value1); + ret1 = xif.getProperty(name1); + if (differ) { + xif.setProperty(name2, value2); + xif.setProperty(name1, value1); + ret2 = xif.getProperty(name2); + } + break; + case VALIDATION: + sf.setProperty(name1, value1); + ret1 = sf.getProperty(name1); + if (differ) { + sf.setProperty(name2, value2); + sf.setProperty(name1, value1); + ret2 = sf.getProperty(name2); + } + break; + case TRANSFORM: + TransformerFactory tf = TransformerFactory.newDefaultInstance(); + tf.setAttribute(name1, value1); + ret1 = tf.getAttribute(name1); + if (differ) { + tf.setAttribute(name2, value2); + tf.setAttribute(name1, value1); + ret2 = tf.getAttribute(name2); + } + break; + case XSLTC: + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.setOutputProperty(name1, (String)value1); + ret1 = transformer.getOutputProperty(name1); + if (differ) { + transformer.setOutputProperty(name2, (String)value2); + transformer.setOutputProperty(name1, (String)value1); + ret2 = transformer.getOutputProperty(name2); + } + break; + case DOMLS: + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); + LSSerializer serializer = impl.createLSSerializer(); + DOMConfiguration domConfig = serializer.getDomConfig(); + domConfig.setParameter(name1, value1); + ret1 = domConfig.getParameter(name1); + if (differ) { + domConfig.setParameter(name2, value2); + domConfig.setParameter(name1, value1); + ret2 = domConfig.getParameter(name2); + } + break; + case XPATH: + break; + } + if ((value1 instanceof Integer) && ret1 instanceof String) { + ret1 = Integer.parseInt((String)ret1); + ret2 = Integer.parseInt((String)ret2); + } + + // name1 is set, expected return value: value1 (set with the old name) + Assert.assertEquals(ret1, value1); + if (differ) { + // if both are set, expected value: value2 (set with the new name) + Assert.assertEquals(ret2, value2); + } + } + + private void testFeatures(Processor processor, String name1, boolean value1, + String name2, boolean value2, boolean differ) + throws Exception { + boolean ret1 = false, ret2 = false; + switch (processor) { + case DOM: + dbf.setFeature(name1, value1); + Assert.assertEquals(dbf.getFeature(name1), value1); + if (differ) { + dbf.setFeature(name2, value2); + dbf.setFeature(name1, value1); + Assert.assertEquals(dbf.getFeature(name2), value2); + } + return; + case SAX: + SAXParserFactory spf = SAXParserFactory.newDefaultInstance(); + spf.setFeature(name1, value1); + Assert.assertEquals(spf.getFeature(name1), value1); + if (differ) { + spf.setFeature(name2, value2); + spf.setFeature(name1, value1); + Assert.assertEquals(spf.getFeature(name2), value2); + } + return; + case VALIDATION: + sf.setFeature(name1, value1); + Assert.assertEquals(sf.getFeature(name1), value1); + if (differ) { + sf.setFeature(name2, value2); + sf.setFeature(name1, value1); + Assert.assertEquals(sf.getFeature(name2), value2); + } + return; + case TRANSFORM: + TransformerFactory tf = TransformerFactory.newDefaultInstance(); + tf.setFeature(name1, value1); + Assert.assertEquals(tf.getFeature(name1), value1); + if (differ) { + tf.setFeature(name2, value2); + tf.setFeature(name1, value1); + Assert.assertEquals(tf.getFeature(name2), value2); + } + return; + case XPATH: + xf.setFeature(name1, value1); + Assert.assertEquals(xf.getFeature(name1), value1); + if (differ) { + xf.setFeature(name2, value2); + xf.setFeature(name1, value1); + Assert.assertEquals(xf.getFeature(name2), value2); + } + return; + } + + Assert.fail("Failed setting features for : " + processor); + } + + + class TestCL extends ClassLoader { + String name; + public TestCL(String name) { + this.name = name; + } + + public Class loadClass(String name) throws ClassNotFoundException { + throw new ClassNotFoundException( name ); + } + } +} diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/Sources.java b/test/jaxp/javax/xml/jaxp/unittest/common/Sources.java index ad5f815cbad..9d902f66ebf 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/Sources.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/Sources.java @@ -57,7 +57,7 @@ * @test * @bug 8144967 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.Sources + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.Sources * @run testng/othervm common.Sources * @summary Tests related to the javax.xml.transform.Source * and org.xml.sax.InputSource diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java index 1dbe4188330..474a892aeef 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java @@ -43,7 +43,7 @@ * @bug 8144593 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @compile -XDignore.symbol.file TestSAXDriver.java - * @run testng/othervm -DrunSecMngr=true common.TransformationWarningsTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.TransformationWarningsTest * @run testng/othervm common.TransformationWarningsTest * @summary Check that warnings about unsupported properties from parsers * are suppressed during the transformation process. diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java index 1e09a762f61..65d9a2806a8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java @@ -47,7 +47,7 @@ * @key intermittent * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @compile -XDignore.symbol.file TestSAXDriver.java - * @run testng/othervm -DrunSecMngr=true common.ValidationWarningsTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.ValidationWarningsTest * @run testng/othervm common.ValidationWarningsTest * @summary Check that warnings about unsupported properties from SAX * parsers are suppressed during the xml validation process. diff --git a/test/jaxp/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java b/test/jaxp/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java index 083c0ff8ba5..2ff1b87dbf7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/common/prettyprint/PrettyPrintTest.java @@ -68,7 +68,7 @@ * @test * @bug 6439439 8087303 8174025 8223291 8249867 8261209 8260858 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true common.prettyprint.PrettyPrintTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow common.prettyprint.PrettyPrintTest * @run testng/othervm common.prettyprint.PrettyPrintTest * @summary Test serializing xml and html with indentation. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6320118.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6320118.java index 2d1c25967e8..d1540dddf63 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6320118.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6320118.java @@ -36,7 +36,7 @@ * @test * @bug 6320118 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.Bug6320118 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.Bug6320118 * @run testng/othervm datatype.Bug6320118 * @summary Test xml datatype XMLGregorianCalendar. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java index 36de6637e6d..4bbb5500c64 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java @@ -35,7 +35,7 @@ * @test * @bug 6937951 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.Bug6937951Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.Bug6937951Test * @run testng/othervm datatype.Bug6937951Test * @summary Test midnight is same as the start of the next day in XMLGregorianCalendar. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java index c4184844c04..f104029a968 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java @@ -41,7 +41,7 @@ * @test * @bug 6937964 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.Bug6937964Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.Bug6937964Test * @run testng/othervm datatype.Bug6937964Test * @summary Test Duration is normalized. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java index 5e6e34b6af6..ed553ee7ce2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java @@ -38,7 +38,7 @@ * @test * @bug 7042647 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.Bug7042647Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.Bug7042647Test * @run testng/othervm datatype.Bug7042647Test * @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java index 4029e2b21ae..d4050c8bff2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.DatatypeFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.DatatypeFactoryTest * @run testng/othervm datatype.DatatypeFactoryTest * @summary Test DatatypeFactory. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/DurationTest.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/DurationTest.java index bd4f8d6a305..044b6588c44 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/DurationTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/DurationTest.java @@ -47,7 +47,7 @@ * @test * @bug 8190835 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.DurationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.DurationTest * @run testng/othervm datatype.DurationTest * @summary Test Duration. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java index 2a1e2d6ea7f..1c8c0821a54 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.FactoryFindTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.FactoryFindTest * @run testng/othervm datatype.FactoryFindTest * @summary Test Classloader for DatatypeFactory. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java index 03412b59edb..b66af1d778b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java @@ -34,7 +34,7 @@ * @test * @bug 8068839 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.JDK8068839Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.JDK8068839Test * @run testng/othervm datatype.JDK8068839Test * @summary Verifies that Duration's edge cases */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java b/test/jaxp/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java index 415d949c05d..b7fcae1dadd 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true datatype.XMLGregorianCalendarTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow datatype.XMLGregorianCalendarTest * @run testng/othervm datatype.XMLGregorianCalendarTest * @summary Test XMLGregorianCalendar. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915524.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915524.java index 5ce2d195acd..664393a687e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915524.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915524.java @@ -39,7 +39,7 @@ * @test * @bug 4915524 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4915524 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4915524 * @run testng/othervm dom.Bug4915524 * @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915748.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915748.java index 50a5ced37f4..fcabd144b76 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915748.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4915748.java @@ -39,7 +39,7 @@ * @test * @bug 4915748 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4915748 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4915748 * @run testng/othervm dom.Bug4915748 * @summary Test DOMErrorHandler is called in case CDATA section is split by termination marker ']]>'. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966082.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966082.java index 30e1740f11c..237d416a51b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966082.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966082.java @@ -34,7 +34,7 @@ * @test * @bug 4966082 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4966082 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4966082 * @run testng/othervm dom.Bug4966082 * @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966138.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966138.java index cdc96d140b9..a105ceb4f78 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966138.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966138.java @@ -36,7 +36,7 @@ * @test * @bug 4966138 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4966138 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4966138 * @run testng/othervm dom.Bug4966138 * @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966142.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966142.java index ebd66a0a02b..248f70e4b98 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966142.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966142.java @@ -36,7 +36,7 @@ * @test * @bug 4966142 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4966142 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4966142 * @run testng/othervm dom.Bug4966142 * @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966143.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966143.java index 4e42cb06b8c..99fa5490046 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966143.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug4966143.java @@ -36,7 +36,7 @@ * @test * @bug 4966143 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug4966143 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug4966143 * @run testng/othervm dom.Bug4966143 * @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION, * in case TypeInfo instance refers to a complex type derived from another complex type by extension. diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6339023.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6339023.java index d389516117e..f303bf1c707 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6339023.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6339023.java @@ -40,7 +40,7 @@ * @test * @bug 6339023 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6339023 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6339023 * @run testng/othervm dom.Bug6339023 * @summary Test normalize-characters. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6355326.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6355326.java index f0b557a24a7..74321c52fde 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6355326.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6355326.java @@ -47,7 +47,7 @@ * @test * @bug 6355326 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6355326 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6355326 * @run testng/othervm dom.Bug6355326 * @summary Test DOM implementation encoding. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6367542.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6367542.java index 21284ee3902..bcad42bdfaa 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6367542.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6367542.java @@ -33,7 +33,7 @@ * @test * @bug 6367542 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6367542 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6367542 * @run testng/othervm dom.Bug6367542 * @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6520131.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6520131.java index 22940e07b14..181d83b5559 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6520131.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6520131.java @@ -41,7 +41,7 @@ * @test * @bug 6520131 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6520131 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6520131 * @run testng/othervm dom.Bug6520131 * @summary Test DOMErrorHandler reports an error for invalid character. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6521260.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6521260.java index e051748fe7a..d3784f0a6be 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6521260.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6521260.java @@ -41,7 +41,7 @@ * @test * @bug 6521260 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6521260 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6521260 * @run testng/othervm dom.Bug6521260 * @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6582545Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6582545Test.java index 23c872e8553..38735c414f2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6582545Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6582545Test.java @@ -46,7 +46,7 @@ * @test * @bug 6582545 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6582545Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6582545Test * @run testng/othervm dom.Bug6582545Test * @summary Test the value is correct when iterating attributes. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6879614Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6879614Test.java index 1e0f9da9f24..08f6530e7b4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6879614Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/Bug6879614Test.java @@ -39,7 +39,7 @@ * @test * @bug 6879614 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.Bug6879614Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.Bug6879614Test * @run testng/othervm dom.Bug6879614Test * @summary Test DocumentBuilder can parse the certain xml. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6333993Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6333993Test.java index a706ae2bb31..b32d8b1d904 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6333993Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6333993Test.java @@ -42,7 +42,7 @@ * @test * @bug 6333993 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.CR6333993Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.CR6333993Test * @run testng/othervm dom.CR6333993Test * @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517707Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517707Test.java index 90102a0afd2..58c4019bffa 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517707Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517707Test.java @@ -44,7 +44,7 @@ * @test * @bug 6517707 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.CR6517707Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.CR6517707Test * @run testng/othervm dom.CR6517707Test * @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517717Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517717Test.java index 0d73cd4fee7..70f1cb68e1b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517717Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6517717Test.java @@ -43,7 +43,7 @@ * @test * @bug 6517717 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.CR6517717Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.CR6517717Test * @run testng/othervm dom.CR6517717Test * @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6909336Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6909336Test.java index ea91169b203..ccae3a55e06 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/CR6909336Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/CR6909336Test.java @@ -38,7 +38,7 @@ * @test * @bug 6909336 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.CR6909336Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.CR6909336Test * @run testng/othervm dom.CR6909336Test * @summary Test DOM writer can write more that 20 nested elements. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java index 528736f11e8..b3aa2d812f5 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java @@ -59,7 +59,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.DOMConfigurationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.DOMConfigurationTest * @run testng/othervm dom.DOMConfigurationTest * @summary Test DOMConfiguration for supported properties. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/DOMXPathTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/DOMXPathTest.java index b43e694a575..94a2dcdeb78 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/DOMXPathTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/DOMXPathTest.java @@ -34,7 +34,7 @@ * @test * @bug 8042244 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.DOMXPathTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.DOMXPathTest * @run testng/othervm dom.DOMXPathTest * @summary Verifies that the experimental DOM L3 XPath implementation is no longer available. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ElementTraversal.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ElementTraversal.java index 72a56b8a9a8..f72c9739c75 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ElementTraversal.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ElementTraversal.java @@ -40,7 +40,7 @@ * @test * @bug 8135283 8138721 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ElementTraversal + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ElementTraversal * @run testng/othervm dom.ElementTraversal * @summary Tests for the Element Traversal interface. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java index f07ac57c7b2..80e67d416f1 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java @@ -32,7 +32,7 @@ * @test * @bug 8078139 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.JdkXmlDomTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.JdkXmlDomTest * @run testng/othervm dom.JdkXmlDomTest * @summary Verifies that jdk.xml.dom classes are loaded by the ext class loader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java index 6f71906ee9d..24ec0476b8f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.TCKEncodingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.TCKEncodingTest * @run testng/othervm dom.TCKEncodingTest * @summary Test Document.getInputEncoding(). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java index b6bdd0f606c..d360a27f042 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java @@ -53,7 +53,7 @@ * @test * @bug 4973153 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.Bug4973153 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.Bug4973153 * @run testng/othervm dom.ls.Bug4973153 * @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java index 745c31c8d2b..2a362a9f4a5 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java @@ -47,7 +47,7 @@ * @test * @bug 6290947 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6290947 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.Bug6290947 * @run testng/othervm dom.ls.Bug6290947 * @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and * LSSerializer's configuration set parameter "xml-declaration" to "true". diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java index 91507e97700..76c013f4d7c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java @@ -44,7 +44,7 @@ * @test * @bug 6354955 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6354955 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.Bug6354955 * @run testng/othervm dom.ls.Bug6354955 * @summary Test LSSerializer can writeToString on DOM Text node with white space. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java index 07541e8fee3..429949ad7f2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java @@ -47,7 +47,7 @@ * @test * @bug 6376823 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6376823 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.Bug6376823 * @run testng/othervm dom.ls.Bug6376823 * @summary Test LSSerializer works. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java index 3f4f1ffb0c4..c0eafb0f014 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java @@ -38,7 +38,7 @@ * @test * @bug 6710741 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6710741Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.Bug6710741Test * @run testng/othervm dom.ls.Bug6710741Test * @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java index 8c39f248400..825d3f56596 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTCKTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.LSParserTCKTest * @run testng/othervm dom.ls.LSParserTCKTest * @summary Test Specifications and Descriptions for LSParser. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java index 18b50f2daed..4a999b5cb14 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.LSParserTest * @run testng/othervm dom.ls.LSParserTest * @summary Test LSParser's DOMConfiguration for supported properties. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java index a9f15c33cf9..3cf602c82a4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java @@ -55,7 +55,7 @@ * @test * @bug 8080906 8114834 8206132 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true dom.ls.LSSerializerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow dom.ls.LSSerializerTest * @run testng/othervm dom.ls.LSSerializerTest * @summary Test LSSerializer. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java index 7da0d602d7e..dda14b2b36c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/BaseParsingTest.java @@ -48,7 +48,7 @@ * @test * @bug 8169450 8222415 8219692 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.BaseParsingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.BaseParsingTest * @run testng/othervm parsers.BaseParsingTest * @summary Tests that verify base parsing */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java index 1713fff6d62..93d6782c358 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java @@ -37,7 +37,7 @@ * @test * @bug 4674384 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4674384_MAX_OCCURS_Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4674384_MAX_OCCURS_Test * @run testng/othervm parsers.Bug4674384_MAX_OCCURS_Test * @summary Test large maxOccurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4934208.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4934208.java index 743f236302b..f885a244cc2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4934208.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4934208.java @@ -39,7 +39,7 @@ * @test * @bug 4934208 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4934208 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4934208 * @run testng/othervm parsers.Bug4934208 * @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4967002.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4967002.java index d0797a2f669..79dd7d326ef 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4967002.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4967002.java @@ -41,7 +41,7 @@ * @test * @bug 4967002 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4967002 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4967002 * @run testng/othervm parsers.Bug4967002 * @summary Test DocumentBuilderFactory.newDocumentBuilder() throws ParserConfigurationException * when it uses the "http://java.sun.com/xml/jaxp/properties/schemaSource" property diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4985486.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4985486.java index 3fb179751e6..fb1c722be19 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4985486.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4985486.java @@ -35,7 +35,7 @@ * @test * @bug 4985486 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4985486 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4985486 * @run testng/othervm parsers.Bug4985486 * @summary Test SAXParser can parse large characters(more than 10000). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991020.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991020.java index c0be7b47a04..59ae3bb4f06 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991020.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991020.java @@ -33,7 +33,7 @@ * @test * @bug 4991020 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4991020 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4991020 * @run testng/othervm parsers.Bug4991020 * @summary Test XPath like "node_name/." can be parsed. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991946.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991946.java index 9213a59508d..e9e658d5064 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991946.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug4991946.java @@ -33,7 +33,7 @@ * @test * @bug 4991946 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug4991946 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug4991946 * @run testng/othervm parsers.Bug4991946 * @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5010072.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5010072.java index 04346c89fea..872ba1b3e4f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5010072.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5010072.java @@ -36,7 +36,7 @@ * @test * @bug 5010072 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug5010072 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug5010072 * @run testng/othervm parsers.Bug5010072 * @summary Test SchemaFactory throws SAXException if xpath is "@". */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5025825.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5025825.java index 9f8cbcb4111..340bd12d867 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5025825.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug5025825.java @@ -42,7 +42,7 @@ * @test * @bug 5025825 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug5025825 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug5025825 * @run testng/othervm parsers.Bug5025825 * @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property * and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException. diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6309988.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6309988.java index 75fc8adfdd4..83a66f3ce06 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6309988.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6309988.java @@ -45,7 +45,7 @@ * @test * @bug 6309988 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6309988 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6309988 * @run testng/othervm parsers.Bug6309988 * @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6341770.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6341770.java index 1bf27aa09a0..3c0998b57a8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6341770.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6341770.java @@ -45,7 +45,7 @@ * @test * @bug 6341770 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6341770 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6341770 * @run testng/othervm parsers.Bug6341770 * @summary Test external entity linked to non-ASCII base URL. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6361283.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6361283.java index 5a76ae9992e..38fd631114b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6361283.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6361283.java @@ -34,7 +34,7 @@ * @test * @bug 6361283 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6361283 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6361283 * @run testng/othervm parsers.Bug6361283 * @summary Test SAXParser returns version as 1.1 for XML 1.1 document. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java index 98f2e96418d..fab882af2ee 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java @@ -37,7 +37,7 @@ * @test * @bug 6506304 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6506304Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6506304Test * @run testng/othervm parsers.Bug6506304Test * @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6518733.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6518733.java index 37ee4cc57f4..459aa086e4d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6518733.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6518733.java @@ -39,7 +39,7 @@ * @test * @bug 6518733 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6518733 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6518733 * @run testng/othervm parsers.Bug6518733 * @summary Test SAX parser handles several attributes that each contain a newline within the attribute value. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6564400.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6564400.java index e427478c427..930151d0f4d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6564400.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6564400.java @@ -50,7 +50,7 @@ * @test * @bug 6564400 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6564400 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6564400 * @run testng/othervm parsers.Bug6564400 * @summary Test ignorable whitespace handling with schema validation. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6573786.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6573786.java index 87953ae836b..41cc1c29a36 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6573786.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6573786.java @@ -36,7 +36,7 @@ * @test * @bug 6573786 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6573786 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6573786 * @run testng/othervm parsers.Bug6573786 * @summary Test parser error messages are formatted. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6594813.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6594813.java index 7e168d90cd4..2c9ba167249 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6594813.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6594813.java @@ -43,7 +43,7 @@ * @test * @bug 6594813 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6594813 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6594813 * @run testng/othervm parsers.Bug6594813 * @summary Test SAXParser output is wellformed with name space. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6608841.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6608841.java index 9c638368cc6..c18f144a3f4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6608841.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6608841.java @@ -39,7 +39,7 @@ * @test * @bug 6608841 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6608841 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6608841 * @run testng/othervm parsers.Bug6608841 * @summary Test SAX parses external parameter entity. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6690015.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6690015.java index a866ee56a81..6149805a0f6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6690015.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6690015.java @@ -41,7 +41,7 @@ * @test * @bug 6518733 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6690015 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6690015 * @run testng/othervm parsers.Bug6690015 * @summary Test SAX parser handles several attributes with newlines. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6760982.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6760982.java index a1cdcac7054..b6d3de02d98 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6760982.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6760982.java @@ -43,7 +43,7 @@ * @test * @bug 6518733 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6760982 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6760982 * @run testng/othervm parsers.Bug6760982 * @summary Test SAX parser handles several attributes with containing ">". */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java index f2266d24e1c..2e4f8d936e4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java @@ -39,7 +39,7 @@ * @test * @bug 6849942 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug6849942Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug6849942Test * @run testng/othervm parsers.Bug6849942Test * @summary Test parsing an XML that starts with a processing instruction and no prolog. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java index 6fb819bf9ec..28e9072b209 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java @@ -45,7 +45,7 @@ * @test * @bug 7157608 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug7157608Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug7157608Test * @run testng/othervm parsers.Bug7157608Test * @summary Test feature standard-uri-conformant works. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java index ec25ae28d80..9de25e9aa1f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java @@ -39,7 +39,7 @@ * @test * @bug 7166896 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug7166896Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug7166896Test * @run testng/othervm parsers.Bug7166896Test * @summary Test DocumentBuilder.parse(String uri) supports IPv6 format. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java index 2cab8f85f52..ddabbcd998d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java @@ -26,7 +26,7 @@ * @bug 8003147 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @compile -g Bug8003147TestClass.java - * @run testng/othervm -DrunSecMngr=true parsers.Bug8003147Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug8003147Test * @run testng/othervm parsers.Bug8003147Test * @summary Test port fix for BCEL bug 39695. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8073385.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8073385.java index aef8e65f838..4349a8cbdcc 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8073385.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/Bug8073385.java @@ -44,7 +44,7 @@ * @test * @bug 8073385 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.Bug8073385 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.Bug8073385 * @run testng/othervm parsers.Bug8073385 * @summary test that invalid XML character exception string contains * information about character value, element and attribute names diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java index d45e6702fc0..b6a2a394769 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.FactoryFindTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.FactoryFindTest * @run testng/othervm parsers.FactoryFindTest * @summary Test Classloader for SAXParserFactory. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/HandleError.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/HandleError.java index 0a3e35c5dd3..9a842561ab0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/HandleError.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/HandleError.java @@ -39,7 +39,7 @@ * @test * @bug 8157797 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.HandleError + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.HandleError * @run testng/othervm parsers.HandleError * @summary Tests that the parser handles errors properly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java index c3159cf50cd..dc554f259df 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.ParseEmptyStream + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.ParseEmptyStream * @run testng/othervm parsers.ParseEmptyStream * @summary Test SAXParser doesn't accept empty stream. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java index 5b4e018e757..60f95005760 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java @@ -14,7 +14,7 @@ * @test * @bug 8072081 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.SupplementaryChars + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.SupplementaryChars * @run testng/othervm parsers.SupplementaryChars * @summary verifies that supplementary characters are supported as character * data in xml 1.0, and also names in xml 1.1. diff --git a/test/jaxp/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java b/test/jaxp/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java index 8385d40c47f..421e4109cda 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java @@ -46,7 +46,7 @@ * @test * @bug 6794483 8080908 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true parsers.xinclude.Bug6794483Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow parsers.xinclude.Bug6794483Test * @run testng/othervm parsers.xinclude.Bug6794483Test * @summary Test JAXP parser can resolve the included content properly if the * included xml contains an empty tag that ends with "/>", refer to XERCESJ-1134. diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java index 982bc8e595b..22c7f5b048b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java @@ -31,7 +31,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Attributes2ImplTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Attributes2ImplTest * @run testng/othervm sax.Attributes2ImplTest * @summary Test Attributes2Impl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6889654Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6889654Test.java index 7eb7a59fe8f..3a82f58dca8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6889654Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6889654Test.java @@ -40,7 +40,7 @@ * @test * @bug 6889654 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Bug6889654Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Bug6889654Test * @run testng/othervm sax.Bug6889654Test * @summary Test SAXException includes whole information. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6925410Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6925410Test.java index df006578c0c..f735b8c869f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6925410Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6925410Test.java @@ -34,7 +34,7 @@ * @test * @bug 6925410 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Bug6925410Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Bug6925410Test * @run testng/othervm sax.Bug6925410Test * @summary Test XMLReaderFactory can createXMLReader repeatedly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6949607Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6949607Test.java index 1ba064fa56b..ba2c3656563 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6949607Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6949607Test.java @@ -39,7 +39,7 @@ * @test * @bug 6949607 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Bug6949607Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Bug6949607Test * @run testng/othervm sax.Bug6949607Test * @summary Test Attributes.getValue returns null when parameter uri is empty. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6992561Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6992561Test.java index 7d05dd7f0a9..49ea6ea06f3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6992561Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug6992561Test.java @@ -44,7 +44,7 @@ * @test * @bug 6992561 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Bug6992561Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Bug6992561Test * @run testng/othervm sax.Bug6992561Test * @summary Test encoding of SystemId in Locator. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug7057778Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug7057778Test.java index be6dbc986f8..fac75946702 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/Bug7057778Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/Bug7057778Test.java @@ -57,7 +57,7 @@ * @test * @bug 7057778 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.Bug7057778Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.Bug7057778Test * @run testng/othervm sax.Bug7057778Test * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java index a7bd3f59d0c..440999d8dbe 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java @@ -45,7 +45,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.DefaultHandler2Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.DefaultHandler2Test * @run testng/othervm sax.DefaultHandler2Test * @summary Test DefaultHandler2. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java b/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java index fbfef8f705b..102ef7d0900 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java @@ -43,7 +43,7 @@ * @test * @bug 6809409 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.IssueTracker56Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.IssueTracker56Test * @run testng/othervm sax.IssueTracker56Test * @summary Test SAXException has Cause. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/NSSupportTest.java b/test/jaxp/javax/xml/jaxp/unittest/sax/NSSupportTest.java index 32c4c5c05dc..5d16af21b86 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/NSSupportTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/NSSupportTest.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.NSSupportTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.NSSupportTest * @run testng/othervm sax.NSSupportTest * @summary Test NamespaceSupport. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/SymbolTableResetTest.java b/test/jaxp/javax/xml/jaxp/unittest/sax/SymbolTableResetTest.java index b56eb7ec9a9..19a2c4d9a6b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/SymbolTableResetTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/SymbolTableResetTest.java @@ -42,8 +42,8 @@ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng/othervm -Djdk.xml.resetSymbolTable=false sax.SymbolTableResetTest * @run testng/othervm -Djdk.xml.resetSymbolTable=true sax.SymbolTableResetTest - * @run testng/othervm -Djdk.xml.resetSymbolTable=false -DrunSecMngr=true sax.SymbolTableResetTest - * @run testng/othervm -Djdk.xml.resetSymbolTable=true -DrunSecMngr=true sax.SymbolTableResetTest + * @run testng/othervm -Djdk.xml.resetSymbolTable=false -DrunSecMngr=true -Djava.security.manager=allow sax.SymbolTableResetTest + * @run testng/othervm -Djdk.xml.resetSymbolTable=true -DrunSecMngr=true -Djava.security.manager=allow sax.SymbolTableResetTest * @summary Test that SAXParser reallocates symbol table during * subsequent parse operations */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/sax/XMLReaderTest.java b/test/jaxp/javax/xml/jaxp/unittest/sax/XMLReaderTest.java index cc234531a27..79c3bba3362 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/sax/XMLReaderTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/sax/XMLReaderTest.java @@ -39,7 +39,7 @@ * @test * @bug 8158246 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true sax.XMLReaderTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow sax.XMLReaderTest * @run testng/othervm sax.XMLReaderTest * @summary This class contains tests that cover the creation of XMLReader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java index 7aece9698f9..b949340123e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.AttributeLocalNameTest.AttributeLocalNameTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.AttributeLocalNameTest.AttributeLocalNameTest * @run testng/othervm stream.AttributeLocalNameTest.AttributeLocalNameTest * @summary Test XMLStreamReader.getAttributeLocalName(). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6370703.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6370703.java index ba8c7adee57..83413811fba 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6370703.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6370703.java @@ -34,7 +34,7 @@ * @test * @bug 6370703 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6370703 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6370703 * @run testng/othervm stream.Bug6370703 * @summary Test StAX parser can parse attribute default value when START_ELEMENT. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6378422.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6378422.java index 4fa70e2b73b..250721a4744 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6378422.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6378422.java @@ -33,7 +33,7 @@ * @test * @bug 6378422 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6378422 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6378422 * @run testng/othervm stream.Bug6378422 * @summary Test setting reuse-instance property on StAX factory. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6380870.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6380870.java index 0c584d0fe35..74223c6826c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6380870.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6380870.java @@ -34,7 +34,7 @@ * @test * @bug 6380870 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6380870 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6380870 * @run testng/othervm stream.Bug6380870 * @summary Test StAX parser can parse VoiceXML DTD. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6489502.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6489502.java index 832f74de959..debb318d470 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6489502.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6489502.java @@ -37,7 +37,7 @@ * @test * @bug 6489502 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6489502 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6489502 * @run testng/othervm stream.Bug6489502 * @summary Test XMLInputFactory works correctly in case it repeats to create reader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6509774.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6509774.java index 5c6a4106104..1f347385057 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6509774.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6509774.java @@ -35,7 +35,7 @@ * @test * @bug 6509774 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6509774 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6509774 * @run testng/othervm stream.Bug6509774 * @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6688002Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6688002Test.java index 1d1f728009d..4dfe360ac13 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6688002Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6688002Test.java @@ -43,7 +43,7 @@ * @test * @bug 6688002 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6688002Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6688002Test * @run testng/othervm stream.Bug6688002Test * @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6976938Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6976938Test.java index f4a40ef28e8..bef1b02e238 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6976938Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/Bug6976938Test.java @@ -38,7 +38,7 @@ * @test * @bug 6976938 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.Bug6976938Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.Bug6976938Test * @run testng/othervm stream.Bug6976938Test * @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "< ... >". */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java index 09a12ca7476..c6c4af176c7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.CoalesceTest.CoalesceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.CoalesceTest.CoalesceTest * @run testng/othervm stream.CoalesceTest.CoalesceTest * @summary Test Coalesce property works. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java index 24526e0dd9f..806be8572db 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java @@ -43,7 +43,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EntitiesTest.EntityTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EntitiesTest.EntityTest * @run testng/othervm stream.EntitiesTest.EntityTest * @summary Test StAX parses entity. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java index db93e02f55b..51da18e69c5 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EventReaderDelegateTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EventReaderDelegateTest * @run testng/othervm stream.EventReaderDelegateTest * @summary Test EventReaderDelegate. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java index 13f25d5adc0..d69808989e3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java @@ -55,7 +55,7 @@ * @test * @bug 6631268 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue41Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EventsTest.Issue41Test * @run testng/othervm stream.EventsTest.Issue41Test * @summary Test XMLEvent.writeAsEncodedUnicode can output the event content. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java index d4fa45bb789..870b3297be8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java @@ -44,7 +44,7 @@ * @test * @bug 6620632 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue48Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EventsTest.Issue48Test * @run testng/othervm stream.EventsTest.Issue48Test * @summary Test XMLEventReader can parse notation and entity information from DTD Event. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java index 1490e28269c..260a8c47316 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java @@ -33,7 +33,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue53Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EventsTest.Issue53Test * @run testng/othervm stream.EventsTest.Issue53Test * @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java index 6453fae9e06..61bba35daeb 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue58Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.EventsTest.Issue58Test * @run testng/othervm stream.EventsTest.Issue58Test * @summary Test XMLEvent.getLocation() returns a non-volatile Location. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/FactoryFindTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/FactoryFindTest.java index a0a538f2369..6650315ef16 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/FactoryFindTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/FactoryFindTest.java @@ -45,7 +45,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.FactoryFindTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.FactoryFindTest * @run testng/othervm stream.FactoryFindTest * @summary Test SaTX factory using factory property and using ContextClassLoader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java index 4610aff758e..fd9034eeb44 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.IgnoreExternalDTDTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.IgnoreExternalDTDTest * @run testng/othervm stream.IgnoreExternalDTDTest * @summary Test feature ignore-external-dtd. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java index 43e785f81e4..ed79ce0cf60 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.ProcessingInstructionTest.ProcessingInstructionTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.ProcessingInstructionTest.ProcessingInstructionTest * @run testng/othervm stream.ProcessingInstructionTest.ProcessingInstructionTest * @summary Test XMLStreamReader parses Processing Instruction. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java index 44c602e72d4..03a8863a180 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.StreamReaderDelegateTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.StreamReaderDelegateTest * @run testng/othervm stream.StreamReaderDelegateTest * @summary Test StreamReaderDelegate. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java index 0472899ebb2..aeaed26dafe 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventLocationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventLocationTest * @run testng/othervm stream.XMLEventLocationTest * @summary Test XMLEvent Location. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java index d98aec1caf8..687db31a91d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java @@ -36,7 +36,7 @@ * @test * @bug 6489890 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6489890 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6489890 * @run testng/othervm stream.XMLEventReaderTest.Bug6489890 * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java index ebb7cf87942..8d193d18188 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java @@ -40,7 +40,7 @@ * @test * @bug 6555001 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6555001 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6555001 * @run testng/othervm stream.XMLEventReaderTest.Bug6555001 * @summary Test StAX parser replaces the entity reference as setting. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java index 437dd9e602a..2da4cd7e88f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java @@ -37,7 +37,7 @@ * @test * @bug 6586466 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6586466Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6586466Test * @run testng/othervm stream.XMLEventReaderTest.Bug6586466Test * @summary Test XMLEventReader.nextTag() shall update internal event state. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java index 23531b463ec..ddc9e44f1f8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java @@ -37,7 +37,7 @@ * @test * @bug 6613059 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6613059Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6613059Test * @run testng/othervm stream.XMLEventReaderTest.Bug6613059Test * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java index f2b8ebe7e2f..1a52f698290 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java @@ -37,7 +37,7 @@ * @test * @bug 6668115 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6668115Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6668115Test * @run testng/othervm stream.XMLEventReaderTest.Bug6668115Test * @summary Test XMLEventReader.getElementText() shall update last event even if no peek. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java index 416c3e960bb..2f8c8871b8e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java @@ -33,7 +33,7 @@ * @test * @bug 6846133 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6846133Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug6846133Test * @run testng/othervm stream.XMLEventReaderTest.Bug6846133Test * @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java index 7c3b529afcf..b81d14e2477 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java @@ -40,7 +40,7 @@ * @test * @bug 8153781 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug8153781 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Bug8153781 * @run testng/othervm stream.XMLEventReaderTest.Bug8153781 * @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section, * even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true. diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java index 9ed53c57833..95f664dfee0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Issue40Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.Issue40Test * @run testng/othervm stream.XMLEventReaderTest.Issue40Test * @summary Test XMLEventReader.getElementText() works after calling peek(). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8201138.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8201138.java index 0ff6191cc31..0ed6b58895c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8201138.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8201138.java @@ -42,7 +42,7 @@ * @test * @bug 8201138 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.JDK8201138 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.JDK8201138 * @run testng/othervm stream.XMLEventReaderTest.JDK8201138 * @summary Verifies a fix that set the type and data properly in the loop */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8209615.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8209615.java index f0e143632d3..281f385c732 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8209615.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8209615.java @@ -35,7 +35,7 @@ * @test * @bug 8209615 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.JDK8209615 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventReaderTest.JDK8209615 * @run testng/othervm stream.XMLEventReaderTest.JDK8209615 * @summary Verifies that the parser continues parsing the character data */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java index 28b871afcd9..59a2bd313ab 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.ReaderToWriterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventWriterTest.ReaderToWriterTest * @run testng/othervm stream.XMLEventWriterTest.ReaderToWriterTest * @summary Test XMLEventWriter. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java index 3dd7e25de3c..afc23e959a4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.XMLEventWriterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLEventWriterTest.XMLEventWriterTest * @run testng/othervm stream.XMLEventWriterTest.XMLEventWriterTest * @summary Test XMLEventWriter. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java index 2e4b41dce2d..90187dd0cd6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java @@ -39,7 +39,7 @@ * @bug 6756677 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @compile MyInputFactory.java - * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6756677Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLInputFactoryTest.Bug6756677Test * @run testng/othervm stream.XMLInputFactoryTest.Bug6756677Test * @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java index 562b7a3d559..707518e0112 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java @@ -36,7 +36,7 @@ * @test * @bug 6909759 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6909759Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLInputFactoryTest.Bug6909759Test * @run testng/othervm stream.XMLInputFactoryTest.Bug6909759Test * @summary Test createXMLStreamReader with StreamSource. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java index a70288a9346..ab932b857dc 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.IssueTracker38 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLInputFactoryTest.IssueTracker38 * @run testng/othervm stream.XMLInputFactoryTest.IssueTracker38 * @summary Test createXMLEventReader from DOM or SAX source is unsupported. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java index aabfa430581..1129e4d522e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java @@ -37,7 +37,7 @@ * @test * @bug 6846132 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.Bug6846132Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLOutputFactoryTest.Bug6846132Test * @run testng/othervm stream.XMLOutputFactoryTest.Bug6846132Test * @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java index 99c12487cf7..d202dadecab 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest * @run testng/othervm stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest * @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java index 47b089ae55f..2ba4177d0a3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.StreamResultTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLOutputFactoryTest.StreamResultTest * @run testng/othervm stream.XMLOutputFactoryTest.StreamResultTest * @summary Test create XMLWriter with variant Result. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java index 628977e2656..e0e84869a2f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLResolverTest.XMLResolverTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLResolverTest.XMLResolverTest * @run testng/othervm stream.XMLResolverTest.XMLResolverTest * @summary Test XMLResolver. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java index 05f9aaecd0e..445fd457629 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamExceptionTest.ExceptionTest * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest * @summary Test XMLStreamException contains the message of the wrapped exception. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java index 87e70ab9cd9..a73129a4ee7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java @@ -37,7 +37,7 @@ * @test * @bug 6481615 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481615 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamFilterTest.Bug6481615 * @run testng/othervm stream.XMLStreamFilterTest.Bug6481615 * @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java index daec8fb9cd2..7a83b01a0d9 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java @@ -42,7 +42,7 @@ * @test * @bug 6481678 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481678 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamFilterTest.Bug6481678 * @run testng/othervm stream.XMLStreamFilterTest.Bug6481678 * @summary Test Filtered XMLStreamReader parses namespace correctly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java index ad4c50dce75..918e4ff77a9 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.HasNextTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamFilterTest.HasNextTest * @run testng/othervm stream.XMLStreamFilterTest.HasNextTest * @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java index 93e934c7fe3..9981b8cdc8d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java @@ -34,7 +34,7 @@ * @test * @bug 6218794 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BOMTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.BOMTest * @run testng/othervm stream.XMLStreamReaderTest.BOMTest * @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java index 5c8096b45af..782cef14452 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java @@ -43,7 +43,7 @@ * @test * @bug 6388460 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6388460 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Bug6388460 * @run testng/othervm stream.XMLStreamReaderTest.Bug6388460 * @summary Test StAX parser can parse UTF-16 wsdl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java index a4bec110fe9..b67b39cd096 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java @@ -37,7 +37,7 @@ * @test * @bug 6472982 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6472982Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Bug6472982Test * @run testng/othervm stream.XMLStreamReaderTest.Bug6472982Test * @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java index 49f03ca4ba0..8b13cba975a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java @@ -36,7 +36,7 @@ * @test * @bug 6767322 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6767322Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Bug6767322Test * @run testng/othervm stream.XMLStreamReaderTest.Bug6767322Test * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java index cdf353ecafe..bfec69af143 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java @@ -35,7 +35,7 @@ * @test * @bug 6847819 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6847819Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Bug6847819Test * @run testng/othervm stream.XMLStreamReaderTest.Bug6847819Test * @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java index 508b52e41dd..073d782a8b3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java @@ -39,7 +39,7 @@ * @test * @bug 8069098 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.BugTest * @run testng/othervm stream.XMLStreamReaderTest.BugTest * @summary Test StAX parser can parse xml without declaration. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java index 898bf3e3332..3dbd217976d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java @@ -40,7 +40,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DefaultAttributeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.DefaultAttributeTest * @run testng/othervm stream.XMLStreamReaderTest.DefaultAttributeTest * @summary Test StAX parses namespace and attribute. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java index 1b47db5f4b3..0ba48680086 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DoubleXmlnsTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.DoubleXmlnsTest * @run testng/othervm stream.XMLStreamReaderTest.DoubleXmlnsTest * @summary Test double namespaces and nested namespaces. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java index 44c0c1fcd2c..84de5d22a27 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java @@ -35,7 +35,7 @@ * @test * @bug 6440324 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IsValidatingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.IsValidatingTest * @run testng/othervm stream.XMLStreamReaderTest.IsValidatingTest * @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java index f4f8f5dbdc0..497c5b13162 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java @@ -34,7 +34,7 @@ * @test * @bug 6631262 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue44Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Issue44Test * @run testng/othervm stream.XMLStreamReaderTest.Issue44Test * @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java index 7d456463a4b..c74569dd49c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java @@ -37,7 +37,7 @@ * @test * @bug 6631265 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue47Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Issue47Test * @run testng/othervm stream.XMLStreamReaderTest.Issue47Test * @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java index 1d7041d58b2..9faa9028a68 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker24 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.IssueTracker24 * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker24 * @summary Test no prefix is represented by "", not null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java index 2cc0a483ae6..197ffbd9cf7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java @@ -36,7 +36,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker35 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.IssueTracker35 * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker35 * @summary Test StAX parse xsd document including external DTD. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java index c107c18110f..277eed57037 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker70 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.IssueTracker70 * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker70 * @summary Test it can retrieve attribute with null or empty name space. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java index 0c753ac3be4..5898049acbb 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req5Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Jsr173MR1Req5Test * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req5Test * @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java index 49908781cd1..6d2755480c0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java @@ -34,7 +34,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req8Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.Jsr173MR1Req8Test * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req8Test * @summary Test XMLStreamReader parses attribute with namespace aware. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java index 334011befc7..a90e465b922 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.NamespaceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.NamespaceTest * @run testng/othervm stream.XMLStreamReaderTest.NamespaceTest * @summary Test StAX parser processes namespace. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java index cc8ac7bbd9f..3d83e2342f6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java @@ -37,7 +37,7 @@ * @test * @bug 8167340 8204329 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.StreamReaderTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.StreamReaderTest * @run testng/othervm stream.XMLStreamReaderTest.StreamReaderTest * @summary Verifies patches for StreamReader bugs */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java index bfdfb76e06f..0fa1183302b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java @@ -44,7 +44,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.SupportDTDTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.SupportDTDTest * @run testng/othervm stream.XMLStreamReaderTest.SupportDTDTest * @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java index a31b445880c..6e771ad4ceb 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java @@ -33,7 +33,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.VoiceXMLDTDTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.VoiceXMLDTDTest * @run testng/othervm stream.XMLStreamReaderTest.VoiceXMLDTDTest * @summary Test parsing Voice XML DTD. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java index 95a88e5eb4b..be495f03af7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java @@ -33,7 +33,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.XML11Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamReaderTest.XML11Test * @run testng/othervm stream.XMLStreamReaderTest.XML11Test * @summary Test parsing xml 1.1. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java index e7378e11170..971a89535a2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.AttributeEscapeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.AttributeEscapeTest * @run testng/othervm stream.XMLStreamWriterTest.AttributeEscapeTest * @summary Test XMLStreamWriter shall escape the illegal characters. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java index 35472f0713d..82205353cab 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java @@ -38,7 +38,7 @@ * @test * @bug 6452107 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6452107 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.Bug6452107 * @run testng/othervm stream.XMLStreamWriterTest.Bug6452107 * @summary Test StAX can write ISO-8859-1 encoding XML. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java index e17b04da265..11e0c2d1319 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java @@ -36,7 +36,7 @@ * @test * @bug 6600882 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6600882Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.Bug6600882Test * @run testng/othervm stream.XMLStreamWriterTest.Bug6600882Test * @summary Test toString(), hashCode() of XMLStreamWriter . */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java index 0e4f0aa22f5..b89cda5758c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java @@ -39,7 +39,7 @@ * @test * @bug 6675332 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6675332Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.Bug6675332Test * @run testng/othervm stream.XMLStreamWriterTest.Bug6675332Test * @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java index 8729d9f2711..2d683464430 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java @@ -37,7 +37,7 @@ * @test * @bug 7037352 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug7037352Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.Bug7037352Test * @run testng/othervm stream.XMLStreamWriterTest.Bug7037352Test * @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java index bef8db02e6e..c33092534e0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.DomUtilTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.DomUtilTest * @run testng/othervm stream.XMLStreamWriterTest.DomUtilTest * @summary Test XMLStreamWriter writes a soap message. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java index d40bcae712c..bb91e14c720 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EmptyElementTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.EmptyElementTest * @run testng/othervm stream.XMLStreamWriterTest.EmptyElementTest * @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java index ced54992790..ad1e9e2c4be 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EncodingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.EncodingTest * @run testng/othervm stream.XMLStreamWriterTest.EncodingTest * @summary Test XMLStreamWriter writes a document with encoding setting. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java index 7e574bc879f..ae268155e0c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java @@ -38,7 +38,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NamespaceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.NamespaceTest * @run testng/othervm stream.XMLStreamWriterTest.NamespaceTest * @summary Test the writing of Namespaces. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java index 00f7a62dada..1170fb0ffb9 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java @@ -35,7 +35,7 @@ * @test * @bug 6391922 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NullUriDetectionTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.NullUriDetectionTest * @run testng/othervm stream.XMLStreamWriterTest.NullUriDetectionTest * @summary Test XMLStreamWriter can writeDefaultNamespace(null). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java index ea71a065817..f6234bc4412 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SqeLinuxTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.SqeLinuxTest * @run testng/othervm stream.XMLStreamWriterTest.SqeLinuxTest * @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java index 4af0c3df23a..cadc7fbc40e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java @@ -44,7 +44,7 @@ * @test * @bug 8145974 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SurrogatesTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.SurrogatesTest * @run testng/othervm stream.XMLStreamWriterTest.SurrogatesTest * @summary Check that XMLStreamWriter generates valid xml with surrogate pair * used within element text diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java index 68fab1bdb5b..4fc07a4894f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java @@ -35,7 +35,7 @@ * @test * @bug 6394074 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.UnprefixedNameTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.UnprefixedNameTest * @run testng/othervm stream.XMLStreamWriterTest.UnprefixedNameTest * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java index abb9957a256..f0ba0306e10 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.WriterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.WriterTest * @run testng/othervm stream.XMLStreamWriterTest.WriterTest * @summary Test XMLStreamWriter functionality. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java index 832f9e38e3b..894a9c96c88 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java @@ -44,7 +44,7 @@ * @test * @bug 6347190 8139584 8216408 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.XMLStreamWriterTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamWriterTest.XMLStreamWriterTest * @run testng/othervm stream.XMLStreamWriterTest.XMLStreamWriterTest * @summary Tests XMLStreamWriter. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4693341Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4693341Test.java index 1e4266d65e7..12b30b07d7c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4693341Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4693341Test.java @@ -48,7 +48,7 @@ * @test * @bug 4693341 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug4693341Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug4693341Test * @run testng/othervm transform.Bug4693341Test * @summary Test transform with external dtd. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4892774.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4892774.java index 0419c1cf8bc..a69d21e4899 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4892774.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug4892774.java @@ -50,7 +50,7 @@ * @test * @bug 4892774 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug4892774 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug4892774 * @run testng/othervm transform.Bug4892774 * @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug5073477.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug5073477.java index eb8853da891..f4163861734 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug5073477.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug5073477.java @@ -35,7 +35,7 @@ * @test * @bug 5073477 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug5073477 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug5073477 * @run testng/othervm transform.Bug5073477 * @summary Test DOMResult.setNextSibling works correctly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6175602.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6175602.java index dede016d4ff..b6ca27670a2 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6175602.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6175602.java @@ -36,7 +36,7 @@ * @test * @bug 6175602 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6175602 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6175602 * @run testng/othervm transform.Bug6175602 * @summary Test compilation of MsWordXMLImport.xsl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6206491.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6206491.java index 2c60db3cc3d..a90da9e0917 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6206491.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6206491.java @@ -49,7 +49,7 @@ * @test * @bug 6206491 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6206491 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6206491 * @run testng/othervm transform.Bug6206491 * @summary Test key searches over more than one document. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6216226Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6216226Test.java index 9ba16dbc9c1..1936e1bb05e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6216226Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6216226Test.java @@ -43,7 +43,7 @@ * @test * @bug 6216226 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6216226Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6216226Test * @run testng/othervm transform.Bug6216226Test * @summary Test StreamResult(File) is closed after transform(). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6311448.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6311448.java index 9cfec4471f3..c3eaca59f1e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6311448.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6311448.java @@ -42,7 +42,7 @@ * @test * @bug 6311448 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6311448 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6311448 * @run testng/othervm transform.Bug6311448 * @summary Test XML transformer can output Unicode surrorate pair. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6384805.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6384805.java index b32d1d83524..e4069b33256 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6384805.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6384805.java @@ -42,7 +42,7 @@ * @test * @bug 6384805 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6384805 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6384805 * @run testng/othervm transform.Bug6384805 * @summary Test XSLTC can parse XML namespace when nodeset is created within a template. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6465722.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6465722.java index ecf248b8523..1efacc7ce35 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6465722.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6465722.java @@ -42,7 +42,7 @@ * @test * @bug 6465722 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6465722 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6465722 * @run testng/othervm transform.Bug6465722 * @summary Test Transformer can transform the node attribute prefixed with a namespace. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6467808.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6467808.java index 61c6692b755..fa6a287bc1a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6467808.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6467808.java @@ -40,7 +40,7 @@ * @test * @bug 6467808 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6467808 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6467808 * @run testng/othervm transform.Bug6467808 * @summary Test Transformer can parse re-declare prefixed namespace mappings. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490380.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490380.java index 255dd878c4e..851fac70837 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490380.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490380.java @@ -39,7 +39,7 @@ * @test * @bug 6490380 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6490380 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6490380 * @run testng/othervm transform.Bug6490380 * @summary Test only a single DOCTYPE declaration is generated through transforming. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490921.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490921.java index f9bea6978a1..e2d2b179218 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490921.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6490921.java @@ -49,7 +49,7 @@ * @test * @bug 6490921 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6490921 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6490921 * @run testng/othervm transform.Bug6490921 * @summary Test property org.xml.sax.driver is always applied in transformer API. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6513892.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6513892.java index acb81122327..145de8eecf0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6513892.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6513892.java @@ -42,7 +42,7 @@ * @test * @bug 6513892 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6513892 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6513892 * @run testng/othervm transform.Bug6513892 * @summary Test the output encoding of the transform is the same as that of the redirect extension. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6537167.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6537167.java index 6c1938e4afd..97cbbbd1b1d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6537167.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6537167.java @@ -39,7 +39,7 @@ * @test * @bug 6537167 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6537167 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6537167 * @run testng/othervm transform.Bug6537167 * @summary Test transforming for particular xsl files. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6540545.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6540545.java index 22182435206..1323cdff886 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6540545.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6540545.java @@ -38,7 +38,7 @@ * @test * @bug 6540545 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6540545 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6540545 * @run testng/othervm transform.Bug6540545 * @summary Test XSLT as expected. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6551616.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6551616.java index 27c6ddf008c..dddbbea396b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6551616.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6551616.java @@ -25,7 +25,7 @@ * @test * @bug 6551616 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6551616 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6551616 * @run testng/othervm transform.Bug6551616 * @summary Test SAX2StAXEventWriter. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6559595.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6559595.java index f1d4c3d8cfe..6f3481a463e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6559595.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6559595.java @@ -42,7 +42,7 @@ * @test * @bug 6559595 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6559595 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6559595 * @run testng/othervm transform.Bug6559595 * @summary Test ampersand in href attribute is not handled specially even if output is set to HTML. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6565260.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6565260.java index df14bc37603..d8c3218ae37 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6565260.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6565260.java @@ -38,7 +38,7 @@ * @test * @bug 6565260 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6565260 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6565260 * @run testng/othervm transform.Bug6565260 * @summary Test use-attribute-sets attribute is not used for the root node. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6940416.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6940416.java index e00da88993c..7a621141bc7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6940416.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Bug6940416.java @@ -46,7 +46,7 @@ * @test * @bug 6940416 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Bug6940416 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Bug6940416 * @run testng/othervm transform.Bug6940416 * @summary Test transforming correctly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java index ecd61f603ec..a68f805521f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java @@ -50,7 +50,7 @@ * @test * @bug 6935697 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.BugDB12665704Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.BugDB12665704Test * @run testng/othervm transform.BugDB12665704Test * @summary Test Transformer can compile large xsl file. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CLITest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CLITest.java index 57f3009b682..883e5ace08a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CLITest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CLITest.java @@ -24,7 +24,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CLITest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CLITest * @run testng/othervm transform.CLITest * @summary Test internal transform CLI. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6401137Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6401137Test.java index b17df311824..62220163c0d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6401137Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6401137Test.java @@ -44,7 +44,7 @@ * @test * @bug 6401137 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6401137Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6401137Test * @run testng/othervm transform.CR6401137Test * @summary Test transform certain xsl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6551600Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6551600Test.java index 615a973be02..2c1764d39f3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6551600Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6551600Test.java @@ -49,7 +49,7 @@ * @bug 6551600 * @requires os.family == "windows" * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6551600Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6551600Test * @run testng/othervm transform.CR6551600Test * @summary Test using UNC path as StreamResult. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6577667Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6577667Test.java index fec10a1be1b..cac380f1a50 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6577667Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6577667Test.java @@ -37,7 +37,7 @@ * @test * @bug 6577667 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6577667Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6577667Test * @run testng/othervm transform.CR6577667Test * @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6652519Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6652519Test.java index 2bfe0631a71..505d5930b45 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6652519Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6652519Test.java @@ -41,7 +41,7 @@ * @test * @bug 6652519 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6652519Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6652519Test * @run testng/othervm transform.CR6652519Test * @summary Test transfoming from StreamSource to DOMResult. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6689809Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6689809Test.java index 5ad290060ac..97f0f82e9da 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6689809Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6689809Test.java @@ -37,7 +37,7 @@ * @test * @bug 6689809 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6689809Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6689809Test * @run testng/othervm transform.CR6689809Test * @summary Test Transformer can handle XPath predicates in xsl:key elements. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6905829Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6905829Test.java index 78006b5c8f4..9b9aa76ae45 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6905829Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6905829Test.java @@ -39,7 +39,7 @@ * @test * @bug 6905829 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6905829Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6905829Test * @run testng/othervm transform.CR6905829Test * @summary Test XSLT can parse certain xsl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6935697Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6935697Test.java index fe65ee0e7a9..744dfdee274 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6935697Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6935697Test.java @@ -43,7 +43,7 @@ * @test * @bug 6935697 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6935697Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6935697Test * @run testng/othervm transform.CR6935697Test * @summary Test XSLT can parse the certain xsl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6941869Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6941869Test.java index 13331ce4cc1..f6a3dd2275b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6941869Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6941869Test.java @@ -39,7 +39,7 @@ * @test * @bug 6941869 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6941869Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6941869Test * @run testng/othervm transform.CR6941869Test * @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6957215Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6957215Test.java index 24c3bfd4318..1e18d7c7478 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR6957215Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR6957215Test.java @@ -46,7 +46,7 @@ * @test * @bug 6957215 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR6957215Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR6957215Test * @run testng/othervm transform.CR6957215Test * @summary Test XSLT generates the element content using xsl:attribute instructions. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/CR7098746Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/CR7098746Test.java index 04ec9fd8ea3..b39593295a8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/CR7098746Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/CR7098746Test.java @@ -41,7 +41,7 @@ * @test * @bug 7098746 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.CR7098746Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.CR7098746Test * @run testng/othervm transform.CR7098746Test * @summary Test transforming as expected. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/DOMResultTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/DOMResultTest.java index cbfaf0f924a..d69cf7af210 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/DOMResultTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/DOMResultTest.java @@ -49,7 +49,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.DOMResultTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.DOMResultTest * @run testng/othervm transform.DOMResultTest * @summary Test DOMResult. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/FactoryFindTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/FactoryFindTest.java index f1267ce4622..3486215c490 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/FactoryFindTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/FactoryFindTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.FactoryFindTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.FactoryFindTest * @run testng/othervm transform.FactoryFindTest * @summary Test creating TransformerFactory with ContextClassLoader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2204Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2204Test.java index dbba31b46dc..398f935a648 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2204Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2204Test.java @@ -38,7 +38,7 @@ * @test * @bug 6905829 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Issue2204Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Issue2204Test * @run testng/othervm transform.Issue2204Test * @summary Test XSLT can work against the certain xsl. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2290Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2290Test.java index 8047d83fec1..35f7aa6fc40 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2290Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/Issue2290Test.java @@ -47,7 +47,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.Issue2290Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.Issue2290Test * @run testng/othervm transform.Issue2290Test * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/NamespacePrefixTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/NamespacePrefixTest.java index 6602286fe90..44a7822479e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/NamespacePrefixTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/NamespacePrefixTest.java @@ -46,7 +46,7 @@ * @test * @bug 8167179 * @library /javax/xml/jaxp/libs - * @run testng/othervm -DrunSecMngr=true transform.NamespacePrefixTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.NamespacePrefixTest * @run testng/othervm transform.NamespacePrefixTest * @summary This class tests the generation of namespace prefixes */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java b/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java index 8aff9628bba..425468ef26a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java @@ -40,7 +40,7 @@ * @test * @bug 6883209 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.OpenJDK100017Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.OpenJDK100017Test * @run testng/othervm transform.OpenJDK100017Test * @summary Test XSLT won't cause StackOverflow when it handle many characters. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java index 34e092101bc..673c4b212f8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java @@ -48,7 +48,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.SAX2DOMTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.SAX2DOMTest * @run testng/othervm transform.SAX2DOMTest * @summary Test Transforming from SAX to DOM. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java index 569d987ab73..b46e6d7e480 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.SecureProcessingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.SecureProcessingTest * @run testng/othervm transform.SecureProcessingTest * @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/SourceTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/SourceTest.java index dd92c26065a..a8589c1ece3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/SourceTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/SourceTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.SourceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.SourceTest * @run testng/othervm transform.SourceTest * @summary Test Sources. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/StAXSourceTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/StAXSourceTest.java index 29d08e3e56b..78a397969d7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/StAXSourceTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/StAXSourceTest.java @@ -61,7 +61,7 @@ * @modules java.xml/com.sun.xml.internal.stream * @clean MyXMLInputFactoryImpl MyXMLStreamReader * @build MyXMLInputFactoryImpl MyXMLStreamReader - * @run testng/othervm -DrunSecMngr=true transform.StAXSourceTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.StAXSourceTest * @run testng/othervm transform.StAXSourceTest * @summary Test parsing from StAXSource. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/StylesheetTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/StylesheetTest.java index cf6aa98f30f..29d211db788 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/StylesheetTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/StylesheetTest.java @@ -38,7 +38,7 @@ * @test * @bug 8058152 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.StylesheetTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.StylesheetTest * @run testng/othervm transform.StylesheetTest * @summary this test contains test cases for verifying stylesheet */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/TemplatesTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/TemplatesTest.java index f0cd1441661..270507a8c2d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/TemplatesTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/TemplatesTest.java @@ -35,7 +35,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.TemplatesTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.TemplatesTest * @run testng/othervm transform.TemplatesTest * @summary This class contains tests for Templates. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java index 550da2bc8d2..064461a56dc 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.TransformerFactoryTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.TransformerFactoryTest * @run testng/othervm transform.TransformerFactoryTest * @summary Test TransformerFactory. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerTest.java index 32f79d67463..e25f2bf3c2c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/TransformerTest.java @@ -72,7 +72,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.TransformerTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.TransformerTest * @run testng/othervm transform.TransformerTest * @summary Transformer Tests * @bug 6272879 6305029 6505031 8150704 8162598 8169112 8169631 8169772 diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java index 3f99410869b..a358978557b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java @@ -54,7 +54,7 @@ * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @compile DocumentExtFunc.java - * @run testng/othervm -DrunSecMngr=true transform.XSLTFunctionsTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.XSLTFunctionsTest * @run testng/othervm transform.XSLTFunctionsTest * @summary This class contains tests for XSLT functions. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java b/test/jaxp/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java index 77bc7b4a7e2..c6c1ae2433d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java @@ -38,7 +38,7 @@ * @test * @bug 6451633 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.sax.Bug6451633 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.sax.Bug6451633 * @run testng/othervm transform.sax.Bug6451633 * @summary Test TransformerHandler ignores empty text node. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java index 8966ffeea12..4e83f88dff1 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java @@ -47,7 +47,7 @@ * @test * @bug 8193830 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true transform.sort.SortTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow transform.sort.SortTest * @run testng/othervm transform.sort.SortTest * @summary verify xsl:sort lang attribute */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/AnyElementTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/AnyElementTest.java index c12a1515245..ff006e9129a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/AnyElementTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/AnyElementTest.java @@ -26,7 +26,7 @@ * @test * @bug 8080907 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.AnyElementTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.AnyElementTest * @run testng/othervm validation.AnyElementTest * @summary Test processContents attribute of any element */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966232.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966232.java index 05300cc6964..88dcd0a1159 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966232.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966232.java @@ -39,7 +39,7 @@ * @test * @bug 4966232 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4966232 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4966232 * @run testng/othervm validation.Bug4966232 * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966254.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966254.java index 46e9fd23034..6eb978c6670 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966254.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4966254.java @@ -39,7 +39,7 @@ * @test * @bug 4966254 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4966254 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4966254 * @run testng/othervm validation.Bug4966254 * @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969042.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969042.java index e7b22fec08b..3229af656ce 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969042.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969042.java @@ -45,7 +45,7 @@ * @test * @bug 4969042 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969042 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969042 * @run testng/othervm validation.Bug4969042 * @summary Test ValidationHandler shall invoke ignorableWhitespace() of the * user-defined ContentHandler once the validator detects any ignorable whitespaces. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969089.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969089.java index 74a75f75433..0c014d7503b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969089.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969089.java @@ -40,7 +40,7 @@ * @test * @bug 4969089 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969089 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969089 * @run testng/othervm validation.Bug4969089 * @summary Test when an ErrorHandler is set for a SchemaFactory, SchemaFactory.newSchema(Source[]) * method throws an exception that is not equal to the exception thrown from the ErrorHandler. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969110.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969110.java index 5c7bac6dbc9..f4d3f4b1a26 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969110.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969110.java @@ -36,7 +36,7 @@ * @test * @bug 4969110 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969110 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969110 * @run testng/othervm validation.Bug4969110 * @summary Test ValidationHandler.set/getProperty() throws a correct exception * instead of a sun internal exception in case the "property name" parameter is invalid. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969689.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969689.java index c0554c2478e..1ed208aabb3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969689.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969689.java @@ -36,7 +36,7 @@ * @test * @bug 4969689 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969689 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969689 * @run testng/othervm validation.Bug4969689 * @summary Test SchemaFactory.get/setFeature() throw NullPointerException * instead of SAXNotRecognizedException in case the "feature name" parameter is null. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969692.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969692.java index d78fe660b5f..d0538969786 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969692.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969692.java @@ -35,7 +35,7 @@ * @test * @bug 4969692 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969692 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969692 * @run testng/othervm validation.Bug4969692 * @summary Test Validator.get/setFeature() throw NullPointerException * instead of SAXNotRecognizedException in case the "feature name" parameter is null. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969693.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969693.java index fd203f3c734..8eca589566d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969693.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969693.java @@ -35,7 +35,7 @@ * @test * @bug 4969693 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969693 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969693 * @run testng/othervm validation.Bug4969693 * @summary Test Validator.get/setProperty() throw NullPointerException * instead of SAXNotRecognizedException in case the "property name" parameter is null. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969695.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969695.java index 01d47b627e4..ef04b737408 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969695.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969695.java @@ -35,7 +35,7 @@ * @test * @bug 4969695 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969695 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969695 * @run testng/othervm validation.Bug4969695 * @summary Test SchemaFactory.get/setProperty() throw NullPointerException * instead of SAXNotRecognizedException in case the "property name" parameter is null. diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969732.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969732.java index cfec3964c19..990e2f6a4be 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969732.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4969732.java @@ -44,7 +44,7 @@ * @test * @bug 4969732 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4969732 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4969732 * @run testng/othervm validation.Bug4969732 * @summary Test TypeInfoProvider.getElementTypeInfo() throws IllegalStateException * in case the method is not called from method startElement() or endElement(). diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970380.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970380.java index 4954f41948a..30c094cd83b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970380.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970380.java @@ -35,7 +35,7 @@ * @test * @bug 4970380 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4970380 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4970380 * @run testng/othervm validation.Bug4970380 * @summary Test validatorHandler.getFeature(...) with unknown name and "http://xml.org/sax/features/namespace-prefixes". */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970383.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970383.java index 28809222c12..67b9751c1dc 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970383.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970383.java @@ -34,7 +34,7 @@ * @test * @bug 4970383 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4970383 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4970383 * @run testng/othervm validation.Bug4970383 * @summary Test validatorHandler.setFeature throws NullPointerException if name parameter is null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970400.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970400.java index a8c761f23da..a20705a718d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970400.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970400.java @@ -33,7 +33,7 @@ * @test * @bug 4970400 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4970400 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4970400 * @run testng/othervm validation.Bug4970400 * @summary Test ValidatorHandler recognizes namespace-prefixes feature. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970402.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970402.java index c75604b4b5e..9b801d76d62 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970402.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970402.java @@ -47,7 +47,7 @@ * @test * @bug 4970402 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4970402 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4970402 * @run testng/othervm validation.Bug4970402 * @summary Test TypeInfoProvider's attribute accessing methods throw IndexOutOfBoundsException when index parameter is invalid. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970951.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970951.java index 91b2891fdbf..210bd2ce932 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970951.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4970951.java @@ -47,7 +47,7 @@ * @test * @bug 4970951 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4970951 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4970951 * @run testng/othervm validation.Bug4970951 * @summary Test TypeInfoProvider.isSpecified(...) return true if the attribute was originally present. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971605.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971605.java index 8654f283a04..a8d10802541 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971605.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971605.java @@ -42,7 +42,7 @@ * @test * @bug 4971605 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4971605 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4971605 * @run testng/othervm validation.Bug4971605 * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971607.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971607.java index 385bef46b58..496f63a7bd4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971607.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4971607.java @@ -34,7 +34,7 @@ * @test * @bug 4971607 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4971607 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4971607 * @run testng/othervm validation.Bug4971607 * @summary Test ValidatorHandler.getFeature(...) throws NullPointerException when name parameter is null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4972882.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4972882.java index cf585a2df69..663056025f9 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4972882.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4972882.java @@ -38,7 +38,7 @@ * @test * @bug 4972882 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4972882 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4972882 * @run testng/othervm validation.Bug4972882 * @summary Test Validator throws Exception when two identity-constraints are defined with the same {name} and {target namespace}. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4986844.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4986844.java index fb6dcdd4210..4796cff2a51 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4986844.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4986844.java @@ -34,7 +34,7 @@ * @test * @bug 4986844 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4986844 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4986844 * @run testng/othervm validation.Bug4986844 * @summary Test SchemaFactory can detect particle restriction. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java index 75a7ee51fa6..10f9157eef7 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4987574.java @@ -39,7 +39,7 @@ * @test * @bug 4987574 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4987574 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4987574 * @run testng/othervm validation.Bug4987574 * @summary Test schemaFactory.newSchema doesn't throw NullPointerExceptio for empty schema. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988267.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988267.java index 2da7618ed7c..0f5205cbfe8 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988267.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988267.java @@ -34,7 +34,7 @@ * @test * @bug 4988267 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4988267 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4988267 * @run testng/othervm validation.Bug4988267 * @summary Test SchemaFactory can detect particle restriction. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988268.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988268.java index 8de45e95ff3..8450d3e4a49 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988268.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988268.java @@ -32,7 +32,7 @@ * @test * @bug 4988268 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4988268 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4988268 * @run testng/othervm validation.Bug4988268 * @summary Test the schema is valid. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988387.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988387.java index e9db60429ad..feaa8b02250 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988387.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4988387.java @@ -34,7 +34,7 @@ * @test * @bug 4988387 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4988387 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4988387 * @run testng/othervm validation.Bug4988387 * @summary Test SchemaFactory can detect invalid XPath expressions. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4996446.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4996446.java index ba546220580..dee3d838f29 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4996446.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4996446.java @@ -40,7 +40,7 @@ * @test * @bug 4996446 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4996446 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4996446 * @run testng/othervm validation.Bug4996446 * @summary Test SchemaFactory can detect violations of the "Schema Component Constraint: Element Declarations Consistent". */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4997818.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4997818.java index 8c8d677c520..223137c9751 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4997818.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug4997818.java @@ -39,7 +39,7 @@ * @test * @bug 4997818 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug4997818 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug4997818 * @run testng/othervm validation.Bug4997818 * @summary Test SchemaFactory.newSchema(...) throws an exception, which is thrown from LSResourceResolver. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5011500.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5011500.java index b3a85cadc68..189822e1fdf 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5011500.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5011500.java @@ -44,7 +44,7 @@ * @test * @bug 5011500 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug5011500 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug5011500 * @run testng/othervm validation.Bug5011500 * @summary Test ValidatorHanlder and Validator can work for the xml document. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5072946.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5072946.java index 3d6b490f2c3..e314e09b96d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5072946.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug5072946.java @@ -49,7 +49,7 @@ * @test * @bug 5072946 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug5072946 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug5072946 * @run testng/othervm validation.Bug5072946 * @summary Test Validator.validate(DOMSource,DOMResult) outputs to the result. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6378043.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6378043.java index 4bbc7560b19..9f728350462 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6378043.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6378043.java @@ -34,7 +34,7 @@ * @test * @bug 6378043 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6378043 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6378043 * @run testng/othervm validation.Bug6378043 * @summary Test XPath expression "child::" can be parsed. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6449797.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6449797.java index 8a96e05ae5f..99de8bedc52 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6449797.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6449797.java @@ -33,7 +33,7 @@ * @test * @bug 6449797 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6449797 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6449797 * @run testng/othervm validation.Bug6449797 * @summary Test SchemaFactory can parse the specified attribute value with a specified namespace. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6457662.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6457662.java index f6c54b14b64..0cabf01b20f 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6457662.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6457662.java @@ -46,7 +46,7 @@ * @test * @bug 6457662 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6457662 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6457662 * @run testng/othervm validation.Bug6457662 * @summary Test a Validator checks sequence maxOccurs correctly when it validates document repeatedly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6467424Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6467424Test.java index 5fa073eb2d5..0c7419d01da 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6467424Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6467424Test.java @@ -52,7 +52,7 @@ * @test * @bug 6467424 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6467424Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6467424Test * @run testng/othervm validation.Bug6467424Test * @summary Test Validator augments the default delement value if feature element-default is on. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6483188.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6483188.java index b9b0812c8e7..616598bee80 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6483188.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6483188.java @@ -39,7 +39,7 @@ * @test * @bug 6483188 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6483188 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6483188 * @run testng/othervm validation.Bug6483188 * @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6493687.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6493687.java index 71a1afee3f9..3d1054fac30 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6493687.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6493687.java @@ -31,7 +31,7 @@ * @test * @bug 6493687 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6493687 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6493687 * @run testng/othervm validation.Bug6493687 * @summary Test validator.validate(new DOMSource(node)) without any exception. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6509668.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6509668.java index f397677ce73..d671aa9c02b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6509668.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6509668.java @@ -49,7 +49,7 @@ * @test * @bug 6509668 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6509668 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6509668 * @run testng/othervm validation.Bug6509668 * @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6526547.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6526547.java index 47d8d624c21..f1b7bd215e6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6526547.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6526547.java @@ -43,7 +43,7 @@ * @test * @bug 6526547 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6526547 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6526547 * @run testng/othervm validation.Bug6526547 * @summary Test document parsed without setting NamespaceAware can be validated with a Schema. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6531160.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6531160.java index 54e1e05ea90..f47400bfb6d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6531160.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6531160.java @@ -42,7 +42,7 @@ * @test * @bug 6531160 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6531160 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6531160 * @run testng/othervm validation.Bug6531160 * @summary Test document generated by newDocument() can be validated with a Schema. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6695843Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6695843Test.java index 88d37eec67e..5a8d0c3cbe3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6695843Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6695843Test.java @@ -44,7 +44,7 @@ * @test * @bug 6695843 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6695843Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6695843Test * @run testng/othervm validation.Bug6695843Test * @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6773084Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6773084Test.java index 21479c6a6e3..4a4556efac3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6773084Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6773084Test.java @@ -55,7 +55,7 @@ * @test * @bug 6773084 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6773084Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6773084Test * @run testng/othervm validation.Bug6773084Test * @summary Test Schema object is thread safe. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6859210.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6859210.java index c695aded8d7..d7232a0f6ee 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6859210.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6859210.java @@ -42,7 +42,7 @@ * @test * @bug 6859210 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6859210 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6859210 * @run testng/othervm validation.Bug6859210 * @summary Test Schema Validator can parse xml when maxOccurs is large. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6925531Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6925531Test.java index 8059723d700..6f6d2ecf733 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6925531Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6925531Test.java @@ -51,8 +51,8 @@ * @test * @bug 6925531 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6925531Test - * @run testng/othervm validation.Bug6925531Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6925531Test + * @run testng/othervm -Djava.security.manager=allow validation.Bug6925531Test * @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on. */ @Listeners({jaxp.library.BasePolicy.class}) diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6946312Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6946312Test.java index e134d8b6b5c..6b77db907a5 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6946312Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6946312Test.java @@ -48,7 +48,7 @@ * @test * @bug 6946312 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6946312Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6946312Test * @run testng/othervm validation.Bug6946312Test * @summary Test XML parser shall callback to ContentHandler when receiving characters data. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java index 510298c865d..0d3b9219916 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java @@ -41,7 +41,7 @@ * @test * @bug 6954738 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Bug6954738_Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Bug6954738_Test * @run testng/othervm validation.Bug6954738_Test * @summary Test Validator can process a XML document containing an element with 8000 characters. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6708840Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6708840Test.java index 71f55a4f3c4..5334e10aea0 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6708840Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6708840Test.java @@ -47,7 +47,7 @@ * @test * @bug 6708840 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.CR6708840Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.CR6708840Test * @run testng/othervm validation.CR6708840Test * @summary Test Validator can process StAXSource. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java index bccef3d37b8..6ecbba3014d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java @@ -42,7 +42,7 @@ * @test * @bug 6740048 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.CR6740048 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.CR6740048 * @run testng/othervm validation.CR6740048 * @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/Issue682Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/Issue682Test.java index 459fa8c149a..2608ea2ff0c 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/Issue682Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/Issue682Test.java @@ -42,7 +42,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.Issue682Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.Issue682Test * @run testng/othervm validation.Issue682Test * @summary Test comination of fields in , for https://issues.apache.org/jira/browse/XERCESJ-682. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/IssueTracker30.java b/test/jaxp/javax/xml/jaxp/unittest/validation/IssueTracker30.java index 6f0fb1b5a25..83840d1c6cc 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/IssueTracker30.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/IssueTracker30.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.IssueTracker30 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.IssueTracker30 * @run testng/othervm validation.IssueTracker30 * @summary Test maxOccurs validation. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java index b42f5272893..5fbe6d30dac 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java @@ -48,7 +48,7 @@ * @test * @bug 6631318 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue43Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.JaxpIssue43Test * @run testng/othervm validation.JaxpIssue43Test * @summary Test creating schema from a DOM fragment with namespace. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue49.java b/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue49.java index 7cf58257847..832f5f577d5 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue49.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/JaxpIssue49.java @@ -46,7 +46,7 @@ * @test * @bug 6684227 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue49 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.JaxpIssue49 * @run testng/othervm validation.JaxpIssue49 * @summary Test property current-element-node works. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java index 78ac556e80a..e07e172764e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.LargeMaxOccursTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.LargeMaxOccursTest * @run testng/othervm validation.LargeMaxOccursTest * @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursTest.java index 457cf697228..ad8a18a321e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.MultiOccursTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.MultiOccursTest * @run testng/othervm validation.MultiOccursTest * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java index 58062410c43..0fb2fb22487 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.MultiOccursUnboundedTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.MultiOccursUnboundedTest * @run testng/othervm validation.MultiOccursUnboundedTest * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursTest.java index 8e3613739d3..660d3919717 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.OccursTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.OccursTest * @run testng/othervm validation.OccursTest * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java index 6e8213e0e8b..8e9e7dd1a5e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.OccursUnboundedTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.OccursUnboundedTest * @run testng/othervm validation.OccursUnboundedTest * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java index f29da26225d..5a53b6ca7a6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.OccursWildcardTest * @run testng/othervm validation.OccursWildcardTest * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java index 002c9983716..3b4c1f6a18d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardUnbounded + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.OccursWildcardUnbounded * @run testng/othervm validation.OccursWildcardUnbounded * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java index ac1450d05d3..03ecf71aa42 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.ParticlesId005Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.ParticlesId005Test * @run testng/othervm validation.ParticlesId005Test * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java index 424d4f35c86..86a84095d63 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.ParticlesIg004Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.ParticlesIg004Test * @run testng/othervm validation.ParticlesIg004Test * @summary Test particlesIg004.xsd. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java index 77da3675b83..54a381c394d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java @@ -41,7 +41,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.ParticlesQ013Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.ParticlesQ013Test * @run testng/othervm validation.ParticlesQ013Test * @summary Test Schema Validator can parse multiple or unbounded occurs. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java index 0f5e9dc5de5..4d9fea992c4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java @@ -37,7 +37,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.TCKGroupA008Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.TCKGroupA008Test * @run testng/othervm validation.TCKGroupA008Test * @summary Test groupA008.xsd. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/ValidatorTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/ValidatorTest.java index 22317b325bb..e9797a6fde3 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/ValidatorTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/ValidatorTest.java @@ -50,7 +50,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.ValidatorTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.ValidatorTest * @run testng/othervm validation.ValidatorTest * @summary Test Validator.validate(Source, Result). */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java index 663c7d87fd3..774466dee37 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java @@ -39,7 +39,7 @@ * @test * @bug 6943252 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6943252Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6943252Test * @run testng/othervm validation.tck.Bug6943252Test * @summary Test Schema doesn't allow to use value more than allowed by base type. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java index f2ff60839d9..321d33eca6b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java @@ -37,7 +37,7 @@ * @test * @bug 6963124 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963124Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6963124Test * @run testng/othervm validation.tck.Bug6963124Test * @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java index e2e12b62067..6e687c4300a 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java @@ -49,7 +49,7 @@ * @test * @bug 6963468 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963468Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6963468Test * @run testng/othervm validation.tck.Bug6963468Test * @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java index 96d68ff4874..a061cabecb4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java @@ -37,7 +37,7 @@ * @test * @bug 6964720 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6964720Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6964720Test * @run testng/othervm validation.tck.Bug6964720Test * @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java index 9ff29807e61..863f9833540 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java @@ -39,7 +39,7 @@ * @test * @bug 6967214 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6967214Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6967214Test * @run testng/othervm validation.tck.Bug6967214Test * @summary Test Schema doesn't allow unpaired parenthesises in regex. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java index 4e885d190e3..a8f908a752d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java @@ -37,7 +37,7 @@ * @test * @bug 6970890 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6970890Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6970890Test * @run testng/othervm validation.tck.Bug6970890Test * @summary Test Schema allows [-] in regex. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java index b717ff184a3..25f57033052 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java @@ -40,7 +40,7 @@ * @test * @bug 6971190 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6971190Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6971190Test * @run testng/othervm validation.tck.Bug6971190Test * @summary Test Validation accepts UTF lexical presentation. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java index 210ca81ff05..0c72202bd84 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java @@ -44,7 +44,7 @@ * @test * @bug 6974551 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6974551Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6974551Test * @run testng/othervm validation.tck.Bug6974551Test * @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java index 55f9903e470..27ee0b4e3e1 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java @@ -39,7 +39,7 @@ * @test * @bug 6975265 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6975265Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6975265Test * @run testng/othervm validation.tck.Bug6975265Test * @summary Test Schema doesn't allow some Element Information Items contain other element information item. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java index e41bf4aea92..435dd3d3b3b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java @@ -37,7 +37,7 @@ * @test * @bug 6977201 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6977201Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6977201Test * @run testng/othervm validation.tck.Bug6977201Test * @summary Test Validator interprets regex "" correctly. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java index 3fe2676fa62..34cd44649d4 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java @@ -49,7 +49,7 @@ * @test * @bug 6989956 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6989956Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug6989956Test * @run testng/othervm validation.tck.Bug6989956Test * @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java index 1f398cc71fb..319eacb8b54 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java @@ -37,7 +37,7 @@ * @test * @bug 7014246 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.Bug7014246Test + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.Bug7014246Test * @run testng/othervm validation.tck.Bug7014246Test * @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java index 50225cc7117..2c83da1c49b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java @@ -37,7 +37,7 @@ * @test * @bug 8142463 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.ParticleTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.ParticleTest * @run testng/othervm validation.tck.ParticleTest * @summary Tests that verify bug fixes for Particles (http://www.w3.org/TR/xmlschema11-1/#cParticles) diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/RegexWord.java b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/RegexWord.java index 3a127367be6..25ece2a97ab 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/tck/RegexWord.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/tck/RegexWord.java @@ -36,7 +36,7 @@ * @test * @bug 8142900 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true validation.tck.RegexWord + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow validation.tck.RegexWord * @run testng/othervm validation.tck.RegexWord * @summary Verifies that all characters except the set of "punctuation", * "separator" and "other" characters are accepted by \w [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991857.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991857.java index 7422497f030..64a21d999cd 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991857.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991857.java @@ -38,7 +38,7 @@ * @test * @bug 4991857 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.Bug4991857 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.Bug4991857 * @run testng/othervm xpath.Bug4991857 * @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991939.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991939.java index 58f7e1ce33a..e7aa367eace 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991939.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4991939.java @@ -36,7 +36,7 @@ * @test * @bug 4991939 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.Bug4991939 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.Bug4991939 * @run testng/othervm xpath.Bug4991939 * @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992788.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992788.java index dd5ace27633..a0024230fce 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992788.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992788.java @@ -39,7 +39,7 @@ * @test * @bug 4992788 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.Bug4992788 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.Bug4992788 * @run testng/othervm xpath.Bug4992788 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992793.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992793.java index 2aad726f9fd..aca7fe3c248 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992793.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992793.java @@ -41,7 +41,7 @@ * @test * @bug 4992793 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.Bug4992793 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.Bug4992793 * @run testng/othervm xpath.Bug4992793 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992805.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992805.java index 45449364017..a7295986f71 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992805.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/Bug4992805.java @@ -40,7 +40,7 @@ * @test * @bug 4992805 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.Bug4992805 + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.Bug4992805 * @run testng/othervm xpath.Bug4992805 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java index 15411a0e25d..e49fd141e60 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java @@ -35,7 +35,7 @@ * @test * @bug 6354969 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.ClassLoaderTest * @run testng/othervm xpath.ClassLoaderTest * @summary Test XPathFactory newInstance() with ContextClassLoader. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java index d0e100d6f0d..d9a8878093e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java @@ -51,7 +51,7 @@ /* * @test * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.SecureProcessingTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.SecureProcessingTest * @run testng/othervm xpath.SecureProcessingTest * @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException. */ diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java index efe1fa2a61b..47b350f3532 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java @@ -41,7 +41,7 @@ * @test * @bug 8054196 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.XPathAnyTypeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.XPathAnyTypeTest * @run testng/othervm xpath.XPathAnyTypeTest * @summary Test for the project XPath: support any type. This test covers the new * evaluateExpression methods of XPath, as well as XPathNodes and XPathEvaluationResult. diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java index 1717f5d74d5..4502083efa6 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java @@ -43,7 +43,7 @@ * @test * @bug 8054196 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.XPathExpAnyTypeTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.XPathExpAnyTypeTest * @run testng/othervm xpath.XPathExpAnyTypeTest * @summary Test for the project XPath: support any type. This test covers the new * evaluateExpression methods of XPathExpression. diff --git a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathTest.java b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathTest.java index ea961181569..7f5c45dc12b 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/xpath/XPathTest.java @@ -40,7 +40,7 @@ * @test * @bug 6376058 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest - * @run testng/othervm -DrunSecMngr=true xpath.XPathTest + * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow xpath.XPathTest * @run testng/othervm xpath.XPathTest * @summary Test XPath functions. See details for each test. */ diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index e2c24206fd6..d29795a2097 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -595,6 +595,8 @@ javax/management/MBeanServer/OldMBeanServerTest.java 8030957 aix-all javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java 8042215 generic-all +javax/management/remote/mandatory/connection/RMIConnector_NPETest.java 8267887 generic-all + ############################################################################ # jdk_net @@ -608,7 +610,6 @@ java/net/MulticastSocket/SetGetNetworkInterfaceTest.java 8219083 windows- java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64 -java/net/Socket/UdpSocket.java 8265362 macosx-aarch64 java/net/httpclient/websocket/PendingBinaryPongClose.java 8265367 macosx-aarch64 java/net/httpclient/websocket/PendingBinaryPingClose.java 8265367 macosx-aarch64 @@ -636,12 +637,6 @@ java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-al java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic-all -java/rmi/activation/Activatable/extLoadedImpl/ext.sh 8062724 generic-all - -java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java 8169569 windows-all - -java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java 8170562 generic-all - java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all java/rmi/Naming/DefaultRegistryPort.java 8005619 windows-all diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 127c30be458..bf5ae7e7eb4 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -517,7 +517,6 @@ jdk_core_manual_no_input = \ java/net/httpclient/BodyProcessorInputStreamTest.java \ java/net/httpclient/HttpInputStreamTest.java \ java/nio/MappedByteBuffer/PmemTest.java \ - java/rmi/activation/nonLocalActivation/NonLocalActivationTest.java \ java/rmi/registry/nonLocalRegistry/NonLocalRegistryTest.java \ java/util/zip/ZipFile/TestZipFile.java \ javax/net/ssl/compatibility/AlpnTest.java \ diff --git a/test/jdk/com/sun/java/accessibility/util/8051626/Bug8051626.java b/test/jdk/com/sun/java/accessibility/util/8051626/Bug8051626.java index 4751d55ad6f..96f301d5ce5 100644 --- a/test/jdk/com/sun/java/accessibility/util/8051626/Bug8051626.java +++ b/test/jdk/com/sun/java/accessibility/util/8051626/Bug8051626.java @@ -28,7 +28,7 @@ * @summary Ensure no failure when using Java Accessibility Utility with security manager * @modules java.desktop jdk.accessibility * - * @run main/othervm Bug8051626 + * @run main/othervm -Djava.security.manager=allow Bug8051626 */ import com.sun.java.accessibility.util.AWTEventMonitor; diff --git a/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java b/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java index 19dd9271b71..3acc3d0cae1 100644 --- a/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java +++ b/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java @@ -61,8 +61,8 @@ * @compile dnsprovider/TestDnsProvider.java * @run main/othervm LdapDnsProviderTest * @run main/othervm LdapDnsProviderTest nosm - * @run main/othervm LdapDnsProviderTest smnodns - * @run main/othervm LdapDnsProviderTest smdns + * @run main/othervm -Djava.security.manager=allow LdapDnsProviderTest smnodns + * @run main/othervm -Djava.security.manager=allow LdapDnsProviderTest smdns * @run main/othervm LdapDnsProviderTest nosmbaddns */ diff --git a/test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java b/test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java index 545890f7347..a7fa5ae303a 100644 --- a/test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java +++ b/test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java @@ -30,7 +30,7 @@ * @modules java.logging * java.management * - * @run main/othervm DcmdMBeanPermissionsTest + * @run main/othervm -Djava.security.manager=allow DcmdMBeanPermissionsTest */ import java.lang.management.ManagementFactory; diff --git a/test/jdk/java/awt/ComponentOrientation/BasicTest.java b/test/jdk/java/awt/ComponentOrientation/BasicTest.java index 50c0f61eafe..a7b4ac4b22b 100644 --- a/test/jdk/java/awt/ComponentOrientation/BasicTest.java +++ b/test/jdk/java/awt/ComponentOrientation/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4108453 4778440 6304780 6396378 + * @bug 4108453 4778440 6304780 6396378 8263202 * @summary Basic tests for java.awt.ComponentOrientation * @build TestBundle TestBundle_es TestBundle_iw * @build TestBundle1 TestBundle1_ar @@ -100,6 +100,12 @@ static void TestLocale() { orient = ComponentOrientation.getOrientation(new Locale("ar", "")); Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT"); + orient = ComponentOrientation.getOrientation(new Locale("he", "")); + Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "he == RIGHT_TO_LEFT"); + + orient = ComponentOrientation.getOrientation(new Locale("yi", "")); + Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "yi == RIGHT_TO_LEFT"); + System.out.println(" } Pass"); } @@ -130,6 +136,10 @@ static void TestBundle() { rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", "IL")); assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT" ); + // Test with "he" locale. This should load TestBundle_iw and fetch the orientation from there + rb = ResourceBundle.getBundle("TestBundle", new Locale("he", "IL")); + assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "he == RIGHT_TO_LEFT" ); + // This bundle has no orientation setting at all, so we should get // the system's default orientation for Arabic rb = ResourceBundle.getBundle("TestBundle1", new Locale("ar", "")); diff --git a/test/jdk/java/awt/FontClass/CreateFont/BigFont.java b/test/jdk/java/awt/FontClass/CreateFont/BigFont.java index 0c5970b2794..34a98c15119 100644 --- a/test/jdk/java/awt/FontClass/CreateFont/BigFont.java +++ b/test/jdk/java/awt/FontClass/CreateFont/BigFont.java @@ -34,8 +34,8 @@ * @key headful * @bug 6522586 * @summary Enforce limits on font creation - * @run main BigFont 1 A.ttf - * @run main BigFont 2 A.ttf + * @run main/othervm -Djava.security.manager=allow BigFont 1 A.ttf + * @run main/othervm -Djava.security.manager=allow BigFont 2 A.ttf */ public class BigFont { diff --git a/test/jdk/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh b/test/jdk/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh index 7737f63c227..d8930f3b3fa 100644 --- a/test/jdk/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh +++ b/test/jdk/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh @@ -71,7 +71,7 @@ THIS_DIR=`pwd` ${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} FontFile > test.out 2>&1 +${TESTJAVA}${FS}bin${FS}java -Djava.security.manager=allow ${BIT_FLAG} FontFile > test.out 2>&1 STATUS=$? diff --git a/test/jdk/java/awt/FontClass/FontAccess.java b/test/jdk/java/awt/FontClass/FontAccess.java index 489b2a0474b..bcd561b8cbc 100644 --- a/test/jdk/java/awt/FontClass/FontAccess.java +++ b/test/jdk/java/awt/FontClass/FontAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -25,7 +25,7 @@ * @test * @bug 6785424 * @summary Test no SecurityException searching for a font. - * @run main FontAccess + * @run main/othervm -Djava.security.manager=allow FontAccess * * This can only test the specific bug if run on something like * Windows Citrix Server where SystemDirectory and WindowsDirectory diff --git a/test/jdk/java/awt/FontClass/FontPrivilege.java b/test/jdk/java/awt/FontClass/FontPrivilege.java index 24fd5116c8c..96938ece225 100644 --- a/test/jdk/java/awt/FontClass/FontPrivilege.java +++ b/test/jdk/java/awt/FontClass/FontPrivilege.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -25,7 +25,7 @@ * @test * @bug 5010310 6319835 6904882 6968373 * @summary test fonts can be created in the presence of a security manager - * @run main FontPrivilege + * @run main/othervm -Djava.security.manager=allow FontPrivilege */ import java.awt.Font; diff --git a/test/jdk/java/awt/FullScreen/SetFSWindow/FSFrame.java b/test/jdk/java/awt/FullScreen/SetFSWindow/FSFrame.java index e75e891d176..ca836dfce84 100644 --- a/test/jdk/java/awt/FullScreen/SetFSWindow/FSFrame.java +++ b/test/jdk/java/awt/FullScreen/SetFSWindow/FSFrame.java @@ -28,8 +28,8 @@ * @summary verify that isFullScreenSupported and getFullScreenWindow work * correctly with and without a SecurityManager. Note that the test may fail * on older Gnome versions (see bug 6500686). - * @run main FSFrame - * @run main/othervm -Dsun.java2d.noddraw=true FSFrame + * @run main/othervm -Djava.security.manager=allow FSFrame + * @run main/othervm -Djava.security.manager=allow -Dsun.java2d.noddraw=true FSFrame */ import java.awt.*; diff --git a/test/jdk/java/awt/Toolkit/GetImage/bug8078165.java b/test/jdk/java/awt/Toolkit/GetImage/bug8078165.java index 81ebc8a8618..169ad706616 100644 --- a/test/jdk/java/awt/Toolkit/GetImage/bug8078165.java +++ b/test/jdk/java/awt/Toolkit/GetImage/bug8078165.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,6 +30,7 @@ /** * @test * @bug 8078165 + * @run main/othervm -Djava.security.manager=allow bug8078165 * @summary NPE when attempting to get image from toolkit * @author Anton Nashatyrev */ diff --git a/test/jdk/java/awt/Toolkit/SecurityTest/SecurityTest2.java b/test/jdk/java/awt/Toolkit/SecurityTest/SecurityTest2.java index 4fa3a7c294a..e3be3e8fdea 100644 --- a/test/jdk/java/awt/Toolkit/SecurityTest/SecurityTest2.java +++ b/test/jdk/java/awt/Toolkit/SecurityTest/SecurityTest2.java @@ -28,7 +28,7 @@ * @summary tests that a simple GUI application runs without any * exceptions thrown * @author Artem.Ananiev area=awt.Toolkit - * @run main SecurityTest2 + * @run main/othervm -Djava.security.manager=allow SecurityTest2 */ import java.awt.*; diff --git a/test/jdk/java/awt/color/LoadProfileWithSM.java b/test/jdk/java/awt/color/LoadProfileWithSM.java index a886233c850..1d9ba02163a 100644 --- a/test/jdk/java/awt/color/LoadProfileWithSM.java +++ b/test/jdk/java/awt/color/LoadProfileWithSM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -27,7 +27,7 @@ * @test * @bug 8058969 8178708 * @summary test standard profiles loads with SecurityManager installed. - * @run main/othervm LoadProfileWithSM + * @run main/othervm -Djava.security.manager=allow LoadProfileWithSM */ public class LoadProfileWithSM { diff --git a/test/jdk/java/awt/print/PrintServicesSecurityManager.java b/test/jdk/java/awt/print/PrintServicesSecurityManager.java index a780355b20d..7f551476422 100644 --- a/test/jdk/java/awt/print/PrintServicesSecurityManager.java +++ b/test/jdk/java/awt/print/PrintServicesSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -28,6 +28,7 @@ /* * @test * @bug 8241829 + * @run main/othervm -Djava.security.manager=allow PrintServicesSecurityManager */ public final class PrintServicesSecurityManager { diff --git a/test/jdk/java/awt/print/PrinterJob/CheckAccess.java b/test/jdk/java/awt/print/PrinterJob/CheckAccess.java index 05480a01073..f962610c6fb 100644 --- a/test/jdk/java/awt/print/PrinterJob/CheckAccess.java +++ b/test/jdk/java/awt/print/PrinterJob/CheckAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -24,6 +24,7 @@ /** * @test * @bug 4151121 + * @run main/othervm -Djava.security.manager=allow CheckAccess * @summary Confirm that PrinterJob.getPrinterJob is access checked. * @author Graham Hamilton */ diff --git a/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java b/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java index 816046eab67..c5d356c6118 100644 --- a/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java +++ b/test/jdk/java/awt/print/PrinterJob/SecurityDialogTest.java @@ -24,7 +24,7 @@ /** * @test * @bug 4937672 5100706 6252456 - * @run main/manual SecurityDialogTest + * @run main/othervm/manual -Djava.security.manager=allow SecurityDialogTest */ import java.awt.* ; diff --git a/test/jdk/java/awt/regtesthelpers/process/ProcessCommunicator.java b/test/jdk/java/awt/regtesthelpers/process/ProcessCommunicator.java index 8177a2d2ab3..60a5952b32c 100644 --- a/test/jdk/java/awt/regtesthelpers/process/ProcessCommunicator.java +++ b/test/jdk/java/awt/regtesthelpers/process/ProcessCommunicator.java @@ -152,6 +152,7 @@ private static String buildCommand(final Class classToExecute, { StringBuilder commandBuilder = new StringBuilder(); commandBuilder.append(javaPath).append(" "); + commandBuilder.append("-Djava.security.manager=allow "); commandBuilder.append("-cp ").append(System.getProperty("test.classes", ".")).append(File.pathSeparatorChar); if (classPathArguments.trim().length() > 0) { diff --git a/test/jdk/java/awt/security/Permissions.java b/test/jdk/java/awt/security/Permissions.java index 3d964156194..1ee7f7ed726 100644 --- a/test/jdk/java/awt/security/Permissions.java +++ b/test/jdk/java/awt/security/Permissions.java @@ -27,7 +27,7 @@ * @bug 8008981 * @summary Test that selected Toolkit and Window methods/constructors do * the appropriate permission check - * @run main/othervm Permissions + * @run main/othervm -Djava.security.manager=allow Permissions */ import java.awt.AWTPermission; diff --git a/test/jdk/java/beans/Beans/Test4080522.java b/test/jdk/java/beans/Beans/Test4080522.java index 03e4e31300a..1c2d5bb9815 100644 --- a/test/jdk/java/beans/Beans/Test4080522.java +++ b/test/jdk/java/beans/Beans/Test4080522.java @@ -29,7 +29,7 @@ * Beans.setGuiAvailable * Introspector.setBeanInfoSearchPath * PropertyEditorManager.setEditorSearchPath - * @run main/othervm Test4080522 + * @run main/othervm -Djava.security.manager=allow Test4080522 * @author Graham Hamilton */ diff --git a/test/jdk/java/beans/EventHandler/Test6277246.java b/test/jdk/java/beans/EventHandler/Test6277246.java index 2f8015690d2..158b250bcaa 100644 --- a/test/jdk/java/beans/EventHandler/Test6277246.java +++ b/test/jdk/java/beans/EventHandler/Test6277246.java @@ -25,7 +25,7 @@ * @test * @bug 6277246 * @summary Tests problem with java.beans use of reflection - * @run main/othervm Test6277246 + * @run main/othervm -Djava.security.manager=allow Test6277246 * @author Jeff Nisewanger */ diff --git a/test/jdk/java/beans/EventHandler/Test6277266.java b/test/jdk/java/beans/EventHandler/Test6277266.java index c336fd016a7..0bed290ae4a 100644 --- a/test/jdk/java/beans/EventHandler/Test6277266.java +++ b/test/jdk/java/beans/EventHandler/Test6277266.java @@ -25,7 +25,7 @@ * @test * @bug 6277266 * @summary Tests access control issue in EventHandler - * @run main/othervm Test6277266 + * @run main/othervm -Djava.security.manager=allow Test6277266 * @author Jeff Nisewanger */ diff --git a/test/jdk/java/beans/Introspector/7084904/Test7084904.java b/test/jdk/java/beans/Introspector/7084904/Test7084904.java index eb2e68e7930..3ca6970d0a2 100644 --- a/test/jdk/java/beans/Introspector/7084904/Test7084904.java +++ b/test/jdk/java/beans/Introspector/7084904/Test7084904.java @@ -26,8 +26,9 @@ * @test * @bug 7084904 * @summary Compares reflection and bean introspection - * @author Sergey Malenkov * @library .. + * @run main/othervm -Djava.security.manager=allow Test7084904 + * @author Sergey Malenkov */ public class Test7084904 { public static void main(String[] args) throws Exception { diff --git a/test/jdk/java/beans/Introspector/Test4683761.java b/test/jdk/java/beans/Introspector/Test4683761.java index 2edd14580d6..08654c07f8b 100644 --- a/test/jdk/java/beans/Introspector/Test4683761.java +++ b/test/jdk/java/beans/Introspector/Test4683761.java @@ -25,6 +25,7 @@ * @test * @bug 4683761 * @summary Tests that all public methods in a public class + * @run main/othervm -Djava.security.manager=allow Test4683761 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/Introspector/Test6277246.java b/test/jdk/java/beans/Introspector/Test6277246.java index d0251fd82ac..6adecc0e792 100644 --- a/test/jdk/java/beans/Introspector/Test6277246.java +++ b/test/jdk/java/beans/Introspector/Test6277246.java @@ -27,7 +27,7 @@ * @summary Tests problem with java.beans use of reflection * @modules java.base/sun.security.x509 * java.desktop - * @run main/othervm Test6277246 + * @run main/othervm -Djava.security.manager=allow Test6277246 * @author Jeff Nisewanger */ diff --git a/test/jdk/java/beans/PropertyEditor/TestBooleanClass.java b/test/jdk/java/beans/PropertyEditor/TestBooleanClass.java index c274564484c..64d76e4555e 100644 --- a/test/jdk/java/beans/PropertyEditor/TestBooleanClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestBooleanClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 6498158 * @summary Tests PropertyEditor for value of type Boolean with security manager + * @run main/othervm -Djava.security.manager=allow TestBooleanClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestBooleanType.java b/test/jdk/java/beans/PropertyEditor/TestBooleanType.java index 71553a32421..cd8ac27015f 100644 --- a/test/jdk/java/beans/PropertyEditor/TestBooleanType.java +++ b/test/jdk/java/beans/PropertyEditor/TestBooleanType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type boolean with security manager + * @run main/othervm -Djava.security.manager=allow TestBooleanType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestByteClass.java b/test/jdk/java/beans/PropertyEditor/TestByteClass.java index 393dabad722..73998caa642 100644 --- a/test/jdk/java/beans/PropertyEditor/TestByteClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestByteClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type Byte with security manager + * @run main/othervm -Djava.security.manager=allow TestByteClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestByteType.java b/test/jdk/java/beans/PropertyEditor/TestByteType.java index 5d8a01d8169..cfb33ce819a 100644 --- a/test/jdk/java/beans/PropertyEditor/TestByteType.java +++ b/test/jdk/java/beans/PropertyEditor/TestByteType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type byte with security manager + * @run main/othervm -Djava.security.manager=allow TestByteType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestColorClass.java b/test/jdk/java/beans/PropertyEditor/TestColorClass.java index e449baf1064..94452e64339 100644 --- a/test/jdk/java/beans/PropertyEditor/TestColorClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestColorClass.java @@ -30,6 +30,7 @@ * @modules java.compiler * java.desktop * jdk.compiler + * @run main/othervm -Djava.security.manager=allow TestColorClass */ import java.awt.Color; diff --git a/test/jdk/java/beans/PropertyEditor/TestDoubleClass.java b/test/jdk/java/beans/PropertyEditor/TestDoubleClass.java index b1ffde0a9eb..7018bfda44f 100644 --- a/test/jdk/java/beans/PropertyEditor/TestDoubleClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestDoubleClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type Double with security manager + * @run main/othervm -Djava.security.manager=allow TestDoubleClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestDoubleType.java b/test/jdk/java/beans/PropertyEditor/TestDoubleType.java index 7dc21b95d86..699a5a455ed 100644 --- a/test/jdk/java/beans/PropertyEditor/TestDoubleType.java +++ b/test/jdk/java/beans/PropertyEditor/TestDoubleType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type double with security manager + * @run main/othervm -Djava.security.manager=allow TestDoubleType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestEnumClass.java b/test/jdk/java/beans/PropertyEditor/TestEnumClass.java index 8aec51b0299..419d8be2a9a 100644 --- a/test/jdk/java/beans/PropertyEditor/TestEnumClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestEnumClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6219769 6258510 * @summary Tests PropertyEditor for value of type Enum with security manager + * @run main/othervm -Djava.security.manager=allow TestEnumClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestEnumSubclass.java b/test/jdk/java/beans/PropertyEditor/TestEnumSubclass.java index 8ff3d2e55d7..811f3d2fc14 100644 --- a/test/jdk/java/beans/PropertyEditor/TestEnumSubclass.java +++ b/test/jdk/java/beans/PropertyEditor/TestEnumSubclass.java @@ -25,6 +25,7 @@ * @test * @bug 6736248 * @summary Tests PropertyEditor for value of subtype Enum with security manager + * @run main/othervm -Djava.security.manager=allow TestEnumSubclass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestFloatClass.java b/test/jdk/java/beans/PropertyEditor/TestFloatClass.java index cd231d33e68..65bfb7c511c 100644 --- a/test/jdk/java/beans/PropertyEditor/TestFloatClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestFloatClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type Float with security manager + * @run main/othervm -Djava.security.manager=allow TestFloatClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestFloatType.java b/test/jdk/java/beans/PropertyEditor/TestFloatType.java index 84d00f99e7c..e2aa79fff37 100644 --- a/test/jdk/java/beans/PropertyEditor/TestFloatType.java +++ b/test/jdk/java/beans/PropertyEditor/TestFloatType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type float with security manager + * @run main/othervm -Djava.security.manager=allow TestFloatType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestFontClass.java b/test/jdk/java/beans/PropertyEditor/TestFontClass.java index 742a6d65d9b..c2627791541 100644 --- a/test/jdk/java/beans/PropertyEditor/TestFontClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestFontClass.java @@ -30,6 +30,7 @@ * @modules java.compiler * java.desktop * jdk.compiler + * @run main/othervm -Djava.security.manager=allow TestFontClass */ import java.awt.Font; diff --git a/test/jdk/java/beans/PropertyEditor/TestIntegerClass.java b/test/jdk/java/beans/PropertyEditor/TestIntegerClass.java index 10657042489..2243c4ddd52 100644 --- a/test/jdk/java/beans/PropertyEditor/TestIntegerClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestIntegerClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 6498158 * @summary Tests PropertyEditor for value of type Integer with security manager + * @run main/othervm -Djava.security.manager=allow TestIntegerClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestIntegerType.java b/test/jdk/java/beans/PropertyEditor/TestIntegerType.java index 34a2261ea69..5264ee1932d 100644 --- a/test/jdk/java/beans/PropertyEditor/TestIntegerType.java +++ b/test/jdk/java/beans/PropertyEditor/TestIntegerType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type int with security manager + * @run main/othervm -Djava.security.manager=allow TestIntegerType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestLongClass.java b/test/jdk/java/beans/PropertyEditor/TestLongClass.java index 5d06f0c0515..79667c15deb 100644 --- a/test/jdk/java/beans/PropertyEditor/TestLongClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestLongClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type Long with security manager + * @run main/othervm -Djava.security.manager=allow TestLongClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestLongType.java b/test/jdk/java/beans/PropertyEditor/TestLongType.java index a32cd1506ca..2c650385469 100644 --- a/test/jdk/java/beans/PropertyEditor/TestLongType.java +++ b/test/jdk/java/beans/PropertyEditor/TestLongType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type long with security manager + * @run main/othervm -Djava.security.manager=allow TestLongType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestShortClass.java b/test/jdk/java/beans/PropertyEditor/TestShortClass.java index 875c3a0bf78..40dedb00146 100644 --- a/test/jdk/java/beans/PropertyEditor/TestShortClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestShortClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type Short with security manager + * @run main/othervm -Djava.security.manager=allow TestShortClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestShortType.java b/test/jdk/java/beans/PropertyEditor/TestShortType.java index 25a24a8fbb9..43f613e3d37 100644 --- a/test/jdk/java/beans/PropertyEditor/TestShortType.java +++ b/test/jdk/java/beans/PropertyEditor/TestShortType.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 * @summary Tests PropertyEditor for value of type short with security manager + * @run main/othervm -Djava.security.manager=allow TestShortType * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/PropertyEditor/TestStringClass.java b/test/jdk/java/beans/PropertyEditor/TestStringClass.java index 2a2a6d718b4..c27169dfa32 100644 --- a/test/jdk/java/beans/PropertyEditor/TestStringClass.java +++ b/test/jdk/java/beans/PropertyEditor/TestStringClass.java @@ -25,6 +25,7 @@ * @test * @bug 4506596 6258510 6457659 * @summary Tests PropertyEditor for value of type String with security manager + * @run main/othervm -Djava.security.manager=allow TestStringClass * @author Sergey Malenkov * @modules java.compiler * java.desktop diff --git a/test/jdk/java/beans/Statement/Test6224433.java b/test/jdk/java/beans/Statement/Test6224433.java index 9d81402538b..c5aededcb7d 100644 --- a/test/jdk/java/beans/Statement/Test6224433.java +++ b/test/jdk/java/beans/Statement/Test6224433.java @@ -25,6 +25,7 @@ * @test * @bug 6224433 * @summary Tests class loader lookup problem in Statement + * @run main/othervm -Djava.security.manager=allow Test6224433 * @author Jeff Nisewanger */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestArray.java b/test/jdk/java/beans/XMLDecoder/spec/TestArray.java index dbd92b91a29..5681a0411c1 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestArray.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestArray.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestArray * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestBoolean.java b/test/jdk/java/beans/XMLDecoder/spec/TestBoolean.java index e04c0c9042d..7f886353ca2 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestBoolean.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestBoolean.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestBoolean * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestByte.java b/test/jdk/java/beans/XMLDecoder/spec/TestByte.java index f04fc43916f..c8b12c654bf 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestByte.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestByte.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestByte * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestChar.java b/test/jdk/java/beans/XMLDecoder/spec/TestChar.java index 129ea0c4fa9..b7bc4bf93b1 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestChar.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestChar.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestChar * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestClass.java b/test/jdk/java/beans/XMLDecoder/spec/TestClass.java index c4fb4367dfd..36f33531cf9 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestClass.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestClass.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestClass * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestDouble.java b/test/jdk/java/beans/XMLDecoder/spec/TestDouble.java index 24d29fd5316..07660b29f8c 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestDouble.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestDouble.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestDouble * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestFalse.java b/test/jdk/java/beans/XMLDecoder/spec/TestFalse.java index 07d73b0fa3e..6e4dd7f6506 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestFalse.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestFalse.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestFalse * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestField.java b/test/jdk/java/beans/XMLDecoder/spec/TestField.java index 091ee5d272d..36451134480 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestField.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestField.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestField * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestFloat.java b/test/jdk/java/beans/XMLDecoder/spec/TestFloat.java index e846cce2a4a..2cd8ca826ce 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestFloat.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestFloat.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestFloat * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestInt.java b/test/jdk/java/beans/XMLDecoder/spec/TestInt.java index 4a7bb93287a..9df3de81700 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestInt.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestInt.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestInt * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestJava.java b/test/jdk/java/beans/XMLDecoder/spec/TestJava.java index 1f7ffbab8ad..d01b3ee530d 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestJava.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestJava.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestJava * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestLong.java b/test/jdk/java/beans/XMLDecoder/spec/TestLong.java index 1168871051e..e8a87b9ef30 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestLong.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestLong.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestLong * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestMethod.java b/test/jdk/java/beans/XMLDecoder/spec/TestMethod.java index d13778eff4e..025aa45e8d4 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestMethod.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestMethod.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestMethod * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestNew.java b/test/jdk/java/beans/XMLDecoder/spec/TestNew.java index af008c47d87..7a503cf4a28 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestNew.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestNew.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestNew * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestNull.java b/test/jdk/java/beans/XMLDecoder/spec/TestNull.java index 05ead316903..1adf5d18a88 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestNull.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestNull.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestNull * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestObject.java b/test/jdk/java/beans/XMLDecoder/spec/TestObject.java index a22171ab61c..c25ad7d27b4 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestObject.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestObject.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestObject * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestProperty.java b/test/jdk/java/beans/XMLDecoder/spec/TestProperty.java index 914e2055bcf..f1c75ccaed3 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestProperty.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestProperty.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestProperty * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestShort.java b/test/jdk/java/beans/XMLDecoder/spec/TestShort.java index 9fa75a52b09..9c0212bfbc8 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestShort.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestShort.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestShort * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestString.java b/test/jdk/java/beans/XMLDecoder/spec/TestString.java index 9947a4a5e68..e082be5523e 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestString.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestString.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestString * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestTrue.java b/test/jdk/java/beans/XMLDecoder/spec/TestTrue.java index 5353e2b2a6b..805abc0bf40 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestTrue.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestTrue.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestTrue * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLDecoder/spec/TestVar.java b/test/jdk/java/beans/XMLDecoder/spec/TestVar.java index b9f61b5d790..e3f07dc721d 100644 --- a/test/jdk/java/beans/XMLDecoder/spec/TestVar.java +++ b/test/jdk/java/beans/XMLDecoder/spec/TestVar.java @@ -24,6 +24,7 @@ /* * @test * @summary Tests element + * @run main/othervm -Djava.security.manager=allow TestVar * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/4741757/TestSecurityManager.java b/test/jdk/java/beans/XMLEncoder/4741757/TestSecurityManager.java index ed287b7c5d2..d6df6a28e05 100644 --- a/test/jdk/java/beans/XMLEncoder/4741757/TestSecurityManager.java +++ b/test/jdk/java/beans/XMLEncoder/4741757/TestSecurityManager.java @@ -25,6 +25,7 @@ * @test * @bug 4741757 * @summary Tests encoding with security manager + * @run main/othervm -Djava.security.manager=allow TestSecurityManager * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestBox.java b/test/jdk/java/beans/XMLEncoder/6777487/TestBox.java index a69ec8932b7..a45082b6912 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestBox.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestBox.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for BoxLayout + * @run main/othervm -Djava.security.manager=allow TestBox * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedCollection.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedCollection.java index 774113606e8..6acbc6489c3 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedCollection.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedCollection.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedCollection + * @run main/othervm -Djava.security.manager=allow TestCheckedCollection * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedList.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedList.java index 6b44dd66357..e522895d5f4 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedList.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedList.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedList + * @run main/othervm -Djava.security.manager=allow TestCheckedList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedMap.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedMap.java index c36e70c1720..4fd5d87eb67 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedMap.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedMap.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedMap + * @run main/othervm -Djava.security.manager=allow TestCheckedMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedRandomAccessList.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedRandomAccessList.java index dc59b1394f2..0d34eab2e0e 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedRandomAccessList.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedRandomAccessList.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedRandomAccessList + * @run main/othervm -Djava.security.manager=allow TestCheckedRandomAccessList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSet.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSet.java index 911983be6b3..025cb63ca97 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSet.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSet.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedSet + * @run main/othervm -Djava.security.manager=allow TestCheckedSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedMap.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedMap.java index 4b59a4aa49f..819e46141f7 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedMap.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedMap.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedSortedMap + * @run main/othervm -Djava.security.manager=allow TestCheckedSortedMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedSet.java b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedSet.java index 8f4e709701d..957107fc5d2 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedSet.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestCheckedSortedSet.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for CheckedSortedSet + * @run main/othervm -Djava.security.manager=allow TestCheckedSortedSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestEnumMap.java b/test/jdk/java/beans/XMLEncoder/6777487/TestEnumMap.java index f8ec7d72c15..b11a6ee99c5 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestEnumMap.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestEnumMap.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for EnumMap + * @run main/othervm -Djava.security.manager=allow TestEnumMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/6777487/TestEnumSet.java b/test/jdk/java/beans/XMLEncoder/6777487/TestEnumSet.java index 13799ac5558..6e3e3bf50a3 100644 --- a/test/jdk/java/beans/XMLEncoder/6777487/TestEnumSet.java +++ b/test/jdk/java/beans/XMLEncoder/6777487/TestEnumSet.java @@ -25,6 +25,7 @@ * @test * @bug 6777487 * @summary Tests private field access for EnumSet + * @run main/othervm -Djava.security.manager=allow TestEnumSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/ReferenceToNonStaticField.java b/test/jdk/java/beans/XMLEncoder/ReferenceToNonStaticField.java index d9a748689f6..fd8b36e49e7 100644 --- a/test/jdk/java/beans/XMLEncoder/ReferenceToNonStaticField.java +++ b/test/jdk/java/beans/XMLEncoder/ReferenceToNonStaticField.java @@ -26,6 +26,7 @@ /** * @test * @bug 8060027 + * @run main/othervm -Djava.security.manager=allow ReferenceToNonStaticField */ public final class ReferenceToNonStaticField extends AbstractTest { diff --git a/test/jdk/java/beans/XMLEncoder/Test4631471.java b/test/jdk/java/beans/XMLEncoder/Test4631471.java index 1369b4565be..ba39390d5a8 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4631471.java +++ b/test/jdk/java/beans/XMLEncoder/Test4631471.java @@ -25,6 +25,7 @@ * @test * @bug 4631471 6972468 * @summary Tests DefaultTreeModel encoding + * @run main/othervm -Djava.security.manager=allow Test4631471 * @author Sergey Malenkov, Mark Davidson */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4652928.java b/test/jdk/java/beans/XMLEncoder/Test4652928.java index dffc3d5916a..940decfb156 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4652928.java +++ b/test/jdk/java/beans/XMLEncoder/Test4652928.java @@ -25,6 +25,7 @@ * @test * @bug 4652928 * @summary Tests encoding of collections + * @run main/othervm -Djava.security.manager=allow Test4652928 * @author Sergey Malenkov, Mark Davidson */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4679556.java b/test/jdk/java/beans/XMLEncoder/Test4679556.java index ec8472d9cd3..ebeb45534a5 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4679556.java +++ b/test/jdk/java/beans/XMLEncoder/Test4679556.java @@ -25,6 +25,7 @@ * @test * @bug 4679556 * @summary Tests for duplication of some kind instances + * @run main/othervm -Djava.security.manager=allow Test4679556 * @author Sergey Malenkov, Mark Davidson, Philip Milne */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4903007.java b/test/jdk/java/beans/XMLEncoder/Test4903007.java index 02ba9a6a939..8fcc9c1c4e1 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4903007.java +++ b/test/jdk/java/beans/XMLEncoder/Test4903007.java @@ -25,6 +25,7 @@ * @test * @bug 4903007 6972468 * @summary Tests encoding of container with boxes and BoxLayout + * @run main/othervm -Djava.security.manager=allow Test4903007 * @author Sergey Malenkov, Mark Davidson */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4935607.java b/test/jdk/java/beans/XMLEncoder/Test4935607.java index 2282305ca6e..6bcf3006853 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4935607.java +++ b/test/jdk/java/beans/XMLEncoder/Test4935607.java @@ -25,6 +25,7 @@ * @test %I% %G% * @bug 4935607 * @summary Tests transient properties + * @run main/othervm -Djava.security.manager=allow Test4935607 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4936682.java b/test/jdk/java/beans/XMLEncoder/Test4936682.java index 378e6b8f9b5..fc2952bbff7 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4936682.java +++ b/test/jdk/java/beans/XMLEncoder/Test4936682.java @@ -25,6 +25,7 @@ * @test * @bug 4936682 * @summary Tests encoding of reference to target + * @run main/othervm -Djava.security.manager=allow Test4936682 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4993777.java b/test/jdk/java/beans/XMLEncoder/Test4993777.java index b80b1321c11..3208cbd58b0 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4993777.java +++ b/test/jdk/java/beans/XMLEncoder/Test4993777.java @@ -25,6 +25,7 @@ * @test * @bug 4993777 * @summary Tests encoding of multi-dimensional arrays + * @run main/othervm -Djava.security.manager=allow Test4993777 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test4994637.java b/test/jdk/java/beans/XMLEncoder/Test4994637.java index bfc4d8ccff1..866a816f28d 100644 --- a/test/jdk/java/beans/XMLEncoder/Test4994637.java +++ b/test/jdk/java/beans/XMLEncoder/Test4994637.java @@ -25,6 +25,7 @@ * @test * @bug 4994637 * @summary Tests custom map encoding + * @run main/othervm -Djava.security.manager=allow Test4994637 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test5023550.java b/test/jdk/java/beans/XMLEncoder/Test5023550.java index a350f0b2f67..fc3e7da709c 100644 --- a/test/jdk/java/beans/XMLEncoder/Test5023550.java +++ b/test/jdk/java/beans/XMLEncoder/Test5023550.java @@ -25,6 +25,7 @@ * @test * @bug 5023550 * @summary Tests complex references to owner + * @run main/othervm -Djava.security.manager=allow Test5023550 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test5023552.java b/test/jdk/java/beans/XMLEncoder/Test5023552.java index 45a026a325c..11b0cefe758 100644 --- a/test/jdk/java/beans/XMLEncoder/Test5023552.java +++ b/test/jdk/java/beans/XMLEncoder/Test5023552.java @@ -25,6 +25,7 @@ * @test * @bug 5023552 * @summary Tests reference count updating + * @run main/othervm -Djava.security.manager=allow Test5023552 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test5023557.java b/test/jdk/java/beans/XMLEncoder/Test5023557.java index be77cc282e5..efce0d5ddaa 100644 --- a/test/jdk/java/beans/XMLEncoder/Test5023557.java +++ b/test/jdk/java/beans/XMLEncoder/Test5023557.java @@ -25,6 +25,7 @@ * @test * @bug 5023557 * @summary Tests complex references + * @run main/othervm -Djava.security.manager=allow Test5023557 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test5023559.java b/test/jdk/java/beans/XMLEncoder/Test5023559.java index 72f52eb1f6e..9fda201d3b9 100644 --- a/test/jdk/java/beans/XMLEncoder/Test5023559.java +++ b/test/jdk/java/beans/XMLEncoder/Test5023559.java @@ -25,6 +25,7 @@ * @test * @bug 5023559 * @summary Tests encoding of the object with nested target + * @run main/othervm -Djava.security.manager=allow Test5023559 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6176120.java b/test/jdk/java/beans/XMLEncoder/Test6176120.java index a641eaa5a9f..7725b2ab3a0 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6176120.java +++ b/test/jdk/java/beans/XMLEncoder/Test6176120.java @@ -25,6 +25,7 @@ * @test * @bug 6176120 * @summary Tests bean that contains constructor marked with ConstructorProperties annotation + * @run main/othervm -Djava.security.manager=allow Test6176120 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6187118.java b/test/jdk/java/beans/XMLEncoder/Test6187118.java index 46fbe69a5c9..97506c14132 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6187118.java +++ b/test/jdk/java/beans/XMLEncoder/Test6187118.java @@ -25,6 +25,7 @@ * @test * @bug 6187118 * @summary Tests encoding of immutable list that creates itself + * @run main/othervm -Djava.security.manager=allow Test6187118 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6256805.java b/test/jdk/java/beans/XMLEncoder/Test6256805.java index c680f689b59..676fe49d344 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6256805.java +++ b/test/jdk/java/beans/XMLEncoder/Test6256805.java @@ -25,6 +25,7 @@ * @test * @bug 6256805 * @summary Tests invalid XML characters encoding + * @run main/othervm -Djava.security.manager=allow Test6256805 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6437265.java b/test/jdk/java/beans/XMLEncoder/Test6437265.java index db9f220b28c..c4f97a43b85 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6437265.java +++ b/test/jdk/java/beans/XMLEncoder/Test6437265.java @@ -25,6 +25,7 @@ * @test * @bug 6437265 * @summary Tests encoding of container with BorderLayout + * @run main/othervm -Djava.security.manager=allow Test6437265 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6501431.java b/test/jdk/java/beans/XMLEncoder/Test6501431.java index 877d5984cac..9d93935242f 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6501431.java +++ b/test/jdk/java/beans/XMLEncoder/Test6501431.java @@ -25,6 +25,7 @@ * @test * @bug 6501431 * @summary Tests encoding of JMenuItem with accelerator property + * @run main/othervm -Djava.security.manager=allow Test6501431 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6505888.java b/test/jdk/java/beans/XMLEncoder/Test6505888.java index 44802b6f96e..443d7287c8c 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6505888.java +++ b/test/jdk/java/beans/XMLEncoder/Test6505888.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests bean with the property that is guarded by UnmodifiableList + * @run main/othervm -Djava.security.manager=allow Test6505888 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6531597.java b/test/jdk/java/beans/XMLEncoder/Test6531597.java index b9f501e7f8e..58ca311a98a 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6531597.java +++ b/test/jdk/java/beans/XMLEncoder/Test6531597.java @@ -25,6 +25,7 @@ * @test * @bug 6531597 * @summary Tests encoding of arrays of primitives + * @run main/othervm -Djava.security.manager=allow Test6531597 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6570354.java b/test/jdk/java/beans/XMLEncoder/Test6570354.java index 0d37770a361..c2cffd5a408 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6570354.java +++ b/test/jdk/java/beans/XMLEncoder/Test6570354.java @@ -25,6 +25,7 @@ * @test * @bug 6570354 * @summary Tests listeners removing + * @run main/othervm -Djava.security.manager=allow Test6570354 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6852574.java b/test/jdk/java/beans/XMLEncoder/Test6852574.java index 32a90b7e338..40098cdfc64 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6852574.java +++ b/test/jdk/java/beans/XMLEncoder/Test6852574.java @@ -25,6 +25,7 @@ * @test * @bug 6852574 * @summary Tests Enum subclass encoding + * @run main/othervm -Djava.security.manager=allow Test6852574 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6921644.java b/test/jdk/java/beans/XMLEncoder/Test6921644.java index b333e8a1d3e..9ccbe31bcf5 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6921644.java +++ b/test/jdk/java/beans/XMLEncoder/Test6921644.java @@ -25,6 +25,7 @@ * @test * @bug 6921644 * @summary Tests references to cached integer + * @run main/othervm -Djava.security.manager=allow Test6921644 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test6989223.java b/test/jdk/java/beans/XMLEncoder/Test6989223.java index 57730f1172b..1bbc7fd96a7 100644 --- a/test/jdk/java/beans/XMLEncoder/Test6989223.java +++ b/test/jdk/java/beans/XMLEncoder/Test6989223.java @@ -25,6 +25,7 @@ * @test * @bug 6989223 * @summary Tests Rectangle2D.Double encoding + * @run main/othervm -Djava.security.manager=allow Test6989223 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test7080156.java b/test/jdk/java/beans/XMLEncoder/Test7080156.java index 4cbd6a091f1..1d6e86144b4 100644 --- a/test/jdk/java/beans/XMLEncoder/Test7080156.java +++ b/test/jdk/java/beans/XMLEncoder/Test7080156.java @@ -25,6 +25,7 @@ * @test * @bug 7080156 7094245 * @summary Tests beans with public arrays + * @run main/othervm -Djava.security.manager=allow Test7080156 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test7092744.java b/test/jdk/java/beans/XMLEncoder/Test7092744.java index 52f029b47a3..838fdd60bea 100644 --- a/test/jdk/java/beans/XMLEncoder/Test7092744.java +++ b/test/jdk/java/beans/XMLEncoder/Test7092744.java @@ -25,6 +25,7 @@ * @test * @bug 7092744 * @summary Tests for ambiguous methods + * @run main/othervm -Djava.security.manager=allow Test7092744 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test7169395.java b/test/jdk/java/beans/XMLEncoder/Test7169395.java index 42257f512cd..70df96bfb54 100644 --- a/test/jdk/java/beans/XMLEncoder/Test7169395.java +++ b/test/jdk/java/beans/XMLEncoder/Test7169395.java @@ -25,6 +25,7 @@ * @test * @bug 7169395 * @summary Tests that array list initialized correctly + * @run main/othervm -Djava.security.manager=allow Test7169395 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test8013416.java b/test/jdk/java/beans/XMLEncoder/Test8013416.java index bcc345744ff..3f5e3b4887f 100644 --- a/test/jdk/java/beans/XMLEncoder/Test8013416.java +++ b/test/jdk/java/beans/XMLEncoder/Test8013416.java @@ -25,6 +25,7 @@ * @test * @bug 8013416 * @summary Tests public synthetic methods + * @run main/othervm -Djava.security.manager=allow Test8013416 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test8013557.java b/test/jdk/java/beans/XMLEncoder/Test8013557.java index 75036f80ded..e5ea44b302d 100644 --- a/test/jdk/java/beans/XMLEncoder/Test8013557.java +++ b/test/jdk/java/beans/XMLEncoder/Test8013557.java @@ -25,6 +25,7 @@ * @test * @bug 8013557 * @summary Tests beans with public fields + * @run main/othervm -Djava.security.manager=allow Test8013557 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test8016545.java b/test/jdk/java/beans/XMLEncoder/Test8016545.java index 466d8eb01fa..789eb116c9d 100644 --- a/test/jdk/java/beans/XMLEncoder/Test8016545.java +++ b/test/jdk/java/beans/XMLEncoder/Test8016545.java @@ -25,6 +25,7 @@ * @test * @bug 8016545 * @summary Tests beans with predefined fields + * @run main/othervm -Djava.security.manager=allow Test8016545 * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/Test8027066.java b/test/jdk/java/beans/XMLEncoder/Test8027066.java index 22d495d4f31..a2183208b4e 100644 --- a/test/jdk/java/beans/XMLEncoder/Test8027066.java +++ b/test/jdk/java/beans/XMLEncoder/Test8027066.java @@ -25,6 +25,7 @@ * @test * @bug 8027066 * @summary Tests that the same array can be encoded twice + * @run main/othervm -Djava.security.manager=allow Test8027066 * @author Anton Nashatyrev */ public class Test8027066 extends AbstractTest { diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java b/test/jdk/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java index 6abd41fd9c9..93b02ac29b7 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java @@ -25,6 +25,7 @@ * @test * @bug 6501431 * @summary Tests AWTKeyStroke encoding + * @run main/othervm -Djava.security.manager=allow java_awt_AWTKeyStroke * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_BasicStroke.java b/test/jdk/java/beans/XMLEncoder/java_awt_BasicStroke.java index 6a6efdad199..9f7631d80a2 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_BasicStroke.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_BasicStroke.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests BasicStroke encoding + * @run main/othervm -Djava.security.manager=allow java_awt_BasicStroke * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_BorderLayout.java b/test/jdk/java/beans/XMLEncoder/java_awt_BorderLayout.java index a7e515ad1b5..beec75e2825 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_BorderLayout.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_BorderLayout.java @@ -25,6 +25,7 @@ * @test * @bug 4916852 * @summary Tests BorderLayout encoding + * @run main/othervm -Djava.security.manager=allow java_awt_BorderLayout * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_CardLayout.java b/test/jdk/java/beans/XMLEncoder/java_awt_CardLayout.java index 382bba5addd..2b58b2724b5 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_CardLayout.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_CardLayout.java @@ -26,6 +26,7 @@ * @bug 8007458 * @summary Tests CardLayout encoding * @modules java.desktop/java.awt:open + * @run main/othervm -Djava.security.manager=allow java_awt_CardLayout * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Color.java b/test/jdk/java/beans/XMLEncoder/java_awt_Color.java index 6e310e0dd3e..935b36f52da 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Color.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Color.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests Color encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Color * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Component.java b/test/jdk/java/beans/XMLEncoder/java_awt_Component.java index d4207fd4978..71329201ed4 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Component.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Component.java @@ -25,6 +25,7 @@ * @test * @bug 4916852 * @summary Tests Component encoding (background, foreground and font) + * @run main/othervm -Djava.security.manager=allow java_awt_Component * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Cursor.java b/test/jdk/java/beans/XMLEncoder/java_awt_Cursor.java index 9090742bbd2..7612925c898 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Cursor.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Cursor.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests Cursor encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Cursor * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Dimension.java b/test/jdk/java/beans/XMLEncoder/java_awt_Dimension.java index 8e82767e558..3a9f61ac90d 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Dimension.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Dimension.java @@ -25,6 +25,7 @@ * @test * @bug 4741757 6402062 6471539 * @summary Tests Dimension encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Dimension * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Font.java b/test/jdk/java/beans/XMLEncoder/java_awt_Font.java index 95f5f671290..45a3ef61d9c 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Font.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Font.java @@ -25,6 +25,7 @@ * @test * @bug 4951733 6402062 * @summary Tests Font encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Font * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_GradientPaint.java b/test/jdk/java/beans/XMLEncoder/java_awt_GradientPaint.java index 40d8bf59a9f..ccf7022ae7f 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_GradientPaint.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_GradientPaint.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests GradientPaint encoding + * @run main/othervm -Djava.security.manager=allow java_awt_GradientPaint * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_GridBagConstraints.java b/test/jdk/java/beans/XMLEncoder/java_awt_GridBagConstraints.java index 656a11d763f..2d80d9cd731 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_GridBagConstraints.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_GridBagConstraints.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 * @summary Tests GridBagConstraints encoding + * @run main/othervm -Djava.security.manager=allow java_awt_GridBagConstraints * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_GridBagLayout.java b/test/jdk/java/beans/XMLEncoder/java_awt_GridBagLayout.java index 12af8203fb4..98a5cc48715 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_GridBagLayout.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_GridBagLayout.java @@ -26,6 +26,7 @@ * @bug 8007458 * @summary Tests GridBagLayout encoding * @modules java.desktop/java.awt:open + * @run main/othervm -Djava.security.manager=allow java_awt_GridBagLayout * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Insets.java b/test/jdk/java/beans/XMLEncoder/java_awt_Insets.java index 643701ebc90..cac3c10516a 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Insets.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Insets.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6471539 * @summary Tests Insets encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Insets * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java b/test/jdk/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java index 7a636b10c65..47b9f28e67e 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_LinearGradientPaint.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests LinearGradientPaint encoding + * @run main/othervm -Djava.security.manager=allow java_awt_LinearGradientPaint * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_MenuShortcut.java b/test/jdk/java/beans/XMLEncoder/java_awt_MenuShortcut.java index 497af7bc797..5b0a7f1f43e 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_MenuShortcut.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_MenuShortcut.java @@ -25,6 +25,7 @@ * @test * @bug 4818598 * @summary Tests MenuShortcut value encoding + * @run main/othervm -Djava.security.manager=allow java_awt_MenuShortcut * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Point.java b/test/jdk/java/beans/XMLEncoder/java_awt_Point.java index ed65d1ed97e..6aeb17f6bb0 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Point.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Point.java @@ -25,6 +25,7 @@ * @test * @bug 4741757 6402062 6471539 * @summary Tests Point encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Point * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java b/test/jdk/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java index fbb7be9864a..f432153504e 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_RadialGradientPaint.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests RadialGradientPaint encoding + * @run main/othervm -Djava.security.manager=allow java_awt_RadialGradientPaint * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_Rectangle.java b/test/jdk/java/beans/XMLEncoder/java_awt_Rectangle.java index 4212c047d5d..132c6ffdcce 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_Rectangle.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_Rectangle.java @@ -25,6 +25,7 @@ * @test * @bug 4741757 6402062 6471539 * @summary Tests Rectangle encoding + * @run main/othervm -Djava.security.manager=allow java_awt_Rectangle * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_ScrollPane.java b/test/jdk/java/beans/XMLEncoder/java_awt_ScrollPane.java index 4861f625ff9..a3a7552b90b 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_ScrollPane.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_ScrollPane.java @@ -26,6 +26,7 @@ * @bug 6402062 6487891 * @summary Tests ScrollPane encoding * @key headful + * @run main/othervm -Djava.security.manager=allow java_awt_ScrollPane * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java b/test/jdk/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java index 9e5da1160c1..d7d7e16eb9a 100644 --- a/test/jdk/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java +++ b/test/jdk/java/beans/XMLEncoder/java_awt_geom_AffineTransform.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests AffineTransform encoding + * @run main/othervm -Djava.security.manager=allow java_awt_geom_AffineTransform * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_beans_EventHandler.java b/test/jdk/java/beans/XMLEncoder/java_beans_EventHandler.java index 3eb1b1df877..700032b7d65 100644 --- a/test/jdk/java/beans/XMLEncoder/java_beans_EventHandler.java +++ b/test/jdk/java/beans/XMLEncoder/java_beans_EventHandler.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests EventHandler encoding + * @run main/othervm -Djava.security.manager=allow java_beans_EventHandler * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_beans_Expression.java b/test/jdk/java/beans/XMLEncoder/java_beans_Expression.java index 7a1fb303b0c..b4fa548f2de 100644 --- a/test/jdk/java/beans/XMLEncoder/java_beans_Expression.java +++ b/test/jdk/java/beans/XMLEncoder/java_beans_Expression.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests Expression encoding + * @run main/othervm -Djava.security.manager=allow java_beans_Expression * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_beans_Statement.java b/test/jdk/java/beans/XMLEncoder/java_beans_Statement.java index a7b952d0b59..9fa576a6a1b 100644 --- a/test/jdk/java/beans/XMLEncoder/java_beans_Statement.java +++ b/test/jdk/java/beans/XMLEncoder/java_beans_Statement.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests Statement encoding + * @run main/othervm -Djava.security.manager=allow java_beans_Statement * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_Character.java b/test/jdk/java/beans/XMLEncoder/java_lang_Character.java index 15e8c856222..f2970d159c2 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_Character.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_Character.java @@ -25,6 +25,7 @@ * @test * @bug 6256805 * @summary Tests invalid XML character encoding + * @run main/othervm -Djava.security.manager=allow java_lang_Character * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_Class.java b/test/jdk/java/beans/XMLEncoder/java_lang_Class.java index 85217504cf6..fb1613a0164 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_Class.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_Class.java @@ -25,6 +25,7 @@ * @test * @bug 4818598 * @summary Tests Class value encoding + * @run main/othervm -Djava.security.manager=allow java_lang_Class * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_Enum.java b/test/jdk/java/beans/XMLEncoder/java_lang_Enum.java index 7bf64345134..445e9364eb9 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_Enum.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_Enum.java @@ -25,6 +25,7 @@ * @test * @bug 5015403 * @summary Tests Enum value encoding + * @run main/othervm -Djava.security.manager=allow java_lang_Enum * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_String.java b/test/jdk/java/beans/XMLEncoder/java_lang_String.java index 31d5a81a518..9d2c68a06bd 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_String.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_String.java @@ -25,6 +25,7 @@ * @test * @bug 6256805 * @summary Tests invalid XML string encoding + * @run main/othervm -Djava.security.manager=allow java_lang_String * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Field.java b/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Field.java index 699d1b53a49..3a06079dd19 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Field.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Field.java @@ -25,6 +25,7 @@ * @test * @bug 4818598 * @summary Tests Field value encoding + * @run main/othervm -Djava.security.manager=allow java_lang_reflect_Field * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Method.java b/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Method.java index 161de331c23..684bfb40375 100644 --- a/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Method.java +++ b/test/jdk/java/beans/XMLEncoder/java_lang_reflect_Method.java @@ -25,6 +25,7 @@ * @test * @bug 4818598 * @summary Tests Method value encoding + * @run main/othervm -Djava.security.manager=allow java_lang_reflect_Method * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_net_URI.java b/test/jdk/java/beans/XMLEncoder/java_net_URI.java index 4055008206c..dff6df732da 100644 --- a/test/jdk/java/beans/XMLEncoder/java_net_URI.java +++ b/test/jdk/java/beans/XMLEncoder/java_net_URI.java @@ -25,6 +25,7 @@ * @test * @bug 6245149 * @summary Tests URI encoding + * @run main/othervm -Djava.security.manager=allow java_net_URI * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_sql_Date.java b/test/jdk/java/beans/XMLEncoder/java_sql_Date.java index 7278e81e836..032fad774ba 100644 --- a/test/jdk/java/beans/XMLEncoder/java_sql_Date.java +++ b/test/jdk/java/beans/XMLEncoder/java_sql_Date.java @@ -25,6 +25,7 @@ * @test * @bug 4733558 6471539 * @summary Tests Date encoding + * @run main/othervm -Djava.security.manager=allow java_sql_Date * @author Sergey Malenkov * @modules java.desktop * java.sql diff --git a/test/jdk/java/beans/XMLEncoder/java_sql_Time.java b/test/jdk/java/beans/XMLEncoder/java_sql_Time.java index 589bfa8f16a..5302da13805 100644 --- a/test/jdk/java/beans/XMLEncoder/java_sql_Time.java +++ b/test/jdk/java/beans/XMLEncoder/java_sql_Time.java @@ -25,6 +25,7 @@ * @test * @bug 4733558 6471539 * @summary Tests Time encoding + * @run main/othervm -Djava.security.manager=allow java_sql_Time * @author Sergey Malenkov * @modules java.desktop * java.sql diff --git a/test/jdk/java/beans/XMLEncoder/java_sql_Timestamp.java b/test/jdk/java/beans/XMLEncoder/java_sql_Timestamp.java index 94d473155c3..0f2f80a8ccb 100644 --- a/test/jdk/java/beans/XMLEncoder/java_sql_Timestamp.java +++ b/test/jdk/java/beans/XMLEncoder/java_sql_Timestamp.java @@ -25,6 +25,7 @@ * @test * @bug 4733558 6471539 * @summary Tests Timestamp encoding + * @run main/othervm -Djava.security.manager=allow java_sql_Timestamp * @author Sergey Malenkov * @modules java.desktop * java.sql diff --git a/test/jdk/java/beans/XMLEncoder/java_util_ArrayList.java b/test/jdk/java/beans/XMLEncoder/java_util_ArrayList.java index 1a84062a77f..ece00580ec3 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_ArrayList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_ArrayList.java @@ -25,6 +25,7 @@ * @test * @bug 4631471 * @summary Tests ArrayList encoding + * @run main/othervm -Djava.security.manager=allow java_util_ArrayList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyList.java index 0f41464060e..b5b0e12c5e6 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests EmptyList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_EmptyList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java index 794c95c5c26..ccc4385ed92 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests EmptyMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_EmptyMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptySet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptySet.java index fe03a8d751f..f74d409445a 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptySet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_EmptySet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests EmptySet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_EmptySet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonList.java index 66bcd158d1f..5942217a59c 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SingletonList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SingletonList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java index 5efbda71fa2..e9fd90abf81 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SingletonMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SingletonMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java index d302c29abbd..fddd57c104f 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SingletonSet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SingletonSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java index 6548a455311..f92ec82690c 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedCollection encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedCollection * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java index b95357fa085..fbc9ea6e464 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java index b9aeea1a016..998abe17ef3 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java index 382b60e457f..15eb8bf1980 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedRandomAccessList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedRandomAccessList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java index 0fd60cf1a10..54e88a1ccfd 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedSet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java index 72518bfcff1..4ff12e4ebe8 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedSortedMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedSortedMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java index 85d0491fb5f..548e3c41d40 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests SynchronizedSortedSet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_SynchronizedSortedSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java index de964c81dfd..6f2a24205c8 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableCollection encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableCollection * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java index 739cc86c633..478759e4263 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java index 00db87b7ae0..7ff79708166 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java index a45360003cd..e2bd7ff2004 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableRandomAccessList encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableRandomAccessList * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java index 31decb2c886..92f82fb5319 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableSet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java index 739460fe504..414f404dc71 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableSortedMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableSortedMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java index 53ff8cf3ed0..1103fc3d3d2 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java @@ -25,6 +25,7 @@ * @test * @bug 6505888 * @summary Tests UnmodifiableSortedSet encoding + * @run main/othervm -Djava.security.manager=allow java_util_Collections_UnmodifiableSortedSet * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_Date.java b/test/jdk/java/beans/XMLEncoder/java_util_Date.java index 2fbeedba52a..b2b2b6062be 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_Date.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_Date.java @@ -25,6 +25,7 @@ * @test * @bug 4733558 6471539 * @summary Tests Date encoding + * @run main/othervm -Djava.security.manager=allow java_util_Date * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/java_util_HashMap.java b/test/jdk/java/beans/XMLEncoder/java_util_HashMap.java index 689212c237d..f4359fbcc12 100644 --- a/test/jdk/java/beans/XMLEncoder/java_util_HashMap.java +++ b/test/jdk/java/beans/XMLEncoder/java_util_HashMap.java @@ -25,6 +25,7 @@ * @test * @bug 4631471 4921212 4994637 * @summary Tests HashMap encoding + * @run main/othervm -Djava.security.manager=allow java_util_HashMap * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_Box.java b/test/jdk/java/beans/XMLEncoder/javax_swing_Box.java index abf1cd53b31..ef3ae7b9903 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_Box.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_Box.java @@ -25,6 +25,7 @@ * @test * @bug 4818598 * @summary Tests Box value encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_Box * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_BoxLayout.java b/test/jdk/java/beans/XMLEncoder/javax_swing_BoxLayout.java index b4f9c052413..d70b96a49e5 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_BoxLayout.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_BoxLayout.java @@ -25,6 +25,7 @@ * @test * @bug 6405175 6487891 * @summary Tests BoxLayout encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_BoxLayout * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_Box_Filler.java b/test/jdk/java/beans/XMLEncoder/javax_swing_Box_Filler.java index b6fbd1a6d83..b08ce2f113c 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_Box_Filler.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_Box_Filler.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests Filler encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_Box_Filler * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java b/test/jdk/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java index ce66182ceaf..ae9bf62047f 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests DefaultCellEditor encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_DefaultCellEditor * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_JButton.java b/test/jdk/java/beans/XMLEncoder/javax_swing_JButton.java index 3582716ffa2..8dbb2414819 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_JButton.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_JButton.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests JButton encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_JButton * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_JComponent.java b/test/jdk/java/beans/XMLEncoder/javax_swing_JComponent.java index 9ca11f9954a..2695538ce24 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_JComponent.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_JComponent.java @@ -28,6 +28,7 @@ * @test * @bug 8131754 * @summary Tests JComponent encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_JComponent */ public final class javax_swing_JComponent extends AbstractTest { diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_JLayeredPane.java b/test/jdk/java/beans/XMLEncoder/javax_swing_JLayeredPane.java index 1e41bc41e7b..9ca4ceabd63 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_JLayeredPane.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_JLayeredPane.java @@ -25,6 +25,7 @@ * @test * @bug 5023552 6972468 * @summary Tests JLayeredPane encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_JLayeredPane * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_JSplitPane.java b/test/jdk/java/beans/XMLEncoder/javax_swing_JSplitPane.java index 2349c99d315..020e3c85db6 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_JSplitPane.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_JSplitPane.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests JSplitPane encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_JSplitPane * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_JTree.java b/test/jdk/java/beans/XMLEncoder/javax_swing_JTree.java index b1ce8efb7a8..2ee375c1763 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_JTree.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_JTree.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests JTree encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_JTree * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_KeyStroke.java b/test/jdk/java/beans/XMLEncoder/javax_swing_KeyStroke.java index 86f1f7b71d5..3ad47cb95f2 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_KeyStroke.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_KeyStroke.java @@ -25,6 +25,7 @@ * @test * @bug 6501431 * @summary Tests KeyStroke encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_KeyStroke * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_OverlayLayout.java b/test/jdk/java/beans/XMLEncoder/javax_swing_OverlayLayout.java index 2ace41d0008..447aba0791a 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_OverlayLayout.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_OverlayLayout.java @@ -25,6 +25,7 @@ * @test * @bug 6405175 6487891 * @summary Tests OverlayLayout encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_OverlayLayout * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java index e2909fa3e38..f6b1ab2e817 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests BevelBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_BevelBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java index 9c3953f4767..9e146a3af09 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests CompoundBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_CompoundBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java index 89067c82f06..578fe315149 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests EmptyBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_EmptyBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java index b1244539c6d..04418dc89ec 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests EtchedBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_EtchedBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_LineBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_LineBorder.java index 7f2b8fa7afa..b4cee00a9b9 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_LineBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_LineBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests LineBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_LineBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java index 5f68c267228..60e24780503 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 * @summary Tests MatteBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_MatteBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java index e2bd372df11..4e6fbed0393 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests SoftBevelBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_SoftBevelBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java index 0ee1fda4ca8..fb9420d9a90 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_StrokeBorder.java @@ -25,6 +25,7 @@ * @test * @bug 4358979 * @summary Tests StrokeBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_StrokeBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java b/test/jdk/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java index 42caa3d5d46..257b6497b65 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests TitledBorder encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_border_TitledBorder * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java index 91b84332c23..770a6603659 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests BevelBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_BevelBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java index d8fbeb3bbfa..936a76fb661 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests CompoundBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_CompoundBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java index b65f502588a..9721f6c487b 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests EmptyBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_EmptyBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java index 4f393ebddd8..ce818c6afbc 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests EtchedBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_EtchedBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java index 540ce2070b1..abc67c6d51f 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests LineBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_LineBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java index d7e2aac96e5..4be66912568 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 * @summary Tests MatteBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_MatteBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java index 24564fd96fe..03e59c15562 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests TitledBorderUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_BorderUIResource_TitledBorderUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java index 313cfa66a17..86f04ac3fa8 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests ColorUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_ColorUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java index a28d7cf4387..32770bc60f0 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java @@ -25,6 +25,7 @@ * @test * @bug 4951733 6402062 * @summary Tests FontUIResource encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_plaf_FontUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java b/test/jdk/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java index 7ee7c0b94d8..93e7d91175e 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests DefaultTreeModel encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_tree_DefaultTreeModel * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/javax_swing_tree_TreePath.java b/test/jdk/java/beans/XMLEncoder/javax_swing_tree_TreePath.java index 7171eadac82..c154be327ea 100644 --- a/test/jdk/java/beans/XMLEncoder/javax_swing_tree_TreePath.java +++ b/test/jdk/java/beans/XMLEncoder/javax_swing_tree_TreePath.java @@ -25,6 +25,7 @@ * @test * @bug 6402062 6487891 * @summary Tests TreePath encoding + * @run main/othervm -Djava.security.manager=allow javax_swing_tree_TreePath * @author Sergey Malenkov */ diff --git a/test/jdk/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java b/test/jdk/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java index b6e794690d1..5ae0f23ed4e 100644 --- a/test/jdk/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java +++ b/test/jdk/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java @@ -26,6 +26,7 @@ * @bug 6589532 * @summary Tests PrintColorUIResource value encoding * @modules java.desktop/sun.swing + * @run main/othervm -Djava.security.manager=allow sun_swing_PrintColorUIResource * @author Sergey Malenkov */ diff --git a/test/jdk/java/io/File/CheckPermission.java b/test/jdk/java/io/File/CheckPermission.java index 33fffddd283..f6126a08843 100644 --- a/test/jdk/java/io/File/CheckPermission.java +++ b/test/jdk/java/io/File/CheckPermission.java @@ -25,6 +25,7 @@ * @bug 8017212 * @summary Examine methods in File.java that access the file system do the * right permission check when a security manager exists. + * @run main/othervm -Djava.security.manager=allow CheckPermission * @author Dan Xu */ diff --git a/test/jdk/java/io/File/GetXSpace.java b/test/jdk/java/io/File/GetXSpace.java index 80a23db63bb..39402fa9b70 100644 --- a/test/jdk/java/io/File/GetXSpace.java +++ b/test/jdk/java/io/File/GetXSpace.java @@ -27,6 +27,7 @@ * @requires (os.family == "linux" | os.family == "mac" | * os.family == "windows") * @summary Basic functionality of File.get-X-Space methods. + * @run main/othervm -Djava.security.manager=allow GetXSpace */ import java.io.BufferedReader; diff --git a/test/jdk/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java b/test/jdk/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java index 973a539318e..093ef1c98c9 100644 --- a/test/jdk/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java +++ b/test/jdk/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java @@ -27,7 +27,7 @@ * cannot be constructed if they override security-sensitive non-final * methods. * @build AuditStreamSubclass - * @run main/othervm AuditStreamSubclass + * @run main/othervm -Djava.security.manager=allow AuditStreamSubclass */ import java.io.*; diff --git a/test/jdk/java/lang/Class/forName/modules/TestDriver.java b/test/jdk/java/lang/Class/forName/modules/TestDriver.java index 218aaeb5252..de5505063a2 100644 --- a/test/jdk/java/lang/Class/forName/modules/TestDriver.java +++ b/test/jdk/java/lang/Class/forName/modules/TestDriver.java @@ -114,6 +114,7 @@ public void testDeniedClassLoaderAccess() throws Exception { String[] options = new String[] { "--module-path", MOD_DEST_DIR.toString(), "--add-modules", String.join(",", modules), + "-Djava.security.manager=allow", "-m", "m3/p3.NoGetClassLoaderAccess" }; assertTrue(executeTestJava(options) diff --git a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java index 1b112699b68..f62e80dddbb 100644 --- a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java +++ b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java @@ -42,7 +42,7 @@ * hidden from reflection access. * @modules java.base/java.lang:open * @run main/othervm ClassDeclaredFieldsTest UNSECURE - * @run main/othervm ClassDeclaredFieldsTest SECURE + * @run main/othervm -Djava.security.manager=allow ClassDeclaredFieldsTest SECURE * * @author danielfuchs */ diff --git a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java index fa026314908..12cab1f5d0f 100644 --- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java +++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java @@ -65,7 +65,7 @@ * and call setAccessible(false) followed by setAccessible(true); * @modules java.base/jdk.internal.module * @run main/othervm --add-modules=ALL-SYSTEM FieldSetAccessibleTest UNSECURE - * @run main/othervm --add-modules=ALL-SYSTEM FieldSetAccessibleTest SECURE + * @run main/othervm --add-modules=ALL-SYSTEM -Djava.security.manager=allow FieldSetAccessibleTest SECURE * * @author danielfuchs */ diff --git a/test/jdk/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java b/test/jdk/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java index 1c81b09fa5a..e74942bef74 100644 --- a/test/jdk/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java +++ b/test/jdk/java/lang/Class/getEnclosingConstructor/EnclosingConstructorWithSecurityManager.java @@ -25,7 +25,7 @@ * @test * @bug 8014678 * @run main EnclosingConstructorWithSecurityManager - * @run main/othervm EnclosingConstructorWithSecurityManager "WithSecurityManager" + * @run main/othervm -Djava.security.manager=allow EnclosingConstructorWithSecurityManager "WithSecurityManager" */ public class EnclosingConstructorWithSecurityManager { diff --git a/test/jdk/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java b/test/jdk/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java index fa14214cda6..26120d1f034 100644 --- a/test/jdk/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java +++ b/test/jdk/java/lang/Class/getEnclosingMethod/EnclosingMethodWithSecurityManager.java @@ -25,7 +25,7 @@ * @test * @bug 8014678 * @run main EnclosingMethodWithSecurityManager - * @run main/othervm EnclosingMethodWithSecurityManager "WithSecurityManager" + * @run main/othervm -Djava.security.manager=allow EnclosingMethodWithSecurityManager "WithSecurityManager" */ public class EnclosingMethodWithSecurityManager { diff --git a/test/jdk/java/lang/Class/getResource/ResourcesTest.java b/test/jdk/java/lang/Class/getResource/ResourcesTest.java index ebb8b29818e..ef02568c788 100644 --- a/test/jdk/java/lang/Class/getResource/ResourcesTest.java +++ b/test/jdk/java/lang/Class/getResource/ResourcesTest.java @@ -82,7 +82,8 @@ public void runTest() throws Exception { int exitValue = executeTestJava("--module-path", MODS_DIR.toString(), "--add-modules", "m1,m2", - "-cp", CLASSES_DIR.toString(), + "-cp", CLASSES_DIR.toString(), + "-Djava.security.manager=allow", "Main") .outputTo(System.out) .errorTo(System.out) diff --git a/test/jdk/java/lang/ClassLoader/UninitializedParent.java b/test/jdk/java/lang/ClassLoader/UninitializedParent.java index 0ef23a280f9..f84003257ff 100644 --- a/test/jdk/java/lang/ClassLoader/UninitializedParent.java +++ b/test/jdk/java/lang/ClassLoader/UninitializedParent.java @@ -26,7 +26,7 @@ * @bug 6636650 * @summary Uninitialized class loaders should not be a parent of other * class loaders. - * @run main/othervm UninitializedParent + * @run main/othervm -Djava.security.manager=allow UninitializedParent */ diff --git a/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java b/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java index 6daa8a0bc25..804494d8733 100644 --- a/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java +++ b/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java @@ -80,7 +80,8 @@ public void runTest() throws Exception { int exitValue = executeTestJava("--module-path", MODS_DIR.toString(), "--add-modules", "m1,m2", - "-cp", CLASSES_DIR.toString(), + "-cp", CLASSES_DIR.toString(), + "-Djava.security.manager=allow", "Main") .outputTo(System.out) .errorTo(System.out) diff --git a/test/jdk/java/lang/ModuleTests/BasicModuleTest.java b/test/jdk/java/lang/ModuleTests/BasicModuleTest.java index 3f12734efd1..1a1f26f423e 100644 --- a/test/jdk/java/lang/ModuleTests/BasicModuleTest.java +++ b/test/jdk/java/lang/ModuleTests/BasicModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -35,7 +35,7 @@ * @test * @summary Basic test of java.lang.Module * @modules java.desktop java.xml - * @run testng/othervm --illegal-access=deny BasicModuleTest + * @run testng/othervm BasicModuleTest */ public class BasicModuleTest { diff --git a/test/jdk/java/lang/ModuleTests/WithSecurityManager.java b/test/jdk/java/lang/ModuleTests/WithSecurityManager.java index 88813c859ac..2e0bbc983fe 100644 --- a/test/jdk/java/lang/ModuleTests/WithSecurityManager.java +++ b/test/jdk/java/lang/ModuleTests/WithSecurityManager.java @@ -25,8 +25,8 @@ * @test * @modules jdk.compiler * @summary Test java.lang.Module methods that specify permission checks - * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow - * @run main/othervm WithSecurityManager deny + * @run main/othervm -Djava.security.manager=allow -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow + * @run main/othervm -Djava.security.manager=allow WithSecurityManager deny */ import java.io.IOException; diff --git a/test/jdk/java/lang/ProcessBuilder/Basic.java b/test/jdk/java/lang/ProcessBuilder/Basic.java index 750b735e07d..db820b49a09 100644 --- a/test/jdk/java/lang/ProcessBuilder/Basic.java +++ b/test/jdk/java/lang/ProcessBuilder/Basic.java @@ -32,8 +32,8 @@ * @summary Basic tests for Process and Environment Variable code * @modules java.base/java.lang:open * @library /test/lib - * @run main/othervm/timeout=300 Basic - * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic + * @run main/othervm/timeout=300 -Djava.security.manager=allow Basic + * @run main/othervm/timeout=300 -Djava.security.manager=allow -Djdk.lang.Process.launchMechanism=fork Basic * @author Martin Buchholz */ @@ -42,7 +42,7 @@ * @modules java.base/java.lang:open * @requires (os.family == "linux") * @library /test/lib - * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=posix_spawn Basic + * @run main/othervm/timeout=300 -Djava.security.manager=allow -Djdk.lang.Process.launchMechanism=posix_spawn Basic */ import java.lang.ProcessBuilder.Redirect; diff --git a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java index ee0319bc118..1aa56c9b728 100644 --- a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java +++ b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java @@ -28,7 +28,7 @@ * @summary Check that Process-related classes have the proper * doPrivileged blocks, and can be initialized with an adversarial * security manager. - * @run main/othervm SecurityManagerClinit + * @run main/othervm -Djava.security.manager=allow SecurityManagerClinit * @author Martin Buchholz */ diff --git a/test/jdk/java/lang/ProcessHandle/PermissionTest.java b/test/jdk/java/lang/ProcessHandle/PermissionTest.java index 25616b7f5b5..92085e70bcb 100644 --- a/test/jdk/java/lang/ProcessHandle/PermissionTest.java +++ b/test/jdk/java/lang/ProcessHandle/PermissionTest.java @@ -40,7 +40,7 @@ /* * @test - * @run testng/othervm PermissionTest + * @run testng/othervm -Djava.security.manager=allow PermissionTest * @summary Test Permissions to access Info */ diff --git a/test/jdk/java/lang/RuntimeTests/exec/ExecCommand.java b/test/jdk/java/lang/RuntimeTests/exec/ExecCommand.java index 30b13cb7c68..2b037aaafd6 100644 --- a/test/jdk/java/lang/RuntimeTests/exec/ExecCommand.java +++ b/test/jdk/java/lang/RuntimeTests/exec/ExecCommand.java @@ -25,7 +25,7 @@ /** * @test * @bug 8012453 8016046 - * @run main/othervm ExecCommand + * @run main/othervm -Djava.security.manager=allow ExecCommand * @summary workaround for legacy applications with Runtime.getRuntime().exec(String command) */ diff --git a/test/jdk/java/lang/SecurityManager/CheckPackageMatching.java b/test/jdk/java/lang/SecurityManager/CheckPackageMatching.java index 418a04a6857..1ad1f57ff43 100644 --- a/test/jdk/java/lang/SecurityManager/CheckPackageMatching.java +++ b/test/jdk/java/lang/SecurityManager/CheckPackageMatching.java @@ -25,7 +25,7 @@ * @test * @bug 8072692 * @summary Check the matching implemented by SecurityManager.checkPackageAccess - * @run main/othervm CheckPackageMatching + * @run main/othervm -Djava.security.manager=allow CheckPackageMatching */ import java.security.Security; diff --git a/test/jdk/java/lang/SecurityManager/CheckSecurityProvider.java b/test/jdk/java/lang/SecurityManager/CheckSecurityProvider.java index 7134654c044..4e97c625955 100644 --- a/test/jdk/java/lang/SecurityManager/CheckSecurityProvider.java +++ b/test/jdk/java/lang/SecurityManager/CheckSecurityProvider.java @@ -25,7 +25,7 @@ * @test * @bug 6997010 7191662 * @summary Consolidate java.security files into one file with modifications - * @run main/othervm CheckSecurityProvider + * @run main/othervm -Djava.security.manager=allow CheckSecurityProvider */ import java.security.Provider; diff --git a/test/jdk/java/lang/StackWalker/CallerSensitiveMethod/Main.java b/test/jdk/java/lang/StackWalker/CallerSensitiveMethod/Main.java index 6769f6d3355..a821e02544d 100644 --- a/test/jdk/java/lang/StackWalker/CallerSensitiveMethod/Main.java +++ b/test/jdk/java/lang/StackWalker/CallerSensitiveMethod/Main.java @@ -29,7 +29,7 @@ * @modules java.base/jdk.internal.reflect * @build java.base/java.util.CSM csm/* * @run main/othervm csm/jdk.test.CallerSensitiveTest - * @run main/othervm csm/jdk.test.CallerSensitiveTest sm + * @run main/othervm -Djava.security.manager=allow csm/jdk.test.CallerSensitiveTest sm */ public class Main { } diff --git a/test/jdk/java/lang/StackWalker/GetCallerClassTest.java b/test/jdk/java/lang/StackWalker/GetCallerClassTest.java index 31754720bde..c02f0f051ab 100644 --- a/test/jdk/java/lang/StackWalker/GetCallerClassTest.java +++ b/test/jdk/java/lang/StackWalker/GetCallerClassTest.java @@ -26,7 +26,7 @@ * @bug 8140450 8152893 8189291 * @summary Basic test for StackWalker.getCallerClass() * @run main/othervm GetCallerClassTest - * @run main/othervm GetCallerClassTest sm + * @run main/othervm -Djava.security.manager=allow GetCallerClassTest sm */ import static java.lang.StackWalker.Option.*; diff --git a/test/jdk/java/lang/String/StringJoinTest.java b/test/jdk/java/lang/String/StringJoinTest.java index 6e901324a1a..2671ed23d5c 100644 --- a/test/jdk/java/lang/String/StringJoinTest.java +++ b/test/jdk/java/lang/String/StringJoinTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -21,13 +21,15 @@ * questions. */ /** - * @test @bug 5015163 + * @test + * @bug 5015163 8267529 * @summary test String merge/join that is the inverse of String.split() * @run testng StringJoinTest * @author Jim Gish */ import java.util.ArrayList; import java.util.List; +import java.util.StringJoiner; import org.testng.annotations.Test; import static org.testng.Assert.*; @@ -111,4 +113,14 @@ public void testJoinNullStringList() { public void testJoinNullDelimiter() { String.join(null, JIM, JOHN); } + + public void testIgnoreDelimiterCoderJoin() { + // 8267529: Ensure that joining zero or one latin-1 Strings with a UTF-16 + // delimiter produce a String with a latin-1 coder, since the delimiter + // is not added. + assertEquals("", new StringJoiner("\u2013").toString()); + assertEquals("foo", new StringJoiner("\u2013").add("foo").toString()); + assertEquals("", String.join("\u2013")); + assertEquals("foo", String.join("\u2013", "foo")); + } } diff --git a/test/jdk/java/lang/String/concat/WithSecurityManager.java b/test/jdk/java/lang/String/concat/WithSecurityManager.java index dd1fe80dba0..a6edd73faa9 100644 --- a/test/jdk/java/lang/String/concat/WithSecurityManager.java +++ b/test/jdk/java/lang/String/concat/WithSecurityManager.java @@ -31,8 +31,8 @@ * * @compile WithSecurityManager.java * - * @run main/othervm -Xverify:all WithSecurityManager - * @run main/othervm -Xverify:all --limit-modules=java.base WithSecurityManager + * @run main/othervm -Xverify:all -Djava.security.manager=allow WithSecurityManager + * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.security.manager=allow WithSecurityManager */ public class WithSecurityManager { public static void main(String[] args) throws Throwable { diff --git a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java index 823ba62adfe..85c3c54026e 100644 --- a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java +++ b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java @@ -57,8 +57,8 @@ * @build CustomLoggerTest AccessSystemLogger * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot CustomLoggerTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot CustomLoggerTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot CustomLoggerTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow CustomLoggerTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow CustomLoggerTest WITHPERMISSIONS * @author danielfuchs */ public class CustomLoggerTest { diff --git a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java index aaac885ec14..756e90c7ff3 100644 --- a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java +++ b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java @@ -60,10 +60,10 @@ * @build DefaultLoggerTest AccessSystemLogger * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest WITHPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest WITHCUSTOMWRAPPERS - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest WITHREFLECTION + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerTest WITHCUSTOMWRAPPERS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerTest WITHREFLECTION * @author danielfuchs */ public class DefaultLoggerTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java index ab08bb08aa4..8e94dc8d9ae 100644 --- a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java @@ -49,8 +49,8 @@ * @build AccessSystemLogger BaseLoggerFinderTest CustomSystemClassLoader BaseLoggerFinder TestLoggerFinder * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest WITHPERMISSIONS * @author danielfuchs */ public class BaseLoggerFinderTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java index e040b5b8dc1..d1f09dedd3e 100644 --- a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java @@ -56,8 +56,8 @@ * @build AccessSystemLogger DefaultLoggerFinderTest * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerFinderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerFinderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerFinderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerFinderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow DefaultLoggerFinderTest WITHPERMISSIONS * @author danielfuchs */ public class DefaultLoggerFinderTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java index abb71e79d66..5b37d398af5 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java @@ -67,10 +67,10 @@ * @build AccessSystemLogger BaseDefaultLoggerFinderTest CustomSystemClassLoader BaseLoggerFinder * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHCUSTOMWRAPPERS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHREFLECTION + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHCUSTOMWRAPPERS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest WITHREFLECTION * @author danielfuchs */ public class BaseDefaultLoggerFinderTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java index e52434f019c..9e5357f848d 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java @@ -57,8 +57,8 @@ * @modules java.base/sun.util.logging java.base/jdk.internal.logger * @build CustomSystemClassLoader BaseLoggerFinder BaseLoggerBridgeTest * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOSECURITY - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOPERMISSIONS - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest WITHPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest WITHPERMISSIONS * @author danielfuchs */ public class BaseLoggerBridgeTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java index 9e6dc7a4a79..8e98e5ce3c7 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java @@ -57,8 +57,8 @@ * @modules java.base/sun.util.logging * @build CustomSystemClassLoader BaseLoggerFinder BasePlatformLoggerTest * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOSECURITY - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOPERMISSIONS - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest WITHPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest WITHPERMISSIONS * @author danielfuchs */ public class BasePlatformLoggerTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java index e7a90c7466f..3ddf32f12df 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java @@ -57,8 +57,8 @@ Tests the behavior of bootstrap loggers (and SimpleConsoleLoggers * java.logging * @build BootstrapLoggerUtils LogStream * @run main/othervm BootstrapLoggerTest NO_SECURITY - * @run main/othervm BootstrapLoggerTest SECURE - * @run main/othervm/timeout=120 BootstrapLoggerTest SECURE_AND_WAIT + * @run main/othervm -Djava.security.manager=allow BootstrapLoggerTest SECURE + * @run main/othervm/timeout=120 -Djava.security.manager=allow BootstrapLoggerTest SECURE_AND_WAIT */ public class BootstrapLoggerTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java index c3f5d7e2062..541ded5bddf 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java @@ -60,8 +60,8 @@ * java.logging * @build CustomSystemClassLoader LogProducerFinder LoggerBridgeTest * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOSECURITY - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOPERMISSIONS - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest WITHPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest WITHPERMISSIONS * @author danielfuchs */ public class LoggerBridgeTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java index c6ef5c97953..048cea508ee 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java @@ -66,32 +66,32 @@ * @build AccessSystemLogger LoggerFinderLoaderTest CustomSystemClassLoader BaseLoggerFinder BaseLoggerFinder2 * @run driver AccessSystemLogger * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Dtest.fails=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=ERROR LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=DEBUG LoggerFinderLoaderTest WITHPERMISSIONS * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOSECURITY - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOPERMISSIONS - * @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest WITHPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest NOPERMISSIONS + * @run main/othervm -Xbootclasspath/a:boot -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest WITHPERMISSIONS * @author danielfuchs */ public class LoggerFinderLoaderTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java index ff4f980216f..01d6233af6d 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java @@ -60,8 +60,8 @@ * java.logging * @build CustomSystemClassLoader LogProducerFinder PlatformLoggerBridgeTest * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOSECURITY - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOPERMISSIONS - * @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest WITHPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOPERMISSIONS + * @run main/othervm -Djava.security.manager=allow -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest WITHPERMISSIONS * @author danielfuchs */ public class PlatformLoggerBridgeTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java index 153a63bbf50..b051931a553 100644 --- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java @@ -59,8 +59,8 @@ * java.base/jdk.internal.logger * java.logging/sun.util.logging.internal * @run main/othervm DefaultLoggerBridgeTest NOSECURITY - * @run main/othervm DefaultLoggerBridgeTest NOPERMISSIONS - * @run main/othervm DefaultLoggerBridgeTest WITHPERMISSIONS + * @run main/othervm -Djava.security.manager=allow DefaultLoggerBridgeTest NOPERMISSIONS + * @run main/othervm -Djava.security.manager=allow DefaultLoggerBridgeTest WITHPERMISSIONS * @author danielfuchs */ public class DefaultLoggerBridgeTest { diff --git a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java index c7f8cb44e68..91a0324f11e 100644 --- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java @@ -51,7 +51,7 @@ * @bug 8140364 * @summary Tests all PlatformLogger methods with the default LoggerFinder JUL backend. * @modules java.base/sun.util.logging java.logging/sun.util.logging.internal - * @run main/othervm DefaultPlatformLoggerTest + * @run main/othervm -Djava.security.manager=allow DefaultPlatformLoggerTest * @author danielfuchs */ public class DefaultPlatformLoggerTest { diff --git a/test/jdk/java/lang/annotation/ParameterAnnotations.java b/test/jdk/java/lang/annotation/ParameterAnnotations.java index 11211c9460b..b5c657629cb 100644 --- a/test/jdk/java/lang/annotation/ParameterAnnotations.java +++ b/test/jdk/java/lang/annotation/ParameterAnnotations.java @@ -27,7 +27,7 @@ * @summary Check properties of Annotations returned from * getParameterAnnotations, including freedom from security * exceptions. - * @run main/othervm ParameterAnnotations + * @run main/othervm -Djava.security.manager=allow ParameterAnnotations * @author Martin Buchholz */ diff --git a/test/jdk/java/lang/annotation/repeatingAnnotations/CustomRepeatingWithSecurityManager.java b/test/jdk/java/lang/annotation/repeatingAnnotations/CustomRepeatingWithSecurityManager.java index bb85179471f..c0663850646 100644 --- a/test/jdk/java/lang/annotation/repeatingAnnotations/CustomRepeatingWithSecurityManager.java +++ b/test/jdk/java/lang/annotation/repeatingAnnotations/CustomRepeatingWithSecurityManager.java @@ -29,7 +29,7 @@ * @library /test/lib * @build jdk.test.lib.Asserts * @run main CustomRepeatingWithSecurityManager - * @run main/othervm CustomRepeatingWithSecurityManager "withSM" + * @run main/othervm -Djava.security.manager=allow CustomRepeatingWithSecurityManager "withSM" */ import java.lang.annotation.*; diff --git a/test/jdk/java/lang/annotation/repeatingAnnotations/RepeatingWithSecurityManager.java b/test/jdk/java/lang/annotation/repeatingAnnotations/RepeatingWithSecurityManager.java index 9571d9e8cc2..3e4305dd4a7 100644 --- a/test/jdk/java/lang/annotation/repeatingAnnotations/RepeatingWithSecurityManager.java +++ b/test/jdk/java/lang/annotation/repeatingAnnotations/RepeatingWithSecurityManager.java @@ -29,7 +29,7 @@ * @library /test/lib * @build jdk.test.lib.Asserts * @run main RepeatingWithSecurityManager - * @run main/othervm RepeatingWithSecurityManager "withSM" + * @run main/othervm -Djava.security.manager=allow RepeatingWithSecurityManager "withSM" */ import java.lang.annotation.*; diff --git a/test/jdk/java/lang/instrument/RedefineModuleTest.java b/test/jdk/java/lang/instrument/RedefineModuleTest.java index f78266ea543..b5b5b4fc31d 100644 --- a/test/jdk/java/lang/instrument/RedefineModuleTest.java +++ b/test/jdk/java/lang/instrument/RedefineModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -29,7 +29,7 @@ * java.base/jdk.internal.test.TestProviderImpl1 * java.base/jdk.internal.test.TestProviderImpl2 * @run shell MakeJAR3.sh RedefineModuleAgent - * @run testng/othervm --illegal-access=deny -javaagent:RedefineModuleAgent.jar RedefineModuleTest + * @run testng/othervm -javaagent:RedefineModuleAgent.jar RedefineModuleTest */ import java.lang.TestProvider; diff --git a/test/jdk/java/lang/invoke/CallerSensitiveAccess.java b/test/jdk/java/lang/invoke/CallerSensitiveAccess.java index 894c7413805..2e904879a82 100644 --- a/test/jdk/java/lang/invoke/CallerSensitiveAccess.java +++ b/test/jdk/java/lang/invoke/CallerSensitiveAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -24,7 +24,7 @@ /* @test * @bug 8196830 8235351 * @modules java.base/jdk.internal.reflect - * @run testng/othervm --illegal-access=deny CallerSensitiveAccess + * @run testng/othervm CallerSensitiveAccess * @summary Check Lookup findVirtual, findStatic and unreflect behavior with * caller sensitive methods with focus on AccessibleObject.setAccessible */ diff --git a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java index d20c467eeac..76c24a99cdc 100644 --- a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java +++ b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java @@ -32,6 +32,7 @@ * --expand-properties --classpath ${test.classes} * --java test.java.lang.invoke.InvokeDynamicPrintArgs --check-output * @run main/othervm + * -Djava.security.manager=allow * indify.Indify * --expand-properties --classpath ${test.classes} * --java test.java.lang.invoke.InvokeDynamicPrintArgs --security-manager diff --git a/test/jdk/java/lang/invoke/MethodHandleConstants.java b/test/jdk/java/lang/invoke/MethodHandleConstants.java index cf563aab82e..db631915455 100644 --- a/test/jdk/java/lang/invoke/MethodHandleConstants.java +++ b/test/jdk/java/lang/invoke/MethodHandleConstants.java @@ -32,6 +32,7 @@ * --expand-properties --classpath ${test.classes} * --java test.java.lang.invoke.MethodHandleConstants --check-output * @run main/othervm + * -Djava.security.manager=allow * indify.Indify * --expand-properties --classpath ${test.classes} * --java test.java.lang.invoke.MethodHandleConstants --security-manager diff --git a/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java b/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java new file mode 100644 index 00000000000..4ff1a99cc28 --- /dev/null +++ b/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java @@ -0,0 +1,234 @@ +/* + * Copyright (c) 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 + * @run testng/othervm -Xverify:all TestTableSwitch + */ + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import javax.management.ObjectName; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.util.ArrayList; +import java.util.List; +import java.util.function.IntConsumer; +import java.util.function.IntFunction; + +import static org.testng.Assert.assertEquals; + +public class TestTableSwitch { + + static final MethodHandle MH_IntConsumer_accept; + static final MethodHandle MH_check; + + static { + try { + MethodHandles.Lookup lookup = MethodHandles.lookup(); + MH_IntConsumer_accept = lookup.findVirtual(IntConsumer.class, "accept", + MethodType.methodType(void.class, int.class)); + MH_check = lookup.findStatic(TestTableSwitch.class, "check", + MethodType.methodType(void.class, List.class, Object[].class)); + } catch (ReflectiveOperationException e) { + throw new ExceptionInInitializerError(e); + } + } + + public static MethodHandle simpleTestCase(String value) { + return simpleTestCase(String.class, value); + } + + public static MethodHandle simpleTestCase(Class type, Object value) { + return MethodHandles.dropArguments(MethodHandles.constant(type, value), 0, int.class); + } + + public static Object testValue(Class type) { + if (type == String.class) { + return "X"; + } else if (type == byte.class) { + return (byte) 42; + } else if (type == short.class) { + return (short) 84; + } else if (type == char.class) { + return 'Y'; + } else if (type == int.class) { + return 168; + } else if (type == long.class) { + return 336L; + } else if (type == float.class) { + return 42F; + } else if (type == double.class) { + return 84D; + } else if (type == boolean.class) { + return true; + } + return null; + } + + static final Class[] TEST_TYPES = { + Object.class, + String.class, + byte.class, + short.class, + char.class, + int.class, + long.class, + float.class, + double.class, + boolean.class + }; + + public static Object[] testArguments(int caseNum, List testValues) { + Object[] args = new Object[testValues.size() + 1]; + args[0] = caseNum; + int insertPos = 1; + for (Object testValue : testValues) { + args[insertPos++] = testValue; + } + return args; + } + + @DataProvider + public static Object[][] nonVoidCases() { + List tests = new ArrayList<>(); + + for (Class returnType : TEST_TYPES) { + for (int numCases = 1; numCases < 5; numCases++) { + tests.add(new Object[] { returnType, numCases, List.of() }); + tests.add(new Object[] { returnType, numCases, List.of(TEST_TYPES) }); + } + } + + return tests.toArray(Object[][]::new); + } + + private static void check(List testValues, Object[] collectedValues) { + assertEquals(collectedValues, testValues.toArray()); + } + + @Test(dataProvider = "nonVoidCases") + public void testNonVoidHandles(Class type, int numCases, List> additionalTypes) throws Throwable { + MethodHandle collector = MH_check; + List testArguments = new ArrayList<>(); + collector = MethodHandles.insertArguments(collector, 0, testArguments); + collector = collector.asCollector(Object[].class, additionalTypes.size()); + + Object defaultReturnValue = testValue(type); + MethodHandle defaultCase = simpleTestCase(type, defaultReturnValue); + defaultCase = MethodHandles.collectArguments(defaultCase, 1, collector); + Object[] returnValues = new Object[numCases]; + MethodHandle[] cases = new MethodHandle[numCases]; + for (int i = 0; i < cases.length; i++) { + Object returnValue = testValue(type); + returnValues[i] = returnValue; + MethodHandle theCase = simpleTestCase(type, returnValue); + theCase = MethodHandles.collectArguments(theCase, 1, collector); + cases[i] = theCase; + } + + MethodHandle mhSwitch = MethodHandles.tableSwitch( + defaultCase, + cases + ); + + for (Class additionalType : additionalTypes) { + testArguments.add(testValue(additionalType)); + } + + assertEquals(mhSwitch.invokeWithArguments(testArguments(-1, testArguments)), defaultReturnValue); + + for (int i = 0; i < numCases; i++) { + assertEquals(mhSwitch.invokeWithArguments(testArguments(i, testArguments)), returnValues[i]); + } + + assertEquals(mhSwitch.invokeWithArguments(testArguments(numCases, testArguments)), defaultReturnValue); + } + + @Test + public void testVoidHandles() throws Throwable { + IntFunction makeTestCase = expectedIndex -> { + IntConsumer test = actualIndex -> assertEquals(actualIndex, expectedIndex); + return MH_IntConsumer_accept.bindTo(test); + }; + + MethodHandle mhSwitch = MethodHandles.tableSwitch( + /* default: */ makeTestCase.apply(-1), + /* case 0: */ makeTestCase.apply(0), + /* case 1: */ makeTestCase.apply(1), + /* case 2: */ makeTestCase.apply(2) + ); + + mhSwitch.invokeExact((int) -1); + mhSwitch.invokeExact((int) 0); + mhSwitch.invokeExact((int) 1); + mhSwitch.invokeExact((int) 2); + } + + @Test(expectedExceptions = NullPointerException.class) + public void testNullDefaultHandle() { + MethodHandles.tableSwitch(null, simpleTestCase("test")); + } + + @Test(expectedExceptions = NullPointerException.class) + public void testNullCases() { + MethodHandle[] cases = null; + MethodHandles.tableSwitch(simpleTestCase("default"), cases); + } + + @Test(expectedExceptions = NullPointerException.class) + public void testNullCase() { + MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), null); + } + + @Test(expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = ".*Not enough cases.*") + public void testNotEnoughCases() { + MethodHandles.tableSwitch(simpleTestCase("default")); + } + + @Test(expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = ".*Case actions must have int as leading parameter.*") + public void testNotEnoughParameters() { + MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class)); + MethodHandles.tableSwitch(empty, empty, empty); + } + + @Test(expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = ".*Case actions must have int as leading parameter.*") + public void testNoLeadingIntParameter() { + MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class, double.class)); + MethodHandles.tableSwitch(empty, empty, empty); + } + + @Test(expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = ".*Case actions must have the same type.*") + public void testWrongCaseType() { + // doesn't return a String + MethodHandle wrongType = MethodHandles.empty(MethodType.methodType(void.class, int.class)); + MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), wrongType); + } + +} diff --git a/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java b/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java index 6f0bf9db1a8..5096e9c7967 100644 --- a/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java +++ b/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java @@ -26,7 +26,7 @@ /* @test * @bug 8229785 * @summary Test MethodType.fromMethodDescriptorString with security manager - * @run main/othervm test.java.lang.invoke.MethodTypeSecurityManager + * @run main/othervm -Djava.security.manager=allow test.java.lang.invoke.MethodTypeSecurityManager * @run main/othervm/policy=getclassloader.policy test.java.lang.invoke.MethodTypeSecurityManager access */ diff --git a/test/jdk/java/lang/invoke/TestPrivateMember.java b/test/jdk/java/lang/invoke/TestPrivateMember.java index cf710c0a4f6..3f4da568641 100644 --- a/test/jdk/java/lang/invoke/TestPrivateMember.java +++ b/test/jdk/java/lang/invoke/TestPrivateMember.java @@ -30,7 +30,7 @@ * @bug 8007035 * @summary Test MethodHandle of a private member * - * @run main TestPrivateMember + * @run main/othervm -Djava.security.manager=allow TestPrivateMember */ public class TestPrivateMember { diff --git a/test/jdk/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java b/test/jdk/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java index 83024e58c33..37be43d0426 100644 --- a/test/jdk/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java +++ b/test/jdk/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java @@ -29,7 +29,7 @@ * @modules jdk.compiler * jdk.zipfs * @compile -XDignore.symbol.file LambdaAccessControlDoPrivilegedTest.java LUtils.java - * @run main/othervm LambdaAccessControlDoPrivilegedTest + * @run main/othervm -Djava.security.manager=allow LambdaAccessControlDoPrivilegedTest */ import java.io.File; import java.util.ArrayList; @@ -77,7 +77,9 @@ public static void main(String... args) { doprivClass.delete(); tr = doExec(JAVA_CMD.getAbsolutePath(), "-Xbootclasspath/a:foo.jar", - "-cp", ".", "Bar"); + "-cp", ".", + "-Djava.security.manager=allow", + "Bar"); tr.assertZero("testDoPrivileged fails"); barJava.delete(); barClass.delete(); diff --git a/test/jdk/java/lang/invoke/lambda/LambdaAccessControlTest.java b/test/jdk/java/lang/invoke/lambda/LambdaAccessControlTest.java index 6435944e7e8..2ab04836898 100644 --- a/test/jdk/java/lang/invoke/lambda/LambdaAccessControlTest.java +++ b/test/jdk/java/lang/invoke/lambda/LambdaAccessControlTest.java @@ -28,7 +28,7 @@ * @modules jdk.compiler * @compile -XDignore.symbol.file LambdaAccessControlTest.java LUtils.java * - * @run main/othervm LambdaAccessControlTest + * @run main/othervm -Djava.security.manager=allow LambdaAccessControlTest */ public class LambdaAccessControlTest extends LUtils { diff --git a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java index 047c128e9d5..ae15cd187b0 100644 --- a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -115,6 +115,7 @@ public void cleanup() throws IOException { public void testNotLogging() { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "com.example.TestLambda"); tr.assertZero("Should still return 0"); } @@ -124,6 +125,7 @@ public void testLogging() throws IOException { assertTrue(Files.exists(Paths.get("dump"))); TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "-Djdk.internal.lambda.dumpProxyClasses=dump", "com.example.TestLambda"); // 2 our own class files. We don't care about the others @@ -141,6 +143,7 @@ public void testDumpDirNotExist() throws IOException { assertFalse(Files.exists(Paths.get("notExist"))); TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "-Djdk.internal.lambda.dumpProxyClasses=notExist", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() @@ -156,6 +159,7 @@ public void testDumpDirIsFile() throws IOException { assertTrue(Files.isRegularFile(Paths.get("file"))); TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "-Djdk.internal.lambda.dumpProxyClasses=file", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() @@ -214,6 +218,7 @@ public void testDumpDirNotWritable() throws IOException { TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "-Djdk.internal.lambda.dumpProxyClasses=readOnly", "com.example.TestLambda"); assertEquals(tr.testOutput.stream() @@ -232,6 +237,7 @@ public void testLoggingException() throws IOException { assertTrue(Files.exists(Paths.get("dumpLong"))); TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), "-cp", ".", + "-Djava.security.manager=allow", "-Djdk.internal.lambda.dumpProxyClasses=dumpLong", longFQCN); assertEquals(tr.testOutput.stream() diff --git a/test/jdk/java/lang/module/ModuleFinderWithSecurityManager.java b/test/jdk/java/lang/module/ModuleFinderWithSecurityManager.java index 0fe6a0b6467..2a0d60ca20d 100644 --- a/test/jdk/java/lang/module/ModuleFinderWithSecurityManager.java +++ b/test/jdk/java/lang/module/ModuleFinderWithSecurityManager.java @@ -23,8 +23,8 @@ /** * @test - * @run main/othervm ModuleFinderWithSecurityManager allow - * @run main/othervm ModuleFinderWithSecurityManager deny + * @run main/othervm -Djava.security.manager=allow ModuleFinderWithSecurityManager allow + * @run main/othervm -Djava.security.manager=allow ModuleFinderWithSecurityManager deny * @summary Basic test for ModuleFinder.ofSystem() with security manager */ diff --git a/test/jdk/java/lang/reflect/AccessibleObject/CanAccessTest.java b/test/jdk/java/lang/reflect/AccessibleObject/CanAccessTest.java index 6bf93f1312e..45e2502b601 100644 --- a/test/jdk/java/lang/reflect/AccessibleObject/CanAccessTest.java +++ b/test/jdk/java/lang/reflect/AccessibleObject/CanAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,7 +25,7 @@ * @test * @build CanAccessTest * @modules java.base/jdk.internal.misc:+open - * @run testng/othervm --illegal-access=deny CanAccessTest + * @run testng/othervm CanAccessTest * @summary Test AccessibleObject::canAccess method */ diff --git a/test/jdk/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java b/test/jdk/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java index 18a05a2600a..c7c57d2371c 100644 --- a/test/jdk/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java +++ b/test/jdk/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +26,7 @@ * @build ModuleSetAccessibleTest * @modules java.base/java.lang:open * java.base/jdk.internal.misc:+open - * @run testng/othervm --illegal-access=deny ModuleSetAccessibleTest + * @run testng/othervm ModuleSetAccessibleTest * @summary Test java.lang.reflect.AccessibleObject with modules */ diff --git a/test/jdk/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java b/test/jdk/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java index 7ef24b66c8b..22fcb2e01fa 100644 --- a/test/jdk/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java +++ b/test/jdk/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -28,7 +28,7 @@ * java.base/jdk.internal.module * java.base/jdk.internal.perf * java.base/jdk.internal.misc:+open - * @run testng/othervm --illegal-access=deny TrySetAccessibleTest + * @run testng/othervm TrySetAccessibleTest * @summary Test AccessibleObject::trySetAccessible method */ diff --git a/test/jdk/java/lang/reflect/Nestmates/TestSecurityManagerChecks.java b/test/jdk/java/lang/reflect/Nestmates/TestSecurityManagerChecks.java index 1cf5fa897d5..9773b9e4e8d 100644 --- a/test/jdk/java/lang/reflect/Nestmates/TestSecurityManagerChecks.java +++ b/test/jdk/java/lang/reflect/Nestmates/TestSecurityManagerChecks.java @@ -29,7 +29,7 @@ * @library /test/lib * @build TestSecurityManagerChecks testPkg.Host testPkg.Singleton * @run driver jdk.test.lib.helpers.ClassFileInstaller testPkg.Host testPkg.Host$Member testPkg.Singleton - * @run main/othervm -Xbootclasspath/a:. TestSecurityManagerChecks + * @run main/othervm -Xbootclasspath/a:. -Djava.security.manager=allow TestSecurityManagerChecks */ // ClassFileInstaller copies the testPkg files into the "current" directory diff --git a/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java b/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java index 209ba813a1e..e9782854828 100644 --- a/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java +++ b/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java @@ -43,8 +43,8 @@ * @summary Test proxy classes that implement non-public interface * * @build p.Foo - * @run main/othervm NonPublicProxyClass grant - * @run main/othervm NonPublicProxyClass deny + * @run main/othervm -Djava.security.manager=allow NonPublicProxyClass grant + * @run main/othervm -Djava.security.manager=allow NonPublicProxyClass deny * @run main/othervm NonPublicProxyClass */ public class NonPublicProxyClass { diff --git a/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/SimpleProxy.java b/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/SimpleProxy.java index 2d4554fd77d..a2c6197080d 100644 --- a/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/SimpleProxy.java +++ b/test/jdk/java/lang/reflect/Proxy/nonPublicProxy/SimpleProxy.java @@ -31,7 +31,7 @@ * @summary Test making a proxy instance that implements a non-public * interface with and without security manager installed * @build p.Foo p.Bar - * @run main SimpleProxy + * @run main/othervm -Djava.security.manager=allow SimpleProxy */ public class SimpleProxy { public static void main(String[] args) throws Exception { diff --git a/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java b/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java index 43ffc520be1..0b9508702d0 100644 --- a/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java +++ b/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java @@ -28,8 +28,8 @@ * @library /test/lib * @modules java.compiler * @build jdk.test.lib.compiler.CompilerUtils jdk.test.lib.compiler.ModuleInfoMaker TestSecurityManagerChecks - * @run main/othervm --enable-preview TestSecurityManagerChecks named - * @run main/othervm --enable-preview TestSecurityManagerChecks unnamed + * @run main/othervm -Djava.security.manager=allow --enable-preview TestSecurityManagerChecks named + * @run main/othervm -Djava.security.manager=allow --enable-preview TestSecurityManagerChecks unnamed */ import java.io.IOException; diff --git a/test/jdk/java/net/Authenticator/GetAuthenticatorTest.java b/test/jdk/java/net/Authenticator/GetAuthenticatorTest.java index d36236ba32f..9c4c421ba32 100644 --- a/test/jdk/java/net/Authenticator/GetAuthenticatorTest.java +++ b/test/jdk/java/net/Authenticator/GetAuthenticatorTest.java @@ -30,7 +30,7 @@ * @test * @bug 8169068 * @summary Basic test for Authenticator.getDefault() - * @run main/othervm GetAuthenticatorTest + * @run main/othervm -Djava.security.manager=allow GetAuthenticatorTest */ public class GetAuthenticatorTest { diff --git a/test/jdk/java/net/DatagramSocket/ConnectPortZero.java b/test/jdk/java/net/DatagramSocket/ConnectPortZero.java index a1488c7961a..82544d0b558 100644 --- a/test/jdk/java/net/DatagramSocket/ConnectPortZero.java +++ b/test/jdk/java/net/DatagramSocket/ConnectPortZero.java @@ -51,7 +51,7 @@ * @bug 8240533 * @summary Check that DatagramSocket, MulticastSocket and DatagramSocketAdaptor * throw expected Exception when connecting to port 0 - * @run testng/othervm ConnectPortZero + * @run testng/othervm -Djava.security.manager=allow ConnectPortZero */ public class ConnectPortZero{ diff --git a/test/jdk/java/net/DatagramSocket/SendPortZero.java b/test/jdk/java/net/DatagramSocket/SendPortZero.java index b66eb60fc9f..5c60df3a244 100644 --- a/test/jdk/java/net/DatagramSocket/SendPortZero.java +++ b/test/jdk/java/net/DatagramSocket/SendPortZero.java @@ -48,8 +48,8 @@ * @bug 8236105 8240533 * @summary Check that DatagramSocket throws expected * Exception when sending a DatagramPacket with port 0 - * @run testng SendPortZero - * @run testng/othervm -Djdk.net.usePlainDatagramSocketImpl SendPortZero + * @run testng/othervm -Djava.security.manager=allow SendPortZero + * @run testng/othervm -Djava.security.manager=allow -Djdk.net.usePlainDatagramSocketImpl SendPortZero */ public class SendPortZero { diff --git a/test/jdk/java/net/InetAddress/GetLocalHostWithSM.java b/test/jdk/java/net/InetAddress/GetLocalHostWithSM.java index 0167edec328..2eda5f0494d 100644 --- a/test/jdk/java/net/InetAddress/GetLocalHostWithSM.java +++ b/test/jdk/java/net/InetAddress/GetLocalHostWithSM.java @@ -26,9 +26,9 @@ * @bug 4531817 8026245 * @library /test/lib * @summary Inet[46]Address.localHost need doPrivileged - * @run main/othervm GetLocalHostWithSM - * @run main/othervm -Djava.net.preferIPv4Stack=true GetLocalHostWithSM - * @run main/othervm -Djava.net.preferIPv6Addresses=true GetLocalHostWithSM + * @run main/othervm -Djava.security.manager=allow GetLocalHostWithSM + * @run main/othervm -Djava.security.manager=allow -Djava.net.preferIPv4Stack=true GetLocalHostWithSM + * @run main/othervm -Djava.security.manager=allow -Djava.net.preferIPv6Addresses=true GetLocalHostWithSM * files needed: GetLocalHostWithSM.java, MyPrincipal.java, and policy.file */ diff --git a/test/jdk/java/net/MulticastSocket/SendPortZero.java b/test/jdk/java/net/MulticastSocket/SendPortZero.java index 335e769d2e5..e07743ba9fe 100644 --- a/test/jdk/java/net/MulticastSocket/SendPortZero.java +++ b/test/jdk/java/net/MulticastSocket/SendPortZero.java @@ -48,8 +48,8 @@ * @bug 8243408 * @summary Check that MulticastSocket throws expected * Exception when sending a DatagramPacket with port 0 - * @run testng SendPortZero - * @run testng/othervm -Djdk.net.usePlainDatagramSocketImpl SendPortZero + * @run testng/othervm -Djava.security.manager=allow SendPortZero + * @run testng/othervm -Djava.security.manager=allow -Djdk.net.usePlainDatagramSocketImpl SendPortZero */ public class SendPortZero { diff --git a/test/jdk/java/net/NetworkInterface/Equals.java b/test/jdk/java/net/NetworkInterface/Equals.java index 8cc81f825a0..9e973e71de7 100644 --- a/test/jdk/java/net/NetworkInterface/Equals.java +++ b/test/jdk/java/net/NetworkInterface/Equals.java @@ -23,7 +23,7 @@ /* @test * @bug 7003398 - * @run main/othervm Equals + * @run main/othervm -Djava.security.manager=allow Equals */ import java.io.ByteArrayOutputStream; diff --git a/test/jdk/java/net/ServerSocket/TestLocalAddress.java b/test/jdk/java/net/ServerSocket/TestLocalAddress.java index 70f860146cd..b87d21c9821 100644 --- a/test/jdk/java/net/ServerSocket/TestLocalAddress.java +++ b/test/jdk/java/net/ServerSocket/TestLocalAddress.java @@ -45,7 +45,7 @@ * @test * @bug 8224730 * @summary Check local address access with a security manager - * @run testng/othervm TestLocalAddress + * @run testng/othervm -Djava.security.manager=allow TestLocalAddress */ public class TestLocalAddress { diff --git a/test/jdk/java/net/Socket/UdpSocket.java b/test/jdk/java/net/Socket/UdpSocket.java index 5c0b6619b08..a15f9255b45 100644 --- a/test/jdk/java/net/Socket/UdpSocket.java +++ b/test/jdk/java/net/Socket/UdpSocket.java @@ -23,7 +23,7 @@ /** * @test - * @run testng/othervm -Dsun.net.maxDatagramSockets=32 UdpSocket + * @run testng/othervm -Djava.security.manager=allow -Dsun.net.maxDatagramSockets=32 UdpSocket * @summary Basic test for a Socket to a UDP socket */ @@ -37,9 +37,9 @@ import java.nio.channels.DatagramChannel; import java.security.Permission; import java.util.Arrays; -import java.util.ArrayList; import java.util.ArrayDeque; import java.util.Deque; +import java.net.BindException; import org.testng.annotations.Test; import static org.testng.Assert.*; @@ -59,7 +59,6 @@ public void testSendReceive() throws IOException { int port = ((InetSocketAddress) dc.getLocalAddress()).getPort(); try (Socket s = new Socket(loopback, port, false)) { - // send datagram with socket output stream byte[] array1 = MESSAGE.getBytes("UTF-8"); s.getOutputStream().write(array1); @@ -133,8 +132,17 @@ public void testMaxSockets() throws Exception { } } + private Socket newUdpSocket() throws IOException { - return new Socket(InetAddress.getLoopbackAddress(), 8000, false); + Socket s = null; + + try { + s = new Socket(InetAddress.getLoopbackAddress(), 8000, false); + } catch (BindException unexpected) { + System.out.println("BindException caught retry Socket creation"); + s = new Socket(InetAddress.getLoopbackAddress(), 8000, false); + } + return s; } private void closeAll(Deque sockets) throws IOException { diff --git a/test/jdk/java/net/SocketPermission/SocketPermissionTest.java b/test/jdk/java/net/SocketPermission/SocketPermissionTest.java index a787be39c96..856454092da 100644 --- a/test/jdk/java/net/SocketPermission/SocketPermissionTest.java +++ b/test/jdk/java/net/SocketPermission/SocketPermissionTest.java @@ -31,7 +31,7 @@ * @library /test/lib * @build jdk.test.lib.NetworkConfiguration * jdk.test.lib.Platform - * @run testng/othervm SocketPermissionTest + * @run testng/othervm -Djava.security.manager=allow SocketPermissionTest */ import java.io.IOException; diff --git a/test/jdk/java/net/URL/OpenConnection.java b/test/jdk/java/net/URL/OpenConnection.java index ca5615510c5..31ac42f67ef 100644 --- a/test/jdk/java/net/URL/OpenConnection.java +++ b/test/jdk/java/net/URL/OpenConnection.java @@ -24,7 +24,7 @@ /* @test * @bug 5086348 * @summary URL.openConnection(Proxy.NO_PROXY) throws NULLPointerException - * @run main/othervm OpenConnection + * @run main/othervm -Djava.security.manager=allow OpenConnection */ import java.io.*; diff --git a/test/jdk/java/net/URL/TestIPv6Addresses.java b/test/jdk/java/net/URL/TestIPv6Addresses.java index 8014d3158b8..69ae5f99fbf 100644 --- a/test/jdk/java/net/URL/TestIPv6Addresses.java +++ b/test/jdk/java/net/URL/TestIPv6Addresses.java @@ -23,11 +23,11 @@ /* @test * @bug 4451522 4460484 - * @run main/othervm TestIPv6Addresses + * @run main/othervm -Djava.security.manager=allow TestIPv6Addresses * @summary URI and URL getHost() methods don't comform to RFC 2732 */ -// Run in othervm because the tests sets a SecurityManager +// Run in othervm -Djava.security.manager=allow because the tests sets a SecurityManager import java.net.*; diff --git a/test/jdk/java/net/URLPermission/OpenURL.java b/test/jdk/java/net/URLPermission/OpenURL.java index 19c4c1572d4..85b5eef1be0 100644 --- a/test/jdk/java/net/URLPermission/OpenURL.java +++ b/test/jdk/java/net/URLPermission/OpenURL.java @@ -25,7 +25,7 @@ * @test * @bug 8029354 * @library /test/lib - * @run main/othervm OpenURL + * @run main/othervm -Djava.security.manager=allow OpenURL */ import java.net.*; diff --git a/test/jdk/java/net/URLPermission/URLTest.java b/test/jdk/java/net/URLPermission/URLTest.java index 714cf62bffa..7013ba83dee 100644 --- a/test/jdk/java/net/URLPermission/URLTest.java +++ b/test/jdk/java/net/URLPermission/URLTest.java @@ -28,8 +28,8 @@ * @modules jdk.httpserver * @library /test/lib * @build jdk.test.lib.net.SimpleSSLContext - * @run main/othervm URLTest - * @run main/othervm -Djava.net.preferIPv6Addresses=true URLTest + * @run main/othervm -Djava.security.manager=allow URLTest + * @run main/othervm -Djava.security.manager=allow -Djava.net.preferIPv6Addresses=true URLTest * @summary check URLPermission with Http(s)URLConnection */ diff --git a/test/jdk/java/net/URLPermission/nstest/LookupTest.java b/test/jdk/java/net/URLPermission/nstest/LookupTest.java index 3d7a30463ba..6885486c499 100644 --- a/test/jdk/java/net/URLPermission/nstest/LookupTest.java +++ b/test/jdk/java/net/URLPermission/nstest/LookupTest.java @@ -26,7 +26,7 @@ * @summary A simple smoke test of the HttpURLPermission mechanism, which checks * for either IOException (due to unknown host) or SecurityException * due to lack of permission to connect - * @run main/othervm -Djdk.net.hosts.file=LookupTestHosts LookupTest + * @run main/othervm -Djava.security.manager=allow -Djdk.net.hosts.file=LookupTestHosts LookupTest */ import java.io.BufferedWriter; diff --git a/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java b/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java index afe2f595d87..043c33d303a 100644 --- a/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java +++ b/test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java @@ -29,7 +29,7 @@ * @build PrivilegedThreadFactory Attack * jdk.test.lib.util.JarUtils * @run driver SetupJar - * @run main/othervm -Xbootclasspath/a:privileged.jar AsExecutor + * @run main/othervm -Xbootclasspath/a:privileged.jar -Djava.security.manager=allow AsExecutor */ import java.nio.channels.AsynchronousChannelGroup; diff --git a/test/jdk/java/nio/channels/AsynchronousServerSocketChannel/WithSecurityManager.java b/test/jdk/java/nio/channels/AsynchronousServerSocketChannel/WithSecurityManager.java index ee77a3d310c..a48ac19469d 100644 --- a/test/jdk/java/nio/channels/AsynchronousServerSocketChannel/WithSecurityManager.java +++ b/test/jdk/java/nio/channels/AsynchronousServerSocketChannel/WithSecurityManager.java @@ -25,8 +25,8 @@ * @bug 4607272 * @summary Unit test for AsynchronousServerServerSocketChannel * @build WithSecurityManager - * @run main/othervm WithSecurityManager allow - * @run main/othervm WithSecurityManager deny + * @run main/othervm -Djava.security.manager=allow WithSecurityManager allow + * @run main/othervm -Djava.security.manager=allow WithSecurityManager deny */ import java.nio.file.Paths; diff --git a/test/jdk/java/nio/channels/DatagramChannel/ConnectPortZero.java b/test/jdk/java/nio/channels/DatagramChannel/ConnectPortZero.java index 79d243e988b..6074d4cd543 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/ConnectPortZero.java +++ b/test/jdk/java/nio/channels/DatagramChannel/ConnectPortZero.java @@ -54,8 +54,8 @@ * @build jdk.test.lib.net.IPSupport * @summary Check that DatagramChannel throws expected Exception when connecting * to port 0 - * @run testng/othervm ConnectPortZero - * @run testng/othervm -Djava.net.preferIPv4Stack=true ConnectPortZero + * @run testng/othervm -Djava.security.manager=allow ConnectPortZero + * @run testng/othervm -Djava.security.manager=allow -Djava.net.preferIPv4Stack=true ConnectPortZero */ public class ConnectPortZero { diff --git a/test/jdk/java/nio/channels/DatagramChannel/SendPortZero.java b/test/jdk/java/nio/channels/DatagramChannel/SendPortZero.java index 30c6c36d218..dc3511abb34 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/SendPortZero.java +++ b/test/jdk/java/nio/channels/DatagramChannel/SendPortZero.java @@ -55,8 +55,8 @@ * @build jdk.test.lib.net.IPSupport * @summary Check that DatagramChannel throws expected Exception when sending to * port 0 - * @run testng/othervm SendPortZero - * @run testng/othervm -Djava.net.preferIPv4Stack=true SendPortZero + * @run testng/othervm -Djava.security.manager=allow SendPortZero + * @run testng/othervm -Djava.security.manager=allow -Djava.net.preferIPv4Stack=true SendPortZero */ public class SendPortZero { diff --git a/test/jdk/java/nio/channels/FileChannel/MapWithSecurityManager.java b/test/jdk/java/nio/channels/FileChannel/MapWithSecurityManager.java index 37626cf6797..1985799caf1 100644 --- a/test/jdk/java/nio/channels/FileChannel/MapWithSecurityManager.java +++ b/test/jdk/java/nio/channels/FileChannel/MapWithSecurityManager.java @@ -24,7 +24,7 @@ /* @test * @bug 8236582 * @summary Tests the map method when running with a security manager - * @run main/othervm MapWithSecurityManager + * @run main/othervm -Djava.security.manager=allow MapWithSecurityManager */ import java.io.IOException; diff --git a/test/jdk/java/nio/channels/FileChannel/Size.java b/test/jdk/java/nio/channels/FileChannel/Size.java index d06ba81fa51..fd6e744f03f 100644 --- a/test/jdk/java/nio/channels/FileChannel/Size.java +++ b/test/jdk/java/nio/channels/FileChannel/Size.java @@ -67,8 +67,7 @@ private static void testLargeFile() throws Exception { File largeFile = new File("largeFileTest"); long testSize = ((long)Integer.MAX_VALUE) * 2; initTestFile(largeFile, 10); - try (FileChannel fc = new RandomAccessFile(largeFile, "rw").getChannel()) - { + try (FileChannel fc = new RandomAccessFile(largeFile, "rw").getChannel()) { fc.size(); fc.map(FileChannel.MapMode.READ_WRITE, testSize, 10); if (fc.size() != testSize + 10) { diff --git a/test/jdk/java/nio/channels/SocketChannel/OpenLeak.java b/test/jdk/java/nio/channels/SocketChannel/OpenLeak.java index 135ce9a3901..8d8673355ef 100644 --- a/test/jdk/java/nio/channels/SocketChannel/OpenLeak.java +++ b/test/jdk/java/nio/channels/SocketChannel/OpenLeak.java @@ -26,7 +26,7 @@ * @summary SocketChannel.open(SocketAddress) leaks file descriptor if * connection cannot be established * @build OpenLeak - * @run main/othervm OpenLeak + * @run main/othervm -Djava.security.manager=allow OpenLeak */ import java.net.InetAddress; diff --git a/test/jdk/java/nio/channels/unixdomain/Security.java b/test/jdk/java/nio/channels/unixdomain/Security.java index a207cd814e9..4cef6cef893 100644 --- a/test/jdk/java/nio/channels/unixdomain/Security.java +++ b/test/jdk/java/nio/channels/unixdomain/Security.java @@ -26,7 +26,7 @@ * @bug 8245194 * @run main/othervm/java.security.policy=policy1 Security policy1 * @run main/othervm/java.security.policy=policy2 Security policy2 - * @run main/othervm Security policy3 + * @run main/othervm -Djava.security.manager=allow Security policy3 * @summary Security test for Unix Domain socket and server socket channels */ diff --git a/test/jdk/java/nio/file/Files/CheckPermissions.java b/test/jdk/java/nio/file/Files/CheckPermissions.java index 7908d847c05..5a50596d847 100644 --- a/test/jdk/java/nio/file/Files/CheckPermissions.java +++ b/test/jdk/java/nio/file/Files/CheckPermissions.java @@ -26,7 +26,7 @@ * @summary Unit test for java.nio.file.Files * @library .. * @build CheckPermissions - * @run main/othervm CheckPermissions + * @run main/othervm -Djava.security.manager=allow CheckPermissions */ import java.nio.ByteBuffer; diff --git a/test/jdk/java/nio/file/Files/walkFileTree/WalkWithSecurity.java b/test/jdk/java/nio/file/Files/walkFileTree/WalkWithSecurity.java index 9cfc682c956..2e58c92f542 100644 --- a/test/jdk/java/nio/file/Files/walkFileTree/WalkWithSecurity.java +++ b/test/jdk/java/nio/file/Files/walkFileTree/WalkWithSecurity.java @@ -25,9 +25,9 @@ * @bug 6876541 * @summary Test Files.walkFileTree in the presence of a security manager * @build WalkWithSecurity - * @run main/othervm WalkWithSecurity grantAll.policy pass - * @run main/othervm WalkWithSecurity denyAll.policy fail - * @run main/othervm WalkWithSecurity grantTopOnly.policy top_only + * @run main/othervm -Djava.security.manager=allow WalkWithSecurity grantAll.policy pass + * @run main/othervm -Djava.security.manager=allow WalkWithSecurity denyAll.policy fail + * @run main/othervm -Djava.security.manager=allow WalkWithSecurity grantTopOnly.policy top_only */ import java.nio.file.*; diff --git a/test/jdk/java/nio/file/WatchService/WithSecurityManager.java b/test/jdk/java/nio/file/WatchService/WithSecurityManager.java index e165da54fb4..14cab205440 100644 --- a/test/jdk/java/nio/file/WatchService/WithSecurityManager.java +++ b/test/jdk/java/nio/file/WatchService/WithSecurityManager.java @@ -26,14 +26,14 @@ * @summary Unit test for Watchable#register's permission checks * @modules jdk.unsupported * @build WithSecurityManager - * @run main/othervm WithSecurityManager denyAll.policy - fail - * @run main/othervm WithSecurityManager denyAll.policy tree fail - * @run main/othervm WithSecurityManager grantDirOnly.policy - pass - * @run main/othervm WithSecurityManager grantDirOnly.policy tree fail - * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy - pass - * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy tree fail - * @run main/othervm WithSecurityManager grantDirAndTree.policy - pass - * @run main/othervm WithSecurityManager grantDirAndTree.policy tree pass + * @run main/othervm -Djava.security.manager=allow WithSecurityManager denyAll.policy - fail + * @run main/othervm -Djava.security.manager=allow WithSecurityManager denyAll.policy tree fail + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirOnly.policy - pass + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirOnly.policy tree fail + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirAndOneLevel.policy - pass + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirAndOneLevel.policy tree fail + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirAndTree.policy - pass + * @run main/othervm -Djava.security.manager=allow WithSecurityManager grantDirAndTree.policy tree pass */ import java.nio.file.*; diff --git a/test/jdk/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java b/test/jdk/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java index 93d1ce8427d..657e37f4ad3 100644 --- a/test/jdk/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java +++ b/test/jdk/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java @@ -31,7 +31,7 @@ * "accessClassInPackage.*"). * @author Peter Jones * - * @run main/othervm CheckPackageAccess + * @run main/othervm -Djava.security.manager=allow CheckPackageAccess */ import java.rmi.RMISecurityManager; diff --git a/test/jdk/java/rmi/RemoteException/chaining/Chaining.java b/test/jdk/java/rmi/RemoteException/chaining/Chaining.java index bb2f7063be6..e20f5825b35 100644 --- a/test/jdk/java/rmi/RemoteException/chaining/Chaining.java +++ b/test/jdk/java/rmi/RemoteException/chaining/Chaining.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -28,7 +28,6 @@ */ import java.rmi.MarshalledObject; import java.rmi.RemoteException; -import java.rmi.activation.ActivationException; import java.rmi.server.ServerCloneException; public class Chaining { @@ -68,9 +67,6 @@ public static void main(String[] args) throws Exception { test(new RemoteException(), null, null); test(new RemoteException(foo), foo, null); test(new RemoteException(foo, t), fooMsg, t); - test(new ActivationException(), null, null); - test(new ActivationException(foo), foo, null); - test(new ActivationException(foo, t), fooMsg, t); test(new ServerCloneException(foo), foo, null); test(new ServerCloneException(foo, t), fooMsg, t); } diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java deleted file mode 100644 index 9311879886e..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4105080 - * @summary Activation retry during a remote method call to an activatable - * object can cause infinite recursion in some situations. The - * RemoteRef contained in the ActivatableRef should never be - * an ActivatableRef, but another type. - * (Needs /othervm to evade JavaTest security manager --aecolley) - * @author Ann Wollrath - * - * @bug 4164971 - * @summary allow non-public activatable class and/or constructor - * Main test class hasa non-public constructor to ensure - * functionality is in place - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server:+open - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivateMe CheckActivateRef_Stub - * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef - * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef - * @key intermittent - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import sun.rmi.server.ActivatableRef; -import java.lang.reflect.*; -import java.util.Properties; - -public class CheckActivateRef - extends Activatable - implements ActivateMe, Runnable -{ - - private CheckActivateRef(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - } - - public void ping() - {} - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"CheckActivateRef")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - /* - * The following line is required with the JDK 1.2 VM so that the - * VM can exit gracefully when this test completes. Otherwise, the - * conservative garbage collector will find a handle to the server - * object on the native stack and not clear the weak reference to - * it in the RMI runtime's object table. - */ - Object dummy = new Object(); - RMID rmid = null; - ActivateMe obj; - - // test should tolerate certain types of failures - int failures = 0; - int i = 0; - - System.err.println("\nRegression test for bug 4105080\n"); - System.err.println("java.security.policy = " + - System.getProperty("java.security.policy", - "no policy")); - - - String propValue = - System.getProperty("java.rmi.server.useDynamicProxies", "false"); - boolean useDynamicProxies = Boolean.parseBoolean(propValue); - - CheckActivateRef server; - try { - TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager); - - // start an rmid. - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - p.put("java.rmi.server.useDynamicProxies", propValue); - - /* - * Activate an object by registering its object - * descriptor and invoking a method on the - * stub returned from the register call. - */ - System.err.println("Create activation group in this VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - System.err.println("Creating descriptor"); - ActivationDesc desc = - new ActivationDesc("CheckActivateRef", null, null); - System.err.println("Registering descriptor"); - obj = (ActivateMe) Activatable.register(desc); - - System.err.println("proxy = " + obj); - - if (useDynamicProxies && !Proxy.isProxyClass(obj.getClass())) - { - throw new RuntimeException("proxy is not dynamic proxy"); - } - - /* - * Loop a bunch of times to force activator to - * spawn VMs (groups) - */ - try { - for (; i < 7; i++) { - - System.err.println("Activate object via method call"); - - /* - * Fix for 4277196: if we got an inactive group - * exception, it is likely that we accidentally - * invoked a method on an old activation - * group. Give some time for the group to go away - * and then retry the activation. - */ - try { - obj.ping(); - } catch (RemoteException e) { - Exception detail = (Exception) e.detail; - if ((detail != null) && - (detail instanceof ActivationException) && - (detail.getMessage().equals("group is inactive"))) - { - try { - Thread.sleep(5000); - } catch (InterruptedException ex) { - } - obj.ping(); - - } else { - throw e; - } - } - - System.err.println("proxy = " + obj); - - /* - * Now that object is activated, check to make sure that - * the RemoteRef inside the stub's ActivatableRef - * is *not* an ActivatableRef. - */ - ActivatableRef aref; - if (obj instanceof RemoteStub) { - aref = (ActivatableRef) ((RemoteObject) obj).getRef(); - } else if (Proxy.isProxyClass(obj.getClass())) { - RemoteObjectInvocationHandler handler = - (RemoteObjectInvocationHandler) - Proxy.getInvocationHandler(obj); - aref = (ActivatableRef) handler.getRef(); - } else { - throw new RuntimeException("unknown proxy type"); - } - - final ActivatableRef ref = aref; - Field f = (Field) - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public Object run() throws Exception { - Field ff = ref.getClass().getDeclaredField("ref"); - ff.setAccessible(true); - return ff; - } - }); - Object insideRef = f.get(ref); - System.err.println("insideRef = " + insideRef); - if (insideRef instanceof ActivatableRef) { - TestLibrary.bomb("Embedded ref is an ActivatableRef"); - } else { - System.err.println("ActivatableRef's embedded ref type: " + - insideRef.getClass().getName()); - } - - /* - * Clean up object too. - */ - System.err.println("Deactivate object via method call"); - obj.shutdown(); - - try { - // give activation group time to go away - Thread.sleep(3000); - } catch (InterruptedException e) { - } - } - } catch (java.rmi.UnmarshalException ue) { - // account for test's activation race condition - if (ue.detail instanceof java.io.IOException) { - if ((failures ++) >= 3) { - throw ue; - } - } else { - throw ue; - } - } - - System.err.println("\nsuccess: CheckActivateRef test passed "); - - } catch (java.rmi.activation.ActivationException e) { - // test only needs to pass 3 times in 7 - if (i < 4) { - TestLibrary.bomb(e); - } - } catch (Exception e) { - if (e instanceof java.security.PrivilegedActionException) - e = ((java.security.PrivilegedActionException)e).getException(); - TestLibrary.bomb("\nfailure: unexpected exception " + - e.getClass().getName(), e); - - } finally { - rmid.cleanup(); - obj = null; - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef_Stub.java b/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef_Stub.java deleted file mode 100644 index 33ddb0f1344..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef_Stub.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class CheckActivateRef_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = 10333549859256328L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public CheckActivateRef_Stub() { - super(); - } - public CheckActivateRef_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/group.security.policy b/test/jdk/java/rmi/activation/Activatable/checkActivateRef/group.security.policy deleted file mode 100644 index 02604b7eeb3..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/group.security.policy +++ /dev/null @@ -1,11 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; - - permission java.lang.RuntimePermission "getClassLoader"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/checkActivateRef/rmid.security.policy deleted file mode 100644 index 4ca2dd3fbbd..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.rmi.server.useDynamicProxies=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/security.policy b/test/jdk/java/rmi/activation/Activatable/checkActivateRef/security.policy deleted file mode 100644 index e36b0a0a19e..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkActivateRef/security.policy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // test explicitly acccesses sun.rmi.server.ActivatableRef - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; - - // ref to make sure that internal ref is a UnicastRef - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.rmi.server.useDynamicProxies", "read"; - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "getClassLoader"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java deleted file mode 100644 index 4776f90c3be..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4109103 - * @summary rmid should annotate child process output - * - * @author Laird Dornin; code borrowed from Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider MyRMI CheckAnnotations_Stub - * @run main/othervm/policy=security.policy/timeout=480 CheckAnnotations - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import java.security.CodeSource; -import java.util.Properties; -import java.util.StringTokenizer; - - -public class CheckAnnotations - extends Activatable implements MyRMI, Runnable -{ - private static final double TIME_FACTOR = TestLibrary.getTimeoutFactor(); - - private static Object dummy = new Object(); - private static MyRMI myRMI = null; - - // buffers to store rmid output. - private static ByteArrayOutputStream rmidOut = new ByteArrayOutputStream(); - private static ByteArrayOutputStream rmidErr = new ByteArrayOutputStream(); - - public static void main(String args[]) { - /* - * The following line is required with the JDK 1.2 VM so that the - * VM can exit gracefully when this test completes. Otherwise, the - * conservative garbage collector will find a handle to the server - * object on the native stack and not clear the weak reference to - * it in the RMI runtime's object table. - */ - Object dummy1 = new Object(); - RMID rmid = null; - - System.err.println("\nRegression test for bug/rfe 4109103\n"); - - try { - - // Set security manager according to the - // testlibrary. - TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager); - - // start an rmid. - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(rmidOut, rmidErr, false); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* new desc - we will reuse in order to get multiple vms.*/ - System.err.println("Create activation group in this VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - - ActivationDesc desc = new ActivationDesc - ("CheckAnnotations", null, null); - myRMI = (MyRMI) Activatable.register(desc); - - /* The test- - * Loop a bunch of times to force activator to - * spawn VMs (groups) - */ - for (int i = 0; i < 3; i++) { - - // object activated in annotation check via method call - checkAnnotations(i-1); - - /* - * Clean up object too. - */ - System.err.println - ("Deactivate object via method call"); - myRMI.shutdown(); - } - System.err.println - ("\nsuccess: CheckAnnotations test passed "); - - } catch (Exception e) { - TestLibrary.bomb("\nfailure: unexpected exception ", e); - } finally { - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - - myRMI = null; - System.err.println("rmid shut down"); - rmid.cleanup(); - } - } - - /** - * check to make sure that the output from a spawned vm is - * formatted/annotated properly. - */ - public static void checkAnnotations(int iteration) - throws IOException - { - try { - Thread.sleep((long)(5000 * TIME_FACTOR)); - } catch(Exception e) { - System.err.println(e.getMessage()); - } - - final String FAIL_MSG = "Test failed: output improperly annotated."; - final String OUT = "outABC"; - final String ERR = "errXYZ"; - /** - * cause the spawned vm to generate output that will - * be checked for proper annotation. printOut is - * actually being called on an activated implementation. - */ - myRMI.printOut(OUT + iteration); - myRMI.printErr(ERR + iteration); - myRMI.printOut(OUT + iteration); - myRMI.printErr(ERR + iteration); - - /* we have to wait for output to filter down - * from children so we can read it before we - * kill rmid. - */ - - String outString = null; - String errString = null; - - for (int i = 0 ; i < 5 ; i ++ ) { - // have to give output from rmid time to trickle down to - // this process - try { - Thread.sleep((long)(4000 * TIME_FACTOR)); - } catch(InterruptedException e) { - } - - outString = rmidOut.toString(); - errString = rmidErr.toString(); - - if ((!outString.equals("")) && - (!errString.equals(""))) - { - System.err.println("obtained annotations"); - break; - } - System.err.println("rmid output not yet received, retrying..."); - } - - rmidOut.reset(); - rmidErr.reset(); - - // only test when we are annotating..., first run does not annotate - if (iteration >= 0) { - System.err.println("Checking annotations..."); - System.err.println(outString); - System.err.println(errString); - - StringTokenizer stOut = new StringTokenizer(outString, ":"); - StringTokenizer stErr = new StringTokenizer(errString, ":"); - - String execErr = null; - String execOut = null; - String destOut = null; - String destErr = null; - String outTmp = null; - String errTmp = null; - - while (stOut.hasMoreTokens()) { - execOut = outTmp; - outTmp = destOut; - destOut = stOut.nextToken(); - } - while (stErr.hasMoreTokens()) { - execErr = errTmp; - errTmp = destErr; - destErr = stErr.nextToken(); - } - - if ((execErr == null)||(errTmp == null)|| - (destErr == null)) { - TestLibrary.bomb(FAIL_MSG); - } - if ((execOut == null)||(outTmp == null)|| - (destOut == null)) { - TestLibrary.bomb(FAIL_MSG); - } - - - // just make sure that last two strings are what we expect. - if (!execOut.equals("ExecGroup-" + iteration) - || !(new String(destOut.substring(0,OUT.length()+1)).equals(OUT + - iteration)) - || !(execErr.equals("ExecGroup-"+iteration)) - || !(new String(destErr.substring(0,ERR.length()+1)).equals(ERR + - iteration)) ) { - TestLibrary.bomb(FAIL_MSG); - } - } - } - - // implementation of MyRMI, make this object activatable. - public CheckAnnotations - (ActivationID id, MarshalledObject mo) - throws RemoteException { - - // register/export anonymously - super(id,0); - } - - public void printOut(String toPrint) { - System.out.println(toPrint); - } - - public void printErr(String toPrint) { - System.err.println(toPrint); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception { - (new Thread(this,"CheckAnnotations")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations_Stub.java b/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations_Stub.java deleted file mode 100644 index 832ecd312d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations_Stub.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class CheckAnnotations_Stub - extends java.rmi.server.RemoteStub - implements MyRMI, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void printErr(java.lang.String)"), - new java.rmi.server.Operation("void printOut(java.lang.String)"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = -3955951123118841923L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_printErr_0; - private static java.lang.reflect.Method $method_printOut_1; - private static java.lang.reflect.Method $method_shutdown_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_printErr_0 = MyRMI.class.getMethod("printErr", new java.lang.Class[] {java.lang.String.class}); - $method_printOut_1 = MyRMI.class.getMethod("printOut", new java.lang.Class[] {java.lang.String.class}); - $method_shutdown_2 = MyRMI.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public CheckAnnotations_Stub() { - super(); - } - public CheckAnnotations_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of printErr(String) - public void printErr(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_printErr_0, new java.lang.Object[] {$param_String_1}, 1120261287704800747L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeObject($param_String_1); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of printOut(String) - public void printOut(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_printOut_1, new java.lang.Object[] {$param_String_1}, -7517735248176918178L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeObject($param_String_1); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/group.security.policy b/test/jdk/java/rmi/activation/Activatable/checkAnnotations/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/checkAnnotations/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/security.policy b/test/jdk/java/rmi/activation/Activatable/checkAnnotations/security.policy deleted file mode 100644 index ef36478e900..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/security.policy +++ /dev/null @@ -1,34 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl.java b/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl.java deleted file mode 100644 index 53d3764240b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.activation.Activatable; -import java.rmi.RemoteException; -import java.rmi.activation.ActivationID; -import java.rmi.MarshalledObject; -import java.net.URL; - -public class ActivatableImpl extends Activatable implements MyRMI { - - private boolean classLoaderOk = false; - - public ActivatableImpl(ActivationID id, MarshalledObject mobj) - throws RemoteException - { - super(id, 0); - - ClassLoader thisLoader = ActivatableImpl.class.getClassLoader(); - ClassLoader ccl = Thread.currentThread().getContextClassLoader(); - - System.err.println("implLoader: " + thisLoader); - System.err.println("ccl: " + ccl); - - /* - * the context class loader is the ccl from when this object - * was exported. If the bug has been fixed, the ccl will be - * the same as the class loader of this class. - */ - classLoaderOk = (thisLoader == ccl); - } - - public boolean classLoaderOk() throws RemoteException { - return classLoaderOk; - } - - public void shutdown() throws Exception { - ActivationLibrary.deactivate(this, getID()); - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl_Stub.java b/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl_Stub.java deleted file mode 100644 index 17b8c967922..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/ActivatableImpl_Stub.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ActivatableImpl_Stub - extends java.rmi.server.RemoteStub - implements MyRMI, java.rmi.Remote -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_classLoaderOk_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - $method_classLoaderOk_0 = MyRMI.class.getMethod("classLoaderOk", new java.lang.Class[] {}); - $method_shutdown_1 = MyRMI.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public ActivatableImpl_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of classLoaderOk() - public boolean classLoaderOk() - throws java.rmi.RemoteException - { - try { - Object $result = ref.invoke(this, $method_classLoaderOk_0, null, 5226188865994330896L); - return ((java.lang.Boolean) $result).booleanValue(); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java deleted file mode 100644 index f01bcad60b1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4289544 - * @summary ActivationGroupImpl.newInstance does not set context classloader for impl - * @author Laird Dornin; code borrowed from Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider - * MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub - * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import java.net.URL; - -/** - * sun.rmi.server.ActivationGroupImpl.newInstance() needs to set the - * context class loader when it constructs the implementation class of - * an Activatable object. It needs to set the ccl to be the class - * loader of the implementation class. - * - * Test creates an Activatable object whose impl is loaded outside of - * CLASSPATH. The impls constructor checks to make sure that the - * correct context class loader has been set when the constructor is - * invoked. - */ -public class CheckImplClassLoader { - - private static Object dummy = new Object(); - private static MyRMI myRMI = null; - private static ActivationGroup group = null; - - public static void main(String args[]) { - /* - * The following line is required with the JDK 1.2 VM because - * of gc hocus pocus that may no longer be needed with an - * exact vm (hotspot). - */ - Object dummy1 = new Object(); - RMID rmid = null; - - System.err.println("\nRegression test for bug/rfe 4289544\n"); - - try { - - URL implcb = TestLibrary.installClassInCodebase("ActivatableImpl", - "implcb"); - TestLibrary.installClassInCodebase("ActivatableImpl_Stub", - "implcb"); - TestLibrary.suggestSecurityManager( - TestParams.defaultSecurityManager); - - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - System.err.println("Create activation group in this VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(null, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - group = ActivationGroup.createGroup(groupID, groupDesc, 0); - - ActivationDesc desc = new ActivationDesc("ActivatableImpl", - implcb.toString(), null); - myRMI = (MyRMI) Activatable.register(desc); - - System.err.println("Checking that impl has correct " + - "context class loader"); - if (!myRMI.classLoaderOk()) { - TestLibrary.bomb("incorrect context class loader for " + - "activation constructor"); - } - - System.err.println("Deactivate object via method call"); - myRMI.shutdown(); - - System.err.println("\nsuccess: CheckImplClassLoader test passed "); - - } catch (Exception e) { - TestLibrary.bomb("\nfailure: unexpected exception ", e); - } finally { - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - - myRMI = null; - System.err.println("rmid shut down"); - rmid.cleanup(); - TestLibrary.unexport(group); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/security.policy b/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/security.policy deleted file mode 100644 index 82bea323573..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkImplClassLoader/security.policy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // need to move some classes out of the tests classpath; specific to this test - permission java.io.FilePermission "${test.classes}", "read,write,delete"; - permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete"; - - // need to load custom security manager and activation group from a new codebase - permission java.io.FilePermission ".${/}implcb", "read,write,delete"; - permission java.io.FilePermission ".${/}implcb${/}-", "read,write,delete"; - - // impl class needs to compare context class loader to its own class loader - permission java.lang.RuntimePermission "getClassLoader"; - - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/ActivateMe.java deleted file mode 100644 index 0e0bd2eb79b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java deleted file mode 100644 index 6053eddec6f..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4110548 - * @summary activate fails if rmid is restarted - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * ActivateMe CheckRegisterInLog_Stub - * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import sun.rmi.server.ActivatableRef; -import java.lang.reflect.*; -import java.util.Properties; - -public class CheckRegisterInLog - extends Activatable - implements ActivateMe, Runnable -{ - - public CheckRegisterInLog(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - } - - public void ping() - {} - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"CheckRegisterInLog")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - /* - * The following line is required with the JDK 1.2 VM so that the - * VM can exit gracefully when this test completes. Otherwise, the - * conservative garbage collector will find a handle to the server - * object on the native stack and not clear the weak reference to - * it in the RMI runtime's object table. - */ - Object dummy = new Object(); - RMID rmid = null; - ActivateMe obj; - - System.out.println("\nRegression test for bug 4110548\n"); - - CheckRegisterInLog server; - - try { - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - /* - * Start up activation system daemon "rmid". - */ - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Register an activation group and an object - * in that group. - */ - System.err.println("Creating group descriptor"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - System.err.println("Registering group"); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - - System.err.println("Creating descriptor"); - ActivationDesc desc = - new ActivationDesc(groupID, "CheckRegisterInLog", - null, null); - System.err.println("Registering descriptor"); - obj = (ActivateMe)Activatable.register(desc); - - /* - * Restart rmid to force it to read the log file - */ - rmid.restart(); - - - /* - * 4212096: Give rmid time to go away - we want to make - * sure that an attempt to activate the test object is not made - * on the ActivationSystem that is about to be shutdown. - */ - try { - Thread.sleep(5000); - } catch (InterruptedException ie) { - } - - /* - * Activate the object via a method call. - */ - System.err.println("Activate the object via method call"); - obj.ping(); - - /* - * Clean up object too. - */ - System.err.println("Deactivate object via method call"); - obj.shutdown(); - - System.err.println("\nsuccess: CheckRegisterInLog test passed "); - - } catch (Exception e) { - System.err.println("\nfailure: unexpected exception " + - e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(System.err); - throw new RuntimeException("CheckRegisterInLog got exception " + - e.getMessage()); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog_Stub.java b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog_Stub.java deleted file mode 100644 index 6ebcf792034..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog_Stub.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class CheckRegisterInLog_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = 10333549859256328L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public CheckRegisterInLog_Stub() { - super(); - } - public CheckRegisterInLog_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/rmid.security.policy deleted file mode 100644 index ce485f61343..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/security.policy b/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/security.policy deleted file mode 100644 index c8a24a64de1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/checkRegisterInLog/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting object with non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/ActivateMe.java deleted file mode 100644 index 0e0bd2eb79b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java deleted file mode 100644 index 29a662176d4..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4164971 - * @summary allow non-public activatable class and/or constructor - * @author Laird Dornin - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivateMe - * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import sun.rmi.server.ActivatableRef; -import java.lang.reflect.*; -import java.util.Properties; - -/** - * Test creates a private inner class Activatable object with a - * private constructor and makes sure that the object can be - * activated. - */ -public class CreatePrivateActivatable -{ - private static class PrivateActivatable extends Activatable - implements ActivateMe, Runnable - { - private PrivateActivatable(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - } - - public void ping() - {} - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this, "CreatePrivateActivatable$PrivateActivatable")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - } - - public static void main(String[] args) { - /* - * The following line is required with the JDK 1.2 VM so that the - * VM can exit gracefully when this test completes. Otherwise, the - * conservative garbage collector will find a handle to the server - * object on the native stack and not clear the weak reference to - * it in the RMI runtime's object table. - */ - Object dummy = new Object(); - RMID rmid = null; - ActivateMe obj; - - System.err.println("\nRegression test for bug 4164971\n"); - System.err.println("java.security.policy = " + - System.getProperty("java.security.policy", "no policy")); - - CreatePrivateActivatable server; - try { - TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager); - - // start an rmid. - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Activate an object by registering its object - * descriptor and invoking a method on the - * stub returned from the register call. - */ - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - - System.err.println("Creating descriptor"); - ActivationDesc desc = - new ActivationDesc(groupID, - "CreatePrivateActivatable$PrivateActivatable", - null, null); - - System.err.println("Registering descriptor"); - obj = (ActivateMe) Activatable.register(desc); - - /* - * Loop a bunch of times to force activator to - * spawn VMs (groups) - */ - System.err.println("Activate object via method call"); - obj.ping(); - - /* - * Clean up object too. - */ - System.err.println("Deactivate object via method call"); - obj.shutdown(); - - System.err.println("\nsuccess: CreatePrivateActivatable test passed "); - - } catch (Exception e) { - if (e instanceof java.security.PrivilegedActionException) { - e = ((java.security.PrivilegedActionException)e).getException(); - } - TestLibrary.bomb("\nfailure: unexpected exception " + - e.getClass().getName(), e); - - } finally { - rmid.cleanup(); - obj = null; - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy b/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/security.policy b/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/security.policy deleted file mode 100644 index c8a24a64de1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/createPrivateActivable/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting object with non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Bar.java b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Bar.java deleted file mode 100644 index d958d3307a9..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Bar.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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 Bar extends Foo { -} diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java deleted file mode 100644 index b3bafdb1c32..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4149366 - * @summary The class loader used to load classes for parameter types sent in - * an RMI call to an activatable object should delegate to the class loader - * that loaded the class of the activatable object itself, to maximize the - * likelihood of type compatibility between downloaded parameter types and - * supertypes shared with the activatable object. - * @author Peter Jones (much code taken from Ann Wollrath's activation tests) - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * Foo FooReceiverImpl FooReceiverImpl_Stub Bar - * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass - */ - -import java.io.*; -import java.net.*; -import java.util.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; - -public class DownloadParameterClass { - - public interface FooReceiver extends Remote { - - /* - * The interface can't actually declare that the method takes a - * Foo, because then Foo would have to be in the test's CLASSPATH, - * which might get propagated to the group VM's CLASSPATH, which - * would nullify the test (the Foo supertype must be loaded in the - * group VM only through the class loader that loaded the - * activatable object). - */ - public void receiveFoo(Object obj) throws RemoteException; - } - - public static void main(String[] args) { - - System.err.println("\nRegression test for bug 4149366\n"); - - /* - * Install classes to be seen by the activatable object's class - * loader in the "codebase1" subdirectory of working directory, and - * install the subtype to be downloaded into the activatable object - * into the "codebase2" subdirectory. - */ - URL codebase1 = null; - URL codebase2 = null; - try { - codebase1 = TestLibrary.installClassInCodebase("FooReceiverImpl", "codebase1"); - TestLibrary.installClassInCodebase("FooReceiverImpl_Stub", "codebase1"); - TestLibrary.installClassInCodebase("Foo", "codebase1"); - codebase2 = TestLibrary.installClassInCodebase("Bar", "codebase2"); - } catch (MalformedURLException e) { - TestLibrary.bomb("failed to install test classes", e); - } - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Create and register descriptors for activatable object in a - * group other than this VM's group, so that another VM will be - * spawned with the object is activated. - */ - System.err.println("Creating descriptors"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - ActivationDesc objDesc = - new ActivationDesc(groupID, "FooReceiverImpl", - codebase1.toString(), null, false); - - System.err.println("Registering descriptors"); - FooReceiver obj = (FooReceiver) Activatable.register(objDesc); - - /* - * Create an instance of the subtype to be downloaded by the - * activatable object. The codebase must be a path including - * "codebase1" as well as "codebase2" because the supertype - * must be visible here as well; the supertype cannot be - * installed in both codebases (like it would be in a typical - * setup) because of the trivial installation mechanism used - * below, and see the comment above for why it can't be in - * the test's CLASSPATH. - */ - Class subtype = RMIClassLoader.loadClass( - codebase2 + " " + codebase1, "Bar"); - Object subtypeInstance = subtype.newInstance(); - - obj.receiveFoo(subtypeInstance); - - System.err.println("\nTEST PASSED\n"); - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Foo.java b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Foo.java deleted file mode 100644 index 13f4eb08ff7..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/Foo.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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 Foo implements java.io.Serializable { -} diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl_Stub.java b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl_Stub.java deleted file mode 100644 index 1fc32380fc7..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/FooReceiverImpl_Stub.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class FooReceiverImpl_Stub - extends java.rmi.server.RemoteStub - implements DownloadParameterClass. FooReceiver -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_receiveFoo_0; - - static { - try { - $method_receiveFoo_0 = DownloadParameterClass. FooReceiver.class.getMethod("receiveFoo", new java.lang.Class[] {java.lang.Object.class}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public FooReceiverImpl_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of receiveFoo(Object) - public void receiveFoo(java.lang.Object $param_Object_1) - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_receiveFoo_0, new java.lang.Object[] {$param_Object_1}, -1548895758515635945L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy deleted file mode 100644 index 41abd5dd468..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy +++ /dev/null @@ -1,15 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; - - // need to load custom security manager and activation group from a new codebase - permission java.io.FilePermission ".${/}codebase1", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase1${/}-", "read,write"; - permission java.io.FilePermission ".${/}codebase2", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase2${/}-", "read,write,delete"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/manual.security.policy b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/manual.security.policy deleted file mode 100644 index 79d8bb32ce1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/manual.security.policy +++ /dev/null @@ -1,40 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // need to move some classes out of the tests classpath; specific to this test - permission java.io.FilePermission ".", "read,write,delete"; - permission java.io.FilePermission ".${/}-", "read,write,delete"; - - // need to load custom security manager and activation group from a new codebase - permission java.io.FilePermission ".${/}codebase1", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase1${/}-", "read,write"; - permission java.io.FilePermission ".${/}codebase2", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase2${/}-", "read,write,delete"; - - // standard activation permissions - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.classes", "read"; - permission java.util.PropertyPermission "test.src", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/security.policy b/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/security.policy deleted file mode 100644 index f37bf9525a5..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/downloadParameterClass/security.policy +++ /dev/null @@ -1,41 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // need to move some classes out of the tests classpath; specific to this test - permission java.io.FilePermission "${test.classes}", "read,write,delete"; - permission java.io.FilePermission "${test.classes}${/}-", "read,write,delete"; - - // need to load custom security manager and activation group from a new codebase - permission java.io.FilePermission ".${/}codebase1", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase1${/}-", "read,write"; - permission java.io.FilePermission ".${/}codebase2", "read,write,delete"; - permission java.io.FilePermission ".${/}codebase2${/}-", "read,write,delete"; - - // standard activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ActivateMe.java deleted file mode 100644 index 0e0bd2eb79b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java deleted file mode 100644 index 89f3c90b24c..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4128620 - * @summary synopsis: NoSuchMethodError should be elucidated - * @author Laird Dornin - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivateMe ElucidateNoSuchMethod_Stub - * @run main/othervm/policy=security.policy/timeout=240 ElucidateNoSuchMethod - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Properties; - -public class ElucidateNoSuchMethod - extends Activatable - implements ActivateMe, Runnable -{ - - /** - * provide a constructor that alllows this object to be made - * activatable, or at least registered. - */ - ElucidateNoSuchMethod(ActivationID id, int port) - throws RemoteException - { - super(id, port); - } - - /** - * dont provide an activation constructor so that we get a no such - * method error. - */ - - public void ping() {} - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception { - (new Thread(this,"ElucidateNoSuchMethod")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for 4128620 \n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - System.err.println("Create activation group in this VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - - System.err.println("Creating descriptor"); - ActivationDesc desc = - new ActivationDesc("ElucidateNoSuchMethod", null, null); - - System.err.println("Registering descriptor"); - ActivateMe obj = (ActivateMe) Activatable.register(desc); - - System.err.println("Activate object via method call"); - - try { - obj.ping(); - } catch (ActivateFailedException afe) { - ActivationException a = (ActivationException) afe.detail; - - if (((a.detail instanceof NoSuchMethodException) || - (a.detail instanceof NoSuchMethodError)) && - (a.getMessage().indexOf - ("must provide an activation constructor") > -1)) { - System.err.println("\ntest passed for 4128620\n"); - } else { - TestLibrary.bomb("test failed", afe); - } - } - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod_Stub.java b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod_Stub.java deleted file mode 100644 index c0a10df5b2c..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod_Stub.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ElucidateNoSuchMethod_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = 10333549859256328L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public ElucidateNoSuchMethod_Stub() { - super(); - } - public ElucidateNoSuchMethod_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy deleted file mode 100644 index bf7d8c414b9..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy +++ /dev/null @@ -1,13 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; - - // Needed because of bug#: 4182104 - permission java.lang.RuntimePermission "modifyThreadGroup"; - permission java.lang.RuntimePermission "modifyThread"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/rmid.security.policy deleted file mode 100644 index 586dd8efc1b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/security.policy b/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/security.policy deleted file mode 100644 index fd3dd828d23..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/elucidateNoSuchMethod/security.policy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // Needed because of bug#: 4182104 - permission java.lang.RuntimePermission "modifyThreadGroup"; - permission java.lang.RuntimePermission "modifyThread"; - - // properties are needed because of bug#: 4179055 - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; - permission java.util.PropertyPermission "package.restrict.access.sun", "read"; - permission java.util.PropertyPermission "package.restrict.access.sun.rmi", "read"; - - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/CheckLoader.java b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/CheckLoader.java deleted file mode 100644 index e515eb7a58b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/CheckLoader.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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 interface CheckLoader extends java.rmi.Remote { - boolean isCorrectContextLoader() throws java.rmi.RemoteException; -} diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl.java b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl.java deleted file mode 100644 index 7c2dc413986..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.*; -import java.rmi.activation.*; - -public class ExtLoadedImpl implements CheckLoader { - - public ExtLoadedImpl(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - Activatable.exportObject(this, id, 0); - } - - public boolean isCorrectContextLoader() { - ClassLoader contextLoader = - Thread.currentThread().getContextClassLoader(); - ClassLoader implLoader = this.getClass().getClassLoader(); - if (contextLoader == implLoader) { - System.err.println("contextLoader same as implLoader"); - return false; - } else if (contextLoader.getParent() == implLoader) { - System.err.println("contextLoader is child of implLoader"); - return true; - } else { - System.err.println("unknown loader relationship"); - return false; - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java deleted file mode 100644 index 96b2f7d9421..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.*; -import java.rmi.activation.*; -import java.util.*; - -public class ExtLoadedImplTest { - - public static void main(String[] args) { - - System.err.println("\nRegression test for bug 4500504\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - Properties p = new Properties(); - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - p.put("java.ext.dirs", "ext"); - - - System.err.println("Creating descriptors"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - ActivationDesc objDesc = - new ActivationDesc(groupID, "ExtLoadedImpl", null, null); - - System.err.println("Registering descriptors"); - CheckLoader obj = (CheckLoader) Activatable.register(objDesc); - - boolean result = obj.isCorrectContextLoader(); - - System.err.println("\nTEST " + - ((result) ? "PASSED" : "FAILED") + "\n"); - - if (!result) { - throw new RuntimeException("TEST FAILED"); - } - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl_Stub.java b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl_Stub.java deleted file mode 100644 index a320f8f9ea6..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImpl_Stub.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ExtLoadedImpl_Stub - extends java.rmi.server.RemoteStub - implements CheckLoader -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_isCorrectContextLoader_0; - - static { - try { - $method_isCorrectContextLoader_0 = CheckLoader.class.getMethod("isCorrectContextLoader", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public ExtLoadedImpl_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of isCorrectContextLoader() - public boolean isCorrectContextLoader() - throws java.rmi.RemoteException - { - try { - Object $result = ref.invoke(this, $method_isCorrectContextLoader_0, null, -5210790440944383968L); - return ((java.lang.Boolean) $result).booleanValue(); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ext.sh b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ext.sh deleted file mode 100644 index 2a049fa093b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/ext.sh +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (c) 2002, 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 4500504 -# @summary If the context class loader is a child of the impl's class -# loader, the context class loader should remain unchanged (i.e., not be -# set to the impl's class loader) when the impl is activated. -# @library ../../../testlibrary -# @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary -# @build ExtLoadedImplTest ExtLoadedImpl ExtLoadedImpl_Stub CheckLoader -# @run shell ext.sh - -OS=`uname -s` -case "$OS" in - Linux | Darwin | AIX ) - PS=":" - ;; - Windows* | CYGWIN* ) - PS=";" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -mkdir -p classes -for dir in `echo ${TESTCLASSPATH:-$TESTCLASSES} | sed -e "s/$PS/ /"` ; do cp $dir/*.class classes ; done -rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoader.class -mkdir -p ext -$COMPILEJAVA/bin/jar ${TESTTOOLVMOPTS} cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class - -TESTVMOPTS="${TESTVMOPTS} \ - --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED \ - --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED \ - --add-exports java.rmi/sun.rmi.transport=ALL-UNNAMED \ - --add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" -$TESTJAVA/bin/java ${TESTVMOPTS} -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest - diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/rmid.security.policy deleted file mode 100644 index 7d38f7bfa42..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission - "-Djava.security.manager=*"; - permission com.sun.rmi.rmid.ExecOptionPermission - "-Djava.security.policy=*"; - permission com.sun.rmi.rmid.ExecOptionPermission - "-Djava.ext.dirs=*"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/security.policy b/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/security.policy deleted file mode 100644 index 0c9ca1ab750..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/extLoadedImpl/security.policy +++ /dev/null @@ -1,25 +0,0 @@ - -grant { - // standard activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ActivateMe.java deleted file mode 100644 index 79538990c39..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping(int intId, String responder) throws RemoteException; - public void crash() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java deleted file mode 100644 index 2b97650a599..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4173960 - * @summary synopsis: Activatable objects cannot be restarted. - * @author Laird Dornin - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * ActivateMe ForceLogSnapshot_Stub - * @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.*; - -public class ForceLogSnapshot - implements ActivateMe -{ - /** how many activatable remote objects to create to test rmid */ - final public static int HOW_MANY = 50; - final public static int NUM_GROUPS = 4; - /** cause RMID to generate a snapshot every 10th activated object */ - final public static int SNAPSHOT_INTERVAL = 10; - - private ActivationID id; - private Vector responders = new Vector(); - - private static final String RESTARTABLE = "restartable"; - private static final String ACTIVATABLE = "activatable"; - - private static Object lock = new Object(); - private static boolean[] restartedObjects = new boolean[HOW_MANY]; - private static boolean[] activatedObjects = new boolean[HOW_MANY]; - - public ForceLogSnapshot(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - int intId = 0; - - Activatable.exportObject(this, id, 0); - ActivateMe obj; - String responder; - try { - Object[] stuff = (Object[]) mobj.get(); - - intId = ((Integer) stuff[0]).intValue(); - responder = (String) stuff[1]; - obj = (ActivateMe) stuff[2]; - - System.err.println(responder + " service started"); - } catch (Exception e) { - System.err.println("unable to obtain stub from marshalled object"); - System.err.println(e.getMessage()); - e.printStackTrace(); - return; - } - - obj.ping(intId, responder); - } - - public ForceLogSnapshot() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - public void ping(int intId, String responder) { - System.err.println("ForceLogSnapshot: received ping from " + - responder); - if (responder.equals(RESTARTABLE)) { - synchronized (lock) { - restartedObjects[intId] = true; - } - } else if (responder.equals(ACTIVATABLE)) { - synchronized (lock) { - activatedObjects[intId] = true; - } - } - } - - public void crash() { - System.exit(0); - } - - public ActivationID getID() { - return id; - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4173960\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - ForceLogSnapshot[] unicastObjs = new ForceLogSnapshot[HOW_MANY]; - - try { - String option = " -Dsun.rmi.activation.snapshotInterval=" + - SNAPSHOT_INTERVAL; - - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.addOptions(new String[] {option, "-Djava.compiler="}); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - Object[][] stuff = new Object[HOW_MANY][]; - MarshalledObject restartMobj = null; - ActivationGroupDesc groupDesc = null; - MarshalledObject activateMobj = null; - ActivationGroupID[] groupIDs = new ActivationGroupID[NUM_GROUPS]; - ActivationDesc restartableDesc = null; - ActivationDesc activatableDesc = null; - ActivateMe[] restartableObj = new ActivateMe[HOW_MANY]; - ActivateMe[] activatableObj = new ActivateMe[HOW_MANY]; - - /* - * Create unicast object to be contacted when service is activated. - */ - int group = 0; - int groupNo = 0; - for (int i = 0 ; i < HOW_MANY ; i ++ ) { - - System.err.println("Creating descriptors and remote objects"); - - unicastObjs[i] = new ForceLogSnapshot(); - - /* - * Create and register descriptors for a restartable and - * non-restartable service (respectively) in a group other than - * this VM's group. - */ - stuff[i] = new Object[] { new Integer(i), - RESTARTABLE, unicastObjs[i] }; - restartMobj = new MarshalledObject(stuff[i]); - - stuff[i][1] = ACTIVATABLE; - activateMobj = new MarshalledObject(stuff[i]); - - groupDesc = - new ActivationGroupDesc(p, null); - - if (i < NUM_GROUPS) { - groupNo = i; - groupIDs[groupNo] = - ActivationGroup.getSystem(). - registerGroup(groupDesc); - } else { - groupNo = (group++)%NUM_GROUPS; - } - - System.err.println("Objects group number: " + groupNo); - - restartableDesc = - new ActivationDesc(groupIDs[groupNo], "ForceLogSnapshot", null, - restartMobj, true); - - activatableDesc = - new ActivationDesc(groupIDs[groupNo], "ForceLogSnapshot", null, - activateMobj, false); - - System.err.println("Registering descriptors"); - restartableObj[i] = - (ActivateMe) Activatable.register(restartableDesc); - - activatableObj[i] = - (ActivateMe) Activatable.register(activatableDesc); - System.err.println("registered activatable #: " + i); - - // start reusing groups if we need to do so. - } - - int repeatOnce = 1; - do { - - /* - * Restart rmid; it should start up the restartable service - */ - rmid.restart(); - - if (howManyRestarted(restartedObjects, 10) < HOW_MANY) { - TestLibrary.bomb("Test1 failed: a service would not " + - "restart"); - } - System.err.println("Test1 passed: rmid " + - "all service(s) restarted. Performing next test."); - - /* - * Make sure no activatable services were automatically - * restarted. - */ - if (howManyRestarted(activatedObjects, 2) != 0) { - TestLibrary.bomb("Test2 failed: activatable service restarted!", - null); - } - System.err.println("Test2 passed: rmid did not " + - "restart activatable service(s)"); - - if (repeatOnce > 0) { - try { - System.err.println("\nCrash restartable object"); - for (int i = 0 ; i < HOW_MANY ; i ++) { - restartableObj[i].crash(); - } - } catch (Exception e) { - } - } - - } while (repeatOnce-- > 0); - - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - for (int i = 0 ; i < HOW_MANY ; i ++) { - TestLibrary.unexport(unicastObjs[i]); - } - } - } - - /** - * Check to see how many services have been automatically - * restarted. - */ - private static int howManyRestarted(boolean[] startedObjects, int retries) { - int succeeded = 0; - int restarted = 0; - int atry = 0; - - while ((restarted < HOW_MANY) && (atry < retries)) { - restarted = 0; - for (int j = 0 ; j < HOW_MANY ; j ++ ) { - synchronized(lock) { - if (startedObjects[j]) { - restarted ++; - } - } - } - System.err.println("not all objects restarted, retrying..."); - try { - Thread.sleep(10000); - } catch (InterruptedException ie) { - } - atry ++; - } - return restarted; - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Skel.java b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Skel.java deleted file mode 100644 index 755ee3f4a50..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Skel.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Skeleton class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ForceLogSnapshot_Skel - implements java.rmi.server.Skeleton -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void crash()"), - new java.rmi.server.Operation("void ping(int, java.lang.String)") - }; - - private static final long interfaceHash = -5865767584502007357L; - - public java.rmi.server.Operation[] getOperations() { - return (java.rmi.server.Operation[]) operations.clone(); - } - - public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) - throws java.lang.Exception - { - if (opnum < 0) { - if (hash == 8484760490859430950L) { - opnum = 0; - } else if (hash == -1519179153769139224L) { - opnum = 1; - } else { - throw new java.rmi.UnmarshalException("invalid method hash"); - } - } else { - if (hash != interfaceHash) - throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); - } - - ForceLogSnapshot server = (ForceLogSnapshot) obj; - switch (opnum) { - case 0: // crash() - { - call.releaseInputStream(); - server.crash(); - try { - call.getResultStream(true); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling return", e); - } - break; - } - - case 1: // ping(int, String) - { - int $param_int_1; - java.lang.String $param_String_2; - try { - java.io.ObjectInput in = call.getInputStream(); - $param_int_1 = in.readInt(); - $param_String_2 = (java.lang.String) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); - } finally { - call.releaseInputStream(); - } - server.ping($param_int_1, $param_String_2); - try { - call.getResultStream(true); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling return", e); - } - break; - } - - default: - throw new java.rmi.UnmarshalException("invalid method number"); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Stub.java b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Stub.java deleted file mode 100644 index 3e6bb0f2b5a..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot_Stub.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ForceLogSnapshot_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void crash()"), - new java.rmi.server.Operation("void ping(int, java.lang.String)") - }; - - private static final long interfaceHash = -5865767584502007357L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_crash_0; - private static java.lang.reflect.Method $method_ping_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_crash_0 = ActivateMe.class.getMethod("crash", new java.lang.Class[] {}); - $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {int.class, java.lang.String.class}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public ForceLogSnapshot_Stub() { - super(); - } - public ForceLogSnapshot_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of crash() - public void crash() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_crash_0, null, 8484760490859430950L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of ping(int, String) - public void ping(int $param_int_1, java.lang.String $param_String_2) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_1, new java.lang.Object[] {new java.lang.Integer($param_int_1), $param_String_2}, -1519179153769139224L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeInt($param_int_1); - out.writeObject($param_String_2); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/rmid.security.policy deleted file mode 100644 index ce485f61343..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/security.policy b/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/security.policy deleted file mode 100644 index c8a24a64de1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/forceLogSnapshot/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting object with non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/ActivateMe.java deleted file mode 100644 index 4d7d7e5dc8a..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/ActivateMe.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public ActivateMe getUnicastVersion() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java deleted file mode 100644 index bf5d45d69e9..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4116082 - * - * @summary synopsis: rmid should not destroy group when it reports - * inactiveGroup - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary ActivateMe InactiveGroup_Stub - * @run main/othervm/policy=security.policy/timeout=240 InactiveGroup - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Properties; - -public class InactiveGroup - implements ActivateMe, Runnable -{ - - private ActivationID id; - - public InactiveGroup(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - } - - public InactiveGroup() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - public void ping() - {} - - public ActivateMe getUnicastVersion() throws RemoteException { - return new InactiveGroup(); - } - - public ActivationID getID() { - return id; - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"InactiveGroup")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() - { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4116082\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Create descriptor and activate object in a separate VM. - */ - System.err.println("Creating descriptor"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - ActivationDesc desc = - new ActivationDesc(groupID, "InactiveGroup", null, null); - - System.err.println("Registering descriptor"); - ActivateMe activatableObj = (ActivateMe) Activatable.register(desc); - - System.err.println("Activate object via method call"); - activatableObj.ping(); - - /* - * Create a unicast object in the activatable object's VM. - */ - System.err.println("Obtain unicast object"); - ActivateMe unicastObj = activatableObj.getUnicastVersion(); - - /* - * Make activatable object (and therefore group) inactive. - */ - System.err.println("Make activatable object inactive"); - activatableObj.shutdown(); - - /* - * Ping the unicast object a few times to make sure that the - * activation group's process hasn't gone away. - */ - System.err.println("Ping unicast object for existence"); - // set timeout 5 seconds - final long stopTime = System.currentTimeMillis() + 5000; - while (System.currentTimeMillis() < stopTime) { - unicastObj.ping(); - Thread.sleep(500); - } - - /* - * Now, reactivate the activatable object; the unicast object - * should no longer be accessible, since reactivating the - * activatable object should kill the previous group's VM - * and the unicast object along with it. - */ - System.err.println("Reactivate activatable obj"); - activatableObj.ping(); - - try { - System.err.println("Ping unicast object again"); - unicastObj.ping(); - } catch (Exception thisShouldFail) { - System.err.println("Test passed: couldn't reach unicast obj: " + - thisShouldFail.getMessage()); - return; - } - - TestLibrary.bomb("Test failed: unicast obj accessible after group reactivates", - null); - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup_Stub.java b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup_Stub.java deleted file mode 100644 index 5d9fd2ede48..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup_Stub.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class InactiveGroup_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("ActivateMe getUnicastVersion()"), - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = -23477180812089514L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_getUnicastVersion_0; - private static java.lang.reflect.Method $method_ping_1; - private static java.lang.reflect.Method $method_shutdown_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_getUnicastVersion_0 = ActivateMe.class.getMethod("getUnicastVersion", new java.lang.Class[] {}); - $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_2 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public InactiveGroup_Stub() { - super(); - } - public InactiveGroup_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of getUnicastVersion() - public ActivateMe getUnicastVersion() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getUnicastVersion_0, null, -4366214672304578894L); - return ((ActivateMe) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ActivateMe $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (ActivateMe) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_1, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/group.security.policy b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/security.policy b/test/jdk/java/rmi/activation/Activatable/inactiveGroup/security.policy deleted file mode 100644 index c8a24a64de1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/inactiveGroup/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting object with non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java deleted file mode 100644 index 8ed9c763b32..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 6245733 - * @summary synopsis: rmid's registry's list operation doesn't include - * activation system - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * @run main/othervm/timeout=240 LookupActivationSystem - */ - -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.registry.*; -import java.rmi.server.*; -import java.io.Serializable; - -public class LookupActivationSystem implements Remote, Serializable { - - private static final String NAME = ActivationSystem.class.getName(); - - public static void main(String[] args) throws Exception { - - System.out.println("\nRegression test for bug 6245733\n"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - System.err.println("look up activation system"); - Registry rmidRegistry = - LocateRegistry.getRegistry(rmid.getPort()); - ActivationSystem system = (ActivationSystem) - rmidRegistry.lookup(NAME); - - if (system instanceof ActivationSystem) { - System.err.println("test1 passed: lookup succeeded"); - } - - System.err.println("get list of rmid internal registry"); - String[] list = rmidRegistry.list(); - if (list.length == 1 && list[0].equals(NAME)) { - System.err.println( - "test2 passed: activation system found in list"); - } else { - throw new RuntimeException("test2 FAILED"); - } - - try { - rmidRegistry.bind(NAME, new LookupActivationSystem()); - throw new RuntimeException("test3 FAILED: bind succeeded!"); - } catch (ServerException e) { - if (e.getCause() instanceof AccessException) { - System.err.println( - "test3 passed: binding ActivationSystem " + - "failed as expected"); - } else { - throw new RuntimeException( - "test3 FAILED: incorrect cause: " + e.getCause()); - } - - } - - try { - rmidRegistry.rebind(NAME, new LookupActivationSystem()); - throw new RuntimeException("test4 FAILED: rebind succeeded!"); - } catch (ServerException e) { - if (e.getCause() instanceof AccessException) { - System.err.println( - "test4 passed: rebinding ActivationSystem " + - "failed as expected"); - } else { - throw new RuntimeException( - "test4 FAILED: incorrect cause: " + e.getCause()); - } - } - - try { - rmidRegistry.unbind(NAME); - throw new RuntimeException("test4 FAILED: unbind succeeded!"); - } catch (ServerException e) { - if (e.getCause() instanceof AccessException) { - System.err.println( - "test5 passed: unbinding ActivationSystem " + - "failed as expected"); - } else { - throw new RuntimeException( - "test5 FAILED: incorrect cause: " + e.getCause()); - } - } - - - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/rmid.security.policy deleted file mode 100644 index 69c222e3e63..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/lookupActivationSystem/rmid.security.policy +++ /dev/null @@ -1,6 +0,0 @@ -grant { - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/nestedActivate/ActivateMe.java deleted file mode 100644 index a75ba277d3d..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/ActivateMe.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void unregister() throws Exception; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java deleted file mode 100644 index b1c841dc256..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4138056 - * @summary synopsis: Activating objects from an Activatable constructor causes deadlock - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary ActivateMe NestedActivate_Stub - * @run main/othervm/policy=security.policy/timeout=240 NestedActivate - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Properties; - -public class NestedActivate - extends Activatable - implements ActivateMe, Runnable -{ - - private static Exception exception = null; - private static boolean done = false; - private ActivateMe obj = null; - - public NestedActivate(ActivationID id, MarshalledObject mobj) - throws Exception - { - super(id, 0); - System.err.println("NestedActivate<>: activating object"); - if (mobj != null) { - System.err.println("NestedActivate<>: ping obj to activate"); - obj = (ActivateMe) mobj.get(); - obj.ping(); - System.err.println("NestedActivate<>: ping completed"); - } - } - - public void ping() - {} - - public void unregister() throws Exception { - super.unregister(super.getID()); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"NestedActivate")).start(); - if (obj != null) - obj.shutdown(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.err.println("\nRegression test for bug 4138056\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - final Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - Thread t = new Thread() { - public void run () { - try { - System.err.println("Creating group descriptor"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationGroupID groupID = - ActivationGroup.getSystem(). - registerGroup(groupDesc); - - System.err.println("Creating descriptor: object 1"); - ActivationDesc desc1 = - new ActivationDesc(groupID, "NestedActivate", - null, null); - - System.err.println("Registering descriptor: object 1"); - ActivateMe obj1 = - (ActivateMe) Activatable.register(desc1); - - System.err.println("Creating descriptor: object 2"); - ActivationDesc desc2 = - new ActivationDesc(groupID, "NestedActivate", null, - new MarshalledObject(obj1)); - - System.err.println("Registering descriptor: object 2"); - ActivateMe obj2 = - (ActivateMe) Activatable.register(desc2); - - System.err.println("Activating object 2"); - obj2.ping(); - - System.err.println("Deactivating objects"); - obj2.shutdown(); - } catch (Exception e) { - exception = e; - } - done = true; - } - }; - - t.start(); - t.join(35000); - - if (exception != null) { - TestLibrary.bomb("test failed", exception); - } else if (!done) { - TestLibrary.bomb("test failed: not completed before timeout", null); - } else { - System.err.println("Test passed"); - } - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate_Stub.java b/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate_Stub.java deleted file mode 100644 index 22870a41b0f..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/NestedActivate_Stub.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class NestedActivate_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()"), - new java.rmi.server.Operation("void unregister()") - }; - - private static final long interfaceHash = 4395146122524413703L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - private static java.lang.reflect.Method $method_unregister_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - $method_unregister_2 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public NestedActivate_Stub() { - super(); - } - public NestedActivate_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of unregister() - public void unregister() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_unregister_2, null, -5366864281862648102L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/group.security.policy b/test/jdk/java/rmi/activation/Activatable/nestedActivate/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/nestedActivate/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nestedActivate/security.policy b/test/jdk/java/rmi/activation/Activatable/nestedActivate/security.policy deleted file mode 100644 index ac03704a625..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nestedActivate/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting of non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/ActivateMe.java deleted file mode 100644 index a75ba277d3d..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/ActivateMe.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void unregister() throws Exception; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java deleted file mode 100644 index 5074ac52bc5..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4115296 - * @summary synopsis: NoSuchObjectException not thrown for non-existent - * activatable objects - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * ActivateMe NonExistentActivatable_Stub - * @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Properties; - -public class NonExistentActivatable - extends Activatable - implements ActivateMe, Runnable -{ - - public NonExistentActivatable(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - } - - public void ping() - {} - - public void unregister() throws Exception { - super.unregister(super.getID()); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"NonExistentActivatable")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() - { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4115331\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - System.err.println("Create activation group in this VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - - System.err.println("Creating descriptor"); - ActivationDesc desc = - new ActivationDesc("NonExistentActivatable", null, null); - - System.err.println("Registering descriptor"); - ActivateMe obj = (ActivateMe) Activatable.register(desc); - - System.err.println("Activate object via method call"); - obj.ping(); - - System.err.println("Unregister object"); - obj.unregister(); - - System.err.println("Make object inactive"); - obj.shutdown(); - - System.err.println("Reactivate object"); - try { - obj.ping(); - } catch (NoSuchObjectException e) { - System.err.println("Test succeeded: " + - "NoSuchObjectException caught"); - return; - } catch (Exception e) { - TestLibrary.bomb("Test failed: exception other than NoSuchObjectException", - e); - } - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable_Stub.java b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable_Stub.java deleted file mode 100644 index fa0e2d4b258..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable_Stub.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class NonExistentActivatable_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()"), - new java.rmi.server.Operation("void unregister()") - }; - - private static final long interfaceHash = 4395146122524413703L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - private static java.lang.reflect.Method $method_unregister_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - $method_unregister_2 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public NonExistentActivatable_Stub() { - super(); - } - public NonExistentActivatable_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of unregister() - public void unregister() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_unregister_2, null, -5366864281862648102L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/security.policy b/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/security.policy deleted file mode 100644 index c8a24a64de1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/nonExistentActivatable/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // allow exporting object with non-public remote interface - permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/notSerializable/NotSerializable.java b/test/jdk/java/rmi/activation/Activatable/notSerializable/NotSerializable.java deleted file mode 100644 index 5e45106bfdd..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/notSerializable/NotSerializable.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test - * @bug 4460983 - * @summary This test verifies that an instance of Activatable cannot - * be serialized (without implicit impl-to-stub replacement), because - * it cannot be meaningfully deserialized anyway. - * See also test/java/rmi/server/RemoteObject/unrecognizedRefType. - * @author Peter Jones - * - * @run main/othervm NotSerializable - */ - -import java.io.ByteArrayOutputStream; -import java.io.NotSerializableException; -import java.io.ObjectInput; -import java.io.ObjectOutputStream; -import java.io.ObjectOutput; -import java.lang.reflect.Method; -import java.rmi.MarshalledObject; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.server.Operation; -import java.rmi.server.RemoteCall; -import java.rmi.server.RemoteObject; -import java.rmi.server.RemoteRef; -import java.rmi.server.RemoteStub; -import java.rmi.activation.Activatable; -import java.rmi.activation.ActivationID; -import java.rmi.activation.Activator; - -public class NotSerializable { - - public static void main(String[] args) throws Exception { - System.err.println("\nRegression test for bug 4460983\n"); - - Activatable act = new FakeActivatable(); - try { - ObjectOutputStream out = - new ObjectOutputStream(new ByteArrayOutputStream()); - try { - out.writeObject(act); - throw new RuntimeException("TEST FAILED: " + - "Activatable instance successfully serialized"); - } catch (NotSerializableException e) { - System.err.println("NotSerializableException as expected:"); - e.printStackTrace(); - } // other exceptions cause test failure - - System.err.println("TEST PASSED"); - } finally { - try { - Activatable.unexportObject(act, true); - } catch (NoSuchObjectException e) { - } - } - } - - private static class FakeActivatable extends Activatable { - FakeActivatable() throws RemoteException { - super(new ActivationID(new FakeActivator()), 0); - } - } - - private static class FakeActivator - extends RemoteStub implements Activator - { - FakeActivator() { - super(new FakeRemoteRef("FakeRef")); - } - - public MarshalledObject activate(ActivationID id, boolean force) { - return null; - } - } - - private static class FakeRemoteRef implements RemoteRef { - private final String refType; - - FakeRemoteRef(String refType) { - this.refType = refType; - } - - public Object invoke(Remote obj, - Method method, - Object[] params, - long opnum) - { - throw new UnsupportedOperationException(); - } - - public RemoteCall newCall(RemoteObject obj, - Operation[] op, - int opnum, - long hash) - { - throw new UnsupportedOperationException(); - } - - public void invoke(RemoteCall call) { - throw new UnsupportedOperationException(); - } - - public void done(RemoteCall call) { - throw new UnsupportedOperationException(); - } - - public String getRefClass(java.io.ObjectOutput out) { - return refType; - } - - public int remoteHashCode() { return hashCode(); } - public boolean remoteEquals(RemoteRef obj) { return equals(obj); } - public String remoteToString() { return toString(); } - - public void readExternal(ObjectInput in) { - throw new UnsupportedOperationException(); - } - - public void writeExternal(ObjectOutput out) { - // no data to write - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/ActivateMe.java deleted file mode 100644 index 1f6f5529f0a..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/ActivateMe.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -// TEMPORARY HACK!!! to make interface public until MIS.resolveProxyClass is fixed. -public interface ActivateMe extends Remote { - public void ping(String responder) throws RemoteException; - public ActivateMe getUnicastVersion() throws RemoteException; - public void crash() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java deleted file mode 100644 index 526d142af71..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4095165 - * @bug 4140736 - * @summary synopsis: rmid should waitFor restartable objects that crash and restart them - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivateMe RestartCrashedService_Stub - * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Vector; -import java.util.Properties; - -public class RestartCrashedService - implements ActivateMe -{ - - private ActivationID id; - private static Object lock = new Object(); - private Vector responders = new Vector(); - - private static final String RESTARTABLE = "restartable"; - private static final String ACTIVATABLE = "activatable"; - - - public RestartCrashedService(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - ActivateMe obj; - String responder; - try { - Object[] stuff = (Object[]) mobj.get(); - responder = (String) stuff[0]; - System.err.println(responder + " service started"); - obj = (ActivateMe) stuff[1]; - } catch (Exception e) { - System.err.println("unable to obtain stub from marshalled object"); - return; - } - - obj.ping(responder); - } - - public RestartCrashedService() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - public void ping(String responder) { - System.err.println("RestartCrashedService: received ping from " + responder); - synchronized (lock) { - responders.add(responder); - lock.notify(); - } - } - - public boolean receivedPing(String responder) { - return responders.contains(responder); - } - - public void resetResponders() { - responders.clear(); - } - - public ActivateMe getUnicastVersion() throws RemoteException { - return new RestartCrashedService(); - } - - public void crash() { - System.exit(0); - } - - public ActivationID getID() { - return id; - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4095165, 4140736\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - RestartCrashedService unicastObj = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - final Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Create unicast object to be contacted when service is activated. - */ - unicastObj = new RestartCrashedService(); - /* - * Create and register descriptors for a restartable and - * non-restartable service (respectively) in a group other than - * this VM's group. - */ - System.err.println("Creating descriptors"); - - Object[] stuff = new Object[] { RESTARTABLE, unicastObj }; - MarshalledObject restartMobj = new MarshalledObject(stuff); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - - stuff[0] = ACTIVATABLE; - MarshalledObject activateMobj = new MarshalledObject(stuff); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - ActivationDesc restartableDesc = - new ActivationDesc(groupID, "RestartCrashedService", null, - restartMobj, true); - - ActivationDesc activatableDesc = - new ActivationDesc(groupID, "RestartCrashedService", null, - activateMobj, false); - - System.err.println("Registering descriptors"); - ActivateMe restartableObj = - (ActivateMe) Activatable.register(restartableDesc); - - ActivateMe activatableObj = - (ActivateMe) Activatable.register(activatableDesc); - - /* - * Restart rmid; it should start up the restartable service - */ - rmid.restart(); - - /* - * Wait for service to be automatically restarted. - */ - int repeat = 1; - - do { - - for (int i = 0; i < 15; i++) { - synchronized (lock) { - if (unicastObj.receivedPing(RESTARTABLE) != true) { - lock.wait(5000); - if (unicastObj.receivedPing(RESTARTABLE) == true) { - System.err.println("Test1 passed: rmid " + - "restarted service"); - break; - } - } else { - break; - } - } - } - - if (unicastObj.receivedPing(RESTARTABLE) != true) - TestLibrary.bomb("Test1 failed: service not restarted by timeout", - null); - - /* - * Make sure activatable services wasn't automatically - * restarted. - */ - synchronized (lock) { - if (unicastObj.receivedPing(ACTIVATABLE) != true) { - lock.wait(5000); - if (unicastObj.receivedPing(ACTIVATABLE) != true) { - System.err.println("Test2 passed: rmid did not " + - "restart activatable service"); - } else { - TestLibrary.bomb("Test2 failed: activatable service restarted", - null); - } - } else { - TestLibrary.bomb("Test2 failed: activatable service restarted!", - null); - } - } - - - if (repeat > 0) { - try { - System.err.println("\nCrash restartable object"); - unicastObj.resetResponders(); - restartableObj.crash(); - } catch (Exception e) { - } - } - - } while (repeat-- > 0); - - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - TestLibrary.unexport(unicastObj); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService_Stub.java b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService_Stub.java deleted file mode 100644 index 9e30d9a3f9b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService_Stub.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class RestartCrashedService_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void crash()"), - new java.rmi.server.Operation("ActivateMe getUnicastVersion()"), - new java.rmi.server.Operation("void ping(java.lang.String)") - }; - - private static final long interfaceHash = -5511576339806675599L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_crash_0; - private static java.lang.reflect.Method $method_getUnicastVersion_1; - private static java.lang.reflect.Method $method_ping_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_crash_0 = ActivateMe.class.getMethod("crash", new java.lang.Class[] {}); - $method_getUnicastVersion_1 = ActivateMe.class.getMethod("getUnicastVersion", new java.lang.Class[] {}); - $method_ping_2 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {java.lang.String.class}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public RestartCrashedService_Stub() { - super(); - } - public RestartCrashedService_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of crash() - public void crash() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_crash_0, null, 8484760490859430950L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of getUnicastVersion() - public ActivateMe getUnicastVersion() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getUnicastVersion_1, null, -4366214672304578894L); - return ((ActivateMe) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ActivateMe $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (ActivateMe) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of ping(String) - public void ping(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_2, new java.lang.Object[] {$param_String_1}, 8618968970901024056L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeObject($param_String_1); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/group.security.policy b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/rmid.security.policy deleted file mode 100644 index ce485f61343..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/security.policy b/test/jdk/java/rmi/activation/Activatable/restartCrashedService/security.policy deleted file mode 100644 index 0882def59ad..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartCrashedService/security.policy +++ /dev/null @@ -1,34 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java deleted file mode 100644 index 499ef6ce5d9..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4526514 - * @summary rmid does not handle group restart for latecomer objects - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * RestartLatecomer RestartLatecomer_Stub - * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Vector; -import java.util.Properties; - -public class RestartLatecomer - implements ActivateMe, Runnable -{ - - private ActivationID id; - private static Object lock = new Object(); - private Vector responders = new Vector(); - - private static final String RESTARTABLE = "restartable"; - private static final String ACTIVATABLE = "activatable"; - - - public RestartLatecomer(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - ActivateMe obj; - String responder; - try { - Object[] stuff = (Object[]) mobj.get(); - responder = (String) stuff[0]; - System.err.println(responder + " service started"); - obj = (ActivateMe) stuff[1]; - } catch (Exception e) { - System.err.println("unable to obtain stub from marshalled object"); - return; - } - - /* - * Call back object in the test VM to notify it that - * this object has been activated or restarted. - */ - obj.callback(responder); - } - - public RestartLatecomer() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - private void waitFor(String responder) throws Exception { - synchronized (lock) { - for (int i = 0; i < 15; i++) { - if (responders.contains(responder) != true) { - lock.wait(5000); - if (responders.contains(responder) == true) { - return; - } - } else { - return; - } - } - } - - throw new RuntimeException( - "TEST FAILED: service not restarted by timeout"); - } - - private void clearResponders() { - synchronized (lock) { - responders.clear(); - } - } - - - /** - * Notifies the receiver that the object denoted by "responder" - * has activated or restarted. - */ - public void callback(String responder) { - System.err.println( - "RestartLatecomer: received callback from " + responder); - /* - * Notify waiter that callback has been received and - * test can proceed. - */ - synchronized (lock) { - responders.add(responder); - lock.notifyAll(); - } - } - - /** - * Pings object (to activate it). - */ - public void ping() { - System.err.println("RestartLatecomer: recevied ping"); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() { - System.err.println("RestartLatecomer: received shutdown request"); - (new Thread(this,"RestartLatecomer")).start(); - } - - public ActivationID getID() { - return id; - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - System.exit(0); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4526514\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - RestartLatecomer callbackObj = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Create unicast object to be contacted when service is activated. - */ - callbackObj = new RestartLatecomer(); - /* - * Create and register descriptors for a restartable and - * non-restartable service (respectively) in a group other than - * this VM's group. - */ - System.err.println("Creating descriptors"); - - Object[] stuff = new Object[] { RESTARTABLE, callbackObj }; - MarshalledObject restartMobj = new MarshalledObject(stuff); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - - stuff[0] = ACTIVATABLE; - MarshalledObject activateMobj = new MarshalledObject(stuff); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - - ActivationDesc activatableDesc = - new ActivationDesc(groupID, "RestartLatecomer", null, - activateMobj, false); - ActivationDesc restartableDesc = - new ActivationDesc(groupID, "RestartLatecomer", null, - restartMobj, true); - - - System.err.println("Register activatable object's descriptor"); - ActivateMe activatableObj = - (ActivateMe) Activatable.register(activatableDesc); - - System.err.println("Activate object (starts group VM)"); - activatableObj.ping(); - - callbackObj.waitFor(ACTIVATABLE); - callbackObj.clearResponders(); - System.err.println("Callback from activatable object received"); - - System.err.println("Register restartable object's descriptor"); - ActivateMe restartableObj = - (ActivateMe) Activatable.register(restartableDesc); - - System.err.println("Shutdown object (exits group VM)"); - try { - activatableObj.shutdown(); - } catch (RemoteException ignore) { - /* - * Since the shutdown method spawns a thread to call - * System.exit, the group's VM may exit, closing all - * connections, before this call had returned. If that - * happens, then a RemoteException will be caught - * here. - */ - } - - System.err.println("Pause for shutdown to happen..."); - Thread.sleep(5000); - - /* - * Wait for "latecomer" restartable service to be - * automatically restarted. - */ - callbackObj.waitFor(RESTARTABLE); - System.err.println( - "TEST PASSED: rmid restarted latecomer service"); - - } catch (Exception e) { - TestLibrary.bomb(e); - } finally { - rmid.cleanup(); - TestLibrary.unexport(callbackObj); - } - } - - -} - - -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void callback(String responder) throws RemoteException; - public void shutdown() throws RemoteException; -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer_Stub.java b/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer_Stub.java deleted file mode 100644 index ba9c71f06db..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer_Stub.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class RestartLatecomer_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_callback_0; - private static java.lang.reflect.Method $method_ping_1; - private static java.lang.reflect.Method $method_shutdown_2; - - static { - try { - $method_callback_0 = ActivateMe.class.getMethod("callback", new java.lang.Class[] {java.lang.String.class}); - $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_2 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public RestartLatecomer_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of callback(String) - public void callback(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_callback_0, new java.lang.Object[] {$param_String_1}, -1016900954059279373L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_ping_1, null, 5866401369815527589L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/group.security.policy b/test/jdk/java/rmi/activation/Activatable/restartLatecomer/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/restartLatecomer/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/security.policy b/test/jdk/java/rmi/activation/Activatable/restartLatecomer/security.policy deleted file mode 100644 index b0aa6518e0f..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartLatecomer/security.policy +++ /dev/null @@ -1,39 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Used in remote impl of Activator.inactive; by the method - // "restartThread.dispose()"when it calls thread.interrupt() - permission java.lang.RuntimePermission "modifyThreadGroup"; - permission java.lang.RuntimePermission "modifyThread"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/ActivateMe.java b/test/jdk/java/rmi/activation/Activatable/restartService/ActivateMe.java deleted file mode 100644 index 06c6d1c5f82..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/ActivateMe.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -public interface ActivateMe extends Remote { - public void ping(String responder) throws RemoteException; -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/RestartService.java b/test/jdk/java/rmi/activation/Activatable/restartService/RestartService.java deleted file mode 100644 index 792c02f208c..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/RestartService.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4095165 4321151 - * @key intermittent - * @summary synopsis: activator should restart daemon services - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary ActivateMe RestartService_Stub - * @run main/othervm/policy=security.policy/timeout=240 RestartService - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Vector; -import java.util.Properties; - -public class RestartService - implements ActivateMe, Runnable -{ - - private ActivationID id; - private static Object lock = new Object(); - private Vector responders = new Vector(); - - private static final String RESTARTABLE = "restartable"; - private static final String ACTIVATABLE = "activatable"; - - - public RestartService(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - ActivateMe obj; - String responder; - try { - Object[] stuff = (Object[]) mobj.get(); - responder = (String) stuff[0]; - System.err.println(responder + " service started"); - obj = (ActivateMe) stuff[1]; - } catch (Exception e) { - System.err.println("unable to obtain stub from marshalled object"); - return; - } - - obj.ping(responder); - } - - public RestartService() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - public void ping(String responder) { - System.err.println("RestartService: received ping from " + responder); - synchronized (lock) { - responders.add(responder); - lock.notify(); - } - } - - public boolean receivedPing(String responder) { - return responders.contains(responder); - } - - public ActivateMe getUnicastVersion() throws RemoteException { - return new RestartService(); - } - - public ActivationID getID() { - return id; - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"RestartService")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4095165\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - RestartService unicastObj = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", ""); - - /* - * Create unicast object to be contacted when service is activated. - */ - unicastObj = new RestartService(); - /* - * Create and register descriptors for a restartable and - * non-restartable service (respectively) in a group other than - * this VM's group. - */ - System.err.println("Creating descriptors"); - - Object[] stuff = new Object[] { RESTARTABLE, unicastObj }; - MarshalledObject restartMobj = new MarshalledObject(stuff); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - - stuff[0] = ACTIVATABLE; - MarshalledObject activateMobj = new MarshalledObject(stuff); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - ActivationDesc restartableDesc = - new ActivationDesc(groupID, "RestartService", null, - restartMobj, true); - - ActivationDesc activatableDesc = - new ActivationDesc(groupID, "RestartService", null, - activateMobj, false); - - System.err.println("Registering descriptors"); - ActivateMe restartableObj = - (ActivateMe) Activatable.register(restartableDesc); - - ActivateMe activatableObj = - (ActivateMe) Activatable.register(activatableDesc); - - /* - * Restart rmid; it should start up the restartable service - */ - rmid.restart(); - - /* - * Wait for service to be automatically restarted. - */ - boolean gotPing = false; - for (int i = 0; i < 15; i++) { - synchronized (lock) { - if (unicastObj.receivedPing(RESTARTABLE) != true) { - lock.wait(5000); - if (unicastObj.receivedPing(RESTARTABLE) == true) { - System.err.println("Test1 passed: rmid restarted" + - " service"); - gotPing = true; - break; - } - } else { - gotPing = true; - break; - } - } - } - - if (gotPing == false) - TestLibrary.bomb("Test1 failed: service not restarted by timeout", null); - - /* - * Make sure activatable services wasn't automatically restarted. - */ - synchronized (lock) { - if (unicastObj.receivedPing(ACTIVATABLE) != true) { - lock.wait(5000); - if (unicastObj.receivedPing(ACTIVATABLE) != true) { - System.err.println("Test2 passed: rmid did not " + - "restart activatable service"); - return; - } - } - - TestLibrary.bomb("Test2 failed: activatable service restarted!", null); - } - - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - TestLibrary.unexport(unicastObj); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/RestartService_Stub.java b/test/jdk/java/rmi/activation/Activatable/restartService/RestartService_Stub.java deleted file mode 100644 index a58c603f2cd..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/RestartService_Stub.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class RestartService_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping(java.lang.String)") - }; - - private static final long interfaceHash = -3290104068898408724L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {java.lang.String.class}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public RestartService_Stub() { - super(); - } - public RestartService_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping(String) - public void ping(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, new java.lang.Object[] {$param_String_1}, 8618968970901024056L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeObject($param_String_1); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/group.security.policy b/test/jdk/java/rmi/activation/Activatable/restartService/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/restartService/rmid.security.policy deleted file mode 100644 index 3e6ac7893f0..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/restartService/security.policy b/test/jdk/java/rmi/activation/Activatable/restartService/security.policy deleted file mode 100644 index b0aa6518e0f..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/restartService/security.policy +++ /dev/null @@ -1,39 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Used in remote impl of Activator.inactive; by the method - // "restartThread.dispose()"when it calls thread.interrupt() - permission java.lang.RuntimePermission "modifyThreadGroup"; - permission java.lang.RuntimePermission "modifyThread"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java deleted file mode 100644 index c45d95674e6..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. - * 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 4183169 8032050 - * @summary Minor problem with the way ReliableLog handles IOExceptions. - * - * @author Laird Dornin; code borrowed from Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider - * TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub - * @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully - */ - -import java.rmi.activation.*; -import java.rmi.*; -import java.util.Properties; -import java.util.concurrent.TimeoutException; - -/** - * The test creates an rmid with a special security manager. After - * rmid makes two registrations (which is greater than rmid's - * snapshotInterval) the security manager stops allowing rmid to write - * to update and snapshot log files in rmid's log directory. The Test - * registers an Activatable object twice with different group ids. - * The second registration will cause rmid to have to write to a - * LogFile (it causes a snapshot) and the security manager will not - * allow the file write to happen. The test makes sure that rmid - * shuts down in a graceful manner without any explicit request to do - * so. The test will not exit for 400 seconds if rmid does not exit - * (after that time, the test will fail). - */ -public class ShutdownGracefully - extends Activatable implements RegisteringActivatable -{ - private static RegisteringActivatable registering = null; - - private final static long SHUTDOWN_TIMEOUT = 400 * 1000; - - public static void main(String args[]) { - - RMID rmid = null; - - // Save exception if there is a exception or expected behavior - Exception exception = null; - System.err.println("\nRegression test for bug/rfe 4183169\n"); - - try { - TestLibrary.suggestSecurityManager( - "java.rmi.RMISecurityManager"); - - // start an rmid. - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - - // rmid needs to run with a security manager that - // simulates a log problem; rmid should also snapshot - // quickly. - rmid.addOptions(new String[] { - "-Djava.security.manager=TestSecurityManager", - "-Dsun.rmi.activation.snapshotInterval=1"}); - - // rmid.addArguments(new String[] { - // "-C-Djava.rmi.server.logCalls=true"}); - - rmid.start(); - - // Ensure that activation groups run with the correct - // security manager. - // - Properties p = new Properties(); - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - "java.lang.SecurityManager"); - - System.err.println("activation group will be created " + - "in a new VM"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - - System.err.println("registering activatable"); - ActivationDesc desc = new ActivationDesc - (groupID, "ShutdownGracefully", null, null); - registering = (RegisteringActivatable) - Activatable.register(desc); - - System.err.println("activate and deactivate object " + - "via method call"); - registering.shutdown(); - - /* - * the security manager rmid is running with will stop - * rmid from writing to its log files; in 1.2.x this would - * have caused rmid to have thrown a runtime exception and - * continue running in an unstable state. With the fix - * for 4183169, rmid should shutdown gracefully instead. - */ - - /* - * register another activatable with a new group id; rmid - * should not recover from this... I use two - * registrations to more closely simulate the environment - * in which the bug was found. In java versions with out - * the appropriate bug fix, rmid would hide a - * NullPointerException in this circumstance. - */ - p.put("dummyname", "dummyvalue"); - groupDesc = new ActivationGroupDesc(p, null); - ActivationGroupID secondGroupID = - system.registerGroup(groupDesc); - desc = new ActivationDesc(secondGroupID, - "ShutdownGracefully", null, null); - - /* - * registration request is expected to be failed. succeeded case - * should be recorded. And raise error after clean up rmid. - */ - try { - registering = (RegisteringActivatable) - Activatable.register(desc); - System.err.println("The registration request succeeded unexpectedly"); - exception = new RuntimeException("The registration request succeeded unexpectedly"); - } catch (ActivationException e) { - System.err.println("received exception from registration " + - "call that should have failed..."); - // Need wait rmid process terminates. - try { - int exitCode = rmid.waitFor(SHUTDOWN_TIMEOUT); - System.err.println("RMID has exited gracefully with exitcode:" + exitCode); - rmid = null; - } catch (TimeoutException te) { - System.err.println("RMID process has not exited in given time"); - exception = te; - } - } - } catch (Exception e) { - System.err.println("Exception thrown:" + e); - exception = e; - } finally { - if (rmid != null) - rmid.cleanup(); - } - if (exception != null) - TestLibrary.bomb("\nexception thrown in test: ", exception); - } - - /** - * implementation of RegisteringActivatable - */ - public ShutdownGracefully - (ActivationID id, MarshalledObject mo) throws RemoteException - { - // register/export anonymously - super(id, 0); - } - - /** - * Deactivates the object. We need to unexport forcibly because this call - * in-progress on this object, which is the same object that we are trying - * to deactivate. - */ - public void shutdown() throws Exception { - Activatable.unexportObject(this, true); - ActivationLibrary.deactivate(this, getID()); - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully_Stub.java b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully_Stub.java deleted file mode 100644 index f04120d3030..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully_Stub.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ShutdownGracefully_Stub - extends java.rmi.server.RemoteStub - implements RegisteringActivatable, java.rmi.Remote -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_shutdown_0; - - static { - try { - $method_shutdown_0 = RegisteringActivatable.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public ShutdownGracefully_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - ref.invoke(this, $method_shutdown_0, null, -7207851917985848402L); - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/TestSecurityManager.java b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/TestSecurityManager.java deleted file mode 100644 index 4ac4b51c1ab..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/TestSecurityManager.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -/** - * - * - * Security manager which prevents RMID from writing to its logfile - * after it has written out a snapshot. - */ - -import java.io.File; - -public class TestSecurityManager extends SecurityManager { - public TestSecurityManager() { - } - public void checkWrite(String file) { - if (file.endsWith("log" + File.separatorChar + "Snapshot.6")) { - System.out.println("writing file: " + file + " simulating log failure"); - throw new SecurityException("simulating log failure"); - } - } - - public void checkRead(String file) { - if (file.endsWith("log" + File.separatorChar + "Logfile.6")) - { - System.out.println("reading file: " + file + " simulating log failure"); - throw new SecurityException("simulating log failure"); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/rmid.security.policy deleted file mode 100644 index 30b4e537750..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=java.lang.SecurityManager"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Ddummyname=dummyvalue"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/security.policy b/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/security.policy deleted file mode 100644 index b4418a72c3e..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/shutdownGracefully/security.policy +++ /dev/null @@ -1,31 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java deleted file mode 100644 index 2ff66718bf4..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 4115331 - * @summary synopsis: activatable object fails to go inactive after - * unregister/inactive sequence. - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary ActivateMe UnregisterInactive_Stub - * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.Properties; - -public class UnregisterInactive - extends Activatable - implements ActivateMe, Runnable -{ - - public UnregisterInactive(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - } - - public void ping() - {} - - public void unregister() throws Exception { - super.unregister(super.getID()); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"UnregisterInactive")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4115331\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - System.err.println("Creating descriptor"); - - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - - ActivationDesc desc = - new ActivationDesc("UnregisterInactive", null, null); - - System.err.println("Registering descriptor"); - ActivateMe obj = (ActivateMe) Activatable.register(desc); - - System.err.println("Activate object via method call"); - obj.ping(); - - System.err.println("Unregister object"); - obj.unregister(); - - System.err.println("Make object inactive"); - obj.shutdown(); - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive_Stub.java b/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive_Stub.java deleted file mode 100644 index 092ad4f4889..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive_Stub.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class UnregisterInactive_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()"), - new java.rmi.server.Operation("void unregister()") - }; - - private static final long interfaceHash = 4395146122524413703L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - private static java.lang.reflect.Method $method_unregister_2; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - $method_unregister_2 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public UnregisterInactive_Stub() { - super(); - } - public UnregisterInactive_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of unregister() - public void unregister() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_unregister_2, null, -5366864281862648102L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/group.security.policy b/test/jdk/java/rmi/activation/Activatable/unregisterInactive/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/rmid.security.policy b/test/jdk/java/rmi/activation/Activatable/unregisterInactive/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/security.policy b/test/jdk/java/rmi/activation/Activatable/unregisterInactive/security.policy deleted file mode 100644 index 63fecad764c..00000000000 --- a/test/jdk/java/rmi/activation/Activatable/unregisterInactive/security.policy +++ /dev/null @@ -1,34 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test rmid uses these properties to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // Needed to create an activation group - permission java.lang.RuntimePermission "setFactory"; - - // allow exporting of remote objects on an arbitrary port. - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java deleted file mode 100644 index b5787d05735..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4097135 - * @summary Need a specific subtype of RemoteException for activation failure. - * If activation fails to happen during a call to a remote object, - * then the call should end in an ActivateFailedException. In this - * test, the actual "activatable" remote object fails to activate - * since its * "activation" constructor throws an exception. - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary - * ActivateMe ActivateFails_Stub ShutdownThread - * @run main/othervm/java.security.policy=security.policy/timeout=240 ActivateFails - */ - -import java.rmi.*; -import java.rmi.server.*; -import java.rmi.activation.*; -import java.io.*; -import java.util.Properties; - -public class ActivateFails - extends Activatable - implements ActivateMe -{ - - public ActivateFails(ActivationID id, MarshalledObject obj) - throws ActivationException, RemoteException - { - super(id, 0); - - boolean refuseToActivate = false; - try { - refuseToActivate = ((Boolean)obj.get()).booleanValue(); - } catch (Exception impossible) { - } - - if (refuseToActivate) - throw new RemoteException("object refuses to activate"); - } - - public void ping() - {} - - /** - * Spawns a thread to deactivate the object. - */ - public ShutdownThread shutdown() throws Exception - { - ShutdownThread shutdownThread = new ShutdownThread(this, getID()); - shutdownThread.start(); - return(shutdownThread); - } - - public static void main(String[] args) - { - RMID rmid = null; - ActivateMe obj1, obj2; - ShutdownThread shutdownThread; - - System.err.println("\nRegression test for bug 4097135\n"); - try { - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - /* - * First run "rmid" and wait for it to start up. - */ - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - /* - * Create activation descriptor... - */ - System.err.println("creating activation descriptor..."); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - - ActivationDesc desc1 = - new ActivationDesc(groupID, "ActivateFails", - null, - new MarshalledObject(new Boolean(true))); - - ActivationDesc desc2 = - new ActivationDesc(groupID, "ActivateFails", - null, - new MarshalledObject(new Boolean(false))); - /* - * Register activation descriptor and make a call on - * the stub. Activation should fail with an - * ActivateFailedException. If not, report an - * error as a RuntimeException - */ - - System.err.println("registering activation descriptor..."); - obj1 = (ActivateMe)Activatable.register(desc1); - obj2 = (ActivateMe)Activatable.register(desc2); - - System.err.println("invoking method on activatable object..."); - try { - obj1.ping(); - throw new RuntimeException("ActivateFailedException is expected"); - } catch (ActivateFailedException e) { - - /* - * This is what is expected so exit with status 0 - */ - System.err.println("\nsuccess: ActivateFailedException " + - "generated"); - e.getMessage(); - } - - obj2.ping(); - shutdownThread = obj2.shutdown(); - - // wait for shutdown to work - Thread.sleep(2000); - - shutdownThread = null; - - } catch (Exception e) { - /* - * Test failed; unexpected exception generated. - */ - TestLibrary.bomb("\nfailure: unexpected exception " + - e.getClass().getName() + ": " + e.getMessage(), e); - - } finally { - obj1 = obj2 = null; - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails_Stub.java b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails_Stub.java deleted file mode 100644 index b0d2111b943..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails_Stub.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ActivateFails_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("ShutdownThread shutdown()") - }; - - private static final long interfaceHash = -6632667923281093978L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public ActivateFails_Stub() { - super(); - } - public ActivateFails_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public ShutdownThread shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_shutdown_1, null, -3616843253114182719L); - return ((ShutdownThread) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ShutdownThread $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (ShutdownThread) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateMe.java b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateMe.java deleted file mode 100644 index a778f379b3e..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public ShutdownThread shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/rmid.security.policy b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/rmid.security.policy deleted file mode 100644 index fd9ccf3da7b..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/rmid.security.policy +++ /dev/null @@ -1,8 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; -}; diff --git a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/security.policy b/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/security.policy deleted file mode 100644 index ef36478e900..00000000000 --- a/test/jdk/java/rmi/activation/ActivateFailedException/activateFails/security.policy +++ /dev/null @@ -1,34 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java deleted file mode 100644 index bfa12177eb0..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4510355 - * @summary ActivationGroup implementations cannot be downloaded by default; - * Creates a custom activation group without setting a security manager - * in activation group's descriptor. The custom activation group - * implementation should be downloaded when first object within that group - * is activated. - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider - * DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub - * @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup - */ - -import java.net.URL; -import java.rmi.MarshalledObject; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.Activatable; -import java.rmi.activation.ActivationDesc; -import java.rmi.activation.ActivationException; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationGroupDesc; -import java.rmi.activation.ActivationGroupDesc.CommandEnvironment; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationID; -import java.rmi.server.UnicastRemoteObject; -import java.util.Properties; - -public class DownloadActivationGroup - implements Ping, Runnable -{ - - private ActivationID id; - - public DownloadActivationGroup(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - System.err.println("object activated in group"); - } - - public DownloadActivationGroup() throws RemoteException { - UnicastRemoteObject.exportObject(this, 0); - } - - /** - * Used to activate object. - */ - public void ping() { - System.err.println("received ping"); - } - - /** - * Spawns a thread to deactivate the object (and thus, shuts down the - * activation group). - */ - public void shutdown() throws Exception - { - (new Thread(this,"DownloadActivationGroup")).start(); - } - - /** - * Thread to deactivate object. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public ActivationID getID() { - return id; - } - - - public static void main(String[] args) { - - RMID rmid = null; - - System.out.println("\nRegression test for bug 4510355\n"); - - try { - TestLibrary.suggestSecurityManager("java.lang.SecurityManager"); - - /* - * Install group class file in codebase. - */ - System.err.println("install class file in codebase"); - URL groupURL = TestLibrary.installClassInCodebase( - "MyActivationGroupImpl", "group"); - System.err.println("class file installed"); - - /* - * Start rmid. - */ - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none"; - rmid.addOptions(new String[] { execPolicyOption }); - rmid.start(); - - /* - * Create and register descriptors for custom group and an - * activatable object in that group. - */ - System.err.println("register group"); - - Properties p = new Properties(); - p.put("java.security.policy", TestParams.defaultGroupPolicy); - CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment( - null, - new String[] { - "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" }); - - ActivationGroupDesc groupDesc = - new ActivationGroupDesc("MyActivationGroupImpl", - groupURL.toExternalForm(), - null, p, cmd); - ActivationGroupID groupID = - ActivationGroup.getSystem().registerGroup(groupDesc); - - - System.err.println("register activatable object"); - ActivationDesc desc = - new ActivationDesc(groupID, "DownloadActivationGroup", - null, null); - Ping obj = (Ping) Activatable.register(desc); - - /* - * Start group (by calling ping). - */ - System.err.println( - "ping object (forces download of group's class)"); - obj.ping(); - System.err.println( - "TEST PASSED: group's class downloaded successfully"); - System.err.println("shutdown object"); - obj.shutdown(); - System.err.println("TEST PASSED"); - - } catch (Exception e) { - TestLibrary.bomb(e); - } finally { - rmid.cleanup(); - } - } -} - -interface Ping extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup_Stub.java b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup_Stub.java deleted file mode 100644 index ba7df5a52bc..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup_Stub.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class DownloadActivationGroup_Stub - extends java.rmi.server.RemoteStub - implements Ping -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_ping_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - $method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_1 = Ping.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public DownloadActivationGroup_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_ping_0, null, 5866401369815527589L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } -} diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/MyActivationGroupImpl.java b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/MyActivationGroupImpl.java deleted file mode 100644 index 2df6809a4aa..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/MyActivationGroupImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.*; -import sun.rmi.server.*; -import java.rmi.activation.*; - - -public class MyActivationGroupImpl extends ActivationGroupImpl { - - public MyActivationGroupImpl(ActivationGroupID id, MarshalledObject mobj) - throws RemoteException, ActivationException - { - super(id, mobj); - System.err.println("custom group implementation created"); - } -} diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy deleted file mode 100644 index b290738202a..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy +++ /dev/null @@ -1,11 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; - - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/rmid.security.policy b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/rmid.security.policy deleted file mode 100644 index f2c4f1dbfaa..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/rmid.security.policy +++ /dev/null @@ -1,7 +0,0 @@ -grant { - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/security.policy b/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/security.policy deleted file mode 100644 index 5c829579153..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroup/downloadActivationGroup/security.policy +++ /dev/null @@ -1,7 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - permission java.security.AllPermission; -}; diff --git a/test/jdk/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java b/test/jdk/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java deleted file mode 100644 index b329ea2e14b..00000000000 --- a/test/jdk/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4252236 - * @summary ActivationGroupDesc should not do early binding of default classname - * This test doesn't need to run with othervm option as all it does is - * create an ActivationGroupDesc instance, which has no side effects - * @author Laird Dornin - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * @build TestLibrary - * @run main CheckDefaultGroupName - */ - -import java.rmi.activation.*; - -/** - * Test checks the group name for an ActivationGroupDesc which is - * created with no explicit activation group implementation class name - * supplied. - */ -public class CheckDefaultGroupName { - public static void main(String[] args) { - System.out.println("\n\nRegression test for, 4252236\n\n"); - - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(null, null); - - String className = groupDesc.getClassName(); - if (className != null) { - TestLibrary.bomb("ActivationGroupDesc had incorrect default" + - " group implementation class name: " + className); - } else { - System.err.println("test passed, had correct default group" + - " implementation class name: " + className + - "\n\n"); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java deleted file mode 100644 index 9a316e7dac1..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4720528 - * @summary synopsis: (spec) ActivationSystem.activeGroup spec should be - * relaxed (duplicate call to activeGroup with same instantiator and - * incarnation should not throw ActivationException; it should succeed) - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider - * @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup - */ - -import java.rmi.MarshalledObject; -import java.rmi.NoSuchObjectException; -import java.rmi.RemoteException; -import java.rmi.activation.ActivationDesc; -import java.rmi.activation.ActivationException; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationGroupDesc; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationID; -import java.rmi.activation.ActivationInstantiator; -import java.rmi.activation.ActivationSystem; -import java.rmi.server.UnicastRemoteObject; - -public class IdempotentActiveGroup { - - public static void main(String[] args) { - - System.err.println("\nRegression test for bug 4720528\n"); - - TestLibrary.suggestSecurityManager("java.lang.SecurityManager"); - RMID rmid = null; - ActivationInstantiator inst1 = null; - ActivationInstantiator inst2 = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - System.err.println("Create group descriptor"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(null, null); - ActivationSystem system = ActivationGroup.getSystem(); - System.err.println("Register group descriptor"); - ActivationGroupID groupID = system.registerGroup(groupDesc); - inst1 = new FakeInstantiator(); - inst2 = new FakeInstantiator(); - - System.err.println("Invoke activeGroup with inst1"); - system.activeGroup(groupID, inst1, 0); - - try { - System.err.println("Invoke activeGroup with inst2"); - system.activeGroup(groupID, inst2, 0); - throw new RuntimeException( - "TEST FAILED: activeGroup with unequal groups succeeded!"); - } catch (ActivationException expected) { - System.err.println("Caught expected ActivationException"); - System.err.println("Test 1 (of 2) passed"); - } - - try { - System.err.println("Invoke activeGroup with inst1"); - system.activeGroup(groupID, inst1, 0); - System.err.println("activeGroup call succeeded"); - System.err.println("Test 2 (of 2) passed"); - } catch (ActivationException unexpected) { - throw new RuntimeException( - "TEST FAILED: activeGroup with equal groups failed!", - unexpected); - } - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - try { - if (inst1 != null) { - UnicastRemoteObject.unexportObject(inst1, true); - } - if (inst2 != null) { - UnicastRemoteObject.unexportObject(inst2, true); - } - } catch (NoSuchObjectException unexpected) { - throw new AssertionError(unexpected); - } - rmid.cleanup(); - } - } - - private static class FakeInstantiator - extends UnicastRemoteObject - implements ActivationInstantiator - { - FakeInstantiator() throws RemoteException {} - - public MarshalledObject newInstance(ActivationID id, - ActivationDesc desc) - { - throw new AssertionError(); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/rmid.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/rmid.security.policy deleted file mode 100644 index f2c4f1dbfaa..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/rmid.security.policy +++ /dev/null @@ -1,7 +0,0 @@ -grant { - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/security.policy b/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/security.policy deleted file mode 100644 index a6851ff680e..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/activeGroup/security.policy +++ /dev/null @@ -1,24 +0,0 @@ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ActivateMe.java b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ActivateMe.java deleted file mode 100644 index 4c7b2fff992..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ActivateMe.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.activation.ActivationID; -import java.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public String getMessage() throws RemoteException; - public String getProperty(String name) throws RemoteException; - public ActivationID getID() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java deleted file mode 100644 index 27bb48b60e8..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4127754 - * - * @summary synopsis: need to modify registered ActivationDesc and - * ActivationGroupDesc - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary - * ActivateMe ModifyDescriptor_Stub RMIDSelectorProvider - * @run main/othervm/policy=security.policy/timeout=240 ModifyDescriptor - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.rmi.registry.*; -import java.util.*; - -public class ModifyDescriptor - implements ActivateMe, Runnable -{ - - private ActivationID id; - private String message; - - private static final String MESSAGE1 = "hello"; - private static final String MESSAGE2 = "hello, again"; - - - public ModifyDescriptor(ActivationID id, MarshalledObject mobj) - throws ActivationException, RemoteException - { - this.id = id; - Activatable.exportObject(this, id, 0); - - try { - message = (String) mobj.get(); - } catch (Exception e) { - System.err.println("unable to get message from marshalled object"); - } - } - - public String getMessage() { - return message; - } - - public String getProperty(String name) { - return TestLibrary.getProperty(name, null); - } - - public ActivationID getID() { - return id; - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"ModifyDescriptor")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4127754\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* - * Create and register a group and activatable object - */ - - System.err.println("Creating group descriptor"); - Properties props = new Properties(); - props.put("java.security.policy", - TestParams.defaultGroupPolicy); - props.put("java.security.manager", - TestParams.defaultSecurityManager); - props.put("test.message", MESSAGE1); - ActivationGroupDesc initialGroupDesc = - new ActivationGroupDesc(props, null); - System.err.println("Registering group"); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(initialGroupDesc); - - System.err.println("Creating descriptor"); - ActivationDesc initialDesc = - new ActivationDesc(groupID, "ModifyDescriptor", null, - new MarshalledObject(MESSAGE1), false); - - System.err.println("Registering descriptor"); - ActivateMe obj = (ActivateMe) Activatable.register(initialDesc); - - /* - * Ping object and verify that MarshalledObject is okay. - */ - System.err.println("Ping object"); - String message1 = obj.getMessage(); - System.err.println("message = " + message1); - - if (message1.equals(MESSAGE1)) { - System.err.println("Test1a passed: initial MarshalledObject " + - "correct"); - } else { - TestLibrary.bomb("Test1 failed: unexpected MarshalledObject passed to " + - "constructor", null); - } - - /* - * Get property from remote group and make sure it's okay - */ - message1 = obj.getProperty("test.message"); - if (message1.equals(MESSAGE1)) { - System.err.println("Test1b passed: initial group property " + - "correct"); - } else { - TestLibrary.bomb("Test1 failed: unexpected property passed to " + - "group", null); - } - - /* - * Update activation descriptor for object and group - */ - System.err.println("Update activation descriptor"); - ActivationDesc newDesc = - new ActivationDesc(groupID, "ModifyDescriptor", null, - new MarshalledObject(MESSAGE2), false); - ActivationID id = obj.getID(); - ActivationDesc oldDesc = system.setActivationDesc(id, newDesc); - - if (oldDesc.equals(initialDesc)) { - System.err.println("Test2a passed: desc returned from " + - "setActivationDesc is okay"); - } else { - TestLibrary.bomb("Test2a failed: desc returned from setActivationDesc " + - "is not the initial descriptor!", null); - } - - - Properties props2 = new Properties(); - props2.put("test.message", MESSAGE2); - props2.put("java.security.policy", - TestParams.defaultGroupPolicy); - props2.put("java.security.manager", - TestParams.defaultSecurityManager); - ActivationGroupDesc newGroupDesc = - new ActivationGroupDesc(props2, null); - - ActivationGroupDesc oldGroupDesc = - system.setActivationGroupDesc(groupID, newGroupDesc); - - if (oldGroupDesc.equals(initialGroupDesc)) { - System.err.println("Test2b passed: group desc returned from " + - "setActivationGroupDesc is okay"); - } else { - TestLibrary.bomb("Test2b failed: group desc returned from " + - "setActivationGroupDesc is not the initial descriptor!", - null); - } - - /* - * Restart rmid; and ping object to make sure that it has - * new message. - */ - rmid.restart(); - - System.err.println("Ping object after restart"); - String message2 = obj.getMessage(); - - if (message2.equals(MESSAGE2)) { - System.err.println("Test3a passed: setActivationDesc takes " + - "effect after a restart"); - } else { - TestLibrary.bomb("Test3a failed: setActivationDesc did not take effect " + - "after a restart", null); - } - - message2 = obj.getProperty("test.message"); - - if (message2.equals(MESSAGE2)) { - System.err.println("Test3b passed: setActivationGroupDesc " + - "takes effect after a restart"); - } else { - TestLibrary.bomb("Test3b failed: setActivationGroupDesc did not take " + - "effect after a restart", null); - } - - System.err.println("Get activation descriptor"); - ActivationDesc latestDesc = system.getActivationDesc(id); - - if (latestDesc.equals(newDesc)) { - System.err.println("Test4a passed: desc is same as latest"); - } else { - TestLibrary.bomb("Test4a failed: there is no way this would happen", null); - } - - System.err.println("Get activation group descriptor"); - ActivationGroupDesc latestGroupDesc = - system.getActivationGroupDesc(groupID); - - if (latestGroupDesc.equals(newGroupDesc)) { - System.err.println("Test4b passed: group desc is same as " + - "latest"); - } else { - TestLibrary.bomb("Test4b failed: there is no way this would happen", null); - } - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor_Stub.java b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor_Stub.java deleted file mode 100644 index d060da1824b..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor_Stub.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class ModifyDescriptor_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("java.rmi.activation.ActivationID getID()"), - new java.rmi.server.Operation("java.lang.String getMessage()"), - new java.rmi.server.Operation("java.lang.String getProperty(java.lang.String)"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = 7998207954486691383L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_getID_0; - private static java.lang.reflect.Method $method_getMessage_1; - private static java.lang.reflect.Method $method_getProperty_2; - private static java.lang.reflect.Method $method_shutdown_3; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_getID_0 = ActivateMe.class.getMethod("getID", new java.lang.Class[] {}); - $method_getMessage_1 = ActivateMe.class.getMethod("getMessage", new java.lang.Class[] {}); - $method_getProperty_2 = ActivateMe.class.getMethod("getProperty", new java.lang.Class[] {java.lang.String.class}); - $method_shutdown_3 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public ModifyDescriptor_Stub() { - super(); - } - public ModifyDescriptor_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of getID() - public java.rmi.activation.ActivationID getID() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getID_0, null, -7795865521150345044L); - return ((java.rmi.activation.ActivationID) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - java.rmi.activation.ActivationID $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.rmi.activation.ActivationID) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of getMessage() - public java.lang.String getMessage() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getMessage_1, null, 5353407034680111516L); - return ((java.lang.String) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - java.lang.String $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.lang.String) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of getProperty(String) - public java.lang.String getProperty(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getProperty_2, new java.lang.Object[] {$param_String_1}, 77249282285080913L); - return ((java.lang.String) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - try { - java.io.ObjectOutput out = call.getOutputStream(); - out.writeObject($param_String_1); - } catch (java.io.IOException e) { - throw new java.rmi.MarshalException("error marshalling arguments", e); - } - ref.invoke(call); - java.lang.String $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.lang.String) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/rmid.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/rmid.security.policy deleted file mode 100644 index a352c07a92b..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/rmid.security.policy +++ /dev/null @@ -1,11 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Dtest.message=hello"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Dtest.message=hello, again"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/security.policy b/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/security.policy deleted file mode 100644 index 572e29ce309..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/modifyDescriptor/security.policy +++ /dev/null @@ -1,31 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/CanCreateStubs.java b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/CanCreateStubs.java deleted file mode 100644 index 5b041fa83d1..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/CanCreateStubs.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.activation.ActivationGroupID; -import java.rmi.registry.Registry; -import java.rmi.Remote; -import java.rmi.RemoteException; -interface CanCreateStubs extends java.rmi.Remote { - Registry getRegistry() throws RemoteException; - void shutdown() throws Exception; - Object getForbiddenClass() throws Exception; - ActivationGroupID returnGroupID() throws RemoteException; -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java deleted file mode 100644 index 43318ce0eb0..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4179055 - * @summary Some java apps need to have access to read "accessClassInPackage.sun.rmi.server" - * @author Laird Dornin - * - * @library ../../../testlibrary - * @modules java.base/sun.security.provider - * java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider - * CanCreateStubs StubClassesPermitted_Stub - * @run main/othervm/java.security.policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted - */ - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.rmi.MarshalledObject; -import java.rmi.RemoteException; -import java.rmi.activation.Activatable; -import java.rmi.activation.ActivationDesc; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationGroupDesc; -import java.rmi.activation.ActivationGroupDesc.CommandEnvironment; -import java.rmi.activation.ActivationGroupID; -import java.rmi.activation.ActivationID; -import java.rmi.activation.ActivationSystem; -import java.rmi.registry.Registry; -import java.util.Properties; - -/** - * The RMI activation system needs to explicitly allow itself to - * create the following sun.* classes on behalf of code that runs with - * user privileges and needs to make use of RMI activation: - * - * sun.rmi.server.Activation$ActivationMonitorImpl_Stub - * sun.rmi.server.Activation$ActivationSystemImpl_Stub - * sun.rmi.registry.RegistryImpl_Stub - * - * The test causes the activation system to need to create each of - * these classes in turn. The test will fail if the activation system - * does not allow these classes to be created. - */ -public class StubClassesPermitted - extends Activatable implements Runnable, CanCreateStubs -{ - public static boolean sameGroup = false; - private static int registryPort = -1; - private static CanCreateStubs canCreateStubs = null; - private static Registry registry = null; - - public static void main(String args[]) { - - sameGroup = true; - - RMID rmid = null; - - System.err.println("\nRegression test for bug/rfe 4179055\n"); - - try { - TestLibrary.suggestSecurityManager("java.lang.SecurityManager"); - - registry = TestLibrary.createRegistryOnEphemeralPort(); - registryPort = TestLibrary.getRegistryPort(registry); - - // must run with java.lang.SecurityManager or the test - // result will be nullified if running with a build where - // 4180392 has not been fixed. - String smClassName = - System.getSecurityManager().getClass().getName(); - if (!smClassName.equals("java.lang.SecurityManager")) { - TestLibrary.bomb("Test must run with java.lang.SecurityManager"); - } - - // start an rmid. - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"}); - - // Ensure that activation groups run with the correct - // security manager. - // - Properties p = new Properties(); - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - "java.lang.SecurityManager"); - - // This action causes the following classes to be created - // in this VM (RMI must permit the creation of these classes): - // - // sun.rmi.server.Activation$ActivationSystemImpl_Stub - // sun.rmi.server.Activation$ActivationMonitorImpl_Stub - // - System.err.println("Create activation group, in a new VM"); - CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(null, - new String[] { - "--add-exports=java.base/sun.security.provider=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED", - "--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" }); - - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, cmd); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - - System.err.println("register activatable"); - // Fix for: 4271615: make sure activation group runs in a new VM - ActivationDesc desc = new ActivationDesc - (groupID, "StubClassesPermitted", null, null); - canCreateStubs = (CanCreateStubs) Activatable.register(desc); - - // ensure registry stub can be passed in a remote call - System.err.println("getting the registry"); - registry = canCreateStubs.getRegistry(); - - // make sure a client cant load just any sun.* class, just - // as a sanity check, try to create a class we are not - // allowed to access but which was passed in a remote call - try { - System.err.println("accessing forbidden class"); - Object secureRandom = canCreateStubs.getForbiddenClass(); - - TestLibrary.bomb("test allowed to access forbidden class," + - " sun.security.provider.SecureRandom"); - } catch (java.security.AccessControlException e) { - - // Make sure we received a *local* AccessControlException - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(bout); - e.printStackTrace(ps); - ps.flush(); - String trace = new String(bout.toByteArray()); - if ((trace.indexOf("exceptionReceivedFromServer") >= 0) || - trace.equals("")) - { - throw e; - } - System.err.println("received expected local access control exception"); - } - - // make sure that an ActivationGroupID can be passed in a - // remote call; this is slightly more inclusive than - // just passing a reference to the activation system - System.err.println("returning group desc"); - canCreateStubs.returnGroupID(); - - // Clean up object - System.err.println - ("Deactivate object via method call"); - canCreateStubs.shutdown(); - - System.err.println - ("\nsuccess: StubClassesPermitted test passed "); - - } catch (Exception e) { - TestLibrary.bomb("\nfailure: unexpected exception ", e); - } finally { - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - } - - canCreateStubs = null; - rmid.cleanup(); - System.err.println("rmid shut down"); - } - } - - static ActivationGroupID GroupID = null; - - /** - * implementation of CanCreateStubs - */ - public StubClassesPermitted - (ActivationID id, MarshalledObject mo) throws RemoteException - { - // register/export anonymously - super(id, 0); - - // obtain reference to the test registry - registry = java.rmi.registry.LocateRegistry. - getRegistry(registryPort); - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception { - (new Thread(this,"StubClassesPermitted")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() { - ActivationLibrary.deactivate(this, getID()); - } - - /** - * Return a reference to the RMI registry, to make sure that - * the stub for it can be deserialized in the test client VM. - */ - public Registry getRegistry() throws RemoteException { - if (sameGroup) { - System.out.println("in same group"); - } else { - System.out.println("not in same group"); - } - return registry; - } - - /** - * Remote call to create and return a random serializable sun.* - * class, the test should get a local security exception when - * trying to create the class. Ensure that not all sun.* classes - * can be resolved in a remote call. - */ - public Object getForbiddenClass() throws RemoteException { - System.err.println("creating sun class"); - return new sun.security.provider.SecureRandom(); - } - - /** - * Ensures that an activation group id can be passed in a remote - * call (class may contain a remote reference to the activation - * system implementation). - */ - public ActivationGroupID returnGroupID() throws RemoteException { - return ActivationGroup.currentGroupID(); - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted_Stub.java b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted_Stub.java deleted file mode 100644 index b1b4f9bafc2..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted_Stub.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class StubClassesPermitted_Stub - extends java.rmi.server.RemoteStub - implements CanCreateStubs, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("java.lang.Object getForbiddenClass()"), - new java.rmi.server.Operation("java.rmi.registry.Registry getRegistry()"), - new java.rmi.server.Operation("java.rmi.activation.ActivationGroupID returnGroupID()"), - new java.rmi.server.Operation("void shutdown()") - }; - - private static final long interfaceHash = 1677779850431817575L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_getForbiddenClass_0; - private static java.lang.reflect.Method $method_getRegistry_1; - private static java.lang.reflect.Method $method_returnGroupID_2; - private static java.lang.reflect.Method $method_shutdown_3; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_getForbiddenClass_0 = CanCreateStubs.class.getMethod("getForbiddenClass", new java.lang.Class[] {}); - $method_getRegistry_1 = CanCreateStubs.class.getMethod("getRegistry", new java.lang.Class[] {}); - $method_returnGroupID_2 = CanCreateStubs.class.getMethod("returnGroupID", new java.lang.Class[] {}); - $method_shutdown_3 = CanCreateStubs.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public StubClassesPermitted_Stub() { - super(); - } - public StubClassesPermitted_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of getForbiddenClass() - public java.lang.Object getForbiddenClass() - throws java.lang.Exception - { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getForbiddenClass_0, null, -658265783646674294L); - return ((java.lang.Object) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - java.lang.Object $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.lang.Object) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } - - // implementation of getRegistry() - public java.rmi.registry.Registry getRegistry() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getRegistry_1, null, 255311215504696981L); - return ((java.rmi.registry.Registry) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - java.rmi.registry.Registry $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.rmi.registry.Registry) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of returnGroupID() - public java.rmi.activation.ActivationGroupID returnGroupID() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_returnGroupID_2, null, 6267304638191237098L); - return ((java.rmi.activation.ActivationGroupID) $result); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - java.rmi.activation.ActivationGroupID $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = (java.rmi.activation.ActivationGroupID) in.readObject(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } catch (java.lang.ClassNotFoundException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy deleted file mode 100644 index c99d2e288a2..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy +++ /dev/null @@ -1,11 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; - - permission java.lang.RuntimePermission "accessClassInPackage.sun.security.provider"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/rmid.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/rmid.security.policy deleted file mode 100644 index 640fb78d7bd..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/rmid.security.policy +++ /dev/null @@ -1,12 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=java.lang.SecurityManager"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - - // test needs to export a set of internal APIs to access them from unamed module - permission com.sun.rmi.rmid.ExecOptionPermission "*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/security.policy b/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/security.policy deleted file mode 100644 index 9287c5130c9..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/stubClassesPermitted/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // required for test to get the registry port - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java b/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java deleted file mode 100644 index c0230a97226..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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.rmi.Remote; -import java.rmi.RemoteException; -interface ActivateMe extends Remote { - public void ping() throws RemoteException; - public void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java deleted file mode 100644 index fcd21614e6e..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4134233 - * @bug 4213186 - * @summary synopsis: ActivationSystem.unregisterGroup should unregister objects in group - * @author Ann Wollrath - * - * @library ../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary ActivateMe RMIDSelectorProvider - * @run main/othervm/policy=security.policy UnregisterGroup - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.util.Properties; - -public class UnregisterGroup extends Activatable implements ActivateMe -{ - private static volatile Exception exception = null; - private static volatile String error = null; - private static volatile boolean done = false; - private static final int NUM_OBJECTS = 10; - - public UnregisterGroup(ActivationID id, MarshalledObject mobj) - throws Exception - { - super(id, 0); - } - - /** - * Does nothing, but serves to activate this object. - */ - public void ping() { } - - /** - * Deactivates the object. We need to unexport forcibly because - * this call is in-progress on this object, which is the same object - * that we are trying to deactivate. - */ - public void shutdown() throws Exception { - Activatable.unexportObject(this, true); - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) throws RemoteException { - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - RMID rmid = null; - - try { - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.start(); - - /* Cause activation groups to have a security policy that will - * allow security managers to be downloaded and installed - */ - final Properties p = new Properties(); - // this test must always set policies/managers in its - // activation groups - p.put("java.security.policy", TestParams.defaultGroupPolicy); - p.put("java.security.manager", TestParams.defaultSecurityManager); - - Thread t = new Thread() { - public void run () { - try { - System.err.println("Creating group descriptor"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(p, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = - system.registerGroup(groupDesc); - - ActivateMe[] obj = new ActivateMe[NUM_OBJECTS]; - - for (int i = 0; i < NUM_OBJECTS; i++) { - System.err.println("Creating descriptor: " + i); - ActivationDesc desc = - new ActivationDesc(groupID, "UnregisterGroup", - null, null); - System.err.println("Registering descriptor: " + i); - obj[i] = (ActivateMe) Activatable.register(desc); - System.err.println("Activating object: " + i); - obj[i].ping(); - } - - System.err.println("Unregistering group"); - system.unregisterGroup(groupID); - - try { - System.err.println("Get the group descriptor"); - system.getActivationGroupDesc(groupID); - error = "test failed: group still registered"; - } catch (UnknownGroupException e) { - System.err.println("Test passed: " + - "group unregistered"); - } - - /* - * Deactivate objects so group VM will exit. - */ - for (int i = 0; i < NUM_OBJECTS; i++) { - System.err.println("Deactivating object: " + i); - obj[i].shutdown(); - obj[i] = null; - } - System.err.println("Successfully deactivated all objects."); - - } catch (Exception e) { - exception = e; - } - - done = true; - } - }; - - t.start(); - - // Default jtreg timeout is two minutes. - // Timeout ourselves after one minute so that - // we can clean up. - t.join(60000); - - if (exception != null) { - TestLibrary.bomb("test failed", exception); - } else if (error != null) { - TestLibrary.bomb(error, null); - } else if (!done) { - TestLibrary.bomb("test failed: not completed before timeout", null); - } else { - System.err.println("Test passed"); - } - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - } finally { - rmid.cleanup(); - } - } -} diff --git a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/rmid.security.policy b/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/rmid.security.policy deleted file mode 100644 index ce485f61343..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/rmid.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy b/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy deleted file mode 100644 index 4fc5934ff33..00000000000 --- a/test/jdk/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - - // required for test to get the registry port - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; -}; diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/Doctor.java b/test/jdk/java/rmi/activation/CommandEnvironment/Doctor.java deleted file mode 100644 index 77f9495cb4e..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/Doctor.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.*; -import java.rmi.activation.*; - -public class Doctor - extends Activatable - implements Eliza, Retireable -{ - // reanimation constructor - public Doctor(ActivationID id, MarshalledObject blah) - throws RemoteException - { - super(id, 0); // export self on port 0 (== assign randomly) - System.out.println("Doctor constructed and exported"); - } - - private boolean asked = false; - - // implement Eliza.complain() - public String complain(String plaint) - { - System.out.println("Doctor will see you now"); - if (this.asked) { - return ("DO GO ON?"); - } else { - this.asked = true; - return ("TELL ME ABOUT YOUR MOTHER"); - } - } - - // implement Retireable.retire() - public void retire() - { - System.out.println("Doctor retiring"); - try { - Activatable.inactive(this.getID()); - ActivationGroup.getSystem().unregisterObject(this.getID()); - (new HaraKiri()).start(); - - } catch (UnknownObjectException uoe) { - System.err.println("Exception in Activatable.inactive:"); - uoe.printStackTrace(); - - } catch (ActivationException ae) { - System.err.println("Exception in Activatable.inactive:"); - ae.printStackTrace(); - - } catch (RemoteException re) { - System.err.println("Exception in Activatable.inactive:"); - re.printStackTrace(); - } - } - - private static class HaraKiri extends Thread - { - public HaraKiri() { - super("Thread-of-Death"); - } - - public void run() - { - try { - Thread.sleep(5000); - } catch (Exception foo) { - } - System.exit(0); - } - } -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/Doctor_Stub.java b/test/jdk/java/rmi/activation/CommandEnvironment/Doctor_Stub.java deleted file mode 100644 index 63b7134dd6d..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/Doctor_Stub.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class Doctor_Stub - extends java.rmi.server.RemoteStub - implements Eliza, Retireable, java.rmi.Remote -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_complain_0; - private static java.lang.reflect.Method $method_retire_1; - - static { - try { - $method_complain_0 = Eliza.class.getMethod("complain", new java.lang.Class[] {java.lang.String.class}); - $method_retire_1 = Retireable.class.getMethod("retire", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public Doctor_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of complain(String) - public java.lang.String complain(java.lang.String $param_String_1) - throws java.rmi.RemoteException - { - try { - Object $result = ref.invoke(this, $method_complain_0, new java.lang.Object[] {$param_String_1}, -6341882871094951445L); - return ((java.lang.String) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of retire() - public void retire() - throws java.rmi.RemoteException - { - try { - ref.invoke(this, $method_retire_1, null, 1748571935738034018L); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/Eliza.java b/test/jdk/java/rmi/activation/CommandEnvironment/Eliza.java deleted file mode 100644 index baa3ca11db5..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/Eliza.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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 interface Eliza - extends java.rmi.Remote -{ - public String complain(String plaint) - throws java.rmi.RemoteException; -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/NullOptions.java b/test/jdk/java/rmi/activation/CommandEnvironment/NullOptions.java deleted file mode 100644 index b15ce40c9c3..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/NullOptions.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test - * @bug 6236643 - * @summary null doesn't have the same effect as empty list for - * ActivationGroupDesc.CommandEnvironment - * @author Ann Wollrath - * - * @run main/othervm/timeout=240 NullOptions - */ - -import java.rmi.activation.ActivationGroupDesc.CommandEnvironment; - -public class NullOptions { - - public static void main(String[] args) throws Exception { - - CommandEnvironment env1 = - new CommandEnvironment(null, null); - CommandEnvironment env2 = - new CommandEnvironment(null, new String[0]); - - if (env1.equals(env2)) { - System.err.println("TEST PASSED: environments are equal"); - } else { - System.err.println("TEST FAILED: environments not equal!"); - throw new RuntimeException("TEST FAILED"); - } - } -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/Retireable.java b/test/jdk/java/rmi/activation/CommandEnvironment/Retireable.java deleted file mode 100644 index 56bde68bc06..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/Retireable.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * 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 interface Retireable - extends java.rmi.Remote -{ - public void retire() - throws java.rmi.RemoteException; -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java deleted file mode 100644 index 1b7b8f6a7f5..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/SetChildEnv.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 1998, 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 - * 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 4105043 - * @summary cannot set java.rmi.server.hostname on children of rmid in time - * - * @bug 4097357 - * @summary activation group should not overwrite system properties - * - * @bug 4107184 - * @summary activation groups should be able to control their JVM properties - * - * @author Adrian Colley - * - * @library ../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary RMID ActivationLibrary RMIDSelectorProvider - * Eliza Retireable Doctor Doctor_Stub - * @run main/othervm/timeout=240/policy=security.policy SetChildEnv 0 0 - * @run main/othervm/timeout=240/policy=security.policy SetChildEnv 1 -verbosegc - * 2 foo.bar=SetChildEnvTest sun.rmi.server.doSomething=true - * @run main/othervm/timeout=240/policy=security.policy SetChildEnv 0 1 parameter.count=zero - * @run main/othervm/timeout=240/policy=security.policy SetChildEnv 1 -Xmx32m 0 - */ -import java.rmi.*; -import java.util.Properties; -import java.io.*; -import java.util.StringTokenizer; -import java.util.Set; -import java.util.HashSet; -import java.util.Arrays; -import java.rmi.activation.*; - -public class SetChildEnv -{ - public static void main(String argv[]) throws Exception { - RMID rmid = null; - try { - System.out.println("java.compiler=" + System.getProperty("java.compiler")); - int paramCount = Integer.valueOf(argv[0]); - String[] params = paramCount == 0 ? - new String[0] : Arrays.copyOfRange(argv, 1, paramCount+1); - int propCount = Integer.valueOf(argv[paramCount+1]); - String[] props = propCount == 0 ? - new String[0] : - Arrays.copyOfRange(argv, paramCount+2, paramCount+propCount+2); - - TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager); - - // make a "watcher" which listens on a pipe and searches for - // the debugExec line while teeing to System.err - DebugExecWatcher watcher = DebugExecWatcher.makeWithPipe(); - - RMID.removeLog(); - rmid = RMID.createRMIDOnEphemeralPort(watcher.otherEnd(), - watcher.otherEnd(), true); - - rmid.start(); - - // compile props - Properties p = new Properties(); - p.put("java.security.policy", TestParams.defaultGroupPolicy); - p.put("java.security.manager", TestParams.defaultSecurityManager); - //p.put("java.rmi.server.logCalls", "true"); - int i; - for (i = 0; i < props.length; i++) { - p.put(props[i].substring(0, props[i].indexOf('=')), - props[i].substring(props[i].indexOf('=')+1)); - } - - // create CommandEnvironment and ActivationGroupDesc - ActivationGroupDesc.CommandEnvironment cmdenv = - new ActivationGroupDesc.CommandEnvironment( - null, - params); - - ActivationGroupDesc gdesc = new ActivationGroupDesc( - p, cmdenv); - - // register group - ActivationSystem actsys = ActivationGroup.getSystem(); - ActivationGroupID gid = actsys.registerGroup(gdesc); - - // create ActivationDesc - ActivationDesc odesc = new ActivationDesc(gid, // group - "Doctor", // class - null, // codesource - null); // closure data - - // register activatable object - Eliza doctor = (Eliza)Activatable.register(odesc); - - // invoke a call with oh-so-humorous sample text - System.out.println ("Invoking complain()..."); - String complaint = - "HELP ME, DOCTOR. I FEEL VIOLENT TOWARDS PEOPLE " + - "WHO INQUIRE ABOUT MY PARENTS."; - - System.out.println(complaint); - String res = doctor.complain(complaint); - System.out.println (" => " + res); - - // Get debugExec line, allowing 15 seconds for it to flush - // through the buffers and pipes. - String found = watcher.found; - if (found == null) { - int fudge = 15; - while (found == null && --fudge > 0) { - Thread.sleep(1000); - found = watcher.found; - } - if (found == null) { - TestLibrary.bomb("rmid subprocess produced no " + - "recognizable debugExec line"); - } - } - - System.err.println("debugExec found: <<" + found + ">>"); - // q: first double-quote after debugExec - int q = found.indexOf('"', found.indexOf("rmid: debugExec")); - // qe: last double-quote on debugExec line - int qe = found.lastIndexOf('"'); - if (q <= 1 || qe <= q) { - TestLibrary.bomb("rmid subprocess produced " + - "mangled debugExec line"); - } - - // split args by whitespace - StringTokenizer tk = new StringTokenizer(found.substring(q+1, qe)); - tk.nextToken(); // skip command path/name - - // Now check off the requested args. Order isn't important, and - // any extra args are ignored, even if they're inconsistent or - // bargage, or duplicates. - - Set argset = new HashSet(tk.countTokens()); - while (tk.hasMoreTokens()) { - argset.add(tk.nextToken()); - } - - int m; - for (m = 0; m < params.length; m++) { - if(!argset.contains(params[m])) - TestLibrary.bomb("Parameter \"" + params[m] + "\" not set"); - } - - for (m = 0; m < props.length; m++) { - if (!argset.contains("-D" + props[m])) { - TestLibrary.bomb("Property binding \"" + props[m] + - "\" not set"); - } - } - - // End doctor - if (doctor instanceof Retireable) - ((Retireable)doctor).retire(); - actsys.unregisterGroup(gid); - } finally { - Thread.sleep(5000); - if (rmid != null) { - rmid.cleanup(); - } - } - } - - public static class DebugExecWatcher - extends Thread - { - public String found; - private BufferedReader str; - private OutputStream otherEnd; - - private DebugExecWatcher(InputStream readStream, OutputStream wrStream) - { - super("DebugExecWatcher"); - found = null; - str = new BufferedReader(new InputStreamReader(readStream)); - otherEnd = wrStream; - } - - static public DebugExecWatcher makeWithPipe() - throws IOException - { - PipedOutputStream wr = new PipedOutputStream(); - PipedInputStream rd = new PipedInputStream(wr); - DebugExecWatcher embryo = new DebugExecWatcher(rd, wr); - embryo.start(); - return embryo; - } - - public OutputStream otherEnd() - { - return otherEnd; - } - - public synchronized void notifyLine(String s) - { - if (s != null && s.indexOf("rmid: debugExec") != -1) - found = s; - } - - public void run() - { - try { - String line; - while ((line = str.readLine()) != null) { - this.notifyLine(line); - System.err.println(line); - } - } catch (IOException e) { - /* During termination of distant rmid, StreamPipes will be broken when - * distant vm terminates. A "Pipe broken" exception is expected because - * DebugExecWatcher points to the same streams as StreamPipes used by RMID. - * If we get this exception. We just terminate the thread. - */ - if (e.getMessage().equals("Pipe broken")) { - try { - str.close(); - } catch (IOException ioe) {} - } - else { - e.printStackTrace(); - } - } - } - } -} diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/group.security.policy b/test/jdk/java/rmi/activation/CommandEnvironment/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/rmid.security.policy b/test/jdk/java/rmi/activation/CommandEnvironment/rmid.security.policy deleted file mode 100644 index 1f861467197..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/rmid.security.policy +++ /dev/null @@ -1,14 +0,0 @@ -grant { - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Dsun.rmi.server.doSomething=true"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Dfoo.bar=SetChildEnvTest"; - permission com.sun.rmi.rmid.ExecOptionPermission "-verbosegc"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Dparameter.count=zero"; - permission com.sun.rmi.rmid.ExecOptionPermission "-Xmx32m"; - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/activation/CommandEnvironment/security.policy b/test/jdk/java/rmi/activation/CommandEnvironment/security.policy deleted file mode 100644 index de4eaa17834..00000000000 --- a/test/jdk/java/rmi/activation/CommandEnvironment/security.policy +++ /dev/null @@ -1,32 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - permission java.util.PropertyPermission "java.compiler", "read"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; -}; diff --git a/test/jdk/java/rmi/activation/log/LogTest.java b/test/jdk/java/rmi/activation/log/LogTest.java deleted file mode 100644 index 91d4726754b..00000000000 --- a/test/jdk/java/rmi/activation/log/LogTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4652922 - * - * @summary synopsis: ReliableLog.update should pad records to 4-byte - * boundaries - * @author Ann Wollrath - * - * @modules java.rmi/sun.rmi.log - * @run main/othervm/timeout=240 LogTest - */ - -import sun.rmi.log.LogHandler; -import sun.rmi.log.ReliableLog; -import java.io.FileDescriptor; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.Serializable; - -public class LogTest { - - private static int crashPoint = 0; - private static boolean spansBoundary = false; - private static ReliableLog log = null; - private static Counter counter = new Counter(); - - public static void main(String[] args) throws Exception { - - System.err.println("\nRegression test for bug 4652922\n"); - - System.setProperty("sun.rmi.log.class", MyLogFile.class.getName()); - //System.setProperty("sun.rmi.log.debug", "true"); - - log = new ReliableLog(".", new TestLogHandler(counter), false); - - writeUpdatesCrashAndRecover(10, 1, false, 10); - writeUpdatesCrashAndRecover(10, 1, true, 20); - writeUpdatesCrashAndRecover(10, 2, true, 30); - writeUpdatesCrashAndRecover(9, 2, false, 40); - writeUpdatesCrashAndRecover(9, 3, true, 50); - log.close(); - } - - private static void writeUpdatesCrashAndRecover(int updates, - int crashValue, - boolean spans, - int expectedCount) - throws IOException - { - /* - * Write updates - */ - System.err.println("\nwrite updates: " + updates); - for (int i = 0; i < updates; i++) { - counter.increment(); - log.update(counter); - } - - /* - * Crash - */ - crashPoint = crashValue; - spansBoundary = spans; - System.err.println("crash during next update on sync #" + - crashPoint + - " (spansBoundary = " + spansBoundary + ")"); - try { - System.err.println( - "write one update (update record should " + - ((counter.value() + 1 == expectedCount) ? "" : "not ") + - "be complete)"); - counter.increment(); - log.update(counter); - throw new RuntimeException("failed to reach crashpoint " + - crashPoint); - } catch (IOException e) { - System.err.println("caught IOException; message: " + - e.getMessage()); - log.close(); - } - - /* - * Recover - */ - log = new ReliableLog(".", new TestLogHandler(null), false); - try { - System.err.println("recover log"); - counter = (Counter) log.recover(); - System.err.println("recovered counter value: " + counter.value()); - if (counter.value() != expectedCount) { - throw new RuntimeException("unexpected counter value " + - counter.value()); - } - System.err.println("log recovery successful"); - - } catch (IOException e) { - System.err.println("log should recover after crash point"); - e.printStackTrace(); - throw new RuntimeException( - "log should recover after crash point"); - } - - } - - private static class Counter implements Serializable { - private static long serialVersionUID = 1; - private int count = 0; - - Counter() {} - - int increment() { - return ++count; - } - - int value() { - return count; - } - - void update(Counter value) { - if (value.value() < count) { - throw new IllegalStateException( - "bad update (count = " + count + ", value = " + value + ")"); - } else { - count = value.value(); - } - } - } - - static class TestLogHandler extends LogHandler { - - private final Counter initialState; - - TestLogHandler(Counter initialState) { - this.initialState = initialState; - } - - public Object initialSnapshot() { - if (initialState == null) { - throw new IllegalStateException( - "attempting initialSnapshot with null"); - } - return initialState; - } - - public Object applyUpdate(Object update, Object state) { - ((Counter) state).update((Counter) update); - return state; - } - } - - public static class MyLogFile extends ReliableLog.LogFile { - - public MyLogFile(String name, String mode) - throws FileNotFoundException, IOException - { - super(name, mode); - } - - protected void sync() throws IOException { - if (crashPoint != 0) { - if (--crashPoint == 0) { - throw new IOException("crash point reached"); - } - } - super.sync(); - } - - protected boolean checkSpansBoundary(long fp) { - return - crashPoint > 0 ? spansBoundary : super.checkSpansBoundary(fp); - } - } -} diff --git a/test/jdk/java/rmi/activation/nonLocalActivation/NonLocalActivationTest.java b/test/jdk/java/rmi/activation/nonLocalActivation/NonLocalActivationTest.java deleted file mode 100644 index 55cea96a0d2..00000000000 --- a/test/jdk/java/rmi/activation/nonLocalActivation/NonLocalActivationTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * 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.net.InetAddress; -import java.rmi.AccessException; -import java.rmi.activation.ActivationSystem; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.util.Set; - -/* - * @test - * @bug 8174770 - * @summary Verify that ActivationSystem rejects non-local access. - * The test is manual because the (non-local) host running rmid must be supplied as a property. - * @run main/manual/othervm -Dactivation.host=rmid-host NonLocalActivationTest - */ - -/** - * Lookup the ActivationSystem on a different host and invoke its remote interface methods. - * They should all throw an exception, non-local access is prohibited. - * - * This test is a manual test and uses rmid running on a *different* host. - * The default port (1098) for the Activation System is ok and expected. - * Login or ssh to the different host and invoke {@code $JDK_HOME/bin/rmid}. - * It will not show any output. - * - * On the first host modify the @run command above to replace "rmid-host" - * with the hostname or IP address of the different host and run the test with jtreg. - */ -public class NonLocalActivationTest -{ - public static void main(String[] args) throws Exception { - - String host = System.getProperty("activation.host"); - if (host == null || host.isEmpty()) { - throw new RuntimeException("Specify host with system property: -Dactivation.host="); - } - - // Check if running the test on a local system; it only applies to remote - String myHostName = InetAddress.getLocalHost().getHostName(); - Set myAddrs = Set.of(InetAddress.getAllByName(myHostName)); - Set hostAddrs = Set.of(InetAddress.getAllByName(host)); - if (hostAddrs.stream().anyMatch(i -> myAddrs.contains(i)) - || hostAddrs.stream().anyMatch(h -> h.isLoopbackAddress())) { - throw new RuntimeException("Error: property 'activation.host' must not be the local host%n"); - } - - // Locate the registry operated by the ActivationSystem - // Test SystemRegistryImpl - Registry registry = LocateRegistry.getRegistry(host, ActivationSystem.SYSTEM_PORT); - try { - // Verify it is an ActivationSystem registry - registry.lookup("java.rmi.activation.ActivationSystem"); - } catch (Exception nf) { - throw new RuntimeException("Not a ActivationSystem registry, does not contain java.rmi.activation.ActivationSystem", nf); - } - - try { - registry.bind("foo", null); - throw new RuntimeException("Remote access should not succeed for method: bind"); - } catch (Exception e) { - assertIsAccessException(e, "Registry.bind"); - } - - try { - registry.rebind("foo", null); - throw new RuntimeException("Remote access should not succeed for method: rebind"); - } catch (Exception e) { - assertIsAccessException(e, "Registry.rebind"); - } - - try { - registry.unbind("foo"); - throw new RuntimeException("Remote access should not succeed for method: unbind"); - } catch (Exception e) { - assertIsAccessException(e, "Registry.unbind"); - } - - - // Locate the ActivationSystem on the specified host and default port. - // Test each of the ActivationSystem methods - ActivationSystem as = (ActivationSystem) registry.lookup("java.rmi.activation.ActivationSystem"); - - // Argument is not material, access check is before arg processing - - try { - as.registerGroup(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.getActivationDesc(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.getActivationGroupDesc(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.registerObject(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.unregisterGroup(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.unregisterObject(null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.setActivationDesc(null, null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - - try { - as.setActivationGroupDesc(null, null); - } catch (Exception aex) { - assertIsAccessException(aex, "ActivationSystem.nonLocalAccess"); - } - } - - /** - * Check the exception chain for the expected AccessException and message. - * @param ex the exception from the remote invocation. - */ - private static void assertIsAccessException(Exception ex, String msg1) { - Throwable t = ex; - System.out.println(); - while (!(t instanceof AccessException) && t.getCause() != null) { - t = t.getCause(); - } - if (t instanceof AccessException) { - String msg = t.getMessage(); - int asIndex = msg.indexOf(msg1); - int disallowIndex = msg.indexOf("disallowed"); - int nonLocalHostIndex = msg.indexOf("non-local host"); - if (asIndex < 0 || - disallowIndex < 0 || - nonLocalHostIndex < 0 ) { - throw new RuntimeException("exception message is malformed", t); - } - System.out.printf("Found expected AccessException: %s%n", t); - } else { - throw new RuntimeException("AccessException did not occur", ex); - } - } -} diff --git a/test/jdk/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/test/jdk/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java deleted file mode 100644 index e7a7f1da8c4..00000000000 --- a/test/jdk/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 6261402 6824141 - * @summary If rmid has an inherited channel that is not a server - * socket (such as it if was started using rsh/rcmd), then it should - * function normally. - * @author Peter Jones - * - * @library ../../testlibrary - * @modules java.base/sun.nio.ch - * java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * @build TestLibrary RMID ActivationLibrary - * @run main/othervm/timeout=240 InheritedChannelNotServerSocket - * @key intermittent - */ - -import java.io.IOException; -import java.net.Socket; -import java.net.ProtocolFamily; -import java.nio.channels.Channel; -import java.nio.channels.DatagramChannel; -import java.nio.channels.Pipe; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.nio.channels.spi.AbstractSelector; -import java.nio.channels.spi.SelectorProvider; -import java.rmi.NotBoundException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.activation.ActivationGroup; -import java.rmi.activation.ActivationSystem; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.rmi.server.UnicastRemoteObject; - -public class InheritedChannelNotServerSocket { - private static final Object lock = new Object(); - private static boolean notified = false; - - private InheritedChannelNotServerSocket() { } - - public interface Callback extends Remote { - void notifyTest() throws RemoteException; - } - - public static class CallbackImpl implements Callback { - CallbackImpl() { } - public void notifyTest() { - synchronized (lock) { - notified = true; - System.err.println("notification received."); - lock.notifyAll(); - } - } - } - - public static void main(String[] args) throws Exception { - System.err.println("\nRegression test for bug 6261402\n"); - System.setProperty("java.rmi.activation.port", - Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT)); - RMID rmid = null; - Callback obj = null; - try { - /* - * Export callback object and bind in registry. - */ - System.err.println("export callback object and bind in registry"); - obj = new CallbackImpl(); - Callback proxy = - (Callback) UnicastRemoteObject.exportObject(obj, 0); - Registry registry = TestLibrary.createRegistryOnEphemeralPort(); - int registryPort = TestLibrary.getRegistryPort(registry); - registry.bind("Callback", proxy); - - /* - * Start rmid. - */ - System.err.println("start rmid with inherited channel"); - RMID.removeLog(); - rmid = RMID.createRMID(System.out, System.err, true, true, - TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT); - rmid.addOptions( - "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED", - "-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP", - "-Dtest.java.rmi.rmidViaInheritedChannel.registry.port=" + registryPort); - rmid.start(); - - /* - * Get activation system and wait to be notified via callback - * from rmid's selector provider. - */ - System.err.println("get activation system"); - ActivationSystem system = ActivationGroup.getSystem(); - System.err.println("ActivationSystem = " + system); - synchronized (lock) { - while (!notified) { - lock.wait(); - } - } - System.err.println("TEST PASSED"); - } finally { - if (obj != null) { - UnicastRemoteObject.unexportObject(obj, true); - } - if (rmid != null) { - rmid.cleanup(); - } - } - } - - public static class SP extends SelectorProvider { - private final SelectorProvider provider; - private volatile SocketChannel channel = null; - - public SP() { - provider = sun.nio.ch.DefaultSelectorProvider.get(); - } - - public DatagramChannel openDatagramChannel() throws IOException { - return provider.openDatagramChannel(); - } - - public DatagramChannel openDatagramChannel(ProtocolFamily family) - throws IOException - { - return provider.openDatagramChannel(family); - } - - public Pipe openPipe() throws IOException { - return provider.openPipe(); - } - - public AbstractSelector openSelector() throws IOException { - return provider.openSelector(); - } - - public ServerSocketChannel openServerSocketChannel() - throws IOException - { - return provider.openServerSocketChannel(); - } - - public SocketChannel openSocketChannel() throws IOException { - return provider.openSocketChannel(); - } - - public synchronized Channel inheritedChannel() throws IOException { - System.err.println("SP.inheritedChannel"); - if (channel == null) { - channel = SocketChannel.open(); - Socket socket = channel.socket(); - System.err.println("socket = " + socket); - - /* - * Notify test that inherited channel was created. - */ - try { - System.err.println("notify test..."); - int registryPort = Integer.getInteger( - "test.java.rmi.rmidViaInheritedChannel.registry.port", 0); - Registry registry = LocateRegistry.getRegistry(registryPort); - Callback obj = (Callback) registry.lookup("Callback"); - obj.notifyTest(); - } catch (NotBoundException nbe) { - throw (IOException) - new IOException("callback object not bound"). - initCause(nbe); - } - } - return channel; - } - } -} diff --git a/test/jdk/java/rmi/activation/rmidViaInheritedChannel/rmid.security.policy b/test/jdk/java/rmi/activation/rmidViaInheritedChannel/rmid.security.policy deleted file mode 100644 index 1d94a375522..00000000000 --- a/test/jdk/java/rmi/activation/rmidViaInheritedChannel/rmid.security.policy +++ /dev/null @@ -1,7 +0,0 @@ -grant { - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.net.SocketPermission "*", "connect,accept"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - permission java.util.PropertyPermission "test.java.rmi.rmidViaInheritedChannel.registry.port", "read"; -}; diff --git a/test/jdk/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/test/jdk/java/rmi/registry/altSecurityManager/AltSecurityManager.java index 4f29e0519b4..0a542c2d036 100644 --- a/test/jdk/java/rmi/registry/altSecurityManager/AltSecurityManager.java +++ b/test/jdk/java/rmi/registry/altSecurityManager/AltSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -23,7 +23,7 @@ /* @test * @bug 4183202 - * @summary rmid and rmiregistry could allow alternate security manager + * @summary rmiregistry could allow alternate security manager * @author Laird Dornin * * @library ../../testlibrary @@ -32,27 +32,25 @@ * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp * java.base/sun.nio.ch - * @build TestLibrary RMID RMIDSelectorProvider RegistryVM RMIRegistryRunner - * TestSecurityManager + * @build TestLibrary RegistryVM RMIRegistryRunner TestSecurityManager * @run main/othervm AltSecurityManager */ /** * Ensure that a user is able to specify alternate security managers to - * be used in rmiregistry and rmid. Test specifies a security manager + * be used in rmiregistry. Test specifies a security manager * that throws a runtime exception in its checkListen method, this - * will cause rmiregistry and rmid to exit early because those + * will cause rmiregistry to exit early because those * utilities will be unable to export any remote objects; test fails - * if registry and rmid take too long to exit. + * if registry takes too long to exit. */ public class AltSecurityManager implements Runnable { - // variable to hold registry and rmid children + // variable to hold registry child static JavaVM vm = null; // names of utilities static String utilityToStart = null; static final String REGISTRY_IMPL = "sun.rmi.registry.RegistryImpl"; - static final String ACTIVATION = "sun.rmi.server.Activation"; // children should exit in at least this time. private static final long TIME_OUT = @@ -64,12 +62,8 @@ public void run() { vm = RegistryVM.createRegistryVMWithRunner( "RMIRegistryRunner", "-Djava.security.manager=TestSecurityManager"); - } else if (utilityToStart.contains(ACTIVATION)) { - vm = RMID.createRMIDOnEphemeralPortWithOptions( - "-Djava.security.manager=TestSecurityManager"); } else { - TestLibrary.bomb("Utility to start must be " + REGISTRY_IMPL + - " or " + ACTIVATION); + TestLibrary.bomb("Utility to start must be " + REGISTRY_IMPL); } System.err.println("starting " + utilityToStart); @@ -93,7 +87,7 @@ public void run() { } /** - * Wait to make sure that the registry and rmid exit after + * Wait to make sure that the registry exits after * their security manager is set. */ public static void ensureExit(String utility) throws Exception { @@ -131,15 +125,10 @@ public static void main(String[] args) { // make sure the registry exits early. ensureExit(REGISTRY_IMPL); - // make sure rmid exits early - ensureExit(ACTIVATION); - System.err.println("test passed"); } catch (Exception e) { TestLibrary.bomb(e); - } finally { - RMID.removeLog(); } } } diff --git a/test/jdk/java/rmi/registry/altSecurityManager/TestSecurityManager.java b/test/jdk/java/rmi/registry/altSecurityManager/TestSecurityManager.java index ea291919ad3..42e370fa3d8 100644 --- a/test/jdk/java/rmi/registry/altSecurityManager/TestSecurityManager.java +++ b/test/jdk/java/rmi/registry/altSecurityManager/TestSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -30,10 +30,9 @@ public TestSecurityManager() { } public void checkListen(int port) { - // 4269910: ok, now rmid and the regsitry will *really* go - // away... + // 4269910: ok, now the registry will *really* go away... // - // rmid and the registry need to listen on sockets so they + // the registry needs to listen on sockets so they // will exit when they try to do so... this is used as a sign // by the main test process to detect that the proper security // manager has been installed in the relevant VMs. diff --git a/test/jdk/java/rmi/registry/altSecurityManager/rmid.security.policy b/test/jdk/java/rmi/registry/altSecurityManager/rmid.security.policy index 5307f72ce64..81c0c85c188 100644 --- a/test/jdk/java/rmi/registry/altSecurityManager/rmid.security.policy +++ b/test/jdk/java/rmi/registry/altSecurityManager/rmid.security.policy @@ -1,7 +1,5 @@ grant { permission java.lang.RuntimePermission "selectorProvider"; permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; }; diff --git a/test/jdk/java/rmi/registry/classPathCodebase/ClassPathCodebase.java b/test/jdk/java/rmi/registry/classPathCodebase/ClassPathCodebase.java index f0acc02bcc6..217010d2cf5 100644 --- a/test/jdk/java/rmi/registry/classPathCodebase/ClassPathCodebase.java +++ b/test/jdk/java/rmi/registry/classPathCodebase/ClassPathCodebase.java @@ -85,7 +85,7 @@ public static void main(String[] args) { File rmiregistryDir = new File(System.getProperty("user.dir", "."), importCodebase); rmiregistry = RegistryVM.createRegistryVMWithRunner("RMIRegistryRunner", - " -Denv.class.path=." + " -Denv.class.path=. -Djava.security.manager=allow" + " -Djava.rmi.server.codebase=" + exportCodebaseURL + " -Duser.dir=" + rmiregistryDir.getAbsolutePath()); rmiregistry.start(); diff --git a/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java b/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java index 679ae3b0b3b..dc2964ea5c8 100644 --- a/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java +++ b/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java @@ -37,6 +37,7 @@ import java.rmi.server.RemoteObjectInvocationHandler; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Arrays; import java.util.Set; @@ -85,8 +86,8 @@ public static void main(String[] args) throws Exception { // Check if running the test on a local system; it only applies to remote String myHostName = InetAddress.getLocalHost().getHostName(); - Set myAddrs = Set.of(InetAddress.getAllByName(myHostName)); - Set hostAddrs = Set.of(InetAddress.getAllByName(host)); + Set myAddrs = Set.copyOf(Arrays.asList(InetAddress.getAllByName(myHostName))); + Set hostAddrs = Set.copyOf(Arrays.asList(InetAddress.getAllByName(host))); boolean isLocal = (hostAddrs.stream().anyMatch(i -> myAddrs.contains(i)) || hostAddrs.stream().anyMatch(h -> h.isLoopbackAddress())); diff --git a/test/jdk/java/rmi/registry/readTest/CodebaseTest.java b/test/jdk/java/rmi/registry/readTest/CodebaseTest.java index 453dfe75e22..480bb8e6064 100644 --- a/test/jdk/java/rmi/registry/readTest/CodebaseTest.java +++ b/test/jdk/java/rmi/registry/readTest/CodebaseTest.java @@ -57,7 +57,7 @@ public static void main(String args[]) throws Exception { rmiregistryDir.mkdirs(); rmiregistry = RegistryVM.createRegistryVMWithRunner( "RMIRegistryRunner", - " -Djava.rmi.server.useCodebaseOnly=false" + " -Djava.rmi.server.useCodebaseOnly=false -Djava.security.manager=allow" + " -Duser.dir=" + rmiregistryDir.getAbsolutePath()); rmiregistry.start(); int port = rmiregistry.getPort(); diff --git a/test/jdk/java/rmi/reliability/benchmark/bench/rmi/Main.java b/test/jdk/java/rmi/reliability/benchmark/bench/rmi/Main.java index 4d8b22e17d4..8f997afca21 100644 --- a/test/jdk/java/rmi/reliability/benchmark/bench/rmi/Main.java +++ b/test/jdk/java/rmi/reliability/benchmark/bench/rmi/Main.java @@ -242,6 +242,7 @@ public static void main(String[] args) { clientProcessStr.add(classpath); } clientProcessStr.add("-Djava.security.policy=" + TEST_SRC_PATH + "policy.all"); + clientProcessStr.add("-Djava.security.manager=allow"); clientProcessStr.add("-Dtest.src=" + TEST_SRC_PATH); clientProcessStr.add("bench.rmi.Main"); //Client mode if (verbose) { diff --git a/test/jdk/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java b/test/jdk/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java index fa438cfeb62..4c883c93362 100644 --- a/test/jdk/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java +++ b/test/jdk/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java @@ -38,7 +38,7 @@ * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp * @build TestLibrary Foo - * @run main/othervm DelegateBeforePermissionCheck + * @run main/othervm -Djava.security.manager=allow DelegateBeforePermissionCheck */ import java.net.*; diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressConstants.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressConstants.java deleted file mode 100644 index 909e1d4eb84..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -/* - */ - -interface CompressConstants { - - // constants for 6-bit code values - static final int NOP = 0; // no operation: used to pad words on flush() - static final int RAW = 1; // introduces raw byte format - static final int BASE = 2; // base for codes found in lookup table - static final String codeTable = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()"; -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressInputStream.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressInputStream.java deleted file mode 100644 index 73c3d8db863..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressInputStream.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.*; - -class CompressInputStream extends FilterInputStream - implements CompressConstants -{ - - public CompressInputStream(InputStream in) { - super(in); - } - - // buffer of unpacked 6-bit codes from last 32-word read - int buf[] = new int[5]; - - // position of next code to read in buffer (5 == end of buffer) - int bufPos = 5; - - public int read() throws IOException { - try { - int code; - do { - code = readCode(); - } while (code == NOP); // ignore NOP codes - - if (code >= BASE) - return codeTable.charAt(code - BASE); - else if (code == RAW) { - int high = readCode(); - int low = readCode(); - return (high << 4) | low; - } else - throw new IOException("unknown compression code: " + code); - } catch (EOFException e) { - return -1; - } - } - - public int read(byte b[], int off, int len) throws IOException { - if (len <= 0) { - return 0; - } - - int c = read(); - if (c == -1) { - return -1; - } - b[off] = (byte)c; - - int i = 1; -/***** - try { - for (; i < len ; i++) { - c = read(); - if (c == -1) { - break; - } - if (b != null) { - b[off + i] = (byte)c; - } - } - } catch (IOException ee) { - } - *****/ - return i; - } - - private int readCode() throws IOException { - if (bufPos == 5) { - int b1 = in.read(); - int b2 = in.read(); - int b3 = in.read(); - int b4 = in.read(); - if ((b1 | b2 | b3 | b4) < 0) - throw new EOFException(); - int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; - buf[0] = (pack >>> 24) & 0x3F; - buf[1] = (pack >>> 18) & 0x3F; - buf[2] = (pack >>> 12) & 0x3F; - buf[3] = (pack >>> 6) & 0x3F; - buf[4] = (pack >>> 0) & 0x3F; - bufPos = 0; - } - return buf[bufPos++]; - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressOutputStream.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressOutputStream.java deleted file mode 100644 index 883a4a8e8ae..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressOutputStream.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.*; - -class CompressOutputStream extends FilterOutputStream - implements CompressConstants -{ - - public CompressOutputStream(OutputStream out) { - super(out); - } - - // buffer of 6-bit codes to pack into next 32-bit word - int buf[] = new int[5]; - - // number of valid codes pending in buffer - int bufPos = 0; - - public void write(int b) throws IOException { - b &= 0xFF; // force argument to a byte - - int pos = codeTable.indexOf((char)b); - if (pos != -1) - writeCode(BASE + pos); - else { - writeCode(RAW); - writeCode(b >> 4); - writeCode(b & 0xF); - } - } - - public void write(byte b[], int off, int len) throws IOException { - /* - * This is quite an inefficient implementation, because it has to - * call the other write method for every byte in the array. It - * could be optimized for performance by doing all the processing - * in this method. - */ - for (int i = 0; i < len; i++) - write(b[off + i]); - } - - public void flush() throws IOException { - while (bufPos > 0) - writeCode(NOP); - } - - private void writeCode(int c) throws IOException { - buf[bufPos++] = c; - if (bufPos == 5) { // write next word when we have 5 codes - int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) | - (buf[3] << 6) | buf[4]; - out.write((pack >>> 24) & 0xFF); - out.write((pack >>> 16) & 0xFF); - out.write((pack >>> 8) & 0xFF); - out.write((pack >>> 0) & 0xFF); - bufPos = 0; - } - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/Echo.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/Echo.java deleted file mode 100644 index 05f3075cb48..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/Echo.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.*; - -public interface Echo extends Remote { - - byte[] echoNot(byte[] data) throws RemoteException; - void shutdown() throws Exception; -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl.java deleted file mode 100644 index 209be45911b..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - */ -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.server.*; -import java.security.CodeSource; -import java.net.URL; - -public class EchoImpl - extends Activatable - implements Echo, Runnable -{ - private static final byte[] pattern = { (byte) 'A' }; - - /** - * Initialization constructor. - */ - public EchoImpl(String protocol) - throws ActivationException, RemoteException - { - super(null, makeMarshalledObject(protocol), false, 0, - new MultiSocketFactory.ClientFactory(protocol, pattern), - new MultiSocketFactory.ServerFactory(protocol, pattern)); - } - - /** - * Activation constructor. - */ - public EchoImpl(ActivationID id, MarshalledObject obj) - throws RemoteException - { - super(id, 0, - new MultiSocketFactory.ClientFactory(getProtocol(obj), pattern), - new MultiSocketFactory.ServerFactory(getProtocol(obj), pattern)); - } - - private static MarshalledObject makeMarshalledObject(String protocol) { - MarshalledObject obj = null; - try { - obj = new MarshalledObject(protocol); - } catch (Exception willNotHappen) { - } - - return obj; - } - - private static String getProtocol(MarshalledObject obj) { - String protocol = ""; - try { - protocol = (String) obj.get(); - } catch (Exception willNotHappen) { - } - - return protocol; - } - - public byte[] echoNot(byte[] data) { - byte[] result = new byte[data.length]; - for (int i = 0; i < data.length; i++) - result[i] = (byte) ~data[i]; - return result; - } - - /** - * Spawns a thread to deactivate the object. - */ - public void shutdown() throws Exception - { - (new Thread(this,"Echo.shutdown")).start(); - } - - /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. - */ - public void run() - { - ActivationLibrary.deactivate(this, getID()); - } - - public static void main(String[] args) { - /* - * The following line is required with the JDK 1.2 VM so that the - * VM can exit gracefully when this test completes. Otherwise, the - * conservative garbage collector will find a handle to the server - * object on the native stack and not clear the weak reference to - * it in the RMI runtime's object table. - */ - Object dummy = new Object(); - - System.setSecurityManager(new RMISecurityManager()); - - try { - String protocol = ""; - if (args.length >= 1) - protocol = args[0]; - - System.out.println("EchoServer: creating remote object"); - ActivationGroupDesc groupDesc = - new ActivationGroupDesc(null, null); - ActivationSystem system = ActivationGroup.getSystem(); - ActivationGroupID groupID = system.registerGroup(groupDesc); - ActivationGroup.createGroup(groupID, groupDesc, 0); - - EchoImpl impl = new EchoImpl(protocol); - int registryPort = Integer.parseInt(System.getProperty("rmi.registry.port")); - System.out.println("EchoServer: binding in registry on port:" + registryPort); - Naming.rebind("//:" + registryPort + - "/EchoServer", impl); - System.out.println("EchoServer ready."); - } catch (Exception e) { - System.err.println("EXCEPTION OCCURRED:"); - e.printStackTrace(); - } - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl_Stub.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl_Stub.java deleted file mode 100644 index 6331dd875ae..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl_Stub.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class EchoImpl_Stub - extends java.rmi.server.RemoteStub - implements Echo, java.rmi.Remote -{ - private static final long serialVersionUID = 2; - - private static java.lang.reflect.Method $method_echoNot_0; - private static java.lang.reflect.Method $method_shutdown_1; - - static { - try { - $method_echoNot_0 = Echo.class.getMethod("echoNot", new java.lang.Class[] {byte[].class}); - $method_shutdown_1 = Echo.class.getMethod("shutdown", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError( - "stub class initialization failed"); - } - } - - // constructors - public EchoImpl_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of echoNot(byte[]) - public byte[] echoNot(byte[] $param_arrayOf_byte_1) - throws java.rmi.RemoteException - { - try { - Object $result = ref.invoke(this, $method_echoNot_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -4295721514897591756L); - return ((byte[]) $result); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L); - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/MultiSocketFactory.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/MultiSocketFactory.java deleted file mode 100644 index 4af99832bb0..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/MultiSocketFactory.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * 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.*; -import java.net.*; -import java.rmi.*; -import java.rmi.server.*; -import java.util.zip.*; - - -public class MultiSocketFactory { - - private static RMISocketFactory def = - RMISocketFactory.getDefaultSocketFactory(); - - - public static class ServerFactory - implements RMIServerSocketFactory, Serializable - { - - private String protocol; - private byte[] data; - - public ServerFactory(String protocol, byte[] data) { - this.protocol = protocol; - this.data = data; - } - - public ServerSocket createServerSocket(int port) throws IOException - { - if (protocol.equals("compress")) { - return new CompressServerSocket(port); - - } else if (protocol.equals("xor")) { - if (data == null || data.length != 1) - throw new IOException("invalid argument for XOR protocol"); - return new XorServerSocket(port, data[0]); - - } - - return def.createServerSocket(port); - } - } - - public static class ClientFactory - implements RMIClientSocketFactory, Serializable - { - - private String protocol; - private byte[] data; - - public ClientFactory(String protocol, byte[] data) { - this.protocol = protocol; - this.data = data; - } - - public Socket createSocket(String host, int port) - throws IOException - { - if (protocol.equals("compress")) { - return new CompressSocket(host, port); - - } else if (protocol.equals("xor")) { - if (data == null || data.length != 1) - throw new IOException("invalid argument for XOR protocol"); - return new XorSocket(host, port, data[0]); - - } - - return def.createSocket(host, port); - } - } - - static class CompressSocket extends Socket { - private InputStream in; - private OutputStream out; - public CompressSocket() { super(); } - public CompressSocket(String host, int port) throws IOException { - super(host, port); - } - public InputStream getInputStream() throws IOException { - if (in == null) { - in = new CompressInputStream(super.getInputStream()); - } - return in; - } - public OutputStream getOutputStream() throws IOException { - if (out == null) { - out = new CompressOutputStream(super.getOutputStream()); - } - return out; - } - } - - static class CompressServerSocket extends ServerSocket { - public CompressServerSocket(int port) throws IOException { - super(port); - } - public Socket accept() throws IOException { - Socket s = new CompressSocket(); - implAccept(s); - return s; - } - } - - static class XorSocket extends Socket { - private byte pattern; - private InputStream in; - private OutputStream out; - public XorSocket(byte pattern) { super(); this.pattern = pattern; } - public XorSocket(String host, int port, byte pattern) - throws IOException - { - super(host, port); - this.pattern = pattern; - } - public InputStream getInputStream() throws IOException { - if (in == null) { - in = new XorInputStream(super.getInputStream(), pattern); - } - return in; - } - public OutputStream getOutputStream() throws IOException { - if (out == null) { - out = new XorOutputStream(super.getOutputStream(), pattern); - } - return out; - } - } - - static class XorServerSocket extends ServerSocket { - private byte pattern; - public XorServerSocket(int port, byte pattern) throws IOException { - super(port); - this.pattern = pattern; - } - public Socket accept() throws IOException { - Socket s = new XorSocket(pattern); - implAccept(s); - return s; - } - } - - static class XorOutputStream extends FilterOutputStream { - private byte pattern; - public XorOutputStream(OutputStream out, byte pattern) { - super(out); - this.pattern = pattern; - } - public void write(int b) throws IOException { - out.write(b ^ pattern); - out.flush(); - } - public void write(byte b[], int off, int len) throws IOException { - for (int i = 0; i < len; i++) - write(b[off + i]); - } - } - - static class XorInputStream extends FilterInputStream { - private byte pattern; - public XorInputStream(InputStream in, byte pattern) { - super(in); - this.pattern = pattern; - } - public int read() throws IOException { - int b = in.read(); -// System.out.print("BEFORE: " + Integer.toHexString(b)); - if (b != -1) - b = (b ^ pattern) & 0xFF; -// System.out.println("\tAFTER: " + Integer.toHexString(b)); - return b; - } - public int read(byte b[], int off, int len) throws IOException { - if (len <= 0) { - return 0; - } - - int c = read(); - if (c == -1) { - return -1; - } - b[off] = (byte)c; - - int i = 1; -/***** - try { - for (; i < len ; i++) { - c = read(); - if (c == -1) { - break; - } - if (b != null) { - b[off + i] = (byte)c; - } - } - } catch (IOException ee) { - } -*****/ - return i; - } - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java deleted file mode 100644 index 3509a3fbae5..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. - * 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 4115696 - * @key intermittent - * @summary synopsis: cannot use socket factories with Activatable objects - * @author Ann Wollrath - * - * @library ../../../../testlibrary - * @modules java.rmi/sun.rmi.registry - * java.rmi/sun.rmi.server - * java.rmi/sun.rmi.transport - * java.rmi/sun.rmi.transport.tcp - * java.base/sun.nio.ch - * @build TestLibrary Echo EchoImpl EchoImpl_Stub RMIDSelectorProvider - * @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory - */ - -import java.io.*; -import java.net.MalformedURLException; -import java.rmi.*; -import java.rmi.registry.*; - -public class UseCustomSocketFactory { - static int registryPort = -1; - - static String[] protocol = new String[] { "", "compress", "xor" }; - - public static void main(String[] args) { - - System.out.println("\nRegression test for bug 4115696\n"); - - TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); - - try { - Registry reg = LocateRegistry.createRegistry(0); - registryPort = TestLibrary.getRegistryPort(reg); - } catch (RemoteException e) { - TestLibrary.bomb("creating registry", e); - } - - RMID rmid = null; - - try { - rmid = RMID.createRMIDOnEphemeralPort(); - rmid.addArguments(new String[] { - "-C-Djava.security.policy=" + - TestParams.defaultGroupPolicy + - " -C-Djava.security.manager=java.rmi.RMISecurityManager "}); - rmid.start(); - - Echo[] echo = spawnAndTest(rmid.getPort()); - reactivateAndTest(echo); - } catch (IOException e) { - TestLibrary.bomb("creating rmid", e); - } finally { - if (rmid != null) - rmid.destroy(); - } - } - - private static Echo[] spawnAndTest(int rmidPort) { - - System.err.println("\nCreate Test-->"); - - Echo[] echo = new Echo[protocol.length]; - - for (int i = 0; i < protocol.length; i++) { - JavaVM serverVM = new JavaVM("EchoImpl", - "-Djava.security.policy=" + - TestParams.defaultPolicy + - " -Drmi.registry.port=" + - registryPort + - " -Djava.rmi.activation.port=" + - rmidPort, - protocol[i]); - - System.err.println("\nusing protocol: " + - ("".equals(protocol[i]) ? "none" : protocol[i])); - - try { - /* spawn VM for EchoServer */ - serverVM.start(); - - /* lookup server */ - echo[i] = null; - // 24 seconds timeout - long stopTime = System.currentTimeMillis() + 24000; - do { - try { - echo[i] = (Echo) Naming.lookup("//:" + registryPort + - "/EchoServer"); - break; - } catch (NotBoundException e) { - try { - Thread.sleep(200); - } catch (InterruptedException ignore) { - } - } - } while (System.currentTimeMillis() < stopTime); - - if (echo[i] == null) - TestLibrary.bomb("server not bound in 120 tries", null); - - /* invoke remote method and print result*/ - System.err.println("Bound to " + echo[i]); - byte[] data = ("Greetings, citizen " + - System.getProperty("user.name") + "!"). getBytes(); - byte[] result = echo[i].echoNot(data); - for (int j = 0; j < result.length; j++) - result[j] = (byte) ~result[j]; - System.err.println("Result: " + new String(result)); - echo[i].shutdown(); - - } catch (Exception e) { - TestLibrary.bomb("test failed", e); - - } finally { - serverVM.destroy(); - try { - Naming.unbind("//:" + registryPort + "/EchoServer"); - } catch (RemoteException | NotBoundException | MalformedURLException e) { - TestLibrary.bomb("unbinding EchoServer", e); - } - } - } - return echo; - } - - - private static void reactivateAndTest(Echo[] echo) { - - System.err.println("\nReactivate Test-->"); - - for (int i = 0; i < echo.length; i++) { - try { - System.err.println("\nusing protocol: " + - ("".equals(protocol[i]) ? "none" : protocol[i])); - byte[] data = ("Greetings, citizen " + - System.getProperty("user.name") + "!").getBytes(); - byte[] result = echo[i].echoNot(data); - for (int j = 0; j < result.length; j++) - result[j] = (byte) ~result[j]; - System.err.println("Result: " + new String(result)); - echo[i].shutdown(); - } catch (Exception e) { - TestLibrary.bomb("activating EchoServer for protocol " + protocol[i], e); - } - } - } -} diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy deleted file mode 100644 index 276768a15d1..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy +++ /dev/null @@ -1,9 +0,0 @@ -/* - * security policy used by activation groups - */ - -grant { - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "test.*", "read"; -}; diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/rmid.security.policy b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/rmid.security.policy deleted file mode 100644 index f2c4f1dbfaa..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/rmid.security.policy +++ /dev/null @@ -1,7 +0,0 @@ -grant { - permission java.lang.RuntimePermission "selectorProvider"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read"; - permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read"; - permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept"; -}; diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy deleted file mode 100644 index 324624d5bc7..00000000000 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * security policy used by the test process - */ - -grant { - // property specifically accessed by this test - permission java.util.PropertyPermission "user.name", "read"; - - // standard test activation permissions - permission java.io.FilePermission "..${/}..${/}test.props", "read"; - - // test needs to cleanup rmid's log. - permission java.io.FilePermission ".${/}log", "read,write,delete"; - permission java.io.FilePermission ".${/}log${/}-", "read,write,delete"; - - // test needs to use java to exec an rmid - permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute"; - - // test uses these permissions to propagate security values to rmid - permission java.util.PropertyPermission "java.security.policy", "read"; - permission java.util.PropertyPermission "java.security.manager", "read"; - - // used by TestLibrary to get the RMI Registry port - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.proxy"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; - - // used by TestLibrary to determine test environment - permission java.util.PropertyPermission "test.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "java.home", "read"; - - permission java.util.PropertyPermission "rmi.registry.port", "read"; - permission java.util.PropertyPermission "java.rmi.activation.port", "write"; - - // required for test to create an ActivationGroup - permission java.lang.RuntimePermission "setFactory"; - - // test needs to export rmid and communicate with objects on arbitrary ports - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; -}; diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java index 0b6dc76a3b0..b200893434d 100644 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java +++ b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java @@ -80,7 +80,8 @@ public static void main(String[] args) { } JavaVM serverVM = new JavaVM("HelloImpl", - "-Djava.security.policy=" + + "-Djava.security.manager=allow" + + " -Djava.security.policy=" + TestParams.defaultPolicy + " -Drmi.registry.port=" + registryPort, diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy index 70bf79ac69e..e35814e04b1 100644 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy +++ b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy @@ -29,6 +29,6 @@ grant { permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.proxy"; permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; }; diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java index 4df810af015..945111b8a92 100644 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java +++ b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java @@ -33,7 +33,7 @@ * java.rmi/sun.rmi.server * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp - * @build TestLibrary RMID JavaVM Echo EchoImpl EchoImpl_Stub + * @build TestLibrary JavaVM Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory */ @@ -63,7 +63,8 @@ public static void main(String[] args) { for (String protocol : protocols) { System.err.println("test policy: " + TestParams.defaultPolicy); - JavaVM serverVM = new JavaVM("EchoImpl", "-Djava.security.policy=" + + JavaVM serverVM = new JavaVM("EchoImpl", + "-Djava.security.manager=allow -Djava.security.policy=" + TestParams.defaultPolicy + " -Drmi.registry.port=" + registryPort, protocol); diff --git a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy index 70bf79ac69e..e35814e04b1 100644 --- a/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy +++ b/test/jdk/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy @@ -29,6 +29,6 @@ grant { permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.proxy"; permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; }; diff --git a/test/jdk/java/rmi/server/RemoteObject/unrecognizedRefType/UnrecognizedRefType.java b/test/jdk/java/rmi/server/RemoteObject/unrecognizedRefType/UnrecognizedRefType.java index 86f46397459..57b60756b72 100644 --- a/test/jdk/java/rmi/server/RemoteObject/unrecognizedRefType/UnrecognizedRefType.java +++ b/test/jdk/java/rmi/server/RemoteObject/unrecognizedRefType/UnrecognizedRefType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -32,7 +32,6 @@ * longer a supported "external ref type name", and the names of * other classes in the internal package sun.rmi.server should * produce the same result. - * See also test/java/rmi/activation/Activatable/notSerializable. * @author Peter Jones * * @run main/othervm UnrecognizedRefType diff --git a/test/jdk/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java b/test/jdk/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java index 2c4bb4d6b9f..f1de500a9e2 100644 --- a/test/jdk/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java +++ b/test/jdk/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java @@ -44,7 +44,7 @@ * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp * @build TestLibrary UnreferencedContext_Stub - * @run main/othervm/timeout=120 UnreferencedContext + * @run main/othervm/timeout=120 -Djava.security.manager=allow UnreferencedContext */ import java.net.*; diff --git a/test/jdk/java/rmi/server/clientStackTrace/security.policy b/test/jdk/java/rmi/server/clientStackTrace/security.policy index 2913666a0ee..0585c072708 100644 --- a/test/jdk/java/rmi/server/clientStackTrace/security.policy +++ b/test/jdk/java/rmi/server/clientStackTrace/security.policy @@ -3,6 +3,6 @@ */ grant { - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; }; diff --git a/test/jdk/java/rmi/testlibrary/ActivationLibrary.java b/test/jdk/java/rmi/testlibrary/ActivationLibrary.java deleted file mode 100644 index 75531a97017..00000000000 --- a/test/jdk/java/rmi/testlibrary/ActivationLibrary.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. - * 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.rmi.Naming; -import java.rmi.NoSuchObjectException; -import java.rmi.NotBoundException; -import java.rmi.Remote; -import java.rmi.activation.Activatable; -import java.rmi.activation.ActivationID; -import java.rmi.activation.ActivationSystem; -import java.rmi.registry.LocateRegistry; - -/** - * Class of test utility/library methods related to Activatable - * objects. - */ -public class ActivationLibrary { - private static void mesg(Object mesg) { - System.err.println("ACTIVATION_LIBRARY: " + mesg.toString()); - } - - /** - * Deactivate an activated Activatable - */ - public static void deactivate(Remote remote, - ActivationID id) { - final long POLLTIME_MS = 100L; - final long DEACTIVATE_TIME_MS = 30_000L; - - long startTime = System.currentTimeMillis(); - long deadline = TestLibrary.computeDeadline(startTime, DEACTIVATE_TIME_MS); - - while (System.currentTimeMillis() < deadline) { - try { - if (Activatable.inactive(id) == true) { - mesg("inactive successful"); - return; - } else { - Thread.sleep(POLLTIME_MS); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation"); - return; - } catch (Exception e) { - try { - // forcibly unexport the object - mesg("Unexpected exception. Have to forcibly unexport the object." + - " Exception was :"); - e.printStackTrace(); - Activatable.unexportObject(remote, true); - } catch (NoSuchObjectException ex) { - } - return; - } - } - - mesg("unable to inactivate after " + - (System.currentTimeMillis() - startTime) + "ms."); - mesg("unexporting object forcibly instead"); - - try { - Activatable.unexportObject(remote, true); - } catch (NoSuchObjectException e) { - } - } -} diff --git a/test/jdk/java/rmi/testlibrary/JavaVM.java b/test/jdk/java/rmi/testlibrary/JavaVM.java index c2abd8be7e9..a37f04f81cd 100644 --- a/test/jdk/java/rmi/testlibrary/JavaVM.java +++ b/test/jdk/java/rmi/testlibrary/JavaVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, 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 @@ -188,40 +188,6 @@ public void start() throws IOException { errPipe = StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); } - public int startAndGetPort() throws IOException { - start0(); - - int port = -1; - if (options.contains("java.nio.channels.spi.SelectorProvider=RMIDSelectorProvider")) { - // Obtain the server socket channel's ephemeral port number of the - // child rmid process. - BufferedReader reader = new BufferedReader( - new InputStreamReader(vm.getInputStream())); - String s; - while ((s = reader.readLine()) != null) { - System.out.println(s); - int i = s.indexOf(RMID.EPHEMERAL_MSG); - if (i != -1) { - String v = s.substring(RMID.EPHEMERAL_MSG.length()); - port = Integer.valueOf(v); - break; - } - } - if (port == -1) { - // something failed - reader = new BufferedReader(new InputStreamReader(vm.getErrorStream())); - while ((s = reader.readLine()) != null) - System.err.println(s); - } - } - - /* output from the exec'ed process may optionally be captured. */ - outPipe = StreamPipe.plugTogether(vm.getInputStream(), this.outputStream); - errPipe = StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); - - return port; - } - public void destroy() { if (vm != null) { vm.destroyForcibly(); diff --git a/test/jdk/java/rmi/testlibrary/README.jcov b/test/jdk/java/rmi/testlibrary/README.jcov index d27b8a9114a..d47c5d95ec7 100644 --- a/test/jdk/java/rmi/testlibrary/README.jcov +++ b/test/jdk/java/rmi/testlibrary/README.jcov @@ -2,14 +2,14 @@ # This file contains example scripts and property files for collecting # code coverage data of the RMI regression suite. # -# Since many RMI regression tests spawn child VMs (either directly -# or through activation), special support is required for setting +# Since many RMI regression tests spawn child VMs, +# special support is required for setting # command line options and arguments needed by jcov - the code coverage # instrumentation and collection tool. This special support is provided # by properties in the test.props file. If a file named ../../test.props # exists (assuming the working directory is "/JTwork/scratch", this # will find "/test.props"), then it will be used by test library -# code that spawns VMs or instances of rmid. See the example test.props +# code that spawns VMs. See the example test.props # file below for the properties that may be defined. @@ -32,18 +32,12 @@ ${JT_HOME}/solaris/bin/jtreg -Xrunjcov:file=/files/rmi.jcov ${OPTS} -va -w:/tmp/ # are currently supported: # jcov.options are the jcov options that should be added to VMs # system properties -# rmid.jcov.args are the jcov options that should be added as -# arguments to rmid command line; effectively, these -# are identical to jcov.options but each option is -# prefaced with '-C' # jcov.sleep.multiplier is an integer that will be multiplied by # various wait times in the test library; the # default value used is '1' jcov.options=-Xrunjcov:file=/files/rmi.jcov -Xms256m -Xmx256m -XX:+UseUnsupportedDeprecatedJVMPI -XX:+EnableJVMPIInstructionStartEvent -XX:-UseFastEmptyMethods -XX:-UseFastAccessorMethods -rmid.jcov.args=-C-Xrunjcov:file=/files/rmi.jcov -C-Xms256m -C-Xmx256m -C-XX:+UseUnsupportedDeprecatedJVMPI -C-XX:+EnableJVMPIInstructionStartEvent -C-XX:-UseFastEmptyMethods -C-XX:-UseFastAccessorMethods - jcov.sleep.multiplier=3 @@ -59,7 +53,6 @@ export SRCS= java com.sun.tdk.jcov.MergerMain template_a.jcov /files/rmi.jcov java -Xms256m -Xmx512m com.sun.tdk.jcov.RepGenMain -fmt=html_ns -src_root=${SRCS} \ -include=java.rmi.* \ - -include=java.rmi.activation.* \ -include=java.rmi.dgc.* \ -include=java.rmi.registry.* \ -include=java.rmi.server.* \ @@ -72,7 +65,6 @@ java -Xms256m -Xmx512m com.sun.tdk.jcov.RepGenMain -fmt=html_ns -src_root=${SRCS -include=sun.rmi.transport.tcp.* \ -include=java.lang.reflect.Proxy \ -include=sun.misc.ProxyGenerator \ - -exclude=com.sun.rmi.rmid.* \ -exclude=javax.rmi.ssl.* \ java.jcov diff --git a/test/jdk/java/rmi/testlibrary/RMID.java b/test/jdk/java/rmi/testlibrary/RMID.java deleted file mode 100644 index 26bb6288ce3..00000000000 --- a/test/jdk/java/rmi/testlibrary/RMID.java +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ - -import java.io.*; -import java.rmi.*; -import java.rmi.activation.*; -import java.rmi.registry.*; -import java.time.LocalTime; -import java.util.concurrent.TimeoutException; - -/** - * Utility class that creates an instance of rmid with a policy - * file of name TestParams.defaultPolicy. - * - * Activation groups should run with the same security manager as the - * test. - */ -public class RMID extends JavaVM { - - // TODO: adjust these based on the timeout factor - // such as jcov.sleep.multiplier; see start(long) method. - // Also consider the test.timeout.factor property (a float). - private static final long TIMEOUT_SHUTDOWN_MS = 60_000L; - private static final long TIMEOUT_DESTROY_MS = 10_000L; - private static final long STARTTIME_MS = 15_000L; - private static final long POLLTIME_MS = 100L; - private static final long TIMEOUT_BASE = 240_000L; - - // when restart rmid, it may take more time than usual because of - // "port in use" by a possible interloper (check JDK-8168975), - // so need to set a longer timeout than STARTTIME_MS for restart. - private static final long RESTART_TIMEOUT = (long)(TIMEOUT_BASE * 0.9); - // Same reason to inheritedChannel in RMIDSelectorProvider. - // Put it here rather than in RMIDSelectorProvider to adjust - // both timeout values together. - private static long inheritedChannelTimeout; - - private static final String SYSTEM_NAME = ActivationSystem.class.getName(); - // "java.rmi.activation.ActivationSystem" - - public static String MANAGER_OPTION="-Djava.security.manager="; - - /** - * Test port for rmid. - * - * May initially be 0, which means that the child rmid process will choose - * an ephemeral port and report it back to the parent process. This field - * will then be set to the child rmid's ephemeral port value. - */ - private volatile int port; - //private final boolean ephemeralPort - - /** Initial log name */ - protected static String log = "log"; - /** rmid's logfile directory; currently must be "." */ - protected static String LOGDIR = "."; - - /** The output message from the child rmid process that directly precedes - * the ephemeral port number.*/ - public static final String EPHEMERAL_MSG = "RmidSelectorProvider-listening-On:"; - - private static void mesg(Object mesg) { - System.err.println("RMID: " + mesg.toString()); - } - - /** make test options and arguments */ - private static String makeOptions(int port, boolean debugExec, - boolean enableSelectorProvider) { - - String options = " -Dsun.rmi.server.activation.debugExec=" + - debugExec; - // + - //" -Djava.compiler= "; - - // if test params set, want to propagate them - if (!TestParams.testSrc.equals("")) { - options += " -Dtest.src=" + TestParams.testSrc + " "; - } - //if (!TestParams.testClasses.equals("")) { - // options += " -Dtest.classes=" + TestParams.testClasses + " "; - //} - options += " -Dtest.classes=" + TestParams.testClasses //; - + - " -Djava.rmi.server.logLevel=v "; - - // + - // " -Djava.security.debug=all "; - - // Set execTimeout to 60 sec (default is 30 sec) - // to avoid spurious timeouts on slow machines. - options += " -Dsun.rmi.activation.execTimeout=60000"; - - // It's important to set handshakeTimeout to small value, for example - // 5 sec (default is 60 sec) to avoid wasting too much time when - // calling lookupSystem(port) in restart(), because - // 1. If use default value of this option, it will take about 2 minutes - // to finish lookupSystem(port) in 2 loops in restart(); - // 2. If set this option as 5 sec then lookupSystem(port) will return - // very quickly. - options += " -Dsun.rmi.transport.tcp.handshakeTimeout=5000"; - - if (port == 0 || enableSelectorProvider) { - // Ephemeral port, so have the rmid child process create the - // server socket channel and report its port number, over stdin. - options += " -classpath " + TestParams.testClassPath; - options += " --add-exports=java.base/sun.nio.ch=ALL-UNNAMED"; - options += " -Djava.nio.channels.spi.SelectorProvider=RMIDSelectorProvider"; - options += " -Dtest.java.rmi.testlibrary.RMIDSelectorProvider.port=" + port; - options += " -Dtest.java.rmi.testlibrary.RMIDSelectorProvider.timeout=" - + inheritedChannelTimeout; - - // Disable redirection of System.err to /tmp - options += " -Dsun.rmi.server.activation.disableErrRedirect=true"; - } - - return options; - } - - private static String makeArgs() { - return makeArgs(false, 0); - } - - private static String makeArgs(boolean includePortArg, int port) { - // getAbsolutePath requires permission to read user.dir - String args = - " -log " + (new File(LOGDIR, log)).getAbsolutePath(); - - // 0 = ephemeral port, do not include an explicit port number - if (includePortArg && port != 0) { - args += " -port " + port; - } - - // + - // " -C-Djava.compiler= "; - - // if test params set, want to propagate them - if (!TestParams.testSrc.equals("")) { - args += " -C-Dtest.src=" + TestParams.testSrc; - } - if (!TestParams.testClasses.equals("")) { - args += " -C-Dtest.classes=" + TestParams.testClasses; - } - - if (!TestParams.testJavaOpts.equals("")) { - for (String a : TestParams.testJavaOpts.split(" +")) { - args += " -C" + a; - } - } - - if (!TestParams.testVmOpts.equals("")) { - for (String a : TestParams.testVmOpts.split(" +")) { - args += " -C" + a; - } - } - - args += " -C-Djava.rmi.server.useCodebaseOnly=false "; - - args += " " + getCodeCoverageArgs(); - return args; - } - - /** - * Routine that creates an rmid that will run with or without a - * policy file. - */ - public static RMID createRMID() { - return createRMID(System.out, System.err, true, true, - TestLibrary.getUnusedRandomPort()); - } - - public static RMID createRMID(OutputStream out, OutputStream err, - boolean debugExec) - { - return createRMID(out, err, debugExec, true, - TestLibrary.getUnusedRandomPort()); - } - - public static RMID createRMID(OutputStream out, OutputStream err, - boolean debugExec, boolean includePortArg, - int port) - { - return createRMIDWithOptions(out, err, debugExec, includePortArg, port, ""); - } - - /** - * Create a RMID on a specified port capturing stdout and stderr - * with additional command line options and whether to print out - * debugging information that is used for spawning activation groups. - * - * @param out the OutputStream where the normal output of the - * rmid subprocess goes - * @param err the OutputStream where the error output of the - * rmid subprocess goes - * @param debugExec whether to print out debugging information - * @param includePortArg whether to include port argument - * @param port the port on which rmid accepts requests - * @param additionalOptions additional command line options - * @return a RMID instance - */ - public static RMID createRMIDWithOptions(OutputStream out, OutputStream err, - boolean debugExec, boolean includePortArg, - int port, String additionalOptions) - { - String options = makeOptions(port, debugExec, false); - options += " " + additionalOptions; - String args = makeArgs(includePortArg, port); - RMID rmid = new RMID("sun.rmi.server.Activation", options, args, - out, err, port); - rmid.setPolicyFile(TestParams.defaultRmidPolicy); - - return rmid; - } - - public static RMID createRMIDOnEphemeralPort() { - return createRMID(System.out, System.err, true, false, 0); - } - - /** - * Create a RMID on an ephemeral port capturing stdout and stderr - * with additional command line options. - * - * @param additionalOptions additional command line options - * @return a RMID instance - */ - public static RMID createRMIDOnEphemeralPortWithOptions( - String additionalOptions) { - return createRMIDWithOptions(System.out, System.err, - true, false, 0, additionalOptions); - } - - public static RMID createRMIDOnEphemeralPort(OutputStream out, - OutputStream err, - boolean debugExec) - { - return createRMID(out, err, debugExec, false, 0); - } - - - /** - * Private constructor. RMID instances should be created - * using the static factory methods. - */ - private RMID(String classname, String options, String args, - OutputStream out, OutputStream err, int port) - { - super(classname, options, args, out, err); - this.port = port; - long waitTime = (long)(TIMEOUT_BASE * TestLibrary.getTimeoutFactor()); - inheritedChannelTimeout = (long)(waitTime * 0.8); - } - - /** - * Removes rmid's log file directory. - */ - public static void removeLog() { - File f = new File(LOGDIR, log); - - if (f.exists()) { - mesg("Removing rmid's old log file."); - String[] files = f.list(); - - if (files != null) { - for (int i=0; i deadline) { - TestLibrary.bomb("Failed to start rmid, giving up after " + - (System.currentTimeMillis() - startTime) + "ms.", null); - } - } - } - - /** - * Destroys rmid and restarts it. Note that this does NOT clean up - * the log file, because it stores information about restartable - * and activatable objects that must be carried over to the new - * rmid instance. - */ - public void restart() throws IOException { - destroy(); - options = makeOptions(port, true, true); - args = makeArgs(); - - start(RESTART_TIMEOUT); - } - - /** - * Ask rmid to shutdown gracefully using a remote method call. - * catch any errors that might occur from rmid not being present - * at time of shutdown invocation. If the remote call is - * successful, wait for the process to terminate. Return true - * if the process terminated, otherwise return false. - */ - private boolean shutdown() throws InterruptedException { - mesg("shutdown()"); - long startTime = System.currentTimeMillis(); - ActivationSystem system = lookupSystem(port); - if (system == null) { - mesg("lookupSystem() returned null after " + - (System.currentTimeMillis() - startTime) + "ms."); - return false; - } - - try { - mesg("ActivationSystem.shutdown()"); - system.shutdown(); - } catch (Exception e) { - mesg("Caught exception from ActivationSystem.shutdown():"); - e.printStackTrace(); - } - - try { - waitFor(TIMEOUT_SHUTDOWN_MS); - mesg("Shutdown successful after " + - (System.currentTimeMillis() - startTime) + "ms."); - return true; - } catch (TimeoutException ex) { - mesg("Shutdown timed out after " + - (System.currentTimeMillis() - startTime) + "ms:"); - ex.printStackTrace(); - return false; - } - } - - /** - * Ask rmid to shutdown gracefully but then destroy the rmid - * process if it does not exit by itself. This method only works - * if rmid is a child process of the current VM. - */ - public void destroy() { - if (vm == null) { - throw new IllegalStateException("can't wait for RMID that isn't running"); - } - - long startTime = System.currentTimeMillis(); - - // First, attempt graceful shutdown of the activation system. - try { - if (! shutdown()) { - // Graceful shutdown failed, use Process.destroy(). - mesg("Destroying RMID process."); - vm.destroy(); - try { - waitFor(TIMEOUT_DESTROY_MS); - mesg("Destroy successful after " + - (System.currentTimeMillis() - startTime) + "ms."); - } catch (TimeoutException ex) { - mesg("Destroy timed out, giving up after " + - (System.currentTimeMillis() - startTime) + "ms:"); - ex.printStackTrace(); - } - } - } catch (InterruptedException ie) { - mesg("Shutdown/destroy interrupted, giving up at " + - (System.currentTimeMillis() - startTime) + "ms."); - ie.printStackTrace(); - Thread.currentThread().interrupt(); - return; - } - - vm = null; - } - - /** - * Shuts down rmid and then removes its log file. - */ - public void cleanup() { - destroy(); - RMID.removeLog(); - } - - /** - * Gets the port on which this rmid is listening. - */ - public int getPort() { - return port; - } -} diff --git a/test/jdk/java/rmi/testlibrary/RMIDSelectorProvider.java b/test/jdk/java/rmi/testlibrary/RMIDSelectorProvider.java deleted file mode 100644 index 5726bf0b125..00000000000 --- a/test/jdk/java/rmi/testlibrary/RMIDSelectorProvider.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * 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.*; -import java.net.BindException; -import java.net.InetSocketAddress; -import java.net.ProtocolFamily; -import java.nio.channels.Channel; -import java.nio.channels.DatagramChannel; -import java.nio.channels.Pipe; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.nio.channels.spi.AbstractSelector; -import java.nio.channels.spi.SelectorProvider; -import java.time.LocalTime; -import static java.net.StandardSocketOptions.SO_REUSEADDR; -import static java.net.StandardSocketOptions.SO_REUSEPORT; - -/** - * A SelectorProvider, that can be loaded by the child rmid process, whose - * inheritedChannel method will create a new server socket channel and report - * it back to the parent process, over stdout. - */ -public class RMIDSelectorProvider extends SelectorProvider { - - private final SelectorProvider provider; - private ServerSocketChannel channel; - - public RMIDSelectorProvider() { - provider = sun.nio.ch.DefaultSelectorProvider.get(); - } - - public DatagramChannel openDatagramChannel() - throws IOException - { - return provider.openDatagramChannel(); - } - - public DatagramChannel openDatagramChannel(ProtocolFamily family) - throws IOException - { - return provider.openDatagramChannel(family); - } - - public Pipe openPipe() - throws IOException - { - return provider.openPipe(); - } - - public AbstractSelector openSelector() - throws IOException - { - return provider.openSelector(); - } - - public ServerSocketChannel openServerSocketChannel() - throws IOException - { - return provider.openServerSocketChannel(); - } - - public SocketChannel openSocketChannel() - throws IOException - { - return provider.openSocketChannel(); - } - - public synchronized Channel inheritedChannel() throws IOException { - System.out.println("RMIDSelectorProvider.inheritedChannel"); - if (channel == null) { - // Create and bind a new server socket channel - channel = ServerSocketChannel.open(); - - // Enable SO_REUSEADDR before binding - channel.setOption(SO_REUSEADDR, true); - - // Enable SO_REUSEPORT, if supported, before binding - if (channel.supportedOptions().contains(SO_REUSEPORT)) { - channel.setOption(SO_REUSEPORT, true); - } - - // when it comes here, these properties should have been set with - // a valid value, but assign a default value anyway. - long timeout = Long.getLong( - "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", - 200_000); - long deadline = System.currentTimeMillis() + timeout; - int port = Integer.getInteger( - "test.java.rmi.testlibrary.RMIDSelectorProvider.port", 0); - while (true) { - try { - channel.bind(new InetSocketAddress(port)); - break; - } catch (BindException ex) { - System.out.format("RMIDSelectorProvider: " - + "failed to bind to port %d due to \"%s\", at %s%n", - port, ex.getMessage(), LocalTime.now()); - } - if (System.currentTimeMillis() > deadline) { - System.out.format("RMIDSelectorProvider: " - + "fail to bind to port %d after trying for " - + "%d seconds, exiting rmid process, at %s%n", - port, timeout/1000, LocalTime.now()); - channel.close(); - // can not start rmid on specific port, - // there is no need to continue run rmid. - System.exit(1); - } - try { - Thread.sleep(1000); - } catch(InterruptedException ignore) { } - } - - System.out.println(RMID.EPHEMERAL_MSG + channel.socket().getLocalPort()); - } - return channel; - } -} diff --git a/test/jdk/java/rmi/testlibrary/TestLibrary.java b/test/jdk/java/rmi/testlibrary/TestLibrary.java index 43bab34ad74..cb2d2644660 100644 --- a/test/jdk/java/rmi/testlibrary/TestLibrary.java +++ b/test/jdk/java/rmi/testlibrary/TestLibrary.java @@ -88,8 +88,6 @@ public class TestLibrary { */ public final static int FIXED_PORT_MIN = 60001; public final static int FIXED_PORT_MAX = 60010; - public final static int RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT = 60001; - public final static int RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT = 60002; public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 60003; public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 60004; public final static int READTEST_REGISTRY_PORT = 60005; diff --git a/test/jdk/java/rmi/testlibrary/TestParams.java b/test/jdk/java/rmi/testlibrary/TestParams.java index 4b1f4d6e6e7..9feba1f7636 100644 --- a/test/jdk/java/rmi/testlibrary/TestParams.java +++ b/test/jdk/java/rmi/testlibrary/TestParams.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, 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 @@ -39,15 +39,9 @@ public class TestParams { /** name of default security policy for test JVM */ public static final String defaultPolicy; - /** name of default security policy for RMID */ - public static final String defaultRmidPolicy; - /** name of default security policy for RegistryVM */ public static final String defaultRegistryPolicy; - /** name of default security policy for activation groups */ - public static final String defaultGroupPolicy; - /** name of default security manager */ public static final String defaultSecurityManager; @@ -69,17 +63,14 @@ public class TestParams { } defaultPolicy = dp; - defaultRmidPolicy = - testSrc + File.separatorChar + "rmid.security.policy"; - defaultRegistryPolicy = testSrc + File.separatorChar + "registry.security.policy"; - defaultGroupPolicy = - testSrc + File.separatorChar + "group.security.policy"; - - defaultSecurityManager = TestLibrary.getProperty( - "java.security.manager", "java.lang.SecurityManager"); + String tmp = TestLibrary.getProperty("java.security.manager", null); + if (tmp == null || tmp.equals("allow")) { + tmp = "java.lang.SecurityManager"; + } + defaultSecurityManager = tmp; testVmOpts = TestLibrary.getProperty("test.vm.opts", ""); diff --git a/test/jdk/java/rmi/transport/checkLeaseInfoLeak/security.policy b/test/jdk/java/rmi/transport/checkLeaseInfoLeak/security.policy index 2ae9c27386d..7b62c9d6f41 100644 --- a/test/jdk/java/rmi/transport/checkLeaseInfoLeak/security.policy +++ b/test/jdk/java/rmi/transport/checkLeaseInfoLeak/security.policy @@ -18,6 +18,6 @@ grant { permission java.util.PropertyPermission "java.security.policy", "read"; permission java.util.PropertyPermission "java.security.manager", "read"; - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept"; }; diff --git a/test/jdk/java/rmi/transport/dgcDeadLock/registry.security.policy b/test/jdk/java/rmi/transport/dgcDeadLock/registry.security.policy index 926d8787fd9..bd6ca55df35 100644 --- a/test/jdk/java/rmi/transport/dgcDeadLock/registry.security.policy +++ b/test/jdk/java/rmi/transport/dgcDeadLock/registry.security.policy @@ -22,6 +22,6 @@ grant { permission java.util.PropertyPermission "java.security.policy", "read"; permission java.util.PropertyPermission "java.security.manager", "read"; - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; }; diff --git a/test/jdk/java/rmi/transport/dgcDeadLock/security.policy b/test/jdk/java/rmi/transport/dgcDeadLock/security.policy index b1caaba7e00..df76916420c 100644 --- a/test/jdk/java/rmi/transport/dgcDeadLock/security.policy +++ b/test/jdk/java/rmi/transport/dgcDeadLock/security.policy @@ -22,6 +22,6 @@ grant { permission java.util.PropertyPermission "java.security.policy", "read"; permission java.util.PropertyPermission "java.security.manager", "read"; - // test needs to export rmid and communicate with objects on arbitrary ports + // test needs to communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; }; diff --git a/test/jdk/java/security/BasicPermission/NullOrEmptyName.java b/test/jdk/java/security/BasicPermission/NullOrEmptyName.java index ce7f109d32b..970d011e64f 100644 --- a/test/jdk/java/security/BasicPermission/NullOrEmptyName.java +++ b/test/jdk/java/security/BasicPermission/NullOrEmptyName.java @@ -27,6 +27,7 @@ * @summary Make sure BasicPermission constructor raises * NullPointerException if permission name is null, and * IllegalArgumentException is permission name is empty. + * @run main/othervm -Djava.security.manager=allow NullOrEmptyName */ public class NullOrEmptyName { diff --git a/test/jdk/java/security/PermissionCollection/Concurrent.java b/test/jdk/java/security/PermissionCollection/Concurrent.java index 1b77d4dc77a..f6c97e166ce 100644 --- a/test/jdk/java/security/PermissionCollection/Concurrent.java +++ b/test/jdk/java/security/PermissionCollection/Concurrent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -25,7 +25,6 @@ * @test * @bug 4671598 * @summary PermissionCollection is not properly synchronized - * @modules java.rmi/com.sun.rmi.rmid */ import java.security.*; // AllPermission, BasicPermission, Permissions @@ -37,8 +36,6 @@ import javax.security.auth.kerberos.DelegationPermission; import javax.security.auth.kerberos.ServicePermission; import javax.management.MBeanServerPermission; -import com.sun.rmi.rmid.ExecPermission; -import com.sun.rmi.rmid.ExecOptionPermission; import java.util.*; diff --git a/test/jdk/java/security/Policy/PolicyProvider/UseSystemClassLoader.java b/test/jdk/java/security/Policy/PolicyProvider/UseSystemClassLoader.java index 7c33b1085d2..7988f19c0a8 100644 --- a/test/jdk/java/security/Policy/PolicyProvider/UseSystemClassLoader.java +++ b/test/jdk/java/security/Policy/PolicyProvider/UseSystemClassLoader.java @@ -31,10 +31,10 @@ * @bug 8075706 * @summary Check that a custom policy provider can be loaded from the classpath * @modules java.base/sun.security.provider - * @run main/othervm UseSystemClassLoader CUSTOM - * @run main/othervm UseSystemClassLoader DEFAULT - * @run main/othervm UseSystemClassLoader NOT_AVAIL - * @run main/othervm UseSystemClassLoader NOT_SET + * @run main/othervm -Djava.security.manager=allow UseSystemClassLoader CUSTOM + * @run main/othervm -Djava.security.manager=allow UseSystemClassLoader DEFAULT + * @run main/othervm -Djava.security.manager=allow UseSystemClassLoader NOT_AVAIL + * @run main/othervm -Djava.security.manager=allow UseSystemClassLoader NOT_SET */ public class UseSystemClassLoader { diff --git a/test/jdk/java/security/ProtectionDomain/AllPerm.java b/test/jdk/java/security/ProtectionDomain/AllPerm.java index e1b997983d0..7be2d1e216f 100644 --- a/test/jdk/java/security/ProtectionDomain/AllPerm.java +++ b/test/jdk/java/security/ProtectionDomain/AllPerm.java @@ -26,6 +26,7 @@ * @bug 6256734 * @summary ProtectionDomain could optimize implies by first checking for * AllPermission in internal collection + * @run main/othervm -Djava.security.manager=allow AllPerm */ import java.io.*; diff --git a/test/jdk/java/security/SecureClassLoader/DefineClass.java b/test/jdk/java/security/SecureClassLoader/DefineClass.java index 7e7bc77c617..7ad634c0e4c 100644 --- a/test/jdk/java/security/SecureClassLoader/DefineClass.java +++ b/test/jdk/java/security/SecureClassLoader/DefineClass.java @@ -58,7 +58,7 @@ * @summary Make sure equivalent ProtectionDomains are granted the same * permissions when the CodeSource URLs are different but resolve * to the same ip address after name service resolution. - * @run main/othervm DefineClass + * @run main/othervm -Djava.security.manager=allow DefineClass */ public class DefineClass { diff --git a/test/jdk/java/sql/testng/test/sql/othervm/DriverManagerPermissionsTests.java b/test/jdk/java/sql/permissionTests/DriverManagerPermissionsTests.java similarity index 93% rename from test/jdk/java/sql/testng/test/sql/othervm/DriverManagerPermissionsTests.java rename to test/jdk/java/sql/permissionTests/DriverManagerPermissionsTests.java index 0465e9ae3d2..756af982ba7 100644 --- a/test/jdk/java/sql/testng/test/sql/othervm/DriverManagerPermissionsTests.java +++ b/test/jdk/java/sql/permissionTests/DriverManagerPermissionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -20,12 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package test.sql.othervm; -import java.security.AccessControlException; -import java.security.Policy; -import java.sql.DriverManager; -import java.sql.SQLException; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -33,6 +28,18 @@ import util.StubDriver; import util.TestPolicy; +import java.security.AccessControlException; +import java.security.Policy; +import java.sql.DriverManager; +import java.sql.SQLException; + +/* + * @test + * @library /java/sql/testng + * @run testng/othervm -Djava.security.manager=allow DriverManagerPermissionsTests + * @summary Tests that a JDBC Driver that is a module can be loaded + * via the service-provider loading mechanism. + */ public class DriverManagerPermissionsTests extends BaseTest { private static Policy policy; diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseTests.java b/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseTests.java index e1b006fb9e4..403e483affa 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseTests.java +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -24,7 +24,7 @@ /* * @test * @summary tests Japanese Calendar. - * @bug 4609228 + * @bug 4609228 8187649 * @modules java.base/sun.util * java.base/sun.util.calendar * @compile diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts index daa2bd4d8fa..eddf440b305 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts @@ -435,12 +435,48 @@ test roll WEEK_OF_YEAR check date BeforeMeiji $minyear Dec 25 test WEEK_OF_MONTH - # Needs to wait for 6191841 fix. (WEEK_OF_MONTH needs to change - # ERA and YEAR in a transition month.) + use jcal + clear all + + # Make sure this test does not throw AIOOBE + set date Heisei 1 Aug 1 + roll week_of_month 1 + check date Heisei 1 Aug 8 + + # Check transition dates + set date Showa 64 Jan 7 + roll week_of_month 1 + check date Showa 64 Jan 7 + roll week_of_month -1 + check date Showa 64 Jan 7 + + set date Heisei 1 Jan 31 + roll week_of_month 1 + check date Heisei 1 Jan 10 + roll week_of_month -1 + check date Heisei 1 Jan 31 test DAY_OF_MONTH - # Needs to wait for 6191841 fix. (DAY_OF_MONTH needs to change - # ERA and YEAR in a transition month.) + use jcal + clear all + + # Make sure this test does not throw AIOOBE + Set date Heisei 1 Aug 1 + roll day_of_month 1 + check date Heisei 1 Aug 2 + + # Check transition dates + set date Showa 64 Jan 7 + roll day_of_month 1 + check date Showa 64 Jan 1 + roll day_of_month -1 + check date Showa 64 Jan 7 + + set date Heisei 1 Jan 31 + roll day_of_month 1 + check date Heisei 1 Jan 8 + roll day_of_month -1 + check date Heisei 1 Jan 31 test DAY_OF_YEAR use jcal diff --git a/test/jdk/java/util/Locale/LocaleEnhanceTest.java b/test/jdk/java/util/Locale/LocaleEnhanceTest.java index 692a4e469ce..29c8d29ebd8 100644 --- a/test/jdk/java/util/Locale/LocaleEnhanceTest.java +++ b/test/jdk/java/util/Locale/LocaleEnhanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -44,7 +44,7 @@ /** * @test * @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504 7004603 - * 7044019 8008577 8176853 8255086 + * 7044019 8008577 8176853 8255086 8263202 * @summary test API changes to Locale * @library /java/text/testlib * @modules jdk.localedata @@ -292,12 +292,12 @@ public void testConstructor() { { "xXxXxXxXxXxX", "yYyYyYyYyYyYyYyY", "zZzZzZzZzZzZzZzZ", "xxxxxxxxxxxx", "YYYYYYYYYYYYYYYY" }, // mapped language ids - { "he", "IW", "", "iw" }, - { "iw", "IW", "", "iw" }, - { "yi", "DE", "", "ji" }, - { "ji", "DE", "", "ji" }, - { "id", "ID", "", "in" }, - { "in", "ID", "", "in" }, + { "he", "IL", "", "he" }, + { "iw", "IL", "", "he" }, + { "yi", "DE", "", "yi" }, + { "ji", "DE", "", "yi" }, + { "id", "ID", "", "id" }, + { "in", "ID", "", "id" }, // special variants { "ja", "JP", "JP" }, { "th", "TH", "TH" }, @@ -467,8 +467,8 @@ public void testToLanguageTag() { // three-letter language tags are not canonicalized { "Eng", "", "", "eng" }, // legacy languages canonicalize to modern equivalents - { "he", "IW", "", "he-IW" }, - { "iw", "IW", "", "he-IW" }, + { "he", "IL", "", "he-IL" }, + { "iw", "IL", "", "he-IL" }, { "yi", "DE", "", "yi-DE" }, { "ji", "DE", "", "yi-DE" }, { "id", "ID", "", "id-ID" }, diff --git a/test/jdk/java/util/Locale/LocaleTest.java b/test/jdk/java/util/Locale/LocaleTest.java index c571fcf63df..f0cb6996d14 100644 --- a/test/jdk/java/util/Locale/LocaleTest.java +++ b/test/jdk/java/util/Locale/LocaleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -25,11 +25,12 @@ * @bug 4052404 4052440 4084688 4092475 4101316 4105828 4107014 4107953 4110613 * 4118587 4118595 4122371 4126371 4126880 4135316 4135752 4139504 4139940 4143951 * 4147315 4147317 4147552 4335196 4778440 4940539 5010672 6475525 6544471 6627549 - * 6786276 7066203 7085757 8008577 8030696 8170840 8255086 + * 6786276 7066203 7085757 8008577 8030696 8170840 8255086 8263202 * @summary test Locales * @library /java/text/testlib * @modules jdk.localedata - * @run main/othervm -Djava.locale.providers=JRE,SPI LocaleTest + * @run main/othervm -Djava.locale.providers=COMPAT,SPI LocaleTest + * @run main/othervm -Djava.locale.providers=COMPAT,SPI -Djava.locale.useOldISOCodes=true LocaleTest */ /* * @@ -677,7 +678,7 @@ public void TestUninstalledISO3Names() { } /** - * @bug 4052404 4778440 + * @bug 4052404 4778440 8263202 */ public void TestChangedISO639Codes() { Locale hebrewOld = new Locale("iw", "IL", ""); @@ -687,18 +688,34 @@ public void TestChangedISO639Codes() { Locale indonesianOld = new Locale("in", "", ""); Locale indonesianNew = new Locale("id", "", ""); - if (!hebrewNew.getLanguage().equals("iw")) { - errln("Got back wrong language code for Hebrew: expected \"iw\", got \"" - + hebrewNew.getLanguage() + "\""); - } - if (!yiddishNew.getLanguage().equals("ji")) { - errln("Got back wrong language code for Yiddish: expected \"ji\", got \"" - + yiddishNew.getLanguage() + "\""); - } - if (!indonesianNew.getLanguage().equals("in")) { - errln("Got back wrong language code for Indonesian: expected \"in\", got \"" - + indonesianNew.getLanguage() + "\""); + if ("true".equalsIgnoreCase(System.getProperty("java.locale.useOldISOCodes"))) { + if (!hebrewNew.getLanguage().equals("iw")) { + errln("Got back wrong language code for new Hebrew: expected \"iw\", got \"" + + hebrewNew.getLanguage() + "\""); + } + if (!yiddishNew.getLanguage().equals("ji")) { + errln("Got back wrong language code for new Yiddish: expected \"ji\", got \"" + + yiddishNew.getLanguage() + "\""); + } + if (!indonesianNew.getLanguage().equals("in")) { + errln("Got back wrong language code for new Indonesian: expected \"in\", got \"" + + indonesianNew.getLanguage() + "\""); + } + } else { + if (!hebrewOld.getLanguage().equals("he")) { + errln("Got back wrong language code for old Hebrew: expected \"he\", got \"" + + hebrewNew.getLanguage() + "\""); + } + if (!yiddishOld.getLanguage().equals("yi")) { + errln("Got back wrong language code for old Yiddish: expected \"yi\", got \"" + + yiddishNew.getLanguage() + "\""); + } + if (!indonesianOld.getLanguage().equals("id")) { + errln("Got back wrong language code for old Indonesian: expected \"id\", got \"" + + indonesianNew.getLanguage() + "\""); + } } + } /** diff --git a/test/jdk/java/util/Properties/LoadAndStoreXML.java b/test/jdk/java/util/Properties/LoadAndStoreXML.java index 2fcf0060454..943983a5609 100644 --- a/test/jdk/java/util/Properties/LoadAndStoreXML.java +++ b/test/jdk/java/util/Properties/LoadAndStoreXML.java @@ -25,6 +25,7 @@ * @test * @bug 8000354 8000685 8004371 8043119 * @summary Basic test of storeToXML and loadToXML + * @run main/othervm -Djava.security.manager=allow LoadAndStoreXML */ import java.io.ByteArrayInputStream; diff --git a/test/jdk/java/util/ResourceBundle/Bug6359330.java b/test/jdk/java/util/ResourceBundle/Bug6359330.java index 8dd31ad0cb5..0fedadfcf3b 100644 --- a/test/jdk/java/util/ResourceBundle/Bug6359330.java +++ b/test/jdk/java/util/ResourceBundle/Bug6359330.java @@ -27,7 +27,7 @@ * with a security manager when instantialing RBClassLoader (internal * classloader). * @modules java.xml - * @run main/othervm Bug6359330 + * @run main/othervm -Djava.security.manager=allow Bug6359330 */ import javax.xml.parsers.SAXParser; diff --git a/test/jdk/java/util/ResourceBundle/modules/ModuleTestUtil.java b/test/jdk/java/util/ResourceBundle/modules/ModuleTestUtil.java index 29b25e6ae4f..1d8bdbb89db 100644 --- a/test/jdk/java/util/ResourceBundle/modules/ModuleTestUtil.java +++ b/test/jdk/java/util/ResourceBundle/modules/ModuleTestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -188,4 +188,31 @@ public static void runModuleWithCp(String cp, String mp, String mn, } } } + + /** + * Run the module test with "useOldISOCodes=true". + * + * @param mp module path + * @param mn module name + * @param localeList locale list + */ + public static void runModuleWithLegacyCode(String mp, String mn, List localeList) + throws Throwable { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java"); + launcher.addToolArg("-ea") + .addToolArg("-esa") + .addToolArg("-Djava.locale.useOldISOCodes=true") + .addToolArg("-p") + .addToolArg(mp) + .addToolArg("-m") + .addToolArg(mn); + localeList.forEach(launcher::addToolArg); + + int exitCode = ProcessTools.executeCommand(launcher.getCommand()) + .getExitValue(); + if (exitCode != 0) { + throw new RuntimeException("Execution of the test failed. " + + "Unexpected exit code: " + exitCode); + } + } } \ No newline at end of file diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java index 29c01a58092..69f0db83258 100644 --- a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8044767 8139067 8210408 + * @bug 8044767 8139067 8210408 8263202 * @summary Basic tests for ResourceBundle with modules: * 1) Named module "test" contains resource bundles for root and en, * and separate named modules "eubundles" and "asiabundles" contain @@ -82,7 +82,7 @@ public class BasicTest { private static final List LOCALE_LIST = List.of("de", "fr", "ja", "zh-tw", "en", "de"); private static final List LOCALE_LIST_BASIC = List.of("de", "fr", - "ja", "ja-jp", "zh-tw", "en", "de", "ja-jp"); + "ja", "ja-jp", "zh-tw", "en", "de", "ja-jp", "in", "yi"); private static final List MODULE_LIST = List.of("asiabundles", "eubundles", "test"); @@ -130,6 +130,7 @@ public void runBasicTest(String src, String mod, List moduleList, moduleList.forEach(mn -> ModuleTestUtil.prepareModule(srcPath, modPath, mn, resFormat)); ModuleTestUtil.runModule(modPath.toString(), MAIN, localeList); + ModuleTestUtil.runModuleWithLegacyCode(modPath.toString(), MAIN, localeList); } @Test diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java index f14ace513e6..61c68441726 100644 --- a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResourcesAsia.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -33,6 +33,6 @@ public class MyResourcesAsia extends MyResourcesProvider { public MyResourcesAsia() { super("java.properties", "asia", Locale.JAPANESE, Locale.JAPAN, Locale.CHINESE, Locale.TAIWAN, - new Locale("vi")); + new Locale("vi"), new Locale("in")); } } diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_id.properties b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_id.properties new file mode 100644 index 00000000000..a3bfe1a3d72 --- /dev/null +++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/asiabundles/jdk/test/resources/asia/MyResources_id.properties @@ -0,0 +1,24 @@ +# +# Copyright (c) 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. +# + +key=id: message diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java index 6a5048aa81a..462c1804c33 100644 --- a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResourcesEU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,6 +32,6 @@ public class MyResourcesEU extends MyResourcesProvider { public MyResourcesEU() { super("java.class", "eu", - Locale.GERMAN, Locale.FRENCH, new Locale("es")); + Locale.GERMAN, Locale.FRENCH, new Locale("es"), new Locale("yi")); } } diff --git a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/MyRMI.java b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResources_ji.java similarity index 69% rename from test/jdk/java/rmi/activation/Activatable/checkAnnotations/MyRMI.java rename to test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResources_ji.java index a3ac272a58b..0b381ae7c80 100644 --- a/test/jdk/java/rmi/activation/Activatable/checkAnnotations/MyRMI.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/eubundles/jdk/test/resources/eu/MyResources_ji.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 @@ -21,13 +21,17 @@ * questions. */ -/** - * - */ -import java.rmi.Remote; -import java.rmi.RemoteException; -interface MyRMI extends java.rmi.Remote { - public void printOut(String toPrint) throws RemoteException; - public void printErr(String toPrint) throws RemoteException; - public void shutdown() throws Exception; +package jdk.test.resources.eu; + +import java.util.ListResourceBundle; + +public class MyResources_ji extends ListResourceBundle { + @Override + public Object[][] getContents() { + return new Object[][] { + // returned value is compared with Locale.toLanguageTag() + // which always returns NEW code + { "key", "yi: message" } + }; + } } diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/jdk/test/Main.java b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/jdk/test/Main.java index 65388e7066f..974fa88f36a 100644 --- a/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/jdk/test/Main.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcBasic/test/jdk/test/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -39,7 +39,7 @@ public static void main(String[] args) throws Exception { locale); String tag = locale.toLanguageTag(); // normalized String value = rb.getString("key"); - System.out.println("locale = " + tag + ", value = " + value); + System.out.println("locale = " + locale + ", value = " + value); if (!value.startsWith(tag + ':')) { errors++; } diff --git a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java index 5f654b99938..5655eb5de2d 100644 --- a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java +++ b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -87,7 +87,6 @@ public void loadCacheFirst() throws Exception { assertTrue(executeTestJava("--class-path", MODS_DIR.resolve(TEST_MODULE).toString(), "--module-path", MODS_DIR.resolve(MAIN_BUNDLES_MODULE).toString(), "--add-modules", MAIN_BUNDLES_MODULE, - "--illegal-access=deny", MAIN_CLASS, "cache") .outputTo(System.out) .errorTo(System.out) @@ -110,7 +109,6 @@ public void loadNonExistentBundleInCache() throws Exception { assertTrue(executeTestJava("--class-path", MODS_DIR.resolve(TEST_MODULE).toString(), "--module-path", MODS_DIR.resolve(MAIN_BUNDLES_MODULE).toString(), "--add-modules", MAIN_BUNDLES_MODULE, - "--illegal-access=deny", MAIN_CLASS) .outputTo(System.out) .errorTo(System.out) diff --git a/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java b/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java index e85fd7d1933..5a5755146bc 100644 --- a/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java +++ b/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java @@ -71,6 +71,7 @@ public void compileAll() throws Exception { public void runTest() throws Exception { int exitValue = executeTestJava("--module-path", MODS_DIR.toString(), "--add-modules", "m1", + "-Djava.security.manager=allow", "-m", "test/jdk.test.Main") .outputTo(System.out) .errorTo(System.out) diff --git a/test/jdk/java/util/ServiceLoader/security/SecurityTest.java b/test/jdk/java/util/ServiceLoader/security/SecurityTest.java index 5a680355277..e959e3efa2a 100644 --- a/test/jdk/java/util/ServiceLoader/security/SecurityTest.java +++ b/test/jdk/java/util/ServiceLoader/security/SecurityTest.java @@ -24,6 +24,6 @@ /** * @test * @build test/* - * @run testng/othervm test/p.Tests + * @run testng/othervm -Djava.security.manager=allow test/p.Tests * @summary Tests to exercise ServiceLoader with a security manager */ diff --git a/test/jdk/java/util/Spliterator/IteratorFromSpliteratorTest.java b/test/jdk/java/util/Spliterator/IteratorFromSpliteratorTest.java new file mode 100644 index 00000000000..fbc06bb90e2 --- /dev/null +++ b/test/jdk/java/util/Spliterator/IteratorFromSpliteratorTest.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 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. + */ + +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.PrimitiveIterator; +import java.util.Spliterators; +import java.util.function.DoubleConsumer; +import java.util.function.IntConsumer; +import java.util.function.LongConsumer; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertThrows; +import static org.testng.Assert.fail; + +/** + * @test + * @summary Spliterator.iterator traversing tests + * @library /lib/testlibrary/bootlib + * @run testng IteratorFromSpliteratorTest + * @bug 8267452 + */ +public class IteratorFromSpliteratorTest { + @Test + public void testIteratorFromSpliterator() { + List input = List.of(1, 2, 3, 4, 5); + for (int i = 0; i < input.size(); i++) { + Iterator iterator = Spliterators.iterator(input.spliterator()); + List result = new ArrayList<>(); + int j = i; + while (j++ < input.size() && iterator.hasNext()) { + result.add(iterator.next()); + } + // While SpliteratorTraversingAndSplittingTest tests some scenarios with Spliterators.iterator + // it always wraps the resulting iterator into spliterator again, and this limits the use patterns. + // In particular, calling hasNext() right before forEachRemaining() is not tested. + // Here we cover such a scenario. + assertEquals(iterator.hasNext(), result.size() < input.size()); + iterator.forEachRemaining(result::add); + iterator.forEachRemaining(x -> fail("Should not be called")); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, iterator::next); + iterator.forEachRemaining(x -> fail("Should not be called")); + assertEquals(result, input); + } + } + + @Test + public void testIteratorFromSpliteratorInt() { + int[] input = {1, 2, 3, 4, 5}; + for (int i = 0; i < input.length; i++) { + PrimitiveIterator.OfInt iterator = Spliterators.iterator(Arrays.spliterator(input)); + List result = new ArrayList<>(); + int j = i; + while (j++ < input.length && iterator.hasNext()) { + result.add(iterator.nextInt()); + } + assertEquals(iterator.hasNext(), result.size() < input.length); + iterator.forEachRemaining((IntConsumer) result::add); + iterator.forEachRemaining((IntConsumer) (x -> fail("Should not be called"))); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, iterator::next); + iterator.forEachRemaining((IntConsumer) (x -> fail("Should not be called"))); + assertEquals(result.stream().mapToInt(x -> x).toArray(), input); + } + } + + @Test + public void testIteratorFromSpliteratorLong() { + long[] input = {1, 2, 3, 4, 5}; + for (int i = 0; i < input.length; i++) { + PrimitiveIterator.OfLong iterator = Spliterators.iterator(Arrays.spliterator(input)); + List result = new ArrayList<>(); + int j = i; + while (j++ < input.length && iterator.hasNext()) { + result.add(iterator.nextLong()); + } + assertEquals(iterator.hasNext(), result.size() < input.length); + iterator.forEachRemaining((LongConsumer) result::add); + iterator.forEachRemaining((LongConsumer) (x -> fail("Should not be called"))); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, iterator::next); + iterator.forEachRemaining((LongConsumer) (x -> fail("Should not be called"))); + assertEquals(result.stream().mapToLong(x -> x).toArray(), input); + } + } + + @Test + public void testIteratorFromSpliteratorDouble() { + double[] input = {1, 2, 3, 4, 5}; + for (int i = 0; i < input.length; i++) { + PrimitiveIterator.OfDouble iterator = Spliterators.iterator(Arrays.spliterator(input)); + List result = new ArrayList<>(); + int j = i; + while (j++ < input.length && iterator.hasNext()) { + result.add(iterator.nextDouble()); + } + assertEquals(iterator.hasNext(), result.size() < input.length); + iterator.forEachRemaining((DoubleConsumer) result::add); + iterator.forEachRemaining((DoubleConsumer) (x -> fail("Should not be called"))); + assertFalse(iterator.hasNext()); + assertThrows(NoSuchElementException.class, iterator::next); + iterator.forEachRemaining((DoubleConsumer) (x -> fail("Should not be called"))); + assertEquals(result.stream().mapToDouble(x -> x).toArray(), input); + } + } + + @Test + public void testIteratorFromSpliteratorEmpty() { + Iterator[] iterators = { + Spliterators.iterator(Spliterators.emptySpliterator()), + Spliterators.iterator(Spliterators.emptyIntSpliterator()), + Spliterators.iterator(Spliterators.emptyLongSpliterator()), + Spliterators.iterator(Spliterators.emptyDoubleSpliterator()) + }; + for (Iterator iterator : iterators) { + iterator.forEachRemaining(x -> fail("Should not be called")); + assertFalse(iterator.hasNext()); + iterator.forEachRemaining(x -> fail("Should not be called")); + assertThrows(NoSuchElementException.class, iterator::next); + } + } +} diff --git a/test/jdk/java/util/TimeZone/Bug6912560.java b/test/jdk/java/util/TimeZone/Bug6912560.java index d289e61158e..524d754fd7d 100644 --- a/test/jdk/java/util/TimeZone/Bug6912560.java +++ b/test/jdk/java/util/TimeZone/Bug6912560.java @@ -24,7 +24,7 @@ /* * @test * @bug 6912560 - * @run main/othervm Bug6912560 + * @run main/othervm -Djava.security.manager=allow Bug6912560 * @summary Make sure that file path canonicalization in * sun.util.calendar.ZoneInfoFile works with the default security * manager. diff --git a/test/jdk/java/util/TimeZone/SetDefaultSecurityTest.java b/test/jdk/java/util/TimeZone/SetDefaultSecurityTest.java index d87752adb0e..8bf97f129c7 100644 --- a/test/jdk/java/util/TimeZone/SetDefaultSecurityTest.java +++ b/test/jdk/java/util/TimeZone/SetDefaultSecurityTest.java @@ -26,7 +26,7 @@ * @bug 8001029 * @summary Make sure that TimeZone.setDefault throws a SecurityException if the * security manager doesn't permit. - * @run main/othervm SetDefaultSecurityTest + * @run main/othervm -Djava.security.manager=allow SetDefaultSecurityTest */ import java.util.SimpleTimeZone; diff --git a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java index 3dd4c11ded5..fe4c980f673 100644 --- a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java +++ b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java @@ -25,7 +25,7 @@ * @test * @bug 6552961 6558429 * @summary Test privilegedCallable, privilegedCallableUsingCurrentClassLoader - * @run main/othervm PrivilegedCallables + * @run main/othervm -Djava.security.manager=allow PrivilegedCallables * @author Martin Buchholz */ diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java index 73969d46720..73338770f28 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java @@ -27,7 +27,7 @@ * @summary Test proper handling of pool state changes * @library /test/lib * @build jdk.test.lib.RandomFactory - * @run main/othervm ConfigChanges + * @run main/othervm -Djava.security.manager=allow ConfigChanges * @key randomness * @author Martin Buchholz */ diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java index f7a160741be..db2781f94eb 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java @@ -26,6 +26,7 @@ * @bug 6450200 6450205 6450207 6450211 * @summary Test proper handling of tasks that terminate abruptly * @author Martin Buchholz + * @run main/othervm -Djava.security.manager=allow ThrowingTasks */ import java.security.Permission; diff --git a/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java b/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java index bedd74e10c0..c02f2cdcaab 100644 --- a/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java +++ b/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java @@ -26,7 +26,7 @@ * @bug 7103570 8189291 * @author David Holmes * @run main/othervm AtomicUpdaters - * @run main/othervm AtomicUpdaters UseSM + * @run main/othervm -Djava.security.manager=allow AtomicUpdaters UseSM * @summary Checks the (in)ability to create field updaters for differently * accessible fields in different locations with/without a security * manager diff --git a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java index 1a5904832f8..95a03dae221 100644 --- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java +++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java @@ -41,21 +41,24 @@ * while others also test implementation details. * @build * * @modules java.management - * @run junit/othervm/timeout=1000 JSR166TestCase + * @run junit/othervm/timeout=1000 -Djava.security.manager=allow JSR166TestCase * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED * --add-opens java.base/java.lang=ALL-UNNAMED + * -Djava.security.manager=allow * -Djsr166.testImplementationDetails=true * JSR166TestCase * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED * --add-opens java.base/java.lang=ALL-UNNAMED + * -Djava.security.manager=allow * -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 + * -Djava.security.manager=allow * -Djsr166.testImplementationDetails=true * -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 * -Djava.util.secureRandomSeed=true diff --git a/test/jdk/java/util/logging/AnonymousLogger/TestAnonymousLogger.java b/test/jdk/java/util/logging/AnonymousLogger/TestAnonymousLogger.java index 8d4e528fd33..6bc4f1ad895 100644 --- a/test/jdk/java/util/logging/AnonymousLogger/TestAnonymousLogger.java +++ b/test/jdk/java/util/logging/AnonymousLogger/TestAnonymousLogger.java @@ -39,7 +39,7 @@ * @summary checks that anonymous logger setters work as expected when a * security manager is set, and checks that getters return expected * values. - * @run main/othervm TestAnonymousLogger + * @run main/othervm -Djava.security.manager=allow TestAnonymousLogger */ public class TestAnonymousLogger { diff --git a/test/jdk/java/util/logging/FileHandlerLongLimit.java b/test/jdk/java/util/logging/FileHandlerLongLimit.java index 169732d2663..0cd836508a6 100644 --- a/test/jdk/java/util/logging/FileHandlerLongLimit.java +++ b/test/jdk/java/util/logging/FileHandlerLongLimit.java @@ -54,7 +54,7 @@ * @summary tests that FileHandler can accept a long limit. * @modules java.logging/java.util.logging:open * @run main/othervm FileHandlerLongLimit UNSECURE - * @run main/othervm FileHandlerLongLimit SECURE + * @run main/othervm -Djava.security.manager=allow FileHandlerLongLimit SECURE * @author danielfuchs * @key randomness */ diff --git a/test/jdk/java/util/logging/FileHandlerPath.java b/test/jdk/java/util/logging/FileHandlerPath.java index 0d97dbf573e..f5466097f3f 100644 --- a/test/jdk/java/util/logging/FileHandlerPath.java +++ b/test/jdk/java/util/logging/FileHandlerPath.java @@ -54,7 +54,7 @@ * @summary tests that using a simple (non composite) pattern does not lead * to NPE when the lock file already exists. * @run main/othervm FileHandlerPath UNSECURE - * @run main/othervm FileHandlerPath SECURE + * @run main/othervm -Djava.security.manager=allow FileHandlerPath SECURE * @author danielfuchs * @key randomness */ diff --git a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java index e9714162412..7fa901d4037 100644 --- a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java +++ b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java @@ -47,7 +47,7 @@ * @bug 8025690 * @summary tests that an empty or null pattern always result in an exception. * @run main/othervm FileHandlerPatternExceptions UNSECURE - * @run main/othervm FileHandlerPatternExceptions SECURE + * @run main/othervm -Djava.security.manager=allow FileHandlerPatternExceptions SECURE * @author danielfuchs * @key randomness */ diff --git a/test/jdk/java/util/logging/HandlersConfigTest.java b/test/jdk/java/util/logging/HandlersConfigTest.java index 705c451db9f..5a6e24e265a 100644 --- a/test/jdk/java/util/logging/HandlersConfigTest.java +++ b/test/jdk/java/util/logging/HandlersConfigTest.java @@ -29,8 +29,8 @@ * as specified in javadoc and that no special * logging permission is required for instantiating them. * @modules java.logging/java.util.logging:open - * @run main/othervm HandlersConfigTest default - * @run main/othervm HandlersConfigTest configured + * @run main/othervm -Djava.security.manager=allow HandlersConfigTest default + * @run main/othervm -Djava.security.manager=allow HandlersConfigTest configured */ import java.io.IOException; diff --git a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java index b99b6a96ac5..f7356cde64b 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java @@ -57,7 +57,7 @@ * @summary tests that FileHandlers configured on abstract nodes in logging.properties * will be closed by reset(). * @run main/othervm ParentLoggerWithHandlerGC UNSECURE - * @run main/othervm ParentLoggerWithHandlerGC SECURE + * @run main/othervm -Djava.security.manager=allow ParentLoggerWithHandlerGC SECURE * @author danielfuchs * @key randomness */ diff --git a/test/jdk/java/util/logging/LogManager/Configuration/TestConfigurationLock.java b/test/jdk/java/util/logging/LogManager/Configuration/TestConfigurationLock.java index 04ef1f2788d..455febb7a64 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/TestConfigurationLock.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/TestConfigurationLock.java @@ -48,7 +48,7 @@ * todo: add at randomness * @modules java.logging * java.management - * @run main/othervm TestConfigurationLock + * @run main/othervm -Djava.security.manager=allow TestConfigurationLock * @author danielfuchs */ // This test is a best effort to try & detect issues. The test itself will run diff --git a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java index ad9993ba944..f0796bed901 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java @@ -59,7 +59,7 @@ * suddenly appears in the hierarchy between a child logger and the * root logger. * @run main/othervm HandlersOnComplexResetUpdate UNSECURE - * @run main/othervm HandlersOnComplexResetUpdate SECURE + * @run main/othervm -Djava.security.manager=allow HandlersOnComplexResetUpdate SECURE * @author danielfuchs */ public class HandlersOnComplexResetUpdate { diff --git a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java index 079d3a44f1d..a8d3240b976 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java @@ -59,7 +59,7 @@ * suddenly appears in the hierarchy between a child logger and the * root logger. * @run main/othervm HandlersOnComplexUpdate UNSECURE - * @run main/othervm HandlersOnComplexUpdate SECURE + * @run main/othervm -Djava.security.manager=allow HandlersOnComplexUpdate SECURE * @author danielfuchs */ public class HandlersOnComplexUpdate { diff --git a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java index c8d59c1593e..8c8bc35c24a 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java @@ -53,7 +53,7 @@ * @bug 8033661 8189291 * @summary tests LogManager.updateConfiguration(InputStream, Function) method * @run main/othervm SimpleUpdateConfigWithInputStreamTest UNSECURE - * @run main/othervm SimpleUpdateConfigWithInputStreamTest SECURE + * @run main/othervm -Djava.security.manager=allow SimpleUpdateConfigWithInputStreamTest SECURE * @author danielfuchs */ public class SimpleUpdateConfigWithInputStreamTest { diff --git a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java index ecf7d34880c..0a19d769917 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java @@ -56,7 +56,7 @@ * @bug 8033661 * @summary tests LogManager.updateConfiguration(Function) method * @run main/othervm SimpleUpdateConfigurationTest UNSECURE - * @run main/othervm SimpleUpdateConfigurationTest SECURE + * @run main/othervm -Djava.security.manager=allow SimpleUpdateConfigurationTest SECURE * @author danielfuchs */ public class SimpleUpdateConfigurationTest { diff --git a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/UpdateConfigurationTest.java b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/UpdateConfigurationTest.java index cc01fa08470..629ff10ee1f 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/UpdateConfigurationTest.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/UpdateConfigurationTest.java @@ -63,7 +63,7 @@ * @summary tests LogManager.updateConfiguration(bin) * @modules java.logging/java.util.logging:open * @run main/othervm UpdateConfigurationTest UNSECURE - * @run main/othervm UpdateConfigurationTest SECURE + * @run main/othervm -Djava.security.manager=allow UpdateConfigurationTest SECURE * @author danielfuchs */ public class UpdateConfigurationTest { diff --git a/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java b/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java index 437c863f2aa..8f2a0f2cba4 100644 --- a/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java +++ b/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java @@ -38,7 +38,7 @@ * @modules java.base/sun.util.logging * java.logging * @build TestRootLoggerLevel - * @run main/othervm -Dtest.security=on TestRootLoggerLevel + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestRootLoggerLevel * @run main/othervm -Dtest.security=off TestRootLoggerLevel * @author danielfuchs */ diff --git a/test/jdk/java/util/logging/Logger/getLogger/TestLogger.java b/test/jdk/java/util/logging/Logger/getLogger/TestLogger.java index cf6abc449dd..814f453f3d5 100644 --- a/test/jdk/java/util/logging/Logger/getLogger/TestLogger.java +++ b/test/jdk/java/util/logging/Logger/getLogger/TestLogger.java @@ -29,7 +29,7 @@ * @bug 8005899 * @build TestLogger testlogger.MyResource * @run main/othervm TestLogger - * @run main/othervm -Dsecurity=on TestLogger + * @run main/othervm -Djava.security.manager=allow -Dsecurity=on TestLogger **/ public class TestLogger { diff --git a/test/jdk/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java b/test/jdk/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java index 0dba92132bb..cf57efe1f89 100644 --- a/test/jdk/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java +++ b/test/jdk/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java @@ -43,8 +43,8 @@ * @summary tests Logger.setResourceBundle; * @build TestSetResourceBundle resources.ListBundle resources.ListBundle_fr * @run main/othervm TestSetResourceBundle UNSECURE - * @run main/othervm TestSetResourceBundle PERMISSION - * @run main/othervm TestSetResourceBundle SECURE + * @run main/othervm -Djava.security.manager=allow TestSetResourceBundle PERMISSION + * @run main/othervm -Djava.security.manager=allow TestSetResourceBundle SECURE * @author danielfuchs */ public class TestSetResourceBundle { diff --git a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java index 35401f8bdd9..5ffba8250ac 100644 --- a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java +++ b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java @@ -44,7 +44,7 @@ * configuration file does work. * @modules java.base/jdk.internal.access * java.logging - * @run main/othervm RootLevelInConfigFile + * @run main/othervm -Djava.security.manager=allow RootLevelInConfigFile * * @author danielfuchs */ diff --git a/test/jdk/java/util/logging/SystemLoggerConfigTest.java b/test/jdk/java/util/logging/SystemLoggerConfigTest.java index 501e3124bce..20fe38248c4 100644 --- a/test/jdk/java/util/logging/SystemLoggerConfigTest.java +++ b/test/jdk/java/util/logging/SystemLoggerConfigTest.java @@ -50,7 +50,7 @@ * @summary Tests configuration of loggers. * @modules java.logging/sun.util.logging.internal java.base/sun.util.logging * @run main/othervm SystemLoggerConfigTest NOSECURITY - * @run main/othervm SystemLoggerConfigTest WITHSECURITY + * @run main/othervm -Djava.security.manager=allow SystemLoggerConfigTest WITHSECURITY * * @author danielfuchs */ diff --git a/test/jdk/java/util/logging/TestAppletLoggerContext.java b/test/jdk/java/util/logging/TestAppletLoggerContext.java index 6ca2a63de59..6fbe975b5e4 100644 --- a/test/jdk/java/util/logging/TestAppletLoggerContext.java +++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java @@ -45,25 +45,25 @@ * @modules java.base/jdk.internal.access * java.logging * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet - * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext LoadingApplet * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain - * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingMain + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext LoadingMain * @run main/othervm -Dtest.security=off TestAppletLoggerContext One - * @run main/othervm -Dtest.security=on TestAppletLoggerContext One + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext One * @run main/othervm -Dtest.security=off TestAppletLoggerContext Two - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Two + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Two * @run main/othervm -Dtest.security=off TestAppletLoggerContext Three - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Three + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Three * @run main/othervm -Dtest.security=off TestAppletLoggerContext Four - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Four + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Four * @run main/othervm -Dtest.security=off TestAppletLoggerContext Five - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Five + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Five * @run main/othervm -Dtest.security=off TestAppletLoggerContext Six - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Six + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Six * @run main/othervm -Dtest.security=off TestAppletLoggerContext Seven - * @run main/othervm -Dtest.security=on TestAppletLoggerContext Seven + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext Seven * @run main/othervm -Dtest.security=off TestAppletLoggerContext - * @run main/othervm -Dtest.security=on TestAppletLoggerContext + * @run main/othervm -Djava.security.manager=allow -Dtest.security=on TestAppletLoggerContext */ // NOTE: We run in other VM in order to 1. switch security manager and 2. cause diff --git a/test/jdk/java/util/logging/TestConfigurationListeners.java b/test/jdk/java/util/logging/TestConfigurationListeners.java index ccdbdc9d78e..b9712b203a3 100644 --- a/test/jdk/java/util/logging/TestConfigurationListeners.java +++ b/test/jdk/java/util/logging/TestConfigurationListeners.java @@ -48,8 +48,8 @@ * LogManager.removeConfigurationListener; * @build TestConfigurationListeners * @run main/othervm TestConfigurationListeners UNSECURE - * @run main/othervm TestConfigurationListeners PERMISSION - * @run main/othervm TestConfigurationListeners SECURE + * @run main/othervm -Djava.security.manager=allow TestConfigurationListeners PERMISSION + * @run main/othervm -Djava.security.manager=allow TestConfigurationListeners SECURE * @author danielfuchs */ public class TestConfigurationListeners { diff --git a/test/jdk/java/util/logging/TestGetLoggerNPE.java b/test/jdk/java/util/logging/TestGetLoggerNPE.java index cde2c458a5f..bc204e8241c 100644 --- a/test/jdk/java/util/logging/TestGetLoggerNPE.java +++ b/test/jdk/java/util/logging/TestGetLoggerNPE.java @@ -38,8 +38,8 @@ * @modules java.base/jdk.internal.access * java.logging * @build TestGetLoggerNPE - * @run main/othervm TestGetLoggerNPE getLogger - * @run main/othervm TestGetLoggerNPE getLogManager + * @run main/othervm -Djava.security.manager=allow TestGetLoggerNPE getLogger + * @run main/othervm -Djava.security.manager=allow TestGetLoggerNPE getLogManager */ public class TestGetLoggerNPE { static volatile Throwable thrown = null; diff --git a/test/jdk/java/util/logging/TestLogConfigurationDeadLock.java b/test/jdk/java/util/logging/TestLogConfigurationDeadLock.java index 9679e03f6f5..3327b88d54b 100644 --- a/test/jdk/java/util/logging/TestLogConfigurationDeadLock.java +++ b/test/jdk/java/util/logging/TestLogConfigurationDeadLock.java @@ -40,7 +40,7 @@ * drainLoggerRefQueueBounded / readConfiguration * @modules java.logging * java.management - * @run main/othervm TestLogConfigurationDeadLock + * @run main/othervm -Djava.security.manager=allow TestLogConfigurationDeadLock * @author danielfuchs */ // This test is a best effort to try & detect issues. The test itself will run diff --git a/test/jdk/java/util/logging/TestLogConfigurationDeadLockWithConf.java b/test/jdk/java/util/logging/TestLogConfigurationDeadLockWithConf.java index 5ec160ae807..a7d4c67e349 100644 --- a/test/jdk/java/util/logging/TestLogConfigurationDeadLockWithConf.java +++ b/test/jdk/java/util/logging/TestLogConfigurationDeadLockWithConf.java @@ -46,7 +46,7 @@ * caused by synchronization issues in Logger and LogManager. * @modules java.logging * java.management - * @run main/othervm TestLogConfigurationDeadLockWithConf + * @run main/othervm -Djava.security.manager=allow TestLogConfigurationDeadLockWithConf * @author danielfuchs * @key randomness */ diff --git a/test/jdk/java/util/logging/TestLoggerBundleSync.java b/test/jdk/java/util/logging/TestLoggerBundleSync.java index 757e4f66a8b..6374ef4d261 100644 --- a/test/jdk/java/util/logging/TestLoggerBundleSync.java +++ b/test/jdk/java/util/logging/TestLoggerBundleSync.java @@ -55,7 +55,7 @@ * reproduce intermittent issues can be a good idea. * @modules java.logging * java.management - * @run main/othervm TestLoggerBundleSync + * @run main/othervm -Djava.security.manager=allow TestLoggerBundleSync * @author danielfuchs */ public class TestLoggerBundleSync { diff --git a/test/jdk/java/util/logging/TestLoggingWithMainAppContext.java b/test/jdk/java/util/logging/TestLoggingWithMainAppContext.java index fe42bd4b41e..c2c3ea8712f 100644 --- a/test/jdk/java/util/logging/TestLoggingWithMainAppContext.java +++ b/test/jdk/java/util/logging/TestLoggingWithMainAppContext.java @@ -33,7 +33,7 @@ * VM mode: it would not test the intended behavior. * @modules java.desktop * java.logging - * @run main/othervm TestLoggingWithMainAppContext + * @run main/othervm -Djava.security.manager=allow TestLoggingWithMainAppContext */ public class TestLoggingWithMainAppContext { diff --git a/test/jdk/java/util/logging/TestMainAppContext.java b/test/jdk/java/util/logging/TestMainAppContext.java index bde3ef26430..49f371aa321 100644 --- a/test/jdk/java/util/logging/TestMainAppContext.java +++ b/test/jdk/java/util/logging/TestMainAppContext.java @@ -33,7 +33,7 @@ * @modules java.desktop/sun.awt * java.logging * @build TestMainAppContext - * @run main/othervm TestMainAppContext + * @run main/othervm -Djava.security.manager=allow TestMainAppContext * @author danielfuchs */ public class TestMainAppContext { diff --git a/test/jdk/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java b/test/jdk/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java index 9f4ad590b95..ff0a7954af4 100644 --- a/test/jdk/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java +++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java @@ -28,7 +28,7 @@ * @build test/* * @build com.foo.UserControlProvider * @run main/othervm UserDefaultControlTest false - * @run main/othervm UserDefaultControlTest true + * @run main/othervm -Djava.security.manager=allow UserDefaultControlTest true */ import java.io.*; diff --git a/test/jdk/java/util/spi/ToolProviderTest.java b/test/jdk/java/util/spi/ToolProviderTest.java index 9a337bc6ce2..b47d4c25aa2 100644 --- a/test/jdk/java/util/spi/ToolProviderTest.java +++ b/test/jdk/java/util/spi/ToolProviderTest.java @@ -25,7 +25,7 @@ * @test * @bug 8159855 * @summary test ToolProvider SPI - * @run main/othervm ToolProviderTest + * @run main/othervm -Djava.security.manager=allow ToolProviderTest */ import java.io.IOException; diff --git a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java index f626152e0f1..313690fa3f0 100644 --- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java +++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -24,13 +24,14 @@ /** * @test * @summary Tests counting of streams - * @bug 8031187 8067969 8075307 + * @bug 8031187 8067969 8075307 8265029 */ package org.openjdk.tests.java.util.stream; import java.util.HashSet; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.DoubleStream; import java.util.stream.DoubleStreamTestDataProvider; @@ -56,6 +57,11 @@ public void testOps(String name, TestData.OfRef data) { expectedResult(expectedCount). exercise(); + withData(data). + terminal(s -> s.skip(1), Stream::count). + expectedResult(Math.max(0, expectedCount - 1)). + exercise(); + // Test with an unknown sized stream withData(data). terminal(s -> s.filter(e -> true), Stream::count). @@ -91,6 +97,11 @@ public void testOps(String name, TestData.OfInt data) { expectedResult(expectedCount). exercise(); + withData(data). + terminal(s -> s.skip(1), IntStream::count). + expectedResult(Math.max(0, expectedCount - 1)). + exercise(); + withData(data). terminal(s -> s.filter(e -> true), IntStream::count). expectedResult(expectedCount). @@ -116,6 +127,11 @@ public void testOps(String name, TestData.OfLong data) { expectedResult(expectedCount). exercise(); + withData(data). + terminal(s -> s.skip(1), LongStream::count). + expectedResult(Math.max(0, expectedCount - 1)). + exercise(); + withData(data). terminal(s -> s.filter(e -> true), LongStream::count). expectedResult(expectedCount). @@ -141,6 +157,11 @@ public void testOps(String name, TestData.OfDouble data) { expectedResult(expectedCount). exercise(); + withData(data). + terminal(s -> s.skip(1), DoubleStream::count). + expectedResult(Math.max(0, expectedCount - 1)). + exercise(); + withData(data). terminal(s -> s.filter(e -> true), DoubleStream::count). expectedResult(expectedCount). @@ -157,41 +178,51 @@ public void testOps(String name, TestData.OfDouble data) { exercise(); } + @Test public void testNoEvaluationForSizedStream() { - { - AtomicInteger ai = new AtomicInteger(); - Stream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).count(); - assertEquals(ai.get(), 0); - - Stream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).parallel().count(); - assertEquals(ai.get(), 0); - } - - { - AtomicInteger ai = new AtomicInteger(); - IntStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).count(); - assertEquals(ai.get(), 0); - - IntStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).parallel().count(); - assertEquals(ai.get(), 0); - } - - { - AtomicInteger ai = new AtomicInteger(); - LongStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).count(); - assertEquals(ai.get(), 0); - - LongStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).parallel().count(); - assertEquals(ai.get(), 0); - } - - { - AtomicInteger ai = new AtomicInteger(); - DoubleStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).count(); - assertEquals(ai.get(), 0); - - DoubleStream.of(1, 2, 3, 4).peek(e -> ai.getAndIncrement()).parallel().count(); - assertEquals(ai.get(), 0); - } + checkStreamDoesNotConsumeElements(() -> Stream.of(1, 2, 3, 4), 4); + checkStreamDoesNotConsumeElements(() -> Stream.of(1, 2, 3, 4).skip(1).limit(2).skip(1), 1); + checkIntStreamDoesNotConsumeElements(() -> IntStream.of(1, 2, 3, 4), 4); + checkIntStreamDoesNotConsumeElements(() -> IntStream.of(1, 2, 3, 4).skip(1).limit(2).skip(1), 1); + checkLongStreamDoesNotConsumeElements(() -> LongStream.of(1, 2, 3, 4), 4); + checkLongStreamDoesNotConsumeElements(() -> LongStream.of(1, 2, 3, 4).skip(1).limit(2).skip(1), 1); + checkDoubleStreamDoesNotConsumeElements(() -> DoubleStream.of(1, 2, 3, 4), 4); + checkDoubleStreamDoesNotConsumeElements(() -> DoubleStream.of(1, 2, 3, 4).skip(1).limit(2).skip(1), 1); + } + + private void checkStreamDoesNotConsumeElements(Supplier> supplier, long expectedCount) { + AtomicInteger ai = new AtomicInteger(); + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).count(), expectedCount); + assertEquals(ai.get(), 0); + + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).parallel().count(), expectedCount); + assertEquals(ai.get(), 0); + } + + private void checkIntStreamDoesNotConsumeElements(Supplier supplier, long expectedCount) { + AtomicInteger ai = new AtomicInteger(); + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).count(), expectedCount); + assertEquals(ai.get(), 0); + + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).parallel().count(), expectedCount); + assertEquals(ai.get(), 0); + } + + private void checkLongStreamDoesNotConsumeElements(Supplier supplier, long expectedCount) { + AtomicInteger ai = new AtomicInteger(); + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).count(), expectedCount); + assertEquals(ai.get(), 0); + + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).parallel().count(), expectedCount); + assertEquals(ai.get(), 0); + } + + private void checkDoubleStreamDoesNotConsumeElements(Supplier supplier, long expectedCount) { + AtomicInteger ai = new AtomicInteger(); + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).count(), expectedCount); + assertEquals(ai.get(), 0); + + assertEquals(supplier.get().peek(e -> ai.getAndIncrement()).parallel().count(), expectedCount); + assertEquals(ai.get(), 0); } } diff --git a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java index c43b3deed68..f555fb287f3 100644 --- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java +++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8148250 + * @bug 8148250 8265029 */ package org.openjdk.tests.java.util.stream; @@ -356,4 +356,26 @@ public void testLimitParallelHugeInput() { assertEquals(LongStream.range(0, n).toArray(), actual); } } + + public void testSliceOpsSpliteratorPreservesSized() { + var parSpliterator = IntStream.range(0, 1000).parallel().skip(50).limit(800).spliterator(); + assertTrue(parSpliterator.hasCharacteristics(Spliterator.SIZED)); + assertTrue(parSpliterator.hasCharacteristics(Spliterator.SUBSIZED)); + assertEquals(parSpliterator.getExactSizeIfKnown(), 800); + // Original spliterator is split to [0..499] and [500..999] parts + // due to skip+limit, we have [50..499] and [500..849] + var prefix = parSpliterator.trySplit(); + assertNotNull(prefix); + assertTrue(parSpliterator.hasCharacteristics(Spliterator.SIZED)); + assertTrue(parSpliterator.hasCharacteristics(Spliterator.SUBSIZED)); + assertEquals(parSpliterator.getExactSizeIfKnown(), 350); + assertTrue(prefix.hasCharacteristics(Spliterator.SIZED)); + assertTrue(prefix.hasCharacteristics(Spliterator.SUBSIZED)); + assertEquals(prefix.getExactSizeIfKnown(), 450); + + var seqSpliterator = IntStream.range(0, 1000).skip(50).limit(800).spliterator(); + assertTrue(seqSpliterator.hasCharacteristics(Spliterator.SIZED)); + assertTrue(seqSpliterator.hasCharacteristics(Spliterator.SUBSIZED)); + assertEquals(seqSpliterator.getExactSizeIfKnown(), 800); + } } diff --git a/test/jdk/javax/imageio/CachePremissionsTest/CachePermissionsTest.java b/test/jdk/javax/imageio/CachePremissionsTest/CachePermissionsTest.java index c101f9d1780..c64b171a5ef 100644 --- a/test/jdk/javax/imageio/CachePremissionsTest/CachePermissionsTest.java +++ b/test/jdk/javax/imageio/CachePremissionsTest/CachePermissionsTest.java @@ -50,9 +50,9 @@ * -Djava.security.debug=access can be used to verify file permissions. * * @run main CachePermissionsTest true - * @run main/othervm CachePermissionsTest false w.policy - * @run main/othervm CachePermissionsTest false rw.policy - * @run main/othervm CachePermissionsTest true rwd.policy + * @run main/othervm -Djava.security.manager=allow CachePermissionsTest false w.policy + * @run main/othervm -Djava.security.manager=allow CachePermissionsTest false rw.policy + * @run main/othervm -Djava.security.manager=allow CachePermissionsTest true rwd.policy */ import java.io.File; diff --git a/test/jdk/javax/management/Introspector/AnnotationSecurityTest.java b/test/jdk/javax/management/Introspector/AnnotationSecurityTest.java index 43b466fbdf6..f71427fd994 100644 --- a/test/jdk/javax/management/Introspector/AnnotationSecurityTest.java +++ b/test/jdk/javax/management/Introspector/AnnotationSecurityTest.java @@ -35,7 +35,7 @@ * UnDescribedMBean SqeDescriptorKey DescribedMX DescribedMXBean * @run build AnnotationSecurityTest Described UnDescribed DescribedMBean * UnDescribedMBean SqeDescriptorKey DescribedMX DescribedMXBean - * @run main/othervm AnnotationSecurityTest + * @run main/othervm -Djava.security.manager=allow AnnotationSecurityTest */ // -Djava.security.debug=access,domain,policy diff --git a/test/jdk/javax/management/remote/mandatory/loading/RMIDownloadTest.java b/test/jdk/javax/management/remote/mandatory/loading/RMIDownloadTest.java index c757baeaaca..d702a78ad72 100644 --- a/test/jdk/javax/management/remote/mandatory/loading/RMIDownloadTest.java +++ b/test/jdk/javax/management/remote/mandatory/loading/RMIDownloadTest.java @@ -27,10 +27,10 @@ * @summary Check that class downloading is supported by RMI connector * @author Eamonn McManus * - * @run main RMIDownloadTest receive without - * @run main RMIDownloadTest send without - * @run main RMIDownloadTest receive with - * @run main RMIDownloadTest send with + * @run main/othervm -Djava.security.manager=allow RMIDownloadTest receive without + * @run main/othervm -Djava.security.manager=allow RMIDownloadTest send without + * @run main/othervm -Djava.security.manager=allow RMIDownloadTest receive with + * @run main/othervm -Djava.security.manager=allow RMIDownloadTest send with */ /* diff --git a/test/jdk/javax/management/remote/mandatory/notif/NoPermToRemoveTest.java b/test/jdk/javax/management/remote/mandatory/notif/NoPermToRemoveTest.java index 1af316f1b50..b965c72250f 100644 --- a/test/jdk/javax/management/remote/mandatory/notif/NoPermToRemoveTest.java +++ b/test/jdk/javax/management/remote/mandatory/notif/NoPermToRemoveTest.java @@ -27,7 +27,7 @@ * @summary checks the behaviour of mbeanServerConnection.removeNotificationListener * operation when there is a exception thrown during removal * @modules java.management - * @run main NoPermToRemoveTest + * @run main/othervm -Djava.security.manager=allow NoPermToRemoveTest */ import java.lang.management.ManagementFactory; diff --git a/test/jdk/javax/management/remote/mandatory/notif/NotificationEmissionTest.java b/test/jdk/javax/management/remote/mandatory/notif/NotificationEmissionTest.java index a54030d4c3e..a4c57005853 100644 --- a/test/jdk/javax/management/remote/mandatory/notif/NotificationEmissionTest.java +++ b/test/jdk/javax/management/remote/mandatory/notif/NotificationEmissionTest.java @@ -32,10 +32,10 @@ * @run clean NotificationEmissionTest * @run build NotificationEmissionTest * @run main NotificationEmissionTest 1 - * @run main NotificationEmissionTest 2 - * @run main NotificationEmissionTest 3 - * @run main NotificationEmissionTest 4 - * @run main NotificationEmissionTest 5 + * @run main/othervm -Djava.security.manager=allow NotificationEmissionTest 2 + * @run main/othervm -Djava.security.manager=allow NotificationEmissionTest 3 + * @run main/othervm -Djava.security.manager=allow NotificationEmissionTest 4 + * @run main/othervm -Djava.security.manager=allow NotificationEmissionTest 5 */ import java.io.File; diff --git a/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java b/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java index 4e03de3c107..4eb09595781 100644 --- a/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java +++ b/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java @@ -31,11 +31,11 @@ * java.management/com.sun.jmx.remote.security * @run clean SubjectDelegation2Test SimpleStandard SimpleStandardMBean * @run build SubjectDelegation2Test SimpleStandard SimpleStandardMBean - * @run main SubjectDelegation2Test policy21 ok - * @run main SubjectDelegation2Test policy22 ko - * @run main SubjectDelegation2Test policy23 ko - * @run main SubjectDelegation2Test policy24 ok - * @run main SubjectDelegation2Test policy25 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation2Test policy21 ok + * @run main/othervm -Djava.security.manager=allow SubjectDelegation2Test policy22 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation2Test policy23 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation2Test policy24 ok + * @run main/othervm -Djava.security.manager=allow SubjectDelegation2Test policy25 ko */ import com.sun.jmx.remote.security.JMXPluggableAuthenticator; diff --git a/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java b/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java index b999c9ebdf5..aacd62f7f82 100644 --- a/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java +++ b/test/jdk/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java @@ -32,11 +32,11 @@ * java.management/com.sun.jmx.remote.security * @run clean SubjectDelegation3Test SimpleStandard SimpleStandardMBean * @run build SubjectDelegation3Test SimpleStandard SimpleStandardMBean - * @run main SubjectDelegation3Test policy31 ok - * @run main SubjectDelegation3Test policy32 ko - * @run main SubjectDelegation3Test policy33 ko - * @run main SubjectDelegation3Test policy34 ok - * @run main SubjectDelegation3Test policy35 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation3Test policy31 ok + * @run main/othervm -Djava.security.manager=allow SubjectDelegation3Test policy32 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation3Test policy33 ko + * @run main/othervm -Djava.security.manager=allow SubjectDelegation3Test policy34 ok + * @run main/othervm -Djava.security.manager=allow SubjectDelegation3Test policy35 ko */ import com.sun.jmx.remote.security.JMXPluggableAuthenticator; diff --git a/test/jdk/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java b/test/jdk/javax/sql/permissionTests/SyncFactoryPermissionsTests.java similarity index 95% rename from test/jdk/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java rename to test/jdk/javax/sql/permissionTests/SyncFactoryPermissionsTests.java index 970d678f8db..6433e3e21c9 100644 --- a/test/jdk/javax/sql/testng/test/rowset/spi/SyncFactoryPermissionsTests.java +++ b/test/jdk/javax/sql/permissionTests/SyncFactoryPermissionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -20,8 +20,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package test.rowset.spi; - import java.security.AccessControlException; import java.security.Policy; import java.util.logging.Level; @@ -35,7 +33,13 @@ import util.BaseTest; import util.StubContext; import util.TestPolicy; - +/* + * @test + * @library /java/sql/testng + * @library /javax/sql/testng + * @run testng/othervm -Djava.security.manager=allow SyncFactoryPermissionsTests + * @summary Tests SyncFactory permissions. + */ public class SyncFactoryPermissionsTests extends BaseTest { Context ctx; diff --git a/test/jdk/javax/swing/JComboBox/8080972/TestBasicComboBoxEditor.java b/test/jdk/javax/swing/JComboBox/8080972/TestBasicComboBoxEditor.java index 205aecc9d87..2fb2391116a 100644 --- a/test/jdk/javax/swing/JComboBox/8080972/TestBasicComboBoxEditor.java +++ b/test/jdk/javax/swing/JComboBox/8080972/TestBasicComboBoxEditor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,6 +26,7 @@ /* * @test * @bug 8080972 + * @run main/othervm -Djava.security.manager=allow TestBasicComboBoxEditor * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy diff --git a/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java b/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java index dab2e69a48d..21ea57ab8d0 100644 --- a/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java +++ b/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -25,8 +25,8 @@ @bug 5076514 8025430 8198321 @summary Tests if SecurityManager.checkPermission() used for clipboard access with permission 'accessClipboard' - @run main bug5076514 - @run main/othervm -Djava.awt.headless=true bug5076514 + @run main/othervm -Djava.security.manager=allow bug5076514 + @run main/othervm -Djava.security.manager=allow -Djava.awt.headless=true bug5076514 */ import java.awt.GraphicsEnvironment; diff --git a/test/jdk/javax/swing/JEditorPane/8080972/TestJEditor.java b/test/jdk/javax/swing/JEditorPane/8080972/TestJEditor.java index 6d9a396aa0c..6c3a0d80b2e 100644 --- a/test/jdk/javax/swing/JEditorPane/8080972/TestJEditor.java +++ b/test/jdk/javax/swing/JEditorPane/8080972/TestJEditor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -40,7 +40,7 @@ * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy - * @run main/othervm TestJEditor + * @run main/othervm -Djava.security.manager=allow TestJEditor */ public class TestJEditor { diff --git a/test/jdk/javax/swing/JFileChooser/6484091/bug6484091.java b/test/jdk/javax/swing/JFileChooser/6484091/bug6484091.java index fa379d10fff..51cd8d04093 100644 --- a/test/jdk/javax/swing/JFileChooser/6484091/bug6484091.java +++ b/test/jdk/javax/swing/JFileChooser/6484091/bug6484091.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -25,7 +25,7 @@ * @bug 6484091 * @summary FileSystemView leaks directory info * @author Pavel Porvatov - @run main bug6484091 + @run main/othervm -Djava.security.manager=allow bug6484091 */ import javax.swing.filechooser.FileSystemView; diff --git a/test/jdk/javax/swing/JFileChooser/6570445/bug6570445.java b/test/jdk/javax/swing/JFileChooser/6570445/bug6570445.java index 554c5a44609..c5ed2b7365c 100644 --- a/test/jdk/javax/swing/JFileChooser/6570445/bug6570445.java +++ b/test/jdk/javax/swing/JFileChooser/6570445/bug6570445.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -24,6 +24,7 @@ /* * @test * @bug 6570445 + * @run main/othervm -Djava.security.manager=allow bug6570445 * @summary Checks if Win32ShellFolder2's COM-using methods work under a security manager * @author Leonid Popov */ diff --git a/test/jdk/javax/swing/JFileChooser/FileSystemView/SystemIconTest.java b/test/jdk/javax/swing/JFileChooser/FileSystemView/SystemIconTest.java new file mode 100644 index 00000000000..aeb3b09c3dd --- /dev/null +++ b/test/jdk/javax/swing/JFileChooser/FileSystemView/SystemIconTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 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 8182043 + * @summary Access to Windows Large Icons + * @run main SystemIconTest + */ +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.filechooser.FileSystemView; +import java.awt.image.MultiResolutionImage; +import java.io.File; + +public class SystemIconTest { + static final FileSystemView fsv = FileSystemView.getFileSystemView(); + + public static void main(String[] args) { + testSystemIcon(); + negativeTests(); + } + + static void testSystemIcon() { + String os = System.getProperty("os.name"); + if (os.startsWith("Windows")) { + String windir = System.getenv("windir"); + testSystemIcon(new File(windir), true); + testSystemIcon(new File(windir + "/explorer.exe"), + true); + } else { + String homedir = System.getProperty("user.home"); + testSystemIcon(new File(homedir), false); + } + } + + static void negativeTests() { + Icon icon; + try { + icon = fsv.getSystemIcon(new File("."), -1, 16); + throw new RuntimeException("Negative size icon should throw invalid argument exception"); + } catch (IllegalArgumentException iae) { + // Expected + } + + icon = fsv.getSystemIcon(new File("thereisdefinitelynosuchfile.why"), + 16, 16); + if (icon != null) { + throw new RuntimeException("Icons for files with invalid names should be null"); + } + } + + static void testSystemIcon(File file, boolean implComplete) { + int[] sizes = new int[] {16, 32, 48, 64, 128}; + for (int size : sizes) { + ImageIcon icon = (ImageIcon) fsv.getSystemIcon(file, size, size); + + //Enable below to see the icon + //JLabel label = new JLabel(icon); + //JOptionPane.showMessageDialog(null, label); + + if (icon == null) { + throw new RuntimeException("icon is null!!!"); + } + + if (implComplete && icon.getIconWidth() != size) { + throw new RuntimeException("Wrong icon size " + + icon.getIconWidth() + " when requested " + size); + } + + if (icon.getImage() instanceof MultiResolutionImage) { + MultiResolutionImage mri = (MultiResolutionImage) icon.getImage(); + if (mri.getResolutionVariant(size, size) == null) { + throw new RuntimeException("There is no suitable variant for the size " + + size + " in the multi resolution icon"); + } + } else { + if (implComplete) { + throw new RuntimeException("icon is supposed to be multi-resolution but it is not"); + } + } + } + } +} diff --git a/test/jdk/javax/swing/JFormattedTextField/8080972/TestDefaultFormatter.java b/test/jdk/javax/swing/JFormattedTextField/8080972/TestDefaultFormatter.java index eabb0265c95..c912079f6e8 100644 --- a/test/jdk/javax/swing/JFormattedTextField/8080972/TestDefaultFormatter.java +++ b/test/jdk/javax/swing/JFormattedTextField/8080972/TestDefaultFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,6 +26,7 @@ /* * @test * @bug 8080972 + * @run main/othervm -Djava.security.manager=allow TestDefaultFormatter * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy diff --git a/test/jdk/javax/swing/JOptionPane/8081019/bug8081019.java b/test/jdk/javax/swing/JOptionPane/8081019/bug8081019.java index 95e968d2a0c..2e86cc34cdc 100644 --- a/test/jdk/javax/swing/JOptionPane/8081019/bug8081019.java +++ b/test/jdk/javax/swing/JOptionPane/8081019/bug8081019.java @@ -68,7 +68,7 @@ private static void runTest() throws Exception { private static void runProcess() throws Exception { String javaPath = System.getProperty("java.home", ""); String command = javaPath + File.separator + "bin" + File.separator + "java" - + " " + bug8081019.class.getName() + " " + RUN_TEST; + + " -Djava.security.manager=allow " + bug8081019.class.getName() + " " + RUN_TEST; Process process = Runtime.getRuntime().exec(command); boolean processExit = process.waitFor(20, TimeUnit.SECONDS); diff --git a/test/jdk/javax/swing/JPopupMenu/6675802/bug6675802.java b/test/jdk/javax/swing/JPopupMenu/6675802/bug6675802.java index 5fa7c9eaeb9..849e1f82034 100644 --- a/test/jdk/javax/swing/JPopupMenu/6675802/bug6675802.java +++ b/test/jdk/javax/swing/JPopupMenu/6675802/bug6675802.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -27,7 +27,7 @@ * @summary Checks that there is no AccessControlException when * a heaviweight popup menu is shown from an applet. * @author Mikhail Lapshin - * @run main bug6675802 + * @run main/othervm -Djava.security.manager=allow bug6675802 */ import javax.swing.*; diff --git a/test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java b/test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java index f6f3d9746ac..e8dc909084b 100644 --- a/test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java +++ b/test/jdk/javax/swing/JPopupMenu/6691503/bug6691503.java @@ -29,7 +29,7 @@ * to show a popup menu which has whole screen size. * a heaviweight popup menu is shown from an applet. * @author Mikhail Lapshin - * @run main bug6691503 + * @run main/othervm -Djava.security.manager=allow bug6691503 */ import javax.swing.*; diff --git a/test/jdk/javax/swing/JPopupMenu/6694823/bug6694823.java b/test/jdk/javax/swing/JPopupMenu/6694823/bug6694823.java index 949878e54eb..8cded311045 100644 --- a/test/jdk/javax/swing/JPopupMenu/6694823/bug6694823.java +++ b/test/jdk/javax/swing/JPopupMenu/6694823/bug6694823.java @@ -28,7 +28,7 @@ * @summary Checks that popup menu cannot be partially hidden * by the task bar in applets. * @author Mikhail Lapshin - * @run main bug6694823 + * @run main/othervm -Djava.security.manager=allow bug6694823 */ import javax.swing.*; diff --git a/test/jdk/javax/swing/JTable/8080972/TestJTableCellEditor.java b/test/jdk/javax/swing/JTable/8080972/TestJTableCellEditor.java index 592044a4ea3..e6ad98ba927 100644 --- a/test/jdk/javax/swing/JTable/8080972/TestJTableCellEditor.java +++ b/test/jdk/javax/swing/JTable/8080972/TestJTableCellEditor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,6 +27,8 @@ /* * @test * @bug 8080972 + * @run main/othervm -Djava.security.manager=allow TestJTableCellEditor + * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy diff --git a/test/jdk/javax/swing/UIDefaults/6622002/bug6622002.java b/test/jdk/javax/swing/UIDefaults/6622002/bug6622002.java index 25d4f626d2d..a872f4c4a11 100644 --- a/test/jdk/javax/swing/UIDefaults/6622002/bug6622002.java +++ b/test/jdk/javax/swing/UIDefaults/6622002/bug6622002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -26,7 +26,7 @@ * @bug 6622002 * @author Alexander Potochkin * @summary UIDefault.ProxyLazyValue has unsafe reflection usage - * @run main/othervm bug6622002 + * @run main/othervm -Djava.security.manager=allow bug6622002 */ import javax.swing.*; diff --git a/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java b/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java index bcafb38a676..234ec6a7187 100644 --- a/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java +++ b/test/jdk/javax/swing/UIDefaults/6795356/TableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -26,7 +26,7 @@ * @bug 6795356 * @summary Checks that SwingLazyValue class works correctly * @author Alexander Potochkin - * @run main/othervm TableTest + * @run main/othervm -Djava.security.manager=allow TableTest */ import javax.swing.*; diff --git a/test/jdk/javax/swing/UIDefaults/8080972/TestProxyLazyValue.java b/test/jdk/javax/swing/UIDefaults/8080972/TestProxyLazyValue.java index 73a2d4cc865..cef4ce41bcb 100644 --- a/test/jdk/javax/swing/UIDefaults/8080972/TestProxyLazyValue.java +++ b/test/jdk/javax/swing/UIDefaults/8080972/TestProxyLazyValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -28,7 +28,7 @@ * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy - * @run main/othervm TestProxyLazyValue + * @run main/othervm -Djava.security.manager=allow TestProxyLazyValue */ public class TestProxyLazyValue { diff --git a/test/jdk/javax/swing/dnd/8080972/TestTransferHandler.java b/test/jdk/javax/swing/dnd/8080972/TestTransferHandler.java index a7cf675c482..78d6879a9bf 100644 --- a/test/jdk/javax/swing/dnd/8080972/TestTransferHandler.java +++ b/test/jdk/javax/swing/dnd/8080972/TestTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -28,6 +28,7 @@ /* * @test * @bug 8080972 + * @run main/othervm -Djava.security.manager=allow TestTransferHandler * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy diff --git a/test/jdk/javax/swing/plaf/nimbus/8080972/TestAbstractRegionPainter.java b/test/jdk/javax/swing/plaf/nimbus/8080972/TestAbstractRegionPainter.java index f2b18724d23..ee0abaab166 100644 --- a/test/jdk/javax/swing/plaf/nimbus/8080972/TestAbstractRegionPainter.java +++ b/test/jdk/javax/swing/plaf/nimbus/8080972/TestAbstractRegionPainter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -28,6 +28,7 @@ /* * @test * @bug 8080972 + * @run main/othervm -Djava.security.manager=allow TestAbstractRegionPainter * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy diff --git a/test/jdk/javax/swing/plaf/synth/Test8043627.java b/test/jdk/javax/swing/plaf/synth/Test8043627.java index 2a36634a5fd..03ca4928f40 100644 --- a/test/jdk/javax/swing/plaf/synth/Test8043627.java +++ b/test/jdk/javax/swing/plaf/synth/Test8043627.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -27,6 +27,7 @@ /* * @test * @bug 8043627 + * @run main/othervm -Djava.security.manager=allow Test8043627 * @summary Tests that SynthContext can be created with SecurityManager installed * @author Sergey Malenkov */ diff --git a/test/jdk/javax/swing/text/View/8080972/TestObjectView.java b/test/jdk/javax/swing/text/View/8080972/TestObjectView.java index a2e72391a0a..03b9dfa1b43 100644 --- a/test/jdk/javax/swing/text/View/8080972/TestObjectView.java +++ b/test/jdk/javax/swing/text/View/8080972/TestObjectView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -36,7 +36,7 @@ * @summary Audit Core Reflection in module java.desktop for places that will * require changes to work with modules * @author Alexander Scherbatiy - * @run main/othervm TestObjectView + * @run main/othervm -Djava.security.manager=allow TestObjectView */ public class TestObjectView { diff --git a/test/jdk/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java b/test/jdk/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java index ca3be869c4d..98c0182a144 100644 --- a/test/jdk/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java +++ b/test/jdk/javax/xml/crypto/dsig/SecurityManager/XMLDSigWithSecMgr.java @@ -26,7 +26,7 @@ * @bug 6436919 6460930 * @summary check that XML Signatures can be generated and validated with * SecurityManager enabled and default policy - * @run main/othervm XMLDSigWithSecMgr + * @run main/othervm -Djava.security.manager=allow XMLDSigWithSecMgr * @author Sean Mullan */ import java.io.*; diff --git a/test/jdk/javax/xml/jaxp/transform/8004476/XPathExFuncTest.java b/test/jdk/javax/xml/jaxp/transform/8004476/XPathExFuncTest.java index 5680067037a..bf254f6d33a 100644 --- a/test/jdk/javax/xml/jaxp/transform/8004476/XPathExFuncTest.java +++ b/test/jdk/javax/xml/jaxp/transform/8004476/XPathExFuncTest.java @@ -24,7 +24,7 @@ * @test * @bug 8004476 * @summary test XPath extension functions - * @run main/othervm XPathExFuncTest + * @run main/othervm -Djava.security.manager=allow XPathExFuncTest */ import java.io.FileInputStream; import java.io.InputStream; diff --git a/test/jdk/javax/xml/jaxp/transform/8004476/XSLTExFuncTest.java b/test/jdk/javax/xml/jaxp/transform/8004476/XSLTExFuncTest.java index b86bcff4900..9a72cbe1a55 100644 --- a/test/jdk/javax/xml/jaxp/transform/8004476/XSLTExFuncTest.java +++ b/test/jdk/javax/xml/jaxp/transform/8004476/XSLTExFuncTest.java @@ -24,7 +24,7 @@ * @test * @bug 8004476 * @summary test XSLT extension functions - * @run main/othervm XSLTExFuncTest + * @run main/othervm -Djava.security.manager=allow XSLTExFuncTest */ import java.io.StringWriter; diff --git a/test/jdk/jdk/internal/jrtfs/WithSecurityManager.java b/test/jdk/jdk/internal/jrtfs/WithSecurityManager.java index d982300be2a..8078fbc495a 100644 --- a/test/jdk/jdk/internal/jrtfs/WithSecurityManager.java +++ b/test/jdk/jdk/internal/jrtfs/WithSecurityManager.java @@ -23,8 +23,8 @@ /** * @test - * @run main/othervm WithSecurityManager allow - * @run main/othervm WithSecurityManager deny + * @run main/othervm -Djava.security.manager=allow WithSecurityManager allow + * @run main/othervm -Djava.security.manager=allow WithSecurityManager deny */ import java.net.URI; diff --git a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java index 8e6614372e5..b3fc51f047d 100644 --- a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java +++ b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -68,7 +68,7 @@ public static void main(String... args) throws Exception { Class clz = recordClassDefinition(firstClassLoader); JVM jvm = JVM.getJVM(); // we will now tag the defined and loaded clz as being in use (no recordings are running here) - jvm.getClassIdNonIntrinsic(clz); + jvm.getClassId(clz); // null out for unload to occur firstClassLoader = null; clz = null; diff --git a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java index b50f0b10d43..c63ee3320c3 100644 --- a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java +++ b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java @@ -59,24 +59,20 @@ public class TestJFRIntrinsic { public Object eventWriter; public static void main(String... args) throws Exception { - /* - Temporarily excluded until getClassId is reworked to accommodate epoch shift tagging + JVM.getJVM().createNativeJFR(); + TestJFRIntrinsic ti = new TestJFRIntrinsic(); Method classid = TestJFRIntrinsic.class.getDeclaredMethod("getClassIdIntrinsic", Class.class); ti.runIntrinsicTest(classid); - */ - TestJFRIntrinsic ti = new TestJFRIntrinsic(); Method eventWriterMethod = TestJFRIntrinsic.class.getDeclaredMethod("getEventWriterIntrinsic", Class.class); ti.runIntrinsicTest(eventWriterMethod); } - /* public void getClassIdIntrinsic(Class cls) { long exp = JVM.getClassId(cls); if (exp == 0) { throw new RuntimeException("Class id is zero"); } } - */ public void getEventWriterIntrinsic(Class cls) { Object o = JVM.getEventWriter(); diff --git a/test/jdk/jdk/modules/open/Basic.java b/test/jdk/jdk/modules/open/Basic.java index ade1fe3ec86..30101a34aa7 100644 --- a/test/jdk/jdk/modules/open/Basic.java +++ b/test/jdk/jdk/modules/open/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -25,7 +25,7 @@ * @test * @library modules * @build m1/* m2/* - * @run testng/othervm --add-modules=m1,m2 --illegal-access=deny Basic + * @run testng/othervm --add-modules=m1,m2 Basic * @summary Basic test of open modules and open packages */ diff --git a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java index 0892e8a5a7f..b7b4edc8c98 100644 --- a/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java +++ b/test/jdk/sun/management/PlatformMBeanProviderConstructorCheck.java @@ -33,6 +33,7 @@ * @summary Check permission for PlatformMBeanProvider Constructor * @modules java.management/sun.management.spi * @author Shanliang Jiang + * @run main/othervm -Djava.security.manager=allow PlatformMBeanProviderConstructorCheck */ public class PlatformMBeanProviderConstructorCheck { public static void main(String[] args) throws Exception { diff --git a/test/jdk/sun/net/www/protocol/jrt/WithSecurityManager.java b/test/jdk/sun/net/www/protocol/jrt/WithSecurityManager.java index 97f1105fde8..4a00dd206db 100644 --- a/test/jdk/sun/net/www/protocol/jrt/WithSecurityManager.java +++ b/test/jdk/sun/net/www/protocol/jrt/WithSecurityManager.java @@ -24,8 +24,8 @@ /** * @test * @summary Test that the jimage protocol handler works with a security manager - * @run main/othervm WithSecurityManager allow - * @run main/othervm WithSecurityManager deny + * @run main/othervm -Djava.security.manager=allow WithSecurityManager allow + * @run main/othervm -Djava.security.manager=allow WithSecurityManager deny */ import java.io.InputStream; diff --git a/test/jdk/sun/nio/cs/TestSJIS0213_SM.java b/test/jdk/sun/nio/cs/TestSJIS0213_SM.java index fe85d4e4635..ef61fbc3382 100644 --- a/test/jdk/sun/nio/cs/TestSJIS0213_SM.java +++ b/test/jdk/sun/nio/cs/TestSJIS0213_SM.java @@ -25,6 +25,7 @@ * @bug 7152690 * @summary Initialize SJIS_0213 charset with SecurityManager enabled * @modules jdk.charsets + * @run main/othervm -Djava.security.manager=allow TestSJIS0213_SM */ public class TestSJIS0213_SM { public static void main(String[] args) throws Throwable { diff --git a/test/jdk/sun/nio/cs/TestStringCoding.java b/test/jdk/sun/nio/cs/TestStringCoding.java index 4dd85f490a3..efa7f75314f 100644 --- a/test/jdk/sun/nio/cs/TestStringCoding.java +++ b/test/jdk/sun/nio/cs/TestStringCoding.java @@ -25,7 +25,7 @@ * @bug 6636323 6636319 7040220 7096080 7183053 8080248 8054307 * @summary Test if StringCoding and NIO result have the same de/encoding result * @modules java.base/sun.nio.cs - * @run main/othervm/timeout=2000 TestStringCoding + * @run main/othervm/timeout=2000 -Djava.security.manager=allow TestStringCoding * @key randomness */ diff --git a/test/jdk/sun/nio/cs/TestStringCodingUTF8.java b/test/jdk/sun/nio/cs/TestStringCodingUTF8.java index ad07f19a6a3..2468ccdfc7f 100644 --- a/test/jdk/sun/nio/cs/TestStringCodingUTF8.java +++ b/test/jdk/sun/nio/cs/TestStringCodingUTF8.java @@ -24,7 +24,7 @@ /* @test @bug 7040220 8054307 @summary Test if StringCoding and NIO result have the same de/encoding result for UTF-8 - * @run main/othervm/timeout=2000 TestStringCodingUTF8 + * @run main/othervm/timeout=2000 -Djava.security.manager=allow TestStringCodingUTF8 * @key randomness */ diff --git a/test/jdk/sun/rmi/runtime/Log/checkLogging/CheckLogging.java b/test/jdk/sun/rmi/runtime/Log/checkLogging/CheckLogging.java index 2b3d2d5b808..b181c6996ef 100644 --- a/test/jdk/sun/rmi/runtime/Log/checkLogging/CheckLogging.java +++ b/test/jdk/sun/rmi/runtime/Log/checkLogging/CheckLogging.java @@ -33,7 +33,7 @@ * java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport.tcp * @build TestLibrary - * @run main/othervm CheckLogging + * @run main/othervm -Djava.security.manager=allow CheckLogging */ import java.util.logging.Level; diff --git a/test/jdk/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java b/test/jdk/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java index a8510df5be1..4a8748ab253 100644 --- a/test/jdk/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java +++ b/test/jdk/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java @@ -29,7 +29,7 @@ * @author Peter Jones * * @build DisableMultiplexing_Stub - * @run main/othervm DisableMultiplexing + * @run main/othervm -Djava.security.manager=allow DisableMultiplexing */ import java.rmi.*; diff --git a/test/jdk/sun/security/krb5/auto/AcceptPermissions.java b/test/jdk/sun/security/krb5/auto/AcceptPermissions.java index 00fbced1bab..172d3ede9ba 100644 --- a/test/jdk/sun/security/krb5/auto/AcceptPermissions.java +++ b/test/jdk/sun/security/krb5/auto/AcceptPermissions.java @@ -28,8 +28,8 @@ * @library /test/lib * @compile -XDignore.symbol.file AcceptPermissions.java * @run main jdk.test.lib.FileInstaller TestHosts TestHosts - * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptPermissions two - * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptPermissions unbound + * @run main/othervm -Djava.security.manager=allow -Djdk.net.hosts.file=TestHosts AcceptPermissions two + * @run main/othervm -Djava.security.manager=allow -Djdk.net.hosts.file=TestHosts AcceptPermissions unbound */ import java.nio.file.Files; diff --git a/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java b/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java index 095806d5199..fc5d1380a5c 100644 --- a/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java +++ b/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java @@ -41,7 +41,7 @@ * user cancels the first one * @library /test/lib * @run main jdk.test.lib.FileInstaller TestHosts TestHosts - * @run main/othervm -Djdk.net.hosts.file=TestHosts HttpNegotiateServer + * @run main/othervm -Djava.security.manager=allow -Djdk.net.hosts.file=TestHosts HttpNegotiateServer */ import com.sun.net.httpserver.Headers; diff --git a/test/jdk/sun/security/krb5/auto/KeyPermissions.java b/test/jdk/sun/security/krb5/auto/KeyPermissions.java index 70d8f1c66f6..89f034db809 100644 --- a/test/jdk/sun/security/krb5/auto/KeyPermissions.java +++ b/test/jdk/sun/security/krb5/auto/KeyPermissions.java @@ -28,7 +28,7 @@ * @library /test/lib * @compile -XDignore.symbol.file KeyPermissions.java * @run main jdk.test.lib.FileInstaller TestHosts TestHosts - * @run main/othervm -Djdk.net.hosts.file=TestHosts KeyPermissions + * @run main/othervm -Djava.security.manager=allow -Djdk.net.hosts.file=TestHosts KeyPermissions */ import java.security.AccessControlException; diff --git a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java index c4e2b4b8ba9..da547da752b 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm ReinitCipher - * @run main/othervm ReinitCipher sm + * @run main/othervm -Djava.security.manager=allow ReinitCipher sm */ import java.security.Provider; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java b/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java index a2db21317dd..d192526bf4b 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestPKCS5PaddingError - * @run main/othervm TestPKCS5PaddingError sm + * @run main/othervm -Djava.security.manager=allow TestPKCS5PaddingError sm */ import java.security.AlgorithmParameters; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java index e39fa82fb7d..233cb4e623e 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestRSACipher - * @run main/othervm TestRSACipher sm + * @run main/othervm -Djava.security.manager=allow TestRSACipher sm */ import java.security.GeneralSecurityException; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java index ceea0467c0e..7191d5baac5 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestRSACipherWrap - * @run main/othervm TestRSACipherWrap sm + * @run main/othervm -Djava.security.manager=allow TestRSACipherWrap sm */ import java.security.GeneralSecurityException; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java index c05ec217551..2991dcfa5d8 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestRawRSACipher - * @run main/othervm TestRawRSACipher sm + * @run main/othervm -Djava.security.manager=allow TestRawRSACipher sm */ import java.security.GeneralSecurityException; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java index 598d16b4b4b..2127256b5ec 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestSymmCiphers - * @run main/othervm TestSymmCiphers sm + * @run main/othervm -Djava.security.manager=allow TestSymmCiphers sm */ import java.io.ByteArrayOutputStream; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java index d5fd02e09d5..8f53cda2f6b 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestSymmCiphersNoPad - * @run main/othervm TestSymmCiphersNoPad sm + * @run main/othervm -Djava.security.manager=allow TestSymmCiphersNoPad sm */ import java.io.ByteArrayInputStream; diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java b/test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java index 9490108597c..ec6234c6bdf 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/IllegalPackageAccess.java @@ -38,7 +38,7 @@ * @test * @bug 8259319 * @library /test/lib .. - * @run main/othervm IllegalPackageAccess + * @run main/othervm -Djava.security.manager=allow IllegalPackageAccess */ public class IllegalPackageAccess extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java b/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java index b1a5d83ac76..1246e13fb23 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java @@ -28,7 +28,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm SupportedDHKeys - * @run main/othervm SupportedDHKeys sm + * @run main/othervm -Djava.security.manager=allow SupportedDHKeys sm */ import java.math.BigInteger; diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java b/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java index 765e6e93ab7..d5569f0f3cd 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestDH.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH - * @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH sm + * @run main/othervm -Djava.security.manager=allow -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH sm */ import java.security.KeyPair; diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java b/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java index 6e359196ac6..146a6505423 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestInterop.java @@ -28,7 +28,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestInterop - * @run main/othervm TestInterop sm + * @run main/othervm -Djava.security.manager=allow TestInterop sm */ import java.math.BigInteger; import java.security.KeyFactory; diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java b/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java index 29656c20f3b..0639c06b7d8 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/TestShort.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestShort - * @run main/othervm TestShort sm + * @run main/othervm -Djava.security.manager=allow TestShort sm */ import java.math.BigInteger; diff --git a/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java b/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java index 876627ebfdb..af1734dcd80 100644 --- a/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java +++ b/test/jdk/sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java @@ -28,7 +28,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm UnsupportedDHKeys - * @run main/othervm UnsupportedDHKeys sm + * @run main/othervm -Djava.security.manager=allow UnsupportedDHKeys sm */ import java.security.InvalidParameterException; diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java b/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java index 2f79646fa48..c08c224c620 100644 --- a/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/DESParity.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm DESParity - * @run main/othervm DESParity sm + * @run main/othervm -Djava.security.manager=allow DESParity sm */ import java.security.Provider; diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java b/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java index d6707028d96..14dae5feece 100644 --- a/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java @@ -28,7 +28,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm HmacDefKeySizeTest - * @run main/othervm HmacDefKeySizeTest sm + * @run main/othervm -Djava.security.manager=allow HmacDefKeySizeTest sm */ import java.security.InvalidKeyException; diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java b/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java index ae0e01e1ad5..ccf86444564 100644 --- a/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyGenerator - * @run main/othervm TestKeyGenerator sm + * @run main/othervm -Djava.security.manager=allow TestKeyGenerator sm */ import java.security.InvalidParameterException; diff --git a/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java b/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java index f3e3465fd27..f251c443c18 100644 --- a/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java +++ b/test/jdk/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestDH2048 - * @run main/othervm TestDH2048 sm + * @run main/othervm -Djava.security.manager=allow TestDH2048 sm */ import java.security.InvalidParameterException; diff --git a/test/jdk/sun/security/pkcs11/Mac/MacKAT.java b/test/jdk/sun/security/pkcs11/Mac/MacKAT.java index 70cd50e52c3..e4bed00c7ac 100644 --- a/test/jdk/sun/security/pkcs11/Mac/MacKAT.java +++ b/test/jdk/sun/security/pkcs11/Mac/MacKAT.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm MacKAT - * @run main/othervm MacKAT sm + * @run main/othervm -Djava.security.manager=allow MacKAT sm */ import java.io.UnsupportedEncodingException; diff --git a/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java b/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java index b44b2f4a5b9..f009fbb95e5 100644 --- a/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java +++ b/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm MacSameTest - * @run main/othervm MacSameTest sm + * @run main/othervm -Djava.security.manager=allow MacSameTest sm * @key randomness */ diff --git a/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java b/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java index 7e045232e3a..66fd7d88ce4 100644 --- a/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java +++ b/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm ReinitMac - * @run main/othervm ReinitMac sm + * @run main/othervm -Djava.security.manager=allow ReinitMac sm */ import java.security.Provider; diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java b/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java index 426ed33031c..16b8cced733 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/DigestKAT.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm DigestKAT - * @run main/othervm DigestKAT sm + * @run main/othervm -Djava.security.manager=allow DigestKAT sm */ import java.io.ByteArrayOutputStream; diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java b/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java index 268f698276b..7e6d38d0746 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm ReinitDigest - * @run main/othervm ReinitDigest sm + * @run main/othervm -Djava.security.manager=allow ReinitDigest sm */ import java.security.MessageDigest; diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java b/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java index ace601c7233..c37f6d3324b 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestCloning - * @run main/othervm TestCloning sm + * @run main/othervm -Djava.security.manager=allow TestCloning sm */ import java.security.MessageDigest; diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index b2135243d41..d2aadff96bd 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -690,7 +690,8 @@ private static Map getOsMap() { "/usr/lib/arm-linux-gnueabihf/nss/" }); osMap.put("Linux-aarch64-64", new String[] { "/usr/lib/aarch64-linux-gnu/", - "/usr/lib/aarch64-linux-gnu/nss/" }); + "/usr/lib/aarch64-linux-gnu/nss/", + "/usr/lib64/" }); return osMap; } diff --git a/test/jdk/sun/security/pkcs11/Provider/Login.sh b/test/jdk/sun/security/pkcs11/Provider/Login.sh index dfaccbd4c7e..a9aeb1f0ede 100644 --- a/test/jdk/sun/security/pkcs11/Provider/Login.sh +++ b/test/jdk/sun/security/pkcs11/Provider/Login.sh @@ -124,6 +124,7 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -Dtest.src=${TESTSRC} \ -Dtest.classes=${TESTCLASSES} \ -Djava.security.debug=${DEBUG} \ + -Djava.security.manager=allow \ Login sm Login.policy # save error status diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java index 4fd239150c1..ab74358fb0f 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm AddPrivateKey - * @run main/othervm AddPrivateKey sm policy + * @run main/othervm -Djava.security.manager=allow AddPrivateKey sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java index f64076c14f6..9792a80de8d 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm AddTrustedCert - * @run main/othervm AddTrustedCert sm policy + * @run main/othervm -Djava.security.manager=allow AddTrustedCert sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java index a83222951d9..d57794f1199 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java +++ b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm Crypto - * @run main/othervm Crypto sm policy + * @run main/othervm -Djava.security.manager=allow Crypto sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java index 48614bc3d7e..f9f809f0d28 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java @@ -30,7 +30,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm GetPrivateKey - * @run main/othervm GetPrivateKey sm policy + * @run main/othervm -Djava.security.manager=allow GetPrivateKey sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java index 6144853341a..1689d4c4ed9 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm JksSetPrivateKey - * @run main/othervm JksSetPrivateKey sm policy + * @run main/othervm -Djava.security.manager=allow JksSetPrivateKey sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java index 12373f3b6c5..ce9f8e9bb63 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java +++ b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java @@ -28,7 +28,7 @@ * @library /test/lib ../ * @modules jdk.crypto.cryptoki * @run main/othervm LoadKeystore - * @run main/othervm LoadKeystore sm policy + * @run main/othervm -Djava.security.manager=allow LoadKeystore sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java index 73247a2b3e9..81863f028f9 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java +++ b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TrustAnchors - * @run main/othervm TrustAnchors sm policy + * @run main/othervm -Djava.security.manager=allow TrustAnchors sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java b/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java index 381efb68942..78cd051835e 100644 --- a/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java +++ b/test/jdk/sun/security/pkcs11/SecureRandom/Basic.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm Basic - * @run main/othervm Basic sm + * @run main/othervm -Djava.security.manager=allow Basic sm */ import java.security.NoSuchAlgorithmException; diff --git a/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java b/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java index 5416b04debf..e7e1374245c 100644 --- a/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java +++ b/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm ByteBuffers - * @run main/othervm ByteBuffers sm + * @run main/othervm -Djava.security.manager=allow ByteBuffers sm */ import java.nio.ByteBuffer; diff --git a/test/jdk/sun/security/pkcs11/Signature/TestDSA.java b/test/jdk/sun/security/pkcs11/Signature/TestDSA.java index 39ca94c2f96..04fbdd00bf4 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestDSA.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSA.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestDSA - * @run main/othervm TestDSA sm + * @run main/othervm -Djava.security.manager=allow TestDSA sm */ import java.io.ByteArrayOutputStream; diff --git a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java index d591f939c25..7d0f68e4f01 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestDSAKeyLength - * @run main/othervm TestDSAKeyLength sm + * @run main/othervm -Djava.security.manager=allow TestDSAKeyLength sm */ import java.security.InvalidKeyException; diff --git a/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java b/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java index 004cb99d601..14352c358da 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestRSAKeyLength - * @run main/othervm TestRSAKeyLength sm + * @run main/othervm -Djava.security.manager=allow TestRSAKeyLength sm */ import java.security.InvalidKeyException; diff --git a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java index 6c659f470ac..4b4a6a20a4a 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java @@ -31,7 +31,7 @@ * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm ReadCertificates - * @run main/othervm ReadCertificates sm policy + * @run main/othervm -Djava.security.manager=allow ReadCertificates sm policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java index edfe9fdccaf..6005d88aec4 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java @@ -31,7 +31,7 @@ * @key randomness * @modules jdk.crypto.cryptoki jdk.crypto.ec/sun.security.ec * @run main/othervm ReadPKCS12 - * @run main/othervm ReadPKCS12 sm policy + * @run main/othervm -Djava.security.manager=allow ReadPKCS12 sm policy */ import java.io.BufferedReader; diff --git a/test/jdk/sun/security/pkcs11/ec/TestCurves.java b/test/jdk/sun/security/pkcs11/ec/TestCurves.java index 2d88e274682..e3e43b72c3d 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestCurves.java +++ b/test/jdk/sun/security/pkcs11/ec/TestCurves.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper * @run main/othervm TestCurves - * @run main/othervm TestCurves sm + * @run main/othervm -Djava.security.manager=allow TestCurves sm * @key randomness */ diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH.java b/test/jdk/sun/security/pkcs11/ec/TestECDH.java index 83d19bc9150..49061f1288d 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH.java @@ -30,7 +30,7 @@ * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm TestECDH - * @run main/othervm TestECDH sm policy + * @run main/othervm -Djava.security.manager=allow TestECDH sm policy */ import java.security.KeyFactory; diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH2.java b/test/jdk/sun/security/pkcs11/ec/TestECDH2.java index 55eeced8a02..69ea7275193 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH2.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH2.java @@ -32,7 +32,7 @@ * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDH2.java * @run main/othervm TestECDH2 - * @run main/othervm TestECDH2 sm + * @run main/othervm -Djava.security.manager=allow TestECDH2 sm */ import java.math.BigInteger; diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDSA.java b/test/jdk/sun/security/pkcs11/ec/TestECDSA.java index 7dd8904311a..59db0a3ed01 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDSA.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA.java @@ -31,7 +31,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestECDSA - * @run main/othervm TestECDSA sm policy + * @run main/othervm -Djava.security.manager=allow TestECDSA sm policy */ import java.security.KeyFactory; diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java b/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java index 92bbe83215a..4b6cb6f14ed 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java @@ -32,7 +32,7 @@ * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDSA2.java * @run main/othervm TestECDSA2 - * @run main/othervm TestECDSA2 sm + * @run main/othervm -Djava.security.manager=allow TestECDSA2 sm */ import java.math.BigInteger; diff --git a/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java b/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java index 74eca81853e..8e016f76d9b 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECGenSpec.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestECGenSpec - * @run main/othervm TestECGenSpec sm + * @run main/othervm -Djava.security.manager=allow TestECGenSpec sm */ import java.security.AlgorithmParameters; diff --git a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java index ae0c84edba6..60066f118af 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java +++ b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyFactory - * @run main/othervm TestKeyFactory sm + * @run main/othervm -Djava.security.manager=allow TestKeyFactory sm */ import java.security.Key; diff --git a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java index b2e4e31de19..9a44d8ff036 100644 --- a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java +++ b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm KeyWrap - * @run main/othervm KeyWrap sm + * @run main/othervm -Djava.security.manager=allow KeyWrap sm */ import java.security.GeneralSecurityException; diff --git a/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java b/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java index 524f36378bb..c95d27bc3d8 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java @@ -30,7 +30,7 @@ * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm TestCACerts - * @run main/othervm TestCACerts sm TestCACerts.policy + * @run main/othervm -Djava.security.manager=allow TestCACerts sm TestCACerts.policy */ // this test serves as our known answer test diff --git a/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java b/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java index d77efb0dcbf..9f9ef5dcafa 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestKeyFactory.java @@ -29,7 +29,7 @@ * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm TestKeyFactory - * @run main/othervm TestKeyFactory sm rsakeys.ks.policy + * @run main/othervm -Djava.security.manager=allow TestKeyFactory sm rsakeys.ks.policy */ import java.io.*; diff --git a/test/jdk/sun/security/pkcs11/rsa/TestKeyPairGenerator.java b/test/jdk/sun/security/pkcs11/rsa/TestKeyPairGenerator.java index 9662db995d2..62c05ad8cf6 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestKeyPairGenerator.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestKeyPairGenerator.java @@ -31,7 +31,7 @@ * @modules jdk.crypto.cryptoki * @build jdk.test.lib.RandomFactory * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator - * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator + * @run main/othervm -Djava.security.manager=allow -Djava.security.debug=sunpkcs11 TestKeyPairGenerator * sm TestKeyPairGenerator.policy * @key randomness */ diff --git a/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java b/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java index a34c6cace20..ee847c56d87 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java @@ -38,7 +38,7 @@ * @summary Also checks to ensure that sensitive RSA keys are correctly not exposed * @library /test/lib .. * @run main/othervm TestP11KeyFactoryGetRSAKeySpec - * @run main/othervm TestP11KeyFactoryGetRSAKeySpec sm rsakeys.ks.policy + * @run main/othervm -Djava.security.manager=allow TestP11KeyFactoryGetRSAKeySpec sm rsakeys.ks.policy * @run main/othervm -DCUSTOM_P11_CONFIG_NAME=p11-nss-sensitive.txt -DNO_DEIMOS=true -DNO_DEFAULT=true TestP11KeyFactoryGetRSAKeySpec * @modules jdk.crypto.cryptoki */ diff --git a/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java b/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java index 5241391d952..2e2b9efca42 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestSignatures.java @@ -30,7 +30,7 @@ * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestSignatures - * @run main/othervm TestSignatures sm rsakeys.ks.policy + * @run main/othervm -Djava.security.manager=allow TestSignatures sm rsakeys.ks.policy */ import java.io.File; diff --git a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java index 451a41c3d5b..ad69bfeb123 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java +++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java @@ -30,7 +30,7 @@ * @modules java.base/sun.security.internal.spec * jdk.crypto.cryptoki * @run main/othervm TestKeyMaterial - * @run main/othervm TestKeyMaterial sm policy + * @run main/othervm -Djava.security.manager=allow TestKeyMaterial sm policy */ import java.io.BufferedReader; diff --git a/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java b/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java index b594b3e066e..08a542b59ca 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java +++ b/test/jdk/sun/security/pkcs11/tls/TestLeadingZeroesP11.java @@ -29,7 +29,7 @@ * @author Pasi Eronen * @modules jdk.crypto.cryptoki * @run main/othervm TestLeadingZeroesP11 - * @run main/othervm TestLeadingZeroesP11 sm + * @run main/othervm -Djava.security.manager=allow TestLeadingZeroesP11 sm */ diff --git a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java index ecbb035c470..816e76697ce 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java +++ b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java @@ -31,7 +31,7 @@ * java.base/sun.security.internal.spec * jdk.crypto.cryptoki * @run main/othervm TestMasterSecret - * @run main/othervm TestMasterSecret sm TestMasterSecret.policy + * @run main/othervm -Djava.security.manager=allow TestMasterSecret sm TestMasterSecret.policy */ import java.io.BufferedReader; diff --git a/test/jdk/sun/security/pkcs11/tls/TestPRF.java b/test/jdk/sun/security/pkcs11/tls/TestPRF.java index 2bbc55552c3..d99c21d0e56 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestPRF.java +++ b/test/jdk/sun/security/pkcs11/tls/TestPRF.java @@ -30,7 +30,7 @@ * @modules java.base/sun.security.internal.spec * jdk.crypto.cryptoki * @run main/othervm TestPRF - * @run main/othervm TestPRF sm policy + * @run main/othervm -Djava.security.manager=allow TestPRF sm policy */ import java.io.BufferedReader; diff --git a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java index abd2da15e34..ebae28c996c 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java +++ b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java @@ -30,7 +30,7 @@ * @modules java.base/sun.security.internal.spec * jdk.crypto.cryptoki * @run main/othervm TestPremaster - * @run main/othervm TestPremaster sm policy + * @run main/othervm -Djava.security.manager=allow TestPremaster sm policy */ import java.security.Provider; diff --git a/test/jdk/sun/security/provider/PolicyFile/BadPolicyFile.java b/test/jdk/sun/security/provider/PolicyFile/BadPolicyFile.java index 17a4c5d8d71..a1fc10d6ef6 100644 --- a/test/jdk/sun/security/provider/PolicyFile/BadPolicyFile.java +++ b/test/jdk/sun/security/provider/PolicyFile/BadPolicyFile.java @@ -25,7 +25,7 @@ * @test * @bug 8150468 * @summary check that a badly formatted policy file is handled correctly - * @run main/othervm BadPolicyFile + * @run main/othervm -Djava.security.manager=allow BadPolicyFile */ import java.io.File; diff --git a/test/jdk/sun/security/tools/keytool/ImportToPwordlessPK12.java b/test/jdk/sun/security/tools/keytool/ImportToPwordlessPK12.java new file mode 100644 index 00000000000..26206e890a5 --- /dev/null +++ b/test/jdk/sun/security/tools/keytool/ImportToPwordlessPK12.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 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 8266400 + * @summary Test importkeystore to a password less PKCS12 keystore + * @library /test/lib + */ + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class ImportToPwordlessPK12 { + + static OutputAnalyzer kt(String cmd, String ks) throws Exception { + return SecurityTools.keytool("-storepass changeit " + cmd + + " -keystore " + ks); + } + + public static void main(String[] args) throws Exception { + + kt("-genkeypair -keyalg EC -alias testcert -dname CN=EE " + + "-storetype jks -keypass pass123 ", "ks.jks"); + + /* + * Test by setting the responses for source keystore password and + * key password for alias + */ + SecurityTools.setResponse("changeit", "pass123"); + SecurityTools.keytool("-importkeystore -srckeystore ks.jks " + + "-destkeystore ks.p12 " + + "-J-Dkeystore.pkcs12.macAlgorithm=NONE " + + "-J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE") + .shouldHaveExitValue(0); + + SecurityTools.keytool("-list -keystore ks.p12 -debug") + .shouldContain("Keystore type: PKCS12") + .shouldContain("keystore contains 1 entry") + .shouldNotContain("Enter keystore password:") + .shouldHaveExitValue(0); + + kt("-genkeypair -keyalg EC -alias testcert -dname CN=EE " + + "-storetype jks -keypass pass123 ", "ks1.jks"); + + // Test with all of options specified on command line + SecurityTools.keytool("-importkeystore -srckeystore ks1.jks " + + "-destkeystore ks1.p12 " + + "-srcstorepass changeit " + + "-srcalias testcert " + + "-srckeypass pass123 " + + "-J-Dkeystore.pkcs12.macAlgorithm=NONE " + + "-J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE") + .shouldHaveExitValue(0); + + SecurityTools.keytool("-list -keystore ks1.p12 -debug") + .shouldContain("Keystore type: PKCS12") + .shouldContain("keystore contains 1 entry") + .shouldNotContain("Enter keystore password:") + .shouldHaveExitValue(0); + } +} diff --git a/test/jdk/sun/tools/jstatd/JstatdTest.java b/test/jdk/sun/tools/jstatd/JstatdTest.java index 56c86cbfa07..c603ed1096c 100644 --- a/test/jdk/sun/tools/jstatd/JstatdTest.java +++ b/test/jdk/sun/tools/jstatd/JstatdTest.java @@ -253,6 +253,7 @@ private void cleanUpThread(ProcessThread thread) throws Throwable { private String[] getJstatdCmd() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd"); launcher.addVMArg("-XX:+UsePerfData"); + launcher.addVMArg("-Djava.security.manager=allow"); String testSrc = System.getProperty("test.src"); File policy = new File(testSrc, "all.policy"); assertTrue(policy.exists() && policy.isFile(), diff --git a/test/jdk/sun/util/locale/provider/Bug8152817.java b/test/jdk/sun/util/locale/provider/Bug8152817.java index 14363a4a1df..d08d6717276 100644 --- a/test/jdk/sun/util/locale/provider/Bug8152817.java +++ b/test/jdk/sun/util/locale/provider/Bug8152817.java @@ -27,7 +27,7 @@ * @summary Make sure that resource bundles in the jdk.localedata module are * loaded under a security manager. * @modules jdk.localedata - * @run main/othervm -Djava.locale.providers=COMPAT + * @run main/othervm -Djava.security.manager=allow -Djava.locale.providers=COMPAT * -Djava.security.debug=access,failure,codebase=jrt:/jdk.localedata Bug8152817 */ diff --git a/test/jdk/tools/jlink/SecurityTest.java b/test/jdk/tools/jlink/SecurityTest.java index 7aff0c220c7..a42eb4dbc5e 100644 --- a/test/jdk/tools/jlink/SecurityTest.java +++ b/test/jdk/tools/jlink/SecurityTest.java @@ -26,7 +26,7 @@ * @summary Test JlinkPermission * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal - * @run main/othervm SecurityTest + * @run main/othervm -Djava.security.manager=allow SecurityTest */ import java.security.AccessControlException; diff --git a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java index cd973dcbd91..336f02f6d39 100644 --- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java @@ -377,13 +377,13 @@ public class IncludeLocalesPluginTest { "--include-locales=he,id,yi", "jdk.localedata", List.of( - "/jdk.localedata/sun/text/resources/ext/FormatData_in.class", - "/jdk.localedata/sun/text/resources/ext/FormatData_in_ID.class", - "/jdk.localedata/sun/text/resources/ext/FormatData_iw.class", - "/jdk.localedata/sun/text/resources/ext/FormatData_iw_IL.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_in.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"), + "/jdk.localedata/sun/text/resources/ext/FormatData_he.class", + "/jdk.localedata/sun/text/resources/ext/FormatData_he_IL.class", + "/jdk.localedata/sun/text/resources/ext/FormatData_id.class", + "/jdk.localedata/sun/text/resources/ext/FormatData_id_ID.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_he.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_id.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_yi.class"), List.of( "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", "/jdk.localedata/sun/text/resources/ext/thai_dict", @@ -396,8 +396,8 @@ public class IncludeLocalesPluginTest { "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "in", "in_ID", - "in_ID_#Latn", "iw", "iw_IL", "iw_IL_#Hebr", "ji", "ji_001", "ji_001_#Hebr"), + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "id", "id_ID", + "id_ID_#Latn", "he", "he_IL", "he_IL_#Hebr", "yi", "yi_001", "yi_001_#Hebr"), "", }, diff --git a/test/jdk/tools/jmod/JmodTest.java b/test/jdk/tools/jmod/JmodTest.java index c867904386f..c32284faee6 100644 --- a/test/jdk/tools/jmod/JmodTest.java +++ b/test/jdk/tools/jmod/JmodTest.java @@ -98,7 +98,7 @@ public void buildExplodedModules() throws IOException { // JDK-8166286 - jmod fails on symlink to directory @Test - public void testSymlinks() throws IOException { + public void testDirSymlinks() throws IOException { Path apaDir = EXPLODED_DIR.resolve("apa"); Path classesDir = EXPLODED_DIR.resolve("apa").resolve("classes"); assertTrue(compileModule("apa", classesDir)); @@ -110,6 +110,8 @@ public void testSymlinks() throws IOException { assertTrue(Files.exists(link)); } catch (IOException|UnsupportedOperationException uoe) { // OS does not support symlinks. Nothing to test! + System.out.println("Creating symlink failed. Test passes vacuously."); + uoe.printStackTrace(); return; } @@ -119,6 +121,42 @@ public void testSymlinks() throws IOException { "--class-path", classesDir.toString(), jmod.toString()) .assertSuccess(); + Files.delete(jmod); + } + + // JDK-8267583 - jmod fails on symlink to class file + @Test + public void testFileSymlinks() throws IOException { + Path apaDir = EXPLODED_DIR.resolve("apa"); + Path classesDir = EXPLODED_DIR.resolve("apa").resolve("classes"); + assertTrue(compileModule("apa", classesDir)); + + Files.move(classesDir.resolve("module-info.class"), + classesDir.resolve("module-info.class1")); + Files.move(classesDir.resolve(Paths.get("jdk", "test", "apa", "Apa.class")), + classesDir.resolve("Apa.class1")); + try { + Path link = Files.createSymbolicLink( + classesDir.resolve("module-info.class"), + classesDir.resolve("module-info.class1").toAbsolutePath()); + assertTrue(Files.exists(link)); + link = Files.createSymbolicLink( + classesDir.resolve(Paths.get("jdk", "test", "apa", "Apa.class")), + classesDir.resolve("Apa.class1").toAbsolutePath()); + assertTrue(Files.exists(link)); + } catch (IOException|UnsupportedOperationException uoe) { + // OS does not support symlinks. Nothing to test! + System.out.println("Creating symlinks failed. Test passes vacuously."); + uoe.printStackTrace(); + return; + } + + Path jmod = MODS_DIR.resolve("apa.jmod"); + jmod("create", + "--class-path", classesDir.toString(), + jmod.toString()) + .assertSuccess(); + Files.delete(jmod); } // JDK-8170618 - jmod should validate if any exported or open package is missing diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java index 07d66532fc9..3315de374c3 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/AppImageFileTest.java b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/AppImageFileTest.java index e2b8116d980..3e5c96bbf98 100644 --- a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/AppImageFileTest.java +++ b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/AppImageFileTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -22,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; import java.io.IOException; diff --git a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ApplicationLayoutTest.java b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ApplicationLayoutTest.java index 0d8e4a1abfd..0ac704cb69a 100644 --- a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ApplicationLayoutTest.java +++ b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ApplicationLayoutTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -22,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; import java.io.IOException; diff --git a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/OverridableResourceTest.java b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/OverridableResourceTest.java index a4825c64150..55a3c22dc9a 100644 --- a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/OverridableResourceTest.java +++ b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/OverridableResourceTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -22,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; import java.io.IOException; diff --git a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/PathGroupTest.java b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/PathGroupTest.java index 09634217d0d..36c0773fbbb 100644 --- a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/PathGroupTest.java +++ b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/PathGroupTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -22,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; import java.io.IOException; diff --git a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ToolValidatorTest.java b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ToolValidatorTest.java index 3d0e2b0bb78..9667bad5591 100644 --- a/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ToolValidatorTest.java +++ b/test/jdk/tools/jpackage/junit/jdk/jpackage/internal/ToolValidatorTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -22,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; import java.nio.file.Path; diff --git a/test/jdk/tools/jpackage/junit/junit.java b/test/jdk/tools/jpackage/junit/junit.java index 1073a572078..ea6a43c616b 100644 --- a/test/jdk/tools/jpackage/junit/junit.java +++ b/test/jdk/tools/jpackage/junit/junit.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/test/jdk/tools/jpackage/junit/run_junit.sh b/test/jdk/tools/jpackage/junit/run_junit.sh index 496ac71a974..55a170f17c0 100644 --- a/test/jdk/tools/jpackage/junit/run_junit.sh +++ b/test/jdk/tools/jpackage/junit/run_junit.sh @@ -1,5 +1,26 @@ #!/bin/bash +# Copyright (c) 2020, 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. + set -x set -e diff --git a/test/jdk/tools/jpackage/run_tests.sh b/test/jdk/tools/jpackage/run_tests.sh index 6319b924ef9..a5cb03fc3aa 100644 --- a/test/jdk/tools/jpackage/run_tests.sh +++ b/test/jdk/tools/jpackage/run_tests.sh @@ -1,5 +1,26 @@ #!/bin/bash +# Copyright (c) 2020, 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. + # # Script to run jpackage tests. # diff --git a/test/jdk/tools/jpackage/test_jpackage.sh b/test/jdk/tools/jpackage/test_jpackage.sh index df1edde5a83..c4b28020bc0 100644 --- a/test/jdk/tools/jpackage/test_jpackage.sh +++ b/test/jdk/tools/jpackage/test_jpackage.sh @@ -1,5 +1,27 @@ #!/bin/bash +# Copyright (c) 2020, 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. + + # # Complete testing of jpackage platform-specific packaging. # diff --git a/test/jdk/tools/launcher/HelpFlagsTest.java b/test/jdk/tools/launcher/HelpFlagsTest.java index 6c8c0ccf294..1c1bf98b804 100644 --- a/test/jdk/tools/launcher/HelpFlagsTest.java +++ b/test/jdk/tools/launcher/HelpFlagsTest.java @@ -146,7 +146,6 @@ private static class ToolHelpSpec { new ToolHelpSpec("jstat", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help new ToolHelpSpec("jstatd", 1, 1, 1, 0, 0, 0, 1), // -?, -h, --help new ToolHelpSpec("keytool", 1, 1, 1, 0, 1, 0, 1), // none, prints help message anyways. - new ToolHelpSpec("rmid", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. new ToolHelpSpec("rmiregistry", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. new ToolHelpSpec("serialver", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. new ToolHelpSpec("jpackage", 0, 1, 1, 0, 0, 1, 1), // -h, --help, diff --git a/test/jdk/tools/launcher/VersionCheck.java b/test/jdk/tools/launcher/VersionCheck.java index 1146b33a71f..38a61b54198 100644 --- a/test/jdk/tools/launcher/VersionCheck.java +++ b/test/jdk/tools/launcher/VersionCheck.java @@ -104,7 +104,6 @@ public class VersionCheck extends TestHelper { "klist", "ktab", "jpackage", - "rmid", "rmiregistry", "serialver", "servertool", diff --git a/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java b/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java index 19e6e3ac902..71d6a5b7bf9 100644 --- a/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java +++ b/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -88,8 +88,7 @@ private OutputAnalyzer runTest(String attributes) throws Exception { Paths.get("Test1.class"), Paths.get("Test2.class")); // java -jar test.jar - return ProcessTools.executeTestJava("--illegal-access=deny", - "-jar", jarfile.toString()) + return ProcessTools.executeTestJava("-jar", jarfile.toString()) .outputTo(System.out) .errorTo(System.out); } diff --git a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java index f8be5825751..94c77bd57df 100644 --- a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java +++ b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,454 +23,36 @@ /** * @test - * @requires vm.compMode != "Xcomp" - * @modules java.base/jdk.internal.misc - * java.base/sun.security.x509 - * @library /test/lib modules - * @build IllegalAccessTest TryAccess - * jdk.test.lib.compiler.CompilerUtils - * jdk.test.lib.util.JarUtils - * @build m/* - * @run testng/othervm/timeout=180 IllegalAccessTest - * @summary Basic test for java --illegal-access=$VALUE + * @bug 8266851 + * @library /test/lib + * @build IllegalAccessTest + * @run testng IllegalAccessTest + * @summary Make sure that --illegal-access=$VALUE is obsolete. */ -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.jar.Attributes; -import java.util.jar.Manifest; -import java.util.stream.Stream; - -import jdk.test.lib.compiler.CompilerUtils; -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.util.JarUtils; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import jdk.test.lib.process.*; +import org.testng.annotations.*; /** - * Basic test of --illegal-access=value to deny or permit access to JDK internals. + * Make sure that --illegal-access=$VALUE is obsolete. */ @Test public class IllegalAccessTest { - static final String TEST_SRC = System.getProperty("test.src"); - static final String TEST_CLASSES = System.getProperty("test.classes"); - static final String MODULE_PATH = System.getProperty("jdk.module.path"); - - /** - * Represents the expected result of a test. - */ - static final class Result { - private final boolean success; - private final List expectedOutput = new ArrayList<>(); - private final List notExpectedOutput = new ArrayList<>(); - - Result(boolean success) { - this.success = success; - } - - Result expect(String msg) { - expectedOutput.add(msg); - return this; - } - - Result doNotExpect(String msg) { - notExpectedOutput.add(msg); - return this; - } - - boolean shouldSucceed() { - return success; - } - - Stream expectedOutput() { - return expectedOutput.stream(); - } - - Stream notExpectedOutput() { - return notExpectedOutput.stream(); - } - - @Override - public String toString() { - String s = (success) ? "success" : "failure"; - for (String msg : expectedOutput) { - s += "/" + msg; - } - return s; - } - } - - static Result success() { - return new Result(true); - } - - static Result successNoWarning() { - return success().doNotExpect("WARNING"); - } - - static Result successWithWarning() { - return success().expect("WARNING"); - } - - static Result fail(String expectedOutput) { - return new Result(false).expect(expectedOutput).doNotExpect("WARNING"); - } - - @DataProvider(name = "denyCases") - public Object[][] denyCases() { - return new Object[][] { - { "accessPublicClassNonExportedPackage", fail("IllegalAccessError") }, - { "accessPublicClassJdk9NonExportedPackage", fail("IllegalAccessError") }, - - { "reflectPublicMemberExportedPackage", successNoWarning() }, - { "reflectNonPublicMemberExportedPackage", fail("IllegalAccessException") }, - { "reflectPublicMemberNonExportedPackage", fail("IllegalAccessException") }, - { "reflectNonPublicMemberNonExportedPackage", fail("IllegalAccessException") }, - { "reflectPublicMemberJdk9NonExportedPackage", fail("IllegalAccessException") }, - { "reflectPublicMemberApplicationModule", successNoWarning() }, - - { "setAccessiblePublicMemberExportedPackage", successNoWarning() }, - { "setAccessibleNonPublicMemberExportedPackage", fail("InaccessibleObjectException") }, - { "setAccessiblePublicMemberNonExportedPackage", fail("InaccessibleObjectException") }, - { "setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException") }, - { "setAccessiblePublicMemberJdk9NonExportedPackage", fail("InaccessibleObjectException") }, - { "setAccessiblePublicMemberApplicationModule", successNoWarning() }, - { "setAccessibleNotPublicMemberApplicationModule", fail("InaccessibleObjectException") }, - - { "privateLookupPublicClassExportedPackage", fail("IllegalAccessException") }, - { "privateLookupNonPublicClassExportedPackage", fail("IllegalAccessException") }, - { "privateLookupPublicClassNonExportedPackage", fail("IllegalAccessException") }, - { "privateLookupNonPublicClassNonExportedPackage", fail("IllegalAccessException") }, - { "privateLookupPublicClassJdk9NonExportedPackage", fail("IllegalAccessException") }, - }; - } - - @DataProvider(name = "permitCases") - public Object[][] permitCases() { - return new Object[][] { - { "accessPublicClassNonExportedPackage", successNoWarning() }, - { "accessPublicClassJdk9NonExportedPackage", fail("IllegalAccessError") }, - - { "reflectPublicMemberExportedPackage", successNoWarning() }, - { "reflectNonPublicMemberExportedPackage", fail("IllegalAccessException") }, - { "reflectPublicMemberNonExportedPackage", successWithWarning() }, - { "reflectNonPublicMemberNonExportedPackage", fail("IllegalAccessException") }, - { "reflectPublicMemberJdk9NonExportedPackage", fail("IllegalAccessException") }, - - { "setAccessiblePublicMemberExportedPackage", successNoWarning()}, - { "setAccessibleNonPublicMemberExportedPackage", successWithWarning() }, - { "setAccessiblePublicMemberNonExportedPackage", successWithWarning() }, - { "setAccessibleNonPublicMemberNonExportedPackage", successWithWarning() }, - { "setAccessiblePublicMemberJdk9NonExportedPackage", fail("InaccessibleObjectException") }, - { "setAccessiblePublicMemberApplicationModule", successNoWarning() }, - { "setAccessibleNotPublicMemberApplicationModule", fail("InaccessibleObjectException") }, - - { "privateLookupPublicClassExportedPackage", successWithWarning() }, - { "privateLookupNonPublicClassExportedPackage", successWithWarning() }, - { "privateLookupPublicClassNonExportedPackage", successWithWarning() }, - { "privateLookupNonPublicClassNonExportedPackage", successWithWarning() }, - { "privateLookupPublicClassJdk9NonExportedPackage", fail("IllegalAccessException") }, - { "privateLookupPublicClassApplicationModule", fail("IllegalAccessException") }, - }; - } - - /** - * Checks an expected result with the output captured by the given - * OutputAnalyzer. - */ - void checkResult(Result expectedResult, OutputAnalyzer outputAnalyzer) { - expectedResult.expectedOutput().forEach(outputAnalyzer::shouldContain); - expectedResult.notExpectedOutput().forEach(outputAnalyzer::shouldNotContain); - int exitValue = outputAnalyzer.getExitValue(); - if (expectedResult.shouldSucceed()) { - assertTrue(exitValue == 0); - } else { - assertTrue(exitValue != 0); - } - } - - /** - * Runs the test to execute the given test action. The VM is run with the - * given VM options and the output checked to see that it matches the - * expected result. - */ - OutputAnalyzer run(String action, Result expectedResult, String... vmopts) - throws Exception - { - Stream s1 = Stream.of(vmopts); - Stream s2 = Stream.of("-p", MODULE_PATH, "--add-modules=m", - "-cp", TEST_CLASSES, "TryAccess", action); - String[] opts = Stream.concat(s1, s2).toArray(String[]::new); - OutputAnalyzer outputAnalyzer = ProcessTools - .executeTestJava(opts) - .outputTo(System.out) - .errorTo(System.out); - if (expectedResult != null) - checkResult(expectedResult, outputAnalyzer); - return outputAnalyzer; - } - - OutputAnalyzer run(String action, String... vmopts) throws Exception { - return run(action, null, vmopts); - } - - /** - * Runs an executable JAR to execute the given test action. The VM is run - * with the given VM options and the output checked to see that it matches - * the expected result. - */ - void run(Path jarFile, String action, Result expectedResult, String... vmopts) + void run(String text, String... vmopts) throws Exception { - Stream s1 = Stream.of(vmopts); - Stream s2 = Stream.of("-jar", jarFile.toString(), action); - String[] opts = Stream.concat(s1, s2).toArray(String[]::new); - checkResult(expectedResult, ProcessTools.executeTestJava(opts) - .outputTo(System.out) - .errorTo(System.out)); - } - - @Test(dataProvider = "denyCases") - public void testDefault(String action, Result expectedResult) throws Exception { - run(action, expectedResult); - } - - @Test(dataProvider = "denyCases") - public void testDeny(String action, Result expectedResult) throws Exception { - run(action, expectedResult, "--illegal-access=deny"); - } - - @Test(dataProvider = "permitCases") - public void testPermit(String action, Result expectedResult) throws Exception { - run(action, expectedResult, "--illegal-access=permit"); + var outputAnalyzer = ProcessTools + .executeTestJava(vmopts) + .outputTo(System.out) + .errorTo(System.out); + outputAnalyzer.shouldContain(text); } - @Test(dataProvider = "permitCases") - public void testWarn(String action, Result expectedResult) throws Exception { - run(action, expectedResult, "--illegal-access=warn"); + public void testObsolete() throws Exception { + run("Ignoring option --illegal-access", + "--illegal-access=permit", "--version"); } - @Test(dataProvider = "permitCases") - public void testDebug(String action, Result expectedResult) throws Exception { - // expect stack trace with WARNING - if (expectedResult.expectedOutput().anyMatch("WARNING"::equals)) { - expectedResult.expect("TryAccess.main"); - } - run(action, expectedResult, "--illegal-access=debug"); - } - - /** - * Specify --add-exports to export a package - */ - public void testWithAddExportsOption() throws Exception { - // not accessible - run("reflectPublicMemberNonExportedPackage", fail("IllegalAccessException")); - - // should succeed with --add-exports - run("reflectPublicMemberNonExportedPackage", successNoWarning(), - "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED"); - - // not accessible - run("setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException")); - - // should fail as --add-exports does not open package - run("setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException"), - "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED"); - } - - /** - * Specify --add-open to open a package - */ - public void testWithAddOpensOption() throws Exception { - // not accessible - run("reflectPublicMemberNonExportedPackage", fail("IllegalAccessException")); - - // should succeed with --add-opens - run("reflectPublicMemberNonExportedPackage", successNoWarning(), - "--add-opens", "java.base/sun.security.x509=ALL-UNNAMED"); - - // not accessible - run("setAccessibleNonPublicMemberExportedPackage", fail("InaccessibleObjectException")); - - // should succeed with --add-opens - run("setAccessibleNonPublicMemberExportedPackage", successNoWarning(), - "--add-opens", "java.base/java.lang=ALL-UNNAMED"); - } - - /** - * Test reflective API to export a package - */ - public void testWithReflectiveExports() throws Exception { - // compile patch for java.base - Path src = Paths.get(TEST_SRC, "patchsrc", "java.base"); - Path patch = Files.createDirectories(Paths.get("patches", "java.base")); - assertTrue(CompilerUtils.compile(src, patch, - "--patch-module", "java.base=" + src)); - - // reflectively export, then access - run("exportNonExportedPackages,reflectPublicMemberNonExportedPackage", - successNoWarning(), - "--patch-module", "java.base=" + patch); - - // access, reflectively export, access again - List output = run("reflectPublicMemberNonExportedPackage," - + "exportNonExportedPackages," - + "reflectPublicMemberNonExportedPackage", - "--patch-module", "java.base="+patch, - "--illegal-access=warn").asLines(); - assertTrue(count(output, "WARNING") == 1); // one warning - } - - /** - * Test reflective API to open a package - */ - public void testWithReflectiveOpens() throws Exception { - // compile patch for java.base - Path src = Paths.get(TEST_SRC, "patchsrc", "java.base"); - Path patch = Files.createDirectories(Paths.get("patches", "java.base")); - assertTrue(CompilerUtils.compile(src, patch, - "--patch-module", "java.base=" + src)); - - // reflectively open exported package, then access - run("openExportedPackage,setAccessibleNonPublicMemberExportedPackage", - successNoWarning(), - "--patch-module", "java.base=" + patch); - - // access, reflectively open exported package, access again - List output1 = run("setAccessibleNonPublicMemberExportedPackage" - + ",openExportedPackage" - + ",setAccessibleNonPublicMemberExportedPackage", - "--patch-module", "java.base=" + patch, - "--illegal-access=warn").asLines(); - assertTrue(count(output1, "WARNING") == 1); // one warning - - // reflectively open non-exported packages, then access - run("openNonExportedPackages,setAccessibleNonPublicMemberNonExportedPackage", - successNoWarning(), - "--patch-module", "java.base=" + patch); - - // access, reflectively open non-exported package, access again - List output2 = run("setAccessibleNonPublicMemberNonExportedPackage" - + ",openNonExportedPackages" - + ",setAccessibleNonPublicMemberNonExportedPackage", - "--patch-module", "java.base=" + patch, - "--illegal-access=warn").asLines(); - assertTrue(count(output2, "WARNING") == 1); // one warning - } - - /** - * Specify Add-Exports in JAR file manifest - */ - public void testWithAddExportsInManifest() throws Exception { - Manifest man = new Manifest(); - Attributes attrs = man.getMainAttributes(); - attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); - attrs.put(Attributes.Name.MAIN_CLASS, "TryAccess"); - attrs.put(new Attributes.Name("Add-Exports"), - "java.base/sun.security.x509 java.base/sun.nio.ch"); - Path jarfile = Paths.get("x.jar"); - Path classes = Paths.get(TEST_CLASSES); - JarUtils.createJarFile(jarfile, man, classes, Paths.get("TryAccess.class")); - - run(jarfile, "reflectPublicMemberNonExportedPackage", successNoWarning()); - - run(jarfile, "reflectPublicMemberNonExportedPackage", successNoWarning(), - "--illegal-access=permit"); - - // should fail as Add-Exports does not open package - run(jarfile, "setAccessibleNonPublicMemberNonExportedPackage", - fail("InaccessibleObjectException")); - } - - /** - * Specify Add-Opens in JAR file manifest - */ - public void testWithAddOpensInManifest() throws Exception { - Manifest man = new Manifest(); - Attributes attrs = man.getMainAttributes(); - attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); - attrs.put(Attributes.Name.MAIN_CLASS, "TryAccess"); - attrs.put(new Attributes.Name("Add-Opens"), "java.base/java.lang"); - Path jarfile = Paths.get("x.jar"); - Path classes = Paths.get(TEST_CLASSES); - JarUtils.createJarFile(jarfile, man, classes, Paths.get("TryAccess.class")); - - run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successNoWarning()); - - run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successNoWarning(), - "--illegal-access=permit"); - } - - /** - * Test that --illegal-access=permit behavior is to print a warning on the - * first illegal access only. - */ - public void testWarnOnFirstIllegalAccess() throws Exception { - String action1 = "reflectPublicMemberNonExportedPackage"; - String action2 = "setAccessibleNonPublicMemberExportedPackage"; - int warningCount = count(run(action1, "--illegal-access=permit").asLines(), "WARNING"); - assertTrue(warningCount > 0); // multi line warning - - // same illegal access - List output1 = run(action1 + "," + action1, "--illegal-access=permit").asLines(); - assertTrue(count(output1, "WARNING") == warningCount); - - // different illegal access - List output2 = run(action1 + "," + action2, "--illegal-access=permit").asLines(); - assertTrue(count(output2, "WARNING") == warningCount); - } - - /** - * Test that --illegal-access=warn prints a one-line warning per each unique - * illegal access. - */ - public void testWarnPerIllegalAccess() throws Exception { - String action1 = "reflectPublicMemberNonExportedPackage"; - String action2 = "setAccessibleNonPublicMemberExportedPackage"; - - // same illegal access - String repeatedActions = action1 + "," + action1; - List output1 = run(repeatedActions, "--illegal-access=warn").asLines(); - assertTrue(count(output1, "WARNING") == 1); - - // different illegal access - String differentActions = action1 + "," + action2; - List output2 = run(differentActions, "--illegal-access=warn").asLines(); - assertTrue(count(output2, "WARNING") == 2); - } - - /** - * Specify --illegal-access more than once, last one wins - */ - public void testRepeatedOption() throws Exception { - run("accessPublicClassNonExportedPackage", successNoWarning(), - "--illegal-access=deny", "--illegal-access=permit"); - run("accessPublicClassNonExportedPackage", fail("IllegalAccessError"), - "--illegal-access=permit", "--illegal-access=deny"); - } - - /** - * Specify bad value to --illegal-access - */ - public void testBadValue() throws Exception { - run("accessPublicClassNonExportedPackage", - fail("Value specified to --illegal-access not recognized"), - "--illegal-access=BAD"); - } - - private int count(Iterable lines, CharSequence cs) { - int count = 0; - for (String line : lines) { - if (line.contains(cs)) count++; - } - return count; - } } diff --git a/test/jdk/tools/launcher/modules/illegalaccess/TryAccess.java b/test/jdk/tools/launcher/modules/illegalaccess/TryAccess.java deleted file mode 100644 index 9f58c505215..00000000000 --- a/test/jdk/tools/launcher/modules/illegalaccess/TryAccess.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.nio.channels.SocketChannel; - -/** - * Launched by IllegalAccessTest to attempt illegal access. - */ - -public class TryAccess { - - public static void main(String[] args) throws Exception { - String[] methodNames = args[0].split(","); - for (String methodName : methodNames) { - Method m = TryAccess.class.getDeclaredMethod(methodName); - m.invoke(null); - } - } - - // -- static access -- - - static void accessPublicClassNonExportedPackage() throws Exception { - Object obj = new sun.security.x509.X500Name("CN=name"); - } - - static void accessPublicClassJdk9NonExportedPackage() { - Object obj = jdk.internal.misc.Unsafe.getUnsafe(); - } - - // -- reflective access -- - - static void reflectPublicMemberExportedPackage() throws Exception { - Constructor ctor = String.class.getConstructor(String.class); - Object name = ctor.newInstance("value"); - } - - static void reflectNonPublicMemberExportedPackage() throws Exception { - Field f = String.class.getDeclaredField("value"); - Object obj = f.get("foo"); - } - - static void reflectPublicMemberNonExportedPackage() throws Exception { - Class clazz = Class.forName("sun.security.x509.X500Name"); - Constructor ctor = clazz.getConstructor(String.class); - Object obj = ctor.newInstance("CN=user"); - } - - static void reflectNonPublicMemberNonExportedPackage() throws Exception { - SocketChannel sc = SocketChannel.open(); - Field f = sc.getClass().getDeclaredField("fd"); - Object obj = f.get(sc); - } - - static void reflectPublicMemberJdk9NonExportedPackage() throws Exception { - Class clazz = Class.forName("jdk.internal.misc.Unsafe"); - Method m = clazz.getMethod("getUnsafe"); - Object obj = m.invoke(null); - } - - static void reflectPublicMemberApplicationModule() throws Exception { - Class clazz = Class.forName("p.Type"); - Constructor ctor = clazz.getConstructor(int.class); - Object obj = ctor.newInstance(1); - } - - // -- setAccessible -- - - static void setAccessiblePublicMemberExportedPackage() throws Exception { - Constructor ctor = String.class.getConstructor(String.class); - ctor.setAccessible(true); - } - - static void setAccessibleNonPublicMemberExportedPackage() throws Exception { - Method method = ClassLoader.class.getDeclaredMethod("defineClass", - byte[].class, int.class, int.class); - method.setAccessible(true); - } - - static void setAccessiblePublicMemberNonExportedPackage() throws Exception { - Class clazz = Class.forName("sun.security.x509.X500Name"); - Constructor ctor = clazz.getConstructor(String.class); - ctor.setAccessible(true); - } - - static void setAccessibleNonPublicMemberNonExportedPackage() throws Exception { - SocketChannel sc = SocketChannel.open(); - Field f = sc.getClass().getDeclaredField("fd"); - f.setAccessible(true); - } - - static void setAccessiblePublicMemberJdk9NonExportedPackage() throws Exception { - Class clazz = Class.forName("jdk.internal.misc.Unsafe"); - Method m = clazz.getMethod("getUnsafe"); - m.setAccessible(true); - } - - static void setAccessiblePublicMemberApplicationModule() throws Exception { - Class clazz = Class.forName("p.Type"); - Constructor ctor = clazz.getConstructor(int.class); - ctor.setAccessible(true); - } - - - static void setAccessibleNotPublicMemberApplicationModule() throws Exception { - Class clazz = Class.forName("p.Type"); - Constructor ctor = clazz.getDeclaredConstructor(int.class, int.class); - ctor.setAccessible(true); - } - - - // -- privateLookupIn -- - - static void privateLookupPublicClassExportedPackage() throws Exception { - MethodHandles.privateLookupIn(String.class, MethodHandles.lookup()); - } - - static void privateLookupNonPublicClassExportedPackage() throws Exception { - Class clazz = Class.forName("java.lang.WeakPairMap"); - MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - } - - static void privateLookupPublicClassNonExportedPackage() throws Exception { - Class clazz = Class.forName("sun.security.x509.X500Name"); - MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - } - - static void privateLookupNonPublicClassNonExportedPackage() throws Exception { - Class clazz = Class.forName("sun.nio.ch.SocketChannelImpl"); - MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - } - - static void privateLookupPublicClassJdk9NonExportedPackage() throws Exception { - Class clazz = Class.forName("jdk.internal.misc.Unsafe"); - MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - } - - static void privateLookupPublicClassApplicationModule() throws Exception { - Class clazz = Class.forName("p.Type"); - MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - } - - - // -- export/open packages to this unnamed module -- - - static void exportNonExportedPackages() throws Exception { - Class helper = Class.forName("java.lang.Helper"); - Method m = helper.getMethod("export", String.class, Module.class); - m.invoke(null, "sun.security.x509", TryAccess.class.getModule()); - m.invoke(null, "sun.nio.ch", TryAccess.class.getModule()); - } - - static void openExportedPackage() throws Exception { - Class helper = Class.forName("java.lang.Helper"); - Method m = helper.getMethod("open", String.class, Module.class); - m.invoke(null, "java.lang", TryAccess.class.getModule()); - } - - static void openNonExportedPackages() throws Exception { - Class helper = Class.forName("java.lang.Helper"); - Method m = helper.getMethod("open", String.class, Module.class); - m.invoke(null, "sun.security.x509", TryAccess.class.getModule()); - m.invoke(null, "sun.nio.ch", TryAccess.class.getModule()); - } -} diff --git a/test/jdk/tools/launcher/modules/illegalaccess/modules/m/module-info.java b/test/jdk/tools/launcher/modules/illegalaccess/modules/m/module-info.java deleted file mode 100644 index 90248e83226..00000000000 --- a/test/jdk/tools/launcher/modules/illegalaccess/modules/m/module-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -module m { - exports p; -} diff --git a/test/jdk/tools/launcher/modules/illegalaccess/patchsrc/java.base/java/lang/Helper.java b/test/jdk/tools/launcher/modules/illegalaccess/patchsrc/java.base/java/lang/Helper.java deleted file mode 100644 index 822a0a80520..00000000000 --- a/test/jdk/tools/launcher/modules/illegalaccess/patchsrc/java.base/java/lang/Helper.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * 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 java.lang; - -public class Helper { - private Helper() { } - - /** - * Exports a package to a module. - */ - public static void export(String pn, Module other) { - Helper.class.getModule().addExports(pn, other); - } - - /** - * Opens a package to a module. - */ - public static void open(String pn, Module other) { - Helper.class.getModule().addOpens(pn, other); - } -} diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index e05698500ae..3db4b176132 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -313,6 +313,7 @@ protected void vmOptFinalFlags(SafeMap map) { vmOptFinalFlag(map, "UseCompressedOops"); vmOptFinalFlag(map, "EnableJVMCI"); vmOptFinalFlag(map, "EliminateAllocations"); + vmOptFinalFlag(map, "UseVtableBasedCHA"); } /** diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt index faed5b30d14..98e600d1d1e 100644 --- a/test/langtools/ProblemList.txt +++ b/test/langtools/ProblemList.txt @@ -50,6 +50,9 @@ tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive +tools/javac/processing/options/XprintRepeatingAnnotations.java 8265611 generic-all @compile/ref comparison fails when noSecurityManager=true +tools/javac/processing/options/XprintDocComments.java 8265611 generic-all @compile/ref comparison fails when noSecurityManager=true +tools/javac/processing/model/util/printing/module-info.java 8265611 generic-all @compile/ref comparison fails when noSecurityManager=true ########################################################################### # diff --git a/test/langtools/jdk/javadoc/doclet/checkStylesheetClasses/CheckStylesheetClasses.java b/test/langtools/jdk/javadoc/doclet/checkStylesheetClasses/CheckStylesheetClasses.java new file mode 100644 index 00000000000..2de97bb8f29 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/checkStylesheetClasses/CheckStylesheetClasses.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 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 8267574 + * @summary check stylesheet names against HtmlStyle + * @modules jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.markup + * jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources:open + */ + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; + +/** + * This test compares the set of CSS class names defined in HtmlStyle + * and other files (such as search.js) against the set of CSS class names + * defined in the main stylesheet.css provided by the doclet. + * + * The goal is to detect "unexpected" discrepancies between the two sets. + * "Expected" discrepancies are taken into account, but may indicate a + * need to resolve the discrepancy. + * + * The test does not take into direct account the recent introduction of + * CSS constructs like section {@code [class$="-details"]} + */ +public class CheckStylesheetClasses { + public static void main(String... args) throws Exception { + CheckStylesheetClasses c = new CheckStylesheetClasses(); + c.run(); + } + + int errors = 0; + + void run() throws Exception { + Set htmlStyleNames = getHtmlStyleNames(); + Set styleSheetNames = getStylesheetNames(); + + System.err.println("found " + htmlStyleNames.size() + " names in HtmlStyle"); + System.err.println("found " + styleSheetNames.size() + " names in stylesheet"); + + // Write the lists to external files for the benefit of external diff tools: + // for example, to compare against the CSS class names used in generated documentation. + // To find the classes used in a directory containing HTML files, use something like + // find $DIRECTORY -name \*.html | \ + // xargs grep -o 'class="[^"]*"' | \ + // sed -e 's/^[^"]*"//' -e 's/".*$//' | \ + // while read line ; do for w in $line ; do echo $w ; done ; done | \ + // sort -u + + try (BufferedWriter out = Files.newBufferedWriter(Path.of("htmlStyleNames.txt")); + PrintWriter pw = new PrintWriter(out)) { + htmlStyleNames.forEach(pw::println); + } + + try (BufferedWriter out = Files.newBufferedWriter(Path.of("styleSheetNames.txt")); + PrintWriter pw = new PrintWriter(out)) { + styleSheetNames.forEach(pw::println); + } + + // Remove names from htmlStyleNames if they are valid names generated by the doclet, + // even if they do not by default require a style to be defined in the stylesheet. + // In general, names in these lists are worthy of attention to see if they *should* + // be defined in the stylesheet, especially when the names exist in a family of + // related items: related by name or by function. + + // the page names are provided to override a style on a specific page; + // only some are used in the stylesheet + htmlStyleNames.removeIf(s -> s.endsWith("-page") && !styleSheetNames.contains(s)); + + // descriptions; class-description is used; + // surprisingly? module-description and package-description are not + htmlStyleNames.removeIf(s -> s.endsWith("-description") && !styleSheetNames.contains(s)); + + // help page + htmlStyleNames.removeIf(s -> s.startsWith("help-") && !styleSheetNames.contains(s)); + + // summary and details tables; styles for these may be present in the stylesheet + // using constructs like these: + // .summary section[class$="-summary"], .details section[class$="-details"], + htmlStyleNames.removeIf(s -> s.endsWith("-details")); + htmlStyleNames.removeIf(s -> s.endsWith("-summary") && !styleSheetNames.contains(s)); + + // signature classes + removeAll(htmlStyleNames, "annotations", "element-name", "extends-implements", + "modifiers", "permits", "return-type"); + + // misc: these are defined in HtmlStyle, and used by the doclet + removeAll(htmlStyleNames, "col-plain", "details-table", "external-link", + "hierarchy", "index", "package-uses", "packages", "permits-note", + "serialized-package-container", "source-container"); + + // Remove names from styleSheetNames if they are false positives, + // or used by other code (i.e. not HtmlStyle), + // or if they are unused and therefore candidates to be deleted. + + // false positives: file extensions and URL components + removeAll(styleSheetNames, "css", "png", "w3"); + + // for doc-comment authors; maybe worthy of inclusion in HtmlStyle, just to be documented + removeAll(styleSheetNames, "borderless", "plain", "striped"); + + // used in search.js; may be worth documenting in HtmlStyle + removeAll(styleSheetNames, "result-highlight", "result-item", + "search-tag-desc-result", "search-tag-holder-result", + "ui-autocomplete", "ui-autocomplete-category", + "watermark"); + + // very JDK specific + styleSheetNames.remove("module-graph"); + + // apparently unused + // "tab" is commented implying it is in the header/footer, but + // (a) it is a poorly chosen name + // (b) it does not seem to be used in make/Docs.gmk or anywhere else + removeAll(styleSheetNames, "all-classes-container", "all-packages-container", + "bottom-nav", "clear", "constant-values-container", "deprecated-content", + "footer", "hidden", "override-specify-label", "serialized-class-details", + "tab", "table-sub-heading-color"); + + boolean ok = check(htmlStyleNames, "HtmlStyle", styleSheetNames, "stylesheet") + & check(styleSheetNames, "stylesheet", htmlStyleNames, "HtmlStyle"); + + if (!ok) { + throw new Exception("differences found"); + } + + if (errors > 0) { + throw new Exception(errors + " errors found"); + } + } + + boolean check(Set s1, String l1, Set s2, String l2) { + boolean equal = true; + for (String s : s1) { + if (!s2.contains(s)) { + System.err.println("In " + l1 + " but not " + l2 + ": " + s); + equal = false; + } + } + return equal; + } + + /** + * Remove all the names from the set, giving a message for any that were not found. + */ + void removeAll(Set set, String... names) { + for (String name : names) { + if (!set.remove(name)) { + error("name not found in set: " + name); + } + } + } + + void error(String message) { + System.err.println("error: " + message); + errors++; + } + + Set getHtmlStyleNames() { + return Arrays.stream(HtmlStyle.values()) + .map(HtmlStyle::cssName) + .collect(Collectors.toCollection(TreeSet::new)); + } + + Set getStylesheetNames() throws IOException { + Set names = new TreeSet<>(); + String stylesheet = "/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css"; + URL url = HtmlStyle.class.getResource(stylesheet); + readStylesheet(url, names); + return names; + } + + private void readStylesheet(URL resource, Set names) throws IOException { + try (InputStream in = resource.openStream()) { + if (in == null) { + throw new AssertionError("Cannot find or access resource " + resource); + } + String s = new String(in.readAllBytes()); + Pattern p = Pattern.compile("(?i)(\\s|([a-z][a-z0-9-]*))\\.(?[a-z0-9-]+)\\b"); + Matcher m = p.matcher(s); + while (m.find()) { + names.add(m.group("name")); + } + } + } +} \ No newline at end of file diff --git a/test/langtools/jdk/javadoc/doclet/testCharsetDocencodingOptions/TestCharsetDocencodingOptions.java b/test/langtools/jdk/javadoc/doclet/testCharsetDocencodingOptions/TestCharsetDocencodingOptions.java index 698ddb3ae72..32c6c65dccc 100644 --- a/test/langtools/jdk/javadoc/doclet/testCharsetDocencodingOptions/TestCharsetDocencodingOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testCharsetDocencodingOptions/TestCharsetDocencodingOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -94,7 +94,7 @@ public void testDocencodingWithCharsetDifferent() { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, - "javadoc: error - Option -charset conflicts with -docencoding"); + "error: Option -charset conflicts with -docencoding"); } @Test diff --git a/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/MyTaglet.java b/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/MyTaglet.java new file mode 100644 index 00000000000..78ffad2e1dc --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/MyTaglet.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 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. + */ + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import javax.lang.model.element.Element; +import javax.tools.Diagnostic; + +import com.sun.source.doctree.DocTree; +import com.sun.source.doctree.EntityTree; +import com.sun.source.util.DocTreePath; +import com.sun.source.util.DocTreePathScanner; +import com.sun.source.util.DocTrees; +import com.sun.source.util.TreePath; +import jdk.javadoc.doclet.Doclet; +import jdk.javadoc.doclet.DocletEnvironment; +import jdk.javadoc.doclet.Reporter; +import jdk.javadoc.doclet.StandardDoclet; +import jdk.javadoc.doclet.Taglet; + +/** + * A taglet that writes messages to the doclet's reporter. + */ +public class MyTaglet implements Taglet { + private DocletEnvironment docEnv; + private Reporter reporter; + + @Override + public void init(DocletEnvironment env, Doclet doclet) { + Taglet.super.init(env, doclet); + docEnv = env; + + // The following should be as simple as + // reporter = ((StandardDoclet) doclet).getReporter(); + // JDK-8267176 + try { + StandardDoclet sd = (StandardDoclet) doclet; + Field htmlDocletField = sd.getClass().getDeclaredField("htmlDoclet"); + htmlDocletField.setAccessible(true); + Object htmlDoclet = htmlDocletField.get(sd); + Method getConfigurationMethod = htmlDoclet.getClass().getDeclaredMethod("getConfiguration"); + Object config = getConfigurationMethod.invoke(htmlDoclet); + Method getReporterMethod = config.getClass().getMethod(("getReporter")); + reporter = (Reporter) getReporterMethod.invoke(config); + } catch (ReflectiveOperationException e) { + throw new IllegalStateException(e); + } + } + + @Override + public Set getAllowedLocations() { + return EnumSet.allOf(Location.class); + } + + @Override + public boolean isInlineTag() { + return false; + } + + @Override + public boolean isBlockTag() { + return true; + } + + /** + * Refines an existing tag ({@code @since} that provides a {@code List}, + * so that we can better test positions within the tree node. The alternative, + * defining a new tag, would use {@code UnknownBlockTagTree} which just provides + * a single {@code Doc Tree}. + * + * @return the name of the tag supported by this taglet + */ + @Override + public String getName() { + return "since"; + } + + @Override + public String toString(List tags, Element element) { + List kinds = Arrays.stream(Diagnostic.Kind.values()) + .filter(k -> k != Diagnostic.Kind.OTHER) + .toList(); + + for (Diagnostic.Kind k : kinds) { + String message = "This is a " + k.toString().toLowerCase(Locale.ROOT); + reporter.print(k, message); + } + + for (Diagnostic.Kind k : kinds) { + String message = "This is a " + k.toString().toLowerCase(Locale.ROOT) + " for " + element; + reporter.print(k, element, message); + } + + DocTreePathScanner s = new DocTreePathScanner<>() { + @Override + public Void scan(DocTree tree, Diagnostic.Kind k) { + return super.scan(tree, k); + } + + @Override + public Void visitEntity(EntityTree node, Diagnostic.Kind k) { + if (node.getName().contentEquals("#x1f955")) { + String message = "This is a " + k.toString().toLowerCase(Locale.ROOT) + + ": this is not a caret"; + reporter.print(k, getCurrentPath(), message); + } + return super.visitEntity(node, k); + } + }; + + DocTrees trees = docEnv.getDocTrees(); + TreePath tp = trees.getPath(element); + DocTreePath root = new DocTreePath(tp, trees.getDocCommentTree(element)); + + for (Diagnostic.Kind k : kinds) { + tags.forEach(t -> s.scan(new DocTreePath(root, t), k)); + } + return "mytaglet output"; + } +} \ No newline at end of file diff --git a/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/TestDiagsLineCaret.java b/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/TestDiagsLineCaret.java new file mode 100644 index 00000000000..b047f55eae3 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/TestDiagsLineCaret.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 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 8267126 + * @summary javadoc should show "line and caret" for diagnostics + * @library /tools/lib ../../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build javadoc.tester.* MyTaglet + * @run main TestDiagsLineCaret + */ + +import java.io.IOException; +import java.nio.file.Path; + +import javadoc.tester.JavadocTester; +import toolbox.ToolBox; + +public class TestDiagsLineCaret extends JavadocTester { + + public static void main(String... args) throws Exception { + TestDiagsLineCaret tester = new TestDiagsLineCaret(); + tester.runTests(); + } + + ToolBox tb = new ToolBox(); + + @Test + public void testDiags() throws IOException { + tb.writeJavaFiles(Path.of("."), """ + /** + * First sentence. + * @since def 🥕 ghi + */ + public class MyClass { } + """); + + String testClasses = System.getProperty("test.classes"); + + javadoc("-d", "out", + "-XDaccessInternalAPI", + "-tagletpath", testClasses, + "-taglet", "MyTaglet", + "MyClass.java"); + checkExit(Exit.ERROR); + + checkOutput(Output.OUT, true, + """ + error: This is a error + warning: This is a warning + warning: This is a mandatory_warning + This is a note + MyClass.java:5: error: This is a error for MyClass + public class MyClass { } + ^ + MyClass.java:5: warning: This is a warning for MyClass + public class MyClass { } + ^ + MyClass.java:5: warning: This is a mandatory_warning for MyClass + public class MyClass { } + ^ + MyClass.java:5: Note: This is a note for MyClass + public class MyClass { } + ^ + MyClass.java:3: error: This is a error: this is not a caret + * @since def 🥕 ghi + ^ + MyClass.java:3: warning: This is a warning: this is not a caret + * @since def 🥕 ghi + ^ + MyClass.java:3: warning: This is a mandatory_warning: this is not a caret + * @since def 🥕 ghi + ^ + MyClass.java:3: Note: This is a note: this is not a caret + * @since def 🥕 ghi + ^ + """, + """ + 3 errors + 6 warnings + """); + } +} diff --git a/test/langtools/jdk/javadoc/doclet/testDocFiles/TestDocFiles.java b/test/langtools/jdk/javadoc/doclet/testDocFiles/TestDocFiles.java index a0d6e8c3fd5..c3f94515b36 100644 --- a/test/langtools/jdk/javadoc/doclet/testDocFiles/TestDocFiles.java +++ b/test/langtools/jdk/javadoc/doclet/testDocFiles/TestDocFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -171,7 +171,7 @@ public void testBadFiles(Path base) throws IOException { } else { // be careful handing file separator characters in the message checkOutput(Output.OUT, true, - "warning - File " + f + " not copied: invalid name"); + "warning: File " + f + " not copied: invalid name"); } } } diff --git a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java index 75804be9d06..f121bbe5d0f 100644 --- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java @@ -374,7 +374,7 @@ public void test4() { checkExit(Exit.OK); // make sure the doclet indeed emits the warning - checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag <"); + checkOutput(Output.OUT, true, "C.java:31: warning: invalid usage of tag <"); } /* @@ -419,6 +419,7 @@ public class BooleanProperty { } javadoc("-d", "out5", "--javafx", "--disable-javafx-strict-checks", + "--no-platform-links", "-Xdoclint:all", "--source-path", "src5", "pkg"); diff --git a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java index 3ff86a383a9..ce7192cced9 100644 --- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java +++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java @@ -247,7 +247,7 @@ public void testWithServers() throws Exception { // 3: The original URL is still used in the generated docs, to avoid assuming // that all the other files at that link have been redirected as well. checkOutput(Output.OUT, true, - "javadoc: warning - URL " + oldURL + "/element-list was redirected to " + newURL + "/element-list"); + "warning: URL " + oldURL + "/element-list was redirected to " + newURL + "/element-list"); checkOutput("mC/p5/C5.html", true, "extends C1"""); diff --git a/test/langtools/jdk/javadoc/doclet/testMissingComment/TestMissingComment.java b/test/langtools/jdk/javadoc/doclet/testMissingComment/TestMissingComment.java index 847fe91b17f..8d43c4b4a86 100644 --- a/test/langtools/jdk/javadoc/doclet/testMissingComment/TestMissingComment.java +++ b/test/langtools/jdk/javadoc/doclet/testMissingComment/TestMissingComment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -112,6 +112,7 @@ private void test(Path base, String code, String expect) throws Exception { javadoc("-d", base.resolve("api").toString(), "-Xdoclint:missing", + "--no-platform-links", src.resolve("C.java").toString()); checkExit(Exit.OK); checkOutput(Output.OUT, true, diff --git a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java index ffa38fd9582..80a90b8d093 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -196,9 +196,9 @@ void checkTypeParameters() { checkOutput(Output.OUT, true, // Bad type parameter warnings. """ - warning - @param argument "" is not the name of a type parameter.""", + warning: @param argument "" is not the name of a type parameter.""", """ - warning - @param argument "" is not the name of a type parameter."""); + warning: @param argument "" is not the name of a type parameter."""); // Signature of subclass that has type parameters. checkOutput("pkg/TypeParameterSubClass.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testNoFrames/TestNoFrames.java b/test/langtools/jdk/javadoc/doclet/testNoFrames/TestNoFrames.java index 4eb1829d9e3..b367fb70a6e 100644 --- a/test/langtools/jdk/javadoc/doclet/testNoFrames/TestNoFrames.java +++ b/test/langtools/jdk/javadoc/doclet/testNoFrames/TestNoFrames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -59,7 +59,7 @@ public void testDefault() { checkOutput(Output.OUT, true, """ - javadoc: warning - The --no-frames option is no longer required and may be removed - in a future release."""); + warning: The --no-frames option is no longer required and may be removed + in a future release."""); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java index 6a7384bf4da..b5318e05499 100644 --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java @@ -161,7 +161,7 @@ public void testInvalidStylesheetFile() { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, - "javadoc: error - File not found:", + "error: File not found:", "custom-stylesheet-1.css"); } @@ -174,7 +174,7 @@ public void testInvalidAdditionalStylesheetFiles() { checkExit(Exit.ERROR); checkOutput(Output.OUT, true, - "javadoc: error - File not found:", + "error: File not found:", "additional-stylesheet-4.css"); } diff --git a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java index ba6bf527149..b5d65f79f13 100644 --- a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java +++ b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -69,7 +69,7 @@ public void method() {} checkExit(Exit.OK); checkOutput(Output.OUT, true, - "warning - @return tag cannot be used in method with void return type."); + "warning: @return tag cannot be used in method with void return type."); } @Test diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index 6cdef98ec2f..ec6cb7d1290 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -673,10 +673,10 @@ void checkJavaFXOutput() { void checkInvalidUsageIndexTag() { checkOutput(Output.OUT, true, - "AnotherClass.java:29: warning - invalid usage of tag {@index", - "AnotherClass.java:39: warning - invalid usage of tag {@index", - "AnotherClass.java:34: warning - invalid usage of tag {@index", - "AnotherClass.java:68: warning - invalid usage of tag {@index"); + "AnotherClass.java:29: warning: invalid usage of tag {@index", + "AnotherClass.java:39: warning: invalid usage of tag {@index", + "AnotherClass.java:34: warning: invalid usage of tag {@index", + "AnotherClass.java:68: warning: invalid usage of tag {@index"); } void checkJqueryAndImageFiles(boolean expectedOutput) { diff --git a/test/langtools/jdk/javadoc/doclet/testTagInheritence/TestTagInheritence.java b/test/langtools/jdk/javadoc/doclet/testTagInheritence/TestTagInheritence.java index 7fc24368336..59189ff948e 100644 --- a/test/langtools/jdk/javadoc/doclet/testTagInheritence/TestTagInheritence.java +++ b/test/langtools/jdk/javadoc/doclet/testTagInheritence/TestTagInheritence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -51,7 +51,7 @@ public void test() { //Test bad inheritDoc tag warning. checkOutput(Output.OUT, true, - "warning - @inheritDoc used but testBadInheritDocTag() " + "warning: @inheritDoc used but testBadInheritDocTag() " + "does not override or implement any method."); //Test valid usage of inheritDoc tag. diff --git a/test/langtools/jdk/javadoc/doclet/testTagMisuse/TestTagMisuse.java b/test/langtools/jdk/javadoc/doclet/testTagMisuse/TestTagMisuse.java index bcc01c64224..8278abe9058 100644 --- a/test/langtools/jdk/javadoc/doclet/testTagMisuse/TestTagMisuse.java +++ b/test/langtools/jdk/javadoc/doclet/testTagMisuse/TestTagMisuse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -52,10 +52,10 @@ public void test() { checkExit(Exit.OK); checkOutput(Output.OUT, true, - "warning - Tag @param cannot be used in field documentation.", - "warning - Tag @throws cannot be used in field documentation.", - "warning - Tag @return cannot be used in constructor documentation." - /* DCerroneous, "warning - Tag @throws cannot be used in inline documentation."*/); + "warning: Tag @param cannot be used in field documentation.", + "warning: Tag @throws cannot be used in field documentation.", + "warning: Tag @return cannot be used in constructor documentation." + /* DCerroneous, "warning: Tag @throws cannot be used in inline documentation."*/); checkOutput(Output.OUT, false, "DocletAbortException"); } diff --git a/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java b/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java index acf758e28c3..6197c18671c 100644 --- a/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java +++ b/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -152,14 +152,14 @@ public void test2() { checkExit(Exit.OK); checkOutput(Output.OUT, true, // Test @value warning printed when used with non-constant. - "warning - @value tag (which references nonConstant) " + "warning: @value tag (which references nonConstant) " + "can only be used in constants.", - "warning - @value tag (which references NULL) " + "warning: @value tag (which references NULL) " + "can only be used in constants.", - "warning - @value tag (which references TEST_12_ERROR) " + "warning: @value tag (which references TEST_12_ERROR) " + "can only be used in constants.", // Test warning printed for bad reference. - "warning - {@value UnknownClass#unknownConstant}" + "warning: {@value UnknownClass#unknownConstant}" + " (referenced by @value tag) is an unknown reference." ); checkForException(); diff --git a/test/langtools/jdk/javadoc/doclet/testWarnBadParamNames/TestWarnBadParamNames.java b/test/langtools/jdk/javadoc/doclet/testWarnBadParamNames/TestWarnBadParamNames.java index 6d8036714e7..2a8ea04e8d0 100644 --- a/test/langtools/jdk/javadoc/doclet/testWarnBadParamNames/TestWarnBadParamNames.java +++ b/test/langtools/jdk/javadoc/doclet/testWarnBadParamNames/TestWarnBadParamNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -50,10 +50,10 @@ public void test() { checkOutput(Output.OUT, true, """ - warning - @param argument "int" is not a parameter name.""", + warning: @param argument "int" is not a parameter name.""", """ - warning - @param argument "IDontExist" is not a parameter name.""", + warning: @param argument "IDontExist" is not a parameter name.""", """ - warning - Parameter "arg" is documented more than once."""); + warning: Parameter "arg" is documented more than once."""); } } diff --git a/test/langtools/jdk/javadoc/tool/6958836/Test.java b/test/langtools/jdk/javadoc/tool/6958836/Test.java index d344aa6eb6d..eca563f0b9e 100644 --- a/test/langtools/jdk/javadoc/tool/6958836/Test.java +++ b/test/langtools/jdk/javadoc/tool/6958836/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -80,7 +80,7 @@ void javadoc(String pkg, List testOpts, System.err.println("Errors:\n" + errOut); check(errOut, "Errors.java", expectErrs); - check(errOut, " warning ", expectWarns); // requires -locale en_US + check(errOut, " warning: ", expectWarns); // requires -locale en_US } void check(String text, String expectText, int expectCount) { diff --git a/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java b/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java index d2ac6e657bb..27d06d282dc 100644 --- a/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java +++ b/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -73,12 +73,14 @@ void run() throws Exception { String line; while ((line = in.readLine()) != null) { System.err.println(line); - if (line.contains("DoesNotExist")) + if (line.contains("TestStdDoclet.java") && line.contains("DoesNotExist")) { actualDocletWarnCount++; - if (line.matches("[0-9]+ warning(s)?")) + } + if (line.matches("[0-9]+ warning(s)?")) { reportedDocletWarnCount = Integer.valueOf(line.substring(0, line.indexOf(" "))); } + } } finally { in.close(); } diff --git a/test/langtools/jdk/javadoc/tool/8224613/OptionProcessingFailureTest.java b/test/langtools/jdk/javadoc/tool/8224613/OptionProcessingFailureTest.java index dab4144d335..c2fc29cfbd2 100644 --- a/test/langtools/jdk/javadoc/tool/8224613/OptionProcessingFailureTest.java +++ b/test/langtools/jdk/javadoc/tool/8224613/OptionProcessingFailureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -175,7 +175,7 @@ private void testScenario(Path base, long sumErrors = optionDescriptions.stream().mapToLong(d -> d.nProcessErrors).sum() + nInitErrors; boolean success = optionDescriptions.stream().allMatch(d -> d.success); - checkOutput(Output.OUT, sumErrors != 0 || !success, "error - "); + checkOutput(Output.OUT, sumErrors != 0 || !success, "error: "); } /* Creating a specialized consumer is even more lightweight than creating a POJO */ diff --git a/test/langtools/jdk/javadoc/tool/BadOptionsTest.java b/test/langtools/jdk/javadoc/tool/BadOptionsTest.java index d40c8640c73..e0887ed5646 100644 --- a/test/langtools/jdk/javadoc/tool/BadOptionsTest.java +++ b/test/langtools/jdk/javadoc/tool/BadOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -79,7 +79,7 @@ public void testAddModulesEmptyArg() { .run(Task.Expect.FAIL) .writeAll(); checkFound(result.getOutput(Task.OutputKind.DIRECT), - "javadoc: error - error: no value for --add-modules option"); + "error: no value for --add-modules option"); checkNotFound(result, "Exception", "at jdk.javadoc/"); } @@ -104,7 +104,7 @@ public void testAddExportsEmptyArg() { .run(Task.Expect.FAIL) .writeAll(); checkFound(result.getOutput(Task.OutputKind.DIRECT), - "javadoc: error - error: no value for --add-exports option"); + "error: no value for --add-exports option"); checkNotFound(result, "Exception", "at jdk.javadoc/"); } @@ -116,7 +116,7 @@ public void testAddExportsBadArg() { .run(Task.Expect.FAIL) .writeAll(); checkFound(result.getOutput(Task.OutputKind.DIRECT), - "javadoc: error - error: bad value for --add-exports option: 'm/p'"); + "error: bad value for --add-exports option: 'm/p'"); checkNotFound(result, "Exception", "at jdk.javadoc/"); } diff --git a/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java b/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java index e82b0622895..e7795df75f1 100644 --- a/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java +++ b/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java @@ -227,12 +227,16 @@ Set getCodeKeys() throws IOException { } // special handling for code strings synthesized in - // com.sun.tools.javadoc.Messager + // jdk.javadoc.internal.tool.Messager results.add("javadoc.error.msg"); results.add("javadoc.note.msg"); results.add("javadoc.note.pos.msg"); results.add("javadoc.warning.msg"); + results.add("javadoc.err.message"); + results.add("javadoc.warn.message"); + results.add("javadoc.note.message"); + return results; } } diff --git a/test/langtools/jdk/javadoc/tool/MaxWarns.java b/test/langtools/jdk/javadoc/tool/MaxWarns.java index 675c6319dcd..fa5640209d0 100644 --- a/test/langtools/jdk/javadoc/tool/MaxWarns.java +++ b/test/langtools/jdk/javadoc/tool/MaxWarns.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -75,7 +75,7 @@ File genSrc(int count) throws IOException { String javadoc(File f) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - String[] args = { "-Xdoclint:none", "-d", "api", f.getPath() }; + String[] args = { "-Xdoclint:none", "--no-platform-links", "-d", "api", f.getPath() }; int rc = jdk.javadoc.internal.tool.Main.execute(args, pw); pw.flush(); return sw.toString(); @@ -84,7 +84,7 @@ String javadoc(File f) { void check(String out, int count) { System.err.println(out); Pattern warn = Pattern.compile(""" - warning - @param argument "i[0-9]+" is not a parameter name"""); + warning: @param argument "i[0-9]+" is not a parameter name"""); Matcher m = warn.matcher(out); int n = 0; for (int start = 0; m.find(start); start = m.start() + 1) { diff --git a/test/langtools/jdk/javadoc/tool/api/basic/GetTask_DiagListenerTest.java b/test/langtools/jdk/javadoc/tool/api/basic/GetTask_DiagListenerTest.java index 8e51bdbc50e..7f55f18f186 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/GetTask_DiagListenerTest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/GetTask_DiagListenerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -73,13 +73,13 @@ public void testDiagListener() throws Exception { } else { List diagCodes = new ArrayList(); for (Diagnostic d: dc.getDiagnostics()) { - System.err.println(d); + System.err.println("[" + d.getCode() + "]: " + d); diagCodes.add(d.getCode()); } List expect = Arrays.asList( - "javadoc.note.msg", // Loading source file + "javadoc.note.message", // Loading source file "compiler.err.expected4", // class, interface, enum, or record expected - "javadoc.note.msg"); // 1 error + "javadoc.note.message"); // 1 error if (!diagCodes.equals(expect)) throw new Exception("unexpected diagnostics occurred"); System.err.println("diagnostics received as expected"); diff --git a/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java b/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java index 295873ddd21..33fe088f4be 100644 --- a/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java +++ b/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -116,13 +116,13 @@ private enum Message { DL_WRN12A(WARNING, "Test.java:12: warning: no description for @return"), // javadoc messages about bad content: these should only appear when doclint is disabled - JD_WRN10(WARNING, "Test.java:10: warning - Tag @see: reference not found: DoesNotExist"), - JD_WRN13(WARNING, "Test.java:13: warning - @return tag has no arguments."), + JD_WRN10(WARNING, "Test.java:10: warning: Tag @see: reference not found: DoesNotExist"), + JD_WRN13(WARNING, "Test.java:13: warning: @return tag has no arguments."), // javadoc messages for bad options - OPT_BADARG(ERROR, "javadoc: error - Invalid argument for -Xdoclint option"), - OPT_BADQUAL(ERROR, "javadoc: error - Access qualifiers not permitted for -Xdoclint arguments"), - OPT_BADPACKAGEARG(ERROR, "javadoc: error - Invalid argument for -Xdoclint/package option"); + OPT_BADARG(ERROR, "error: Invalid argument for -Xdoclint option"), + OPT_BADQUAL(ERROR, "error: Access qualifiers not permitted for -Xdoclint arguments"), + OPT_BADPACKAGEARG(ERROR, "error: Invalid argument for -Xdoclint/package option"); final Diagnostic.Kind kind; final String text; diff --git a/test/langtools/jdk/javadoc/tool/exceptionHandling/TestExceptionHandling.java b/test/langtools/jdk/javadoc/tool/exceptionHandling/TestExceptionHandling.java index d48c2652809..a721b92841b 100644 --- a/test/langtools/jdk/javadoc/tool/exceptionHandling/TestExceptionHandling.java +++ b/test/langtools/jdk/javadoc/tool/exceptionHandling/TestExceptionHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -86,7 +86,7 @@ public void testDocletTrace() throws Exception { String errString = "Destination directory is not a directory: " + out.toString(); // check the regular message - assertPresent("javadoc: error - " + errString, tr.getOutputLines(Task.OutputKind.DIRECT)); + assertPresent("error: " + errString, tr.getOutputLines(Task.OutputKind.DIRECT)); // check that first line of the stack trace is present assertPresent("jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException: " + errString, tr.getOutputLines(Task.OutputKind.STDERR)); @@ -102,7 +102,7 @@ public void testToolTrace() throws Exception { Task.Result tr = cmdTask.run(Task.Expect.FAIL); // check the regular message - assertPresent("javadoc: error - Cannot find doclet class NonExistentDoclet", + assertPresent("error: Cannot find doclet class NonExistentDoclet", tr.getOutputLines(Task.OutputKind.DIRECT)); // check that first line of the stack trace is present diff --git a/test/langtools/jdk/javadoc/tool/modules/Modules.java b/test/langtools/jdk/javadoc/tool/modules/Modules.java index 1577bca438f..d830470bb01 100644 --- a/test/langtools/jdk/javadoc/tool/modules/Modules.java +++ b/test/langtools/jdk/javadoc/tool/modules/Modules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -112,7 +112,7 @@ public void testMissingModuleWithSourcePath(Path base) throws Exception { javafile.toString()); assertMessagePresent("error: cannot access module-info"); - assertMessageNotPresent("error - fatal error encountered"); + assertMessageNotPresent("error: fatal error encountered"); } @@ -534,7 +534,7 @@ public void testMissingModule(Path base) throws Exception { "--module", "MIA", "--expand-requires", "all"); - assertMessagePresent("javadoc: error - module MIA not found"); + assertMessagePresent("error: module MIA not found"); } @Test @@ -556,7 +556,7 @@ public void testMissingModuleMultiModuleCmdline(Path base) throws Exception { "--module", "M,N,L,MIA,O,P", "--expand-requires", "all"); - assertMessagePresent("javadoc: error - module MIA not found"); + assertMessagePresent("error: module MIA not found"); } @Test diff --git a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java index d54a6662f7a..b6e16dc592d 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -180,7 +180,7 @@ public void testUnexportedUnqualifiedSubpackages(Path base) throws Exception { "--module", "m1", "-subpackages", "m1pub.pub1:pro"); - assertMessagePresent("javadoc: error - No source files for package pro"); + assertMessagePresent("error: No source files for package pro"); } @Test diff --git a/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java b/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java index bd18cb05d18..e9b92e9e557 100644 --- a/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java +++ b/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -70,10 +70,10 @@ public void testInvalidDoclet(Path base) throws Exception { "pkg"); checkExit(Exit.ERROR); - checkOutput(Output.OUT, true, - "javadoc: error - Class " + Doclet_CLASS_NAME + """ - is not a valid doclet. - Note: As of JDK 13, the com.sun.javadoc API is no longer supported."""); + checkOutput(Output.OUT, true, String.format(""" + error: Class %s is not a valid doclet. + Note: As of JDK 13, the com.sun.javadoc API is no longer supported.""", + Doclet_CLASS_NAME)); } static class TestDoclet { diff --git a/test/langtools/jdk/javadoc/tool/testWErrorOption/TestWErrorOption.java b/test/langtools/jdk/javadoc/tool/testWErrorOption/TestWErrorOption.java index 129cdf6f1a1..ee4761766b4 100644 --- a/test/langtools/jdk/javadoc/tool/testWErrorOption/TestWErrorOption.java +++ b/test/langtools/jdk/javadoc/tool/testWErrorOption/TestWErrorOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -58,7 +58,7 @@ public void testControl(Path base) throws Exception { "p"); checkExit(Exit.OK); checkOutput(Output.OUT, false, - "javadoc: error - warnings found and -Werror specified"); + "error: warnings found and -Werror specified"); checkOutput(Output.OUT, true, "1 warning"); } @@ -74,9 +74,9 @@ public void testWerror(Path base) throws Exception { "p"); checkExit(Exit.ERROR); checkOutput(Output.OUT, true, - "C.java:6: warning - @return tag cannot be used in method with void return type.", + "C.java:6: warning: @return tag cannot be used in method with void return type.", """ - javadoc: error - warnings found and -Werror specified + error: warnings found and -Werror specified 1 error 1 warning """); diff --git a/test/langtools/jdk/jshell/MethodsTest.java b/test/langtools/jdk/jshell/MethodsTest.java index b98da22450e..f613a8112f0 100644 --- a/test/langtools/jdk/jshell/MethodsTest.java +++ b/test/langtools/jdk/jshell/MethodsTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8080357 8167643 8187359 8199762 8080353 8246353 8247456 + * @bug 8080357 8167643 8187359 8199762 8080353 8246353 8247456 8267221 * @summary Tests for EvaluationState.methods * @build KullaTesting TestingInputStream ExpectedDiagnostic * @run testng MethodsTest @@ -374,4 +374,14 @@ public void lambdas() { assertNumberOfActiveMethods(0); assertActiveKeys(); } + + //JDK-8267221: + public void testMethodArrayParameters() { + MethodSnippet m1 = methodKey(assertEval("void m1(int... p) { }", added(VALID))); + assertEquals(m1.parameterTypes(), "int..."); + MethodSnippet m2 = methodKey(assertEval("void m2(int[]... p) { }", added(VALID))); + assertEquals(m2.parameterTypes(), "int[]..."); + MethodSnippet m3 = methodKey(assertEval("void m3(int[][] p) { }", added(VALID))); + assertEquals(m3.parameterTypes(), "int[][]"); + } } diff --git a/test/langtools/tools/doclint/tool/RunTest.java b/test/langtools/tools/doclint/tool/RunTest.java index 92d26895563..78415a95441 100644 --- a/test/langtools/tools/doclint/tool/RunTest.java +++ b/test/langtools/tools/doclint/tool/RunTest.java @@ -27,6 +27,7 @@ * @summary Supplementary test cases needed for doclint * @modules jdk.javadoc/jdk.javadoc.internal.doclint * jdk.compiler/com.sun.tools.javac.api + * @run main/othervm -Djava.security.manager=allow RunTest */ import java.io.ByteArrayOutputStream; diff --git a/test/langtools/tools/javac/NoStringToLower.java b/test/langtools/tools/javac/NoStringToLower.java index cb1f7648deb..ddb8490f649 100644 --- a/test/langtools/tools/javac/NoStringToLower.java +++ b/test/langtools/tools/javac/NoStringToLower.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -63,14 +63,13 @@ boolean run(String... args) throws Exception { "javax.tools", "com.sun.source", "com.sun.tools.classfile", - "com.sun.tools.doclet", "com.sun.tools.doclint", "com.sun.tools.javac", - "com.sun.tools.javadoc", "com.sun.tools.javah", "com.sun.tools.javap", "com.sun.tools.jdeps", - "com.sun.tools.sjavac" + "com.sun.tools.sjavac", + "jdk.javadoc" }; for (String pkg: pkgs) { for (JavaFileObject fo: fm.list(javacLoc, diff --git a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java index ca5ad12586a..9d2f83bb372 100644 --- a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java +++ b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -73,12 +73,9 @@ public class DetectMutableStaticFields { private final String[] packagesToSeekFor = new String[] { "javax.tools", "javax.lang.model", - "com.sun.javadoc", "com.sun.source", "com.sun.tools.classfile", - "com.sun.tools.doclets", "com.sun.tools.javac", - "com.sun.tools.javadoc", "com.sun.tools.javah", "com.sun.tools.javap", "jdk.javadoc" @@ -91,7 +88,6 @@ private static void ignore(String className, String... fields) { static { ignore("javax/tools/ToolProvider", "instance"); - ignore("jdk/javadoc/internal/tool/Start", "versionRB"); ignore("com/sun/tools/javah/JavahTask", "versionRB"); ignore("com/sun/tools/classfile/Dependencies$DefaultFilter", "instance"); ignore("com/sun/tools/javap/JavapTask", "versionRB"); diff --git a/test/langtools/tools/javac/api/ToolProvider/ToolProviderTest.java b/test/langtools/tools/javac/api/ToolProvider/ToolProviderTest.java index 85b5d3b28b1..ceedbcb50e5 100644 --- a/test/langtools/tools/javac/api/ToolProvider/ToolProviderTest.java +++ b/test/langtools/tools/javac/api/ToolProvider/ToolProviderTest.java @@ -33,7 +33,7 @@ * @summary Test javax.tools.ToolProvider running with security manager * @modules java.compiler * jdk.compiler - * @run main/othervm ToolProviderTest + * @run main/othervm -Djava.security.manager=allow ToolProviderTest */ // run in other vm to ensure the initialization code path is exercised. diff --git a/test/langtools/tools/javac/options/modes/InfoOptsTest.java b/test/langtools/tools/javac/options/modes/InfoOptsTest.java index eafe58ce4b8..9818dc2e82a 100644 --- a/test/langtools/tools/javac/options/modes/InfoOptsTest.java +++ b/test/langtools/tools/javac/options/modes/InfoOptsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -23,8 +23,8 @@ /* * @test - * @bug 8044859 - * @summary test support for info options -help -X -version -fullversion + * @bug 8044859 8230623 + * @summary test support for info options -help -X -version -fullversion --help-lint * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * jdk.compiler/com.sun.tools.javac.main @@ -45,6 +45,7 @@ public static void main(String... args) throws Exception { void testInfoOpts() throws IOException { testInfoOpt("-help", "-deprecation"); testInfoOpt("-X", "-Xlint"); + testInfoOpt("--help-lint", "supported keys"); String specVersion = System.getProperty("java.specification.version"); testInfoOpt("-version", "javac", specVersion); diff --git a/test/langtools/tools/javac/parser/JavacParserTest.java b/test/langtools/tools/javac/parser/JavacParserTest.java index cc784db3211..2fff2eea4ad 100644 --- a/test/langtools/tools/javac/parser/JavacParserTest.java +++ b/test/langtools/tools/javac/parser/JavacParserTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 8256149 8259050 8266436 + * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 8256149 8259050 8266436 8267221 * @summary tests error and diagnostics positions * @author Jan Lahoda * @modules jdk.compiler/com.sun.tools.javac.api @@ -1775,6 +1775,27 @@ public class Test { assertEquals("expected null as constructor return type", constr.getReturnType(), null); } + @Test //JDK-8267221 + void testVarArgArrayParameter() throws IOException { + String code = """ + package test; + public class Test { + private void test(int[]... p) {} + } + """; + + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, null, + null, null, Arrays.asList(new MyFileObject(code))); + CompilationUnitTree cut = ct.parse().iterator().next(); + ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); + MethodTree constr = (MethodTree) clazz.getMembers().get(0); + VariableTree param = constr.getParameters().get(0); + SourcePositions sp = Trees.instance(ct).getSourcePositions(); + int typeStart = (int) sp.getStartPosition(cut, param.getType()); + int typeEnd = (int) sp.getEndPosition(cut, param.getType()); + assertEquals("correct parameter type span", code.substring(typeStart, typeEnd), "int[]..."); + } + void run(String[] args) throws Exception { int passed = 0, failed = 0; final Pattern p = (args != null && args.length > 0) diff --git a/test/langtools/tools/javac/processing/6348193/T6348193.java b/test/langtools/tools/javac/processing/6348193/T6348193.java index 9165fc0495a..cc6400a1b38 100644 --- a/test/langtools/tools/javac/processing/6348193/T6348193.java +++ b/test/langtools/tools/javac/processing/6348193/T6348193.java @@ -28,7 +28,7 @@ * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.file * @compile -proc:none T6348193.java - * @run main/othervm T6348193 + * @run main/othervm -Djava.security.manager=allow T6348193 */ import java.io.*; diff --git a/test/langtools/tools/javac/processing/model/element/CheckingAccessorsOnLoadedRecordClasses.java b/test/langtools/tools/javac/processing/model/element/CheckingAccessorsOnLoadedRecordClasses.java new file mode 100644 index 00000000000..914852f758d --- /dev/null +++ b/test/langtools/tools/javac/processing/model/element/CheckingAccessorsOnLoadedRecordClasses.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 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 + * @summary Verify that annotation processing works for records + * @library /tools/lib /tools/javac/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.util + * @build toolbox.ToolBox toolbox.JavacTask + * @build JavacTestingAbstractProcessor + * @compile CheckingAccessorsOnLoadedRecordClasses.java + * @run main/othervm CheckingAccessorsOnLoadedRecordClasses + */ + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; + +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.RecordComponentElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.util.ElementFilter; +import javax.lang.model.util.ElementScanner14; +import javax.tools.Diagnostic.Kind; +import javax.tools.*; + +import java.lang.annotation.*; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import javax.lang.model.type.*; +import javax.tools.Diagnostic.Kind; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.sun.tools.javac.util.Assert; + +import toolbox.JavacTask; +import toolbox.Task; +import toolbox.Task.Mode; +import toolbox.Task.OutputKind; +import toolbox.TestRunner; +import toolbox.ToolBox; + +public class CheckingAccessorsOnLoadedRecordClasses extends TestRunner { + protected ToolBox tb; + + CheckingAccessorsOnLoadedRecordClasses() { + super(System.err); + tb = new ToolBox(); + } + + public static void main(String... args) throws Exception { + new CheckingAccessorsOnLoadedRecordClasses().runTests(); + } + + protected void runTests() throws Exception { + runTests(m -> new Object[] { Paths.get(m.getName()) }); + } + + Path[] findJavaFiles(Path... paths) throws IOException { + return tb.findJavaFiles(paths); + } + + static final String RecordSrc = + """ + package pkg1; + import java.util.List; + public record R(List data) {} + """; + + static final String ISrc = + """ + package pkg2; + import pkg1.R; + + @FunctionalInterface + public interface I { + void foo(R r); + } + """; + + @Test + public void testAnnoProcessing(Path base) throws Exception { + Path src = base.resolve("src"); + Path out = base.resolve("out"); + Files.createDirectories(out); + Path pkg1 = src.resolve("pkg1"); + + tb.writeJavaFiles(src, RecordSrc); + // lets first compile the record + new JavacTask(tb) + .files(findJavaFiles(pkg1)) + .outdir(out) + .run(); + + Path pkg2 = src.resolve("pkg2"); + tb.writeJavaFiles(src, ISrc); + /* now the annotated interface which uses the record, given that the record class + * is now in the classpath, we will force jvm.ClassReader to load it and set the + * accessors correctly + */ + new JavacTask(tb, Mode.API) + .options("-nowarn", "-processor", Processor.class.getName()) + .classpath(out) + .files(findJavaFiles(pkg2)) + .outdir(out) + .run(); + } + + /** This processor will look for records in the arguments of the methods annotated with any + * annotation for a given source. Then it will check that those records have at least one + * record component and that the accessor associated with it is not null and that it has the + * same name as its corresponding record component + */ + @SupportedAnnotationTypes("*") + public static final class Processor extends JavacTestingAbstractProcessor { + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + for (TypeElement annotation : annotations) { + Set annotatedElems = roundEnv.getElementsAnnotatedWith(annotation); + for (Element annotatedElement : annotatedElems) { + TypeElement typeElement = (TypeElement) annotatedElement; + + for (Element enclosedElement : typeElement.getEnclosedElements()) { + if (enclosedElement.getKind() == ElementKind.METHOD) { + validateMethod((ExecutableElement) enclosedElement, roundEnv); + } + } + } + } + } + return false; + } + + protected void validateMethod(ExecutableElement method, RoundEnvironment roundEnv) { + for (VariableElement parameter : method.getParameters()) { + TypeMirror parameterType = parameter.asType(); + if (parameterType.getKind() == TypeKind.DECLARED) { + Element parameterElement = ((DeclaredType) parameterType).asElement(); + if (parameterElement.getKind() == ElementKind.RECORD) { + validateRecord((TypeElement) parameterElement, roundEnv); + } + } + } + } + + protected void validateRecord(TypeElement recordElement, RoundEnvironment roundEnv) { + List recordComponents = recordElement.getRecordComponents(); + + if (recordComponents.isEmpty()) { + processingEnv.getMessager() + .printMessage(Diagnostic.Kind.ERROR, "Record element " + recordElement.getQualifiedName() + + " has no record components"); + } else { + for (RecordComponentElement recordComponent : recordComponents) { + ExecutableElement accessor = recordComponent.getAccessor(); + if (accessor == null) { + processingEnv.getMessager() + .printMessage(Diagnostic.Kind.ERROR, + "Record component " + recordComponent.getSimpleName() + " from record " + recordElement + .getQualifiedName() + " has no accessor"); + } + if (!accessor.getSimpleName().equals(recordComponent.getSimpleName())) { + processingEnv.getMessager() + .printMessage(Diagnostic.Kind.ERROR, + "Record component " + recordComponent.getSimpleName() + " from record " + + recordElement.getQualifiedName() + " has an accessor with name " + accessor.getSimpleName()); + } + } + } + } + } +} diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out b/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out index 8abfdabccd4..1759e3a2408 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out @@ -1,4 +1,4 @@ -ExpressionSwitch.java:40:16: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.expressions), 9, 14 -ExpressionSwitch.java:41:20: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.rules), 9, 14 -ExpressionSwitch.java:93:31: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.multiple.case.labels), 9, 14 +ExpressionSwitch.java:41:16: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.expressions), 9, 14 +ExpressionSwitch.java:42:20: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.rules), 9, 14 +ExpressionSwitch.java:94:31: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.multiple.case.labels), 9, 14 3 errors diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java index 96980e38843..65a127a3c16 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8206986 8222169 8224031 8240964 + * @bug 8206986 8222169 8224031 8240964 8267119 * @summary Check expression switch works. * @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java * @compile ExpressionSwitch.java @@ -34,6 +34,7 @@ private void run() { assertEquals(convert2(""), -1); localClass(T.A); assertEquals(castSwitchExpressions(T.A), "A"); + testTypeInference(true, 0); } private String print(T t) { @@ -144,6 +145,17 @@ private String castSwitchExpressions(T t) { }; } + private void testTypeInference(boolean b, int i) { + m(s -> s.length(), String.class); + m(b ? s -> s.length() : s -> s.length(), String.class); + m(switch (i) { + case 0 -> s -> s.length(); + default -> s -> s.length(); + }, String.class); + } + + void m(Consumer c, Class cl) {} + private void check(T t, String expected) { String result = print(t); assertEquals(result, expected); @@ -162,4 +174,8 @@ void t() { Runnable r = () -> {}; r.run(); } + + interface Consumer { + public void consume(Z z); + } } diff --git a/test/lib/jtreg/SkippedException.java b/test/lib/jtreg/SkippedException.java index 818775ccf8c..3bcde389dd5 100644 --- a/test/lib/jtreg/SkippedException.java +++ b/test/lib/jtreg/SkippedException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -28,6 +28,8 @@ * of skipped status. */ public final class SkippedException extends RuntimeException { + private static final long serialVersionUID = 1347132660681446077L; + public SkippedException(String s, Throwable t) { super(s, t); } diff --git a/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchConstant.java b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchConstant.java new file mode 100644 index 00000000000..dca928ef61b --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchConstant.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.lang.invoke; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.MutableCallSite; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(3) +public class MethodHandlesTableSwitchConstant { + + // Switch combinator test for a single constant input index + + private static final MethodType callType = MethodType.methodType(int.class, int.class); + + private static final MutableCallSite cs = new MutableCallSite(callType); + private static final MethodHandle target = cs.dynamicInvoker(); + + private static final MutableCallSite csInput = new MutableCallSite(MethodType.methodType(int.class)); + private static final MethodHandle targetInput = csInput.dynamicInvoker(); + + private static final MethodHandle MH_SUBTRACT; + private static final MethodHandle MH_DEFAULT; + private static final MethodHandle MH_PAYLOAD; + + static { + try { + MH_SUBTRACT = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchConstant.class, "subtract", + MethodType.methodType(int.class, int.class, int.class)); + MH_DEFAULT = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchConstant.class, "defaultCase", + MethodType.methodType(int.class, int.class)); + MH_PAYLOAD = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchConstant.class, "payload", + MethodType.methodType(int.class, int.class, int.class)); + } catch (ReflectiveOperationException e) { + throw new ExceptionInInitializerError(e); + } + } + + // Using batch size since we really need a per-invocation setup + // but the measured code is too fast. Using JMH batch size doesn't work + // since there is no way to do a batch-level setup as well. + private static final int BATCH_SIZE = 1_000_000; + + @Param({ + "5", + "10", + "25" + }) + public int numCases; + + + @Param({ + "0", + "150" + }) + public int offset; + + @Setup(Level.Trial) + public void setupTrial() throws Throwable { + MethodHandle[] cases = IntStream.range(0, numCases) + .mapToObj(i -> MethodHandles.insertArguments(MH_PAYLOAD, 1, i)) + .toArray(MethodHandle[]::new); + MethodHandle switcher = MethodHandles.tableSwitch(MH_DEFAULT, cases); + if (offset != 0) { + switcher = MethodHandles.filterArguments(switcher, 0, MethodHandles.insertArguments(MH_SUBTRACT, 1, offset)); + } + cs.setTarget(switcher); + + int input = ThreadLocalRandom.current().nextInt(numCases) + offset; + csInput.setTarget(MethodHandles.constant(int.class, input)); + } + + private static int payload(int dropped, int constant) { + return constant; + } + + private static int subtract(int a, int b) { + return a - b; + } + + private static int defaultCase(int x) { + throw new IllegalStateException(); + } + + @Benchmark + public void testSwitch(Blackhole bh) throws Throwable { + for (int i = 0; i < BATCH_SIZE; i++) { + bh.consume((int) target.invokeExact((int) targetInput.invokeExact())); + } + } + +} diff --git a/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchOpaqueSingle.java b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchOpaqueSingle.java new file mode 100644 index 00000000000..b0d45e471a9 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchOpaqueSingle.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.lang.invoke; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.MutableCallSite; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(3) +public class MethodHandlesTableSwitchOpaqueSingle { + + // Switch combinator test for a single input index, but opaquely fed in, so the JIT + // does not see it as a constant. + + private static final MethodType callType = MethodType.methodType(int.class, int.class); + + private static final MutableCallSite cs = new MutableCallSite(callType); + private static final MethodHandle target = cs.dynamicInvoker(); + + private static final MethodHandle MH_DEFAULT; + private static final MethodHandle MH_PAYLOAD; + + static { + try { + MH_DEFAULT = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchOpaqueSingle.class, "defaultCase", + MethodType.methodType(int.class, int.class)); + MH_PAYLOAD = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchOpaqueSingle.class, "payload", + MethodType.methodType(int.class, int.class, int.class)); + } catch (ReflectiveOperationException e) { + throw new ExceptionInInitializerError(e); + } + } + + // Using batch size since we really need a per-invocation setup + // but the measured code is too fast. Using JMH batch size doesn't work + // since there is no way to do a batch-level setup as well. + private static final int BATCH_SIZE = 1_000_000; + + @Param({ + "5", + "10", + "25" + }) + public int numCases; + + public int input; + + @Setup(Level.Trial) + public void setupTrial() throws Throwable { + MethodHandle[] cases = IntStream.range(0, numCases) + .mapToObj(i -> MethodHandles.insertArguments(MH_PAYLOAD, 1, i)) + .toArray(MethodHandle[]::new); + MethodHandle switcher = MethodHandles.tableSwitch(MH_DEFAULT, cases); + cs.setTarget(switcher); + + input = ThreadLocalRandom.current().nextInt(numCases); + } + + private static int payload(int dropped, int constant) { + return constant; + } + + private static int defaultCase(int x) { + throw new IllegalStateException(); + } + + @Benchmark + public void testSwitch(Blackhole bh) throws Throwable { + for (int i = 0; i < BATCH_SIZE; i++) { + bh.consume((int) target.invokeExact(input)); + } + } + +} diff --git a/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchRandom.java b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchRandom.java new file mode 100644 index 00000000000..94c21c1cc92 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/invoke/MethodHandlesTableSwitchRandom.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.lang.invoke; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.invoke.MutableCallSite; +import java.util.Arrays; +import java.util.Random; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(3) +public class MethodHandlesTableSwitchRandom { + + // Switch combinator test for a random input index, testing several switch sizes + + private static final MethodType callType = MethodType.methodType(int.class, int.class); + + private static final MutableCallSite cs = new MutableCallSite(callType); + private static final MethodHandle target = cs.dynamicInvoker(); + + private static final MethodHandle MH_DEFAULT; + private static final MethodHandle MH_PAYLOAD; + + static { + try { + MH_DEFAULT = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchRandom.class, "defaultCase", + MethodType.methodType(int.class, int.class)); + MH_PAYLOAD = MethodHandles.lookup().findStatic(MethodHandlesTableSwitchRandom.class, "payload", + MethodType.methodType(int.class, int.class, int.class)); + } catch (ReflectiveOperationException e) { + throw new ExceptionInInitializerError(e); + } + } + + // Using batch size since we really need a per-invocation setup + // but the measured code is too fast. Using JMH batch size doesn't work + // since there is no way to do a batch-level setup as well. + private static final int BATCH_SIZE = 1_000_000; + + @Param({ + "5", + "10", + "25" + }) + public int numCases; + + @Param({ + "true", + "false" + }) + public boolean sorted; + + public int[] inputs; + + @Setup(Level.Trial) + public void setupTrial() throws Throwable { + MethodHandle[] cases = IntStream.range(0, numCases) + .mapToObj(i -> MethodHandles.insertArguments(MH_PAYLOAD, 1, i)) + .toArray(MethodHandle[]::new); + MethodHandle switcher = MethodHandles.tableSwitch(MH_DEFAULT, cases); + + cs.setTarget(switcher); + + inputs = new int[BATCH_SIZE]; + Random rand = new Random(0); + for (int i = 0; i < BATCH_SIZE; i++) { + inputs[i] = rand.nextInt(numCases); + } + + if (sorted) { + Arrays.sort(inputs); + } + } + + private static int payload(int dropped, int constant) { + return constant; + } + + private static int defaultCase(int x) { + throw new IllegalStateException(); + } + + @Benchmark + public void testSwitch(Blackhole bh) throws Throwable { + for (int i = 0; i < inputs.length; i++) { + bh.consume((int) target.invokeExact(inputs[i])); + } + } + +} diff --git a/test/micro/org/openjdk/bench/java/util/stream/ops/ref/SliceToList.java b/test/micro/org/openjdk/bench/java/util/stream/ops/ref/SliceToList.java new file mode 100644 index 00000000000..9ed94b3af34 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/util/stream/ops/ref/SliceToList.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.util.stream.ops.ref; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +/** + * Benchmark for limit()/skip() operation in sized streams. + */ +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@State(Scope.Thread) +public class SliceToList { + + @Param("10000") + private int size; + + @Benchmark + public List seq_baseline() { + return IntStream.range(0, size) + .mapToObj(x -> "x") + .toList(); + } + + @Benchmark + public List seq_limit() { + return IntStream.range(0, size * 2) + .mapToObj(x -> "x") + .limit(size) + .toList(); + } + + @Benchmark + public List seq_skipLimit() { + return IntStream.range(0, size * 2) + .mapToObj(x -> "x") + .skip(1) + .limit(size) + .toList(); + } + + @Benchmark + public List par_baseline() { + return IntStream.range(0, size) + .parallel() + .mapToObj(x -> "x") + .toList(); + } + + @Benchmark + public List par_limit() { + return IntStream.range(0, size * 2) + .parallel() + .mapToObj(x -> "x") + .limit(size) + .toList(); + } + + @Benchmark + public List par_skipLimit() { + return IntStream.range(0, size * 2) + .parallel() + .mapToObj(x -> "x") + .skip(1) + .limit(size) + .toList(); + } +} diff --git a/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedCount.java b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedCount.java new file mode 100644 index 00000000000..b061d8ece54 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedCount.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.util.stream.ops.value; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.concurrent.TimeUnit; +import java.util.stream.DoubleStream; +import java.util.stream.IntStream; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +/** + * Benchmark for count operation in sized streams. + */ +@Fork(5) +@Warmup(iterations = 10, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 20, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +public class SizedCount { + @Param("10000") + private int size; + + @Param({"true", "false"}) + private boolean polluteTypeProfile; + + @Setup + public void setup() { + if (!polluteTypeProfile) return; + for(int i=0; i<10000; i++) { + IntStream.empty().skip(1).count(); + LongStream.empty().skip(1).count(); + DoubleStream.empty().skip(1).count(); + Stream.empty().skip(1).count(); + } + } + + @Benchmark + public long count0() { + return IntStream.range(0, size) + .count(); + } + + @Benchmark + public long count2() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .count(); + } + + @Benchmark + public long count4() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .count(); + } + + @Benchmark + public long count6() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .count(); + } + + @Benchmark + public long count8() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .count(); + } + + @Benchmark + public long count10() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .count(); + } + + @Benchmark + public long count10Skip() { + return IntStream.range(0, size) + .skip(1) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .count(); + } +} diff --git a/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedSum.java b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedSum.java new file mode 100644 index 00000000000..0d12af0c4ce --- /dev/null +++ b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SizedSum.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.util.stream.ops.value; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.concurrent.TimeUnit; +import java.util.stream.DoubleStream; +import java.util.stream.IntStream; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +/** + * Benchmark for sum operation in sized streams. + */ +@Fork(5) +@Warmup(iterations = 10, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 20, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +public class SizedSum { + @Param({"5", "10"}) + private int size; + + @Param({"true", "false"}) + private boolean polluteTypeProfile; + + @Setup + public void setup() { + if (!polluteTypeProfile) return; + for(int i=0; i<10000; i++) { + IntStream.empty().skip(1).count(); + LongStream.empty().skip(1).count(); + DoubleStream.empty().skip(1).count(); + Stream.empty().skip(1).count(); + } + } + + @Benchmark + public long sum0() { + return IntStream.range(0, size) + .sum(); + } + + @Benchmark + public long sum2() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .sum(); + } + + @Benchmark + public long sum4() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .sum(); + } + + @Benchmark + public long sum6() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .sum(); + } + + @Benchmark + public long sum8() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .sum(); + } + + @Benchmark + public long sum10() { + return IntStream.range(0, size) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .sum(); + } + + @Benchmark + public long sum10Skip() { + return IntStream.range(0, size) + .skip(1) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .map(x -> x) + .sum(); + } +} diff --git a/test/micro/org/openjdk/bench/java/util/stream/ops/value/SliceToArray.java b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SliceToArray.java new file mode 100644 index 00000000000..09ff2c647f0 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/util/stream/ops/value/SliceToArray.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 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. + */ +package org.openjdk.bench.java.util.stream.ops.value; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +/** + * Benchmark for limit()/skip() operation in sized streams. + */ +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@State(Scope.Thread) +public class SliceToArray { + + @Param("10000") + private int size; + + @Benchmark + public int[] seq_baseline() { + return IntStream.range(0, size) + .toArray(); + } + + @Benchmark + public int[] seq_limit() { + return IntStream.range(0, size * 2) + .limit(size) + .toArray(); + } + + @Benchmark + public int[] seq_skipLimit() { + return IntStream.range(0, size * 2) + .skip(1) + .limit(size) + .toArray(); + } + + @Benchmark + public int[] par_baseline() { + return IntStream.range(0, size) + .parallel() + .toArray(); + } + + @Benchmark + public int[] par_limit() { + return IntStream.range(0, size * 2) + .parallel() + .limit(size) + .toArray(); + } + + @Benchmark + public int[] par_skipLimit() { + return IntStream.range(0, size * 2) + .parallel() + .skip(1) + .limit(size) + .toArray(); + } +} diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMBench.java b/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMBench.java index 1166d28d765..1f0e8574c15 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMBench.java +++ b/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMBench.java @@ -82,8 +82,6 @@ public void setup() throws NoSuchAlgorithmException, NoSuchPaddingException, Inv encryptCipher.init(Cipher.ENCRYPT_MODE, ks, gcm_spec); encryptCipher.updateAAD(aad); decryptCipher = makeCipher(prov, algorithm); - decryptCipher.init(Cipher.DECRYPT_MODE, ks, encryptCipher.getParameters().getParameterSpec(GCMParameterSpec.class)); - decryptCipher.updateAAD(aad); data = fillRandom(new byte[dataSize]); encryptedData = encryptCipher.doFinal(data); }