From 069474fc71324b937106ba45563ba09043e058e8 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Fri, 9 Oct 2015 07:52:43 -0700 Subject: [PATCH] Consolidated scan(Set) and scan(List) with scan(Collection). --- .../org/owasp/dependencycheck/Engine.java | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java index 58b2712d7..fa120a0e8 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java @@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileFilter; import java.util.ArrayList; +import java.util.Collection; import java.util.EnumMap; import java.util.HashSet; import java.util.Iterator; @@ -174,8 +175,7 @@ public class Engine implements FileFilter { public List scan(String[] paths) { final List deps = new ArrayList(); for (String path : paths) { - final File file = new File(path); - final List d = scan(file); + final List d = scan(path); if (d != null) { deps.addAll(d); } @@ -215,33 +215,14 @@ public class Engine implements FileFilter { } /** - * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies + * Scans a collection of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies * identified are added to the dependency collection. * * @param files a set of paths to files or directories to be analyzed * @return the list of dependencies scanned * @since v0.3.2.5 */ - public List scan(Set files) { - final List deps = new ArrayList(); - for (File file : files) { - final List d = scan(file); - if (d != null) { - deps.addAll(d); - } - } - return deps; - } - - /** - * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies - * identified are added to the dependency collection. - * - * @param files a set of paths to files or directories to be analyzed - * @return the list of dependencies scanned - * @since v0.3.2.5 - */ - public List scan(List files) { + public List scan(Collection files) { final List deps = new ArrayList(); for (File file : files) { final List d = scan(file);