org.springframework.ldap

## Class NamingException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.springframework.core.NestedRuntimeException
        - - org.springframework.ldap.NamingException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    AttributeInUseException, AttributeModificationException, BadLdapGrammarException, CannotProceedException, CommunicationException, ConfigurationException, ContextNotEmptyException, ConverterException, CreateControlFailedException, InsufficientResourcesException, InterruptedNamingException, InvalidAttributeFormatException, InvalidAttributeIdentifierException, InvalidAttributesException, InvalidAttributeValueException, InvalidNameException, InvalidRecordFormatException, InvalidSearchControlsException, InvalidSearchFilterException, LimitExceededException, LinkException, NameAlreadyBoundException, NameNotFoundException, NamingSecurityException, NoInitialContextException, NoSuchAttributeException, NotContextException, ObjectRetrievalException, OdmException, OperationNotSupportedException, PartialResultException, ReferralException, SchemaViolationException, ServiceUnavailableException, UncategorizedLdapException

      public abstract class NamingException
      extends NestedRuntimeException

  Base class for exception thrown by the framework whenever it encounters a problem related to LDAP.
  Since:
    1.2
  Author:
    Ulrik Sandberg
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NamingException(String msg)` Constructor that takes a message.
    `NamingException(String msg, Throwable cause)` Constructor that allows a message and a root cause.
    `NamingException(Throwable cause)` Constructor that allows a plain root cause, intended for subclasses mirroring corresponding `javax.naming` exceptions.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Throwable` | `getCause()` Overrides `Throwable.getCause()` since serialization always tries to serialize the base class before the subclass.
    `String` | `getExplanation()` Convenience method to get the explanation associated with this exception, if the root cause was an instance of `NamingException`.
    `Name` | `getRemainingName()` Convenience method to get the unresolved part of the name associated with this exception, if the root cause was an instance of `NamingException`.
    `Name` | `getResolvedName()` Convenience method to get the leading portion of the resolved name associated with this exception, if the root cause was an instance of `NamingException`.
    `Object` | `getResolvedObj()` Convenience method to get the resolved object associated with this exception, if the root cause was an instance of `NamingException`.

    - ### Methods inherited from class org.springframework.core.NestedRuntimeException

      `contains, getMessage, getMostSpecificCause, getRootCause`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NamingException

          public NamingException(String msg)

      Constructor that takes a message.
      Parameters:
        `msg` - the detail message

    - #### NamingException

          public NamingException(String msg,
                                 Throwable cause)

      Constructor that allows a message and a root cause.
      Parameters:
        `msg` - the detail message
        `cause` - the cause of the exception. This argument is generally expected to be a proper subclass of `NamingException`.

    - #### NamingException

          public NamingException(Throwable cause)

      Constructor that allows a plain root cause, intended for subclasses mirroring corresponding `javax.naming` exceptions.
      Parameters:
        `cause` - the cause of the exception. This argument is generally expected to be a proper subclass of `NamingException`.

  - ### Method Detail

    - #### getCause

          public Throwable getCause()

      Overrides `Throwable.getCause()` since serialization always tries to serialize the base class before the subclass. Our `cause` may have a `resolvedObj` that is not serializable. By storing the cause in this class, we get a chance at temporarily nulling the cause before serialization, thus in effect making the current instance serializable.
      Overrides:
        `getCause` in class `Throwable`

    - #### getExplanation

          public String getExplanation()

      Convenience method to get the explanation associated with this exception, if the root cause was an instance of `NamingException`.
      Returns:
        a detail string explaining more about this exception if the root cause is an instance of javax.naming.NamingException, or `null` if there is no detail message for this exception

    - #### getRemainingName

          public Name getRemainingName()

      Convenience method to get the unresolved part of the name associated with this exception, if the root cause was an instance of `NamingException`.
      Returns:
        a composite name describing the part of the name that has not been resolved if the root cause is an instance of javax.naming.NamingException, or `null` if the remaining name field has not been set

    - #### getResolvedName

          public Name getResolvedName()

      Convenience method to get the leading portion of the resolved name associated with this exception, if the root cause was an instance of `NamingException`.
      Returns:
        a composite name describing the leading portion of the name that was resolved successfully if the root cause is an instance of javax.naming.NamingException, or `null` if the resolved name field has not been set

    - #### getResolvedObj

          public Object getResolvedObj()

      Convenience method to get the resolved object associated with this exception, if the root cause was an instance of `NamingException`.
      Returns:
        the object that was resolved so far if the root cause is an instance of javax.naming.NamingException, or `null` if the resolved object field has not been set