LDAPResultSet boolean next() fix
Brought to you by:
pavelsavin
If you try to read more results than are in the LDAPResultSet, an exception is returned (PartialResultSet). I think the intention was to return "false" back to the caller to let it know there are no more results. Here is a fix:
public boolean next() throws DAOException {
try {
if(result.hasMore()) {
logger.debug("LDAPResultSet::next() - has more");
currentResult = (SearchResult) result.next();
attrs = currentResult.getAttributes();
return true;
}
else {
currentResult = null;
attrs = null;
return false;
}
}
catch(PartialResultException ex) {
currentResult = null;
attrs = null;
return false;
}
catch(NamingException ex) {
throw new DAOException(ex);
}
}