Fix RegexpMultiline causing exception with default config. #1129

This commit is contained in:
Michal Kordas 2015-05-26 02:20:05 +02:00
parent 0ba72f9767
commit 4e0cb46ae5
3 changed files with 14 additions and 3 deletions

View File

@ -52,9 +52,10 @@
<property name="maximum" value="0"/>
</module>
<module name="RegexpMultiline"/>
<!--
<module name="RegexpHeader"/>
<module name="RegexpMultiline"/>
<module name="UniqueProperties"/>
-->
<module name="TreeWalker">

View File

@ -35,8 +35,11 @@ class DetectorOptions {
private final int compileFlags;
/** Used for reporting violations. */
private final AbstractViolationReporter reporter;
/** Format of the regular expression to check for. */
private String format;
/**
* Format of the regular expression to check for. Default value is pattern that never matches
* any string.
*/
private String format = "$.";
/** The message to report on detection. If blank, then use the format. */
private String message = "";
/** Minimum number of times regular expression should occur in a file. */

View File

@ -112,4 +112,11 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport {
verify(checkConfig, file.getPath(), expected);
}
@Test
public void testDefaultConfiguration() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(RegexpMultilineCheck.class);
final String[] expected = {
};
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
}