use of org.forgerock.opendj.ldap.SearchResultReferenceIOException in project admin-console-beta by connexta.
the class ServerGuesser method getBaseContexts.
public List<String> getBaseContexts() {
try {
ConnectionEntryReader reader = connection.search("", SearchScope.BASE_OBJECT, "(objectClass=*)", "namingContexts");
ArrayList<String> contexts = new ArrayList<>();
while (reader.hasNext()) {
SearchResultEntry entry = reader.readEntry();
if (entry.containsAttribute("namingContexts")) {
contexts.add(entry.getAttribute("namingContexts").firstValueAsString());
}
}
if (contexts.isEmpty()) {
contexts.add("");
}
return contexts;
} catch (LdapException | SearchResultReferenceIOException e) {
LOGGER.debug("Error getting baseContext", e);
return Collections.singletonList("");
}
}
Aggregations