Invocation Target Exception


The java compiler checks that exceptions thrown by methods called are caught or thrown by the calling method. Because the compiler cannot analyze methods call through reflection, the reflection runtime wraps any errors thrown in the called routines in a predictable exception called the InvocationTargetException.

The framework's exception reporting machinery unwraps these exceptions so as to report the true exceptions thrown by methods called through reflection.

See the source.

 

Last edited October 11, 2002
Return to WelcomeVisitors