From bb07973ce5483a6eba3b30a3f54d6691a5cba592 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 26 Apr 2005 07:16:48 +0000 Subject: [PATCH] AccessControlContext.java: Reformated. 2005-04-26 Michael Koch * java/security/AccessControlContext.java: Reformated. (protectedDomains): Renamed from 'protectionDomain'. * java/security/AccessController.java: Reformatted. From-SVN: r98766 --- libjava/ChangeLog | 8 +++++++ libjava/java/security/AccessControlContext.java | 30 ++++++++++++------------- libjava/java/security/AccessController.java | 14 +++++------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ddabdc9..e976ea9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2005-04-26 Michael Koch + + * java/security/AccessControlContext.java: + Reformated. + (protectedDomains): Renamed from 'protectionDomain'. + * java/security/AccessController.java: + Reformatted. + 2005-04-26 Jeroen Frijters * gnu/java/security/action/GetSecurityPropertyAction.java diff --git a/libjava/java/security/AccessControlContext.java b/libjava/java/security/AccessControlContext.java index 6237022..0224a7a 100644 --- a/libjava/java/security/AccessControlContext.java +++ b/libjava/java/security/AccessControlContext.java @@ -53,7 +53,7 @@ package java.security; */ public final class AccessControlContext { - private ProtectionDomain protectionDomain[]; + private ProtectionDomain[] protectionDomains; private DomainCombiner combiner; /** @@ -63,13 +63,13 @@ public final class AccessControlContext * * @param context The ProtectionDomains to use */ - public AccessControlContext(ProtectionDomain[]context) + public AccessControlContext(ProtectionDomain[] context) { int i, j, k, count = context.length, count2 = 0; for (i = 0, j = 0; i < count; i++) { for (k = 0; k < i; k++) - if (context[k] == protectionDomain[i]) + if (context[k] == protectionDomains[i]) break; if (k != i) //it means previous loop did not complete continue; @@ -77,16 +77,16 @@ public final class AccessControlContext count2++; } - protectionDomain = new ProtectionDomain[count2]; + protectionDomains = new ProtectionDomain[count2]; for (i = 0, j = 0; i < count2; i++) { for (k = 0; k < i; k++) - if (context[k] == protectionDomain[i]) + if (context[k] == protectionDomains[i]) break; if (k != i) //it means previous loop did not complete continue; - protectionDomain[j++] = context[i]; + protectionDomains[j++] = context[i]; } } @@ -99,7 +99,7 @@ public final class AccessControlContext public AccessControlContext(AccessControlContext acc, DomainCombiner combiner) { - this(acc.protectionDomain); + this(acc.protectionDomains); this.combiner = combiner; } @@ -123,8 +123,8 @@ public final class AccessControlContext */ public void checkPermission(Permission perm) throws AccessControlException { - for (int i = 0; i < protectionDomain.length; i++) - if (protectionDomain[i].implies(perm) == true) + for (int i = 0; i < protectionDomains.length; i++) + if (protectionDomains[i].implies(perm) == true) return; throw new AccessControlException("Permission not granted"); @@ -146,13 +146,13 @@ public final class AccessControlContext { AccessControlContext acc = (AccessControlContext) obj; - if (acc.protectionDomain.length != protectionDomain.length) + if (acc.protectionDomains.length != protectionDomains.length) return false; - for (int i = 0; i < protectionDomain.length; i++) - if (acc.protectionDomain[i] != protectionDomain[i]) + for (int i = 0; i < protectionDomains.length; i++) + if (acc.protectionDomains[i] != protectionDomains[i]) return false; - return true; + return true; } return false; } @@ -165,8 +165,8 @@ public final class AccessControlContext public int hashCode() { int h = 0; - for (int i = 0; i < protectionDomain.length; i++) - h ^= protectionDomain[i].hashCode(); + for (int i = 0; i < protectionDomains.length; i++) + h ^= protectionDomains[i].hashCode(); return h; } diff --git a/libjava/java/security/AccessController.java b/libjava/java/security/AccessController.java index 66aed9e..a268e18 100644 --- a/libjava/java/security/AccessController.java +++ b/libjava/java/security/AccessController.java @@ -113,7 +113,7 @@ public final class AccessController * @return the result of the action.run() method. */ public static Object doPrivileged(PrivilegedAction action, - AccessControlContext context) + AccessControlContext context) { return action.run(); } @@ -137,14 +137,13 @@ public final class AccessController public static Object doPrivileged(PrivilegedExceptionAction action) throws PrivilegedActionException { - try { - return action.run(); + return action.run(); } catch (Exception e) { - throw new PrivilegedActionException(e); + throw new PrivilegedActionException(e); } } @@ -167,17 +166,16 @@ public final class AccessController * is thrown in the run() method. */ public static Object doPrivileged(PrivilegedExceptionAction action, - AccessControlContext context) + AccessControlContext context) throws PrivilegedActionException { - try { - return action.run(); + return action.run(); } catch (Exception e) { - throw new PrivilegedActionException(e); + throw new PrivilegedActionException(e); } } -- 2.7.4