author | jjg |
Mon, 15 Aug 2011 11:48:20 -0700 | |
changeset 10336 | 0bb1999251f8 |
parent 5506 | 202f599c92aa |
child 13557 | f0156a32c08f |
permissions | -rw-r--r-- |
2 | 1 |
/* |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.crypto; |
|
27 |
||
28 |
import java.security.*; |
|
29 |
import java.util.Enumeration; |
|
30 |
import java.util.Hashtable; |
|
31 |
import java.util.Vector; |
|
32 |
import java.util.NoSuchElementException; |
|
33 |
import java.io.Serializable; |
|
34 |
import java.io.InputStream; |
|
35 |
import java.io.InputStreamReader; |
|
36 |
import java.io.BufferedReader; |
|
37 |
import java.io.IOException; |
|
38 |
||
39 |
/** |
|
40 |
* This class contains CryptoPermission objects, organized into |
|
41 |
* PermissionCollections according to algorithm names. |
|
42 |
* |
|
43 |
* <p>When the <code>add</code> method is called to add a |
|
44 |
* CryptoPermission, the CryptoPermission is stored in the |
|
45 |
* appropriate PermissionCollection. If no such |
|
46 |
* collection exists yet, the algorithm name associated with |
|
47 |
* the CryptoPermission object is |
|
48 |
* determined and the <code>newPermissionCollection</code> method |
|
49 |
* is called on the CryptoPermission or CryptoAllPermission class to |
|
50 |
* create the PermissionCollection and add it to the Permissions object. |
|
51 |
* |
|
52 |
* @see javax.crypto.CryptoPermission |
|
53 |
* @see java.security.PermissionCollection |
|
54 |
* @see java.security.Permissions |
|
55 |
* |
|
56 |
* @author Sharon Liu |
|
57 |
* @since 1.4 |
|
58 |
*/ |
|
59 |
final class CryptoPermissions extends PermissionCollection |
|
60 |
implements Serializable { |
|
61 |
||
62 |
private static final long serialVersionUID = 4946547168093391015L; |
|
63 |
||
64 |
// This class is similar to java.security.Permissions |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
65 |
private Hashtable<String, PermissionCollection> perms; |
2 | 66 |
|
67 |
/** |
|
68 |
* Creates a new CryptoPermissions object containing |
|
69 |
* no CryptoPermissionCollections. |
|
70 |
*/ |
|
71 |
CryptoPermissions() { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
72 |
perms = new Hashtable<String, PermissionCollection>(7); |
2 | 73 |
} |
74 |
||
75 |
/** |
|
76 |
* Populates the crypto policy from the specified |
|
77 |
* InputStream into this CryptoPermissions object. |
|
78 |
* |
|
79 |
* @param in the InputStream to load from. |
|
80 |
* |
|
81 |
* @exception SecurityException if cannot load |
|
82 |
* successfully. |
|
83 |
*/ |
|
84 |
void load(InputStream in) |
|
85 |
throws IOException, CryptoPolicyParser.ParsingException { |
|
86 |
CryptoPolicyParser parser = new CryptoPolicyParser(); |
|
87 |
parser.read(new BufferedReader(new InputStreamReader(in, "UTF-8"))); |
|
88 |
||
89 |
CryptoPermission[] parsingResult = parser.getPermissions(); |
|
90 |
for (int i = 0; i < parsingResult.length; i++) { |
|
91 |
this.add(parsingResult[i]); |
|
92 |
} |
|
93 |
} |
|
94 |
||
95 |
/** |
|
96 |
* Returns true if this CryptoPermissions object doesn't |
|
97 |
* contain any CryptoPermission objects; otherwise, returns |
|
98 |
* false. |
|
99 |
*/ |
|
100 |
boolean isEmpty() { |
|
101 |
return perms.isEmpty(); |
|
102 |
} |
|
103 |
||
104 |
/** |
|
105 |
* Adds a permission object to the PermissionCollection for the |
|
106 |
* algorithm returned by |
|
107 |
* <code>(CryptoPermission)permission.getAlgorithm()</code>. |
|
108 |
* |
|
109 |
* This method creates |
|
110 |
* a new PermissionCollection object (and adds the permission to it) |
|
111 |
* if an appropriate collection does not yet exist. <p> |
|
112 |
* |
|
113 |
* @param permission the Permission object to add. |
|
114 |
* |
|
115 |
* @exception SecurityException if this CryptoPermissions object is |
|
116 |
* marked as readonly. |
|
117 |
* |
|
118 |
* @see isReadOnly |
|
119 |
*/ |
|
120 |
public void add(Permission permission) { |
|
121 |
||
122 |
if (isReadOnly()) |
|
123 |
throw new SecurityException("Attempt to add a Permission " + |
|
124 |
"to a readonly CryptoPermissions " + |
|
125 |
"object"); |
|
126 |
||
127 |
if (!(permission instanceof CryptoPermission)) |
|
128 |
return; |
|
129 |
||
130 |
CryptoPermission cryptoPerm = (CryptoPermission)permission; |
|
131 |
PermissionCollection pc = |
|
132 |
getPermissionCollection(cryptoPerm); |
|
133 |
pc.add(cryptoPerm); |
|
134 |
String alg = cryptoPerm.getAlgorithm(); |
|
135 |
if (!perms.containsKey(alg)) { |
|
136 |
perms.put(alg, pc); |
|
137 |
} |
|
138 |
} |
|
139 |
||
140 |
/** |
|
141 |
* Checks if this object's PermissionCollection for permissons |
|
142 |
* of the specified permission's algorithm implies the specified |
|
143 |
* permission. Returns true if the checking succeeded. |
|
144 |
* |
|
145 |
* @param permission the Permission object to check. |
|
146 |
* |
|
147 |
* @return true if "permission" is implied by the permissions |
|
148 |
* in the PermissionCollection it belongs to, false if not. |
|
149 |
* |
|
150 |
*/ |
|
151 |
public boolean implies(Permission permission) { |
|
152 |
if (!(permission instanceof CryptoPermission)) { |
|
153 |
return false; |
|
154 |
} |
|
155 |
||
156 |
CryptoPermission cryptoPerm = (CryptoPermission)permission; |
|
157 |
||
158 |
PermissionCollection pc = |
|
159 |
getPermissionCollection(cryptoPerm.getAlgorithm()); |
|
160 |
return pc.implies(cryptoPerm); |
|
161 |
} |
|
162 |
||
163 |
/** |
|
164 |
* Returns an enumeration of all the Permission objects in all the |
|
165 |
* PermissionCollections in this CryptoPermissions object. |
|
166 |
* |
|
167 |
* @return an enumeration of all the Permissions. |
|
168 |
*/ |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
169 |
public Enumeration<Permission> elements() { |
2 | 170 |
// go through each Permissions in the hash table |
171 |
// and call their elements() function. |
|
172 |
return new PermissionsEnumerator(perms.elements()); |
|
173 |
} |
|
174 |
||
175 |
/** |
|
176 |
* Returns a CryptoPermissions object which |
|
177 |
* represents the minimum of the specified |
|
178 |
* CryptoPermissions object and this |
|
179 |
* CryptoPermissions object. |
|
180 |
* |
|
181 |
* @param other the CryptoPermission |
|
182 |
* object to compare with this object. |
|
183 |
*/ |
|
184 |
CryptoPermissions getMinimum(CryptoPermissions other) { |
|
185 |
if (other == null) { |
|
186 |
return null; |
|
187 |
} |
|
188 |
||
189 |
if (this.perms.containsKey(CryptoAllPermission.ALG_NAME)) { |
|
190 |
return other; |
|
191 |
} |
|
192 |
||
193 |
if (other.perms.containsKey(CryptoAllPermission.ALG_NAME)) { |
|
194 |
return this; |
|
195 |
} |
|
196 |
||
197 |
CryptoPermissions ret = new CryptoPermissions(); |
|
198 |
||
199 |
||
200 |
PermissionCollection thatWildcard = |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
201 |
other.perms.get(CryptoPermission.ALG_NAME_WILDCARD); |
2 | 202 |
int maxKeySize = 0; |
203 |
if (thatWildcard != null) { |
|
204 |
maxKeySize = ((CryptoPermission) |
|
205 |
thatWildcard.elements().nextElement()).getMaxKeySize(); |
|
206 |
} |
|
207 |
// For each algorithm in this CryptoPermissions, |
|
208 |
// find out if there is anything we should add into |
|
209 |
// ret. |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
210 |
Enumeration<String> thisKeys = this.perms.keys(); |
2 | 211 |
while (thisKeys.hasMoreElements()) { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
212 |
String alg = thisKeys.nextElement(); |
2 | 213 |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
214 |
PermissionCollection thisPc = this.perms.get(alg); |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
215 |
PermissionCollection thatPc = other.perms.get(alg); |
2 | 216 |
|
217 |
CryptoPermission[] partialResult; |
|
218 |
||
219 |
if (thatPc == null) { |
|
220 |
if (thatWildcard == null) { |
|
221 |
// The other CryptoPermissions |
|
222 |
// doesn't allow this given |
|
223 |
// algorithm at all. Just skip this |
|
224 |
// algorithm. |
|
225 |
continue; |
|
226 |
} |
|
227 |
partialResult = getMinimum(maxKeySize, thisPc); |
|
228 |
} else { |
|
229 |
partialResult = getMinimum(thisPc, thatPc); |
|
230 |
} |
|
231 |
||
232 |
for (int i = 0; i < partialResult.length; i++) { |
|
233 |
ret.add(partialResult[i]); |
|
234 |
} |
|
235 |
} |
|
236 |
||
237 |
PermissionCollection thisWildcard = |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
238 |
this.perms.get(CryptoPermission.ALG_NAME_WILDCARD); |
2 | 239 |
|
240 |
// If this CryptoPermissions doesn't |
|
241 |
// have a wildcard, we are done. |
|
242 |
if (thisWildcard == null) { |
|
243 |
return ret; |
|
244 |
} |
|
245 |
||
246 |
// Deal with the algorithms only appear |
|
247 |
// in the other CryptoPermissions. |
|
248 |
maxKeySize = |
|
249 |
((CryptoPermission) |
|
250 |
thisWildcard.elements().nextElement()).getMaxKeySize(); |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
251 |
Enumeration<String> thatKeys = other.perms.keys(); |
2 | 252 |
while (thatKeys.hasMoreElements()) { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
253 |
String alg = thatKeys.nextElement(); |
2 | 254 |
|
255 |
if (this.perms.containsKey(alg)) { |
|
256 |
continue; |
|
257 |
} |
|
258 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
259 |
PermissionCollection thatPc = other.perms.get(alg); |
2 | 260 |
|
261 |
CryptoPermission[] partialResult; |
|
262 |
||
263 |
partialResult = getMinimum(maxKeySize, thatPc); |
|
264 |
||
265 |
for (int i = 0; i < partialResult.length; i++) { |
|
266 |
ret.add(partialResult[i]); |
|
267 |
} |
|
268 |
} |
|
269 |
return ret; |
|
270 |
} |
|
271 |
||
272 |
/** |
|
273 |
* Get the minimum of the two given PermissionCollection |
|
274 |
* <code>thisPc</code> and <code>thatPc</code>. |
|
275 |
* |
|
276 |
* @param thisPc the first given PermissionColloection |
|
277 |
* object. |
|
278 |
* |
|
279 |
* @param thatPc the second given PermissionCollection |
|
280 |
* object. |
|
281 |
*/ |
|
282 |
private CryptoPermission[] getMinimum(PermissionCollection thisPc, |
|
283 |
PermissionCollection thatPc) { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
284 |
Vector<CryptoPermission> permVector = new Vector<>(2); |
2 | 285 |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
286 |
Enumeration<Permission> thisPcPermissions = thisPc.elements(); |
2 | 287 |
|
288 |
// For each CryptoPermission in |
|
289 |
// thisPc object, do the following: |
|
290 |
// 1) if this CryptoPermission is implied |
|
291 |
// by thatPc, this CryptoPermission |
|
292 |
// should be returned, and we can |
|
293 |
// move on to check the next |
|
294 |
// CryptoPermission in thisPc. |
|
295 |
// 2) otherwise, we should return |
|
296 |
// all CryptoPermissions in thatPc |
|
297 |
// which |
|
298 |
// are implied by this CryptoPermission. |
|
299 |
// Then we can move on to the |
|
300 |
// next CryptoPermission in thisPc. |
|
301 |
while (thisPcPermissions.hasMoreElements()) { |
|
302 |
CryptoPermission thisCp = |
|
303 |
(CryptoPermission)thisPcPermissions.nextElement(); |
|
304 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
305 |
Enumeration<Permission> thatPcPermissions = thatPc.elements(); |
2 | 306 |
while (thatPcPermissions.hasMoreElements()) { |
307 |
CryptoPermission thatCp = |
|
308 |
(CryptoPermission)thatPcPermissions.nextElement(); |
|
309 |
||
310 |
if (thatCp.implies(thisCp)) { |
|
311 |
permVector.addElement(thisCp); |
|
312 |
break; |
|
313 |
} |
|
314 |
if (thisCp.implies(thatCp)) { |
|
315 |
permVector.addElement(thatCp); |
|
316 |
} |
|
317 |
} |
|
318 |
} |
|
319 |
||
320 |
CryptoPermission[] ret = new CryptoPermission[permVector.size()]; |
|
321 |
permVector.copyInto(ret); |
|
322 |
return ret; |
|
323 |
} |
|
324 |
||
325 |
/** |
|
326 |
* Returns all the CryptoPermission objects in the given |
|
327 |
* PermissionCollection object |
|
328 |
* whose maximum keysize no greater than <code>maxKeySize</code>. |
|
329 |
* For all CryptoPermission objects with a maximum keysize greater |
|
330 |
* than <code>maxKeySize</code>, this method constructs a |
|
331 |
* corresponding CryptoPermission object whose maximum keysize is |
|
332 |
* set to <code>maxKeySize</code>, and includes that in the result. |
|
333 |
* |
|
334 |
* @param maxKeySize the given maximum key size. |
|
335 |
* |
|
336 |
* @param pc the given PermissionCollection object. |
|
337 |
*/ |
|
338 |
private CryptoPermission[] getMinimum(int maxKeySize, |
|
339 |
PermissionCollection pc) { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
340 |
Vector<CryptoPermission> permVector = new Vector<>(1); |
2 | 341 |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
342 |
Enumeration<Permission> enum_ = pc.elements(); |
2 | 343 |
|
344 |
while (enum_.hasMoreElements()) { |
|
345 |
CryptoPermission cp = |
|
346 |
(CryptoPermission)enum_.nextElement(); |
|
347 |
if (cp.getMaxKeySize() <= maxKeySize) { |
|
348 |
permVector.addElement(cp); |
|
349 |
} else { |
|
350 |
if (cp.getCheckParam()) { |
|
351 |
permVector.addElement( |
|
352 |
new CryptoPermission(cp.getAlgorithm(), |
|
353 |
maxKeySize, |
|
354 |
cp.getAlgorithmParameterSpec(), |
|
355 |
cp.getExemptionMechanism())); |
|
356 |
} else { |
|
357 |
permVector.addElement( |
|
358 |
new CryptoPermission(cp.getAlgorithm(), |
|
359 |
maxKeySize, |
|
360 |
cp.getExemptionMechanism())); |
|
361 |
} |
|
362 |
} |
|
363 |
} |
|
364 |
||
365 |
CryptoPermission[] ret = new CryptoPermission[permVector.size()]; |
|
366 |
permVector.copyInto(ret); |
|
367 |
return ret; |
|
368 |
} |
|
369 |
||
370 |
/** |
|
371 |
* Returns the PermissionCollection for the |
|
372 |
* specified algorithm. Returns null if there |
|
373 |
* isn't such a PermissionCollection. |
|
374 |
* |
|
375 |
* @param alg the algorithm name. |
|
376 |
*/ |
|
377 |
PermissionCollection getPermissionCollection(String alg) { |
|
378 |
// If this CryptoPermissions includes CryptoAllPermission, |
|
379 |
// we should return CryptoAllPermission. |
|
380 |
if (perms.containsKey(CryptoAllPermission.ALG_NAME)) { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
381 |
return perms.get(CryptoAllPermission.ALG_NAME); |
2 | 382 |
} |
383 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
384 |
PermissionCollection pc = perms.get(alg); |
2 | 385 |
|
386 |
// If there isn't a PermissionCollection for |
|
387 |
// the given algorithm,we should return the |
|
388 |
// PermissionCollection for the wildcard |
|
389 |
// if there is one. |
|
390 |
if (pc == null) { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
391 |
pc = perms.get(CryptoPermission.ALG_NAME_WILDCARD); |
2 | 392 |
} |
393 |
return pc; |
|
394 |
} |
|
395 |
||
396 |
/** |
|
397 |
* Returns the PermissionCollection for the algorithm |
|
398 |
* associated with the specified CryptoPermission |
|
399 |
* object. Creates such a PermissionCollection |
|
400 |
* if such a PermissionCollection does not |
|
401 |
* exist yet. |
|
402 |
* |
|
403 |
* @param cryptoPerm the CryptoPermission object. |
|
404 |
*/ |
|
405 |
private PermissionCollection getPermissionCollection( |
|
406 |
CryptoPermission cryptoPerm) { |
|
407 |
||
408 |
String alg = cryptoPerm.getAlgorithm(); |
|
409 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
410 |
PermissionCollection pc = perms.get(alg); |
2 | 411 |
|
412 |
if (pc == null) { |
|
413 |
pc = cryptoPerm.newPermissionCollection(); |
|
414 |
} |
|
415 |
return pc; |
|
416 |
} |
|
417 |
} |
|
418 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
419 |
final class PermissionsEnumerator implements Enumeration<Permission> { |
2 | 420 |
|
421 |
// all the perms |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
422 |
private Enumeration<PermissionCollection> perms; |
2 | 423 |
// the current set |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
424 |
private Enumeration<Permission> permset; |
2 | 425 |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
426 |
PermissionsEnumerator(Enumeration<PermissionCollection> e) { |
2 | 427 |
perms = e; |
428 |
permset = getNextEnumWithMore(); |
|
429 |
} |
|
430 |
||
431 |
public synchronized boolean hasMoreElements() { |
|
432 |
// if we enter with permissionimpl null, we know |
|
433 |
// there are no more left. |
|
434 |
||
435 |
if (permset == null) |
|
436 |
return false; |
|
437 |
||
438 |
// try to see if there are any left in the current one |
|
439 |
||
440 |
if (permset.hasMoreElements()) |
|
441 |
return true; |
|
442 |
||
443 |
// get the next one that has something in it... |
|
444 |
permset = getNextEnumWithMore(); |
|
445 |
||
446 |
// if it is null, we are done! |
|
447 |
return (permset != null); |
|
448 |
} |
|
449 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
450 |
public synchronized Permission nextElement() { |
2 | 451 |
// hasMoreElements will update permset to the next permset |
452 |
// with something in it... |
|
453 |
||
454 |
if (hasMoreElements()) { |
|
455 |
return permset.nextElement(); |
|
456 |
} else { |
|
457 |
throw new NoSuchElementException("PermissionsEnumerator"); |
|
458 |
} |
|
459 |
||
460 |
} |
|
461 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
462 |
private Enumeration<Permission> getNextEnumWithMore() { |
2 | 463 |
while (perms.hasMoreElements()) { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
464 |
PermissionCollection pc = perms.nextElement(); |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
465 |
Enumeration<Permission> next = pc.elements(); |
2 | 466 |
if (next.hasMoreElements()) |
467 |
return next; |
|
468 |
} |
|
469 |
return null; |
|
470 |
} |
|
471 |
} |