coverity suggested corrections

This commit is contained in:
Jeremy Long
2016-08-21 14:40:07 -04:00
parent 4861592d2a
commit cedd93e774
14 changed files with 175 additions and 63 deletions

View File

@@ -158,8 +158,13 @@ public class App {
exitCode = -4;
}
try {
runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(),
cli.getExcludeList(), cli.getSymLinkDepth());
String[] scanFiles = cli.getScanFiles();
if (scanFiles != null) {
runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), scanFiles,
cli.getExcludeList(), cli.getSymLinkDepth());
} else {
LOGGER.error("No scan files configured");
}
} catch (InvalidScanPathException ex) {
LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths");
exitCode = -10;
@@ -293,7 +298,7 @@ public class App {
throw ex;
}
}
if (exCol != null && exCol.getExceptions().size()>0) {
if (exCol != null && exCol.getExceptions().size() > 0) {
throw exCol;
}
} finally {
@@ -301,7 +306,7 @@ public class App {
engine.cleanup();
}
}
}
/**

View File

@@ -196,6 +196,10 @@ public final class CliParser {
isValid = false;
final String msg = String.format("Invalid '%s' argument: '%s'%nUnable to scan paths that start with '//'.", argumentName, path);
throw new FileNotFoundException(msg);
} else if ((path.endsWith("/*") && !path.endsWith("**/*")) || (path.endsWith("\\*") && path.endsWith("**\\*"))) {
final String msg = String.format("Possibly incorrect path '%s' from argument '%s' because it ends with a slash star; "
+ "dependency-check uses ant-style paths", path, argumentName);
LOGGER.warn(msg);
}
}