public class ReportedException extends java.lang.RuntimeException
It is used to capture more information about an exception that was already thrown.
BugReport
,
Serialized FormModifier and Type | Class and Description |
---|---|
private class |
ReportedException.CauseTraceIterator
Iterates over the causes for this exception.
|
private static class |
ReportedException.Section |
private static class |
ReportedException.SectionEntry |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Thread,java.lang.StackTraceElement[]> |
allStackTraces
We capture all stack traces on exception creation.
|
private java.lang.Thread |
caughtOnThread |
private static int |
MAX_COLLECTION_ENTRIES
How many entries of a collection to include in the bug report.
|
private java.lang.String |
methodWarningFrom |
private java.util.LinkedList<ReportedException.Section> |
sections |
private static long |
serialVersionUID |
Constructor and Description |
---|
ReportedException(java.lang.Throwable exception)
Constructs a new
ReportedException . |
ReportedException(java.lang.Throwable exception,
java.lang.Thread caughtOnThread)
Constructs a new
ReportedException . |
Modifier and Type | Method and Description |
---|---|
private static boolean |
hasSameStackTrace(ReportedException.CauseTraceIterator causeTraceIterator,
java.lang.Throwable e2) |
boolean |
isOutOfMemory()
Check if this is caused by an out of memory situaition
|
boolean |
isSame(ReportedException e)
Checks if this exception is considered the same as an other exception.
|
private static java.lang.String |
makeCollectionNice(java.util.Collection<?> value) |
boolean |
mayHaveConcurrentSource()
Check if this exception may be caused by a threading issue.
|
private static java.lang.String |
niceThreadName(java.lang.Thread thread) |
void |
printReportDataTo(java.io.PrintWriter out)
Prints the captured data of this report to a
PrintWriter . |
void |
printReportStackTo(java.io.PrintWriter out)
Prints the stack trace of this report to a
PrintWriter . |
void |
printReportThreadsTo(java.io.PrintWriter out)
Prints the stack traces for other threads of this report to a
PrintWriter . |
ReportedException |
put(java.lang.String key,
java.lang.Object value)
Adds some debug values to this exception.
|
ReportedException |
put(java.lang.String key,
java.util.function.Supplier<java.lang.Object> valueSupplier)
Adds some debug values to this exception.
|
void |
startSection(java.lang.String sectionName)
Starts a new debug data section.
|
java.lang.String |
toString() |
void |
warn()
Displays a warning for this exception.
|
private static final int MAX_COLLECTION_ENTRIES
private static final long serialVersionUID
private final transient java.util.Map<java.lang.Thread,java.lang.StackTraceElement[]> allStackTraces
private final java.util.LinkedList<ReportedException.Section> sections
private final transient java.lang.Thread caughtOnThread
private java.lang.String methodWarningFrom
public ReportedException(java.lang.Throwable exception)
ReportedException
.exception
- the cause (which is saved for later retrieval by the Throwable.getCause()
method)public ReportedException(java.lang.Throwable exception, java.lang.Thread caughtOnThread)
ReportedException
.exception
- the cause (which is saved for later retrieval by the Throwable.getCause()
method)caughtOnThread
- thread where the exception was caugthpublic void warn()
public void startSection(java.lang.String sectionName)
sectionName
- The section name.public void printReportDataTo(java.io.PrintWriter out)
PrintWriter
.out
- The writer to print to.public void printReportStackTo(java.io.PrintWriter out)
PrintWriter
.out
- The writer to print to.public void printReportThreadsTo(java.io.PrintWriter out)
PrintWriter
.out
- The writer to print to.private static java.lang.String niceThreadName(java.lang.Thread thread)
public boolean isSame(ReportedException e)
e
- The exception to check against.true
if they are considered the same.private static boolean hasSameStackTrace(ReportedException.CauseTraceIterator causeTraceIterator, java.lang.Throwable e2)
public ReportedException put(java.lang.String key, java.lang.Object value)
key
- The key to add this for. Does not need to be unique but it would be nice.value
- The value.public ReportedException put(java.lang.String key, java.util.function.Supplier<java.lang.Object> valueSupplier)
key
- The key to add this for. Does not need to be unique but it would be nice.valueSupplier
- A supplier that is called once to get the value.private static java.lang.String makeCollectionNice(java.util.Collection<?> value)
public java.lang.String toString()
toString
in class java.lang.Throwable
public boolean mayHaveConcurrentSource()
true
if it is.public boolean isOutOfMemory()
true
if it is.