EA-49127 - assert: CachingSoftWrapDataMapper.onRecalculationEnd - added more diagnostics

This commit is contained in:
Dmitry Batrak
2014-06-30 12:28:44 +04:00
parent ebd6c2096c
commit 237ba2cfab
@@ -465,21 +465,12 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
|| (beforeLast.visualLine + 1 == last.visualLine && last.startOffset - beforeLast.endOffset > 1)
|| last.startOffset > myEditor.getDocument().getTextLength())
{
CharSequence editorState = "";
if (myEditor instanceof EditorImpl) {
editorState = ((EditorImpl)myEditor).dumpState();
}
LOG.error(
"Detected invalid soft wraps cache update",
String.format(
"Event: %s, normal: %b.%n%nTail cache entries: %s%n%nAffected by change cache entries: %s%n%nBefore change state: %s%n%n"
+ "After change state: %s%n%nEditor state: %s",
event, normal, myNotAffectedByUpdateTailCacheEntries, myAffectedByUpdateCacheEntries,
myBeforeChangeState, myAfterChangeState, editorState
)
);
logInvalidUpdate(event, normal);
}
}
if (!myCache.isEmpty() && myEditor.getDocument().getTextLength() == 0) {
logInvalidUpdate(event, normal);
}
myAffectedByUpdateCacheEntries.clear();
myNotAffectedByUpdateTailCacheEntries.clear();
@@ -492,6 +483,22 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
myBeforeChangeState.cacheShouldBeUpdated = false;
}
private void logInvalidUpdate(@NotNull IncrementalCacheUpdateEvent event, boolean normal) {
CharSequence editorState = "";
if (myEditor instanceof EditorImpl) {
editorState = ((EditorImpl)myEditor).dumpState();
}
LOG.error(
"Detected invalid soft wraps cache update",
String.format(
"Event: %s, normal: %b.%n%nTail cache entries: %s%n%nAffected by change cache entries: %s%n%nBefore change state: %s%n%n"
+ "After change state: %s%n%nEditor state: %s",
event, normal, myNotAffectedByUpdateTailCacheEntries, myAffectedByUpdateCacheEntries,
myBeforeChangeState, myAfterChangeState, editorState
)
);
}
@Override
public void reset() {
myCache.clear();