jdk/src/share/classes/javax/crypto/CryptoPermission.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
child 14014 da3648e13e67
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   473 final class CryptoPermissionCollection extends PermissionCollection
   473 final class CryptoPermissionCollection extends PermissionCollection
   474 implements Serializable {
   474 implements Serializable {
   475 
   475 
   476     private static final long serialVersionUID = -511215555898802763L;
   476     private static final long serialVersionUID = -511215555898802763L;
   477 
   477 
   478     private Vector permissions;
   478     private Vector<Permission> permissions;
   479 
   479 
   480     /**
   480     /**
   481      * Creates an empty CryptoPermissionCollection
   481      * Creates an empty CryptoPermissionCollection
   482      * object.
   482      * object.
   483      */
   483      */
   484     CryptoPermissionCollection() {
   484     CryptoPermissionCollection() {
   485         permissions = new Vector(3);
   485         permissions = new Vector<Permission>(3);
   486     }
   486     }
   487 
   487 
   488     /**
   488     /**
   489      * Adds a permission to the CryptoPermissionCollection.
   489      * Adds a permission to the CryptoPermissionCollection.
   490      *
   490      *
   518         if (!(permission instanceof CryptoPermission))
   518         if (!(permission instanceof CryptoPermission))
   519             return false;
   519             return false;
   520 
   520 
   521         CryptoPermission cp = (CryptoPermission)permission;
   521         CryptoPermission cp = (CryptoPermission)permission;
   522 
   522 
   523         Enumeration e = permissions.elements();
   523         Enumeration<Permission> e = permissions.elements();
   524 
   524 
   525         while (e.hasMoreElements()) {
   525         while (e.hasMoreElements()) {
   526             CryptoPermission x = (CryptoPermission) e.nextElement();
   526             CryptoPermission x = (CryptoPermission) e.nextElement();
   527             if (x.implies(cp)) {
   527             if (x.implies(cp)) {
   528                 return true;
   528                 return true;
   536      * in the container.
   536      * in the container.
   537      *
   537      *
   538      * @return an enumeration of all the CryptoPermission objects.
   538      * @return an enumeration of all the CryptoPermission objects.
   539      */
   539      */
   540 
   540 
   541     public Enumeration elements()
   541     public Enumeration<Permission> elements()
   542     {
   542     {
   543         return permissions.elements();
   543         return permissions.elements();
   544     }
   544     }
   545 }
   545 }