svn commit: r603882 - /lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Dec 13 03:00:50 2007
New Revision: 603882

URL: http://svn.apache.org/viewvc?rev=603882&view=rev
Log:
Throw reasonable error message if non-existent roles are assigned in policies.

Modified:
    lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java

Modified: lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java?rev=603882&r1=603881&r2=603882&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java (original)
+++ lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java Thu Dec 13 03:00:50 2007
@@ -126,6 +126,9 @@
             for (int j = 0; j < roleElements.length; j++) {
                 String roleId = roleElements[j].getAttribute(ID_ATTRIBUTE);
                 Role role = getAccreditableManager().getRoleManager().getRole(roleId);
+                if (role == null) {
+                    throw new AccessControlException("The role '" + roleId + "'Êdoes not exist.");
+                }
                 CredentialImpl credential = new CredentialImpl(accreditable, role);
                 String method = roleElements[j].getAttribute(METHOD_ATTRIBUTE);
                 // If method is not set, we assume DENY
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.