[Patch] java.security - cleaned up

Michael Koch konqueror@gmx.de
Tue Apr 26 07:18:00 GMT 2005


Hi list,


I just commited the attached patch to bring our java.security more in
line with the one in GNU classpath.


Michael


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

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

-------------- next part --------------
Index: java/security/AccessControlContext.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/AccessControlContext.java,v
retrieving revision 1.3
diff -u -r1.3 AccessControlContext.java
--- java/security/AccessControlContext.java	9 Jul 2004 15:43:01 -0000	1.3
+++ java/security/AccessControlContext.java	26 Apr 2005 07:15:26 -0000
@@ -53,7 +53,7 @@
  */
 public final class AccessControlContext
 {
-  private ProtectionDomain protectionDomain[];
+  private ProtectionDomain[] protectionDomains;
   private DomainCombiner combiner;
 
   /**
@@ -63,13 +63,13 @@
    *
    * @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 @@
 	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 AccessControlContext(AccessControlContext acc,
 			      DomainCombiner combiner)
   {
-    this(acc.protectionDomain);
+    this(acc.protectionDomains);
     this.combiner = combiner;
   }
 
@@ -123,8 +123,8 @@
    */
   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 @@
       {
 	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 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;
   }
Index: java/security/AccessController.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/AccessController.java,v
retrieving revision 1.5
diff -u -r1.5 AccessController.java
--- java/security/AccessController.java	20 Apr 2004 14:44:54 -0000	1.5
+++ java/security/AccessController.java	26 Apr 2005 07:15:26 -0000
@@ -113,7 +113,7 @@
    * @return the result of the <code>action.run()</code> method.
    */
   public static Object doPrivileged(PrivilegedAction action,
-				    AccessControlContext context)
+                                    AccessControlContext context)
   {
     return action.run();
   }
@@ -137,14 +137,13 @@
   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 @@
    * is thrown in the <code>run()</code> 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);
       }
   }
 


More information about the Java-patches mailing list