From 88528f00e8a5567ab2c590cb6eb03e133d648092 Mon Sep 17 00:00:00 2001 From: Tony Ciavarella Date: Sat, 1 Jan 2022 23:33:53 -0500 Subject: [PATCH] yet more style adjustments to try to make CI happy --- .../parser/violations/ValgrindAdapter.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/main/java/edu/hm/hafner/analysis/parser/violations/ValgrindAdapter.java b/src/main/java/edu/hm/hafner/analysis/parser/violations/ValgrindAdapter.java index 9a04a09e5..834702b15 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/violations/ValgrindAdapter.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/violations/ValgrindAdapter.java @@ -14,7 +14,6 @@ import edu.hm.hafner.analysis.Report; import edu.umd.cs.findbugs.annotations.CheckForNull; -import edu.umd.cs.findbugs.annotations.Nullable; import se.bjurr.violations.lib.model.Violation; import se.bjurr.violations.lib.parsers.ValgrindParser; @@ -62,7 +61,7 @@ private String generateDescriptionHtml(final Violation violation) { return description.toString(); } - private void appendGeneralTable(final StringBuilder html, final String executable, final String uniqueId, @Nullable final String threadId, @Nullable final String threadName, @Nullable final JSONArray auxWhats) { + private void appendGeneralTable(final StringBuilder html, final String executable, final String uniqueId, @CheckForNull final String threadId, @CheckForNull final String threadName, @CheckForNull final JSONArray auxWhats) { html.append(""); maybeAppendTableRow(html, "Executable", executable); @@ -79,33 +78,35 @@ private void appendGeneralTable(final StringBuilder html, final String executabl html.append("
"); } - private void maybeAppendStackTraces(final StringBuilder html, @Nullable final String stacksJson, final String message, @Nullable final JSONArray auxWhats) { - if (stacksJson != null && !stacksJson.isEmpty()) { - final JSONArray stacks = new JSONArray(new JSONTokener(stacksJson)); + private void maybeAppendStackTraces(final StringBuilder html, @CheckForNull final String stacksJson, final String message, @CheckForNull final JSONArray auxWhats) { + if (stacksJson == null || stacksJson.isEmpty()) { + return; + } - if (!stacks.isEmpty()) { - appendStackTrace(html, "Primary Stack Trace", message, stacks.getJSONArray(0)); + final JSONArray stacks = new JSONArray(new JSONTokener(stacksJson)); - for (int stackIndex = 1; stackIndex < stacks.length(); ++stackIndex) { - String msg = null; + if (!stacks.isEmpty()) { + appendStackTrace(html, "Primary Stack Trace", message, stacks.getJSONArray(0)); - if (auxWhats != null && auxWhats.length() >= stackIndex) { - msg = auxWhats.getString(stackIndex - 1); - } + for (int stackIndex = 1; stackIndex < stacks.length(); ++stackIndex) { + String msg = null; - String title = "Auxiliary Stack Trace"; + if (auxWhats != null && auxWhats.length() >= stackIndex) { + msg = auxWhats.getString(stackIndex - 1); + } - if (stacks.length() > NUMBERED_STACK_THRESHOLD) { - title = "Auxiliary Stack Trace #" + stackIndex; - } + String title = "Auxiliary Stack Trace"; - appendStackTrace(html, title, msg, stacks.getJSONArray(stackIndex)); + if (stacks.length() > NUMBERED_STACK_THRESHOLD) { + title = "Auxiliary Stack Trace #" + stackIndex; } + + appendStackTrace(html, title, msg, stacks.getJSONArray(stackIndex)); } } } - private void appendStackTrace(final StringBuilder html, final String title, @Nullable final String message, final JSONArray frames) { + private void appendStackTrace(final StringBuilder html, final String title, @CheckForNull final String message, final JSONArray frames) { html .append("

") .append(title) @@ -137,7 +138,7 @@ private void appendStackFrame(final StringBuilder html, final JSONObject frame) html.append(""); } - private void maybeAppendSuppression(final StringBuilder html, @Nullable final String suppression) { + private void maybeAppendSuppression(final StringBuilder html, @CheckForNull final String suppression) { if (suppression != null && !suppression.isEmpty()) { html .append("

Suppression

")
@@ -146,7 +147,7 @@ private void maybeAppendSuppression(final StringBuilder html, @Nullable final St
         }
     }
 
-    private void maybeAppendTableRow(final StringBuilder html, final String name, @Nullable final String value) {
+    private void maybeAppendTableRow(final StringBuilder html, final String name, @CheckForNull final String value) {
         if (value != null && !value.isEmpty()) {
             html
                     .append("
")