Package com.nimbusds.common.ldap
Class LDAPExceptionUtils
java.lang.Object
com.nimbusds.common.ldap.LDAPExceptionUtils
LDAP exception utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
ensureSuccess
(com.unboundid.ldap.sdk.LDAPResult result) Throws a JSON-RPC 2.0 error with corresponding code and message if the specified LDAP result indicates failure.static com.thetransactioncompany.jsonrpc2.JSONRPC2Error
toJSONRPC2Error
(com.unboundid.ldap.sdk.LDAPException ldapException) Turns an LDAP exception into a JSON-RPC 2.0 error with corresponding code and message.
-
Method Details
-
toJSONRPC2Error
public static com.thetransactioncompany.jsonrpc2.JSONRPC2Error toJSONRPC2Error(com.unboundid.ldap.sdk.LDAPException ldapException) Turns an LDAP exception into a JSON-RPC 2.0 error with corresponding code and message. The LDAP error codes are mapped directly (1:1) to JSON-RPC 2.0 error codes, e.g. LDAP error 34 (Invalid DN syntax) becomes JSON-RPC 2.0 error 34.- Parameters:
ldapException
- A valid LDAP exception instance. Must not benull
.- Returns:
- A JSON-RPC 2.0 error representing the original LDAP exception, ready for insertion into a JSON-RPC 2.0 response.
-
ensureSuccess
public static void ensureSuccess(com.unboundid.ldap.sdk.LDAPResult result) throws com.thetransactioncompany.jsonrpc2.JSONRPC2Error Throws a JSON-RPC 2.0 error with corresponding code and message if the specified LDAP result indicates failure.- Parameters:
result
- The result from an LDAP request. Must not benull
.- Throws:
com.thetransactioncompany.jsonrpc2.JSONRPC2Error
- On an LDAP result indicating a failure.
-