equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 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. |
174 |
174 |
175 } |
175 } |
176 |
176 |
177 static final class SimplePolicy extends Policy { |
177 static final class SimplePolicy extends Policy { |
178 |
178 |
|
179 static final Policy DEFAULT_POLICY = Policy.getPolicy(); |
|
180 |
179 final PermissionCollection perms = new Permissions(); |
181 final PermissionCollection perms = new Permissions(); |
180 public SimplePolicy(String configFile) { |
182 public SimplePolicy(String configFile) { |
181 perms.add(new LoggingPermission("control", null)); |
183 perms.add(new LoggingPermission("control", null)); |
182 perms.add(new PropertyPermission("java.util.logging.config.class","read")); |
184 perms.add(new PropertyPermission("java.util.logging.config.class","read")); |
183 perms.add(new PropertyPermission("java.util.logging.config.file","read")); |
185 perms.add(new PropertyPermission("java.util.logging.config.file","read")); |
185 perms.add(new RuntimePermission("accessClassInPackage.jdk.internal.access")); |
187 perms.add(new RuntimePermission("accessClassInPackage.jdk.internal.access")); |
186 } |
188 } |
187 |
189 |
188 @Override |
190 @Override |
189 public boolean implies(ProtectionDomain domain, Permission permission) { |
191 public boolean implies(ProtectionDomain domain, Permission permission) { |
190 return perms.implies(permission); |
192 return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission); |
191 } |
193 } |
192 } |
194 } |
193 |
195 |
194 static enum Context { ONE, TWO }; |
196 static enum Context { ONE, TWO }; |
195 |
197 |