Package com.unboundid.ldap.sdk
Class LDAPException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.unboundid.util.LDAPSDKException
com.unboundid.ldap.sdk.LDAPException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LDAPBindException,LDAPExtendedOperationException,LDAPPersistException,LDAPSearchException
@NotExtensible
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public class LDAPException
extends LDAPSDKException
This class defines an exception that can be thrown if a problem occurs while
performing LDAP-related processing. An LDAP exception can include all of
the elements of an
LDAPResult, so that all of the response elements
will be available.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new LDAP exception using the information contained in the provided LDAP exception.LDAPException(LDAPResult ldapResult) Creates a new LDAP exception using the information contained in the provided LDAP result object.LDAPException(LDAPResult ldapResult, Throwable cause) Creates a new LDAP exception using the information contained in the provided LDAP result object.LDAPException(ResultCode resultCode) Creates a new LDAP exception with the provided result code.LDAPException(ResultCode resultCode, String errorMessage) Creates a new LDAP exception with the provided result code and message.LDAPException(ResultCode resultCode, String errorMessage, String matchedDN, String[] referralURLs) Creates a new LDAP exception with the provided information.LDAPException(ResultCode resultCode, String errorMessage, String matchedDN, String[] referralURLs, Control[] controls) Creates a new LDAP exception with the provided information.LDAPException(ResultCode resultCode, String errorMessage, String matchedDN, String[] referralURLs, Control[] controls, Throwable cause) Creates a new LDAP exception with the provided information.LDAPException(ResultCode resultCode, String errorMessage, String matchedDN, String[] referralURLs, Throwable cause) Creates a new LDAP exception with the provided information.LDAPException(ResultCode resultCode, String errorMessage, Throwable cause) Creates a new LDAP exception with the provided result code and message.LDAPException(ResultCode resultCode, Throwable cause) Creates a new LDAP exception with the provided result code. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringRetrieves the diagnostic message returned by the directory server.final StringRetrieves a string representation of this exception suitable for use in messages.final StringgetExceptionMessage(boolean includeCause, boolean includeStackTrace) Retrieves a string representation of this exception suitable for use in messages.final StringRetrieves the matched DN for this LDAP exception.final String[]Retrieves the set of referral URLs for this LDAP exception.final ControlgetResponseControl(String oid) Retrieves the response control with the specified OID.final Control[]Retrieves the set of response controls for this LDAP exception.final ResultCodeRetrieves the result code for this LDAP exception.Retrieves a string representation of this LDAP result, consisting of the result code, diagnostic message (if present), matched DN (if present), and referral URLs (if present).final booleanIndicates whether this result contains at least one control.final booleanhasResponseControl(String oid) Indicates whether this result contains at least one control with the specified OID.Creates a newLDAPResultobject from this exception.voidtoString(StringBuilder buffer) Appends a string representation of this exception to the provided buffer.voidtoString(StringBuilder buffer, boolean includeCause, boolean includeStackTrace) Appends a string representation of thisLDAPExceptionto the provided buffer.Methods inherited from class com.unboundid.util.LDAPSDKException
toStringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
NO_CONTROLS
An empty array that will be used when no controls were provided. -
NO_REFERRALS
An empty array that will be used when no referrals were provided.
-
-
Constructor Details
-
LDAPException
Creates a new LDAP exception with the provided result code. A default message (based on the result code) will be used.- Parameters:
resultCode- The result code for this LDAP exception.
-
LDAPException
Creates a new LDAP exception with the provided result code. A default message (based on the result code) will be used.- Parameters:
resultCode- The result code for this LDAP exception.cause- The underlying exception that triggered this exception.
-
LDAPException
Creates a new LDAP exception with the provided result code and message.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.
-
LDAPException
public LDAPException(@NotNull ResultCode resultCode, @NotNull String errorMessage, @Nullable Throwable cause) Creates a new LDAP exception with the provided result code and message.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.cause- The underlying exception that triggered this exception.
-
LDAPException
public LDAPException(@NotNull ResultCode resultCode, @NotNull String errorMessage, @Nullable String matchedDN, @Nullable String[] referralURLs) Creates a new LDAP exception with the provided information.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.matchedDN- The matched DN for this LDAP exception.referralURLs- The set of referral URLs for this LDAP exception.
-
LDAPException
public LDAPException(@NotNull ResultCode resultCode, @NotNull String errorMessage, @Nullable String matchedDN, @Nullable String[] referralURLs, @Nullable Throwable cause) Creates a new LDAP exception with the provided information.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.matchedDN- The matched DN for this LDAP exception.referralURLs- The set of referral URLs for this LDAP exception.cause- The underlying exception that triggered this exception.
-
LDAPException
public LDAPException(@NotNull ResultCode resultCode, @NotNull String errorMessage, @Nullable String matchedDN, @Nullable String[] referralURLs, @Nullable Control[] controls) Creates a new LDAP exception with the provided information.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.matchedDN- The matched DN for this LDAP exception.referralURLs- The set of referral URLs for this LDAP exception.controls- The set of response controls for this LDAP exception.
-
LDAPException
public LDAPException(@NotNull ResultCode resultCode, @NotNull String errorMessage, @Nullable String matchedDN, @Nullable String[] referralURLs, @Nullable Control[] controls, @Nullable Throwable cause) Creates a new LDAP exception with the provided information.- Parameters:
resultCode- The result code for this LDAP exception.errorMessage- The error message for this LDAP exception.matchedDN- The matched DN for this LDAP exception.referralURLs- The set of referral URLs for this LDAP exception.controls- The set of response controls for this LDAP exception.cause- The underlying exception that triggered this exception.
-
LDAPException
Creates a new LDAP exception using the information contained in the provided LDAP result object.- Parameters:
ldapResult- The LDAP result object containing the information to use for this LDAP exception.
-
LDAPException
Creates a new LDAP exception using the information contained in the provided LDAP result object.- Parameters:
ldapResult- The LDAP result object containing the information to use for this LDAP exception.cause- The underlying exception that triggered this exception.
-
LDAPException
Creates a new LDAP exception using the information contained in the provided LDAP exception.- Parameters:
e- The LDAP exception to use to create this exception.
-
-
Method Details
-
getResultCode
Retrieves the result code for this LDAP exception.- Returns:
- The result code for this LDAP exception.
-
getMatchedDN
Retrieves the matched DN for this LDAP exception.- Returns:
- The matched DN for this LDAP exception, or
nullif there is none.
-
getDiagnosticMessage
Retrieves the diagnostic message returned by the directory server.- Returns:
- The diagnostic message returned by the directory server, or
nullif there is none.
-
getReferralURLs
Retrieves the set of referral URLs for this LDAP exception.- Returns:
- The set of referral URLs for this LDAP exception, or an empty array if there are none.
-
hasResponseControl
Indicates whether this result contains at least one control.- Returns:
trueif this result contains at least one control, orfalseif not.
-
hasResponseControl
Indicates whether this result contains at least one control with the specified OID.- Parameters:
oid- The object identifier for which to make the determination. It must not benull.- Returns:
trueif this result contains at least one control with the specified OID, orfalseif not.
-
getResponseControls
Retrieves the set of response controls for this LDAP exception. Individual response controls of a specific type may be retrieved and decoded using thegetmethod in the response control class, using thetoLDAPResult()method to convert this exception to anLDAPResult.- Returns:
- The set of response controls for this LDAP exception, or an empty array if there are none.
-
getResponseControl
Retrieves the response control with the specified OID.- Parameters:
oid- The OID of the control to retrieve.- Returns:
- The response control with the specified OID, or
nullif there is no such control.
-
toLDAPResult
Creates a newLDAPResultobject from this exception.- Returns:
- The
LDAPResultobject created from this exception.
-
getResultString
Retrieves a string representation of this LDAP result, consisting of the result code, diagnostic message (if present), matched DN (if present), and referral URLs (if present).- Returns:
- A string representation of this LDAP result.
-
toString
Appends a string representation of this exception to the provided buffer.- Overrides:
toStringin classLDAPSDKException- Parameters:
buffer- The buffer to which the string representation of this exception is to be appended.
-
toString
public void toString(@NotNull StringBuilder buffer, boolean includeCause, boolean includeStackTrace) Appends a string representation of thisLDAPExceptionto the provided buffer.- Parameters:
buffer- The buffer to which the information should be appended. This must not benull.includeCause- Indicates whether to include information about the cause (if any) in the exception message.includeStackTrace- Indicates whether to include a condensed representation of the stack trace in the exception message. If a stack trace is included, then the cause (if any) will automatically be included, regardless of the value of theincludeCauseargument.
-
getExceptionMessage
Retrieves a string representation of this exception suitable for use in messages.- Overrides:
getExceptionMessagein classLDAPSDKException- Returns:
- A string representation of this exception suitable for use in messages.
-
getExceptionMessage
Retrieves a string representation of this exception suitable for use in messages.- Overrides:
getExceptionMessagein classLDAPSDKException- Parameters:
includeCause- Indicates whether to include information about the cause (if any) in the exception message.includeStackTrace- Indicates whether to include a condensed representation of the stack trace in the exception message.- Returns:
- A string representation of this exception suitable for use in messages.
-