LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.novell.ldap.LDAPException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LDAPLocalException, LDAPReferralException

public class LDAPException
extends java.lang.Exception

Thrown to indicate that an LDAP exception has occurred. This is a general exception which includes a message and an LDAP result code.

An LDAPException can result from physical problems (such as network errors) as well as problems with LDAP operations detected by the server. For example, if an LDAP add operation fails because of a duplicate entry, the server returns a result code.

Five possible sources of information are available from LDAPException:

Result Code:
The getResultCode method returns a result code, which can be compared against standard LDAP result codes.
Message:
The getMessage method returns a localized message from the message resource that corresponds to the result code.
LDAP server Message:
The getLDAPErrorMessage method returns any error message received from the LDAP server.
Matched DN:
The getMatchedDN method retrieves the part of a submitted distinguished name which could be matched by the server
Root Cause:
The getCause method returns the a nested exception that was the original cause for the error.

The toString method returns a string containing all the above sources of information, if they have a value.

Exceptions generated by the API, i.e. that are not a result of a server response, can be identified as instanceof LDAPLocalException

The following table lists the standard LDAP result codes. See RFC2251 for a discussion of the meanings of the result codes. The corresponding ASN.1 definition from RFC2251 is provided in parentheses.

Value Result Code
0SUCCESS (success)
1OPERATIONS_ERROR (operationsError)
2PROTOCOL_ERROR (protocolError)
3TIME_LIMIT_EXCEEDED (timeLimitExceeded)
4SIZE_LIMIT_EXCEEDED (sizeLimitExceeded)
5COMPARE_FALSE (compareFalse)
6COMPARE_TRUE (compareTrue)
7AUTH_METHOD_NOT_SUPPORTED (authMethodNotSupported)
8STRONG_AUTH_REQUIRED (strongAuthRequired)
10REFERRAL (referral)
11ADMIN_LIMIT_EXCEEDED (adminLimitExceeded)
12UNAVAILABLE_CRITICAL_EXTENSION (unavailableCriticalExtension)
13CONFIDENTIALITY_REQUIRED (confidentialityRequired)
14SASL_BIND_IN_PROGRESS (saslBindInProgress)
16NO_SUCH_ATTRIBUTE (noSuchAttribute)
17UNDEFINED_ATTRIBUTE_TYPE (undefinedAttributeType)
18INAPPROPRIATE_MATCHING (inappropriateMatching)
19CONSTRAINT_VIOLATION (constraintViolation)
20ATTRIBUTE_OR_VALUE_EXISTS (AttributeOrValueExists)
21INVALID_ATTRIBUTE_SYNTAX (invalidAttributeSyntax)
32NO_SUCH_OBJECT (noSuchObject)
33ALIAS_PROBLEM (aliasProblem)
34INVALID_DN_SYNTAX (invalidDNSyntax)
35IS_LEAF (isLeaf)
36ALIAS_DEREFERENCING_PROBLEM (aliasDereferencingProblem)
48INAPPROPRIATE_AUTHENTICATION (inappropriateAuthentication)
49INVALID_CREDENTIALS (invalidCredentials)
50INSUFFICIENT_ACCESS_RIGHTS (insufficientAccessRights)
51BUSY (busy)
52UNAVAILABLE (unavailable)
53UNWILLING_TO_PERFORM (unwillingToPerform)
54LOOP_DETECT (loopDetect)
64NAMING_VIOLATION (namingViolation)
65OBJECT_CLASS_VIOLATION (objectClassViolation)
66NOT_ALLOWED_ON_NONLEAF (notAllowedOnNonLeaf)
67NOT_ALLOWED_ON_RDN (notAllowedOnRDN)
68ENTRY_ALREADY_EXISTS (entryAlreadyExists)
69OBJECT_CLASS_MODS_PROHIBITED (objectClassModsProhibited)
71AFFECTS_MULTIPLE_DSAS (affectsMultipleDSAs
80OTHER (other)

Local errors, resulting from actions other than an operation on a server.

Value Result Code
81SERVER_DOWN
82LOCAL_ERROR
83ENCODING_ERROR
84DECODING_ERROR
85LDAP_TIMEOUT
86AUTH_UNKNOWN
87FILTER_ERROR
88USER_CANCELLED
90NO_MEMORY
91CONNECT_ERROR
92LDAP_NOT_SUPPORTED
93CONTROL_NOT_FOUND
94NO_RESULTS_RETURNED
95MORE_RESULTS_TO_RETURN
96CLIENT_LOOP
97REFERRAL_LIMIT_EXCEEDED
100INVALID_RESPONSE
101AMBIGUOUS_RESPONSE
112TLS_NOT_SUPPORTED

See Also:
Serialized Form

Field Summary
static int ADMIN_LIMIT_EXCEEDED
          Indicates that an LDAP server limit set by an administrative authority has been exceeded.
static int AFFECTS_MULTIPLE_DSAS
          Indicates that the modify DN operation moves the entry from one LDAP server to another and thus requires more than one LDAP server.
static int ALIAS_DEREFERENCING_PROBLEM
          Indicates that during a search operation, either the client does not have access rights to read the aliased object's name or dereferencing is not allowed.
static int ALIAS_PROBLEM
          Indicates that an error occurred when an alias was dereferenced.
static int AMBIGUOUS_RESPONSE
          Indicates that the server response to a request is ambiguous.
static int ATTRIBUTE_OR_VALUE_EXISTS
          Indicates that the attribute value specified in a modify or add operation already exists as a value for that attribute.
static int AUTH_METHOD_NOT_SUPPORTED
          Indicates that during a bind operation the client requested an authentication method not supported by the LDAP server.
static int AUTH_UNKNOWN
          Indicates that a bind method was called with an unknown authentication method.
static int BUSY
          Indicates that the LDAP server is too busy to process the client request at this time, but if the client waits and resubmits the request, the server may be able to process it then.
static int CLIENT_LOOP
          Indicates the LDAP libraries detected a loop.
static int COMPARE_FALSE
          Does not indicate an error condition.
static int COMPARE_TRUE
          Does not indicate an error condition.
static int CONFIDENTIALITY_REQUIRED
          Indicates that the session is not protected by a protocol such as Transport Layer Security (TLS), which provides session confidentiality.
static int CONNECT_ERROR
          Indicates that the LDAP client has lost either its connection or cannot establish a connection to the LDAP server.
static int CONSTRAINT_VIOLATION
          Indicates that the attribute value specified in a modify, add, or modify DN operation violates constraints placed on the attribute.
static int CONTROL_NOT_FOUND
          Indicates that the client requested a control that the libraries cannot find in the list of supported controls sent by the LDAP server.
static int DECODING_ERROR
          Indicates that the LDAP client encountered errors when decoding an LDAP response from the LDAP server.
static int ENCODING_ERROR
          Indicates that the LDAP client encountered errors when encoding an LDAP request intended for the LDAP server.
static int ENTRY_ALREADY_EXISTS
          Indicates that the add operation attempted to add an entry that already exists, or that the modify operation attempted to rename an entry to the name of an entry that already exists.
static int FILTER_ERROR
          Indicates that the search method was called with an invalid search filter.
static int INAPPROPRIATE_AUTHENTICATION
          Indicates that during a bind operation, the client is attempting to use an authentication method that the client cannot use correctly.
static int INAPPROPRIATE_MATCHING
          Indicates that the matching rule specified in the search filter does not match a rule defined for the attribute's syntax.
static int INSUFFICIENT_ACCESS_RIGHTS
          Indicates that the caller does not have sufficient rights to perform the requested operation.
static int INVALID_ATTRIBUTE_SYNTAX
          Indicates that the attribute value specified in an add, compare, or modify operation is an unrecognized or invalid syntax for the attribute.
static int INVALID_CREDENTIALS
          Indicates that invalid information was passed during a bind operation.
static int INVALID_DN_SYNTAX
          Indicates that the syntax of the DN is incorrect.
static int INVALID_RESPONSE
          Indicates that the server response to a request is invalid.
static int IS_LEAF
          Indicates that the specified operation cannot be performed on a leaf entry.
static int LDAP_NOT_SUPPORTED
          Indicates that the requested functionality is not supported by the client.
static int LDAP_PARTIAL_RESULTS
          Returned by some LDAP servers to LDAPv2 clients to indicate that a referral has been returned in the error string.
static int LDAP_TIMEOUT
          Indicates that the time limit of the LDAP client was exceeded while waiting for a result.
static int LOCAL_ERROR
          Indicates that the LDAP client has an error.
static int LOOP_DETECT
          Indicates that the client discovered an alias or referral loop, and is thus unable to complete this request.
static int MORE_RESULTS_TO_RETURN
          Indicates that more results are chained in the result message.
static int NAMING_VIOLATION
          Indicates that the add or modify DN operation violates the schema's structure rules.
static int NO_MEMORY
          Indicates that a dynamic memory allocation method failed when calling an LDAP method.
static int NO_RESULTS_RETURNED
          Indicates that the LDAP server sent no results.
static int NO_SUCH_ATTRIBUTE
          Indicates that the attribute specified in the modify or compare operation does not exist in the entry.
static int NO_SUCH_OBJECT
          Indicates the target object cannot be found.
static int NOT_ALLOWED_ON_NONLEAF
          Indicates that the requested operation is permitted only on leaf entries.
static int NOT_ALLOWED_ON_RDN
          Indicates that the modify operation attempted to remove an attribute value that forms the entry's relative distinguished name.
static int OBJECT_CLASS_MODS_PROHIBITED
          Indicates that the modify operation attempted to modify the structure rules of an object class.
static int OBJECT_CLASS_VIOLATION
          Indicates that the add, modify, or modify DN operation violates the object class rules for the entry.
static int OPERATIONS_ERROR
          Indicates an internal error.
static int OTHER
          Indicates an unknown error condition.
static int PROTOCOL_ERROR
          Indicates that the server has received an invalid or malformed request from the client.
static int REFERRAL
          Does not indicate an error condition.
static int REFERRAL_LIMIT_EXCEEDED
          Indicates that the referral exceeds the hop limit.
static int SASL_BIND_IN_PROGRESS
          Does not indicate an error condition, but indicates that the server is ready for the next step in the process.
static int SERVER_DOWN
          Indicates that the LDAP libraries cannot establish an initial connection with the LDAP server.
static int SIZE_LIMIT_EXCEEDED
          Indicates that in a search operation, the size limit specified by the client or the server has been exceeded.
static int STRONG_AUTH_REQUIRED
          Indicates a problem with the level of authentication.
static int SUCCESS
          Indicates the requested client operation completed successfully.
static int TIME_LIMIT_EXCEEDED
          Indicates that the operation's time limit specified by either the client or the server has been exceeded.
static int TLS_NOT_SUPPORTED
          Indicates that TLS is not supported on the server.
static int UNAVAILABLE
          Indicates that the LDAP server cannot process the client's bind request, usually because it is shutting down.
static int UNAVAILABLE_CRITICAL_EXTENSION
          Indicates that the LDAP server was unable to satisfy a request because one or more critical extensions were not available.
static int UNDEFINED_ATTRIBUTE_TYPE
          Indicates that the attribute specified in the modify or add operation does not exist in the LDAP server's schema.
static int UNWILLING_TO_PERFORM
          Indicates that the LDAP server cannot process the request because of server-defined restrictions.
static int USER_CANCELLED
          Indicates that the user cancelled the LDAP operation.
 
Constructor Summary
LDAPException()
          Constructs a default exception with no specific error information.
LDAPException(java.lang.String messageOrKey, int resultCode, java.lang.String serverMsg)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String, the result code, and a server meessage.
LDAPException(java.lang.String messageOrKey, int resultCode, java.lang.String serverMsg, java.lang.String matchedDN)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String.
LDAPException(java.lang.String messageOrKey, int resultCode, java.lang.String serverMsg, java.lang.Throwable rootException)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String.
LDAPException(java.lang.String messageOrKey, java.lang.Object[] arguments, int resultCode, java.lang.String serverMsg)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments.
LDAPException(java.lang.String messageOrKey, java.lang.Object[] arguments, int resultCode, java.lang.String serverMsg, java.lang.String matchedDN)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments.
LDAPException(java.lang.String messageOrKey, java.lang.Object[] arguments, int resultCode, java.lang.String serverMsg, java.lang.Throwable rootException)
          Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments.
 
Method Summary
 java.lang.Throwable getCause()
          Returns the lower level Exception which caused the failure, if any.
 java.lang.String getLDAPErrorMessage()
          Returns the error message from the LDAP server, if this message is available (that is, if this message was set).
 java.lang.String getLocalizedMessage()
           
 java.lang.String getMatchedDN()
          Returns the part of a submitted distinguished name which could be matched by the server.
 java.lang.String getMessage()
           
 int getResultCode()
          Returns the result code from the exception.
 java.lang.String resultCodeToString()
          Returns a string representing the result code in the default locale.
static java.lang.String resultCodeToString(int code)
          Returns a string representing the specified result code in the default locale.
static java.lang.String resultCodeToString(int code, java.util.Locale locale)
          Returns a string representing the specified error code in the specified locale.
 java.lang.String resultCodeToString(java.util.Locale locale)
          Returns a string representing the result code in the specified locale.
 java.lang.String toString()
          returns a string of information about the exception and the the nested exceptions, if any.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
Indicates the requested client operation completed successfully.

SUCCESS = 0

See Also:
Constant Field Values

OPERATIONS_ERROR

public static final int OPERATIONS_ERROR
Indicates an internal error.

The server is unable to respond with a more specific error and is also unable to properly respond to a request. It does not indicate that the client has sent an erroneous message.

OPERATIONS_ERROR = 1

See Also:
Constant Field Values

PROTOCOL_ERROR

public static final int PROTOCOL_ERROR
Indicates that the server has received an invalid or malformed request from the client.

PROTOCOL_ERROR = 2

See Also:
Constant Field Values

TIME_LIMIT_EXCEEDED

public static final int TIME_LIMIT_EXCEEDED
Indicates that the operation's time limit specified by either the client or the server has been exceeded.

On search operations, incomplete results are returned.

TIME_LIMIT_EXCEEDED = 3

See Also:
Constant Field Values

SIZE_LIMIT_EXCEEDED

public static final int SIZE_LIMIT_EXCEEDED
Indicates that in a search operation, the size limit specified by the client or the server has been exceeded. Incomplete results are returned.

SIZE_LIMIT_EXCEEDED = 4

See Also:
Constant Field Values

COMPARE_FALSE

public static final int COMPARE_FALSE
Does not indicate an error condition. Indicates that the results of a compare operation are false.

COMPARE_FALSE = 5

See Also:
Constant Field Values

COMPARE_TRUE

public static final int COMPARE_TRUE
Does not indicate an error condition. Indicates that the results of a compare operation are true.

COMPARE_TRUE = 6

See Also:
Constant Field Values

AUTH_METHOD_NOT_SUPPORTED

public static final int AUTH_METHOD_NOT_SUPPORTED
Indicates that during a bind operation the client requested an authentication method not supported by the LDAP server.

AUTH_METHOD_NOT_SUPPORTED = 7

See Also:
Constant Field Values

STRONG_AUTH_REQUIRED

public static final int STRONG_AUTH_REQUIRED
Indicates a problem with the level of authentication.

One of the following has occurred:

STRONG_AUTH_REQUIRED = 8

See Also:
Constant Field Values

LDAP_PARTIAL_RESULTS

public static final int LDAP_PARTIAL_RESULTS
Returned by some LDAP servers to LDAPv2 clients to indicate that a referral has been returned in the error string.

LDAP_PARTIAL_RESULTS = 9

See Also:
Constant Field Values

REFERRAL

public static final int REFERRAL
Does not indicate an error condition. In LDAPv3, indicates that the server does not hold the target entry of the request, but that the servers in the referral field may.

REFERRAL = 10

See Also:
Constant Field Values

ADMIN_LIMIT_EXCEEDED

public static final int ADMIN_LIMIT_EXCEEDED
Indicates that an LDAP server limit set by an administrative authority has been exceeded.

ADMIN_LIMIT_EXCEEDED = 11

See Also:
Constant Field Values

UNAVAILABLE_CRITICAL_EXTENSION

public static final int UNAVAILABLE_CRITICAL_EXTENSION
Indicates that the LDAP server was unable to satisfy a request because one or more critical extensions were not available.

Either the server does not support the control or the control is not appropriate for the operation type.

UNAVAILABLE_CRITICAL_EXTENSION = 12

See Also:
Constant Field Values

CONFIDENTIALITY_REQUIRED

public static final int CONFIDENTIALITY_REQUIRED
Indicates that the session is not protected by a protocol such as Transport Layer Security (TLS), which provides session confidentiality.

CONFIDENTIALITY_REQUIRED = 13

See Also:
Constant Field Values

SASL_BIND_IN_PROGRESS

public static final int SASL_BIND_IN_PROGRESS
Does not indicate an error condition, but indicates that the server is ready for the next step in the process. The client must send the server the same SASL mechanism to continue the process.

SASL_BIND_IN_PROGRESS = 14

See Also:
Constant Field Values

NO_SUCH_ATTRIBUTE

public static final int NO_SUCH_ATTRIBUTE
Indicates that the attribute specified in the modify or compare operation does not exist in the entry.

NO_SUCH_ATTRIBUTE = 16

See Also:
Constant Field Values

UNDEFINED_ATTRIBUTE_TYPE

public static final int UNDEFINED_ATTRIBUTE_TYPE
Indicates that the attribute specified in the modify or add operation does not exist in the LDAP server's schema.

UNDEFINED_ATTRIBUTE_TYPE = 17

See Also:
Constant Field Values

INAPPROPRIATE_MATCHING

public static final int INAPPROPRIATE_MATCHING
Indicates that the matching rule specified in the search filter does not match a rule defined for the attribute's syntax.

INAPPROPRIATE_MATCHING = 18

See Also:
Constant Field Values

CONSTRAINT_VIOLATION

public static final int CONSTRAINT_VIOLATION
Indicates that the attribute value specified in a modify, add, or modify DN operation violates constraints placed on the attribute. The constraint can be one of size or content (for example, string only, no binary data).

CONSTRAINT_VIOLATION = 19

See Also:
Constant Field Values

ATTRIBUTE_OR_VALUE_EXISTS

public static final int ATTRIBUTE_OR_VALUE_EXISTS
Indicates that the attribute value specified in a modify or add operation already exists as a value for that attribute.

ATTRIBUTE_OR_VALUE_EXISTS = 20

See Also:
Constant Field Values

INVALID_ATTRIBUTE_SYNTAX

public static final int INVALID_ATTRIBUTE_SYNTAX
Indicates that the attribute value specified in an add, compare, or modify operation is an unrecognized or invalid syntax for the attribute.

INVALID_ATTRIBUTE_SYNTAX = 21

See Also:
Constant Field Values

NO_SUCH_OBJECT

public static final int NO_SUCH_OBJECT
Indicates the target object cannot be found.

This code is not returned on the following operations:

NO_SUCH_OBJECT = 32

See Also:
Constant Field Values

ALIAS_PROBLEM

public static final int ALIAS_PROBLEM
Indicates that an error occurred when an alias was dereferenced.

ALIAS_PROBLEM = 33

See Also:
Constant Field Values

INVALID_DN_SYNTAX

public static final int INVALID_DN_SYNTAX
Indicates that the syntax of the DN is incorrect.

If the DN syntax is correct, but the LDAP server's structure rules do not permit the operation, the server returns LDAP_UNWILLING_TO_PERFORM.

INVALID_DN_SYNTAX = 34

See Also:
Constant Field Values

IS_LEAF

public static final int IS_LEAF
Indicates that the specified operation cannot be performed on a leaf entry.

This code is not currently in the LDAP specifications, but is reserved for this constant.

IS_LEAF = 35

See Also:
Constant Field Values

ALIAS_DEREFERENCING_PROBLEM

public static final int ALIAS_DEREFERENCING_PROBLEM
Indicates that during a search operation, either the client does not have access rights to read the aliased object's name or dereferencing is not allowed.

ALIAS_DEREFERENCING_PROBLEM = 36

See Also:
Constant Field Values

INAPPROPRIATE_AUTHENTICATION

public static final int INAPPROPRIATE_AUTHENTICATION
Indicates that during a bind operation, the client is attempting to use an authentication method that the client cannot use correctly.

For example, either of the following cause this error:

INAPPROPRIATE_AUTHENTICATION = 48

See Also:
Constant Field Values

INVALID_CREDENTIALS

public static final int INVALID_CREDENTIALS
Indicates that invalid information was passed during a bind operation.

One of the following occurred:

INVALID_CREDENTIALS = 49

See Also:
Constant Field Values

INSUFFICIENT_ACCESS_RIGHTS

public static final int INSUFFICIENT_ACCESS_RIGHTS
Indicates that the caller does not have sufficient rights to perform the requested operation.

INSUFFICIENT_ACCESS_RIGHTS = 50

See Also:
Constant Field Values

BUSY

public static final int BUSY
Indicates that the LDAP server is too busy to process the client request at this time, but if the client waits and resubmits the request, the server may be able to process it then.

BUSY = 51

See Also:
Constant Field Values

UNAVAILABLE

public static final int UNAVAILABLE
Indicates that the LDAP server cannot process the client's bind request, usually because it is shutting down.

UNAVAILABLE = 52

See Also:
Constant Field Values

UNWILLING_TO_PERFORM

public static final int UNWILLING_TO_PERFORM
Indicates that the LDAP server cannot process the request because of server-defined restrictions.

This error is returned for the following reasons:

UNWILLING_TO_PERFORM = 53

See Also:
Constant Field Values

LOOP_DETECT

public static final int LOOP_DETECT
Indicates that the client discovered an alias or referral loop, and is thus unable to complete this request.

LOOP_DETECT = 54

See Also:
Constant Field Values

NAMING_VIOLATION

public static final int NAMING_VIOLATION
Indicates that the add or modify DN operation violates the schema's structure rules.

For example,


OBJECT_CLASS_VIOLATION

public static final int OBJECT_CLASS_VIOLATION
Indicates that the add, modify, or modify DN operation violates the object class rules for the entry.

For example, the following types of request return this error:

OBJECT_CLASS_VIOLATION = 65

See Also:
Constant Field Values

NOT_ALLOWED_ON_NONLEAF

public static final int NOT_ALLOWED_ON_NONLEAF
Indicates that the requested operation is permitted only on leaf entries.

For example, the following types of requests return this error:

NOT_ALLOWED_ON_NONLEAF = 66

See Also:
Constant Field Values

NOT_ALLOWED_ON_RDN

public static final int NOT_ALLOWED_ON_RDN
Indicates that the modify operation attempted to remove an attribute value that forms the entry's relative distinguished name.

NOT_ALLOWED_ON_RDN = 67

See Also:
Constant Field Values

ENTRY_ALREADY_EXISTS

public static final int ENTRY_ALREADY_EXISTS
Indicates that the add operation attempted to add an entry that already exists, or that the modify operation attempted to rename an entry to the name of an entry that already exists.

ENTRY_ALREADY_EXISTS = 68

See Also:
Constant Field Values

OBJECT_CLASS_MODS_PROHIBITED

public static final int OBJECT_CLASS_MODS_PROHIBITED
Indicates that the modify operation attempted to modify the structure rules of an object class.

OBJECT_CLASS_MODS_PROHIBITED = 69

See Also:
Constant Field Values

AFFECTS_MULTIPLE_DSAS

public static final int AFFECTS_MULTIPLE_DSAS
Indicates that the modify DN operation moves the entry from one LDAP server to another and thus requires more than one LDAP server.

AFFECTS_MULTIPLE_DSAS = 71

See Also:
Constant Field Values

OTHER

public static final int OTHER
Indicates an unknown error condition.

OTHER = 80

See Also:
Constant Field Values

SERVER_DOWN

public static final int SERVER_DOWN
Indicates that the LDAP libraries cannot establish an initial connection with the LDAP server. Either the LDAP server is down or the specified host name or port number is incorrect.

SERVER_DOWN = 81

See Also:
Constant Field Values

LOCAL_ERROR

public static final int LOCAL_ERROR
Indicates that the LDAP client has an error. This is usually a failed dynamic memory allocation error.

LOCAL_ERROR = 82

See Also:
Constant Field Values

ENCODING_ERROR

public static final int ENCODING_ERROR
Indicates that the LDAP client encountered errors when encoding an LDAP request intended for the LDAP server.

ENCODING_ERROR = 83

See Also:
Constant Field Values

DECODING_ERROR

public static final int DECODING_ERROR
Indicates that the LDAP client encountered errors when decoding an LDAP response from the LDAP server.

DECODING_ERROR = 84

See Also:
Constant Field Values

LDAP_TIMEOUT

public static final int LDAP_TIMEOUT
Indicates that the time limit of the LDAP client was exceeded while waiting for a result.

LDAP_TIMEOUT = 85

See Also:
Constant Field Values

AUTH_UNKNOWN

public static final int AUTH_UNKNOWN
Indicates that a bind method was called with an unknown authentication method.

AUTH_UNKNOWN = 86

See Also:
Constant Field Values

FILTER_ERROR

public static final int FILTER_ERROR
Indicates that the search method was called with an invalid search filter.

FILTER_ERROR = 87

See Also:
Constant Field Values

USER_CANCELLED

public static final int USER_CANCELLED
Indicates that the user cancelled the LDAP operation.

USER_CANCELLED = 88

See Also:
Constant Field Values

NO_MEMORY

public static final int NO_MEMORY
Indicates that a dynamic memory allocation method failed when calling an LDAP method.

NO_MEMORY = 90

See Also:
Constant Field Values

CONNECT_ERROR

public static final int CONNECT_ERROR
Indicates that the LDAP client has lost either its connection or cannot establish a connection to the LDAP server.

CONNECT_ERROR = 91

See Also:
Constant Field Values

LDAP_NOT_SUPPORTED

public static final int LDAP_NOT_SUPPORTED
Indicates that the requested functionality is not supported by the client. For example, if the LDAP client is established as an LDAPv2 client, the libraries set this error code when the client requests LDAPv3 functionality.

LDAP_NOT_SUPPORTED = 92

See Also:
Constant Field Values

CONTROL_NOT_FOUND

public static final int CONTROL_NOT_FOUND
Indicates that the client requested a control that the libraries cannot find in the list of supported controls sent by the LDAP server.

CONTROL_NOT_FOUND = 93

See Also:
Constant Field Values

NO_RESULTS_RETURNED

public static final int NO_RESULTS_RETURNED
Indicates that the LDAP server sent no results.

NO_RESULTS_RETURNED = 94

See Also:
Constant Field Values

MORE_RESULTS_TO_RETURN

public static final int MORE_RESULTS_TO_RETURN
Indicates that more results are chained in the result message.

MORE_RESULTS_TO_RETURN = 95

See Also:
Constant Field Values

CLIENT_LOOP

public static final int CLIENT_LOOP
Indicates the LDAP libraries detected a loop. Usually this happens when following referrals.

CLIENT_LOOP = 96

See Also:
Constant Field Values

REFERRAL_LIMIT_EXCEEDED

public static final int REFERRAL_LIMIT_EXCEEDED
Indicates that the referral exceeds the hop limit. The default hop limit is ten.

The hop limit determines how many servers the client can hop through to retrieve data. For example, suppose the following conditions:

With these conditions, the hop limit is exceeded and the LDAP libraries set this code.

REFERRAL_LIMIT_EXCEEDED = 97

See Also:
Constant Field Values

INVALID_RESPONSE

public static final int INVALID_RESPONSE
Indicates that the server response to a request is invalid.

INVALID_RESPONSE = 100

See Also:
Constant Field Values

AMBIGUOUS_RESPONSE

public static final int AMBIGUOUS_RESPONSE
Indicates that the server response to a request is ambiguous.

AMBIGUOUS_RESPONSE = 101

See Also:
Constant Field Values

TLS_NOT_SUPPORTED

public static final int TLS_NOT_SUPPORTED
Indicates that TLS is not supported on the server.

TLS_NOT_SUPPORTED = 112

See Also:
Constant Field Values
Constructor Detail

LDAPException

public LDAPException()
Constructs a default exception with no specific error information.


LDAPException

public LDAPException(java.lang.String messageOrKey,
                     int resultCode,
                     java.lang.String serverMsg)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String, the result code, and a server meessage.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

resultCode - The result code returned.

serverMsg - Error message specifying additional information from the server

LDAPException

public LDAPException(java.lang.String messageOrKey,
                     java.lang.Object[] arguments,
                     int resultCode,
                     java.lang.String serverMsg)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code and server message.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

arguments - The modifying arguments to be included in the message string.

serverMsg - Error message specifying additional information from the server

resultCode - The result code returned.

LDAPException

public LDAPException(java.lang.String messageOrKey,
                     int resultCode,
                     java.lang.String serverMsg,
                     java.lang.Throwable rootException)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

resultCode - The result code returned.

serverMsg - Error message specifying additional information from the server

rootException - A throwable which is the underlying cause of the LDAPException.

LDAPException

public LDAPException(java.lang.String messageOrKey,
                     java.lang.Object[] arguments,
                     int resultCode,
                     java.lang.String serverMsg,
                     java.lang.Throwable rootException)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

arguments - The modifying arguments to be included in the message string.

resultCode - The result code returned.

serverMsg - Error message specifying additional information from the server

rootException - A throwable which is the underlying cause of the LDAPException.

LDAPException

public LDAPException(java.lang.String messageOrKey,
                     int resultCode,
                     java.lang.String serverMsg,
                     java.lang.String matchedDN)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String. Additional parameters specify the result code, the message returned from the server, and a matchedDN returned from the server.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

resultCode - The result code returned.

serverMsg - Error message specifying additional information from the server

matchedDN - The maximal subset of a specified DN which could be matched by the server on a search operation.

LDAPException

public LDAPException(java.lang.String messageOrKey,
                     java.lang.Object[] arguments,
                     int resultCode,
                     java.lang.String serverMsg,
                     java.lang.String matchedDN)

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code, a message returned from the server, and a matchedDN returned from the server.

The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

Parameters:
messageOrKey - Key to addition result information, a key into ExceptionMessages, or the information itself if the key doesn't exist.

arguments - The modifying arguments to be included in the message string.

resultCode - The result code returned.

serverMsg - Error message specifying additional information from the server

matchedDN - The maximal subset of a specified DN which could be matched by the server on a search operation.
Method Detail

resultCodeToString

public java.lang.String resultCodeToString()
Returns a string representing the result code in the default locale.

Returns:
The message for the result code in the LDAPException object.

resultCodeToString

public static java.lang.String resultCodeToString(int code)
Returns a string representing the specified result code in the default locale.

Parameters:
code - The result code for which a message is to be returned.
Returns:
The message corresponding to the specified result code, or or null if the message is not available for the default locale.

resultCodeToString

public java.lang.String resultCodeToString(java.util.Locale locale)
Returns a string representing the result code in the specified locale.

Parameters:
locale - The locale in which to render the error message.
Returns:
A message corresponding to the result code in the specified locale, or null if the message is not available for the requested locale.

resultCodeToString

public static java.lang.String resultCodeToString(int code,
                                                  java.util.Locale locale)
Returns a string representing the specified error code in the specified locale.

Parameters:
code - The result code for which a message is to be returned.

locale - The locale in which to render the message.
Returns:
A message corresponding to the result code in the specified locale, or null if the message is not available for the requested locale.

getLDAPErrorMessage

public java.lang.String getLDAPErrorMessage()
Returns the error message from the LDAP server, if this message is available (that is, if this message was set). If the message was not set, this method returns null.

Returns:
The error message or null if the message was not set.

getCause

public java.lang.Throwable getCause()
Returns the lower level Exception which caused the failure, if any. For example, an IOException with additional information may be returned on a CONNECT_ERROR failure.


getResultCode

public int getResultCode()
Returns the result code from the exception.

The codes are defined as public final static int members of the LDAP Exception class. If the exception is a result of error information returned from a directory operation, the code will be one of those defined for the class. Otherwise, a local error code is returned.


getMatchedDN

public java.lang.String getMatchedDN()
Returns the part of a submitted distinguished name which could be matched by the server.

If the exception was caused by a local error, such as no server available, the return value is null. If the exception resulted from an operation being executed on a server, the value is an empty string except when the result of the operation was one of the following:

Returns:
The part of a submitted distinguished name which could be matched by the server or null if the error is a local error.

getMessage

public java.lang.String getMessage()

getLocalizedMessage

public java.lang.String getLocalizedMessage()

toString

public java.lang.String toString()
returns a string of information about the exception and the the nested exceptions, if any.


LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000