Menu

#4 LDAPResultSet boolean next() fix

open
nobody
None
5
2008-02-29
2008-02-29
trames
No

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);
}
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.