]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.util/src/org/argeo/osgi/useradmin/LdifGroup.java
LDAP support for hierarchy unit. Code clean up.
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / osgi / useradmin / LdifGroup.java
index b7167ea134684bacf63b25618446e8b198db27a5..80bff59472a7799ca5fdd1ada85ebd91215ac2cb 100644 (file)
@@ -5,6 +5,7 @@ import java.util.List;
 
 import javax.naming.InvalidNameException;
 import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.ldap.LdapName;
@@ -73,7 +74,7 @@ abstract class LdifGroup extends LdifUser implements DirectoryGroup {
                for (LdapName ldapName : getMemberNames()) {
                        Role role = findRole(ldapName);
                        if (role == null) {
-                               throw new UserDirectoryException("Role " + ldapName + " cannot be added.");
+                               throw new IllegalStateException("Role " + ldapName + " not found.");
                        }
                        directMembers.add(role);
                }
@@ -107,8 +108,8 @@ abstract class LdifGroup extends LdifUser implements DirectoryGroup {
                                roles.add(dn);
                        }
                        return roles;
-               } catch (Exception e) {
-                       throw new UserDirectoryException("Cannot get members", e);
+               } catch (NamingException e) {
+                       throw new IllegalStateException("Cannot get members", e);
                }
        }