Source:
private Set<Identity> getIdentities(SearchResult result) { final Set<Identity> identities = new HashSet<>(); final Attribute memberOf = result.getAttributes().get(getConstantsConfig().getUserMemberAttribute()); logger.trace("ADConstants userMemberAttribute() " + getConstantsConfig().getUserMemberAttribute()); logger.trace("SearchResult memberOf attribute " + memberOf.toString()); if (!isType(result.getAttributes(), getConstantsConfig().getUserObjectClass())) { return identities; } Collection<Callable<Identity>> groupsToGet = new ArrayList<>(); LdapName userName; try { userName = new LdapName(result.getNameInNamespace()); } catch (InvalidNameException e) { getLogger().error("Got a result with an invalid ldap name.", e); throw new UserLoginFailureException(e); } Identity user = attributesToIdentity(userName); identities.add(user); if (memberOf != null) { for (int i = 0; i < memberOf.size(); i++) { final int finalI = i; groupsToGet.add(new Callable<Identity>() { @Override public Identity call() throws Exception { try { Identity identity; try { identity = getObject(memberOf.get(finalI).toString(), getConstantsConfig().getGroupScope()); } catch (ServiceContextRetrievalException | ServiceContextCreationException e){ logger.error("Ldap Failure during group retrieval: " + e.getMessage(), e); throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "LdapDown", e.getMessage(), null); } identities.add(identity); return identity; } catch (NamingException e) { logger.error("Failed to get a group", e); return null; } } }); } } try { executorService.invokeAll(groupsToGet); } catch (InterruptedException e) { logger.error("Interrupted when getting groups from ldap.", e); throw new RuntimeException(e); } return identities; }

Target:
private Set<Identity> getIdentities(SearchResult result) { final Set<Identity> identities = new HashSet<>(); final Attribute memberOf = result.getAttributes().get(getConstantsConfig().getUserMemberAttribute()); logger.trace("ADConstants userMemberAttribute() {}", getConstantsConfig().getUserMemberAttribute()); logger.trace("SearchResult memberOf attribute {}", memberOf); if (!isType(result.getAttributes(), getConstantsConfig().getUserObjectClass())) { return identities; } Collection<Callable<Identity>> groupsToGet = new ArrayList<>(); LdapName userName; try { userName = new LdapName(result.getNameInNamespace()); } catch (InvalidNameException e) { getLogger().error("Got a result with an invalid ldap name.", e); throw new UserLoginFailureException(e); } Identity user = attributesToIdentity(userName); identities.add(user); if (memberOf != null) { for (int i = 0; i < memberOf.size(); i++) { final int finalI = i; groupsToGet.add(new Callable<Identity>() { @Override public Identity call() throws Exception { try { Identity identity; try { identity = getObject(memberOf.get(finalI).toString(), getConstantsConfig().getGroupScope()); } catch (ServiceContextRetrievalException | ServiceContextCreationException e){ logger.error("Ldap Failure during group retrieval: " + e.getMessage(), e); throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "LdapDown", e.getMessage(), null); } identities.add(identity); return identity; } catch (NamingException e) { logger.error("Failed to get a group", e); return null; } } }); } } try { executorService.invokeAll(groupsToGet); } catch (InterruptedException e) { logger.error("Interrupted when getting groups from ldap.", e); throw new RuntimeException(e); } return identities; }