updated error reporting for non-existent files

This commit is contained in:
Jeremy Long
2017-07-06 06:05:26 -04:00
parent 756d39df9a
commit d5503ff615
2 changed files with 8 additions and 1 deletions

View File

@@ -113,6 +113,13 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
@Override
public void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException {
File test = new File(dependency.getActualFilePath());
if (!test.isFile()) {
throw new AnalysisException(String.format("%s does not exist and cannot be analyzed by dependency-check",
dependency.getActualFilePath()));
}
if (grokAssemblyExe == null) {
LOGGER.warn("GrokAssembly didn't get deployed");
return;

View File

@@ -173,7 +173,7 @@ public class AssemblyAnalyzerTest extends BaseTest {
analyzer.analyze(d, null);
fail("Expected an AnalysisException");
} catch (AnalysisException ae) {
assertEquals("File does not exist", ae.getMessage());
assertTrue(ae.getMessage().contains("nonexistent.dll does not exist and cannot be analyzed by dependency-check"));
} finally {
System.setProperty(LOG_KEY, oldProp);
}