Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java
41159 views
1
/*
2
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.sun.jdi;
27
28
/**
29
* The {@code JDIPermission} class represents access rights to
30
* the {@code VirtualMachineManager}. This is the permission
31
* which the SecurityManager will check when code that is running with
32
* a SecurityManager requests access to the VirtualMachineManager, as
33
* defined in the Java Debug Interface (JDI) for the Java platform.
34
* <P>
35
* A {@code JDIPermission} object contains a name (also referred
36
* to as a "target name") but no actions list; you either have the
37
* named permission or you don't.
38
* <P>
39
* The following table provides a summary description of what the
40
* permission allows, and discusses the risks of granting code the
41
* permission.
42
*
43
* <table class="striped">
44
* <caption style="display:none">Table shows permission target name, what the
45
* permission allows, and associated risks</caption>
46
* <thead>
47
* <tr>
48
* <th scope="col">Permission Target Name</th>
49
* <th scope="col">What the Permission Allows</th>
50
* <th scope="col">Risks of Allowing this Permission</th>
51
* </tr>
52
* </thead>
53
*
54
* <tbody>
55
* <tr>
56
* <th scope="row">virtualMachineManager</th>
57
* <td>Ability to inspect and modify the JDI objects in the
58
* {@code VirtualMachineManager}
59
* </td>
60
* <td>This allows an attacker to control the
61
* {@code VirtualMachineManager} and cause the system to
62
* misbehave.
63
* </td>
64
* </tr>
65
* </tbody>
66
*
67
* </table>
68
*
69
* <p>
70
* Programmers do not normally create JDIPermission objects directly.
71
* Instead they are created by the security policy code based on reading
72
* the security policy file.
73
*
74
* @author Tim Bell
75
* @since 1.5
76
*
77
* @see Bootstrap
78
* @see java.security.BasicPermission
79
* @see java.security.Permission
80
* @see java.security.Permissions
81
* @see java.security.PermissionCollection
82
* @see java.lang.SecurityManager
83
*
84
*/
85
86
public final class JDIPermission extends java.security.BasicPermission {
87
88
private static final long serialVersionUID = -6988461416938786271L;
89
90
/**
91
* The {@code JDIPermission} class represents access rights to the
92
* {@code VirtualMachineManager}
93
* @param name Permission name. Must be "virtualMachineManager".
94
* @throws IllegalArgumentException if the name argument is invalid.
95
*/
96
public JDIPermission(String name) {
97
super(name);
98
if (!name.equals("virtualMachineManager")) {
99
throw new IllegalArgumentException("name: " + name);
100
}
101
}
102
103
/**
104
* Constructs a new JDIPermission object.
105
*
106
* @param name Permission name. Must be "virtualMachineManager".
107
* @param actions Must be either null or the empty string.
108
* @throws IllegalArgumentException if arguments are invalid.
109
*/
110
public JDIPermission(String name, String actions)
111
throws IllegalArgumentException {
112
super(name);
113
if (!name.equals("virtualMachineManager")) {
114
throw new IllegalArgumentException("name: " + name);
115
}
116
if (actions != null && actions.length() > 0) {
117
throw new IllegalArgumentException("actions: " + actions);
118
}
119
}
120
}
121
122