mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8297074: Use enhanced-for cycle instead of Enumeration in javax.crypto
Reviewed-by: weijun, wetmore
This commit is contained in:
parent
819af69f40
commit
66228f77fe
3 changed files with 6 additions and 36 deletions
|
@ -506,10 +506,8 @@ final class CryptoPermissionCollection extends PermissionCollection
|
|||
if (!(permission instanceof CryptoPermission cp))
|
||||
return false;
|
||||
|
||||
Enumeration<Permission> e = permissions.elements();
|
||||
|
||||
while (e.hasMoreElements()) {
|
||||
CryptoPermission x = (CryptoPermission) e.nextElement();
|
||||
for (Permission p : permissions) {
|
||||
CryptoPermission x = (CryptoPermission) p;
|
||||
if (x.implies(cp)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -229,10 +229,7 @@ implements Serializable {
|
|||
// For each algorithm in this CryptoPermissions,
|
||||
// find out if there is anything we should add into
|
||||
// ret.
|
||||
Enumeration<String> thisKeys = this.perms.keys();
|
||||
while (thisKeys.hasMoreElements()) {
|
||||
String alg = thisKeys.nextElement();
|
||||
|
||||
for (String alg : this.perms.keySet()) {
|
||||
PermissionCollection thisPc = this.perms.get(alg);
|
||||
PermissionCollection thatPc = other.perms.get(alg);
|
||||
|
||||
|
@ -270,9 +267,7 @@ implements Serializable {
|
|||
maxKeySize =
|
||||
((CryptoPermission)
|
||||
thisWildcard.elements().nextElement()).getMaxKeySize();
|
||||
Enumeration<String> thatKeys = other.perms.keys();
|
||||
while (thatKeys.hasMoreElements()) {
|
||||
String alg = thatKeys.nextElement();
|
||||
for (String alg : other.perms.keySet()) {
|
||||
|
||||
if (this.perms.containsKey(alg)) {
|
||||
continue;
|
||||
|
|
|
@ -471,13 +471,8 @@ final class CryptoPolicyParser {
|
|||
CryptoPermission[] getPermissions() {
|
||||
ArrayList<CryptoPermission> result = new ArrayList<>();
|
||||
|
||||
Enumeration<GrantEntry> grantEnum = grantEntries.elements();
|
||||
while (grantEnum.hasMoreElements()) {
|
||||
GrantEntry ge = grantEnum.nextElement();
|
||||
Enumeration<CryptoPermissionEntry> permEnum =
|
||||
ge.permissionElements();
|
||||
while (permEnum.hasMoreElements()) {
|
||||
CryptoPermissionEntry pe = permEnum.nextElement();
|
||||
for (GrantEntry ge : grantEntries) {
|
||||
for (CryptoPermissionEntry pe : ge.permissionEntries) {
|
||||
if (pe.cryptoPermission.equals(
|
||||
"javax.crypto.CryptoAllPermission")) {
|
||||
result.add(CryptoAllPermission.INSTANCE);
|
||||
|
@ -577,24 +572,6 @@ final class CryptoPolicyParser {
|
|||
{
|
||||
permissionEntries.addElement(pe);
|
||||
}
|
||||
|
||||
boolean remove(CryptoPermissionEntry pe)
|
||||
{
|
||||
return permissionEntries.removeElement(pe);
|
||||
}
|
||||
|
||||
boolean contains(CryptoPermissionEntry pe)
|
||||
{
|
||||
return permissionEntries.contains(pe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate all the permission entries in this {@code GrantEntry}.
|
||||
*/
|
||||
Enumeration<CryptoPermissionEntry> permissionElements(){
|
||||
return permissionEntries.elements();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue