Hylke van der Schaaf created LANG-1789:
------------------------------------------

             Summary: NPE when generating NoSuchMethodException
                 Key: LANG-1789
                 URL: https://issues.apache.org/jira/browse/LANG-1789
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.reflect.*
    Affects Versions: 3.19.0
            Reporter: Hylke van der Schaaf


When calling MethodUtils.invokeMethod, on an instance that does not have the 
requested Method, a NoSuchMethodException should be called.

But, when one of the parameters to be passed to the method is Null, a 
NullPointerException is thrown when trying to create the NoSuchMethodException.

This is because one of the entries in the parameterTypes method is now null, 
and thus the call to getClass on this parameter fails.

Trace:
{code:java}
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
    at 
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
    at 
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
    at 
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
    at 
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
    at 
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at 
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
    at 
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:727)
    at 
org.apache.commons.lang3.reflect.MethodUtils.requireNonNull(MethodUtils.java:1026)
    at 
org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:837)
    at 
org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:936)
    at 
org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:897) 
{code}
 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to