com.opensymphony.xwork
Class XworkException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended bycom.opensymphony.xwork.XworkException
All Implemented Interfaces:
Locatable, Serializable
Direct Known Subclasses:
ConfigurationException, ReferenceResolverException, TypeConversionException

public class XworkException
extends RuntimeException
implements Locatable

A generic runtime exception that optionally contains Location information

Author:
Jason Carreira
See Also:
Serialized Form

Constructor Summary
XworkException()
          Constructs a XworkException with no detail message.
XworkException(String s)
          Constructs a XworkException with the specified detail message.
XworkException(String s, Object target)
          Constructs a XworkException with the specified detail message and target.
XworkException(String s, Throwable cause)
          Constructs a XworkException with the specified detail message and exception cause.
XworkException(String s, Throwable cause, Object target)
          Constructs a XworkException with the specified detail message, cause, and target
XworkException(Throwable cause)
          Constructs a XworkException with the root cause
XworkException(Throwable cause, Object target)
          Constructs a XworkException with the root cause and target
 
Method Summary
 Location getLocation()
          Gets the location of the error, if available
 List getSnippet()
          Gets a source code snippet with the default padding
 List getSnippet(int padding)
          Gets a source code snippet with the default padding
 Throwable getThrowable()
          Deprecated. Use getCause()
 String toString()
          Returns a short description of this throwable object, including the location.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XworkException

public XworkException()
Constructs a XworkException with no detail message.


XworkException

public XworkException(String s)
Constructs a XworkException with the specified detail message.

Parameters:
s - the detail message.

XworkException

public XworkException(String s,
                      Object target)
Constructs a XworkException with the specified detail message and target.

Parameters:
s - the detail message.
target - the target of the exception.

XworkException

public XworkException(Throwable cause)
Constructs a XworkException with the root cause

Parameters:
cause - The wrapped exception

XworkException

public XworkException(Throwable cause,
                      Object target)
Constructs a XworkException with the root cause and target

Parameters:
cause - The wrapped exception
target - The target of the exception

XworkException

public XworkException(String s,
                      Throwable cause)
Constructs a XworkException with the specified detail message and exception cause.

Parameters:
s - the detail message.
cause - the wrapped exception

XworkException

public XworkException(String s,
                      Throwable cause,
                      Object target)
Constructs a XworkException with the specified detail message, cause, and target

Parameters:
s - the detail message.
cause - The wrapped exception
target - The target of the exception
Method Detail

getThrowable

public Throwable getThrowable()
Deprecated. Use getCause()

Gets the underlying cause


getLocation

public Location getLocation()
Gets the location of the error, if available

Specified by:
getLocation in interface Locatable
Returns:
the location

getSnippet

public List getSnippet()
Gets a source code snippet with the default padding


getSnippet

public List getSnippet(int padding)
Gets a source code snippet with the default padding

Parameters:
padding - The amount of lines before and after the error to include

toString

public String toString()
Returns a short description of this throwable object, including the location. If no detailed message is available, it will use the message of the underlying exception if available.

Returns:
a string representation of this Throwable.

XWork Project Page