public class Throwable extends Object implements Serializable
Error
,
Exception
,
RuntimeException
,
Serialized FormModifier | Constructor and Description |
---|---|
|
Throwable()
Constructs a new instance of this class with its
walkback filled in.
|
|
Throwable(String detailMessage)
Constructs a new instance of this class with its
walkback and message filled in.
|
|
Throwable(String detailMessage,
Throwable throwable)
Constructs a new instance of this class with its
walkback, message and cause filled in.
|
protected |
Throwable(String detailMessage,
Throwable throwable,
boolean enableSuppression,
boolean enableWritableStackTrace)
Constructs a new instance of this class with its walkback, message
and cause filled in.
|
|
Throwable(Throwable throwable)
Constructs a new instance of this class with its
walkback and cause filled in.
|
Modifier and Type | Method and Description |
---|---|
void |
addSuppressed(Throwable exception)
The specified exception is going to be suppressed in order to give priority
to this exception (primary exception) and to be appended to the list of
suppressed exceptions.
|
Throwable |
fillInStackTrace()
Record in the receiver a walkback from the point
where this message was sent.
|
Throwable |
getCause()
Answers the cause of this Throwable, or null if there
is no cause.
|
String |
getLocalizedMessage()
Answers the extra information message which was provided
when the throwable was created.
|
String |
getMessage()
Answers the extra information message which was provided
when the throwable was created.
|
StackTraceElement[] |
getStackTrace()
Answers an array of StackTraceElement.
|
Throwable[] |
getSuppressed()
Returns an array of exceptions suppressed, typically by the automatically
generated code from the try-with-resources statement, in order to give
priority to this exception (primary exception).
|
Throwable |
initCause(Throwable throwable)
Initialize the cause of the receiver.
|
void |
printStackTrace()
Outputs a printable representation of the receiver's
walkback on the System.err stream.
|
void |
printStackTrace(PrintStream err)
Outputs a printable representation of the receiver's
walkback on the stream specified by the argument.
|
void |
printStackTrace(PrintWriter err)
Outputs a printable representation of the receiver's
walkback on the writer specified by the argument.
|
void |
setStackTrace(StackTraceElement[] trace)
Sets the array of StackTraceElements.
|
String |
toString()
Answers a string containing a concise, human-readable
description of the receiver.
|
public Throwable()
public Throwable(String detailMessage)
detailMessage
- String
The detail message for the exception.public Throwable(String detailMessage, Throwable throwable)
detailMessage
- String
The detail message for the exception.throwable
- The cause of this Throwablepublic Throwable(Throwable throwable)
throwable
- The cause of this Throwableprotected Throwable(String detailMessage, Throwable throwable, boolean enableSuppression, boolean enableWritableStackTrace)
detailMessage
- String
The detail message for the exception.throwable
- The cause of this ThrowableenableSuppression
- boolean
enable or disable suppressionenableWritableStackTrace
- boolean
whether the stack trace is writablepublic Throwable fillInStackTrace()
public String getMessage()
public String getLocalizedMessage()
public StackTraceElement[] getStackTrace()
public void setStackTrace(StackTraceElement[] trace)
trace
- The array of StackTraceElementpublic void printStackTrace()
public void printStackTrace(PrintStream err)
err
- PrintStream
The stream to write the walkback on.public void printStackTrace(PrintWriter err)
err
- PrintWriter
The writer to write the walkback on.public String toString()
public Throwable initCause(Throwable throwable)
throwable
- The cause of this ThrowableIllegalArgumentException
- when the cause is the receiverIllegalStateException
- when the cause has already been initializedpublic Throwable getCause()
public final void addSuppressed(Throwable exception)
exception
- Throwable
an exception to be suppressed and added to
the list of suppressed exceptionsIllegalArgumentException
- if exception is this throwable, can't suppress itselfNullPointerException
- if exception is null and there is an exception suppressed beforepublic final Throwable[] getSuppressed()
Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1993, 2023 IBM Corp. and others.