Added Ecosystem to Java

This commit is contained in:
brianf
2017-09-21 17:37:17 -04:00
parent 9998cd0ccc
commit 6726101e36
2 changed files with 6 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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")) {