Commit bb07973c by Michael Koch Committed by Michael Koch

AccessControlContext.java: Reformated.

2005-04-26  Michael Koch  <konqueror@gmx.de>

	* java/security/AccessControlContext.java:
	Reformated.
	(protectedDomains): Renamed from 'protectionDomain'.
	* java/security/AccessController.java:
	Reformatted.

From-SVN: r98766
parent 6f3a3283
2005-04-26 Michael Koch <konqueror@gmx.de>
* java/security/AccessControlContext.java:
Reformated.
(protectedDomains): Renamed from 'protectionDomain'.
* java/security/AccessController.java:
Reformatted.
2005-04-26 Jeroen Frijters <jeroen@frijters.net> 2005-04-26 Jeroen Frijters <jeroen@frijters.net>
* gnu/java/security/action/GetSecurityPropertyAction.java * gnu/java/security/action/GetSecurityPropertyAction.java
......
...@@ -53,7 +53,7 @@ package java.security; ...@@ -53,7 +53,7 @@ package java.security;
*/ */
public final class AccessControlContext public final class AccessControlContext
{ {
private ProtectionDomain protectionDomain[]; private ProtectionDomain[] protectionDomains;
private DomainCombiner combiner; private DomainCombiner combiner;
/** /**
...@@ -63,13 +63,13 @@ public final class AccessControlContext ...@@ -63,13 +63,13 @@ public final class AccessControlContext
* *
* @param context The ProtectionDomains to use * @param context The ProtectionDomains to use
*/ */
public AccessControlContext(ProtectionDomain[]context) public AccessControlContext(ProtectionDomain[] context)
{ {
int i, j, k, count = context.length, count2 = 0; int i, j, k, count = context.length, count2 = 0;
for (i = 0, j = 0; i < count; i++) for (i = 0, j = 0; i < count; i++)
{ {
for (k = 0; k < i; k++) for (k = 0; k < i; k++)
if (context[k] == protectionDomain[i]) if (context[k] == protectionDomains[i])
break; break;
if (k != i) //it means previous loop did not complete if (k != i) //it means previous loop did not complete
continue; continue;
...@@ -77,16 +77,16 @@ public final class AccessControlContext ...@@ -77,16 +77,16 @@ public final class AccessControlContext
count2++; count2++;
} }
protectionDomain = new ProtectionDomain[count2]; protectionDomains = new ProtectionDomain[count2];
for (i = 0, j = 0; i < count2; i++) for (i = 0, j = 0; i < count2; i++)
{ {
for (k = 0; k < i; k++) for (k = 0; k < i; k++)
if (context[k] == protectionDomain[i]) if (context[k] == protectionDomains[i])
break; break;
if (k != i) //it means previous loop did not complete if (k != i) //it means previous loop did not complete
continue; continue;
protectionDomain[j++] = context[i]; protectionDomains[j++] = context[i];
} }
} }
...@@ -99,7 +99,7 @@ public final class AccessControlContext ...@@ -99,7 +99,7 @@ public final class AccessControlContext
public AccessControlContext(AccessControlContext acc, public AccessControlContext(AccessControlContext acc,
DomainCombiner combiner) DomainCombiner combiner)
{ {
this(acc.protectionDomain); this(acc.protectionDomains);
this.combiner = combiner; this.combiner = combiner;
} }
...@@ -123,8 +123,8 @@ public final class AccessControlContext ...@@ -123,8 +123,8 @@ public final class AccessControlContext
*/ */
public void checkPermission(Permission perm) throws AccessControlException public void checkPermission(Permission perm) throws AccessControlException
{ {
for (int i = 0; i < protectionDomain.length; i++) for (int i = 0; i < protectionDomains.length; i++)
if (protectionDomain[i].implies(perm) == true) if (protectionDomains[i].implies(perm) == true)
return; return;
throw new AccessControlException("Permission not granted"); throw new AccessControlException("Permission not granted");
...@@ -146,13 +146,13 @@ public final class AccessControlContext ...@@ -146,13 +146,13 @@ public final class AccessControlContext
{ {
AccessControlContext acc = (AccessControlContext) obj; AccessControlContext acc = (AccessControlContext) obj;
if (acc.protectionDomain.length != protectionDomain.length) if (acc.protectionDomains.length != protectionDomains.length)
return false; return false;
for (int i = 0; i < protectionDomain.length; i++) for (int i = 0; i < protectionDomains.length; i++)
if (acc.protectionDomain[i] != protectionDomain[i]) if (acc.protectionDomains[i] != protectionDomains[i])
return false; return false;
return true; return true;
} }
return false; return false;
} }
...@@ -165,8 +165,8 @@ public final class AccessControlContext ...@@ -165,8 +165,8 @@ public final class AccessControlContext
public int hashCode() public int hashCode()
{ {
int h = 0; int h = 0;
for (int i = 0; i < protectionDomain.length; i++) for (int i = 0; i < protectionDomains.length; i++)
h ^= protectionDomain[i].hashCode(); h ^= protectionDomains[i].hashCode();
return h; return h;
} }
......
...@@ -113,7 +113,7 @@ public final class AccessController ...@@ -113,7 +113,7 @@ public final class AccessController
* @return the result of the <code>action.run()</code> method. * @return the result of the <code>action.run()</code> method.
*/ */
public static Object doPrivileged(PrivilegedAction action, public static Object doPrivileged(PrivilegedAction action,
AccessControlContext context) AccessControlContext context)
{ {
return action.run(); return action.run();
} }
...@@ -137,14 +137,13 @@ public final class AccessController ...@@ -137,14 +137,13 @@ public final class AccessController
public static Object doPrivileged(PrivilegedExceptionAction action) public static Object doPrivileged(PrivilegedExceptionAction action)
throws PrivilegedActionException throws PrivilegedActionException
{ {
try try
{ {
return action.run(); return action.run();
} }
catch (Exception e) catch (Exception e)
{ {
throw new PrivilegedActionException(e); throw new PrivilegedActionException(e);
} }
} }
...@@ -167,17 +166,16 @@ public final class AccessController ...@@ -167,17 +166,16 @@ public final class AccessController
* is thrown in the <code>run()</code> method. * is thrown in the <code>run()</code> method.
*/ */
public static Object doPrivileged(PrivilegedExceptionAction action, public static Object doPrivileged(PrivilegedExceptionAction action,
AccessControlContext context) AccessControlContext context)
throws PrivilegedActionException throws PrivilegedActionException
{ {
try try
{ {
return action.run(); return action.run();
} }
catch (Exception e) catch (Exception e)
{ {
throw new PrivilegedActionException(e); throw new PrivilegedActionException(e);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment