title: What could cause java.lang.reflect.InvocationTargetException?
body: <p>Well, I've tried to understand and read what could cause it but I just can't get it:</p>
  
  <p>I have this somewhere in my code:</p>
  
  <pre><code> try{
   ..
   m.invoke(testObject);
   ..
   } catch(AssertionError e){
   ...
   } catch(Exception e){
   ..
   }
  </code></pre>
  
  <p>Thing is that, when it tries to invoke some method it throws
   <code>InvocationTargetException</code> instead of some other expected exception (specifically <code>ArrayIndexOutOfBoundsException</code>).
   As I actually know what method is invoked I went straight to this method code and added a try-catch block for the line that suppose to throw  <code>ArrayIndexOutOfBoundsException</code> and it really threw <code>ArrayIndexOutOfBoundsException</code> as expected. Yet when going up it
   somehow changes to <code>InvocationTargetException</code> and in the code above <code>catch(Exception e)</code> 
   e is <code>InvocationTargetException</code> and not <code>ArrayIndexOutOfBoundsException</code>
   as expected.</p>
  
  <p>What could cause such a behavior or how can I check such a thing?</p>