Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
This commit is contained in:
@@ -77,14 +77,23 @@ public final class AccessControlContext
|
||||
|
||||
/**
|
||||
* Construct a new AccessControlContext with the specified
|
||||
* ProtectionDomains and DomainCombiner
|
||||
* {@link ProtectionDomain}s and {@link DomainCombiner}.
|
||||
*
|
||||
* <p>Code calling this constructor must have a {@link
|
||||
* SecurityPermission} of <i>createAccessControlContext</i>.</p>
|
||||
*
|
||||
* @throws SecurityException If the caller does not have permission
|
||||
* to create an access control context.
|
||||
* @since 1.3
|
||||
*/
|
||||
public AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner)
|
||||
{
|
||||
// XXX check permission to call this.
|
||||
SecurityManager sm = System.getSecurityManager ();
|
||||
if (sm != null)
|
||||
{
|
||||
sm.checkPermission (new SecurityPermission ("createAccessControlContext"));
|
||||
}
|
||||
AccessControlContext acc2 = AccessController.getContext();
|
||||
protectionDomains = combiner.combine (acc2.protectionDomains,
|
||||
acc.protectionDomains);
|
||||
@@ -119,10 +128,20 @@ public final class AccessControlContext
|
||||
public void checkPermission(Permission perm) throws AccessControlException
|
||||
{
|
||||
if (protectionDomains.length == 0)
|
||||
throw new AccessControlException ("permission not granted");
|
||||
throw new AccessControlException ("permission "
|
||||
+ perm
|
||||
+ " not granted: no protection domains");
|
||||
|
||||
for (int i = 0; i < protectionDomains.length; i++)
|
||||
if (!protectionDomains[i].implies(perm))
|
||||
throw new AccessControlException ("permission not granted");
|
||||
{
|
||||
final ProtectionDomain domain = protectionDomains[i];
|
||||
if (!domain.implies(perm))
|
||||
throw new AccessControlException ("permission "
|
||||
+ perm
|
||||
+ " not granted: "
|
||||
+ domain
|
||||
+ " does not imply it.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,4 +192,9 @@ public final class AccessControlContext
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
ProtectionDomain[] getProtectionDomains ()
|
||||
{
|
||||
return protectionDomains;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ public final class AccessController
|
||||
* @param action the <code>PrivilegedExceptionAction</code> whose
|
||||
* <code>run()</code> should be be called.
|
||||
* @return the result of the <code>action.run()</code> method.
|
||||
* @exception PrivilegedActionException wrapped around any exception that
|
||||
* is thrown in the <code>run()</code> method.
|
||||
* @exception PrivilegedActionException wrapped around any checked exception
|
||||
* that is thrown in the <code>run()</code> method.
|
||||
*/
|
||||
public static Object doPrivileged(PrivilegedExceptionAction action)
|
||||
throws PrivilegedActionException
|
||||
@@ -153,6 +153,10 @@ public final class AccessController
|
||||
{
|
||||
return action.run();
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new PrivilegedActionException(e);
|
||||
@@ -178,8 +182,8 @@ public final class AccessController
|
||||
* @param context the <code>AccessControlContext</code> whose protection
|
||||
* domains should be added to the protection domain of the calling class.
|
||||
* @return the result of the <code>action.run()</code> method.
|
||||
* @exception PrivilegedActionException wrapped around any exception that
|
||||
* is thrown in the <code>run()</code> method.
|
||||
* @exception PrivilegedActionException wrapped around any checked exception
|
||||
* that is thrown in the <code>run()</code> method.
|
||||
*/
|
||||
public static Object doPrivileged(PrivilegedExceptionAction action,
|
||||
AccessControlContext context)
|
||||
@@ -190,6 +194,10 @@ public final class AccessController
|
||||
{
|
||||
return action.run();
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new PrivilegedActionException(e);
|
||||
|
||||
@@ -297,8 +297,8 @@ public abstract class Identity implements Principal, Serializable
|
||||
if (identity == this)
|
||||
return true;
|
||||
|
||||
if ((((Identity) identity).getName() == this.name) &&
|
||||
(((Identity) identity).getScope() == this.scope))
|
||||
if ((((Identity) identity).getName().equals(this.name)) &&
|
||||
(((Identity) identity).getScope().equals(this.scope)))
|
||||
return true;
|
||||
|
||||
return identityEquals((Identity) identity);
|
||||
@@ -319,8 +319,8 @@ public abstract class Identity implements Principal, Serializable
|
||||
*/
|
||||
protected boolean identityEquals(Identity identity)
|
||||
{
|
||||
return ((identity.getName() == this.name) &&
|
||||
(identity.getPublicKey() == this.publicKey));
|
||||
return ((identity.getName().equals(this.name)) &&
|
||||
(identity.getPublicKey().equals(this.publicKey)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Security.java --- Java base security class implementation
|
||||
Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -651,7 +651,7 @@ public final class Security
|
||||
if (result.isEmpty())
|
||||
return null;
|
||||
|
||||
return (Provider[]) result.toArray(new Provider[0]);
|
||||
return (Provider[]) result.toArray(new Provider[result.size()]);
|
||||
}
|
||||
|
||||
private static void selectProviders(String svc, String algo, String attr,
|
||||
|
||||
Reference in New Issue
Block a user