< prev index next >

src/java.base/share/classes/java/security/BasicPermission.java

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea


 332      * @see #serialPersistentFields
 333      */
 334     private Class<?> permClass;
 335 
 336     /**
 337      * Create an empty BasicPermissionCollection object.
 338      *
 339      */
 340     public BasicPermissionCollection(Class<?> clazz) {
 341         perms = new ConcurrentHashMap<>(11);
 342         all_allowed = false;
 343         permClass = clazz;
 344     }
 345 
 346     /**
 347      * Adds a permission to the BasicPermissions. The key for the hash is
 348      * permission.path.
 349      *
 350      * @param permission the Permission object to add.
 351      *
 352      * @exception IllegalArgumentException - if the permission is not a
 353      *                                       BasicPermission, or if
 354      *                                       the permission is not of the
 355      *                                       same Class as the other
 356      *                                       permissions in this collection.
 357      *
 358      * @exception SecurityException - if this BasicPermissionCollection object
 359      *                                has been marked readonly
 360      */
 361     @Override
 362     public void add(Permission permission) {
 363         if (! (permission instanceof BasicPermission))
 364             throw new IllegalArgumentException("invalid permission: "+
 365                                                permission);
 366         if (isReadOnly())
 367             throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
 368 
 369         BasicPermission bp = (BasicPermission) permission;
 370 
 371         // make sure we only add new BasicPermissions of the same class
 372         // Also check null for compatibility with deserialized form from
 373         // previous versions.
 374         if (permClass == null) {
 375             // adding first permission
 376             permClass = bp.getClass();
 377         } else {
 378             if (bp.getClass() != permClass)




 332      * @see #serialPersistentFields
 333      */
 334     private Class<?> permClass;
 335 
 336     /**
 337      * Create an empty BasicPermissionCollection object.
 338      *
 339      */
 340     public BasicPermissionCollection(Class<?> clazz) {
 341         perms = new ConcurrentHashMap<>(11);
 342         all_allowed = false;
 343         permClass = clazz;
 344     }
 345 
 346     /**
 347      * Adds a permission to the BasicPermissions. The key for the hash is
 348      * permission.path.
 349      *
 350      * @param permission the Permission object to add.
 351      *
 352      * @throws    IllegalArgumentException - if the permission is not a
 353      *                                       BasicPermission, or if
 354      *                                       the permission is not of the
 355      *                                       same Class as the other
 356      *                                       permissions in this collection.
 357      *
 358      * @throws    SecurityException - if this BasicPermissionCollection object
 359      *                                has been marked readonly
 360      */
 361     @Override
 362     public void add(Permission permission) {
 363         if (! (permission instanceof BasicPermission))
 364             throw new IllegalArgumentException("invalid permission: "+
 365                                                permission);
 366         if (isReadOnly())
 367             throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
 368 
 369         BasicPermission bp = (BasicPermission) permission;
 370 
 371         // make sure we only add new BasicPermissions of the same class
 372         // Also check null for compatibility with deserialized form from
 373         // previous versions.
 374         if (permClass == null) {
 375             // adding first permission
 376             permClass = bp.getClass();
 377         } else {
 378             if (bp.getClass() != permClass)


< prev index next >