test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java
equal
deleted
inserted
replaced
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. |
661 |
661 |
662 public static class SimplePolicy extends Policy { |
662 public static class SimplePolicy extends Policy { |
663 final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION; |
663 final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION; |
664 final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); |
664 final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging"); |
665 |
665 |
|
666 static final Policy DEFAULT_POLICY = Policy.getPolicy(); |
|
667 |
666 final Permissions permissions; |
668 final Permissions permissions; |
667 final Permissions allPermissions; |
669 final Permissions allPermissions; |
668 final ThreadLocal<AtomicBoolean> allowControl; |
670 final ThreadLocal<AtomicBoolean> allowControl; |
669 final ThreadLocal<AtomicBoolean> allowAccess; |
671 final ThreadLocal<AtomicBoolean> allowAccess; |
670 final ThreadLocal<AtomicBoolean> allowAll; |
672 final ThreadLocal<AtomicBoolean> allowAll; |
698 return permissions; |
700 return permissions; |
699 } |
701 } |
700 |
702 |
701 @Override |
703 @Override |
702 public boolean implies(ProtectionDomain domain, Permission permission) { |
704 public boolean implies(ProtectionDomain domain, Permission permission) { |
703 return getPermissions().implies(permission); |
705 return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission); |
704 } |
706 } |
705 |
707 |
706 @Override |
708 @Override |
707 public PermissionCollection getPermissions(CodeSource codesource) { |
709 public PermissionCollection getPermissions(CodeSource codesource) { |
708 return new PermissionsBuilder().addAll(getPermissions()).toPermissions(); |
710 return new PermissionsBuilder().addAll(getPermissions()).toPermissions(); |