question: public static NamingException mapErrorCode ( int errorCode , String errorMessage ) { if ( errorCode == LdapClient . LDAP_SUCCESS ) return null ; NamingException e = null ; String message = LdapClient . getErrorMessage ( errorCode , errorMessage ) ; switch ( errorCode ) { case LdapClient . LDAP_ALIAS_DEREFERENCING_PROBLEM : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_ALIAS_PROBLEM : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_ATTRIBUTE_OR_VALUE_EXISTS : e = new AttributeInUseException ( message ) ; break ; case LdapClient . LDAP_AUTH_METHOD_NOT_SUPPORTED : case LdapClient . LDAP_CONFIDENTIALITY_REQUIRED : case LdapClient . LDAP_STRONG_AUTH_REQUIRED : case LdapClient . LDAP_INAPPROPRIATE_AUTHENTICATION : e = new AuthenticationNotSupportedException ( message ) ; break ; case LdapClient . LDAP_ENTRY_ALREADY_EXISTS : e = new NameAlreadyBoundException ( message ) ; break ; case LdapClient . LDAP_INVALID_CREDENTIALS : case LdapClient . LDAP_SASL_BIND_IN_PROGRESS : e = new AuthenticationException ( message ) ; break ; case LdapClient . LDAP_INAPPROPRIATE_MATCHING : e = new InvalidSearchFilterException ( message ) ; break ; case LdapClient . LDAP_INSUFFICIENT_ACCESS_RIGHTS : e = new NoPermissionException ( message ) ; break ; case LdapClient . LDAP_INVALID_ATTRIBUTE_SYNTAX : case LdapClient . LDAP_CONSTRAINT_VIOLATION : e = new InvalidAttributeValueException ( message ) ; break ; case LdapClient . LDAP_LOOP_DETECT : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_NO_SUCH_ATTRIBUTE : e = new NoSuchAttributeException ( message ) ; break ; case LdapClient . LDAP_NO_SUCH_OBJECT : e = new NameNotFoundException ( message ) ; break ; case LdapClient . LDAP_OBJECT_CLASS_MODS_PROHIBITED : case LdapClient . LDAP_OBJECT_CLASS_VIOLATION : case LdapClient . LDAP_NOT_ALLOWED_ON_RDN : e = new SchemaViolationException ( message ) ; break ; case LdapClient . LDAP_NOT_ALLOWED_ON_NON_LEAF : e = new ContextNotEmptyException ( message ) ; break ; case LdapClient . LDAP_OPERATIONS_ERROR : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_OTHER : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_PROTOCOL_ERROR : e = new CommunicationException ( message ) ; break ; case LdapClient . LDAP_SIZE_LIMIT_EXCEEDED : e = new SizeLimitExceededException ( message ) ; break ; case LdapClient . LDAP_TIME_LIMIT_EXCEEDED : e = new TimeLimitExceededException ( message ) ; break ; case LdapClient . LDAP_UNAVAILABLE_CRITICAL_EXTENSION : e = new OperationNotSupportedException ( message ) ; break ; case LdapClient . LDAP_UNAVAILABLE : case LdapClient . LDAP_BUSY : e = new ServiceUnavailableException ( message ) ; break ; case LdapClient . LDAP_UNDEFINED_ATTRIBUTE_TYPE : e = new InvalidAttributeIdentifierException ( message ) ; break ; case LdapClient . LDAP_UNWILLING_TO_PERFORM : e = new OperationNotSupportedException ( message ) ; break ; case LdapClient . LDAP_COMPARE_FALSE : case LdapClient . LDAP_COMPARE_TRUE : case LdapClient . LDAP_IS_LEAF : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_ADMIN_LIMIT_EXCEEDED : e = new LimitExceededException ( message ) ; break ; case LdapClient . LDAP_REFERRAL : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_PARTIAL_RESULTS : e = new NamingException ( message ) ; break ; case LdapClient . LDAP_INVALID_DN_SYNTAX : case LdapClient . LDAP_NAMING_VIOLATION : e = new InvalidNameException ( message ) ; break ; default : e = new NamingException ( message ) ; break ; } return e ; }
target:  Maps an LDAP error code to an appropriate NamingException. %%% public; used by controls