org.apache.openjpa.util
Class OpenJPAException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.apache.openjpa.util.OpenJPAException
All Implemented Interfaces:
Serializable, ExceptionInfo
Direct Known Subclasses:
GeneralException, InternalException, StoreException, UnsupportedException, UserException

public abstract class OpenJPAException
extends RuntimeException
implements Serializable, ExceptionInfo

Exception type for all OpenJPA exceptions. Meant to be easily transformed into an appropriate exception at the API layer, since most APIs define their own exception types.

Since:
0.4.0
Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.openjpa.util.ExceptionInfo
GENERAL, INTERNAL, STORE, UNSUPPORTED, USER
 
Constructor Summary
OpenJPAException()
          Default constructor.
OpenJPAException(Localizer.Message msg)
          Constructor; supply message.
OpenJPAException(Localizer.Message msg, Throwable cause)
          Construct with message and cause.
OpenJPAException(String msg)
          Constructor; supply message.
OpenJPAException(String msg, Throwable cause)
          Construct with message and cause.
OpenJPAException(Throwable cause)
          Construct with cause.
 
Method Summary
 Throwable getCause()
          Returns the first Throwable from getNestedThrowables() in order to conform to Throwable.getCause() in Java 1.4+.
 Object getFailedObject()
          The failed object.
 Throwable[] getNestedThrowables()
          The nested throwables.
 int getSubtype()
          Exception subtype.
abstract  int getType()
          Exception type.
 boolean isFatal()
          Whether this error is fatal.
 void printStackTrace()
          Stack.
 void printStackTrace(PrintStream out)
           
 void printStackTrace(PrintWriter out)
           
 OpenJPAException setCause(Throwable nested)
          The first nested throwable.
 OpenJPAException setFailedObject(Object failed)
          The failed object.
 OpenJPAException setFatal(boolean fatal)
          Whether this error is fatal.
 OpenJPAException setNestedThrowables(Throwable[] nested)
          The nested throwables.
 String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.util.ExceptionInfo
getMessage
 

Constructor Detail

OpenJPAException

public OpenJPAException()
Default constructor.


OpenJPAException

public OpenJPAException(String msg)
Constructor; supply message.


OpenJPAException

public OpenJPAException(Localizer.Message msg)
Constructor; supply message.


OpenJPAException

public OpenJPAException(Throwable cause)
Construct with cause.


OpenJPAException

public OpenJPAException(String msg,
                        Throwable cause)
Construct with message and cause.


OpenJPAException

public OpenJPAException(Localizer.Message msg,
                        Throwable cause)
Construct with message and cause.

Method Detail

getType

public abstract int getType()
Exception type.

Specified by:
getType in interface ExceptionInfo

getSubtype

public int getSubtype()
Exception subtype.

Specified by:
getSubtype in interface ExceptionInfo

isFatal

public boolean isFatal()
Whether this error is fatal.

Specified by:
isFatal in interface ExceptionInfo

setFatal

public OpenJPAException setFatal(boolean fatal)
Whether this error is fatal.


getCause

public Throwable getCause()
Returns the first Throwable from getNestedThrowables() in order to conform to Throwable.getCause() in Java 1.4+.

Specified by:
getCause in interface ExceptionInfo
Overrides:
getCause in class Throwable
See Also:
Throwable.getCause()

setCause

public OpenJPAException setCause(Throwable nested)
The first nested throwable.


getNestedThrowables

public Throwable[] getNestedThrowables()
The nested throwables.

Specified by:
getNestedThrowables in interface ExceptionInfo

setNestedThrowables

public OpenJPAException setNestedThrowables(Throwable[] nested)
The nested throwables.


getFailedObject

public Object getFailedObject()
The failed object.

Specified by:
getFailedObject in interface ExceptionInfo

setFailedObject

public OpenJPAException setFailedObject(Object failed)
The failed object.


toString

public String toString()
Overrides:
toString in class Throwable

printStackTrace

public void printStackTrace()
Description copied from interface: ExceptionInfo
Stack.

Specified by:
printStackTrace in interface ExceptionInfo
Overrides:
printStackTrace in class Throwable
See Also:
Throwable.printStackTrace()

printStackTrace

public void printStackTrace(PrintStream out)
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintWriter out)
Overrides:
printStackTrace in class Throwable


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.