com.bea.wli.management.runtime
Class WrappedThrowable

java.lang.Object
  extended by com.bea.wli.management.runtime.WrappedThrowable
All Implemented Interfaces:
Serializable

public class WrappedThrowable
extends Object
implements Serializable

Wraps an exception that was thrown on the server so that information about the exception can be obtained by any client without having to worry about whether the original exception is in the classpath of the caller. This is required if an exception thrown on the server is not necessarily on clients classpath. Such Throwables are wrapped by serializing them into a byte array so that they can be selectively deserialized on the client. If the deserialization of the original exception fails the client can ask for a simpler representation of the original exception that is guaranteed to be on clients classpath. This simple representation has stack trace and exception message of the original throwable

See Also:
Serialized Form

Constructor Summary
WrappedThrowable(Throwable wrappedThrowable, int maxDataSize)
          Constructor for wrapping a throwable.
 
Method Summary
 Throwable getOriginalForm()
          Returns the original (wrapped) throwable.
 String getOriginalThrowableClassName()
          Returns the class name of the wrapped Throwable.
 String getOtherMsgs()
           
 Throwable getSimpleForm()
          Returns a simple representation of the original throwable.
 Throwable getThrowable()
          Returns the original exception if it can be deserialized without errors and if it is not null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedThrowable

public WrappedThrowable(Throwable wrappedThrowable,
                        int maxDataSize)
Constructor for wrapping a throwable.

Parameters:
wrappedThrowable - the throwable to be wrapped
maxDataSize - the maximum size of the serialized representation for the throwable. If the size of the serialized representation exceeds this value the serialized representation will not be kept, and it will be null. Only values that are greater than or equal to 1 are valid
Method Detail

getOtherMsgs

public String getOtherMsgs()

getOriginalThrowableClassName

public String getOriginalThrowableClassName()
Returns the class name of the wrapped Throwable. This method can be used to verify if the original throwable is in the classpath of the caller, before calling getOriginalForm()

Returns:

getOriginalForm

public Throwable getOriginalForm()
                          throws IOException,
                                 ClassNotFoundException
Returns the original (wrapped) throwable. This method should be called only if the class of the wrapped throwable is known to be in the classpath of the caller. The caller should typically call getSimpleForm() to get the alternative simpler representation of this class if the original form could not be obtained due to an exception

Returns:
the original wrapped throwable. Returns null if the original Throwable could not be serialized due to some serialization error.
Throws:
IOException
ClassNotFoundException

getSimpleForm

public Throwable getSimpleForm()
Returns a simple representation of the original throwable. This method should be used if the call to getOriginalForm() has failed because the class of the original Throwable was not on callers classpath.

Returns:
a simple representation of the original throwable.

getThrowable

public Throwable getThrowable()
Returns the original exception if it can be deserialized without errors and if it is not null. Otherwise returns the simple form.