You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Dennis K (JIRA)" <ji...@apache.org> on 2018/03/17 12:28:00 UTC
[jira] [Created] (GROOVY-8514) NullPointerException in class
MissingMethodException
Dennis K created GROOVY-8514:
--------------------------------
Summary: NullPointerException in class MissingMethodException
Key: GROOVY-8514
URL: https://issues.apache.org/jira/browse/GROOVY-8514
Project: Groovy
Issue Type: Bug
Affects Versions: 2.4.14
Reporter: Dennis K
The class {{MissingMethodException}} throws an {{NullPointerException}} on {{getMessage()}} if {{arguments}} are null.
This can happen, if the someone calls {{GroovyScriptEngineImpl.getInterface}} and invokes a method without arguments on that interface. And the method is not defined in the groovy script.
The {{InvocationHandler}} calls the method {{invokeImpl}} with {{null}} as arguments, because the interface method has no arguments. If the Method is not defined in the groovy script. A {{MissingMethodException}} is thrown and catched. Than the following {{NoSuchMethodException(var5.getMessage());}} is thrown. But {{getMessage()}} itself throws an NPE due to {{arguments}} is null.
From the Java Documentation [InvocationHandler|https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/InvocationHandler.html]
{quote}args - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.
{quote}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)