*/
public class NvdCveUpdater implements CachedWebDataSource {
-
+
+ /**
+ * The logger
+ */
+ private static final Logger LOGGER = Logger.getLogger(NvdCveUpdater.class.getName());
/**
*
* Downloads the latest NVD CVE XML file from the web and imports it into the current CVE Database.
@@ -44,13 +48,13 @@ public class NvdCveUpdater implements CachedWebDataSource {
task.update();
}
} catch (MalformedURLException ex) {
- Logger.getLogger(NvdCveUpdater.class.getName()).log(Level.WARNING,
+ LOGGER.log(Level.WARNING,
"NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data.");
- Logger.getLogger(NvdCveUpdater.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
} catch (DownloadFailedException ex) {
- Logger.getLogger(NvdCveUpdater.class.getName()).log(Level.WARNING,
+ LOGGER.log(Level.WARNING,
"Unable to download the NVD CVE data, unable to update the data to use the most current data.");
- Logger.getLogger(NvdCveUpdater.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdate.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdate.java
index 930736e9d..3fb7aad68 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdate.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/StandardUpdate.java
@@ -46,7 +46,7 @@ import org.owasp.dependencycheck.utils.Settings;
* @author Jeremy Long
*/
public class StandardUpdate {
-
+ private static final Logger LOGGER = Logger.getLogger(StandardUpdate.class.getName());
/**
* The max thread pool size to use when downloading files.
*/
@@ -104,7 +104,7 @@ public class StandardUpdate {
return;
}
if (maxUpdates > 3) {
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.INFO,
+ LOGGER.log(Level.INFO,
"NVD CVE requires several updates; this could take a couple of minutes.");
}
if (maxUpdates > 0) {
@@ -134,19 +134,19 @@ public class StandardUpdate {
downloadExecutors.shutdownNow();
processExecutor.shutdownNow();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Thread was interrupted during download", ex);
+ LOGGER.log(Level.FINE, "Thread was interrupted during download", ex);
throw new UpdateException("The download was interrupted", ex);
} catch (ExecutionException ex) {
downloadExecutors.shutdownNow();
processExecutor.shutdownNow();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Thread was interrupted during download execution", ex);
+ LOGGER.log(Level.FINE, "Thread was interrupted during download execution", ex);
throw new UpdateException("The execution of the download was interrupted", ex);
}
if (task == null) {
downloadExecutors.shutdownNow();
processExecutor.shutdownNow();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Thread was interrupted during download");
+ LOGGER.log(Level.FINE, "Thread was interrupted during download");
throw new UpdateException("The download was interrupted; unable to complete the update");
} else {
processFutures.add(task);
@@ -161,11 +161,11 @@ public class StandardUpdate {
}
} catch (InterruptedException ex) {
processExecutor.shutdownNow();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Thread was interrupted during processing", ex);
+ LOGGER.log(Level.FINE, "Thread was interrupted during processing", ex);
throw new UpdateException(ex);
} catch (ExecutionException ex) {
processExecutor.shutdownNow();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Execution Exception during process", ex);
+ LOGGER.log(Level.FINE, "Execution Exception during process", ex);
throw new UpdateException(ex);
} finally {
processExecutor.shutdown();
@@ -197,10 +197,10 @@ public class StandardUpdate {
updates = retrieveCurrentTimestampsFromWeb();
} catch (InvalidDataException ex) {
final String msg = "Unable to retrieve valid timestamp from nvd cve downloads page";
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, msg, ex);
+ LOGGER.log(Level.FINE, msg, ex);
throw new DownloadFailedException(msg, ex);
} catch (InvalidSettingException ex) {
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Invalid setting found when retrieving timestamps", ex);
+ LOGGER.log(Level.FINE, "Invalid setting found when retrieving timestamps", ex);
throw new DownloadFailedException("Invalid settings", ex);
}
@@ -233,9 +233,7 @@ public class StandardUpdate {
} catch (NumberFormatException ex) {
final String msg = String.format("Error parsing '%s' '%s' from nvdcve.lastupdated",
DatabaseProperties.LAST_UPDATED_BASE, entry.getId());
- Logger
- .getLogger(StandardUpdate.class
- .getName()).log(Level.FINE, msg, ex);
+ LOGGER.log(Level.FINE, msg, ex);
}
if (currentTimestamp == entry.getTimestamp()) {
entry.setNeedsUpdate(false);
@@ -245,8 +243,8 @@ public class StandardUpdate {
}
} catch (NumberFormatException ex) {
final String msg = "An invalid schema version or timestamp exists in the data.properties file.";
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "", ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, "", ex);
}
}
return updates;
@@ -290,7 +288,7 @@ public class StandardUpdate {
try {
cveDB.close();
} catch (Throwable ignore) {
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINEST, "Error closing the cveDB", ignore);
+ LOGGER.log(Level.FINEST, "Error closing the cveDB", ignore);
}
}
}
@@ -309,7 +307,7 @@ public class StandardUpdate {
cveDB.open();
} catch (DatabaseException ex) {
closeDataStores();
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.FINE, "Database Exception opening databases", ex);
+ LOGGER.log(Level.FINE, "Database Exception opening databases", ex);
throw new UpdateException("Error updating the CPE/CVE data, please see the log file for more details.");
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/CallableDownloadTask.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/CallableDownloadTask.java
index 6a016dd55..0d765fa0d 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/CallableDownloadTask.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/CallableDownloadTask.java
@@ -37,7 +37,11 @@ import org.owasp.dependencycheck.utils.Settings;
* @author Jeremy Long
*/
public class CallableDownloadTask implements Callable> {
-
+
+ /**
+ * The Logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(CallableDownloadTask.class.getName());
/**
* Simple constructor for the callable download task.
*
@@ -172,27 +176,27 @@ public class CallableDownloadTask implements Callable> {
final URL url1 = new URL(nvdCveInfo.getUrl());
final URL url2 = new URL(nvdCveInfo.getOldSchemaVersionUrl());
String msg = String.format("Download Started for NVD CVE - %s", nvdCveInfo.getId());
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.INFO, msg);
+ LOGGER.log(Level.INFO, msg);
try {
Downloader.fetchFile(url1, first);
Downloader.fetchFile(url2, second);
} catch (DownloadFailedException ex) {
msg = String.format("Download Failed for NVD CVE - %s%nSome CVEs may not be reported.", nvdCveInfo.getId());
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, null, ex);
return null;
}
msg = String.format("Download Complete for NVD CVE - %s", nvdCveInfo.getId());
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.INFO, msg);
+ LOGGER.log(Level.INFO, msg);
final ProcessTask task = new ProcessTask(cveDB, this, settings);
return this.processorService.submit(task);
} catch (Throwable ex) {
final String msg = String.format("An exception occurred downloading NVD CVE - %s%nSome CVEs may not be reported.", nvdCveInfo.getId());
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(CallableDownloadTask.class.getName()).log(Level.FINE, "Download Task Failed", ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, "Download Task Failed", ex);
} finally {
Settings.cleanup();
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/ProcessTask.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/ProcessTask.java
index 7ea150b40..8276211f7 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/ProcessTask.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/task/ProcessTask.java
@@ -46,7 +46,11 @@ import org.xml.sax.SAXException;
* @author Jeremy Long
*/
public class ProcessTask implements Callable {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(ProcessTask.class.getName());
/**
* A field to store any update exceptions that occur during the "call".
*/
@@ -154,7 +158,7 @@ public class ProcessTask implements Callable {
*/
private void processFiles() throws UpdateException {
String msg = String.format("Processing Started for NVD CVE - %s", filePair.getNvdCveInfo().getId());
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.INFO, msg);
+ LOGGER.log(Level.INFO, msg);
try {
importXML(filePair.getFirst(), filePair.getSecond());
cveDB.commit();
@@ -177,6 +181,6 @@ public class ProcessTask implements Callable {
filePair.cleanup();
}
msg = String.format("Processing Complete for NVD CVE - %s", filePair.getNvdCveInfo().getId());
- Logger.getLogger(StandardUpdate.class.getName()).log(Level.INFO, msg);
+ LOGGER.log(Level.INFO, msg);
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/xml/NvdCve20Handler.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/xml/NvdCve20Handler.java
index 4c05420bc..3dcaee74f 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/xml/NvdCve20Handler.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/xml/NvdCve20Handler.java
@@ -39,7 +39,11 @@ import org.xml.sax.helpers.DefaultHandler;
* @author Jeremy Long
*/
public class NvdCve20Handler extends DefaultHandler {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(NvdCve20Handler.class.getName());
/**
* the current supported schema version.
*/
@@ -168,8 +172,8 @@ public class NvdCve20Handler extends DefaultHandler {
final float score = Float.parseFloat(nodeText.toString());
vulnerability.setCvssScore(score);
} catch (NumberFormatException ex) {
- Logger.getLogger(NvdCve20Handler.class.getName()).log(Level.SEVERE, "Error parsing CVSS Score.");
- Logger.getLogger(NvdCve20Handler.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.SEVERE, "Error parsing CVSS Score.");
+ LOGGER.log(Level.FINE, null, ex);
}
nodeText = null;
} else if (current.isCVSSAccessVectorNode()) {
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java
index 47848eaed..c0bcbab6b 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java
@@ -36,7 +36,11 @@ import org.owasp.dependencycheck.utils.FileUtils;
* @author Jeremy Long
*/
public class Dependency implements Comparable {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(Dependency.class.getName());
/**
* The actual file path of the dependency on disk.
*/
@@ -480,12 +484,12 @@ public class Dependency implements Comparable {
sha1 = Checksum.getSHA1Checksum(file);
} catch (IOException ex) {
final String msg = String.format("Unable to read '%s' to determine hashes.", file.getName());
- Logger.getLogger(Dependency.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(Dependency.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, null, ex);
} catch (NoSuchAlgorithmException ex) {
final String msg = "Unable to use MD5 of SHA1 checksums.";
- Logger.getLogger(Dependency.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(Dependency.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, null, ex);
}
this.setMd5sum(md5);
this.setSha1sum(sha1);
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
index 9c4d63ec1..4d2d431a4 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/EvidenceCollection.java
@@ -37,7 +37,11 @@ import org.owasp.dependencycheck.utils.UrlStringUtils;
* @author Jeremy Long
*/
public class EvidenceCollection implements Iterable {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(EvidenceCollection.class.getName());
/**
* Used to iterate over highest confidence evidence contained in the collection.
*/
@@ -360,7 +364,7 @@ public class EvidenceCollection implements Iterable {
final List data = UrlStringUtils.extractImportantUrlData(part);
sb.append(' ').append(StringUtils.join(data, ' '));
} catch (MalformedURLException ex) {
- Logger.getLogger(EvidenceCollection.class.getName()).log(Level.FINE, "error parsing " + part, ex);
+ LOGGER.log(Level.FINE, "error parsing " + part, ex);
sb.append(' ').append(part);
}
} else {
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/VulnerableSoftware.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/VulnerableSoftware.java
index ddd041bdb..f822026a3 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/VulnerableSoftware.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/VulnerableSoftware.java
@@ -30,7 +30,11 @@ import org.owasp.dependencycheck.data.cpe.IndexEntry;
* @author Jeremy Long
*/
public class VulnerableSoftware extends IndexEntry implements Serializable, Comparable {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(VulnerableSoftware.class.getName());
/**
* The serial version UID.
*/
@@ -46,8 +50,8 @@ public class VulnerableSoftware extends IndexEntry implements Serializable, Comp
parseName(cpe);
} catch (UnsupportedEncodingException ex) {
final String msg = String.format("Character encoding is unsupported for CPE '%s'.", cpe);
- Logger.getLogger(VulnerableSoftware.class.getName()).log(Level.WARNING, msg);
- Logger.getLogger(VulnerableSoftware.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.WARNING, msg);
+ LOGGER.log(Level.FINE, null, ex);
setName(cpe);
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
index 11e112faf..408bffe2a 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/EscapeTool.java
@@ -28,7 +28,11 @@ import org.apache.commons.lang.StringEscapeUtils;
* @author Jeremy Long
*/
public class EscapeTool {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(EscapeTool.class.getName());
/**
* URL Encodes the provided text.
*
@@ -39,8 +43,8 @@ public class EscapeTool {
try {
return URLEncoder.encode(text, "UTF-8");
} catch (UnsupportedEncodingException ex) {
- Logger.getLogger(EscapeTool.class.getName()).log(Level.WARNING, "UTF-8 is not supported?");
- Logger.getLogger(EscapeTool.class.getName()).log(Level.INFO, null, ex);
+ LOGGER.log(Level.WARNING, "UTF-8 is not supported?");
+ LOGGER.log(Level.INFO, null, ex);
}
return "";
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java
index 5c5a8bee1..76dec55b2 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java
@@ -49,7 +49,11 @@ import org.owasp.dependencycheck.utils.Settings;
* @author Jeremy Long
*/
public class ReportGenerator {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(ReportGenerator.class.getName());
/**
* An enumeration of the report formats.
*/
@@ -208,8 +212,8 @@ public class ReportGenerator {
input = new FileInputStream(f);
} catch (FileNotFoundException ex) {
final String msg = "Unable to generate the report, the report template file could not be found.";
- Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, msg);
- Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.SEVERE, msg);
+ LOGGER.log(Level.FINE, null, ex);
}
} else {
templatePath = "templates/" + templateName + ".vsl";
@@ -244,20 +248,20 @@ public class ReportGenerator {
try {
writer.close();
} catch (IOException ex) {
- Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException ex) {
- Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
try {
reader.close();
} catch (IOException ex) {
- Logger.getLogger(ReportGenerator.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/VelocityLoggerRedirect.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/VelocityLoggerRedirect.java
index 73358e2f6..134c22ce2 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/VelocityLoggerRedirect.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/reporting/VelocityLoggerRedirect.java
@@ -36,7 +36,11 @@ import org.apache.velocity.runtime.log.LogChute;
* @author Steve Springett
*/
public class VelocityLoggerRedirect implements LogChute {
-
+
+ /**
+ * The Logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(VelocityLoggerRedirect.class.getName());
/**
* This will be invoked once by the LogManager.
*
@@ -54,7 +58,7 @@ public class VelocityLoggerRedirect implements LogChute {
* @param message the message to be logged
*/
public void log(int level, String message) {
- Logger.getLogger(Velocity.class.getName()).log(getLevel(level), message);
+ LOGGER.log(getLevel(level), message);
}
/**
@@ -66,7 +70,7 @@ public class VelocityLoggerRedirect implements LogChute {
* @param t a throwable to log
*/
public void log(int level, String message, Throwable t) {
- Logger.getLogger(Velocity.class.getName()).log(getLevel(level), message, t);
+ LOGGER.log(getLevel(level), message, t);
}
/**
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionErrorHandler.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionErrorHandler.java
index d5e2846c6..c19c6876b 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionErrorHandler.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionErrorHandler.java
@@ -29,7 +29,11 @@ import org.xml.sax.SAXParseException;
* @author Jeremy Long
*/
public class SuppressionErrorHandler implements ErrorHandler {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(SuppressionErrorHandler.class.getName());
/**
* Builds a prettier exception message.
*
@@ -65,7 +69,7 @@ public class SuppressionErrorHandler implements ErrorHandler {
*/
@Override
public void warning(SAXParseException ex) throws SAXException {
- Logger.getLogger(SuppressionErrorHandler.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
}
/**
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
index 0075006df..5e3ae8873 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
@@ -40,7 +40,11 @@ import org.xml.sax.XMLReader;
* @author Jeremy Long
*/
public class SuppressionParser {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(SuppressionParser.class.getName());
/**
* JAXP Schema Language. Source: http://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html
*/
@@ -85,16 +89,16 @@ public class SuppressionParser {
return handler.getSuppressionRules();
} catch (ParserConfigurationException ex) {
- Logger.getLogger(SuppressionParser.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
throw new SuppressionParseException(ex);
} catch (SAXException ex) {
- Logger.getLogger(SuppressionParser.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
throw new SuppressionParseException(ex);
} catch (FileNotFoundException ex) {
- Logger.getLogger(SuppressionParser.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
throw new SuppressionParseException(ex);
} catch (IOException ex) {
- Logger.getLogger(SuppressionParser.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
throw new SuppressionParseException(ex);
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Checksum.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
index 7a6526d21..64e358ff7 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
@@ -20,7 +20,11 @@ import java.util.logging.Logger;
*
*/
public final class Checksum {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(Checksum.class.getName());
/**
* Private constructor for a utility class.
*/
@@ -57,7 +61,7 @@ public final class Checksum {
try {
fis.close();
} catch (IOException ex) {
- Logger.getLogger(Checksum.class.getName()).log(Level.FINEST, "Error closing file '" + file.getName() + "'.", ex);
+ LOGGER.log(Level.FINEST, "Error closing file '" + file.getName() + "'.", ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
index f6b6aa873..c9187e0c9 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DBUtils.java
@@ -31,7 +31,11 @@ import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
* @author Jeremy Long
*/
public final class DBUtils {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(DBUtils.class.getName());
/**
* Private constructor for a utility class.
*/
@@ -70,8 +74,7 @@ public final class DBUtils {
try {
statement.close();
} catch (SQLException ex) {
- Logger.getLogger(CveDB.class
- .getName()).log(Level.FINEST, statement.toString(), ex);
+ LOGGER.log(Level.FINEST, statement.toString(), ex);
}
}
}
@@ -86,8 +89,7 @@ public final class DBUtils {
try {
rs.close();
} catch (SQLException ex) {
- Logger.getLogger(CveDB.class
- .getName()).log(Level.FINEST, rs.toString(), ex);
+ LOGGER.log(Level.FINEST, rs.toString(), ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Downloader.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Downloader.java
index 7c08c8bf3..78a1eab78 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Downloader.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Downloader.java
@@ -36,7 +36,11 @@ import java.util.zip.InflaterInputStream;
* @author Jeremy Long
*/
public final class Downloader {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(Downloader.class.getName());
/**
* Private constructor for utility class.
*/
@@ -124,7 +128,7 @@ public final class Downloader {
try {
writer.close();
} catch (Throwable ex) {
- Logger.getLogger(Downloader.class.getName()).log(Level.FINEST,
+ LOGGER.log(Level.FINEST,
"Error closing the writer in Downloader.", ex);
}
}
@@ -132,7 +136,7 @@ public final class Downloader {
try {
reader.close();
} catch (Throwable ex) {
- Logger.getLogger(Downloader.class.getName()).log(Level.FINEST,
+ LOGGER.log(Level.FINEST,
"Error closing the reader in Downloader.", ex);
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java
index ecca59858..164a3aef7 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java
@@ -39,7 +39,11 @@ import org.owasp.dependencycheck.Engine;
* @author Jeremy Long
*/
public final class FileUtils {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(FileUtils.class.getName());
/**
* Bit bucket for non-Windows systems
*/
@@ -87,7 +91,7 @@ public final class FileUtils {
if (!org.apache.commons.io.FileUtils.deleteQuietly(file)) {
success = false;
final String msg = String.format("Failed to delete file: %s; attempting to delete on exit.", file.getPath());
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINE, msg);
+ LOGGER.log(Level.FINE, msg);
file.deleteOnExit();
}
return success;
@@ -188,7 +192,7 @@ public final class FileUtils {
try {
fis = new FileInputStream(archive);
} catch (FileNotFoundException ex) {
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
throw new ExtractionException("Archive file was not found.", ex);
}
zis = new ZipInputStream(new BufferedInputStream(fis));
@@ -217,11 +221,11 @@ public final class FileUtils {
}
bos.flush();
} catch (FileNotFoundException ex) {
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
final String msg = String.format("Unable to find file '%s'.", file.getName());
throw new ExtractionException(msg, ex);
} catch (IOException ex) {
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.FINE, null, ex);
final String msg = String.format("IO Exception while parsing file '%s'.", file.getName());
throw new ExtractionException(msg, ex);
} finally {
@@ -229,7 +233,7 @@ public final class FileUtils {
try {
bos.close();
} catch (IOException ex) {
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
}
@@ -238,13 +242,13 @@ public final class FileUtils {
}
} catch (IOException ex) {
final String msg = String.format("Exception reading archive '%s'.", archive.getName());
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINE, msg, ex);
+ LOGGER.log(Level.FINE, msg, ex);
throw new ExtractionException(msg, ex);
} finally {
try {
zis.close();
} catch (IOException ex) {
- Logger.getLogger(FileUtils.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/LogUtils.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/LogUtils.java
index b5360919d..e7bfc0968 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/LogUtils.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/LogUtils.java
@@ -31,7 +31,11 @@ import java.util.logging.SimpleFormatter;
* @author Jeremy Long
*/
public final class LogUtils {
-
+
+ /**
+ * The logger.
+ */
+ private static final Logger LOGGER = Logger.getLogger(LogUtils.class.getName());
/**
* Private constructor for a utility class.
*/
@@ -59,15 +63,15 @@ public final class LogUtils {
logger.setLevel(Level.FINE);
}
} catch (IOException ex) {
- Logger.getLogger(LogUtils.class.getName()).log(Level.FINE, "IO Error preparing the logger", ex);
+ LOGGER.log(Level.FINE, "IO Error preparing the logger", ex);
} catch (SecurityException ex) {
- Logger.getLogger(LogUtils.class.getName()).log(Level.FINE, "Error preparing the logger", ex);
+ LOGGER.log(Level.FINE, "Error preparing the logger", ex);
} finally {
if (in != null) {
try {
in.close();
} catch (Throwable ex) {
- Logger.getLogger(LogUtils.class.getName()).log(Level.FINEST, "Error closing resource stream", ex);
+ LOGGER.log(Level.FINEST, "Error closing resource stream", ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
index d5b09f641..cec42614e 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
@@ -225,14 +225,14 @@ public final class Settings {
in = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);
props.load(in);
} catch (IOException ex) {
- Logger.getLogger(Settings.class.getName()).log(Level.SEVERE, "Unable to load default settings.");
- Logger.getLogger(Settings.class.getName()).log(Level.FINE, null, ex);
+ LOGGER.log(Level.SEVERE, "Unable to load default settings.");
+ LOGGER.log(Level.FINE, null, ex);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
- Logger.getLogger(Settings.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
}
}
@@ -413,16 +413,16 @@ public final class Settings {
*/
public static File getDataFile(String key) {
final String file = getString(key);
- Logger.getLogger(Settings.class.getName()).log(Level.FINE, String.format("Settings.getDataFile() - file: '%s'", file));
+ LOGGER.log(Level.FINE, String.format("Settings.getDataFile() - file: '%s'", file));
if (file == null) {
return null;
}
if (file.startsWith("[JAR]")) {
- Logger.getLogger(Settings.class.getName()).log(Level.FINE, "Settings.getDataFile() - transforming filename");
+ LOGGER.log(Level.FINE, "Settings.getDataFile() - transforming filename");
final File jarPath = getJarPath();
- Logger.getLogger(Settings.class.getName()).log(Level.FINE, String.format("Settings.getDataFile() - jar file: '%s'", jarPath.toString()));
+ LOGGER.log(Level.FINE, String.format("Settings.getDataFile() - jar file: '%s'", jarPath.toString()));
final File retVal = new File(jarPath, file.substring(6));
- Logger.getLogger(Settings.class.getName()).log(Level.FINE, String.format("Settings.getDataFile() - returning: '%s'", retVal.toString()));
+ LOGGER.log(Level.FINE, String.format("Settings.getDataFile() - returning: '%s'", retVal.toString()));
return retVal;
}
return new File(file);
@@ -439,7 +439,7 @@ public final class Settings {
try {
decodedPath = URLDecoder.decode(jarPath, "UTF-8");
} catch (UnsupportedEncodingException ex) {
- Logger.getLogger(Settings.class.getName()).log(Level.FINEST, null, ex);
+ LOGGER.log(Level.FINEST, null, ex);
}
final File path = new File(decodedPath);
@@ -529,7 +529,7 @@ public final class Settings {
value = Integer.parseInt(Settings.getString(key));
} catch (NumberFormatException ex) {
final String msg = String.format("Could not convert property '%s' to an int.", key);
- Logger.getLogger(Settings.class.getName()).log(Level.FINEST, msg, ex);
+ LOGGER.log(Level.FINEST, msg, ex);
value = defaultValue;
}
return value;