public static class SerializableThrowable extends Object
Throwable
, including its causes and stack trace. It overrides
#toString
to mimic original Throwable#toString()
so that #printStackTrace
will work as if it is coming from the original exception.
This class is especially useful for logging and testing as the emulated Throwable class does not serialize recursively and does not serialize the stack trace. This class, as an alternative, can be used to transfer the Throwable without losing any of these data, even if the underlying Throwable is not serializable.
Please note that, to get more useful stack traces from client side, this class needs to be used
in conjunction with StackTraceDeobfuscator
.
NOTE: Does not serialize suppressed exceptions to remain compatible with Java 6 and below.
Copyright © 2018. All rights reserved.