< prev index next >
src/java.base/share/classes/java/lang/Throwable.java
Print this page
@@ -464,10 +464,20 @@
throw new IllegalArgumentException("Self-causation not permitted", this);
this.cause = cause;
return this;
}
+ /*
+ * This is called by readObject of a few exceptions such as
+ * ClassNotFoundException and ExceptionInInitializerError to deserialize
+ * a stream output from an older runtime version where the cause may
+ * have set to null.
+ */
+ final void setCause(Throwable t) {
+ this.cause = t;
+ }
+
/**
* Returns a short description of this throwable.
* The result is the concatenation of:
* <ul>
* <li> the {@linkplain Class#getName() name} of the class of this object
< prev index next >