test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java
changeset 55462 6dfdcd31463d
parent 53044 432795b1c2c8
equal deleted inserted replaced
55461:e764228f71dc 55462:6dfdcd31463d
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 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.
  1024     public static class SimplePolicy extends Policy {
  1024     public static class SimplePolicy extends Policy {
  1025         final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION;
  1025         final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION;
  1026         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
  1026         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
  1027         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
  1027         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
  1028 
  1028 
       
  1029         static final Policy DEFAULT_POLICY = Policy.getPolicy();
       
  1030 
  1029         final Permissions permissions;
  1031         final Permissions permissions;
  1030         final Permissions allPermissions;
  1032         final Permissions allPermissions;
  1031         final ThreadLocal<AtomicBoolean> allowControl;
  1033         final ThreadLocal<AtomicBoolean> allowControl;
  1032         final ThreadLocal<AtomicBoolean> allowAccess;
  1034         final ThreadLocal<AtomicBoolean> allowAccess;
  1033         final ThreadLocal<AtomicBoolean> allowAll;
  1035         final ThreadLocal<AtomicBoolean> allowAll;
  1062             return permissions;
  1064             return permissions;
  1063         }
  1065         }
  1064 
  1066 
  1065         @Override
  1067         @Override
  1066         public boolean implies(ProtectionDomain domain, Permission permission) {
  1068         public boolean implies(ProtectionDomain domain, Permission permission) {
  1067             return getPermissions().implies(permission);
  1069             return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
  1068         }
  1070         }
  1069 
  1071 
  1070         @Override
  1072         @Override
  1071         public PermissionCollection getPermissions(CodeSource codesource) {
  1073         public PermissionCollection getPermissions(CodeSource codesource) {
  1072             return new PermissionsBuilder().addAll(getPermissions()).toPermissions();
  1074             return new PermissionsBuilder().addAll(getPermissions()).toPermissions();