Skip navigation links

Oracle® On Track Communication SDK Documentation
Release 1(1.0)

E20955-01


waggle.core.exceptions
Class XExceptionUtils

java.lang.Object
  extended by waggle.core.exceptions.XExceptionUtils


public final class XExceptionUtils
extends Object

Exception utilities.


Method Summary
static Throwable getCause(Object[] arguments)
          Check if the last argument is an exception of not.
static String getExceptionMessagesAsString(Throwable ex, String separator)
          Return a String made up of an exception's message, followed by the messages of the exception's cause, and its cause, etc.
static XExceptionInfo getInfo(Throwable ex, boolean includeStackTrace)
          Generate an XExceptionInfo object from the specified throwable.
static Throwable getRetryable(Throwable ex)
          Get the root cause of a retryable exception.
static String getStackTraceAsString(Throwable ex)
          Return an Exceptions stack trace as a String.
static boolean isCause(Throwable ex, Class<? extends Throwable> cause)
          Is the cause a reason for the exception.
static boolean isRetryable(Throwable ex)
          Check if the root cause is a retryable exception.
static void printStackTrace(Throwable ex)
          Print the specified exception to System.err using our exception format.
static void printStackTrace(Throwable ex, PrintStream s)
          Print an exception to a PrintStream.
static void printStackTrace(Throwable ex, PrintWriter w)
          This code originates from JDK classes.
static void printStackTraceAsCause(Throwable ex, PrintWriter w, StackTraceElement[] causedTrace)
          This code originates from JDK classes.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

isRetryable

public static boolean isRetryable(Throwable ex)
Check if the root cause is a retryable exception.
Parameters:
ex - The reported Exception.
Returns:
True any of the causing exceptions are retryable.

getRetryable

public static Throwable getRetryable(Throwable ex)
Get the root cause of a retryable exception.
Parameters:
ex - The reported Exception.
Returns:
The retryable or null.

isCause

public static boolean isCause(Throwable ex,
                              Class<? extends Throwable> cause)
Is the cause a reason for the exception.
Parameters:
ex - The exception.
cause - The cause we are looking for.
Returns:
True if the specified cause is a cause.

printStackTrace

public static void printStackTrace(Throwable ex)
Print the specified exception to System.err using our exception format.
Parameters:
ex - The exception to print.

getCause

public static Throwable getCause(Object[] arguments)
Check if the last argument is an exception of not.
Parameters:
arguments - The array of arguments.
Returns:
An exception if the last value in the array is an exception. Null if the last value in the array is not an exception.

getInfo

public static XExceptionInfo getInfo(Throwable ex,
                                     boolean includeStackTrace)
Generate an XExceptionInfo object from the specified throwable.
Parameters:
ex - the throwable
includeStackTrace - True to include the StackTrace. In many environments, the stack trace is considered security-sensitive data, and should not be returned to a client or displayed to a user.
Returns:
the XExceptionInfo object

getStackTraceAsString

public static String getStackTraceAsString(Throwable ex)
Return an Exceptions stack trace as a String.
Parameters:
ex - The exception.
Returns:
The stack trace as a string.

getExceptionMessagesAsString

public static String getExceptionMessagesAsString(Throwable ex,
                                                  String separator)
Return a String made up of an exception's message, followed by the messages of the exception's cause, and its cause, etc. Useful for debug strings.
Parameters:
ex - The original exception.
separator - A string that will separate the messages.
Returns:
The exception string.

printStackTrace

public static void printStackTrace(Throwable ex,
                                   PrintWriter w)
This code originates from JDK classes.
Parameters:
ex - The Exception to print.
w - The Writer to write to.

printStackTrace

public static void printStackTrace(Throwable ex,
                                   PrintStream s)
Print an exception to a PrintStream.
Parameters:
ex - The Exception to print.
s - The PrintStream to write to.

printStackTraceAsCause

public static void printStackTraceAsCause(Throwable ex,
                                          PrintWriter w,
                                          StackTraceElement[] causedTrace)
This code originates from JDK classes.
Parameters:
ex - The Exception to print.
w - The Writer to write to.
causedTrace - The caused stack.

Skip navigation links

Oracle® On Track Communication SDK Documentation
Release 1(1.0)

E20955-01


Copyright © 2011, Oracle and/or its affiliates. All rights reserved.