src/share/classes/java/lang/management/ManagementPermission.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -61,10 +61,17 @@
* stack trace, a list of all loaded class names, and input arguments
* to the Java virtual machine.</td>
* <td>This allows malicious code to monitor runtime information and
* uncover vulnerabilities.</td>
* </tr>
+ * <tr>
+ * <td>diagnosticCommand</td>
+ * <td>Ability to execute diagnostic commands in the Java virtual machine.
+ * </td>
+ * <td>This allows an attacker to disturb the behavior of the Java virtual
+ * machine, stop some services or expose application information
+ * </td>
*
* </table>
*
* <p>
* Programmers do not normally create ManagementPermission objects directly.
@@ -86,36 +93,40 @@
private static final long serialVersionUID = 1897496590799378737L;
/**
* Constructs a ManagementPermission with the specified name.
*
- * @param name Permission name. Must be either "monitor" or "control".
+ * @param name Permission name. Must be either "monitor", "control" or
+ * "diagnosticCommand"
*
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty or invalid.
*/
public ManagementPermission(String name) {
super(name);
- if (!name.equals("control") && !name.equals("monitor")) {
+ if (!name.equals("control") && !name.equals("monitor")
+ && !name.equals("diagnosticCommand")) {
throw new IllegalArgumentException("name: " + name);
}
}
/**
* Constructs a new ManagementPermission object.
*
- * @param name Permission name. Must be either "monitor" or "control".
+ * @param name Permission name. Must be either "monitor", "control" or
+ * "diagnosticCommand"
* @param actions Must be either null or the empty string.
*
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty or
* if arguments are invalid.
*/
public ManagementPermission(String name, String actions)
throws IllegalArgumentException {
super(name);
- if (!name.equals("control") && !name.equals("monitor")) {
+ if (!name.equals("control") && !name.equals("monitor")
+ && !name.equals("diagnosticCommand")) {
throw new IllegalArgumentException("name: " + name);
}
if (actions != null && actions.length() > 0) {
throw new IllegalArgumentException("actions: " + actions);
}