GUACAMOLE-938: Remove disconnect() utility function. Closing an LdapNetworkConnection cannot throw an IOException.

This commit is contained in:
Michael Jumper
2020-01-24 22:51:08 -08:00
parent 9c72a87c6a
commit 15b631514d
2 changed files with 3 additions and 27 deletions

View File

@@ -154,7 +154,7 @@ public class AuthenticationProviderService {
// Always disconnect
finally {
ldapService.disconnect(searchConnection);
searchConnection.close();
}
}
@@ -226,7 +226,7 @@ public class AuthenticationProviderService {
// Always disconnect
finally {
ldapService.disconnect(ldapConnection);
ldapConnection.close();
}
}
@@ -335,7 +335,7 @@ public class AuthenticationProviderService {
// Always disconnect
finally {
ldapService.disconnect(ldapConnection);
ldapConnection.close();
}
}
return null;

View File

@@ -20,7 +20,6 @@
package org.apache.guacamole.auth.ldap;
import com.google.inject.Inject;
import java.io.IOException;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.filter.ExprNode;
import org.apache.directory.api.ldap.model.message.BindRequest;
@@ -32,7 +31,6 @@ import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.url.LdapUrl;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.ldap.client.api.LdapConnectionConfig;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.guacamole.GuacamoleException;
@@ -227,28 +225,6 @@ public class LDAPConnectionService {
}
/**
* 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.close();
}
// Warn if disconnect unexpectedly fails
catch (IOException e) {
logger.warn("Unable to disconnect from LDAP server: {}", e.getMessage());
logger.debug("LDAP disconnect failed.", e);
}
}
/**
* Generate a SearchRequest object using the given Base DN and filter
* and retrieving other properties from the LDAP configuration service.