/** * Closes an LDAP context, logging any errors, but not throwing * an exception if there is a failure. * * @param ctx the LDAP context to close. */ public static void closeContext(LdapContext ctx) { try { if (ctx != null) { ctx.close(); } } catch (NamingException e) { log.error("Exception while closing LDAP context. ", e); } }
ldapContext.close(); } catch (NamingException ex) { log.error("Failed to close LDAP context", ex);
userContext = new InitialLdapContext(props, null); userContext.close(); } else { // the same context - copy context LdapContext userContext = ((LdapContext) dirContext).newInstance(null); userContext.addToEnvironment(LdapContext.SECURITY_CREDENTIALS, password); userContext.reconnect(null); userContext.close();
if (ctx != null) { ctx.setRequestControls(null); ctx.close();
if (ctx != null) { ctx.setRequestControls(null); ctx.close();
@Override public Group getGroup(String groupName) throws GroupNotFoundException { LdapContext ctx = null; try { String groupDN = manager.findGroupDN(groupName); // Load record. ctx = manager.getContext(manager.getGroupsBaseDN(groupName)); Attributes attrs = ctx.getAttributes(groupDN, standardAttributes); return processGroup(ctx, attrs); } catch (Exception e) { Log.error(e.getMessage(), e); throw new GroupNotFoundException("Group with name " + groupName + " not found.", e); } finally { try { if (ctx != null) { ctx.setRequestControls(null); ctx.close(); } } catch (Exception ignored) { // Ignore. } } }
/** * Closes an LDAP context, logging any errors, but not throwing * an exception if there is a failure. * * @param ctx the LDAP context to close. */ public static void closeContext(LdapContext ctx) { try { if (ctx != null) { ctx.close(); } } catch (NamingException e) { log.error("Exception while closing LDAP context. ", e); } }
private void closeContext(final LdapContext context) { try { if (context != null) { context.close(); } } catch (final NamingException e) { s_logger.warn(e.getMessage(), e); } }
public void close() { if (initialContext != null) { try { initialContext.close(); } catch (Exception e) { // ignore LdapPluginLogger.INSTANCE.exceptionWhenClosingLdapCOntext(e); } } }
private static void closeContext(LdapContext ldapContext) { try { if (ldapContext != null) { ldapContext.close(); } } catch (NamingException e) { // We can silently ignore this, no? } }
private static void closeContext(LdapContext ldapContext) { try { if (ldapContext != null) { ldapContext.close(); } } catch (NamingException e) { // We can silently ignore this, no? } }
public void close() { if (initialContext != null) { try { initialContext.close(); } catch (Exception e) { // ignore LOG.log(Level.FINE, "exception while closing LDAP DIR CTX", e); } } }
private static void closeContexts(LdapContext... ctx) { for (int i = 0; i < ctx.length; i++) { try { if (ctx[i] != null) { ctx[i].close(); } } catch (Throwable t) { log.error("Error closing context " + i, t); } } }
private void closeContext(LdapContext context) { try { if (context != null) { context.close(); } } catch (NamingException e) { this.log.debug("Error closing connection: " + e.getMessage(), e); } } }
LdapContext ctx = new InitialLdapContext(); try { /* Use the context... */ } finally { ctx.close(); }
public void close() { if (context != null) { try { context.close(); } catch (NamingException e) { throw new CukesRuntimeException(e); } } context = null; }
@Override public void destroyObject(PooledObject<LdapContext> p) throws Exception { p.getObject().close(); }
protected void closeConnection() { if (context != null) { try { context.close(); } catch (Throwable t) { if (isDebugOn()) { t.printStackTrace(); } info("Exception trying to close LDAP connection: " + t.getMessage()); } } }