org.apache.commons.jelly.util
Class NestedRuntimeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.apache.commons.jelly.util.NestedRuntimeException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XPathComparator.XPathSortException

public class NestedRuntimeException
extends java.lang.RuntimeException

A RuntimeException which is nested to preserve stack traces. This class allows the following code to be written to convert a regular Exception into a RuntimeException without losing the stack trace.

    try {
        ...
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
 

Version:
$Revision: 1807798 $
Author:
James Strachan
See Also:
Serialized Form

Field Summary
private  java.lang.Throwable cause
          Holds the reference to the exception or error that caused this exception to be thrown.
 
Constructor Summary
NestedRuntimeException(java.lang.String msg, java.lang.Throwable cause)
          Constructs a new NestedRuntimeException with specified detail message and nested Throwable.
NestedRuntimeException(java.lang.Throwable cause)
          Constructs a new NestedRuntimeException with specified nested Throwable.
 
Method Summary
 java.lang.Throwable getCause()
           
 void printStackTrace()
           
 void printStackTrace(java.io.PrintStream out)
           
 void printStackTrace(java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cause

private java.lang.Throwable cause
Holds the reference to the exception or error that caused this exception to be thrown.

Constructor Detail

NestedRuntimeException

public NestedRuntimeException(java.lang.Throwable cause)
Constructs a new NestedRuntimeException with specified nested Throwable.

Parameters:
cause - the exception or error that caused this exception to be thrown

NestedRuntimeException

public NestedRuntimeException(java.lang.String msg,
                              java.lang.Throwable cause)
Constructs a new NestedRuntimeException with specified detail message and nested Throwable.

Parameters:
msg - the error message
cause - the exception or error that caused this exception to be thrown
Method Detail

getCause

public java.lang.Throwable getCause()
Overrides:
getCause in class java.lang.Throwable

printStackTrace

public void printStackTrace()
Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream out)
Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintWriter out)
Overrides:
printStackTrace in class java.lang.Throwable