From 10faef62faa028f8d3624f654b2e64de3ef66dd6 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Tue, 8 Oct 2013 20:59:30 -0400 Subject: [PATCH] checkstyle corrections Former-commit-id: 784b14351589b8d4184e931a2b9bf680af2a7283 --- .../data/update/StandardUpdateTask.java | 2 +- .../dependencycheck/data/update/UpdateTaskFactory.java | 2 +- .../owasp/dependencycheck/data/update/Updateable.java | 10 ++++++++++ .../owasp/dependencycheck/utils/UrlStringUtils.java | 3 ++- .../dependencycheck/data/update/UpdateableTest.java | 6 +++--- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdateTask.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdateTask.java index 290814b45..e65ae98e4 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdateTask.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdateTask.java @@ -276,7 +276,7 @@ public class StandardUpdateTask extends AbstractUpdateTask { private Updateable retrieveCurrentTimestampsFromWeb() throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException { - Updateable updates = new Updateable(); + final Updateable updates = new Updateable(); updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL), Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL), false); diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/UpdateTaskFactory.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/UpdateTaskFactory.java index 82d0d0742..b4bc632e8 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/UpdateTaskFactory.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/UpdateTaskFactory.java @@ -28,7 +28,7 @@ import org.owasp.dependencycheck.utils.DownloadFailedException; * * @author Jeremy Long (jeremy.long@owasp.org) */ -public class UpdateTaskFactory { +public final class UpdateTaskFactory { /** * private constructor for a utility class. diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/Updateable.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/Updateable.java index 9d1c6c5c7..044e1d26a 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/Updateable.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/Updateable.java @@ -40,6 +40,16 @@ public class Updateable implements java.lang.Iterable, Iterator collection = new TreeMap(); + /** + * Returns the collection of NvdCveInfo objects. This method is mainly used + * for testing. + * + * @return the collection of NvdCveInfo objects + */ + protected Map getCollection() { + return collection; + } + /** * Gets whether or not an update is needed. * diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/UrlStringUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/UrlStringUtils.java index 501f2c65e..d34b1bee0 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/UrlStringUtils.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/UrlStringUtils.java @@ -70,7 +70,8 @@ public final class UrlStringUtils { * A listing of domain parts that shold not be used as evidence. Yes, this * is an incomplete list. */ - private static final HashSet IGNORE_LIST = new HashSet(Arrays.asList("www", "com", "org", "gov", "info", "name", "net", "pro", "tel", "mobi", "xxx")); + private static final HashSet IGNORE_LIST = new HashSet( + Arrays.asList("www", "com", "org", "gov", "info", "name", "net", "pro", "tel", "mobi", "xxx")); /** *

Takes a URL, in String format, and adds the important parts of the URL diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/update/UpdateableTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/update/UpdateableTest.java index 09d3ce337..f739c7e98 100644 --- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/update/UpdateableTest.java +++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/update/UpdateableTest.java @@ -130,9 +130,9 @@ public class UpdateableTest { String url = "file:///" + f.getCanonicalPath(); Updateable instance = new Updateable(); instance.add(id, url, url, false); - assertFalse(instance.collection.isEmpty()); + assertFalse(instance.getCollection().isEmpty()); instance.clear(); - assertTrue(instance.collection.isEmpty()); + assertTrue(instance.getCollection().isEmpty()); } /** @@ -155,6 +155,6 @@ public class UpdateableTest { itemsProcessed += 1; } assertEquals(3, itemsProcessed); - assertEquals(2, instance.collection.size()); + assertEquals(2, instance.getCollection().size()); } }