From 93e0187129d7ac919a2a366ad75f5f9f7ed4f553 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Tue, 5 May 2015 17:40:26 -0400 Subject: [PATCH] removal of validation suppressions, and resoling of them. Issue #596 --- config/findbugs-exclude.xml | 8 ++++---- config/pmd.xml | 5 +---- .../com/puppycrawl/tools/checkstyle/Main.java | 17 +++++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/config/findbugs-exclude.xml b/config/findbugs-exclude.xml index 9eada5d0f..a1d4247ad 100644 --- a/config/findbugs-exclude.xml +++ b/config/findbugs-exclude.xml @@ -42,11 +42,10 @@ - - + @@ -77,8 +76,9 @@ - + + diff --git a/config/pmd.xml b/config/pmd.xml index 79eaa0e6d..bc2e9d879 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -151,10 +151,7 @@ - - - - + diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java index 1fdef9c27..7c4640e82 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java @@ -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 files = Lists.newLinkedList(); + final List 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. **/