public SecurityChallenge getDefaultSecurityChallenge(String username) { for (LdapServer ldapServer : ldapServers) { try { SecurityChallenge challenge = ldapServer.getDefaultSecurityChallenge(username); if (logger.isDebugEnabled()) { if (challenge != null) { logger.debug( "Successfully got default security challenge for " + username + " at " + ldapServer.getDescription()); } else { logger.debug( "Got null default security challenge for " + username + " at " + ldapServer.getDescription()); } } return challenge; } catch (NameNotFoundException ex) { logger.debug("Didn't find " + username + " in " + ldapServer.getDescription()); // ignore... we'll try another server } catch (ObjectRetrievalException ex) { logger.debug("Multiple results found for " + username); // ignore it... try the next server } } logger.debug("Couldn't find default security questions for " + username); throw new NameNotFoundException( "Couldn't find username " + username + " in any of provided servers."); }