]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ecobee] Alignment according to #14407 (#14506)
authorlsiepel <leosiepel@gmail.com>
Sun, 26 Feb 2023 11:22:03 +0000 (12:22 +0100)
committerGitHub <noreply@github.com>
Sun, 26 Feb 2023 11:22:03 +0000 (12:22 +0100)
Signed-off-by: lsiepel <leosiepel@gmail.com>
bundles/org.openhab.binding.ecobee/src/main/java/org/openhab/binding/ecobee/internal/util/ExceptionUtils.java

index c4f7a3773b3b89e073b8d0e463439c2df5d8f58f..860917e2ba64a437d27e44216a2ec949da18c1ee 100644 (file)
@@ -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<Throwable> 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;
     }