Source:
public Map<String, String> getSecurityQuestions(final String username) { val results = new HashMap<String, String>(0); this.ldapProperties .stream() .sorted(Comparator.comparing(LdapPasswordManagementProperties::getName)) .forEach(Unchecked.consumer(ldap -> { val filter = LdapUtils.newLdaptiveSearchFilter(ldap.getSearchFilter(), LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(username)); LOGGER.debug("Constructed LDAP filter to locate security questions", filter); val ldapConnectionFactory = this.connectionFactoryMap.get(ldap); val response = LdapUtils.executeSearchOperation(ldapConnectionFactory, ldap.getBaseDn(), filter, ldap.getPageSize()); LOGGER.debug("LDAP response for security questions [{}]", response); if (LdapUtils.containsResultEntry(response)) { val entry = response.getEntry(); LOGGER.debug("Located LDAP entry in the response", entry); val questionsAndAnswers = ldap.getSecurityQuestionsAttributes(); LOGGER.debug("Security question attributes are defined to be [{}]", questionsAndAnswers); questionsAndAnswers.forEach((k, v) -> { val questionAttribute = entry.getAttribute(k); val answerAttribute = entry.getAttribute(v); if (questionAttribute != null && answerAttribute != null) { val question = questionAttribute.getStringValue(); val answer = answerAttribute.getStringValue(); if (StringUtils.isNotBlank(question) && StringUtils.isNotBlank(answer)) { LOGGER.debug("Added security question with answer [{}]", question, answer); results.put(question, answer); } } }); } LOGGER.debug("LDAP response did not contain a result for security questions"); })); return results; }

Target:
public Map<String, String> getSecurityQuestions(final String username) { val results = new HashMap<String, String>(0); this.ldapProperties .stream() .sorted(Comparator.comparing(LdapPasswordManagementProperties::getName)) .forEach(Unchecked.consumer(ldap -> { val filter = LdapUtils.newLdaptiveSearchFilter(ldap.getSearchFilter(), LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(username)); LOGGER.debug("Constructed LDAP filter to locate security questions", filter); val ldapConnectionFactory = this.connectionFactoryMap.get(ldap.getLdapUrl()); val response = LdapUtils.executeSearchOperation(ldapConnectionFactory, ldap.getBaseDn(), filter, ldap.getPageSize()); LOGGER.debug("LDAP response for security questions [{}]", response); if (LdapUtils.containsResultEntry(response)) { val entry = response.getEntry(); LOGGER.debug("Located LDAP entry in the response", entry); val questionsAndAnswers = ldap.getSecurityQuestionsAttributes(); LOGGER.debug("Security question attributes are defined to be [{}]", questionsAndAnswers); questionsAndAnswers.forEach((k, v) -> { val questionAttribute = entry.getAttribute(k); val answerAttribute = entry.getAttribute(v); if (questionAttribute != null && answerAttribute != null) { val question = questionAttribute.getStringValue(); val answer = answerAttribute.getStringValue(); if (StringUtils.isNotBlank(question) && StringUtils.isNotBlank(answer)) { LOGGER.debug("Added security question with answer [{}]", question, answer); results.put(question, answer); } } }); } LOGGER.debug("LDAP response did not contain a result for security questions"); })); return results; }