mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix NPE in DefaultLogger.attachmentsToString
This commit is contained in:
@@ -77,9 +77,9 @@ public class DefaultLogger extends Logger {
|
||||
@Override
|
||||
public void setLevel(Level level) { }
|
||||
|
||||
public static String attachmentsToString(Throwable t) {
|
||||
public static String attachmentsToString(@Nullable Throwable t) {
|
||||
//noinspection ThrowableResultOfMethodCallIgnored
|
||||
Throwable rootCause = ExceptionUtil.getRootCause(t);
|
||||
Throwable rootCause = t == null ? null : ExceptionUtil.getRootCause(t);
|
||||
if (rootCause instanceof ExceptionWithAttachments) {
|
||||
return "\nAttachments:" + StringUtil.join(((ExceptionWithAttachments)rootCause).getAttachments(),
|
||||
new Function<Attachment, String>() {
|
||||
|
||||
@@ -27,7 +27,8 @@ import java.util.Arrays;
|
||||
public class ExceptionUtil {
|
||||
private ExceptionUtil() { }
|
||||
|
||||
public static Throwable getRootCause(Throwable e) {
|
||||
@NotNull
|
||||
public static Throwable getRootCause(@NotNull Throwable e) {
|
||||
while (true) {
|
||||
if (e.getCause() == null) return e;
|
||||
e = e.getCause();
|
||||
|
||||
Reference in New Issue
Block a user