com.ibm.ws.exception

Interface WsNestedException

  • All Known Implementing Classes:
    ComponentDisabledException, ConfigurationError, ConfigurationWarning, RuntimeError, RuntimeWarning, WsEJBException, WsException, WsRuntimeException, WsRuntimeFwException

    Deprecated. 
    - We are now using JDK 1.4 - D200273.1

    public interface WsNestedException
    The WsNestedException interface defines the interface that a WebSphere exception class must implement to obtain the exception chaining semantics that will be available in the JDK 1.4 timeframe. It is intended for usage by Exception subclasses that are constrained to extend an architected exception that does not provide these semantics. Exception classes that are free to extend java.lang.Exception or java.lang.Runtime exceptions should extend the com.ibm.ws.exception.WsException and com.ibm.ws.exception.WsRuntimeException instead.

    Exceptions that implement the WsNestedException interface and do not already contain a legacy exception chaining mechanism must do the following.

    • contain an attribute to maintain a reference to the causing or nested exception. For example private Throwable ivCause; See WsException for a sample.
    • provide the appropriate constructors to allow the specification of a nested exception during construction. This is not absolutely required, but is good practice.
    • provide implementations for the methods defined in this interface. In most cases, the method implementations can be copied directly from WsException, if desired.
    • provide appropriate implementations for the printStackTrace(PrintStream) and printStackTrace(PrintWriter) methods. These implementations can be copied directly from the WsException class.
    Exceptions that already implement a legacy exception chaining mechanism must perform the moral equivalent of the above operations. However, the implementations may vary based on the form of the legacy chaining mechanism.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.Throwable getCause()
      Deprecated. 
      Return the Throwable that is considered the root cause of this WsException.
      java.lang.Throwable initCause(java.lang.Throwable cause)
      Deprecated. 
      Initialize the cause field for this WsNestedException to the specified value.
    • Method Detail

      • getCause

        java.lang.Throwable getCause()
        Deprecated. 
        Return the Throwable that is considered the root cause of this WsException. Null is returned if the root cause is nonexistent or unknown. The root cause is the throwable that caused this WsNestedException to get thrown.

        The Throwable that is returned is either the Throwable supplied via one of the appropriate constructors, that set via the initCause(Throwable) method, or that obtained from the legacy exception chaining mechanism if the class already provides one.

        Returns:
        the Throwable that is the cause of this WsException, or null if the cause is nonexistent or unknown.
      • initCause

        java.lang.Throwable initCause(java.lang.Throwable cause)
                                      throws java.lang.IllegalArgumentException,
                                             java.lang.IllegalStateException
        Deprecated. 
        Initialize the cause field for this WsNestedException to the specified value. The cause is the Throwable that caused this WsNestedException to get thrown.

        For classes that do not implement an exception chaining mechanism, this method can be called at most once. In such a case, it is generally called from within a constructor that takes a Throwable, or immediately after constructing the exception object with a constructor that does not accept a Throwable. Thus, if a constructor that takes Throwable as a parameter is used to construct this object, it cannot be called at all.

        For classes that already implement an exception chaining mechanism, the implementation of this method must provide moral equivalence to the above restrictions. Essentially, a cause is allowed to be specified only once. Once specified it is not allowed to change. The cause cannot be the exception itself.

        Parameters:
        cause - the Throwable which caused this WsException to be thrown. Null is tolerated.
        Returns:
        a reference to this Throwable instance.
        Throws:
        java.lang.IllegalArgumentException - if the specified cause is the same exception as the object this method is being called on. An exception cannot be its own cause.
        java.lang.IllegalStateException - if this WsNestedException was created with a constructor that specified a cause, or this method has already been called on this object.
IBM WebSphere Application ServerTM
Release 9.0