You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Marwell (Jira)" <ji...@apache.org> on 2019/12/14 11:50:00 UTC
[jira] [Commented] (MCHECKSTYLE-367) Regexp module fails when "id"
property without a "." is provided
[ https://issues.apache.org/jira/browse/MCHECKSTYLE-367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16996339#comment-16996339 ]
Benjamin Marwell commented on MCHECKSTYLE-367:
----------------------------------------------
[~robertandrewbain] I was not able to reproduce this. Maybe https://issues.apache.org/jira/browse/MCHECKSTYLE-344 fixed this. Can you confirm this?
> Regexp module fails when "id" property without a "." is provided
> ----------------------------------------------------------------
>
> Key: MCHECKSTYLE-367
> URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-367
> Project: Maven Checkstyle Plugin
> Issue Type: Bug
> Components: checkstyle:check
> Affects Versions: 3.0.0
> Reporter: Robert Bain
> Priority: Minor
>
> Using an "id" property without a "." as follows, the following stack trace is produced:
>
> {code:java}
> <module name="Regexp">
> <property name="severity" value="warning" />
> <property name="id" value="wibble" />
> <property name="format" value="(LocalDate(Time)?\.now|new (LocalDate(Time)?|Date(Midnight)?))\(\)" />
> <property name="message" value="Use NuDateService" />
> <property name="illegalPattern" value="true" />
> </module>{code}
> java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 6
> at java.lang.String.checkBoundsBeginEnd (String.java:3116)
> at java.lang.String.substring (String.java:1885)
> at org.apache.maven.plugins.checkstyle.RuleUtil.getCategory (RuleUtil.java:95)
>
> It's pretty clear from [the code|https://github.com/apache/maven-plugins/blob/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java#L95] what's causing the issue.
> Adding a "." to the "id" property resolves things, as follows:
> {code:java}
> <module name="Regexp">
> <property name="severity" value="warning" />
> <property name="id" value="wibble.foo" />
> <property name="format" value="(LocalDate(Time)?\.now|new (LocalDate(Time)?|Date(Midnight)?))\(\)" />
> <property name="message" value="Use NuDateService" />
> <property name="illegalPattern" value="true" />
> </module>{code}
> We now get the message [WARNING] Example.java:[12] (extension) foo: Line matches the illegal pattern 'Use NuDateService'.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)