tags:

views:

210

answers:

1

Hi, I am trying to search a LDAP server(Active Directroy), When i parse the search results, the hasMoreElements method of NamingEnumeration takes around 15-20 seconds to execute when it returns false. It is not the case when it is returning true. Is there a way to solve this issue?

code:

            SearchControls ctrl = new SearchControls();
 ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);
 String searchFilter = "(&(objectClass=user("uid"="abc"))";
 NamingEnumeration ne = dirContext.search("ldap://abc:389/dc=abc,dc=xy", searchFilter,ctrl);

 if (ne != null) {
  while (ne.hasMoreElements()) {
                       //parse results
                       }
A: 

AD has a default limit of number of objects it returns in an LDAP query. I think it is in the 1000 object range.

If you hit 1001, you get 1000 returned, then an error, so I could see this being the case.

Count how many objects you get back in a test, and betcha you beat 1000 and then fail.

geoffc