mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 07:43:40 +01:00
reformated and changed isEnabled to a getter by adding checkEnabled that is called during initialization
Former-commit-id: d5c1224709469fccacfad7e22cf5a44eecdcab36
This commit is contained in:
@@ -1,14 +1,5 @@
|
||||
package org.owasp.dependencycheck.analyzer;
|
||||
|
||||
import org.owasp.dependencycheck.Engine;
|
||||
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
||||
import org.owasp.dependencycheck.data.nexus.MavenArtifact;
|
||||
import org.owasp.dependencycheck.data.central.CentralSearch;
|
||||
import org.owasp.dependencycheck.dependency.Confidence;
|
||||
import org.owasp.dependencycheck.dependency.Dependency;
|
||||
import org.owasp.dependencycheck.utils.InvalidSettingException;
|
||||
import org.owasp.dependencycheck.utils.Settings;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@@ -16,11 +7,20 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.owasp.dependencycheck.Engine;
|
||||
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
||||
import org.owasp.dependencycheck.data.central.CentralSearch;
|
||||
import org.owasp.dependencycheck.data.nexus.MavenArtifact;
|
||||
import org.owasp.dependencycheck.dependency.Confidence;
|
||||
import org.owasp.dependencycheck.dependency.Dependency;
|
||||
import org.owasp.dependencycheck.utils.InvalidSettingException;
|
||||
import org.owasp.dependencycheck.utils.Settings;
|
||||
|
||||
/**
|
||||
* Created by colezlaw on 10/9/14.
|
||||
*/
|
||||
public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
|
||||
/**
|
||||
* The logger.
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
/**
|
||||
* The name of the analyzer.
|
||||
*/
|
||||
private static final String ANALYZER_NAME = "Central Analyzer";
|
||||
private static final String ANALYZER_NAME = "Central Analyzer";
|
||||
|
||||
/**
|
||||
* The phase in which this analyzer runs.
|
||||
@@ -42,8 +42,8 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("jar");
|
||||
|
||||
/**
|
||||
* The analyzer should be disabled if there are errors, so this is a flag
|
||||
* to determine if such an error has occurred.
|
||||
* The analyzer should be disabled if there are errors, so this is a flag to determine if such an error has
|
||||
* occurred.
|
||||
*/
|
||||
protected boolean errorFlag = false;
|
||||
|
||||
@@ -52,6 +52,8 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
*/
|
||||
private CentralSearch searcher;
|
||||
|
||||
private boolean enabled = checkEnabled();
|
||||
|
||||
/**
|
||||
* Determine whether to enable this analyzer or not.
|
||||
*
|
||||
@@ -59,6 +61,10 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
*/
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private boolean checkEnabled() {
|
||||
boolean retval = false;
|
||||
|
||||
try {
|
||||
@@ -106,7 +112,8 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
return ANALYZER_NAME;
|
||||
}
|
||||
|
||||
/** Returns the key used in the properties file to to reference the analyzer's enabled property.
|
||||
/**
|
||||
* Returns the key used in the properties file to to reference the analyzer's enabled property.
|
||||
*
|
||||
* @return the analyzer's enabled property setting key.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user