[ 
https://issues.apache.org/jira/browse/MCHECKSTYLE-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429364#comment-16429364
 ] 

Guillaume Boué commented on MCHECKSTYLE-347:
--------------------------------------------

In addition to this, there could be the case of blank strings like 
{{<checkstyle.violation.ignore>foo, ,bar</checkstyle.violation.ignore>}}. All 
of those should be skipped.

Fixed in 
[8fd6c8bbd26ca02cd7c64057676c9934c99c03bc|https://gitbox.apache.org/repos/asf?p=maven-checkstyle-plugin.git;a=commit;h=8fd6c8bbd26ca02cd7c64057676c9934c99c03bc].

> StringIndexOutOfBoundsException when checkstyle.violation.ignore set to empty 
> value
> -----------------------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-347
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-347
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Sylwester Lachiewicz
>            Priority: Trivial
>
> 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
> {code}
> 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)
> {code}
> Sample code from maven-checkstyle-plugin
> {code}
>   <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>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to