mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 09:31:32 +01:00
checkstyle corrections... javadoc, final variables, etc.
Former-commit-id: 87905c8a957efb5b57e1c142eda9e7c2e7312f78
This commit is contained in:
@@ -87,6 +87,7 @@ public class Engine {
|
|||||||
/**
|
/**
|
||||||
* Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services.
|
* Creates a new Engine using the specified classloader to dynamically load Analyzer and Update services.
|
||||||
*
|
*
|
||||||
|
* @param serviceClassLoader the ClassLoader to use when dynamically loading Analyzer and Update services
|
||||||
* @throws DatabaseException thrown if there is an error connecting to the database
|
* @throws DatabaseException thrown if there is an error connecting to the database
|
||||||
*/
|
*/
|
||||||
public Engine(ClassLoader serviceClassLoader) throws DatabaseException {
|
public Engine(ClassLoader serviceClassLoader) throws DatabaseException {
|
||||||
|
|||||||
@@ -17,14 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.owasp.dependencycheck.analyzer;
|
package org.owasp.dependencycheck.analyzer;
|
||||||
|
|
||||||
import org.owasp.dependencycheck.suppression.SuppressionParseException;
|
|
||||||
import org.owasp.dependencycheck.suppression.SuppressionParser;
|
|
||||||
import org.owasp.dependencycheck.suppression.SuppressionRule;
|
|
||||||
import org.owasp.dependencycheck.utils.DownloadFailedException;
|
|
||||||
import org.owasp.dependencycheck.utils.Downloader;
|
|
||||||
import org.owasp.dependencycheck.utils.FileUtils;
|
|
||||||
import org.owasp.dependencycheck.utils.Settings;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -35,6 +27,13 @@ import java.util.Set;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import org.owasp.dependencycheck.suppression.SuppressionParseException;
|
||||||
|
import org.owasp.dependencycheck.suppression.SuppressionParser;
|
||||||
|
import org.owasp.dependencycheck.suppression.SuppressionRule;
|
||||||
|
import org.owasp.dependencycheck.utils.DownloadFailedException;
|
||||||
|
import org.owasp.dependencycheck.utils.Downloader;
|
||||||
|
import org.owasp.dependencycheck.utils.FileUtils;
|
||||||
|
import org.owasp.dependencycheck.utils.Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base suppression analyzer that contains methods for parsing the suppression xml file.
|
* Abstract base suppression analyzer that contains methods for parsing the suppression xml file.
|
||||||
@@ -49,7 +48,6 @@ public abstract class AbstractSuppressionAnalyzer extends AbstractAnalyzer {
|
|||||||
private static final Logger LOGGER = Logger.getLogger(AbstractSuppressionAnalyzer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(AbstractSuppressionAnalyzer.class.getName());
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of file EXTENSIONS supported by this analyzer.
|
* Returns a list of file EXTENSIONS supported by this analyzer.
|
||||||
*
|
*
|
||||||
@@ -60,7 +58,6 @@ public abstract class AbstractSuppressionAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initialize method loads the suppression XML file.
|
* The initialize method loads the suppression XML file.
|
||||||
*
|
*
|
||||||
@@ -121,7 +118,7 @@ public abstract class AbstractSuppressionAnalyzer extends AbstractAnalyzer {
|
|||||||
} else {
|
} else {
|
||||||
file = new File(suppressionFilePath);
|
file = new File(suppressionFilePath);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
InputStream suppressionsFromClasspath = this.getClass().getClassLoader().getResourceAsStream(suppressionFilePath);
|
final InputStream suppressionsFromClasspath = this.getClass().getClassLoader().getResourceAsStream(suppressionFilePath);
|
||||||
if (suppressionsFromClasspath != null) {
|
if (suppressionsFromClasspath != null) {
|
||||||
deleteTempFile = true;
|
deleteTempFile = true;
|
||||||
file = FileUtils.getTempFile("suppression", "xml");
|
file = FileUtils.getTempFile("suppression", "xml");
|
||||||
@@ -160,6 +157,13 @@ public abstract class AbstractSuppressionAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to throw parse exceptions.
|
||||||
|
*
|
||||||
|
* @param message the exception message
|
||||||
|
* @param exception the cause of the exception
|
||||||
|
* @throws SuppressionParseException throws the generated SuppressionParseException
|
||||||
|
*/
|
||||||
private void throwSuppressionParseException(String message, Exception exception) throws SuppressionParseException {
|
private void throwSuppressionParseException(String message, Exception exception) throws SuppressionParseException {
|
||||||
LOGGER.log(Level.WARNING, message);
|
LOGGER.log(Level.WARNING, message);
|
||||||
LOGGER.log(Level.FINE, "", exception);
|
LOGGER.log(Level.FINE, "", exception);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class AnalyzerService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of AnalyzerService.
|
* Creates a new instance of AnalyzerService.
|
||||||
|
*
|
||||||
|
* @param classLoader the ClassLoader to use when dynamically loading Analyzer and Update services
|
||||||
*/
|
*/
|
||||||
public AnalyzerService(ClassLoader classLoader) {
|
public AnalyzerService(ClassLoader classLoader) {
|
||||||
loader = ServiceLoader.load(Analyzer.class, classLoader);
|
loader = ServiceLoader.load(Analyzer.class, classLoader);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class UpdateService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of UpdateService.
|
* Creates a new instance of UpdateService.
|
||||||
|
*
|
||||||
|
* @param classLoader the ClassLoader to use when dynamically loading Analyzer and Update services
|
||||||
*/
|
*/
|
||||||
public UpdateService(ClassLoader classLoader) {
|
public UpdateService(ClassLoader classLoader) {
|
||||||
loader = ServiceLoader.load(CachedWebDataSource.class, classLoader);
|
loader = ServiceLoader.load(CachedWebDataSource.class, classLoader);
|
||||||
|
|||||||
@@ -474,9 +474,10 @@ public final class Settings {
|
|||||||
* Returns the temporary directory.
|
* Returns the temporary directory.
|
||||||
*
|
*
|
||||||
* @return the temporary directory
|
* @return the temporary directory
|
||||||
|
* @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created
|
||||||
*/
|
*/
|
||||||
public static File getTempDirectory() throws IOException {
|
public static File getTempDirectory() throws IOException {
|
||||||
File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
|
final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
|
||||||
if (!tmpDir.exists()) {
|
if (!tmpDir.exists()) {
|
||||||
if (!tmpDir.mkdirs()) {
|
if (!tmpDir.mkdirs()) {
|
||||||
final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
|
final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
|
||||||
|
|||||||
Reference in New Issue
Block a user