src/share/classes/java/lang/Throwable.java
Print this page
rev 5703 : [mq]: throwableevent
@@ -25,10 +25,12 @@
package java.lang;
import java.io.*;
import java.util.*;
+import sun.misc.ThrowableTrace;
+
/**
* The {@code Throwable} class is the superclass of all errors and
* exceptions in the Java language. Only objects that are instances of this
* class (or one of its subclasses) are thrown by the Java Virtual Machine or
* can be thrown by the Java {@code throw} statement. Similarly, only
@@ -246,10 +248,11 @@
* <p>The {@link #fillInStackTrace()} method is called to initialize
* the stack trace data in the newly created throwable.
*/
public Throwable() {
fillInStackTrace();
+ ThrowableTrace.traceThrowable(this);
}
/**
* Constructs a new throwable with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
@@ -262,10 +265,11 @@
* later retrieval by the {@link #getMessage()} method.
*/
public Throwable(String message) {
fillInStackTrace();
detailMessage = message;
+ ThrowableTrace.traceThrowable(this);
}
/**
* Constructs a new throwable with the specified detail message and
* cause. <p>Note that the detail message associated with
@@ -285,10 +289,11 @@
*/
public Throwable(String message, Throwable cause) {
fillInStackTrace();
detailMessage = message;
this.cause = cause;
+ ThrowableTrace.traceThrowable(this);
}
/**
* Constructs a new throwable with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())} (which
@@ -308,10 +313,11 @@
*/
public Throwable(Throwable cause) {
fillInStackTrace();
detailMessage = (cause==null ? null : cause.toString());
this.cause = cause;
+ ThrowableTrace.traceThrowable(this);
}
/**
* Constructs a new throwable with the specified detail message,
* cause, {@linkplain #addSuppressed suppression} enabled or
@@ -363,10 +369,11 @@
}
detailMessage = message;
this.cause = cause;
if (!enableSuppression)
suppressedExceptions = null;
+ ThrowableTrace.traceThrowable(this);
}
/**
* Returns the detail message string of this throwable.
*