[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
partial 1.4 Throwable compatiblity
From: |
Colin Walters |
Subject: |
partial 1.4 Throwable compatiblity |
Date: |
Thu, 02 Aug 2001 04:08:15 -0400 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.104 (powerpc-debian-linux-gnu) |
Hello,
What's the word with respect to JDK 1.4 compatibility and Classpath?
Are patches accepted for this yet?
Here's a small patch which implements part of the new 1.4 "chained
exception" facility in the example native code:
--- Throwable.java.~1.1.~ Sun Dec 10 12:42:10 2000
+++ Throwable.java Thu Aug 2 03:47:05 2001
@@ -47,7 +47,8 @@
static final long serialVersionUID = -3042686055658047285L;
private String message = null;
-
+ private Throwable cause;
+
static
{
System.loadLibrary ("runtime");
@@ -66,10 +67,23 @@
*/
public Throwable(String message) {
fillInStackTrace();
+ this.cause = null;
this.message = message;
}
/**
+ * Instantiate this <code>Throwable</code> with another Throwable.
+ * This is used for chained exceptions.
+ *
+ * @param cause The <code>Throwable<code> to wrap.
+ */
+ public Throwable(Throwable cause)
+ {
+ this.cause = cause;
+ message = cause == null ? null : cause.toString();
+ }
+
+ /**
* Get the message associated with this Throwable.
* @return the error message associated with this Throwable.
*/
@@ -123,6 +137,11 @@
printStackTrace0 (w);
}
+ public Throwable getCause()
+ {
+ return cause;
+ }
+
private native void printStackTrace0 (Object stream);
/**
@@ -156,3 +175,9 @@
message = (String)oFields.get("detailMessage", (String)null);
}
}
+
+/*
+ Local Variables:
+ c-file-style: "gnu"
+ End:
+*/
- partial 1.4 Throwable compatiblity,
Colin Walters <=