Limit call stack function output length

This commit is contained in:
aNNiMON 2023-10-04 19:34:29 +03:00 committed by Victor Melnik
parent 02e9d1f6c5
commit 368cc8612c

View File

@ -7,6 +7,7 @@ import java.util.stream.Collectors;
public final class CallStack {
private static final int MAX_FUNCTION_LENGTH = 62;
private static final Deque<CallInfo> calls = new ConcurrentLinkedDeque<>();
private CallStack() { }
@ -24,6 +25,9 @@ public final class CallStack {
if (func.contains("\n")) {
func = func.substring(0, func.indexOf("\n")).trim();
}
if (func.length() > MAX_FUNCTION_LENGTH) {
func = func.substring(0, MAX_FUNCTION_LENGTH) + "...";
}
calls.push(new CallInfo(name, func, range));
}