Class NamingException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
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
- Resolved Name. Portion of name that has been resolved.
- Resolved Object. Object to which resolution of name proceeded.
- Remaining Name. Portion of name that has not been resolved.
- Explanation. Detail explaining why name resolution failed.
- Root Exception. The exception that caused this naming exception to be thrown.
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.
- Since:
- 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Name
Contains the remaining name that has not been resolved yet.protected Name
Contains the part of the name that has been successfully resolved.protected Object
Contains the object to which resolution of the part of the name was successful.protected Throwable
Contains the original exception that caused this NamingException to be thrown. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new NamingException.NamingException
(String explanation) Constructs a new NamingException with an explanation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add name as the last component in remaining name.void
appendRemainingName
(Name name) Add components from 'name' as the last components in remaining name.getCause()
Returns the cause of this exception.Retrieves the explanation associated with this exception.Retrieves the remaining unresolved portion of the name.Retrieves the leading portion of the name that was resolved successfully.Retrieves the object to which resolution was successful.Retrieves the root cause of this NamingException, if any.Initializes the cause of this exception to the specified value.void
setRemainingName
(Name name) Sets the remaining name field of this exception.void
setResolvedName
(Name name) Sets the resolved name field of this exception.void
setResolvedObj
(Object obj) Sets the resolved object field of this exception.void
Records the root cause of this NamingException.toString()
Generates the string representation of this exception.toString
(boolean detail) Generates the string representation in more detail.Methods declared in class Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace
Modifier and TypeMethodDescriptionfinal void
addSuppressed
(Throwable exception) Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.Fills in the execution stack trace.Creates a localized description of this throwable.Returns the detail message string of this throwable.Provides programmatic access to the stack trace information printed byThrowable.printStackTrace()
.final Throwable[]
Returns an array containing all of the exceptions that were suppressed, typically by thetry
-with-resources statement, in order to deliver this exception.void
Prints this throwable and its backtrace to the standard error stream.void
Prints this throwable and its backtrace to the specified print stream.void
Prints this throwable and its backtrace to the specified print writer.void
setStackTrace
(StackTraceElement[] stackTrace) Sets the stack trace elements that will be returned byThrowable.getStackTrace()
and printed byThrowable.printStackTrace()
and related methods.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Field Details
-
resolvedName
Contains the part of the name that has been successfully resolved. It is a composite name and can be null. This field is initialized by the constructors. You should access and manipulate this field through its get and set methods.- See Also:
-
resolvedObj
Contains the object to which resolution of the part of the name was successful. Can be null. This field is initialized by the constructors. You should access and manipulate this field through its get and set methods.- See Also:
-
remainingName
Contains the remaining name that has not been resolved yet. It is a composite name and can be null. This field is initialized by the constructors. You should access and manipulate this field through its get, set, "append" methods.- See Also:
-
rootException
Contains the original exception that caused this NamingException to be thrown. This field is set if there is additional information that could be obtained from the original exception, or if the original exception could not be mapped to a subclass of NamingException. Can be null.This field predates the general-purpose exception chaining facility. The
initCause(Throwable)
andgetCause()
methods are now the preferred means of accessing this information.- See Also:
-
-
Constructor Details
-
NamingException
Constructs a new NamingException with an explanation. All unspecified fields are set to null.- Parameters:
explanation
- A possibly null string containing additional detail about this exception.- See Also:
-
NamingException
public NamingException()Constructs a new NamingException. All fields are set to null.
-
-
Method Details
-
getResolvedName
Retrieves the leading portion of the name that was resolved successfully.- Returns:
- The part of the name that was resolved successfully. It is a composite name. It can be null, which means the resolved name field has not been set.
- See Also:
-
getRemainingName
Retrieves the remaining unresolved portion of the name.- Returns:
- The part of the name that has not been resolved. It is a composite name. It can be null, which means the remaining name field has not been set.
- See Also:
-
getResolvedObj
Retrieves the object to which resolution was successful. This is the object to which the resolved name is bound.- Returns:
- The possibly null object that was resolved so far. null means that the resolved object field has not been set.
- See Also:
-
getExplanation
Retrieves the explanation associated with this exception.- Returns:
- The possibly null detail string explaining more about this exception. If null, it means there is no detail message for this exception.
- See Also:
-
setResolvedName
Sets the resolved name field of this exception.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 toname
do not affect the copy in this NamingException and vice versa.- Parameters:
name
- The possibly null name to set resolved name to. If null, it sets the resolved name field to null.- See Also:
-
setRemainingName
Sets the remaining name field of this exception.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 toname
do not affect the copy in this NamingException and vice versa.- Parameters:
name
- The possibly null name to set remaining name to. If null, it sets the remaining name field to null.- See Also:
-
setResolvedObj
Sets the resolved object field of this exception.- Parameters:
obj
- The possibly null object to set resolved object to. If null, the resolved object field is set to null.- See Also:
-
appendRemainingComponent
Add name as the last component in remaining name.- Parameters:
name
- The component to add. If name is null, this method does not do anything.- See Also:
-
appendRemainingName
Add components from 'name' as the last components in remaining 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.- Parameters:
name
- The possibly null name containing ordered components to add. If name is null, this method does not do anything.- See Also:
-
getRootCause
Retrieves the root cause of this NamingException, if any. The root cause of a naming exception is used when the service provider wants to indicate to the caller a non-naming related exception but at the same time wants to use the NamingException structure to indicate how far the naming operation proceeded.This method predates the general-purpose exception chaining facility. The
getCause()
method is now the preferred means of obtaining this information.- Returns:
- The possibly null exception that caused this naming exception. If null, it means no root cause has been set for this naming exception.
- See Also:
-
setRootCause
Records the root cause of this NamingException. Ife
isthis
, 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.- Parameters:
e
- The possibly null exception that caused the naming operation to fail. If null, it means this naming exception has no root cause.- See Also:
-
getCause
Returns the cause of this exception. The cause is the throwable that caused this naming exception to be thrown. Returnsnull
if the cause is nonexistent or unknown. -
initCause
Initializes the cause of this exception to the specified value. The cause is the throwable that caused this naming exception to be thrown.This method may be called at most once.
- Overrides:
initCause
in classThrowable
- Parameters:
cause
- the cause, which is saved for later retrieval by thegetCause()
method. Anull
value indicates that the cause is nonexistent or unknown.- Returns:
- a reference to this
NamingException
instance. - Throws:
IllegalArgumentException
- ifcause
is this exception. (A throwable cannot be its own cause.)IllegalStateException
- if this method has already been called on this exception.- Since:
- 1.4
- See Also:
-
toString
Generates the string representation of this exception. The string representation consists of this exception's class name, its detailed message, and if it has a root cause, the string representation of the root cause exception, followed by the remaining name (if it is not null). This string is used for debugging and not meant to be interpreted programmatically. -
toString
Generates the string representation in more detail. This string representation consists of the information returned by the toString() that takes no parameters, plus the string representation of the resolved object (if it is not null). This string is used for debugging and not meant to be interpreted programmatically.- Parameters:
detail
- If true, include details about the resolved object in addition to the other information.- Returns:
- The non-null string containing the string representation.
-