IDEA-223505 Critical Error in IDEA Async Stacktraces (IndexOutOfBOundsException) - more logging

GitOrigin-RevId: f846d48e944013da203adaefeb90b7bb7149afcf
This commit is contained in:
Egor Ushakov
2019-11-21 10:10:01 +00:00
committed by intellij-monorepo-bot
parent 2f041c3a31
commit 45a8e6d446
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.rt.debugger.agent;
import java.lang.ref.ReferenceQueue;
@@ -250,12 +250,19 @@ public class CaptureStorage {
List<StackTraceElement> stackTrace = stack.getStackTrace();
if (stack instanceof DeepCapturedStack) {
int depth = 0;
for (; depth < stackTrace.size(); depth++) {
int size = stackTrace.size();
for (; depth < size; depth++) {
if (stackTrace.get(depth).getMethodName().endsWith(GENERATED_INSERT_METHOD_POSTFIX)) {
break;
}
}
stackTrace = stackTrace.subList(0, depth + 2);
int newEnd = depth + 2;
if (newEnd > size) {
IllegalStateException exception = new IllegalStateException("Insertion point was not found in stack:");
exception.setStackTrace(stackTrace.toArray(new StackTraceElement[0]));
throw exception;
}
stackTrace = stackTrace.subList(0, newEnd);
stack = ((DeepCapturedStack)stack).myInsertMatch;
}
else {