You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (JIRA)" <ji...@apache.org> on 2018/01/06 13:35:00 UTC

[jira] [Commented] (MCHECKSTYLE-347) StringIndexOutOfBoundsException when checkstyle.violation.ignore set to empty value

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

Sylwester Lachiewicz commented on MCHECKSTYLE-347:
--------------------------------------------------

In _org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo#countViolations_ 
_RuleUtil.Matcher[] ignores = ( violationIgnore == null ) ? null : RuleUtil.parseMatchers( violationIgnore.split( "," ) );_
can be updated to _violationIgnore == null  || violationIgnore.isEmpty()_


> 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
(v6.4.14#64029)