引起java.lang.reflect.InvocationTargetException的一個可能原因


stackoverflow中有這樣一句話: The reflection layer wraps any exception in an InvocationTargetException, which lets you tell the difference between an exception actually caused by a failure in the reflection call (maybe your argument list wasn't valid, for example) and a failure within the method called

翻譯一下就是: 反射層將所有的異常都包裝在一個InvocationTargetException 中,能使你區分異常的實際上是反射層的引起的一個調用失敗(例如參數列表無效)和調用方法內部的錯誤

大概意思就是這樣,嗯*~*

所以,我查看了invoke參數和調用的方法的參數是否一致,發現一致后,再檢查調用方法內部,有個空指針異常(比較低級的錯誤。。)

問題解決。bingo~

 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM