use of org.forgerock.opendj.ldap.EntryNotFoundException in project OpenAM by OpenRock.
the class SMSLdapObject method entryExists.
/**
* Checks if the provided DN exists.
*/
private static boolean entryExists(String dn) throws SMSException {
boolean entryExists = false;
try (Connection conn = getConnection(adminPrincipal)) {
// Use the Admin Principal to check if entry exists
conn.searchSingleEntry(LDAPRequests.newSingleEntrySearchRequest(dn, OU_ATTR));
entryExists = true;
} catch (EntryNotFoundException e) {
debug.warning("SMSLdapObject:entryExists: {} does not exist", dn);
} catch (LdapException e) {
throw new SMSException("Unable to find entry with DN: " + dn, e, IUMSConstants.SMS_LDAP_OPERATION_FAILED);
}
return entryExists;
}
Aggregations