I disagree, use getCause(). Users should see the class as similar to the JDK as much as possible.
See http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_1/org/ap ache/commons/collections/FunctorException.html
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/collections/src/java/org/a pache/commons/collections/FunctorException.java?rev=1.6&view=auto
Looks good. I will go ahead and commit something like the simple version below, with the improvements in FunctorException.
For those keeping score, this change will make us runtime dependency free :-)
Phil
Stephen
----- Original Message ----- From: "Henri Yandell" <[EMAIL PROTECTED]>
Is using the same name as Throwable for getCause() wise?
Won't this lead to times when you can compile on 1.3, and the code won't run on 1.4? (unsure, but it seems likely to me).
I'd suggest getThrowable as with Lang. You know it's supported by the reflection Utils in Lang if someone puts them together, and it keeps things standard.
Hen
On Fri, 9 Jul 2004, Mark R. Diggory wrote:
I suspect that would just look like this, is this adequate for our
needs?
-Mark
/** * A generic exception indicating problems in the math package. * @version $Revision: 1.16 $ $Date: 2004/06/02 00:05:28 $ */ public class MathException extends Exception implements Serializable {
/** Serializable version identifier */ static final long serialVersionUID = -8594613561393443827L;
private Throwable cause = null;
/** * Constructs a MathException */ public MathException() { super(); }
/** * Create an exception with a given error message. * @param message message describing the problem */ public MathException(final String message) { super(message); }
/** * Create an exception with a given error message and root cause. * @param message message describing the problem * @param throwable caught exception causing this problem */ public MathException(final String message, final Throwable
throwable) {
super(message, throwable); this.cause = throwable; }
/** * Create an exception with a given root cause. * @param throwable caught exception causing this problem */ public MathException(final Throwable throwable) { super(); this.cause = throwable; }
/* (non-Javadoc) * @see java.lang.Throwable#getCause() */ public Throwable getCause() { return cause; }
/* (non-Javadoc) * @see java.lang.Throwable#printStackTrace() */ public void printStackTrace() { super.printStackTrace();
if(cause != null) cause.printStackTrace(); }
/* (non-Javadoc) * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) */ public void printStackTrace(PrintStream s) { super.printStackTrace(s);
if(cause != null){ s.print("\n\nCaused By:\n\n"); cause.printStackTrace(s); } }
/* (non-Javadoc) * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) */ public void printStackTrace(PrintWriter s) { super.printStackTrace(s);
if(cause != null){ s.print("\n\nCaused By:\n\n"); cause.printStackTrace(s); } }
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
