diff --git a/platform/util/src/com/intellij/openapi/diagnostic/DefaultLogger.java b/platform/util/src/com/intellij/openapi/diagnostic/DefaultLogger.java index 16b1360a7cfa..0943a0775ae1 100644 --- a/platform/util/src/com/intellij/openapi/diagnostic/DefaultLogger.java +++ b/platform/util/src/com/intellij/openapi/diagnostic/DefaultLogger.java @@ -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() { diff --git a/platform/util/src/com/intellij/util/ExceptionUtil.java b/platform/util/src/com/intellij/util/ExceptionUtil.java index 0f4491b04f3f..1fc03c880992 100644 --- a/platform/util/src/com/intellij/util/ExceptionUtil.java +++ b/platform/util/src/com/intellij/util/ExceptionUtil.java @@ -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();