added type checking for CPEAnalyzer to avoid exceptions

Former-commit-id: 6f407c839f4c2f74900f46901f4a8452abe83e06
This commit is contained in:
Jeremy Long
2014-12-17 11:25:16 -05:00
parent d6e1352869
commit 38a5834785

View File

@@ -131,7 +131,10 @@ public class Engine extends org.owasp.dependencycheck.Engine {
CPEAnalyzer cpe = null;
final MavenProject project = getRootParent();
if (project != null) {
cpe = (CPEAnalyzer) project.getContextValue(CPE_ANALYZER_KEY);
Object obj = project.getContextValue(CPE_ANALYZER_KEY);
if (obj instanceof CPEAnalyzer) {
cpe = (CPEAnalyzer) project.getContextValue(CPE_ANALYZER_KEY);
}
}
return cpe;
}