[weathercompany] Alignment according to #14407 (#14505)

Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-02-26 12:21:41 +01:00 committed by GitHub
parent b023e5ac47
commit 8a433bd6c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View 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;
}