|
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
import javax.naming.Context;
|
|
|
+import javax.naming.NamingEnumeration;
|
|
|
import javax.naming.NamingException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URI;
|
|
@@ -60,6 +61,16 @@ public final class LdapUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void closeEnumeration(NamingEnumeration ne) {
|
|
|
+ try {
|
|
|
+ if (ne != null) {
|
|
|
+ ne.close();
|
|
|
+ }
|
|
|
+ } catch (NamingException e) {
|
|
|
+ logger.error("Failed to close enumeration.", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Obtains the part of a DN relative to a supplied base context.
|
|
|
* <p>If the DN is "cn=bob,ou=people,dc=springframework,dc=org" and the base context name is
|