com.ibm.ws.exception

Class WsException

  1. java.lang.Object
  2. extended byjava.lang.Throwable
  3. extended byjava.lang.Exception
  4. extended bycom.ibm.ws.exception.WsException
All implemented interfaces:
com.ibm.ws.exception.WsNestedException, java.io.Serializable
Direct known subclasses:
WsRuntimeFwException

  1. public class WsException
  2. extends java.lang.Exception
  3. implements com.ibm.ws.exception.WsNestedException
The WsException class is a subclass of java.lang.Exception that provides support for exception chaining semantics that will be available in the 1.4 timeframe. Exceptions that desire to inherit these semantics while running on pre 1.4 JDKs should extend this class.

It should be noted that this class will provide only the exception chaining semantics available in 1.4. This is a subset of all the new functionality introduced in 1.4. Most of that functionality requires support from the JVM that is not available on earlier editions.

Exceptions that subclass this exception only need to add the various constructors and inherit everything else from this class.

See the javadoc for the JDK 1.4 java.lang.Throwable for a full description of the exception chaining functionality.

Note: Since the Application Server only supports JDK 1.4 and newer JDKs, new exceptions should extend java.lang.Exception which supports exception chaining.

See Also:
Serialized Form

Constructor Summary

Constructor and Description
WsException()
Constructs a new WsException with null as its detail message.
WsException(java.lang.String message)
Constructs a new WsException with the specified detail message.
WsException(java.lang.String message,java.lang.Throwable cause)
Constructs a new WsException with the specified detail message and cause.
WsException(java.lang.Throwable cause)
Constructs a new WsException with the specified cause and a detail message of (cause==null ?

Method Summary

Modifier and Type Method and Description
  1. java.lang.Throwable
getCause()
Return the Throwable that is considered the root cause of this WsException.
  1. java.lang.Throwable
initCause(java.lang.Throwable cause)
Initialize the cause field for this WsException to the specified value.
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

WsException

  1. public WsException()
Constructs a new WsException with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause(java.lang.Throwable).

WsException

  1. public WsException(java.lang.String message)
Constructs a new WsException with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause(java.lang.Throwable).
Parameters:
message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.

WsException

  1. public WsException(java.lang.Throwable cause)
Constructs a new WsException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for WsExceptions that are little more than wrappers for other throwables.
Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

WsException

  1. public WsException(java.lang.String message,
  2. java.lang.Throwable cause)
Constructs a new WsException with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated in this WsException's detail message.

Parameters:
message - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Method Detail

getCause

  1. public java.lang.Throwable getCause( )
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 WsException to get thrown.

The Throwable that is returned is either the Throwable supplied via one of the appropriate constructors, or that set via the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means, such as a legacy exception chaining infrastructure.

Specified by:
getCause in interface com.ibm.ws.exception.WsNestedException
Overrides:
getCause in class java.lang.Throwable
Returns:
the Throwable that is the cause of this WsException, or null if the cause is nonexistent or unknown.

initCause

  1. public java.lang.Throwable initCause( java.lang.Throwable cause)
  2. throws java.lang.IllegalStateException
  3. java.lang.IllegalArgumentException
Initialize the cause field for this WsException to the specified value. The cause is the Throwable that caused this WsException to get thrown.

This method can be called at most once. It is generally called from within a constructor that takes a Throwable, or immediately after constructing this 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.

Specified by:
initCause in interface com.ibm.ws.exception.WsNestedException
Overrides:
initCause in class java.lang.Throwable
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 this WsException. An exception cannot be its own cause.
java.lang.IllegalStateException - if this WsException was created with a constructor that specified a cause, or this method has already been called on this object.