javax.naming

Class NamingException

Implemented Interfaces:
Serializable
Known Direct 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

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:
1.3
See Also:
Serialized Form

Field Summary

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.
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.
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.
protected Throwable
rootException
The root cause of this exception.

Constructor Summary

NamingException()
Creates a new NamingException without a message.
NamingException(String msg)
Creates a new NamingException with a detailed message.

Method Summary

void
appendRemainingComponent(String name)
Adds the given String to the remainingName field.
void
appendRemainingName(Name name)
Adds the given Name to the remainingName field.
String
getExplanation()
Gets the message given to the constructor or null if no message was given.
Name
getRemainingName()
Gets the part of the name that could not be resolved before this exception happend.
Name
getResolvedName()
Gets the part of the name that could be resolved before this exception happend.
Object
getResolvedObj()
Gets the Object to which (part of) the name could be resolved before this exception happend.
Throwable
getRootCause()
Gets the root cause field rootException of this Exception.
void
printStackTrace()
Prints the stacktrace of this exception or of the root cause if not null.
void
printStackTrace(PrintStream ps)
Prints the stacktrace of this exception or of the root cause if not null to the given PrintStream.
void
printStackTrace(PrintWriter pw)
Prints the stacktrace of this exception or of the root cause if not null to the given PrintWriter.
void
setRemainingName(Name name)
Sets the part of the name that could be resolved before this exception happend.
void
setResolvedName(Name name)
Sets the part of the name that could be resolved before this exception happend.
void
setResolvedObj(Object o)
Sets the Object to which (part of) the name could be resolved before this exception happend.
void
setRootCause(Throwable e)
Sets the root cause field rootException of this Exception.
String
toString()
Returns a string representation of this exception.
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.

Methods inherited from class java.lang.Throwable

fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

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(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.

Method Details

appendRemainingComponent

public void appendRemainingComponent(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.

appendRemainingName

public void appendRemainingName(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.

getExplanation

public String getExplanation()
Gets the message given to the constructor or null if no message was given.

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.
Overrides:
printStackTrace in interface Throwable

printStackTrace

public void printStackTrace(PrintStream ps)
Prints the stacktrace of this exception or of the root cause if not null to the given PrintStream.
Overrides:
printStackTrace in interface Throwable

printStackTrace

public void printStackTrace(PrintWriter pw)
Prints the stacktrace of this exception or of the root cause if not null to the given PrintWriter.
Overrides:
printStackTrace in interface Throwable

setRemainingName

public void setRemainingName(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().

setResolvedName

public void setResolvedName(Name name)
Sets the part of the name that could be resolved before this exception happend. Sets the resolvedName field of this Exception.

setResolvedObj

public void setResolvedObj(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.

setRootCause

public void setRootCause(Throwable e)
Sets the root cause field rootException of this Exception.

toString

public String toString()
Returns a string representation of this exception. Calls toString(false).
Overrides:
toString in interface Throwable

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.

NamingException.java -- Superclass of all naming Exceptions Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.