Renaming Kit.initCauseOrNull into simple Kit.initCause and making it to

return the passed exception to allow usage like:

throw Kit.initCause(new RuntimeException("WRAPPED"), origException);
This commit is contained in:
igor%mir2.org 2004-08-13 23:45:52 +00:00
parent b6ea76c9ef
commit 83a55815ca
2 changed files with 4 additions and 2 deletions

View File

@ -110,8 +110,9 @@ public class Kit
/**
* If initCause methods exists in Throwable, call
* <tt>ex.initCause(cause)</tt> or otherwise do nothing.
* @return The <tt>ex</tt> argument.
*/
public static void initCauseOrIgnore(Throwable ex, Throwable cause)
public static Throwable initCause(Throwable ex, Throwable cause)
{
if (Throwable_initCause != null) {
Object[] args = { cause };
@ -121,6 +122,7 @@ public class Kit
// Ignore any exceptions
}
}
return ex;
}
/**

View File

@ -54,7 +54,7 @@ public class WrappedException extends EvaluatorException
{
super("Wrapped "+exception.toString());
this.exception = exception;
Kit.initCauseOrIgnore(this, exception);
Kit.initCause(this, exception);
Context cx = Context.getCurrentContext();
if (cx!= null) {