Whenever calling a var-args method using invokeMethod() of MethodUtils it will throw a NPE if the last parameter value is null.
Example: Given is the following class with var-args method
The following code will work:
But this will throw a NPE:
Further more it is not deterministic which method of the two will be called if the method search of invokeMethod() can not find a single unique match. So the code
might call any of the two methods of MyClass and it might change with each and every invocation. The search is not deterministic due to Class.getMethods () is not deterministic.
I would categorize such a method call as a bug, due to it should not be the intention of the developer to just pick any of the methods. However, debugging such an issue is really hard if the "right" method is called "sometimes" and it can be solved by just doing a sort, which should be no big deal I belive.