mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-26 11:01:44 +01:00
checkstyle corrections
Former-commit-id: 77b519236f1afe7ad8eab0407d055e7f9ab4745f
This commit is contained in:
@@ -60,7 +60,13 @@ import org.owasp.dependencycheck.utils.Settings;
|
|||||||
*
|
*
|
||||||
* @author Jeremy Long <jeremy.long@owasp.org>
|
* @author Jeremy Long <jeremy.long@owasp.org>
|
||||||
*/
|
*/
|
||||||
@Mojo(name = "check", defaultPhase = LifecyclePhase.COMPILE, threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM, requiresOnline = true)
|
@Mojo(
|
||||||
|
name = "check",
|
||||||
|
defaultPhase = LifecyclePhase.COMPILE,
|
||||||
|
threadSafe = true,
|
||||||
|
requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM,
|
||||||
|
requiresOnline = true
|
||||||
|
)
|
||||||
public class DependencyCheckMojo extends ReportAggregationMojo {
|
public class DependencyCheckMojo extends ReportAggregationMojo {
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Private fields">
|
//<editor-fold defaultstate="collapsed" desc="Private fields">
|
||||||
@@ -327,12 +333,12 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
|
|||||||
if (excludeFromScan(a)) {
|
if (excludeFromScan(a)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<Dependency> deps = localEngine.scan(a.getFile().getAbsoluteFile());
|
final List<Dependency> deps = localEngine.scan(a.getFile().getAbsoluteFile());
|
||||||
if (deps != null) {
|
if (deps != null) {
|
||||||
if (deps.size() == 1) {
|
if (deps.size() == 1) {
|
||||||
Dependency d = deps.get(0);
|
final Dependency d = deps.get(0);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion());
|
final MavenArtifact ma = new MavenArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion());
|
||||||
d.addAsEvidence("pom", ma, Confidence.HIGHEST);
|
d.addAsEvidence("pom", ma, Confidence.HIGHEST);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -591,15 +597,16 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
|
|||||||
engine = initializeEngine();
|
engine = initializeEngine();
|
||||||
engine.getDependencies().addAll(deps);
|
engine.getDependencies().addAll(deps);
|
||||||
} catch (DatabaseException ex) {
|
} catch (DatabaseException ex) {
|
||||||
final String msg = String.format("An unrecoverable exception with the dependency-check initialization occured while scanning %s", getProject()
|
final String msg = String.format("An unrecoverable exception with the dependency-check initialization occured while scanning %s",
|
||||||
.getName());
|
getProject().getName());
|
||||||
throw new MavenReportException(msg, ex);
|
throw new MavenReportException(msg, ex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
engine = executeDependencyCheck();
|
engine = executeDependencyCheck();
|
||||||
} catch (DatabaseException ex) {
|
} catch (DatabaseException ex) {
|
||||||
final String msg = String.format("An unrecoverable exception with the dependency-check scan occured while scanning %s", getProject().getName());
|
final String msg = String.format("An unrecoverable exception with the dependency-check scan occured while scanning %s",
|
||||||
|
getProject().getName());
|
||||||
throw new MavenReportException(msg, ex);
|
throw new MavenReportException(msg, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,14 +629,16 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
|
|||||||
try {
|
try {
|
||||||
engine = executeDependencyCheck(project);
|
engine = executeDependencyCheck(project);
|
||||||
} catch (DatabaseException ex) {
|
} catch (DatabaseException ex) {
|
||||||
final String msg = String.format("An unrecoverable exception with the dependency-check scan occured while scanning %s", project.getName());
|
final String msg = String.format("An unrecoverable exception with the dependency-check scan occured while scanning %s",
|
||||||
|
project.getName());
|
||||||
throw new MavenReportException(msg, ex);
|
throw new MavenReportException(msg, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (MavenProject child : getAllChildren(project)) {
|
for (MavenProject child : getAllChildren(project)) {
|
||||||
deps = readDataFile(child);
|
deps = readDataFile(child);
|
||||||
if (deps == null) {
|
if (deps == null) {
|
||||||
final String msg = String.format("Unable to include information on %s in the dependency-check aggregate report", child.getName());
|
final String msg = String.format("Unable to include information on %s in the dependency-check aggregate report",
|
||||||
|
child.getName());
|
||||||
LOGGER.severe(msg);
|
LOGGER.severe(msg);
|
||||||
} else {
|
} else {
|
||||||
engine.getDependencies().addAll(deps);
|
engine.getDependencies().addAll(deps);
|
||||||
@@ -693,7 +702,8 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
|
|||||||
* @return the description
|
* @return the description
|
||||||
*/
|
*/
|
||||||
public String getDescription(Locale locale) {
|
public String getDescription(Locale locale) {
|
||||||
return "A report providing details on any published " + "vulnerabilities within project dependencies. This report is a best effort but may contain "
|
return "A report providing details on any published "
|
||||||
|
+ "vulnerabilities within project dependencies. This report is a best effort but may contain "
|
||||||
+ "false positives and false negatives.";
|
+ "false positives and false negatives.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user