removal of validation suppressions, and resoling of them. Issue #596

This commit is contained in:
Roman Ivanov 2015-05-05 17:40:26 -04:00
parent e121ec185c
commit 93e0187129
3 changed files with 16 additions and 14 deletions

View File

@ -42,11 +42,10 @@
<Class name="com.puppycrawl.tools.checkstyle.api.AuditEvent" />
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED" />
</Match>
<Match>
<!-- till #596 -->
<!-- <Match>
<Class name="com.puppycrawl.tools.checkstyle.Main" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
</Match>-->
<Match>
<!-- till #766 -->
<Class name="com.puppycrawl.tools.checkstyle.checks.indentation.LineWrappingHandler" />
@ -77,8 +76,9 @@
<Bug pattern="NM_CONFUSING" />
</Match>
<Match>
<!-- till #596 -->
<!-- that CLI class so we need system exit code there, but only in main(...) method -->
<Class name="com.puppycrawl.tools.checkstyle.Main" />
<Method name="main" />
<Bug pattern="DM_EXIT" />
</Match>
<Match>

View File

@ -151,10 +151,7 @@
<rule ref="rulesets/java/junit.xml"/>
<rule ref="rulesets/java/logging-jakarta-commons.xml"/>
<rule ref="rulesets/java/logging-java.xml">
<!-- till #596 -->
<exclude name="AvoidPrintStackTrace"/>
</rule>
<rule ref="rulesets/java/logging-java.xml"/>
<rule ref="rulesets/java/logging-java.xml/SystemPrintln">
<properties>
<!-- it is ok to use println in CLI class -->

View File

@ -44,7 +44,8 @@ import org.apache.commons.cli.PosixParser;
/**
* Wrapper command line program for the Checker.
* @author Damian Szczepanik (damianszczepanik@github)
* @author the original author or authors.
*
**/
public final class Main
{
@ -344,19 +345,23 @@ public final class Main
{
// could be replaced with org.apache.commons.io.FileUtils.list() method
// if only we add commons-io library
final List<File> files = Lists.newLinkedList();
final List<File> result = Lists.newLinkedList();
if (node.canRead()) {
if (node.isDirectory()) {
for (File element : node.listFiles()) {
files.addAll(listFiles(element));
final File[] files = node.listFiles();
// listFiles() can return null, so we need to check it
if (files != null) {
for (File element : files) {
result.addAll(listFiles(element));
}
}
}
else if (node.isFile()) {
files.add(node);
result.add(node);
}
}
return files;
return result;
}
/** Prints the usage information. **/