Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
javax.naming

Class NamingException

java.lang.Object
|
+--java.lang.Throwable
   |
   +--java.lang.Exception
      |
      +--javax.naming.NamingException


public class NamingException

extends Exception

Superclass of all naming Exceptions. Can contain extra information about the root cause of this exception (for example when the original exception was not a subclass of NamingException), the part of the Name that could be resolved (including the Object it resolved to) and the part of the Name that could not be resolved when the exception occured.

Since:Authors:

Field Summary

javax.naming.NameremainingName

If the exception was caused while resolving a Name then this field contains that part of the name that could not be resolved.
javax.naming.NameresolvedName

If the exception was caused while resolving a Name then this field contains that part of the name that could be resolved.
java.lang.ObjectresolvedObj

If the exception was caused while resolving a Name then this field contains the object that part of the name could be resolved to.
java.lang.ThrowablerootException

The root cause of this exception.

Constructor Summary

NamingException()

Creates a new NamingException without a message.
NamingException(java.lang.String msg)

Creates a new NamingException with a detailed message.

Method Summary

voidappendRemainingComponent(java.lang.String name)

Adds the given String to the remainingName field.
voidappendRemainingName(javax.naming.Name name)

Adds the given Name to the remainingName field.
java.lang.StringgetExplanation()

Gets the message given to the constructor or null if no message was given.
javax.naming.NamegetRemainingName()

Gets the part of the name that could not be resolved before this exception happend.
javax.naming.NamegetResolvedName()

Gets the part of the name that could be resolved before this exception happend.
java.lang.ObjectgetResolvedObj()

Gets the Object to which (part of) the name could be resolved before this exception happend.
java.lang.ThrowablegetRootCause()

Gets the root cause field rootException of this Exception.
voidprintStackTrace()

Prints the stacktrace of this exception or of the root cause if not null.
voidprintStackTrace(java.io.PrintStream ps)

Prints the stacktrace of this exception or of the root cause if not null to the given PrintStream.
voidprintStackTrace(java.io.PrintWriter pw)

Prints the stacktrace of this exception or of the root cause if not null to the given PrintWriter.
voidsetRemainingName(javax.naming.Name name)

Sets the part of the name that could be resolved before this exception happend.
voidsetResolvedName(javax.naming.Name name)

Sets the part of the name that could be resolved before this exception happend.
voidsetResolvedObj(java.lang.Object o)

Sets the Object to which (part of) the name could be resolved before this exception happend.
voidsetRootCause(java.lang.Throwable e)

Sets the root cause field rootException of this Exception.
java.lang.StringtoString(boolean objectInfo)

Returns a String representation of this exception and possibly including the part object that could be resolved if the given flag is set to true.
java.lang.StringtoString()

Returns a string representation of this exception.

Field Details

remainingName

protected Name remainingName

If the exception was caused while resolving a Name then this field contains that part of the name that could not be resolved. Field might be null. Set by calling setRemainingName(). The field can be extended by calling appendRemainingName() or appendRemainingComponent(). Can be accessed by calling getRemainingName.


resolvedName

protected Name resolvedName

If the exception was caused while resolving a Name then this field contains that part of the name that could be resolved. Field might be null. Set by calling setResolvedName(). Can be accessed by calling getResolvedName.


resolvedObj

protected Object resolvedObj

If the exception was caused while resolving a Name then this field contains the object that part of the name could be resolved to. Field might be null. Set by calling setResolvedObj(). Can be accessed by calling getResolvedObj.


rootException

protected Throwable rootException

The root cause of this exception. Might be null. Set by calling setRootCause(), can be accessed by calling getRootCause().


Constructor Details

NamingException

public NamingException()

Creates a new NamingException without a message. Does not set any of the rootException, resolvedName, resolvedObj or remainingObject, fields. These fields can be set later.


NamingException

public NamingException(java.lang.String msg)

Creates a new NamingException with a detailed message. Does not set the rootException, resolvedName, resolvedObj or remainingObject, fields. These fields can be set later.

Parameters:

  • msg -

Method Details

appendRemainingComponent

public void appendRemainingComponent(java.lang.String name)

Adds the given String to the remainingName field. Does nothing when name is null or when a InvalidNameException is thrown when adding the component.

Parameters:

  • name -
See Also:


appendRemainingName

public void appendRemainingName(javax.naming.Name name)

Adds the given Name to the remainingName field. Does nothing when name is null or when a InvalidNameException is thrown when adding the name.

Parameters:

  • name -
See Also:


getExplanation

public String getExplanation()

Gets the message given to the constructor or null if no message was given.

See Also:


getRemainingName

public Name getRemainingName()

Gets the part of the name that could not be resolved before this exception happend. Returns the remainingName field of this Exception.


getResolvedName

public Name getResolvedName()

Gets the part of the name that could be resolved before this exception happend. Returns the resolvedName field of this Exception.


getResolvedObj

public Object getResolvedObj()

Gets the Object to which (part of) the name could be resolved before this exception happend. Returns the resolvedObj field of this Exception.


getRootCause

public Throwable getRootCause()

Gets the root cause field rootException of this Exception.


printStackTrace

public void printStackTrace()

Prints the stacktrace of this exception or of the root cause if not null.


printStackTrace

public void printStackTrace(java.io.PrintStream ps)

Prints the stacktrace of this exception or of the root cause if not null to the given PrintStream.

Parameters:

  • ps -

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)

Prints the stacktrace of this exception or of the root cause if not null to the given PrintWriter.

Parameters:

  • pw -

setRemainingName

public void setRemainingName(javax.naming.Name name)

Sets the part of the name that could be resolved before this exception happend. Sets the resolvedName field of this Exception. The field can be extended by calling appendRemainingName() or appendRemainingComponent().

Parameters:

  • name -

setResolvedName

public void setResolvedName(javax.naming.Name name)

Sets the part of the name that could be resolved before this exception happend. Sets the resolvedName field of this Exception.

Parameters:

  • name -

setResolvedObj

public void setResolvedObj(java.lang.Object o)

Sets the Object to which (part of) the name could be resolved before this exception happend. Sets the resolvedObj field of this Exception.

Parameters:

  • o -

setRootCause

public void setRootCause(java.lang.Throwable e)

Sets the root cause field rootException of this Exception.

Parameters:

  • e -

toString

public String toString()

Returns a string representation of this exception. Calls toString(false).


toString

public String toString(boolean objectInfo)

Returns a String representation of this exception and possibly including the part object that could be resolved if the given flag is set to true. Always includes the root cause and the remaining name if not null.

Parameters:

  • objectInfo -