equal
deleted
inserted
replaced
176 /** |
176 /** |
177 * Returns the hash code value for this object. |
177 * Returns the hash code value for this object. |
178 * |
178 * |
179 * @return a hash code value for this object. |
179 * @return a hash code value for this object. |
180 */ |
180 */ |
181 |
|
182 public int hashCode() { |
181 public int hashCode() { |
183 return getName().hashCode(); |
182 return getName().hashCode(); |
184 } |
183 } |
185 |
184 |
186 |
185 |
276 |
275 |
277 /** |
276 /** |
278 * Check and see if this collection of permissions implies the permissions |
277 * Check and see if this collection of permissions implies the permissions |
279 * expressed in "permission". |
278 * expressed in "permission". |
280 * |
279 * |
281 * @param p the Permission object to compare |
280 * @param permission the Permission object to compare |
282 * |
281 * |
283 * @return true if "permission" is a proper subset of a permission in |
282 * @return true if "permission" is a proper subset of a permission in |
284 * the collection, false if not. |
283 * the collection, false if not. |
285 */ |
284 */ |
286 |
|
287 public boolean implies(Permission permission) { |
285 public boolean implies(Permission permission) { |
288 if (! (permission instanceof DelegationPermission)) |
286 if (! (permission instanceof DelegationPermission)) |
289 return false; |
287 return false; |
290 |
288 |
291 synchronized (this) { |
289 synchronized (this) { |
308 * DelegationPermission |
306 * DelegationPermission |
309 * |
307 * |
310 * @exception SecurityException - if this PermissionCollection object |
308 * @exception SecurityException - if this PermissionCollection object |
311 * has been marked readonly |
309 * has been marked readonly |
312 */ |
310 */ |
313 |
|
314 public void add(Permission permission) { |
311 public void add(Permission permission) { |
315 if (! (permission instanceof DelegationPermission)) |
312 if (! (permission instanceof DelegationPermission)) |
316 throw new IllegalArgumentException("invalid permission: "+ |
313 throw new IllegalArgumentException("invalid permission: "+ |
317 permission); |
314 permission); |
318 if (isReadOnly()) |
315 if (isReadOnly()) |
327 * Returns an enumeration of all the DelegationPermission objects |
324 * Returns an enumeration of all the DelegationPermission objects |
328 * in the container. |
325 * in the container. |
329 * |
326 * |
330 * @return an enumeration of all the DelegationPermission objects. |
327 * @return an enumeration of all the DelegationPermission objects. |
331 */ |
328 */ |
332 |
|
333 public Enumeration<Permission> elements() { |
329 public Enumeration<Permission> elements() { |
334 // Convert Iterator into Enumeration |
330 // Convert Iterator into Enumeration |
335 synchronized (this) { |
331 synchronized (this) { |
336 return Collections.enumeration(perms); |
332 return Collections.enumeration(perms); |
337 } |
333 } |
374 |
370 |
375 /* |
371 /* |
376 * Reads in a Vector of DelegationPermissions and saves them in the perms field. |
372 * Reads in a Vector of DelegationPermissions and saves them in the perms field. |
377 */ |
373 */ |
378 @SuppressWarnings("unchecked") |
374 @SuppressWarnings("unchecked") |
379 private void readObject(ObjectInputStream in) throws IOException, |
375 private void readObject(ObjectInputStream in) |
380 ClassNotFoundException { |
376 throws IOException, ClassNotFoundException |
|
377 { |
381 // Don't call defaultReadObject() |
378 // Don't call defaultReadObject() |
382 |
379 |
383 // Read in serialized fields |
380 // Read in serialized fields |
384 ObjectInputStream.GetField gfields = in.readFields(); |
381 ObjectInputStream.GetField gfields = in.readFields(); |
385 |
382 |