/** * Disconnects the given LDAP connection, logging any failure to do so * appropriately. * * @param ldapConnection * The LDAP connection to disconnect. */ public void disconnect(LDAPConnection ldapConnection) { // Attempt disconnect try { ldapConnection.disconnect(); } // Warn if disconnect unexpectedly fails catch (LDAPException e) { logger.warn("Unable to disconnect from LDAP server: {}", e.getMessage()); logger.debug("LDAP disconnect failed.", e); } }
logger.error("Unable to connect to LDAP server: {}", e.getMessage()); logger.debug("Failed to connect to LDAP server.", e); return null;
public String getMessage() { return exception.getMessage(); } }
public void close( ) { if ( this.ldapConnection != null ) { try { this.ldapConnection.disconnect(); } catch ( LDAPException e ) { LOGGER.error( "error closing ldap connection: " + e.getMessage(), e ); } this.ldapConnection = null; } }
/** * Find all user objects which have this email address. * * @param email * The email address string. * @param factory * To create all the UserEdit objects you populate and return in the return collection. * @return Collection (UserEdit) of user objects that have this email address, or an empty Collection if there are none. */ @SuppressWarnings("rawtypes") public Collection findUsersByEmail(String email, UserFactory factory) { String filter = ldapAttributeMapper.getFindUserByEmailFilter(email); List<User> users = new ArrayList<User>(); try { List<LdapUserData> ldapUsers = searchDirectory(filter, null, null, null, null, maxResultSize); for(LdapUserData ldapUserData: ldapUsers) { //SAK-20625 ensure we have an id-eid mapping at this time UserEdit user = factory.newUser(ldapUserData.getEid()); mapUserDataOntoUserEdit(ldapUserData, user); users.add(user); } } catch (LDAPException e) { log.warn("An error occurred finding users by email: " + e.getClass().getName() + ": (" + e.getResultCode() + ") " + e.getMessage()); return null; } return users; }
log.warn("An error occurred searching for users: " + e.getClass().getName() + ": (" + e.getResultCode() + ") " + e.getMessage()); return null;
if (e instanceof LDAPException) { LDAPException le = (LDAPException) e; String msg = Integer.toString(le.getResultCode()) + ":" + le.getMessage(); out.write(makeXMLSafe(msg)); } else {
lc.disconnect(); } catch (LDAPException ex) { LOG.debug(ex.getMessage()); lc.disconnect(); } catch (LDAPException ex) { LOG.debug(ex.getMessage()); LOG.debug("disconected from LDAP server {} on port {}", address, ldapPort); } catch (LDAPException e) { LOG.debug(e.getMessage());