author | weijun |
Mon, 11 Aug 2014 11:11:55 +0800 | |
changeset 25974 | 850dc36ea410 |
parent 25549 | a2f898967541 |
child 27565 | 729f9700483a |
permissions | -rw-r--r-- |
12446 | 1 |
/* |
25549
a2f898967541
8041633: [TESTBUG] java/lang/SecurityManager/CheckPackageAccess.java fails with "In j.s file, but not in golden set: com.sun.activation.registries."
mkos
parents:
25390
diff
changeset
|
2 |
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
12446 | 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. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
25 |
* @test |
25549
a2f898967541
8041633: [TESTBUG] java/lang/SecurityManager/CheckPackageAccess.java fails with "In j.s file, but not in golden set: com.sun.activation.registries."
mkos
parents:
25390
diff
changeset
|
26 |
* @bug 6741606 7146431 8000450 8019830 8022945 8027144 8041633 |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
27 |
* @summary Make sure all restricted packages listed in the package.access |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
28 |
* property in the java.security file are blocked |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
29 |
* @run main/othervm CheckPackageAccess |
12446 | 30 |
*/ |
31 |
||
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
32 |
import java.security.Security; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
33 |
import java.util.Collections; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
34 |
import java.util.Arrays; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
35 |
import java.util.ArrayList; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
36 |
import java.util.List; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
37 |
import java.util.StringTokenizer; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
38 |
|
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
39 |
/* |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
40 |
* The main benefit of this test is to catch merge errors or other types |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
41 |
* of issues where one or more of the packages are accidentally |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
42 |
* removed. This is why the packages that are known to be restricted have to |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
43 |
* be explicitly listed below. |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
44 |
*/ |
12446 | 45 |
public class CheckPackageAccess { |
46 |
||
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
47 |
/* |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
48 |
* This array should be updated whenever new packages are added to the |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
49 |
* package.access property in the java.security file |
20874
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
50 |
* NOTE: it should be in the same order as the java.security file |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
51 |
*/ |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
52 |
private static final String[] packages = { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
53 |
"sun.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
54 |
"com.sun.xml.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
55 |
"com.sun.imageio.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
56 |
"com.sun.istack.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
57 |
"com.sun.jmx.", |
19600
fce5c0729a1c
8019830: Add com.sun.media.sound to the list of restricted package
mullan
parents:
18828
diff
changeset
|
58 |
"com.sun.media.sound.", |
22300 | 59 |
"com.sun.naming.internal.", |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
60 |
"com.sun.proxy.", |
21317
176090ca2be7
8021257: com.sun.corba.se.** should be on restricted package list
alanb
parents:
20874
diff
changeset
|
61 |
"com.sun.corba.se.", |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
62 |
"com.sun.org.apache.bcel.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
63 |
"com.sun.org.apache.regexp.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
64 |
"com.sun.org.apache.xerces.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
65 |
"com.sun.org.apache.xpath.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
66 |
"com.sun.org.apache.xalan.internal.extensions.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
67 |
"com.sun.org.apache.xalan.internal.lib.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
68 |
"com.sun.org.apache.xalan.internal.res.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
69 |
"com.sun.org.apache.xalan.internal.templates.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
70 |
"com.sun.org.apache.xalan.internal.utils.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
71 |
"com.sun.org.apache.xalan.internal.xslt.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
72 |
"com.sun.org.apache.xalan.internal.xsltc.cmdline.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
73 |
"com.sun.org.apache.xalan.internal.xsltc.compiler.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
74 |
"com.sun.org.apache.xalan.internal.xsltc.trax.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
75 |
"com.sun.org.apache.xalan.internal.xsltc.util.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
76 |
"com.sun.org.apache.xml.internal.res.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
77 |
"com.sun.org.apache.xml.internal.security.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
78 |
"com.sun.org.apache.xml.internal.serializer.utils.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
79 |
"com.sun.org.apache.xml.internal.utils.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
80 |
"com.sun.org.glassfish.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
81 |
"com.oracle.xmlns.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
82 |
"com.oracle.webservices.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
83 |
"org.jcp.xml.dsig.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
84 |
"jdk.internal.", |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
85 |
"jdk.nashorn.internal.", |
25549
a2f898967541
8041633: [TESTBUG] java/lang/SecurityManager/CheckPackageAccess.java fails with "In j.s file, but not in golden set: com.sun.activation.registries."
mkos
parents:
25390
diff
changeset
|
86 |
"jdk.nashorn.tools.", |
a2f898967541
8041633: [TESTBUG] java/lang/SecurityManager/CheckPackageAccess.java fails with "In j.s file, but not in golden set: com.sun.activation.registries."
mkos
parents:
25390
diff
changeset
|
87 |
"com.sun.activation.registries." |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
88 |
}; |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
89 |
|
12446 | 90 |
public static void main(String[] args) throws Exception { |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
91 |
List<String> pkgs = new ArrayList<>(Arrays.asList(packages)); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
92 |
String osName = System.getProperty("os.name"); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
93 |
if (osName.contains("OS X")) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
94 |
pkgs.add("apple."); // add apple package for OS X |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
95 |
} |
12446 | 96 |
|
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
97 |
List<String> jspkgs = |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
98 |
getPackages(Security.getProperty("package.access")); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
99 |
|
20874
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
100 |
if (!isOpenJDKOnly()) { |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
101 |
String lastPkg = pkgs.get(pkgs.size() - 1); |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
102 |
|
20774
330ea6efa3fd
8007292: Add JavaFX internal packages to package.access
mullan
parents:
19600
diff
changeset
|
103 |
// Remove any closed packages from list before comparing |
20874
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
104 |
int index = jspkgs.indexOf(lastPkg); |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
105 |
if (index != -1 && index != jspkgs.size() - 1) { |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
106 |
jspkgs.subList(index + 1, jspkgs.size()).clear(); |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
107 |
} |
20774
330ea6efa3fd
8007292: Add JavaFX internal packages to package.access
mullan
parents:
19600
diff
changeset
|
108 |
} |
330ea6efa3fd
8007292: Add JavaFX internal packages to package.access
mullan
parents:
19600
diff
changeset
|
109 |
|
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
110 |
// Sort to ensure lists are comparable |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
111 |
Collections.sort(pkgs); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
112 |
Collections.sort(jspkgs); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
113 |
|
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
114 |
if (!pkgs.equals(jspkgs)) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
115 |
for (String p : pkgs) |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
116 |
if (!jspkgs.contains(p)) |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
117 |
System.out.println("In golden set, but not in j.s file: " + p); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
118 |
for (String p : jspkgs) |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
119 |
if (!pkgs.contains(p)) |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
120 |
System.out.println("In j.s file, but not in golden set: " + p); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
121 |
|
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
122 |
|
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
123 |
throw new RuntimeException("restricted packages are not " + |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
124 |
"consistent with java.security file"); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
125 |
} |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
126 |
System.setSecurityManager(new SecurityManager()); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
127 |
SecurityManager sm = System.getSecurityManager(); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
128 |
for (String pkg : packages) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
129 |
String subpkg = pkg + "foo"; |
12446 | 130 |
try { |
131 |
sm.checkPackageAccess(pkg); |
|
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
132 |
throw new RuntimeException("Able to access " + pkg + |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
133 |
" package"); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
134 |
} catch (SecurityException se) { } |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
135 |
try { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
136 |
sm.checkPackageAccess(subpkg); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
137 |
throw new RuntimeException("Able to access " + subpkg + |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
138 |
" package"); |
18138
02cb2d482ed0
8000450: Restrict access to com/sun/corba/se/impl package
coffeys
parents:
12446
diff
changeset
|
139 |
} catch (SecurityException se) { } |
02cb2d482ed0
8000450: Restrict access to com/sun/corba/se/impl package
coffeys
parents:
12446
diff
changeset
|
140 |
try { |
02cb2d482ed0
8000450: Restrict access to com/sun/corba/se/impl package
coffeys
parents:
12446
diff
changeset
|
141 |
sm.checkPackageDefinition(pkg); |
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
142 |
throw new RuntimeException("Able to define class in " + pkg + |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
143 |
" package"); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
144 |
} catch (SecurityException se) { } |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
145 |
try { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
146 |
sm.checkPackageDefinition(subpkg); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
147 |
throw new RuntimeException("Able to define class in " + subpkg + |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
148 |
" package"); |
12446 | 149 |
} catch (SecurityException se) { } |
150 |
} |
|
18791
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
151 |
System.out.println("Test passed"); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
152 |
} |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
153 |
|
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
154 |
private static List<String> getPackages(String p) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
155 |
List<String> packages = new ArrayList<>(); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
156 |
if (p != null && !p.equals("")) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
157 |
StringTokenizer tok = new StringTokenizer(p, ","); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
158 |
while (tok.hasMoreElements()) { |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
159 |
String s = tok.nextToken().trim(); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
160 |
packages.add(s); |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
161 |
} |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
162 |
} |
1973449fc9d9
8019979: Replace CheckPackageAccess test with better one from closed repo
coffeys
parents:
18138
diff
changeset
|
163 |
return packages; |
12446 | 164 |
} |
20874
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
165 |
|
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
166 |
private static boolean isOpenJDKOnly() { |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
167 |
String prop = System.getProperty("java.runtime.name"); |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
168 |
return prop != null && prop.startsWith("OpenJDK"); |
3d0974c9a59e
8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing
mullan
parents:
20774
diff
changeset
|
169 |
} |
12446 | 170 |
} |