saker.build Documentation TaskDoc JavaDoc
public class ExceptionView implements Externalizable
A view of an exception.

An exception view contains the full information of an exception stack trace and causes, but does not hold any instances of the exceptions. This is generally useful when clients only want to access the stack trace and causes of an exception, but not the actual exception instances.

Sometimes it is not possible to transfer the exceptions over RMI, as the exceptions classes might not be found on the other endpoint. In order to avoid the errors this could cause, and exception view can be transferred, which only holds raw data.

Use create(Throwable) to create a new instance.

Fields
protected static final ExceptionView[]
Singleton empty ExceptionView array.
protected ExceptionView
The cause of the exception.
protected String
The class name of the exception.
protected String
The message of the exception.
protected StackTraceElement[]
The stack trace of the exception.
protected ExceptionView[]
The suppressed exceptions.
Constructors
public
public
Creates a new exception view intialized with the argument throwable.
public
Creates a new exception view by copying the data from the argument.
Methods
public static ExceptionView
Creates a new exception view based on the argument exception.
protected static <T extends ExceptionView> T
createImpl(Throwable e, Function<super Throwable, T> viewcreator)
Creates a new exception view based on the argument exception, using the specified view creator.
public ExceptionView
Gets the cause of the exception.
public String
Gets the class name of the exception.
public String
Gets the message of the exception.
public StackTraceElement[]
Gets the stack trace of the exception.
public ExceptionView[]
Gets the suppressed exceptions of this exception.
public void
Prints the stack trace to System.err.
public void
Prints the stack trace to the specified stream.
public void
Prints the stack trace to the specified stream.
public void
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
public String
Returns a string representation of the object.
public void
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
protected static final ExceptionView[] EMPTY_EXCEPTIONVIEW_ARRAY
Singleton empty ExceptionView array.
The cause of the exception.
The class name of the exception.
protected String message
The message of the exception.
The stack trace of the exception.
The suppressed exceptions.
Creates a new exception view intialized with the argument throwable.

The cause and suppressed exceptions are not initialized.

eThe exception.
NullPointerExceptionIf the exception is null.
Creates a new exception view by copying the data from the argument.

The cause and suppressed exceptions are not copied recursively.

copyThe exception view to copy the attributes from.
NullPointerExceptionIf the argument is null.
Creates a new exception view based on the argument exception.
eThe exception.
The created exception view.
NullPointerExceptionIf the exception is null.
protected static <T extends ExceptionView> T createImpl(Throwable e, Function<super Throwable, T> viewcreator)
Creates a new exception view based on the argument exception, using the specified view creator.
TThe type of the exception view to create.
eThe exception.
viewcreatorThe function to use when creating an exception view.
The created exception view.
Gets the cause of the exception.
The cause.
Gets the class name of the exception.
The class name.
Gets the message of the exception.
The message.
Gets the stack trace of the exception.
The stack trace.
Gets the suppressed exceptions of this exception.
The suppressed exceptions.
public void printStackTrace()
Prints the stack trace to System.err.

The format is the same as Throwable.printStackTrace().

Prints the stack trace to the specified stream.

The format is the same as Throwable.printStackTrace(PrintStream).

psThe output stream for the stack trace.
Prints the stack trace to the specified stream.

The format is the same as Throwable.printStackTrace(PrintWriter).

psThe output stream for the stack trace.
Overridden from: Externalizable
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
inthe stream to read data from in order to restore the object
IOExceptionif I/O errors occur
ClassNotFoundExceptionIf the class for an object being restored cannot be found.
public String toString()
Overridden from: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
a string representation of the object.
public void writeExternal(ObjectOutput out) throws IOException
Overridden from: Externalizable
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
outthe stream to write the object to
IOExceptionIncludes any I/O exceptions that may occur