diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileFilterBuilder.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileFilterBuilder.java
index 312b9f9f3..25ee59726 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileFilterBuilder.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileFilterBuilder.java
@@ -24,41 +24,53 @@ import org.apache.commons.io.filefilter.NameFileFilter;
import org.apache.commons.io.filefilter.OrFileFilter;
import org.apache.commons.io.filefilter.SuffixFileFilter;
-import java.io.File;
import java.io.FileFilter;
import java.util.*;
/**
- * Utility class for building useful {@link FileFilter} instances for
+ *
Utility class for building useful {@link FileFilter} instances for
* {@link org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer} implementations. The built filter uses
- * {@link OrFileFilter} to logically OR the given filter conditions.
+ * {@link OrFileFilter} to logically OR the given filter conditions. Example usage:
+ *
+ *
+ * FileFilter filter = FileFilterBuilder.newInstance().addExtensions("jar", "war").build();
+ *
*
* @author Dale Visser
+ * @see Builder pattern
*/
public class FileFilterBuilder {
- public static FileFilterBuilder newInstance(){
+ private Set filenames = new HashSet();
+ private Set extensions = new HashSet();
+ private List fileFilters = new ArrayList();
+
+ /**
+ * Create a new instance and return it. This method is for convenience in using the builder pattern within a single
+ * statement.
+ *
+ * @return a new builder instance
+ */
+ public static FileFilterBuilder newInstance() {
return new FileFilterBuilder();
}
- private Set filenames = new HashSet();
-
/**
* Add to the set of filenames to accept for analysis. Case-sensitivity is assumed.
*
* @param names one or more filenames to accept for analysis
+ * @return this builder
*/
public FileFilterBuilder addFilenames(String... names) {
filenames.addAll(Arrays.asList(names));
return this;
}
- private Set extensions = new HashSet();
-
/**
* Add to the set of file extensions to accept for analysis. Case-insensitivity is assumed.
*
* @param extensions one or more file extensions to accept for analysis
+ * @return this builder
*/
public FileFilterBuilder addExtensions(String... extensions) {
return this.addExtensions(Arrays.asList(extensions));
@@ -68,8 +80,9 @@ public class FileFilterBuilder {
* Add to the set of file extensions to accept for analysis. Case-insensitivity is assumed.
*
* @param extensions one or more file extensions to accept for analysis
+ * @return this builder
*/
- public FileFilterBuilder addExtensions(Iterable extensions){
+ public FileFilterBuilder addExtensions(Iterable extensions) {
for (String extension : extensions) {
// Ultimately, SuffixFileFilter will be used, and the "." needs to be explicit.
this.extensions.add(extension.startsWith(".") ? extension : "." + extension);
@@ -77,12 +90,11 @@ public class FileFilterBuilder {
return this;
}
- private List fileFilters = new ArrayList();
-
/**
* Add to a list of {@link IOFileFilter} instances to consult for whether to accept a file for analysis.
*
* @param filters one or more file filters to consult for whether to accept for analysis
+ * @return this builder
*/
public FileFilterBuilder addFileFilters(IOFileFilter... filters) {
fileFilters.addAll(Arrays.asList(filters));
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java
index 60122969a..f3ea0b0e9 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java
@@ -48,8 +48,7 @@ public final class PomUtils {
*
* @param file the pom.xml file
* @return returns a
- * @throws AnalysisException is thrown if there is an exception extracting or parsing the POM
- * {@link org.owasp.dependencycheck.jaxb.pom.generated.Model} object
+ * @throws AnalysisException is thrown if there is an exception extracting or parsing the POM {@link Model} object
*/
public static Model readPom(File file) throws AnalysisException {
Model model = null;
@@ -78,8 +77,7 @@ public final class PomUtils {
* @param path the path to the pom.xml file within the jar file
* @param jar the jar file to extract the pom from
* @return returns a
- * @throws AnalysisException is thrown if there is an exception extracting or parsing the POM
- * {@link org.owasp.dependencycheck.jaxb.pom.generated.Model} object
+ * @throws AnalysisException is thrown if there is an exception extracting or parsing the POM {@link Model} object
*/
public static Model readPom(String path, JarFile jar) throws AnalysisException {
final ZipEntry entry = jar.getEntry(path);