Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8514

NullPointerException in class MissingMethodException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.14
    • 2.4.15
    • None
    • None

    Description

      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

      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.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              Dennis_K Dennis K
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: