do not store more than we show for long values in debugger

This commit is contained in:
Egor.Ushakov
2015-02-05 17:00:45 +03:00
parent 255506aede
commit e22f061051
@@ -50,6 +50,7 @@ import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.frame.XValueNode;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import com.sun.jdi.*;
import com.sun.jdi.event.Event;
@@ -66,8 +67,6 @@ import java.util.regex.PatternSyntaxException;
public abstract class DebuggerUtilsEx extends DebuggerUtils {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.DebuggerUtilsEx");
private static final int MAX_LABEL_SIZE = 255;
/**
* @param context
* @return all CodeFragmentFactoryProviders that provide code fragment factories suitable in the context given
@@ -594,8 +593,9 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
}
public static String truncateString(final String str) {
if (str.length() > MAX_LABEL_SIZE) {
return str.substring(0, MAX_LABEL_SIZE) + "...";
// leave a small gap over XValueNode.MAX_VALUE_LENGTH to detect oversize
if (str.length() > XValueNode.MAX_VALUE_LENGTH + 5) {
return str.substring(0, XValueNode.MAX_VALUE_LENGTH + 5);
}
return str;
}