SearchResultEntry matchingEntry = null;
InternalClientConnection conn =
InternalClientConnection.getRootConnection();
for (DN baseDN : baseDNs)
{
InternalSearchOperation internalSearch =
conn.processSearch(baseDN, SearchScope.WHOLE_SUBTREE,
DereferencePolicy.NEVER_DEREF_ALIASES, 1, 10,
false, filter, requestedAttributes);
switch (internalSearch.getResultCode())
{
case SUCCESS:
// This is fine. No action needed.
break;
case NO_SUCH_OBJECT:
// The search base doesn't exist. Not an ideal situation, but we'll
// ignore it.
break;
case SIZE_LIMIT_EXCEEDED:
// Multiple entries matched the filter. This is not acceptable.
Message message =
ERR_EXACTMAP_MULTIPLE_MATCHING_ENTRIES.get(String.valueOf(id));
throw new DirectoryException(
ResultCode.CONSTRAINT_VIOLATION, message);
case TIME_LIMIT_EXCEEDED:
case ADMIN_LIMIT_EXCEEDED:
// The search criteria was too inefficient.
message = ERR_EXACTMAP_INEFFICIENT_SEARCH.
get(String.valueOf(id),
String.valueOf(internalSearch.getErrorMessage()));
throw new DirectoryException(internalSearch.getResultCode(), message);
default:
// Just pass on the failure that was returned for this search.
message = ERR_EXACTMAP_SEARCH_FAILED.
get(String.valueOf(id),
String.valueOf(internalSearch.getErrorMessage()));
throw new DirectoryException(internalSearch.getResultCode(), message);
}
LinkedList<SearchResultEntry> searchEntries =
internalSearch.getSearchEntries();
if ((searchEntries != null) && (! searchEntries.isEmpty()))
{
if (matchingEntry == null)
{
Iterator<SearchResultEntry> iterator = searchEntries.iterator();