From d3d14d8b046d0f9bce3fa6d47a8ae3cbc86a9fd8 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sun, 26 Feb 2023 12:22:03 +0100 Subject: [PATCH] [ecobee] Alignment according to #14407 (#14506) Signed-off-by: lsiepel --- .../binding/ecobee/internal/util/ExceptionUtils.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/util/ExceptionUtils.java b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/util/ExceptionUtils.java index c4f7a3773..860917e2b 100644 --- a/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/util/ExceptionUtils.java +++ b/bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/util/ExceptionUtils.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; /** * The {@link ExceptionUtils} class defines static Exception related methods @@ -26,11 +25,14 @@ import org.eclipse.jdt.annotation.Nullable; @NonNullByDefault public class ExceptionUtils { - public static @Nullable Throwable getRootThrowable(@Nullable Throwable throwable) { + public static Throwable getRootThrowable(Throwable throwable) { List list = new ArrayList<>(); - while (throwable != null && !list.contains(throwable)) { + while (!list.contains(throwable)) { list.add(throwable); - throwable = throwable.getCause(); + Throwable throwableLocal = throwable.getCause(); + if (throwableLocal != null) { + throwable = throwableLocal; + } } return throwable; }