diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/ProcessTask.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/ProcessTask.java index ff7914b69..0c3f807b2 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/ProcessTask.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/ProcessTask.java @@ -1,6 +1,20 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * This file is part of dependency-check-core. + * + * Dependency-check-core is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * Dependency-check-core is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * dependency-check-core. If not, see http://www.gnu.org/licenses/. + * + * Copyright (c) 2013 Jeremy Long. All Rights Reserved. */ package org.owasp.dependencycheck.data.update; @@ -10,7 +24,6 @@ import java.io.IOException; import java.sql.SQLException; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; @@ -26,15 +39,20 @@ import org.owasp.dependencycheck.dependency.VulnerableSoftware; import org.xml.sax.SAXException; /** + * A callable task that will process a given set of NVD CVE xml files and update + * the Cve Database accordingly. * * @author Jeremy Long (jeremy.long@owasp.org) */ public class ProcessTask implements Callable { + /** + * A field to store any update exceptions that occur during the "call". + */ private UpdateException exception = null; /** - * Get the value of exception + * Get the value of exception. * * @return the value of exception */ @@ -43,7 +61,7 @@ public class ProcessTask implements Callable { } /** - * Set the value of exception + * Set the value of exception. * * @param exception new value of exception */ 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 9f7e32e03..ffd8b78ad 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 @@ -20,38 +20,27 @@ package org.owasp.dependencycheck.data.update; import org.owasp.dependencycheck.data.nvdcve.InvalidDataException; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.SAXException; import java.net.MalformedURLException; import java.sql.SQLException; import java.util.Calendar; import java.util.Date; import java.util.HashSet; import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; import org.owasp.dependencycheck.data.UpdateException; import org.owasp.dependencycheck.data.nvdcve.CveDB; import org.owasp.dependencycheck.utils.DownloadFailedException; import org.owasp.dependencycheck.utils.Settings; import org.owasp.dependencycheck.data.nvdcve.DatabaseException; -import org.owasp.dependencycheck.data.nvdcve.NvdCve12Handler; -import org.owasp.dependencycheck.data.nvdcve.NvdCve20Handler; import org.owasp.dependencycheck.utils.InvalidSettingException; import static org.owasp.dependencycheck.data.update.DataStoreMetaInfo.MODIFIED; -import org.owasp.dependencycheck.dependency.VulnerableSoftware; import org.owasp.dependencycheck.utils.FileUtils; /** @@ -173,7 +162,7 @@ public class StandardUpdateTask { if (ctr == 3) { ctr = 0; - Iterator> itr = downloadFutures.iterator(); + final Iterator> itr = downloadFutures.iterator(); while (itr.hasNext()) { final Future future = itr.next(); while (!future.isDone()) { @@ -205,7 +194,7 @@ public class StandardUpdateTask { } try { - Iterator> itr = downloadFutures.iterator(); + final Iterator> itr = downloadFutures.iterator(); while (itr.hasNext()) { final Future future = itr.next(); final CallableDownloadTask filePair = future.get(); @@ -226,7 +215,7 @@ public class StandardUpdateTask { for (Future future : processFutures) { try { - ProcessTask task = future.get(); + final ProcessTask task = future.get(); if (task.getException() != null) { throw task.getException(); } @@ -364,7 +353,7 @@ public class StandardUpdateTask { * @throws UpdateException Is thrown if there is an issue with the last * updated properties file */ - final protected Updateable updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { + protected final Updateable updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException { Updateable updates = null; try { updates = retrieveCurrentTimestampsFromWeb();