fix some checkstyles
@@ -19,7 +19,7 @@ import edu.hm.hafner.analysis.Severity;
/**
* <p>
- * Parser for reports of aquasec trivy container vulnerability scanner
+ * Parser for reports of aquasec trivy container vulnerability scanner.
* </p>
* <p>
* <strong>Usage: </strong>trivy image -f json -o results.json golang:1.12-alpine
@@ -31,7 +31,7 @@ public class TrivyParser extends IssueParser {
private static final long serialVersionUID = 1L;
@Override
- public Report parse(ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException {
+ public Report parse(final ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException {
final Report report = new Report();
try (Reader reader = readerFactory.create()) {
@@ -41,45 +41,46 @@ public class TrivyParser extends IssueParser {
for (Object vulnatbility : vulnatbilites) {
report.add(convertToIssue((JSONObject)vulnatbility));
}
- } catch (IOException e) {
+ }
+ catch (IOException e) {
throw new ParsingException(e);
}
return report;
}
- private Issue convertToIssue(JSONObject vulnatbility) {
- return new IssueBuilder()
- .setFileName(vulnatbility.getString("PkgName"))
- .setCategory(vulnatbility.getString("SeveritySource"))
- .setSeverity(mapSeverity(vulnatbility.getString("Severity")))
- .setType(vulnatbility.getString("VulnerabilityID"))
- .setMessage(vulnatbility.optString("Title", "UNKNOWN"))
- .setDescription(formatDescription(vulnatbility))
+ private Issue convertToIssue(final JSONObject vulneratbility) {
+ return new IssueBuilder().setFileName(vulneratbility.getString("PkgName"))
+ .setCategory(vulneratbility.getString("SeveritySource"))
+ .setSeverity(mapSeverity(vulneratbility.getString("Severity")))
+ .setType(vulneratbility.getString("VulnerabilityID"))
+ .setMessage(vulneratbility.optString("Title", "UNKNOWN"))
+ .setDescription(formatDescription(vulneratbility))
.build();
}
- private Severity mapSeverity(String string) {
+ private Severity mapSeverity(final String string) {
if ("low".equalsIgnoreCase(string)) {
return Severity.WARNING_LOW;
- } else if ("medium".equalsIgnoreCase(string)) {
+ }
+ else if ("medium".equalsIgnoreCase(string)) {
return Severity.WARNING_NORMAL;
- } else if ("high".equalsIgnoreCase(string) || "critcal".equalsIgnoreCase(string)) {
+ }
+ else if ("high".equalsIgnoreCase(string) || "critcal".equalsIgnoreCase(string)) {
return Severity.WARNING_HIGH;
- } else {
+ }
+ else {
return Severity.WARNING_HIGH;
}
}
- private String formatDescription(JSONObject vulnatbility) {
- return new StringBuilder()
- .append(MessageFormat.format("<p><div><b>File</b>: {0}</div><div><b>Installed Version:</b> {1}</div><div><b>Fixed Version:</b> {2}</div><div><b>Severity:</b> {3}</div>",
- vulnatbility.getString("PkgName"),
- vulnatbility.getString("InstalledVersion"),
- vulnatbility.getString("FixedVersion"),
- vulnatbility.getString("Severity")))
+ private String formatDescription(final JSONObject vulneratbility) {
+ return new StringBuilder().append(MessageFormat.format(
+ "<p><div><b>File</b>: {0}</div><div><b>Installed Version:</b> {1}</div><div><b>Fixed Version:</b> {2}</div><div><b>Severity:</b> {3}</div>",
+ vulneratbility.getString("PkgName"), vulneratbility.getString("InstalledVersion"),
+ vulneratbility.getString("FixedVersion"), vulneratbility.getString("Severity")))
.append("<p>")
- .append(vulnatbility.getString("Description"))
+ .append(vulneratbility.getString("Description"))
.append("</p>")
.toString();
}
