Skip to content

Commit

Permalink
Alignment according to openhab#14407
Browse files Browse the repository at this point in the history
Signed-off-by: lsiepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel committed Feb 26, 2023
1 parent 0675a80 commit 7941e5f
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 static Exception related 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 7941e5f

Please sign in to comment.