diff --git a/test/jdk/java/net/URLPermission/URLTest.java b/test/jdk/java/net/URLPermission/URLTest.java index d6f28fa38e..714cf62bff 100644 --- a/test/jdk/java/net/URLPermission/URLTest.java +++ b/test/jdk/java/net/URLPermission/URLTest.java @@ -276,7 +276,9 @@ public class URLTest { } static class CustomPolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); final PermissionCollection perms = new Permissions(); + CustomPolicy(Permission... permissions) { java.util.Arrays.stream(permissions).forEach(perms::add); @@ -301,7 +303,7 @@ public class URLTest { } public boolean implies(ProtectionDomain domain, Permission perm) { - return perms.implies(perm); + return perms.implies(perm) || DEFAULT_POLICY.implies(domain, perm); } } } diff --git a/test/jdk/java/sql/testng/util/TestPolicy.java b/test/jdk/java/sql/testng/util/TestPolicy.java index af21cc8fc1..2adeaf31bc 100644 --- a/test/jdk/java/sql/testng/util/TestPolicy.java +++ b/test/jdk/java/sql/testng/util/TestPolicy.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 @@ -42,6 +42,7 @@ import java.util.logging.LoggingPermission; * JDBC concrete classes */ public class TestPolicy extends Policy { + static final Policy DEFAULT_POLICY = Policy.getPolicy(); final PermissionCollection permissions = new Permissions(); @@ -137,6 +138,6 @@ public 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); } }