org.apache.openjpa.util
Class Exceptions

java.lang.Object
  extended by org.apache.openjpa.util.Exceptions
Direct Known Subclasses:
PersistenceExceptions

public class Exceptions
extends Object

Utility methods for externalizing and handling exceptions.

Since:
0.2.5
Author:
Marc Prud'hommeaux

Field Summary
static Throwable[] EMPTY_THROWABLES
           
 
Constructor Summary
Exceptions()
           
 
Method Summary
static void printNestedThrowables(ExceptionInfo e, PrintStream out)
          Print the stack trace of the exception's nested throwables.
static void printNestedThrowables(ExceptionInfo e, PrintWriter out)
          Print the stack trace of the exception's nested throwables.
static Object replaceFailedObject(Object ob)
          Convert the specified failed object into a serializable object for when we are serializing an Exception.
static Throwable[] replaceNestedThrowables(Throwable[] nested)
          Convert the specified throwables into a serialzable array.
static String toString(Collection failed)
          Safely stringify the given objects.
static String toString(ExceptionInfo e)
          Stringify the given exception.
static String toString(Object ob)
          Safely stringify the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_THROWABLES

public static final Throwable[] EMPTY_THROWABLES
Constructor Detail

Exceptions

public Exceptions()
Method Detail

toString

public static String toString(Object ob)
Safely stringify the given object.


toString

public static String toString(Collection failed)
Safely stringify the given objects.


toString

public static String toString(ExceptionInfo e)
Stringify the given exception.


printNestedThrowables

public static void printNestedThrowables(ExceptionInfo e,
                                         PrintStream out)
Print the stack trace of the exception's nested throwables.


printNestedThrowables

public static void printNestedThrowables(ExceptionInfo e,
                                         PrintWriter out)
Print the stack trace of the exception's nested throwables.


replaceFailedObject

public static Object replaceFailedObject(Object ob)
Convert the specified failed object into a serializable object for when we are serializing an Exception. It will try the following:

Parameters:
ob - the object to convert
Returns:
some serialized representation of the object

replaceNestedThrowables

public static Throwable[] replaceNestedThrowables(Throwable[] nested)
Convert the specified throwables into a serialzable array. If any of the nested throwables cannot be serialized, they will be converted into a Exception with the original message.



Copyright © 2006 Apache Software Foundation. All Rights Reserved.