DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=37574>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37574 Summary: [lang] [PATCH] new ExceptionUtils.setCause() method Product: Commons Version: 1.4 Final Platform: Other OS/Version: other Status: NEW Severity: enhancement Priority: P2 Component: Lang AssignedTo: commons-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Hi people, the purpose of the ExceptionUtils.setCause() method I am proposing is to preserve the standard JDK 1.4 exception nesting mechanism even when targeting source code for a prior JDK 1.4 version. ExceptionUtils.setCause(), which can be thought as the counterpart of ExceptionUtils.getCause(), calls via introspection on the target Throwable the 2 following methods: <Object>.setCause(Throwable) <Object>.initCause(Throwable) The typical use of ExceptionUtils.setCause() is inside a constructor, as in the following example: import org.apache.commons.lang.exception.ExceptionUtils; public class MyException extends Exception { public MyException(String msg) { super(msg); } public MyException(String msg, Throwable cause) { super(msg); ExceptionUtils.setCause(this, cause); } } I hope this can be useful for whom who are maintaining code that must be portable on both the JDK 1.3 and JDK 1.4+ environments. Andrea. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]