8185139: [Graal] Tests which set too restrictive security manager fail with Graal
Summary: tests should also check default policy
Reviewed-by: mchung, dfuchs, alanb, mullan
--- a/test/jdk/ProblemList-graal.txt Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/ProblemList-graal.txt Fri Jun 21 13:04:14 2019 -0700
@@ -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
--- a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
// 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<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -187,7 +188,7 @@
@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
--- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
// 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<AtomicBoolean> allowAll;
@@ -420,6 +422,7 @@
return true;
}
}
+ if (DEFAULT_POLICY.implies(domain, permission)) return true;
return false;
}
--- a/test/jdk/java/lang/ProcessBuilder/Basic.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/ProcessBuilder/Basic.java Fri Jun 21 13:04:14 2019 -0700
@@ -2602,6 +2602,8 @@
// 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 boolean implies(ProtectionDomain pd, Permission p) {
- return perms.implies(p);
+ return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
}
public void refresh() {}
--- a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java Fri Jun 21 13:04:14 2019 -0700
@@ -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.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 @@
System.getProperty("java.home") +
File.separator + "bin" + File.separator + "java";
- final Policy policy =
- new Policy
+ final SimplePolicy policy =
+ new SimplePolicy
(new FilePermission("<<ALL FILES>>", "execute"),
new RuntimePermission("setSecurityManager"));
Policy.setPolicy(policy);
--- a/test/jdk/java/lang/ProcessHandle/PermissionTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/ProcessHandle/PermissionTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
}
class TestPolicy extends Policy {
+
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
private final PermissionCollection permissions = new Permissions();
public TestPolicy() {
@@ -222,6 +225,6 @@
@Override
public boolean implies(ProtectionDomain domain, Permission perm) {
- return permissions.implies(perm);
+ return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
}
}
--- a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return permissions().implies(permission);
+ return permissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 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
--- a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
final ThreadLocal<AtomicBoolean> allowAccess;
@@ -678,7 +680,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 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
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
@@ -1019,7 +1021,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
@@ -700,7 +702,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
@@ -1064,7 +1066,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
@@ -843,7 +845,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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<AtomicBoolean> allowControl;
@@ -839,7 +841,7 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return getPermissions().implies(permission);
+ return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override
--- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 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
--- a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
}
static class TestPolicy extends Policy {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
final PermissionCollection permissions = new Permissions();
TestPolicy() {
permissions.add(new java.io.FilePermission("<<ALL FILES>>", "read"));
@@ -247,7 +249,7 @@
}
public boolean implies(ProtectionDomain domain, Permission perm) {
- return permissions.implies(perm);
+ return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
}
}
}
--- a/test/jdk/java/lang/invoke/MethodHandleConstants.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandleConstants.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
}
static class TestPolicy extends Policy {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
final PermissionCollection permissions = new Permissions();
TestPolicy() {
permissions.add(new java.io.FilePermission("<<ALL FILES>>", "read"));
@@ -182,7 +184,7 @@
}
public boolean implies(ProtectionDomain domain, Permission perm) {
- return permissions.implies(perm);
+ return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
}
}
}
--- a/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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 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) {
--- a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java Fri Jun 21 13:04:14 2019 -0700
@@ -70,6 +70,8 @@
// 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 boolean implies(ProtectionDomain pd, Permission p) {
- return perms.implies(p);
+ return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
}
public void refresh() {}
--- a/test/jdk/java/util/logging/FileHandlerLongLimit.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/FileHandlerLongLimit.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@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
--- a/test/jdk/java/util/logging/FileHandlerPath.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/FileHandlerPath.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@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
--- a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@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
--- a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@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
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java Fri Jun 21 13:04:14 2019 -0700
@@ -522,6 +522,8 @@
public static class SimplePolicy extends Policy {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
final Permissions permissions;
final Permissions allPermissions;
final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -541,7 +543,7 @@
@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
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java Fri Jun 21 13:04:14 2019 -0700
@@ -521,6 +521,8 @@
public static class SimplePolicy extends Policy {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
final Permissions permissions;
final Permissions allPermissions;
final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -540,7 +542,7 @@
@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
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@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() {
--- a/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
}
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 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return perms.implies(permission);
+ return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
}
--- a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
// 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<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -360,7 +362,7 @@
@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
--- a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
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 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return perms.implies(permission);
+ return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
}
--- a/test/jdk/java/util/logging/TestAppletLoggerContext.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 @@
// 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 @@
}
@Override
public boolean implies(ProtectionDomain pd, Permission p) {
- return perms.implies(p);
+ return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
}
}
--- a/test/jdk/java/util/logging/TestConfigurationListeners.java Fri Jun 21 08:38:26 2019 -0400
+++ b/test/jdk/java/util/logging/TestConfigurationListeners.java Fri Jun 21 13:04:14 2019 -0700
@@ -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 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 @@
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
- return permissions.implies(permission);
+ return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
@Override