mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-25 02:21:28 +01:00
checkstyle corrections
Former-commit-id: c18cb3046e295e5369fbe9ac78fc689167f9a1d3
This commit is contained in:
@@ -1,6 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* To change this template, choose Tools | Templates
|
* This file is part of dependency-check-core.
|
||||||
* and open the template in the editor.
|
*
|
||||||
|
* 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;
|
package org.owasp.dependencycheck.data.update;
|
||||||
|
|
||||||
@@ -10,7 +24,6 @@ import java.io.IOException;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -26,15 +39,20 @@ import org.owasp.dependencycheck.dependency.VulnerableSoftware;
|
|||||||
import org.xml.sax.SAXException;
|
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)
|
* @author Jeremy Long (jeremy.long@owasp.org)
|
||||||
*/
|
*/
|
||||||
public class ProcessTask implements Callable<ProcessTask> {
|
public class ProcessTask implements Callable<ProcessTask> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A field to store any update exceptions that occur during the "call".
|
||||||
|
*/
|
||||||
private UpdateException exception = null;
|
private UpdateException exception = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of exception
|
* Get the value of exception.
|
||||||
*
|
*
|
||||||
* @return the value of exception
|
* @return the value of exception
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +61,7 @@ public class ProcessTask implements Callable<ProcessTask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of exception
|
* Set the value of exception.
|
||||||
*
|
*
|
||||||
* @param exception new value of exception
|
* @param exception new value of exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,38 +20,27 @@ package org.owasp.dependencycheck.data.update;
|
|||||||
|
|
||||||
import org.owasp.dependencycheck.data.nvdcve.InvalidDataException;
|
import org.owasp.dependencycheck.data.nvdcve.InvalidDataException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
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.UpdateException;
|
||||||
import org.owasp.dependencycheck.data.nvdcve.CveDB;
|
import org.owasp.dependencycheck.data.nvdcve.CveDB;
|
||||||
import org.owasp.dependencycheck.utils.DownloadFailedException;
|
import org.owasp.dependencycheck.utils.DownloadFailedException;
|
||||||
import org.owasp.dependencycheck.utils.Settings;
|
import org.owasp.dependencycheck.utils.Settings;
|
||||||
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
|
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 org.owasp.dependencycheck.utils.InvalidSettingException;
|
||||||
import static org.owasp.dependencycheck.data.update.DataStoreMetaInfo.MODIFIED;
|
import static org.owasp.dependencycheck.data.update.DataStoreMetaInfo.MODIFIED;
|
||||||
import org.owasp.dependencycheck.dependency.VulnerableSoftware;
|
|
||||||
import org.owasp.dependencycheck.utils.FileUtils;
|
import org.owasp.dependencycheck.utils.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,7 +162,7 @@ public class StandardUpdateTask {
|
|||||||
if (ctr == 3) {
|
if (ctr == 3) {
|
||||||
ctr = 0;
|
ctr = 0;
|
||||||
|
|
||||||
Iterator<Future<CallableDownloadTask>> itr = downloadFutures.iterator();
|
final Iterator<Future<CallableDownloadTask>> itr = downloadFutures.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
final Future<CallableDownloadTask> future = itr.next();
|
final Future<CallableDownloadTask> future = itr.next();
|
||||||
while (!future.isDone()) {
|
while (!future.isDone()) {
|
||||||
@@ -205,7 +194,7 @@ public class StandardUpdateTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Iterator<Future<CallableDownloadTask>> itr = downloadFutures.iterator();
|
final Iterator<Future<CallableDownloadTask>> itr = downloadFutures.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
final Future<CallableDownloadTask> future = itr.next();
|
final Future<CallableDownloadTask> future = itr.next();
|
||||||
final CallableDownloadTask filePair = future.get();
|
final CallableDownloadTask filePair = future.get();
|
||||||
@@ -226,7 +215,7 @@ public class StandardUpdateTask {
|
|||||||
|
|
||||||
for (Future<ProcessTask> future : processFutures) {
|
for (Future<ProcessTask> future : processFutures) {
|
||||||
try {
|
try {
|
||||||
ProcessTask task = future.get();
|
final ProcessTask task = future.get();
|
||||||
if (task.getException() != null) {
|
if (task.getException() != null) {
|
||||||
throw task.getException();
|
throw task.getException();
|
||||||
}
|
}
|
||||||
@@ -364,7 +353,7 @@ public class StandardUpdateTask {
|
|||||||
* @throws UpdateException Is thrown if there is an issue with the last
|
* @throws UpdateException Is thrown if there is an issue with the last
|
||||||
* updated properties file
|
* updated properties file
|
||||||
*/
|
*/
|
||||||
final protected Updateable updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException {
|
protected final Updateable updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException {
|
||||||
Updateable updates = null;
|
Updateable updates = null;
|
||||||
try {
|
try {
|
||||||
updates = retrieveCurrentTimestampsFromWeb();
|
updates = retrieveCurrentTimestampsFromWeb();
|
||||||
|
|||||||
Reference in New Issue
Block a user