Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Auto Closed
-
3.0.0
-
None
-
None
Description
Using an "id" property without a "." as follows, the following stack trace is produced:
<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>
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 what's causing the issue.
Adding a "." to the "id" property resolves things, as follows:
<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>
We now get the message [WARNING] Example.java:[12] (extension) foo: Line matches the illegal pattern 'Use NuDateService'.
Attachments
Issue Links
- duplicates
-
MCHECKSTYLE-344 StringIndexOutOfBoundsException in RuleUtil
- Closed