Package org.forgerock.opendj.ldap
Class LdapException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.forgerock.opendj.ldap.LdapException
- All Implemented Interfaces:
Serializable,LocalizableException
- Direct Known Subclasses:
AssertionFailureException,AuthenticationException,AuthorizationException,CancelledResultException,ConnectionException,ConstraintViolationException,EntryNotFoundException,MultipleEntriesFoundException,TimeoutResultException
Thrown when the result code returned in a Result indicates that the Request
was unsuccessful. This class can be sub-classed in order to implement
application specific exceptions.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLdapException(Result result) Creates a new LDAP exception using the provided result. -
Method Summary
Modifier and TypeMethodDescriptionstatic LdapExceptionconstraintViolation(CharSequence message) Returns a newLdapExceptionwith theCONSTRAINT_VIOLATIONerror code using the provided message.static LdapExceptionconstraintViolation(CharSequence message, Throwable cause) Returns a newLdapExceptionwith theCONSTRAINT_VIOLATIONerror code using the provided message.final ThrowablePrevent costly stack traces from being created because they are not useful for this type of exception.final Stringfinal LocalizableMessageReturns the localizable message that explains the problem that occurred.final ResultReturns the error result which caused this exception to be thrown.final ResultCodeReturns the result code associated with this result.static LdapExceptionReturns a newLdapExceptionwith theINVALID_CREDENTIALSerror code with no message.static LdapExceptioninvalidCredentials(CharSequence message) Returns a newLdapExceptionwith theINVALID_CREDENTIALSerror code using the provided message.static LdapExceptionnewLdapClientException(Throwable cause) Creates a new LDAP client exception with the provided cause and a result code depending on the class cause originalcause.static LdapExceptionnewLdapException(Throwable cause) Creates a new LDAP exception with the provided cause and a result code depending on the class cause originalcause.static LdapExceptionnewLdapException(Result result) Creates a new LDAP exception using the provided result.static LdapExceptionnewLdapException(ResultCode resultCode) Creates a new LDAP exception with the provided result code and an empty diagnostic message.static LdapExceptionnewLdapException(ResultCode resultCode, CharSequence diagnosticMessage) Creates a new LDAP exception with the provided result code and diagnostic message.static LdapExceptionnewLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Throwable cause) Creates a new LDAP exception with the provided result code, diagnostic message, and cause.static LdapExceptionnewLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Dn matchedDn) Creates a new LDAP exception with the provided resultCode, diagnosticMessage, matched DN and cause.static LdapExceptionnewLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Dn matchedDn, Throwable cause) Creates a new LDAP exception with the provided resultCode, diagnosticMessage, matched DN and cause.static LdapExceptionnewLdapException(ResultCode resultCode, Throwable cause) Creates a new LDAP exception with the provided result code and cause.static LdapExceptionReturns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.static LdapExceptionnoSuchObject(CharSequence message) Returns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.static LdapExceptionnoSuchObject(CharSequence message, Dn matchedDn) Returns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.static LdapExceptionprotocolError(CharSequence message) Returns a newLdapExceptionwith thePROTOCOL_ERRORerror code using the provided message.static LdapExceptionprotocolError(Throwable cause) Returns a newLdapExceptionwith thePROTOCOL_ERRORerror code using the provided message.final StringtoString()static LdapExceptionunwillingToPerform(CharSequence message) Returns a newLdapExceptionwith theUNWILLING_TO_PERFORMerror code using the provided message.Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
LdapException
Creates a new LDAP exception using the provided result.- Parameters:
result- The error result.
-
-
Method Details
-
invalidCredentials
Returns a newLdapExceptionwith theINVALID_CREDENTIALSerror code with no message.- Returns:
- a new
LdapException
-
invalidCredentials
Returns a newLdapExceptionwith theINVALID_CREDENTIALSerror code using the provided message.- Parameters:
message- the error message to use- Returns:
- a new
LdapException
-
constraintViolation
Returns a newLdapExceptionwith theCONSTRAINT_VIOLATIONerror code using the provided message.- Parameters:
message- the error message to use- Returns:
- a new
LdapException
-
constraintViolation
Returns a newLdapExceptionwith theCONSTRAINT_VIOLATIONerror code using the provided message.- Parameters:
message- the error message to usecause- the cause of the exception- Returns:
- a new
LdapException
-
noSuchObject
Returns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.- Returns:
- a new
LdapException
-
noSuchObject
Returns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.- Parameters:
message- the error message to use- Returns:
- a new
LdapException
-
noSuchObject
Returns a newLdapExceptionwith theNO_SUCH_OBJECTerror code using the provided message.- Parameters:
message- the error message to usematchedDn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- a new
LdapException
-
protocolError
Returns a newLdapExceptionwith thePROTOCOL_ERRORerror code using the provided message.- Parameters:
message- the error message to use- Returns:
- a new
LdapException
-
protocolError
Returns a newLdapExceptionwith thePROTOCOL_ERRORerror code using the provided message.- Parameters:
cause- the cause of the exception- Returns:
- a new
LdapException
-
unwillingToPerform
Returns a newLdapExceptionwith theUNWILLING_TO_PERFORMerror code using the provided message.- Parameters:
message- the error message to use- Returns:
- a new
LdapException
-
newLdapException
Creates a new LDAP exception with the provided result code and an empty diagnostic message.- Parameters:
resultCode- The result code.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
Creates a new LDAP exception with the provided result code and diagnostic message.- Parameters:
resultCode- The result code.diagnosticMessage- The diagnostic message, which may be empty ornullindicating that none was provided.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
Creates a new LDAP exception with the provided result code and cause. The diagnostic message will be taken from the cause, if provided.- Parameters:
resultCode- The result code.cause- The throwable cause, which may benullindicating that none was provided.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
public static LdapException newLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Throwable cause) Creates a new LDAP exception with the provided result code, diagnostic message, and cause.- Parameters:
resultCode- The result code.diagnosticMessage- The diagnostic message, which may be empty ornullindicating that none was provided.cause- The throwable cause, which may benullindicating that none was provided.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
public static LdapException newLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Dn matchedDn) Creates a new LDAP exception with the provided resultCode, diagnosticMessage, matched DN and cause.- Parameters:
resultCode- The result code.diagnosticMessage- The diagnostic message, which may be empty ornull.matchedDn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
public static LdapException newLdapException(ResultCode resultCode, CharSequence diagnosticMessage, Dn matchedDn, Throwable cause) Creates a new LDAP exception with the provided resultCode, diagnosticMessage, matched DN and cause.- Parameters:
resultCode- The result code.diagnosticMessage- The diagnostic message, which may be empty ornull.matchedDn- The matched DN associated, which may be empty ornullindicating that none was provided.cause- The throwable cause, which may benullindicating that none was provided.- Returns:
- The new LDAP exception.
- Throws:
IllegalArgumentException- If the provided result code does not represent a failure.NullPointerException- IfresultCodewasnull.
-
newLdapException
Creates a new LDAP exception with the provided cause and a result code depending on the class cause originalcause. If no cause is provided, or there is no specific result code defined for the cause,ResultCode.OTHERwill be used.- Parameters:
cause- The throwable cause, may be {code null}.- Returns:
- The new LDAP exception
-
newLdapClientException
Creates a new LDAP client exception with the provided cause and a result code depending on the class cause originalcause. If no cause is provided, or there is no specific result code defined for the cause,ResultCode.CLIENT_SIDE_LOCAL_ERRORwill be used.- Parameters:
cause- The throwable cause, may be {code null}.- Returns:
- The new LDAP exception
-
newLdapException
Creates a new LDAP exception using the provided result.- Parameters:
result- The result whose result code indicates a failure.- Returns:
- The LDAP exception wrapping the provided result.
- Throws:
IllegalArgumentException- If the provided result does not represent a failure.NullPointerException- Ifresultwasnull.
-
fillInStackTrace
Prevent costly stack traces from being created because they are not useful for this type of exception.- Overrides:
fillInStackTracein classThrowable
-
getResult
Returns the error result which caused this exception to be thrown. The type of result returned corresponds to the expected result type of the original request.- Returns:
- The error result which caused this exception to be thrown.
-
getResultCode
Returns the result code associated with this result.- Returns:
- The result code.
-
getMessageObject
Description copied from interface:LocalizableExceptionReturns the localizable message that explains the problem that occurred.- Specified by:
getMessageObjectin interfaceLocalizableException- Returns:
- The localizable message that explains the problem that occurred.
-
getMessage
- Overrides:
getMessagein classThrowable
-
toString
-