Author: andreas
Date: Sat Jan 3 08:33:31 2009
New Revision: 731017
URL: http://svn.apache.org/viewvc?rev=731017&view=rev
Log:
Adding assertion that identity of workflowable must not be null.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java?rev=731017&r1=731016&r2=731017&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java Sat Jan 3 08:33:31 2009
@@ -61,12 +61,10 @@
}
/**
- * Returns if the condition is complied in a certain situation. The
- * condition is complied when the current user has the role that is required
- * by the RoleCondition.
+ * Returns if the condition is complied in a certain situation. The condition is complied when
+ * the current user has the role that is required by the RoleCondition.
*
- * @see org.apache.lenya.workflow.impl.AbstractCondition#isComplied(Workflow,
- * Workflowable)
+ * @see org.apache.lenya.workflow.impl.AbstractCondition#isComplied(Workflow, Workflowable)
*/
public boolean isComplied(Workflow workflow, Workflowable instance) {
@@ -86,14 +84,17 @@
PolicyManager policyManager = accessController.getPolicyManager();
Identity identity = workflowable.getSession().getIdentity();
- AccreditableManager accreditableMgr = accessController
- .getAccreditableManager();
+ if (identity == null) {
+ throw new IllegalArgumentException("The session of the workflowable "
+ + workflowable + " has no identity.");
+ }
+ AccreditableManager accreditableMgr = accessController.getAccreditableManager();
Policy policy = policyManager.getPolicy(accreditableMgr, url);
RoleManager roleManager = accreditableMgr.getRoleManager();
-
+
boolean complied = false;
-
- for (Iterator i = this.roleIds.iterator(); i.hasNext(); ) {
+
+ for (Iterator i = this.roleIds.iterator(); i.hasNext();) {
String roleId = (String) i.next();
Role role = roleManager.getRole(roleId);
if (policy.check(identity, role) == Policy.RESULT_GRANTED) {
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.