test/jdk/java/util/logging/FileHandlerPath.java
changeset 55462 6dfdcd31463d
parent 47216 71c04702a3d5
equal deleted inserted replaced
55461:e764228f71dc 55462:6dfdcd31463d
     1 /*
     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   268         }
   268         }
   269     }
   269     }
   270 
   270 
   271     public static class SimplePolicy extends Policy {
   271     public static class SimplePolicy extends Policy {
   272 
   272 
       
   273         static final Policy DEFAULT_POLICY = Policy.getPolicy();
       
   274 
   273         final Permissions permissions;
   275         final Permissions permissions;
   274         final Permissions allPermissions;
   276         final Permissions allPermissions;
   275         final AtomicBoolean allowAll;
   277         final AtomicBoolean allowAll;
   276         public SimplePolicy(TestCase test, AtomicBoolean allowAll) {
   278         public SimplePolicy(TestCase test, AtomicBoolean allowAll) {
   277             this.allowAll = allowAll;
   279             this.allowAll = allowAll;
   295         }
   297         }
   296 
   298 
   297         @Override
   299         @Override
   298         public boolean implies(ProtectionDomain domain, Permission permission) {
   300         public boolean implies(ProtectionDomain domain, Permission permission) {
   299             if (allowAll.get()) return allPermissions.implies(permission);
   301             if (allowAll.get()) return allPermissions.implies(permission);
   300             return permissions.implies(permission);
   302             return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
   301         }
   303         }
   302 
   304 
   303         @Override
   305         @Override
   304         public PermissionCollection getPermissions(CodeSource codesource) {
   306         public PermissionCollection getPermissions(CodeSource codesource) {
   305             return new PermissionsBuilder().addAll(allowAll.get()
   307             return new PermissionsBuilder().addAll(allowAll.get()