com.unboundid.ldap.sdk
Class LDAPSearchException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.unboundid.util.LDAPSDKException
              extended by com.unboundid.ldap.sdk.LDAPException
                  extended by com.unboundid.ldap.sdk.LDAPSearchException
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class LDAPSearchException
extends LDAPException

This class defines an exception that can be thrown if a problem occurs while performing LDAP-related processing. It includes all of the elements of the SearchResult object, potentially including entries and references returned before the failure result.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.unboundid.ldap.sdk.LDAPException
NO_CONTROLS, NO_REFERRALS
 
Constructor Summary
LDAPSearchException(LDAPException ldapException)
          Creates a new LDAP search exception from the provided exception.
LDAPSearchException(ResultCode resultCode, java.lang.String errorMessage)
          Creates a new LDAP search exception with the provided information.
LDAPSearchException(ResultCode resultCode, java.lang.String errorMessage, java.lang.Throwable cause)
          Creates a new LDAP search exception with the provided information.
LDAPSearchException(SearchResult searchResult)
          Creates a new LDAP search exception with the provided result.
 
Method Summary
 int getEntryCount()
          Retrieves the number of matching entries returned for the search operation before this exception was thrown.
 int getReferenceCount()
          Retrieves the number of search references returned for the search operation before this exception was thrown.
 java.util.List<SearchResultEntry> getSearchEntries()
          Retrieves a list containing the matching entries returned from the search operation before this exception was thrown.
 java.util.List<SearchResultReference> getSearchReferences()
          Retrieves a list containing the search references returned from the search operation before this exception was thrown.
 SearchResult getSearchResult()
          Retrieves the search result object associated with this LDAP search exception.
 SearchResult toLDAPResult()
          Creates a new SearchResult object from this exception.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this LDAP exception to the provided buffer.
 
Methods inherited from class com.unboundid.ldap.sdk.LDAPException
getDiagnosticMessage, getExceptionMessage, getMatchedDN, getReferralURLs, getResponseControl, getResponseControls, getResultCode, getResultString, hasResponseControl, hasResponseControl
 
Methods inherited from class com.unboundid.util.LDAPSDKException
toString
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPSearchException

public LDAPSearchException(ResultCode resultCode,
                           java.lang.String errorMessage)
Creates a new LDAP search exception with the provided information.

Parameters:
resultCode - The result code for this LDAP search exception.
errorMessage - The error message for this LDAP search exception.

LDAPSearchException

public LDAPSearchException(ResultCode resultCode,
                           java.lang.String errorMessage,
                           java.lang.Throwable cause)
Creates a new LDAP search exception with the provided information.

Parameters:
resultCode - The result code for this LDAP search exception.
errorMessage - The error message for this LDAP search exception.
cause - The underlying exception that triggered this LDAP search exception.

LDAPSearchException

public LDAPSearchException(LDAPException ldapException)
Creates a new LDAP search exception from the provided exception.

Parameters:
ldapException - The LDAP exception with the information to include in this LDAP search exception.

LDAPSearchException

public LDAPSearchException(SearchResult searchResult)
Creates a new LDAP search exception with the provided result.

Parameters:
searchResult - The search result to use to create this LDAP search exception.
Method Detail

getSearchResult

public SearchResult getSearchResult()
Retrieves the search result object associated with this LDAP search exception.

Returns:
The search result object associated with this LDAP search exception.

getEntryCount

public int getEntryCount()
Retrieves the number of matching entries returned for the search operation before this exception was thrown.

Returns:
The number of matching entries returned for the search operation before this exception was thrown.

getReferenceCount

public int getReferenceCount()
Retrieves the number of search references returned for the search operation before this exception was thrown.

Returns:
The number of search references returned for the search operation before this exception was thrown.

getSearchEntries

public java.util.List<SearchResultEntry> getSearchEntries()
Retrieves a list containing the matching entries returned from the search operation before this exception was thrown. This will only be available if a SearchResultListener was not used during the search.

Returns:
A list containing the matching entries returned from the search operation before this exception was thrown, or null if a SearchResultListener was used during the search.

getSearchReferences

public java.util.List<SearchResultReference> getSearchReferences()
Retrieves a list containing the search references returned from the search operation before this exception was thrown. This will only be available if a SearchResultListener was not used during the search.

Returns:
A list containing the search references returned from the search operation before this exception was thrown, or null if a SearchResultListener was used during the search.

toLDAPResult

public SearchResult toLDAPResult()
Creates a new SearchResult object from this exception.

Overrides:
toLDAPResult in class LDAPException
Returns:
The SearchResult object created from this exception.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP exception to the provided buffer.

Overrides:
toString in class LDAPException
Parameters:
buffer - The buffer to which to append a string representation of this LDAP exception.