Class ThrowableProxy
- java.lang.Object
-
- org.apache.logging.log4j.core.impl.ThrowableProxy
-
- All Implemented Interfaces:
java.io.Serializable
@Deprecated public class ThrowableProxy extends java.lang.Object implements java.io.SerializableDeprecated.Wraps a Throwable to add packaging information about each stack trace element.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?
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private ThrowableProxycauseProxyDeprecated.private intcommonElementCountDeprecated.(package private) static ThrowableProxy[]EMPTY_ARRAYDeprecated.private static charEOLDeprecated.private static java.lang.StringEOL_STRDeprecated.private ExtendedStackTraceElement[]extendedStackTraceDeprecated.private java.lang.StringlocalizedMessageDeprecated.private java.lang.StringmessageDeprecated.private java.lang.StringnameDeprecated.private static longserialVersionUIDDeprecated.private ThrowableProxy[]suppressedProxiesDeprecated.private java.lang.ThrowablethrowableDeprecated.
-
Constructor Summary
Constructors Modifier Constructor Description (package private)ThrowableProxy()Deprecated.For JSON and XML IO via Jackson.ThrowableProxy(java.lang.Throwable throwable)Deprecated.Constructs the wrapper for the Throwable that includes packaging data.privateThrowableProxy(java.lang.Throwable parent, java.util.Deque<java.lang.Class<?>> stack, java.util.Map<java.lang.String,ThrowableProxyHelper.CacheEntry> map, java.lang.Throwable cause, java.util.Set<java.lang.Throwable> suppressedVisited, java.util.Set<java.lang.Throwable> causeVisited)Deprecated.Constructs the wrapper for a Throwable that is referenced as the cause by another Throwable.(package private)ThrowableProxy(java.lang.Throwable throwable, java.util.Set<java.lang.Throwable> visited)Deprecated.Constructs the wrapper for the Throwable that includes packaging data.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Deprecated.voidformatExtendedStackTraceTo(java.lang.StringBuilder sb, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the stack trace including packaging information.voidformatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.lang.String suffix)Deprecated.Formats the specified Throwable.voidformatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, java.lang.String suffix)Deprecated.Formats the specified Throwable.voidformatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the specified Throwable.voidformatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the specified Throwable.ThrowableProxygetCauseProxy()Deprecated.java.lang.StringgetCauseStackTraceAsString(java.lang.String suffix)Deprecated.Formats the Throwable that is the cause of this Throwable.java.lang.StringgetCauseStackTraceAsString(java.util.List<java.lang.String> packages, java.lang.String suffix)Deprecated.Formats the Throwable that is the cause of this Throwable.java.lang.StringgetCauseStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the Throwable that is the cause of this Throwable.java.lang.StringgetCauseStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the Throwable that is the cause of this Throwable.intgetCommonElementCount()Deprecated.Returns the number of elements that are being omitted because they are common with the parent Throwable's stack trace.ExtendedStackTraceElement[]getExtendedStackTrace()Deprecated.Gets the stack trace including packaging information.java.lang.StringgetExtendedStackTraceAsString()Deprecated.Formats the stack trace including packaging information.java.lang.StringgetExtendedStackTraceAsString(java.lang.String suffix)Deprecated.Formats the stack trace including packaging information.java.lang.StringgetExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, java.lang.String suffix)Deprecated.Formats the stack trace including packaging information.java.lang.StringgetExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the stack trace including packaging information.java.lang.StringgetExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the stack trace including packaging information.java.lang.StringgetLocalizedMessage()Deprecated.java.lang.StringgetMessage()Deprecated.java.lang.StringgetName()Deprecated.Return the FQCN of the Throwable.java.lang.StackTraceElement[]getStackTrace()Deprecated.ThrowableProxy[]getSuppressedProxies()Deprecated.Gets proxies for suppressed exceptions.java.lang.StringgetSuppressedStackTrace(java.lang.String suffix)Deprecated.Formats the suppressed Throwables.java.lang.ThrowablegetThrowable()Deprecated.The throwable or null if this object is deserialized from XML or JSON.inthashCode()Deprecated.(package private) voidsetCommonElementCount(int value)Deprecated.Set the value ofcommonElementCount.java.lang.StringtoString()Deprecated.
-
-
-
Field Detail
-
EOL
private static final char EOL
Deprecated.- See Also:
- Constant Field Values
-
EOL_STR
private static final java.lang.String EOL_STR
Deprecated.
-
serialVersionUID
private static final long serialVersionUID
Deprecated.- See Also:
- Constant Field Values
-
causeProxy
private final ThrowableProxy causeProxy
Deprecated.
-
commonElementCount
private int commonElementCount
Deprecated.
-
extendedStackTrace
private final ExtendedStackTraceElement[] extendedStackTrace
Deprecated.
-
localizedMessage
private final java.lang.String localizedMessage
Deprecated.
-
message
private final java.lang.String message
Deprecated.
-
name
private final java.lang.String name
Deprecated.
-
suppressedProxies
private final ThrowableProxy[] suppressedProxies
Deprecated.
-
throwable
private final transient java.lang.Throwable throwable
Deprecated.
-
EMPTY_ARRAY
static final ThrowableProxy[] EMPTY_ARRAY
Deprecated.
-
-
Constructor Detail
-
ThrowableProxy
ThrowableProxy()
Deprecated.For JSON and XML IO via Jackson.
-
ThrowableProxy
public ThrowableProxy(java.lang.Throwable throwable)
Deprecated.Constructs the wrapper for the Throwable that includes packaging data.- Parameters:
throwable- The Throwable to wrap, must not be null.
-
ThrowableProxy
ThrowableProxy(java.lang.Throwable throwable, java.util.Set<java.lang.Throwable> visited)Deprecated.Constructs the wrapper for the Throwable that includes packaging data.- Parameters:
throwable- The Throwable to wrap, must not be null.visited- The set of visited suppressed exceptions.
-
ThrowableProxy
private ThrowableProxy(java.lang.Throwable parent, java.util.Deque<java.lang.Class<?>> stack, java.util.Map<java.lang.String,ThrowableProxyHelper.CacheEntry> map, java.lang.Throwable cause, java.util.Set<java.lang.Throwable> suppressedVisited, java.util.Set<java.lang.Throwable> causeVisited)Deprecated.Constructs the wrapper for a Throwable that is referenced as the cause by another Throwable.- Parameters:
parent- The Throwable referencing this Throwable.stack- The Class stack.map- The cache containing the packaging data.cause- The Throwable to wrap.suppressedVisited- TODOcauseVisited- TODO
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.- Overrides:
equalsin classjava.lang.Object
-
formatWrapper
public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.lang.String suffix)Deprecated.Formats the specified Throwable.- Parameters:
sb- StringBuilder to contain the formatted Throwable.cause- The Throwable to format.suffix- Append this to the end of each stack frame.
-
formatWrapper
public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, java.lang.String suffix)Deprecated.Formats the specified Throwable.- Parameters:
sb- StringBuilder to contain the formatted Throwable.cause- The Throwable to format.ignorePackages- The List of packages to be suppressed from the trace.suffix- Append this to the end of each stack frame.
-
formatWrapper
public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the specified Throwable.- Parameters:
sb- StringBuilder to contain the formatted Throwable.cause- The Throwable to format.ignorePackages- The List of packages to be suppressed from the stack trace.textRenderer- The text renderer.suffix- Append this to the end of each stack frame.
-
formatWrapper
public void formatWrapper(java.lang.StringBuilder sb, ThrowableProxy cause, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the specified Throwable.- Parameters:
sb- StringBuilder to contain the formatted Throwable.cause- The Throwable to format.ignorePackages- The List of packages to be suppressed from the stack trace.textRenderer- The text renderer.suffix- Append this to the end of each stack frame.lineSeparator- The end-of-line separator.
-
getCauseProxy
public ThrowableProxy getCauseProxy()
Deprecated.
-
getCauseStackTraceAsString
public java.lang.String getCauseStackTraceAsString(java.lang.String suffix)
Deprecated.Formats the Throwable that is the cause of this Throwable.- Parameters:
suffix- Append this to the end of each stack frame.- Returns:
- The formatted Throwable that caused this Throwable.
-
getCauseStackTraceAsString
public java.lang.String getCauseStackTraceAsString(java.util.List<java.lang.String> packages, java.lang.String suffix)Deprecated.Formats the Throwable that is the cause of this Throwable.- Parameters:
packages- The List of packages to be suppressed from the trace.suffix- Append this to the end of each stack frame.- Returns:
- The formatted Throwable that caused this Throwable.
-
getCauseStackTraceAsString
public java.lang.String getCauseStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the Throwable that is the cause of this Throwable.- Parameters:
ignorePackages- The List of packages to be suppressed from the trace.textRenderer- The text renderer.suffix- Append this to the end of each stack frame.- Returns:
- The formatted Throwable that caused this Throwable.
-
getCauseStackTraceAsString
public java.lang.String getCauseStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the Throwable that is the cause of this Throwable.- Parameters:
ignorePackages- The List of packages to be suppressed from the stack trace.textRenderer- The text renderer.suffix- Append this to the end of each stack frame.lineSeparator- The end-of-line separator.- Returns:
- The formatted Throwable that caused this Throwable.
-
getCommonElementCount
public int getCommonElementCount()
Deprecated.Returns the number of elements that are being omitted because they are common with the parent Throwable's stack trace.- Returns:
- The number of elements omitted from the stack trace.
-
setCommonElementCount
void setCommonElementCount(int value)
Deprecated.Set the value ofcommonElementCount. Method is package-private, to be used internally for initialization.- Parameters:
value- New value of commonElementCount.
-
getExtendedStackTrace
public ExtendedStackTraceElement[] getExtendedStackTrace()
Deprecated.Gets the stack trace including packaging information.- Returns:
- The stack trace including packaging information.
-
getExtendedStackTraceAsString
public java.lang.String getExtendedStackTraceAsString()
Deprecated.Formats the stack trace including packaging information.- Returns:
- The formatted stack trace including packaging information.
-
getExtendedStackTraceAsString
public java.lang.String getExtendedStackTraceAsString(java.lang.String suffix)
Deprecated.Formats the stack trace including packaging information.- Parameters:
suffix- Append this to the end of each stack frame.- Returns:
- The formatted stack trace including packaging information.
-
getExtendedStackTraceAsString
public java.lang.String getExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, java.lang.String suffix)Deprecated.Formats the stack trace including packaging information.- Parameters:
ignorePackages- List of packages to be ignored in the trace.suffix- Append this to the end of each stack frame.- Returns:
- The formatted stack trace including packaging information.
-
getExtendedStackTraceAsString
public java.lang.String getExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix)Deprecated.Formats the stack trace including packaging information.- Parameters:
ignorePackages- List of packages to be ignored in the trace.textRenderer- The message renderer.suffix- Append this to the end of each stack frame.- Returns:
- The formatted stack trace including packaging information.
-
getExtendedStackTraceAsString
public java.lang.String getExtendedStackTraceAsString(java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the stack trace including packaging information.- Parameters:
ignorePackages- List of packages to be ignored in the trace.textRenderer- The message renderer.suffix- Append this to the end of each stack frame.lineSeparator- The end-of-line separator.- Returns:
- The formatted stack trace including packaging information.
-
formatExtendedStackTraceTo
public void formatExtendedStackTraceTo(java.lang.StringBuilder sb, java.util.List<java.lang.String> ignorePackages, TextRenderer textRenderer, java.lang.String suffix, java.lang.String lineSeparator)Deprecated.Formats the stack trace including packaging information.- Parameters:
sb- Destination.ignorePackages- List of packages to be ignored in the trace.textRenderer- The message renderer.suffix- Append this to the end of each stack frame.lineSeparator- The end-of-line separator.
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
Deprecated.
-
getMessage
public java.lang.String getMessage()
Deprecated.
-
getName
public java.lang.String getName()
Deprecated.Return the FQCN of the Throwable.- Returns:
- The FQCN of the Throwable.
-
getStackTrace
public java.lang.StackTraceElement[] getStackTrace()
Deprecated.
-
getSuppressedProxies
public ThrowableProxy[] getSuppressedProxies()
Deprecated.Gets proxies for suppressed exceptions.- Returns:
- proxies for suppressed exceptions.
-
getSuppressedStackTrace
public java.lang.String getSuppressedStackTrace(java.lang.String suffix)
Deprecated.Formats the suppressed Throwables.- Parameters:
suffix- Append this to the end of each stack frame.- Returns:
- The formatted suppressed Throwables.
-
getThrowable
public java.lang.Throwable getThrowable()
Deprecated.The throwable or null if this object is deserialized from XML or JSON.- Returns:
- The throwable or null if this object is deserialized from XML or JSON.
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
-