org.rhq.core.util.exception
Class WrappedRemotingException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.rhq.core.util.exception.WrappedRemotingException
All Implemented Interfaces:
Serializable

public class WrappedRemotingException
extends RuntimeException

This class can wrap up an exception in a non-object/serialized form to send to a remote system that might not have the exception class available for deserialization. It extends RuntimeException so it can be thrown as a normal exception to a remote VM without requiring it to be part of a remoting API signature.

Note that most of the RuntimeException methods are overridden by this class to work on the actual exception. However, Throwable.initCause(Throwable), Throwable.fillInStackTrace(), Throwable.getStackTrace() and Throwable.setStackTrace(StackTraceElement[]) will operate on this exception object itself, not of the actual exception. Typically, the use-cases in which this exception object is to be used will not require those methods to be needed.

Author:
John Mazzitelli
See Also:
Serialized Form

Constructor Summary
WrappedRemotingException(ExceptionPackage actualException)
          Constructor for WrappedRemotingException that wraps the actual exception information.
WrappedRemotingException(Severity severity, Throwable throwable)
          Constructor for WrappedRemotingException that takes the actual exception and wraps it in a ExceptionPackage.
WrappedRemotingException(Throwable throwable)
          Constructor for WrappedRemotingException that takes the actual exception and wraps it in a ExceptionPackage.
 
Method Summary
 ExceptionPackage getActualException()
          Returns the actual exception that occurred wrapped in an ExceptionPackage.
 Throwable getCause()
          If the actual exception had a cause, this will return a WrappedRemotingException wrapping the cause's ExceptionPackage.
 String getMessage()
          Returns the message of the actual exception.
 void printStackTrace()
          Prints the stack trace of the actual exception to System.err.
 void printStackTrace(PrintStream s)
          Prints the stack trace of the actual exception.
 void printStackTrace(PrintWriter w)
          Prints the stack trace of the actual exception.
 String toString()
          Returns the ExceptionPackage.toString() of the actual exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrappedRemotingException

public WrappedRemotingException(ExceptionPackage actualException)
                         throws IllegalArgumentException
Constructor for WrappedRemotingException that wraps the actual exception information.

Parameters:
actualException - the actual exception that occurred (must not be null)
Throws:
IllegalArgumentException - if actualException is null

WrappedRemotingException

public WrappedRemotingException(Throwable throwable)
                         throws IllegalArgumentException
Constructor for WrappedRemotingException that takes the actual exception and wraps it in a ExceptionPackage. The severity will be that used by ExceptionPackage.ExceptionPackage(Throwable).

Parameters:
throwable - the actual exception
Throws:
IllegalArgumentException - if throwable is null

WrappedRemotingException

public WrappedRemotingException(Severity severity,
                                Throwable throwable)
                         throws IllegalArgumentException
Constructor for WrappedRemotingException that takes the actual exception and wraps it in a ExceptionPackage. If severity is null, then it will be assigned a default (see ExceptionPackage.ExceptionPackage(Severity, Throwable)).

Parameters:
severity - the severity of the exception (may be null)
throwable - the actual exception
Throws:
IllegalArgumentException - if throwable is null
Method Detail

getActualException

public ExceptionPackage getActualException()
Returns the actual exception that occurred wrapped in an ExceptionPackage.

Returns:
the information about the actual exception that occurred

getMessage

public String getMessage()
Returns the message of the actual exception.

Overrides:
getMessage in class Throwable
Returns:
action exception message

getCause

public Throwable getCause()
If the actual exception had a cause, this will return a WrappedRemotingException wrapping the cause's ExceptionPackage.

Overrides:
getCause in class Throwable
See Also:
Throwable.getCause()

toString

public String toString()
Returns the ExceptionPackage.toString() of the actual exception.

Overrides:
toString in class Throwable
See Also:
Throwable.toString()

printStackTrace

public void printStackTrace()
Prints the stack trace of the actual exception to System.err.

Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintStream s)
Prints the stack trace of the actual exception.

Overrides:
printStackTrace in class Throwable
Parameters:
s - the stream where the stack trace will be written to

printStackTrace

public void printStackTrace(PrintWriter w)
Prints the stack trace of the actual exception.

Overrides:
printStackTrace in class Throwable
Parameters:
w - the writer that will print the stack trace


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.