From 6c2ab074d67182aebf8099d062977bd8413c24b6 Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Tue, 26 Jul 2022 14:08:11 +0200 Subject: [PATCH] Remove no longer needed handling of null ProBError.getErrors If there is no detailed error information, it now always returns an empty list and never null. --- .../java/de/prob2/jupyter/ProBKernel.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/prob2/jupyter/ProBKernel.java b/src/main/java/de/prob2/jupyter/ProBKernel.java index e364beb..fa36299 100644 --- a/src/main/java/de/prob2/jupyter/ProBKernel.java +++ b/src/main/java/de/prob2/jupyter/ProBKernel.java @@ -902,20 +902,13 @@ public final class ProBKernel extends BaseKernel { this.errorStyler.primary("Error from ProB: ") + this.errorStyler.secondary(String.valueOf(proBError.getOriginalMessage())) ).split("\n"))); - if (proBError.getErrors() == null) { - // If the errors list is null rather than empty, don't show the "no error messages" message. - // (This matches the normal behavior of ProBError.) - } else if (proBError.getErrors().isEmpty()) { - out.addAll(this.errorStyler.primaryLines("ProB returned no error messages.\n")); - } else { - if (proBError.getErrors().size() > 1) { - out.addAll(this.errorStyler.primaryLines(proBError.getErrors().size() + " errors:\n")); - } - for (final ErrorItem error : proBError.getErrors()) { - out.addAll(this.errorStyler.secondaryLines(error.toString())); - for (final ErrorItem.Location location : error.getLocations()) { - out.addAll(formatErrorSource(contextSourceLines, location)); - } + if (proBError.getErrors().size() > 1) { + out.addAll(this.errorStyler.primaryLines(proBError.getErrors().size() + " errors:\n")); + } + for (final ErrorItem error : proBError.getErrors()) { + out.addAll(this.errorStyler.secondaryLines(error.toString())); + for (final ErrorItem.Location location : error.getLocations()) { + out.addAll(formatErrorSource(contextSourceLines, location)); } } return out; -- GitLab