/** * Attempts to recast the exception as other Throwable types. * @return the exception recast as another type if possible, otherwise null. */ protected Throwable getRootException() { Throwable result = getException(); if (result instanceof SAXException) { result = ((SAXException)result).getException(); } if (result instanceof java.lang.reflect.InvocationTargetException) { result = ((java.lang.reflect.InvocationTargetException)result).getTargetException(); } if (result != getException()) { return result; } return null; }
/** * Prints this FOP exception and its backtrace to the specified print stream. * @param stream PrintStream to use for output */ public void printStackTrace(java.io.PrintStream stream) { synchronized (stream) { super.printStackTrace(stream); if (getException() != null) { stream.println(EXCEPTION_SEPARATOR); getException().printStackTrace(stream); } if (getRootException() != null) { stream.println(EXCEPTION_SEPARATOR); getRootException().printStackTrace(stream); } } }
/** * Prints this FOP exception and its backtrace to the standard error stream. */ public void printStackTrace() { synchronized (System.err) { super.printStackTrace(); if (getException() != null) { System.err.println(EXCEPTION_SEPARATOR); getException().printStackTrace(); } if (getRootException() != null) { System.err.println(EXCEPTION_SEPARATOR); getRootException().printStackTrace(); } } }
/** * Prints this FOP exception and its backtrace to the specified print writer. * @param writer PrintWriter to use for output */ public void printStackTrace(java.io.PrintWriter writer) { synchronized (writer) { super.printStackTrace(writer); if (getException() != null) { writer.println(EXCEPTION_SEPARATOR); getException().printStackTrace(writer); } if (getRootException() != null) { writer.println(EXCEPTION_SEPARATOR); getRootException().printStackTrace(writer); } } }