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

NullPointerException in Invodker.toTypeString if arg is null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-6
    • None
    • None

    Description

      The Invoker.toTypeString method blows up with a NullPointerException if one of the arguments is null. The NullPointerException occurs on Invoker.java, line 439:

      argBuf.append(arguments[i].getClass().getName());

      An argument might be null for example if a builder is invoked with a class parameter that either does not exist or has not been imported. For example, a PicoContainerBuidler:

      builder.container()

      { component(class : WhoopsIMadeATypo) }

      The 'WhoopsIMadeATypo' arg shows up as null in the arguments array passed to Invoker.toString. So we get a NullPointerException Invoker.toString, which makes it really hard to figure out the real cause.

      A simple null-check guard would fix this.

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            steve_molitor Stephen Molitor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: