Skip to content

Commit

Permalink
[weathercompany] Alignment according to openhab#14407 (openhab#14505)
Browse files Browse the repository at this point in the history
Signed-off-by: lsiepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel authored and nemerdaud committed Feb 28, 2023
1 parent db9f886 commit b452e10
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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
Expand All @@ -26,11 +25,14 @@
@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;
}
Expand Down

0 comments on commit b452e10

Please sign in to comment.