Serializable
AttributeInUseException
, AttributeModificationException
, CannotProceedException
, CommunicationException
, ConfigurationException
, ContextNotEmptyException
, InsufficientResourcesException
, InterruptedNamingException
, InvalidAttributeIdentifierException
, InvalidAttributesException
, InvalidAttributeValueException
, InvalidNameException
, InvalidSearchControlsException
, InvalidSearchFilterException
, LimitExceededException
, LinkException
, NameAlreadyBoundException
, NameNotFoundException
, NamingSecurityException
, NoInitialContextException
, NoSuchAttributeException
, NotContextException
, OperationNotSupportedException
, PartialResultException
, ReferralException
, SchemaViolationException
, ServiceUnavailableException
public class NamingException extends Exception
A NamingException instance is not synchronized against concurrent multithreaded access. Multiple threads trying to access and modify a single NamingException instance should lock the object.
This exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The root exception (or root cause) is the same object as the cause returned by the Throwable.getCause()
method.
Modifier and Type | Field | Description |
---|---|---|
protected Name |
remainingName |
Contains the remaining name that has not been resolved yet. |
protected Name |
resolvedName |
Contains the part of the name that has been successfully resolved. |
protected Object |
resolvedObj |
Contains the object to which resolution of the part of the name was successful. |
protected Throwable |
rootException |
Contains the original exception that caused this NamingException to be thrown. |
Constructor | Description |
---|---|
NamingException() |
Constructs a new NamingException. |
NamingException |
Constructs a new NamingException with an explanation. |
Modifier and Type | Method | Description |
---|---|---|
void |
appendRemainingComponent |
Add name as the last component in remaining name. |
void |
appendRemainingName |
Add components from 'name' as the last components in remaining name. |
Throwable |
getCause() |
Returns the cause of this exception. |
String |
getExplanation() |
Retrieves the explanation associated with this exception. |
Name |
getRemainingName() |
Retrieves the remaining unresolved portion of the name. |
Name |
getResolvedName() |
Retrieves the leading portion of the name that was resolved successfully. |
Object |
getResolvedObj() |
Retrieves the object to which resolution was successful. |
Throwable |
getRootCause() |
Retrieves the root cause of this NamingException, if any. |
Throwable |
initCause |
Initializes the cause of this exception to the specified value. |
void |
setRemainingName |
Sets the remaining name field of this exception. |
void |
setResolvedName |
Sets the resolved name field of this exception. |
void |
setResolvedObj |
Sets the resolved object field of this exception. |
void |
setRootCause |
Records the root cause of this NamingException. |
String |
toString() |
Generates the string representation of this exception. |
String |
toString |
Generates the string representation in more detail. |
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace
protected Name resolvedName
protected Object resolvedObj
protected Name remainingName
protected Throwable rootException
This field predates the general-purpose exception chaining facility. The initCause(Throwable)
and getCause()
methods are now the preferred means of accessing this information.
public NamingException(String explanation)
explanation
- A possibly null string containing additional detail about this exception.public NamingException()
public Name getResolvedName()
public Name getRemainingName()
public Object getResolvedObj()
public String getExplanation()
public void setResolvedName(Name name)
name
is a composite name. If the intent is to set this field using a compound name or string, you must "stringify" the compound name, and create a composite name with a single component using the string. You can then invoke this method using the resulting composite name.
A copy of name
is made and stored. Subsequent changes to name
do not affect the copy in this NamingException and vice versa.
name
- The possibly null name to set resolved name to. If null, it sets the resolved name field to null.public void setRemainingName(Name name)
name
is a composite name. If the intent is to set this field using a compound name or string, you must "stringify" the compound name, and create a composite name with a single component using the string. You can then invoke this method using the resulting composite name.
A copy of name
is made and stored. Subsequent changes to name
do not affect the copy in this NamingException and vice versa.
name
- The possibly null name to set remaining name to. If null, it sets the remaining name field to null.public void setResolvedObj(Object obj)
obj
- The possibly null object to set resolved object to. If null, the resolved object field is set to null.public void appendRemainingComponent(String name)
name
- The component to add. If name is null, this method does not do anything.public void appendRemainingName(Name name)
name
is a composite name. If the intent is to append a compound name, you should "stringify" the compound name then invoke the overloaded form that accepts a String parameter.
Subsequent changes to name
do not affect the remaining name field in this NamingException and vice versa.
name
- The possibly null name containing ordered components to add. If name is null, this method does not do anything.public Throwable getRootCause()
This method predates the general-purpose exception chaining facility. The getCause()
method is now the preferred means of obtaining this information.
public void setRootCause(Throwable e)
e
is this
, this method does not do anything. This method predates the general-purpose exception chaining facility. The initCause(Throwable)
method is now the preferred means of recording this information.
e
- The possibly null exception that caused the naming operation to fail. If null, it means this naming exception has no root cause.public Throwable getCause()
null
if the cause is nonexistent or unknown.public Throwable initCause(Throwable cause)
This method may be called at most once.
initCause
in class Throwable
cause
- the cause, which is saved for later retrieval by the getCause()
method. A null
value indicates that the cause is nonexistent or unknown.NamingException
instance.IllegalArgumentException
- if cause
is this exception. (A throwable cannot be its own cause.)IllegalStateException
- if this method has already been called on this exception.public String toString()
public String toString(boolean detail)
detail
- If true, include details about the resolved object in addition to the other information.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.naming/javax/naming/NamingException.html