From c956e7ca8d1982438156e53932aff375355def57 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 21 Jun 2019 13:04:14 -0700 Subject: [PATCH] 8185139: [Graal] Tests which set too restrictive security manager fail with Graal Tests should also check default policy Reviewed-by: mchung, dfuchs, alanb, mullan --- test/jdk/ProblemList-graal.txt | 44 +------------------ .../ClassDeclaredFieldsTest.java | 5 ++- .../FieldSetAccessibleTest.java | 5 ++- test/jdk/java/lang/ProcessBuilder/Basic.java | 4 +- .../ProcessBuilder/SecurityManagerClinit.java | 13 +++--- .../lang/ProcessHandle/PermissionTest.java | 7 ++- .../Logger/custom/CustomLoggerTest.java | 6 ++- .../Logger/default/DefaultLoggerTest.java | 7 ++- .../BaseLoggerFinderTest.java | 6 ++- .../DefaultLoggerFinderTest.java | 6 ++- .../BaseLoggerBridgeTest.java | 6 ++- .../BasePlatformLoggerTest.java | 6 ++- .../LoggerBridgeTest/LoggerBridgeTest.java | 6 ++- .../PlatformLoggerBridgeTest.java | 6 ++- .../DefaultLoggerBridgeTest.java | 6 ++- .../DefaultPlatformLoggerTest.java | 6 ++- .../lang/invoke/InvokeDynamicPrintArgs.java | 6 ++- .../lang/invoke/MethodHandleConstants.java | 6 ++- .../Policy/Dynamic/DynamicPolicy.java | 5 ++- .../Executors/PrivilegedCallables.java | 4 +- .../util/logging/FileHandlerLongLimit.java | 6 ++- .../java/util/logging/FileHandlerPath.java | 6 ++- .../logging/FileHandlerPatternExceptions.java | 6 ++- .../ParentLoggerWithHandlerGC.java | 6 ++- .../HandlersOnComplexResetUpdate.java | 4 +- .../HandlersOnComplexUpdate.java | 4 +- .../SimpleUpdateConfigurationTest.java | 6 ++- .../setLevel/TestRootLoggerLevel.java | 7 ++- .../logging/LogManagerAppContextDeadlock.java | 6 ++- .../RootLogger/RootLevelInConfigFile.java | 6 ++- .../util/logging/TestAppletLoggerContext.java | 7 ++- .../logging/TestConfigurationListeners.java | 6 ++- 32 files changed, 128 insertions(+), 102 deletions(-) diff --git a/test/jdk/ProblemList-graal.txt b/test/jdk/ProblemList-graal.txt index 5bc3355abd..3902f12eec 100644 --- a/test/jdk/ProblemList-graal.txt +++ b/test/jdk/ProblemList-graal.txt @@ -27,48 +27,8 @@ # ############################################################################# -java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java 8185139 generic-all -java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java 8185139 generic-all -java/lang/invoke/InvokeDynamicPrintArgs.java 8185139 generic-all -java/lang/invoke/MethodHandleConstants.java 8185139 generic-all -java/lang/ProcessBuilder/Basic.java#id0 8185139 generic-all -java/lang/ProcessBuilder/Basic.java#id1 8185139 generic-all -java/lang/ProcessBuilder/SecurityManagerClinit.java 8185139 generic-all -java/lang/ProcessHandle/PermissionTest.java 8185139 generic-all -java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java 8185139 generic-all -java/lang/StackWalker/CallerSensitiveMethod/Main.java 8185139 generic-all -java/lang/StackWalker/GetCallerClassTest.java 8185139 generic-all -java/lang/String/concat/WithSecurityManager.java 8185139 generic-all -java/lang/System/Logger/custom/CustomLoggerTest.java 8185139 generic-all -java/lang/System/Logger/default/DefaultLoggerTest.java 8185139 generic-all -java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java 8185139 generic-all -java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java 8185139 generic-all -java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java 8185139 generic-all -java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java 8185139 generic-all -java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java 8185139 generic-all -java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java 8185139 generic-all -java/util/concurrent/atomic/AtomicUpdaters.java 8185139 generic-all -java/util/concurrent/Executors/PrivilegedCallables.java 8185139 generic-all -java/util/logging/FileHandlerPath.java 8185139 generic-all -java/util/logging/FileHandlerPatternExceptions.java 8185139 generic-all -java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java 8185139 generic-all -java/util/logging/LogManagerAppContextDeadlock.java 8185139 generic-all -java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java 8185139 generic-all -java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java 8185139 generic-all -java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java 8185139 generic-all -java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java 8185139 generic-all -java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java 8185139 generic-all -java/util/logging/RootLogger/RootLevelInConfigFile.java 8185139 generic-all -java/util/logging/TestAppletLoggerContext.java 8185139 generic-all -java/util/logging/TestConfigurationListeners.java 8185139 generic-all -java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java 8185139 generic-all -java/util/logging/FileHandlerLongLimit.java 8185139 generic-all +java/lang/String/concat/WithSecurityManager.java 8207267 generic-all +java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java 8207267 generic-all java/util/concurrent/tck/JSR166TestCase.java 8187486 generic-all diff --git a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java index 0c53acc9f2..1b112699b6 100644 --- a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java +++ b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -166,6 +166,7 @@ public class ClassDeclaredFieldsTest { // Policy for the test... public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowAll; // actually: this should be in a thread locale @@ -187,7 +188,7 @@ public class ClassDeclaredFieldsTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java index d39dc6c9ca..b0a3ed035b 100644 --- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java +++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -385,6 +385,8 @@ public class FieldSetAccessibleTest { // Policy for the test... public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowAll; @@ -420,6 +422,7 @@ public class FieldSetAccessibleTest { return true; } } + if (DEFAULT_POLICY.implies(domain, permission)) return true; return false; } diff --git a/test/jdk/java/lang/ProcessBuilder/Basic.java b/test/jdk/java/lang/ProcessBuilder/Basic.java index 4d8a9e81e0..0b1713e1ee 100644 --- a/test/jdk/java/lang/ProcessBuilder/Basic.java +++ b/test/jdk/java/lang/ProcessBuilder/Basic.java @@ -2602,6 +2602,8 @@ public class Basic { // A Policy class designed to make permissions fiddling very easy. //---------------------------------------------------------------- private static class Policy extends java.security.Policy { + static final java.security.Policy DEFAULT_POLICY = java.security.Policy.getPolicy(); + private Permissions perms; public void setPermissions(Permission...permissions) { @@ -2621,7 +2623,7 @@ public class Basic { } public boolean implies(ProtectionDomain pd, Permission p) { - return perms.implies(p); + return perms.implies(p) || DEFAULT_POLICY.implies(pd, p); } public void refresh() {} diff --git a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java index a72cdbe9c9..ee0319bc11 100644 --- a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java +++ b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java @@ -1,5 +1,6 @@ /* * Copyright 2010 Google Inc. All Rights Reserved. + * Copyright (c) 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 @@ -35,17 +36,19 @@ import java.io.*; import java.security.*; public class SecurityManagerClinit { - private static class Policy extends java.security.Policy { + private static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + private Permissions perms; - public Policy(Permission... permissions) { + public SimplePolicy(Permission... permissions) { perms = new Permissions(); for (Permission permission : permissions) perms.add(permission); } public boolean implies(ProtectionDomain pd, Permission p) { - return perms.implies(p); + return perms.implies(p) || DEFAULT_POLICY.implies(pd, p); } } @@ -54,8 +57,8 @@ public class SecurityManagerClinit { System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; - final Policy policy = - new Policy + final SimplePolicy policy = + new SimplePolicy (new FilePermission("<>", "execute"), new RuntimePermission("setSecurityManager")); Policy.setPolicy(policy); diff --git a/test/jdk/java/lang/ProcessHandle/PermissionTest.java b/test/jdk/java/lang/ProcessHandle/PermissionTest.java index 7d596c2695..055152ebca 100644 --- a/test/jdk/java/lang/ProcessHandle/PermissionTest.java +++ b/test/jdk/java/lang/ProcessHandle/PermissionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -178,6 +178,9 @@ public class PermissionTest { } class TestPolicy extends Policy { + + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + private final PermissionCollection permissions = new Permissions(); public TestPolicy() { @@ -222,6 +225,6 @@ class TestPolicy extends Policy { @Override public boolean implies(ProtectionDomain domain, Permission perm) { - return permissions.implies(perm); + return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm); } } diff --git a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java index 4e18babd0b..823ba62adf 100644 --- a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java +++ b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -704,6 +704,8 @@ public class CustomLoggerTest { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + static final RuntimePermission LOGGERFINDER_PERMISSION = new RuntimePermission("loggerFinder"); final Permissions permissions; @@ -736,7 +738,7 @@ public class CustomLoggerTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return permissions().implies(permission); + return permissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java index 4a2be556bf..aaac885ec1 100644 --- a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java +++ b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -884,6 +884,9 @@ public class DefaultLoggerTest { } public static class SimplePolicy extends Policy { + + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + static final RuntimePermission LOGGERFINDER_PERMISSION = new RuntimePermission("loggerFinder"); final Permissions permissions; @@ -908,7 +911,7 @@ public class DefaultLoggerTest { public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); if (allowControl.get().get()) return controlPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java index b3805919e5..ab08bb08aa 100644 --- a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -652,6 +652,8 @@ public class BaseLoggerFinderTest { final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION; final static RuntimePermission ACCESS = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final ThreadLocal allowControl; final ThreadLocal allowAccess; @@ -678,7 +680,7 @@ public class BaseLoggerFinderTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java index 5a84b16a0e..e040b5b8dc 100644 --- a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -842,6 +842,8 @@ public class DefaultLoggerFinderTest { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions withControlPermissions; final Permissions allPermissions; @@ -865,7 +867,7 @@ public class DefaultLoggerFinderTest { public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); if (allowControl.get().get()) return withControlPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 f179f35838..e52434f019 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -981,6 +981,8 @@ public class BaseLoggerBridgeTest { final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowControl; @@ -1019,7 +1021,7 @@ public class BaseLoggerBridgeTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 a1de820866..9e6dc7a4a7 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -663,6 +663,8 @@ public class BasePlatformLoggerTest { final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION; final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowControl; @@ -700,7 +702,7 @@ public class BasePlatformLoggerTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 99678cd332..c3f5d7e206 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -1026,6 +1026,8 @@ public class LoggerBridgeTest { final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowControl; @@ -1064,7 +1066,7 @@ public class LoggerBridgeTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 6b4f4bf4d8..ff4f980216 100644 --- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -805,6 +805,8 @@ public class PlatformLoggerBridgeTest { final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowControl; @@ -843,7 +845,7 @@ public class PlatformLoggerBridgeTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 d2348a2c9d..153a63bbf5 100644 --- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -801,6 +801,8 @@ public class DefaultLoggerBridgeTest { final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowControl; @@ -839,7 +841,7 @@ public class DefaultLoggerBridgeTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions().implies(permission); + return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 200b169b7c..c7f8cb44e6 100644 --- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java +++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -499,6 +499,8 @@ public class DefaultPlatformLoggerTest { public static final RuntimePermission LOGGERFINDER_PERMISSION = new RuntimePermission("loggerFinder"); + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions withControlPermissions; final Permissions allPermissions; @@ -522,7 +524,7 @@ public class DefaultPlatformLoggerTest { public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); if (allowControl.get().get()) return withControlPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java index 6bde420461..d20c467eea 100644 --- a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java +++ b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -234,6 +234,8 @@ public class InvokeDynamicPrintArgs { } static class TestPolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final PermissionCollection permissions = new Permissions(); TestPolicy() { permissions.add(new java.io.FilePermission("<>", "read")); @@ -247,7 +249,7 @@ public class InvokeDynamicPrintArgs { } public boolean implies(ProtectionDomain domain, Permission perm) { - return permissions.implies(perm); + return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm); } } } diff --git a/test/jdk/java/lang/invoke/MethodHandleConstants.java b/test/jdk/java/lang/invoke/MethodHandleConstants.java index 5f64e696ef..cf563aab82 100644 --- a/test/jdk/java/lang/invoke/MethodHandleConstants.java +++ b/test/jdk/java/lang/invoke/MethodHandleConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -169,6 +169,8 @@ public class MethodHandleConstants { } static class TestPolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final PermissionCollection permissions = new Permissions(); TestPolicy() { permissions.add(new java.io.FilePermission("<>", "read")); @@ -182,7 +184,7 @@ public class MethodHandleConstants { } public boolean implies(ProtectionDomain domain, Permission perm) { - return permissions.implies(perm); + return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm); } } } diff --git a/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java b/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java index 582eacba7f..5759b764e8 100644 --- a/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java +++ b/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -28,6 +28,7 @@ import java.lang.*; public class DynamicPolicy extends Policy{ + static final Policy DEFAULT_POLICY = Policy.getPolicy(); // do this early before setPolicy is called static int refresher = 0; @@ -48,7 +49,7 @@ public class DynamicPolicy extends Policy{ } public boolean implies(ProtectionDomain pd, Permission p) { - return getPermissions(pd).implies(p); + return getPermissions(pd).implies(p) || DEFAULT_POLICY.implies(pd, p); } public PermissionCollection getPermissions(ProtectionDomain pd) { diff --git a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java index d5a47f2877..3dd4c11ded 100644 --- a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java +++ b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java @@ -70,6 +70,8 @@ public class PrivilegedCallables { // A Policy class designed to make permissions fiddling very easy. //---------------------------------------------------------------- static class Policy extends java.security.Policy { + static final java.security.Policy DEFAULT_POLICY = java.security.Policy.getPolicy(); + private Permissions perms; public void setPermissions(Permission...permissions) { @@ -89,7 +91,7 @@ public class PrivilegedCallables { } public boolean implies(ProtectionDomain pd, Permission p) { - return perms.implies(p); + return perms.implies(p) || DEFAULT_POLICY.implies(pd, p); } public void refresh() {} diff --git a/test/jdk/java/util/logging/FileHandlerLongLimit.java b/test/jdk/java/util/logging/FileHandlerLongLimit.java index 028e14ef9c..169732d266 100644 --- a/test/jdk/java/util/logging/FileHandlerLongLimit.java +++ b/test/jdk/java/util/logging/FileHandlerLongLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -471,6 +471,8 @@ public class FileHandlerLongLimit { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final AtomicBoolean allowAll; @@ -490,7 +492,7 @@ public class FileHandlerLongLimit { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/util/logging/FileHandlerPath.java b/test/jdk/java/util/logging/FileHandlerPath.java index 9a7e8daec4..0d97dbf573 100644 --- a/test/jdk/java/util/logging/FileHandlerPath.java +++ b/test/jdk/java/util/logging/FileHandlerPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -270,6 +270,8 @@ public class FileHandlerPath { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final AtomicBoolean allowAll; @@ -297,7 +299,7 @@ public class FileHandlerPath { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java index 7209562edb..e971416241 100644 --- a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java +++ b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -294,6 +294,8 @@ public class FileHandlerPatternExceptions { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final AtomicBoolean allowAll; @@ -313,7 +315,7 @@ public class FileHandlerPatternExceptions { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java index e70928599e..b99b6a96ac 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -480,6 +480,8 @@ public class ParentLoggerWithHandlerGC { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final AtomicBoolean allowAll; @@ -499,7 +501,7 @@ public class ParentLoggerWithHandlerGC { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 97f438f595..ad9993ba94 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java @@ -522,6 +522,8 @@ public class HandlersOnComplexResetUpdate { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowAll; // actually: this should be in a thread locale @@ -541,7 +543,7 @@ public class HandlersOnComplexResetUpdate { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 cd5257cec5..079d3a44f1 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java @@ -521,6 +521,8 @@ public class HandlersOnComplexUpdate { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowAll; // actually: this should be in a thread locale @@ -540,7 +542,7 @@ public class HandlersOnComplexUpdate { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override 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 342f58b078..ecf7d34880 100644 --- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java +++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -652,6 +652,8 @@ public class SimpleUpdateConfigurationTest { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions basic; final Permissions control; final Permissions all; @@ -690,7 +692,7 @@ public class SimpleUpdateConfigurationTest { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return getPermissions(domain).implies(permission); + return getPermissions(domain).implies(permission) || DEFAULT_POLICY.implies(domain, permission); } public PermissionCollection permissions() { 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 c3a98fe963..437c863f2a 100644 --- a/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java +++ b/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -119,6 +119,9 @@ public class TestRootLoggerLevel { } private static final class SimplePolicy extends Policy { + + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + private final Permissions perms; private static final Permissions permissions(Permission... perms) { @@ -141,7 +144,7 @@ public class TestRootLoggerLevel { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return perms.implies(permission); + return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } } diff --git a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java index a4a1688389..4116d69620 100644 --- a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java +++ b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -340,6 +340,8 @@ public class LogManagerAppContextDeadlock { // Policy for the test... public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; final Permissions allPermissions; final ThreadLocal allowAll; // actually: this should be in a thread locale @@ -360,7 +362,7 @@ public class LogManagerAppContextDeadlock { @Override public boolean implies(ProtectionDomain domain, Permission permission) { if (allowAll.get().get()) return allPermissions.implies(permission); - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override diff --git a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java index c2de8de3fc..35401f8bdd 100644 --- a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java +++ b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -176,6 +176,8 @@ public class RootLevelInConfigFile { static final class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final PermissionCollection perms = new Permissions(); public SimplePolicy(String configFile) { perms.add(new LoggingPermission("control", null)); @@ -187,7 +189,7 @@ public class RootLevelInConfigFile { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return perms.implies(permission); + return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } } diff --git a/test/jdk/java/util/logging/TestAppletLoggerContext.java b/test/jdk/java/util/logging/TestAppletLoggerContext.java index 846f093d7b..6ca2a63de5 100644 --- a/test/jdk/java/util/logging/TestAppletLoggerContext.java +++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -72,6 +72,9 @@ public class TestAppletLoggerContext { // Avoids the hassle of dealing with files and system props... static class SimplePolicy extends Policy { + + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + private final Permissions perms; public SimplePolicy(Permission... permissions) { perms = new Permissions(); @@ -89,7 +92,7 @@ public class TestAppletLoggerContext { } @Override public boolean implies(ProtectionDomain pd, Permission p) { - return perms.implies(p); + return perms.implies(p) || DEFAULT_POLICY.implies(pd, p); } } diff --git a/test/jdk/java/util/logging/TestConfigurationListeners.java b/test/jdk/java/util/logging/TestConfigurationListeners.java index 03c7a7f7b8..ccdbdc9d78 100644 --- a/test/jdk/java/util/logging/TestConfigurationListeners.java +++ b/test/jdk/java/util/logging/TestConfigurationListeners.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -458,6 +458,8 @@ public class TestConfigurationListeners { public static class SimplePolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); + final Permissions permissions; public SimplePolicy(TestCase test) { permissions = new Permissions(); @@ -472,7 +474,7 @@ public class TestConfigurationListeners { @Override public boolean implies(ProtectionDomain domain, Permission permission) { - return permissions.implies(permission); + return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission); } @Override