From 034a2eb3c171013ebe310ce618b372f609c44a27 Mon Sep 17 00:00:00 2001 From: "Svetlana.Zemlyanskaya" Date: Mon, 15 Jun 2020 16:33:43 +0200 Subject: [PATCH] FUS: don't report stacktrace for kotlin compilator exception GitOrigin-RevId: 27f3f1076f8605e04dbee553e376912effa11f08 --- .../fusCollectors/ThrowableDescription.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/featureStatistics/fusCollectors/ThrowableDescription.java b/platform/platform-impl/src/com/intellij/featureStatistics/fusCollectors/ThrowableDescription.java index 61d008bb0ffa..984de6d9d77c 100644 --- a/platform/platform-impl/src/com/intellij/featureStatistics/fusCollectors/ThrowableDescription.java +++ b/platform/platform-impl/src/com/intellij/featureStatistics/fusCollectors/ThrowableDescription.java @@ -18,7 +18,17 @@ public final class ThrowableDescription { public ThrowableDescription(@Nullable Throwable throwable) { myThrowable = throwable != null ? getCause(throwable) : null; - myStacktrace = myThrowable != null ? myThrowable.getStackTrace() : null; + myStacktrace = myThrowable != null ? getStacktrace(myThrowable) : null; + } + + private static StackTraceElement @Nullable [] getStacktrace(@NotNull Throwable throwable) { + try { + return throwable.getStackTrace(); + } + catch (Throwable e) { + // Kotlin internals might throw an exception and it doesn't support retrieving a stacktrace + return null; + } } @NotNull