Uploaded image for project: 'Maven Checkstyle Plugin'
  1. Maven Checkstyle Plugin
  2. MCHECKSTYLE-347

StringIndexOutOfBoundsException when checkstyle.violation.ignore set to empty value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 3.0.0
    • 3.1.0
    • None
    • None

    Description

      When i test maven-checkstyle-plugin 3.0.0 and try to disable ignoring checkstyle rules from parent-pom by seting checkstyle.violation.ignore property to empty value
      i got exception

      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check failed: String index out of range: 0
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
          at java.lang.String.charAt (String.java:658)
          at org.apache.maven.plugins.checkstyle.RuleUtil.parseMatchers (RuleUtil.java:117)
          at org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo.countViolations (CheckstyleViolationCheckMojo.java:606)
          at org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo.execute (CheckstyleViolationCheckMojo.java:564)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
      

      Sample code from maven-checkstyle-plugin

        <properties>
          <checkstyle.violation.ignore/>
        </properties>
      
      <plugins>
      <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-checkstyle-plugin</artifactId>
              <version>3.0.0</version>
              <configuration combine.self="override">
                <configLocation>config/maven_checks.xml</configLocation>
                <headerLocation>config/maven-header.txt</headerLocation>
                <testSourceDirectories>${project.testCompileSourceRoots}</testSourceDirectories>
              </configuration>
              <dependencies>
                <dependency>
                  <groupId>org.apache.maven.shared</groupId>
                  <artifactId>maven-shared-resources</artifactId>
                  <version>2</version>
                </dependency>
              </dependencies>
            </plugin>
      </plugins>
      

      Attachments

        Activity

          People

            gboue Guillaume Boué
            slachiewicz Sylwester Lachiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: