in ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ResultCodeEnum.java [1975:2220]
public static boolean processResponse( ResultResponse response ) throws LdapException
{
LdapResult ldapResult = response.getLdapResult();
switch ( ldapResult.getResultCode() )
{
// Not erroneous code
case SUCCESS:
case PARTIAL_RESULTS:
case REFERRAL:
case SASL_BIND_IN_PROGRESS:
case CANCELED:
case COMPARE_TRUE:
return true;
case COMPARE_FALSE:
return false;
case INVALID_CREDENTIALS:
LdapAuthenticationException authenticationException = new LdapAuthenticationException(
ldapResult.getDiagnosticMessage() );
authenticationException.setResolvedDn( ldapResult.getMatchedDn() );
throw authenticationException;
case UNWILLING_TO_PERFORM:
case UNAVAILABLE_CRITICAL_EXTENSION:
LdapUnwillingToPerformException unwillingToPerformException =
new LdapUnwillingToPerformException( ldapResult.getResultCode(), ldapResult.getDiagnosticMessage() );
unwillingToPerformException.setResolvedDn( ldapResult.getMatchedDn() );
throw unwillingToPerformException;
case INSUFFICIENT_ACCESS_RIGHTS:
LdapNoPermissionException ldapNoPermissionException = new LdapNoPermissionException(
ldapResult.getDiagnosticMessage() );
ldapNoPermissionException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapNoPermissionException;
case NOT_ALLOWED_ON_NON_LEAF:
LdapContextNotEmptyException ldapContextNotEmptyException = new LdapContextNotEmptyException(
ldapResult.getDiagnosticMessage() );
ldapContextNotEmptyException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapContextNotEmptyException;
case NO_SUCH_OBJECT:
LdapNoSuchObjectException ldapNoSuchObjectException = new LdapNoSuchObjectException(
ldapResult.getDiagnosticMessage() );
ldapNoSuchObjectException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapNoSuchObjectException;
case NO_SUCH_ATTRIBUTE:
LdapNoSuchAttributeException ldapNoSuchAttributeException = new LdapNoSuchAttributeException(
ldapResult.getDiagnosticMessage() );
ldapNoSuchAttributeException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapNoSuchAttributeException;
case ATTRIBUTE_OR_VALUE_EXISTS:
LdapAttributeInUseException ldapAttributeInUseException = new LdapAttributeInUseException(
ldapResult.getDiagnosticMessage() );
ldapAttributeInUseException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAttributeInUseException;
case ENTRY_ALREADY_EXISTS:
LdapEntryAlreadyExistsException ldapEntryAlreadyExistsException = new LdapEntryAlreadyExistsException(
ldapResult.getDiagnosticMessage() );
ldapEntryAlreadyExistsException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapEntryAlreadyExistsException;
case OBJECT_CLASS_VIOLATION:
case NOT_ALLOWED_ON_RDN:
case OBJECT_CLASS_MODS_PROHIBITED:
LdapSchemaViolationException ldapSchemaViolationException =
new LdapSchemaViolationException( ldapResult.getResultCode(), ldapResult.getDiagnosticMessage() );
ldapSchemaViolationException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapSchemaViolationException;
case ALIAS_PROBLEM:
LdapAliasException ldapAliasException = new LdapAliasException( ldapResult.getDiagnosticMessage() );
ldapAliasException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAliasException;
case AFFECTS_MULTIPLE_DSAS:
LdapAffectMultipleDsaException ldapAffectMultipleDsaException = new LdapAffectMultipleDsaException(
ldapResult.getDiagnosticMessage() );
ldapAffectMultipleDsaException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAffectMultipleDsaException;
case ALIAS_DEREFERENCING_PROBLEM:
LdapAliasDereferencingException ldapAliasDereferencingException = new LdapAliasDereferencingException(
ldapResult.getDiagnosticMessage() );
ldapAliasDereferencingException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAliasDereferencingException;
case AUTH_METHOD_NOT_SUPPORTED:
case INAPPROPRIATE_AUTHENTICATION:
case CONFIDENTIALITY_REQUIRED:
LdapAuthenticationNotSupportedException ldapAuthenticationNotSupportedException =
new LdapAuthenticationNotSupportedException( ldapResult.getResultCode(),
ldapResult.getDiagnosticMessage() );
ldapAuthenticationNotSupportedException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAuthenticationNotSupportedException;
case BUSY:
case UNAVAILABLE:
LdapServiceUnavailableException ldapServiceUnavailableException =
new LdapServiceUnavailableException( ldapResult.getResultCode(), ldapResult.getDiagnosticMessage() );
ldapServiceUnavailableException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapServiceUnavailableException;
case CONSTRAINT_VIOLATION:
case INVALID_ATTRIBUTE_SYNTAX:
LdapInvalidAttributeValueException ldapInvalidAttributeValueException =
new LdapInvalidAttributeValueException( ldapResult.getResultCode(),
ldapResult.getDiagnosticMessage() );
ldapInvalidAttributeValueException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapInvalidAttributeValueException;
case INAPPROPRIATE_MATCHING:
LdapInvalidSearchFilterException ldapInvalidSearchFilterException = new LdapInvalidSearchFilterException(
ldapResult.getDiagnosticMessage() );
ldapInvalidSearchFilterException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapInvalidSearchFilterException;
case INVALID_DN_SYNTAX:
case NAMING_VIOLATION:
LdapInvalidDnException ldapInvalidDnException =
new LdapInvalidDnException( ldapResult.getResultCode(), ldapResult.getDiagnosticMessage() );
ldapInvalidDnException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapInvalidDnException;
case LOOP_DETECT:
LdapLoopDetectedException ldapLoopDetectedException = new LdapLoopDetectedException(
ldapResult.getDiagnosticMessage() );
ldapLoopDetectedException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapLoopDetectedException;
case OPERATIONS_ERROR:
LdapOperationErrorException ldapOperationErrorException = new LdapOperationErrorException(
ldapResult.getDiagnosticMessage() );
ldapOperationErrorException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapOperationErrorException;
case PROTOCOL_ERROR:
LdapProtocolErrorException ldapProtocolErrorException = new LdapProtocolErrorException(
ldapResult.getDiagnosticMessage() );
ldapProtocolErrorException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapProtocolErrorException;
case TIME_LIMIT_EXCEEDED:
LdapTimeLimitExceededException ldapTimeLimitExceededException = new LdapTimeLimitExceededException(
ldapResult.getDiagnosticMessage() );
ldapTimeLimitExceededException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapTimeLimitExceededException;
case UNDEFINED_ATTRIBUTE_TYPE:
LdapInvalidAttributeTypeException ldapInvalidAttributeTypeException = new LdapInvalidAttributeTypeException(
ldapResult.getDiagnosticMessage() );
ldapInvalidAttributeTypeException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapInvalidAttributeTypeException;
case OTHER:
LdapOtherException ldapOtherException = new LdapOtherException( ldapResult.getDiagnosticMessage() );
ldapOtherException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapOtherException;
case SIZE_LIMIT_EXCEEDED:
LdapSizeLimitExceededException ldapSizeLimitExceededException = new LdapSizeLimitExceededException(
ldapResult.getDiagnosticMessage() );
ldapSizeLimitExceededException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapSizeLimitExceededException;
case STRONG_AUTH_REQUIRED:
LdapStrongAuthenticationRequiredException ldapStrongAuthenticationRequiredException =
new LdapStrongAuthenticationRequiredException( ldapResult.getDiagnosticMessage() );
ldapStrongAuthenticationRequiredException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapStrongAuthenticationRequiredException;
case ADMIN_LIMIT_EXCEEDED:
LdapAdminLimitExceededException ldapAdminLimitExceededException =
new LdapAdminLimitExceededException( ldapResult.getDiagnosticMessage() );
ldapAdminLimitExceededException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapAdminLimitExceededException;
case TOO_LATE:
LdapTooLateException ldapTooLateException = new LdapTooLateException( ldapResult.getDiagnosticMessage() );
ldapTooLateException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapTooLateException;
case UNKNOWN:
LdapUnknownException ldapUnknownException = new LdapUnknownException( ldapResult.getDiagnosticMessage() );
ldapUnknownException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapUnknownException;
case CANNOT_CANCEL:
LdapCannotCancelException ldapCannotCancelException = new LdapCannotCancelException(
ldapResult.getDiagnosticMessage() );
ldapCannotCancelException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapCannotCancelException;
case NO_SUCH_OPERATION:
LdapNoSuchOperationException ldapNoSuchOperationException = new LdapNoSuchOperationException(
ldapResult.getDiagnosticMessage() );
ldapNoSuchOperationException.setResolvedDn( ldapResult.getMatchedDn() );
throw ldapNoSuchOperationException;
case E_SYNC_REFRESH_REQUIRED:
// This is a specific error message. We won't encapsulate it in a dedicated exception
// Fallthrough
default:
LdapOperationException exception = new LdapOperationException( ldapResult.getResultCode(),
ldapResult.getDiagnosticMessage() );
exception.setResolvedDn( ldapResult.getMatchedDn() );
throw exception;
}
}