I've attempted to comprehend and read about potential causes, but I just don't get it:
I have the following code
try{
..
m.invoke(testObject);
..
} catch(AssertionError e){
...
} catch(Exception e){
..
}
somewhere:
The problem is that it throws InvocationTargetException rather than the expected exception when it tries to invoke a method (specifically ArrayIndexOutOfBoundsException). Since I already knew what the method was called, I skipped over the method's code and added a try-catch block for the line that was supposed to raise an ArrayIndexOutOfBoundsException; in fact, it did so as expected. But when it rises, it mysteriously transforms into an InvocationTargetException, and in the code above, catch(Exception e), e is actually an InvocationTargetException rather than the anticipated ArrayIndexOutOfBoundsException.
What may result in such behavior, and how can I check for it?