[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] java.security.Permissions.implies()
From: |
Andrew Haley |
Subject: |
[cp-patches] java.security.Permissions.implies() |
Date: |
Tue, 1 Feb 2005 16:39:51 +0000 |
Permissions.imples() is rather broken ATM.
Simply checking if the collection includes a particular permission
doesn't do the job -- the permission might be a wildcard like
"/secured/*". We need to check every permission in the collection.
The question of synchronization is interesting. I don't think people
usually hold the lock on a Permissions instance when they invoke
implies().
Andrew.
2005-02-01 Andrew Haley <address@hidden>
* java/security/Permissions.java: Iterate over the collection
and invoke implies() on each element.
Index: java/security/Permissions.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/Permissions.java,v
retrieving revision 1.6
diff -p -2 -c -r1.6 Permissions.java
*** java/security/Permissions.java 6 Nov 2004 23:11:47 -0000 1.6
--- java/security/Permissions.java 1 Feb 2005 16:36:17 -0000
*************** class PermissionsHash extends Permission
*** 229,235 ****
* @return true if it is implied
*/
public boolean implies(Permission perm)
{
! return perms.get(perm) != null;
}
--- 229,244 ----
* @return true if it is implied
*/
+ // FIXME: Should this method be synchronized?
public boolean implies(Permission perm)
{
! Enumeration elements = elements();
!
! while (elements.hasMoreElements())
! {
! Permission p = (Permission)elements.nextElement();
! if (p.implies(perm))
! return true;
! }
! return false;
}
- [cp-patches] java.security.Permissions.implies(),
Andrew Haley <=