Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-53

Plugin descriptor extractor crashes on certain types of Java source files

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4
    • None
    • None
    • Tested with Maven version 2.0.4, and 2.0.x SNAPSHOT.
    • Patch

    Description

      Part of my plugin includes a .java file that contains an annotation type declaration. It looks like this:

      package org.jboss.lang.annotation;

      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.ANNOTATION_TYPE)
      public @interface Inherited {
      }

      When the JavaMojoDescriptorExtractor encounters this file it crashes because of an ArrayIndexOutOfBoundsException. Because the code is trying to access the 1st element of a zero length array. The attached file has a simple fix where the descriptor extractor just ignores any java source file that does not contain a valid class.

      Attachments

        1. maven-plugin-tools-java-MPLUGIN-53-r613932.patch
          2 kB
          Paul Gier
        2. JavaMojoDescriptorExtractor.java
          22 kB
          Paul Gier
        3. JavaMojoDescriptorExtractor.java
          22 kB
          Paul Gier

        Activity

          People

            siveton Siveton Vincent
            pgier Paul Gier
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: