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

index f2e322e528f2c653e7d9270e63f30227078a3010..481d90e5226597168c31829dcd265011d26b284c 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 some static utility 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;
     }