Spec-Zone .ru
спецификации, руководства, описания, API
JavaTM 2 Platform
Std. Ed. v1.3.1

javax.naming
Class NamingException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--javax.naming.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

public class NamingException
extends Exception

This is the superclass of all exceptions thrown by operations in the Context and DirContext interfaces. The nature of the failure is described by the name of the subclass. This exception captures the information pinpointing where the operation failed, such as where resolution last proceeded to.

null is an acceptable value for any of these fields. When null, it means that no such information has been recorded for that field.

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.

Since:
1.3
See Also:
Serialized Form

Field Summary
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 Summary
NamingException()
          Constructs a new NamingException.
NamingException(String explanation)
          Constructs a new NamingException with an explanation.
 
Method Summary
 void appendRemainingComponent(String name)
          Add name as the last component in remaining name.
 void appendRemainingName(Name name)
          Add components from 'name' as the last components in remaining name.
 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.
 void printStackTrace()
          Prints this exception's stack trace to System.err.
 void printStackTrace(PrintStream ps)
          Prints this exception's stack trace to a print stream.
 void printStackTrace(PrintWriter pw)
          Prints this exception's stack trace to a print writer.
 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 setRootCause(Throwable e)
          Records that the root cause of this NamingException.
 String toString()
          Generates the string representation of this exception.
 String toString(boolean detail)
          Generates the string representation in more detail.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resolvedName

protected Name 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:
getResolvedName(), setResolvedName(javax.naming.Name)

resolvedObj

protected Object 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:
getResolvedObj(), setResolvedObj(java.lang.Object)

remainingName

protected Name 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:
getRemainingName(), setRemainingName(javax.naming.Name), appendRemainingName(javax.naming.Name), appendRemainingComponent(java.lang.String)

rootException

protected Throwable 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 there original exception could not be mapped to a subclass of NamingException. 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:
getRootCause(), setRootCause(java.lang.Throwable)
Constructor Detail

NamingException

public NamingException(String explanation)
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:
Throwable.getMessage()

NamingException

public NamingException()
Constructs a new NamingException. All fields are set to null.
Method Detail

getResolvedName

public Name 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:
getResolvedObj(), setResolvedName(javax.naming.Name)

getRemainingName

public Name 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:
setRemainingName(javax.naming.Name), appendRemainingName(javax.naming.Name), appendRemainingComponent(java.lang.String)

getResolvedObj

public Object 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:
getResolvedName(), setResolvedObj(java.lang.Object)

getExplanation

public String 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:
Throwable.getMessage()

setResolvedName

public void setResolvedName(Name name)
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 to name does 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:
getResolvedName()

setRemainingName

public void setRemainingName(Name name)
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 to name does 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:
getRemainingName(), appendRemainingName(javax.naming.Name), appendRemainingComponent(java.lang.String)

setResolvedObj

public void setResolvedObj(Object obj)
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:
getResolvedObj()

appendRemainingComponent

public void appendRemainingComponent(String name)
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:
setRemainingName(javax.naming.Name), getRemainingName(), appendRemainingName(javax.naming.Name)

appendRemainingName

public void appendRemainingName(Name name)
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 does 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:
setRemainingName(javax.naming.Name), getRemainingName(), appendRemainingComponent(java.lang.String)

getRootCause

public Throwable 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 want to use the NamingException structure to indicate how far the naming operation proceeded.
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(java.lang.Throwable), rootException

setRootCause

public void setRootCause(Throwable e)
Records that the root cause of this NamingException. If e is this, this method does no do anything.
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:
getRootCause(), rootException

toString

public String 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.
Overrides:
toString in class Throwable
Returns:
The non-null string containing the string representation of this exception.

toString

public String toString(boolean detail)
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.

printStackTrace

public void printStackTrace()
Prints this exception's stack trace to System.err. If this exception has a root exception, the stack trace of the root exception is printed instead.
Overrides:
printStackTrace in class Throwable
Following copied from class: java.lang.Throwable
See Also:
System.err

printStackTrace

public void printStackTrace(PrintStream ps)
Prints this exception's stack trace to a print stream. If this exception has a root exception, the stack trace of the root exception is printed instead.
Overrides:
printStackTrace in class Throwable
Parameters:
ps - The non-null print stream to which to print.

printStackTrace

public void printStackTrace(PrintWriter pw)
Prints this exception's stack trace to a print writer. If this exception has a root exception, the stack trace of the root exception is printed instead.
Overrides:
printStackTrace in class Throwable
Parameters:
pw - The non-null print writer to which to print.

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.

free hit counter