Path: blob/master/src/java.logging/share/classes/java/util/logging/LoggingPermission.java
41159 views
/*1* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package java.util.logging;2728import java.security.*;2930/**31* The permission which the SecurityManager will check when code32* that is running with a SecurityManager calls one of the logging33* control methods (such as Logger.setLevel).34* <p>35* Currently there is only one named LoggingPermission. This is "control"36* and it grants the ability to control the logging configuration, for37* example by adding or removing Handlers, by adding or removing Filters,38* or by changing logging levels.39* <p>40* Programmers do not normally create LoggingPermission objects directly.41* Instead they are created by the security policy code based on reading42* the security policy file.43*44*45* @since 1.446* @see java.security.BasicPermission47* @see java.security.Permission48* @see java.security.Permissions49* @see java.security.PermissionCollection50* @see java.lang.SecurityManager51*52*/5354public final class LoggingPermission extends java.security.BasicPermission {5556private static final long serialVersionUID = 63564341580231582L;5758/**59* Creates a new LoggingPermission object.60*61* @param name Permission name. Must be "control".62* @param actions Must be either null or the empty string.63*64* @throws NullPointerException if <code>name</code> is <code>null</code>.65* @throws IllegalArgumentException if <code>name</code> is empty or if66* arguments are invalid.67*/68public LoggingPermission(String name, String actions) throws IllegalArgumentException {69super(name);70if (!name.equals("control")) {71throw new IllegalArgumentException("name: " + name);72}73if (actions != null && actions.length() > 0) {74throw new IllegalArgumentException("actions: " + actions);75}76}77}787980