X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2Fdirectory%2Fldap%2FLdapConnection.java;h=748efe35087867c086aae4d7706b0d216aaf5b5c;hb=3c1cdc594d954520b14646102b366290bdad58c7;hp=f7838381d3884a872661ea8b61b408042da63bef;hpb=e2ffdf6872592aa22d0de2b0ec69ee4eca698c45;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/directory/ldap/LdapConnection.java b/org.argeo.util/src/org/argeo/util/directory/ldap/LdapConnection.java index f7838381d..748efe350 100644 --- a/org.argeo.util/src/org/argeo/util/directory/ldap/LdapConnection.java +++ b/org.argeo.util/src/org/argeo/util/directory/ldap/LdapConnection.java @@ -99,6 +99,20 @@ public class LdapConnection { } } + public synchronized boolean entryExists(LdapName name) throws NamingException { + String[] noAttrOID = new String[] { "1.1" }; + try { + getLdapContext().getAttributes(name, noAttrOID); + return true; + } catch (CommunicationException e) { + reconnect(); + getLdapContext().getAttributes(name, noAttrOID); + return true; + } catch (NameNotFoundException e) { + return false; + } + } + public synchronized void prepareChanges(WorkingCopy wc) throws NamingException { // make sure connection will work reconnect(); @@ -121,13 +135,13 @@ public class LdapConnection { } - protected boolean entryExists(LdapName dn) throws NamingException { - try { - return getAttributes(dn).size() != 0; - } catch (NameNotFoundException e) { - return false; - } - } +// protected boolean entryExists(LdapName dn) throws NamingException { +// try { +// return getAttributes(dn).size() != 0; +// } catch (NameNotFoundException e) { +// return false; +// } +// } public synchronized void commitChanges(LdapEntryWorkingCopy wc) throws NamingException { // delete