author | jboes |
Fri, 08 Nov 2019 11:15:16 +0000 | |
changeset 59029 | 3786a0962570 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
42153
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
1 |
/* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
4 |
* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
8 |
* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
13 |
* accompanied this code). |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
14 |
* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
18 |
* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
21 |
* questions. |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
22 |
*/ |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
23 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
24 |
/* |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
25 |
* @test |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
26 |
* @bug 8043252 |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
27 |
* @summary Debug of access control is obfuscated - NullPointerException in |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
28 |
* ProtectionDomain |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
29 |
* @run main/othervm/java.security.policy=NullGetActions.policy NullGetActions |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
30 |
*/ |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
31 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
32 |
import java.net.*; |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
33 |
import java.security.*; |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
34 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
35 |
public class NullGetActions { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
36 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws Exception { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
38 |
Permissions permset = new Permissions(); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
39 |
permset.add(new EvilPermission("java.let.me.do.stuff")); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
40 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
41 |
Policy.getPolicy(); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
42 |
ProtectionDomain protDom = new ProtectionDomain( |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
43 |
new CodeSource(new URL("http://bar"), |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
44 |
(java.security.cert.Certificate[])null), permset, |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
45 |
null, null); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
46 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
47 |
System.out.println("Protection Domain:\n" + protDom); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
48 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
49 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
50 |
public static class EvilPermission extends Permission { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
51 |
public EvilPermission(String name) { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
52 |
super(name); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
53 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
54 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
55 |
@Override |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
56 |
public String getActions() { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
57 |
return null; |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
58 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
59 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
60 |
@Override |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
61 |
public boolean equals(Object obj) { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
62 |
return (obj == this); |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
63 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
64 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
65 |
@Override |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
66 |
public int hashCode() { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
67 |
return 42; |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
68 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
69 |
|
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
70 |
@Override |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
71 |
public boolean implies(Permission permission) { |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
72 |
return false; |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
73 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
74 |
} |
d57f354dd0ab
8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents:
diff
changeset
|
75 |
} |