From 0b8aa4c76cb7a1d19abf93a4c1ae0c973abdab5b Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Wed, 6 Apr 2016 14:06:16 +0000 Subject: [PATCH] Fix glitches while testing the Security Perspective with LDAP backend git-svn-id: https://svn.argeo.org/commons/trunk@8860 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../src/org/argeo/osgi/useradmin/LdapUserAdmin.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.argeo.security.core/src/org/argeo/osgi/useradmin/LdapUserAdmin.java b/org.argeo.security.core/src/org/argeo/osgi/useradmin/LdapUserAdmin.java index 7acb7dffd..22d9a5422 100644 --- a/org.argeo.security.core/src/org/argeo/osgi/useradmin/LdapUserAdmin.java +++ b/org.argeo.security.core/src/org/argeo/osgi/useradmin/LdapUserAdmin.java @@ -10,6 +10,7 @@ import java.util.List; import javax.naming.Binding; import javax.naming.Context; import javax.naming.InvalidNameException; +import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; @@ -200,7 +201,7 @@ public class LdapUserAdmin extends AbstractUserDirectory { // modify for (LdapName dn : wc.getModifiedUsers().keySet()) { if (!entryExists(dn)) - throw new UserDirectoryException("User to modify no found " + throw new UserDirectoryException("User to modify not found " + dn); } } catch (NamingException e) { @@ -209,7 +210,11 @@ public class LdapUserAdmin extends AbstractUserDirectory { } private boolean entryExists(LdapName dn) throws NamingException { - return getLdapContext().getAttributes(dn).size() != 0; + try { + return getLdapContext().getAttributes(dn).size() != 0; + } catch (NameNotFoundException e) { + return false; + } } @Override -- 2.30.2