X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FLdapConnection.java;h=1eaf1e7d65470e8377e072727b0fb8069f375ebd;hb=cceead8a279e8630f63cc9e8213bdcdca39955a5;hp=ed69eb16b09443409757a9c6584a4909a5dcfc66;hpb=eb4324be6ac9cdff15828a21ee7d3f6ca2f19fb9;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/osgi/useradmin/LdapConnection.java b/org.argeo.util/src/org/argeo/osgi/useradmin/LdapConnection.java index ed69eb16b..1eaf1e7d6 100644 --- a/org.argeo.util/src/org/argeo/osgi/useradmin/LdapConnection.java +++ b/org.argeo.util/src/org/argeo/osgi/useradmin/LdapConnection.java @@ -49,8 +49,8 @@ class LdapConnection { initialLdapContext.addToEnvironment(Context.SECURITY_CREDENTIALS, creds.toString()); } } - } catch (Exception e) { - throw new UserDirectoryException("Cannot connect to LDAP", e); + } catch (NamingException e) { + throw new IllegalStateException("Cannot connect to LDAP", e); } } @@ -105,17 +105,17 @@ class LdapConnection { // delete for (LdapName dn : wc.getDeletedUsers().keySet()) { if (!entryExists(dn)) - throw new UserDirectoryException("User to delete no found " + dn); + throw new IllegalStateException("User to delete no found " + dn); } // add for (LdapName dn : wc.getNewUsers().keySet()) { if (entryExists(dn)) - throw new UserDirectoryException("User to create found " + dn); + throw new IllegalStateException("User to create found " + dn); } // modify for (LdapName dn : wc.getModifiedUsers().keySet()) { if (!wc.getNewUsers().containsKey(dn) && !entryExists(dn)) - throw new UserDirectoryException("User to modify not found " + dn); + throw new IllegalStateException("User to modify not found " + dn); } }