Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5097

@parameter using 'property' to allow custom naming convention, throws a NPE if the parameter is defined, but empty.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.3
    • 3.1.0
    • Plugin API
    • None
    • Gentoo Linux, amd64, multicore.

    Description

      The test case (not JUnit) is attached.

      If a Maven plugin runs within Maven 3.0.3, and defines

      /**

      • @parameter property="abc"
        */
        private String somethingDifferentThanAbc;

      public void setAbc(String value) {
      somethingDifferentThanAbc = value;
      }

      Works for non-empty values:
      <abc>abc-value</abc>

      But throws a NPE in
      org.codehaus.plexus.component.configurator.converters.ComponentValueSetter:331
      (fieldTypeConverter is null) with empty values:

      <abc></abc>

      It works in Maven 2.x. It works if you declare the
      property with no naming conventions:

      private String abc;

      As a side note, the plexus classes being used are not the ones declared in the pom, but the ones bundled within $MAVEN_HOME/lib/sisu-inject-plexus-2.1.1.jar.

      I couldn't find sisu-inject-plexus-2.1.1-sources.jar anywhere, but the
      repository itself is fortunately available at

      https://github.com/sonatype/sisu.git

      And then within

      /sisu-inject/containers/guice-plexus/guice-plexus-shim/src/main/java/

      I could have try to post a patch, but I'm not really sure about why this corner case is producing plexus-container's misbehavior.

      Attachments

        1. build.log
          26 kB
          rydnr
        2. empty-string-npe.zip
          4 kB
          rydnr

        Activity

          People

            Unassigned Unassigned
            rydnr rydnr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: