mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -258,6 +262,7 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
final boolean hasPOM = analyzePOM(dependency, classNames, engine);
|
||||
final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
|
||||
analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
|
||||
dependency.setDependencyEcosystem(DEPENDENCY_ECOSYSTEM);
|
||||
} catch (IOException 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");
|
||||
result = new Dependency(file);
|
||||
instance.analyze(result, null);
|
||||
assertEquals(JarAnalyzer.DEPENDENCY_ECOSYSTEM,result.getDependencyEcosystem());
|
||||
boolean found = false;
|
||||
for (Evidence e : result.getVendorEvidence()) {
|
||||
if (e.getName().equals("url")) {
|
||||
|
||||
Reference in New Issue
Block a user