mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-24 01:51:49 +01:00
Added Ecosystem to Java
This commit is contained in:
@@ -157,6 +157,10 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
* The name of the analyzer.
|
* The name of the analyzer.
|
||||||
*/
|
*/
|
||||||
private static final String ANALYZER_NAME = "Jar Analyzer";
|
private static final String ANALYZER_NAME = "Jar Analyzer";
|
||||||
|
/**
|
||||||
|
* The dependency ecosystem.
|
||||||
|
*/
|
||||||
|
static final String DEPENDENCY_ECOSYSTEM = "Java";
|
||||||
/**
|
/**
|
||||||
* The phase that this analyzer is intended to run in.
|
* The phase that this analyzer is intended to run in.
|
||||||
*/
|
*/
|
||||||
@@ -258,6 +262,7 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
final boolean hasPOM = analyzePOM(dependency, classNames, engine);
|
final boolean hasPOM = analyzePOM(dependency, classNames, engine);
|
||||||
final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
|
final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
|
||||||
analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
|
analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
|
||||||
|
dependency.setDependencyEcosystem(DEPENDENCY_ECOSYSTEM);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AnalysisException("Exception occurred reading the JAR file (" + dependency.getFileName() + ").", ex);
|
throw new AnalysisException("Exception occurred reading the JAR file (" + dependency.getFileName() + ").", ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class JarAnalyzerTest extends BaseTest {
|
|||||||
file = BaseTest.getResourceAsFile(this, "dwr.jar");
|
file = BaseTest.getResourceAsFile(this, "dwr.jar");
|
||||||
result = new Dependency(file);
|
result = new Dependency(file);
|
||||||
instance.analyze(result, null);
|
instance.analyze(result, null);
|
||||||
|
assertEquals(JarAnalyzer.DEPENDENCY_ECOSYSTEM,result.getDependencyEcosystem());
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (Evidence e : result.getVendorEvidence()) {
|
for (Evidence e : result.getVendorEvidence()) {
|
||||||
if (e.getName().equals("url")) {
|
if (e.getName().equals("url")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user