Author: andreas
Date: Sat Jan 3 08:31:20 2009
New Revision: 731012
URL: http://svn.apache.org/viewvc?rev=731012&view=rev
Log:
Adding parameter assertions.
Modified:
lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java
Modified: lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java?rev=731012&r1=731011&r2=731012&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java (original)
+++ lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java Sat Jan 3 08:31:20 2009
@@ -34,6 +34,7 @@
import org.apache.lenya.ac.ModifiablePolicy;
import org.apache.lenya.ac.Policy;
import org.apache.lenya.ac.Role;
+import org.apache.lenya.util.Assert;
/**
* A DefaultPolicy is the own policy of a certain URL (not merged).
@@ -206,6 +207,8 @@
}
public int check(Identity identity, Role role) throws AccessControlException {
+ Assert.notNull("identity", identity);
+ Assert.notNull("role", role);
Credential[] credentials = getCredentials();
for (int i = credentials.length - 1; i >= 0; i--) {
if (matches(identity, credentials[i].getAccreditable())
@@ -221,6 +224,8 @@
}
protected boolean matches(Identity identity, Accreditable accreditable) {
+ Assert.notNull("identity", identity);
+ Assert.notNull("accreditable", accreditable);
Accreditable[] accrs = identity.getAccreditables();
return Arrays.asList(accrs).contains(accreditable);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.