Class LDAPExceptionUtils

java.lang.Object
com.nimbusds.common.ldap.LDAPExceptionUtils

public class LDAPExceptionUtils extends Object
LDAP exception utilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 be null.
      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 be null.
      Throws:
      com.thetransactioncompany.jsonrpc2.JSONRPC2Error - On an LDAP result indicating a failure.