wrapped exception from Method.invoke()

invoke() method within Class java.lang.reflect.Method may throw InvocationTargetException if the underlying method throws an exception. java1.1 API says,

"Control transfers to the underlying method. If the method completes abruptly by throwing an exception, the exception is placed in an InvocationTargetException and thrown in turn to the caller of invoke. "

Is there a way I can get the original exception info from the underlying method, instead of the uniform InvocationTargetException from invoke()? I want to handle exceptions base on original exception types.

Currently, my solution is changing the underlying method API to RETURN exceptions which are supposed to be thrown.

Any other way, we can do it without touching the underlying method? thanks.

[798 byte] By [wjw_c] at [2007-9-26 3:31:50]
# 1
i just figured out there is a method getTargetException() which is right for this purpose. thanks anyway.
wjw_c at 2007-6-29 11:58:45 > top of Java-index,Desktop,Runtime Environment...