org.ldaptive.provider.jndi
Class NamingExceptionUtils

java.lang.Object
  extended by org.ldaptive.provider.jndi.NamingExceptionUtils

public final class NamingExceptionUtils
extends Object

Utility class that provides a bridge between JNDI naming exceptions and ldap result codes. See http://docs.oracle.com/javase/tutorial/jndi/ldap/exceptions.html

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Method Summary
static Class<? extends NamingException> getNamingException(ResultCode code)
          Returns the naming exception that maps to the supplied result code.
static ResultCode getResultCode(Class<? extends NamingException> clazz)
          Returns the result code that map to the supplied naming exception.
static ResultCode getResultCode(String message)
          Returns the result code contained in the supplied naming exception message.
static ResultCode[] getResultCodes(Class<? extends NamingException> clazz)
          Returns the result codes that map to the supplied naming exception.
static boolean matches(Class<? extends NamingException> clazz, ResultCode code)
          Returns whether the supplied naming exception maps to the supplied result code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResultCodes

public static ResultCode[] getResultCodes(Class<? extends NamingException> clazz)
Returns the result codes that map to the supplied naming exception.

Parameters:
clazz - naming exception
Returns:
ldap result codes

getResultCode

public static ResultCode getResultCode(Class<? extends NamingException> clazz)
Returns the result code that map to the supplied naming exception. If the exception maps to multiple result codes, null is returned.

Parameters:
clazz - naming exception
Returns:
ldap result code or null

getResultCode

public static ResultCode getResultCode(String message)
Returns the result code contained in the supplied naming exception message. JNDI displays the error code in the form "[LDAP: error code {code} - {message}" and this method attempts to parse that numeric code from the message.

Parameters:
message - naming exception message
Returns:
ldap result code or null

matches

public static boolean matches(Class<? extends NamingException> clazz,
                              ResultCode code)
Returns whether the supplied naming exception maps to the supplied result code.

Parameters:
clazz - naming exception
code - ldap result code
Returns:
whether the naming exception matches the result code

getNamingException

public static Class<? extends NamingException> getNamingException(ResultCode code)
Returns the naming exception that maps to the supplied result code. If the result code does not map to an exception, null is returned

Parameters:
code - ldap result code
Returns:
array of naming exception classes


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.