public class ThrowableProxy
extends java.lang.Object
implements java.io.Serializable
A proxy is used to represent a throwable that may not exist in a different class loader or JVM. When an application deserializes a ThrowableProxy, the throwable may not be set, but the throwable's information is preserved in other fields of the proxy like the message and stack trace.
TODO: Move this class to org.apache.logging.log4j.core because it is used from LogEvent.
TODO: Deserialize: Try to rebuild Throwable if the target exception is in this class loader?
Constructor and Description |
---|
ThrowableProxy(java.lang.Throwable throwable)
Constructs the wrapper for the Throwable that includes packaging data.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
void |
formatWrapper(java.lang.StringBuilder sb,
ThrowableProxy cause)
Formats the specified Throwable.
|
void |
formatWrapper(java.lang.StringBuilder sb,
ThrowableProxy cause,
java.util.List<java.lang.String> packages)
Formats the specified Throwable.
|
ThrowableProxy |
getCauseProxy() |
java.lang.String |
getCauseStackTraceAsString()
Format the Throwable that is the cause of this Throwable.
|
java.lang.String |
getCauseStackTraceAsString(java.util.List<java.lang.String> packages)
Format the Throwable that is the cause of this Throwable.
|
int |
getCommonElementCount()
Return the number of elements that are being omitted because they are common with the parent Throwable's stack
trace.
|
org.apache.logging.log4j.core.impl.ExtendedStackTraceElement[] |
getExtendedStackTrace()
Gets the stack trace including packaging information.
|
java.lang.String |
getExtendedStackTraceAsString()
Format the stack trace including packaging information.
|
java.lang.String |
getExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages)
Format the stack trace including packaging information.
|
java.lang.String |
getLocalizedMessage() |
java.lang.String |
getMessage() |
java.lang.String |
getName()
Return the FQCN of the Throwable.
|
java.lang.StackTraceElement[] |
getStackTrace() |
ThrowableProxy[] |
getSuppressedProxies()
Gets proxies for suppressed exceptions.
|
java.lang.String |
getSuppressedStackTrace()
Format the suppressed Throwables.
|
java.lang.Throwable |
getThrowable()
The throwable or null if this object is deserialized from XML or JSON.
|
int |
hashCode() |
java.lang.String |
toString() |
public ThrowableProxy(java.lang.Throwable throwable)
throwable
- The Throwable to wrap, must not be null.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> packages)
sb
- StringBuilder to contain the formatted Throwable.cause
- The Throwable to format.packages
- The List of packages to be suppressed from the trace.public ThrowableProxy getCauseProxy()
public java.lang.String getCauseStackTraceAsString()
public java.lang.String getCauseStackTraceAsString(java.util.List<java.lang.String> packages)
packages
- The List of packages to be suppressed from the trace.public int getCommonElementCount()
public org.apache.logging.log4j.core.impl.ExtendedStackTraceElement[] getExtendedStackTrace()
public java.lang.String getExtendedStackTraceAsString()
public java.lang.String getExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages)
ignorePackages
- List of packages to be ignored in the trace.public java.lang.String getLocalizedMessage()
public java.lang.String getMessage()
public java.lang.String getName()
public java.lang.StackTraceElement[] getStackTrace()
public ThrowableProxy[] getSuppressedProxies()
public java.lang.String getSuppressedStackTrace()
public java.lang.Throwable getThrowable()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object