Avoid printing document text at EA reports (private source text may be found in internet otherwise)

This commit is contained in:
Denis.Zhdanov
2011-07-28 12:00:20 +04:00
parent d5ef93fc77
commit 8b4afc3e65
8 changed files with 12 additions and 14 deletions
@@ -147,8 +147,7 @@ public class PlainEnterProcessor implements EnterProcessor {
int i = CharArrayUtil.shiftForward(whiteSpaceText, 0, " \t");
if (i >= whiteSpaceText.length() - 1) {
assert false : String.format("document: '%s', code block: %s, white space: %s",
document.getText(), codeBlock.getTextRange(), whiteSpace.getTextRange());
assert false : String.format("code block: %s, white space: %s", codeBlock.getTextRange(), whiteSpace.getTextRange());
return false;
}
@@ -106,7 +106,7 @@ public class ImportsFormatter extends XmlRecursiveElementVisitor {
final StringBuffer result = new StringBuffer();
final int lineStartOffset = myDocumentModel.getLineStartOffset(myDocumentModel.getLineNumber(startOffset));
final int emptyLineEnd = CharArrayUtil.shiftForward(myDocumentModel.getDocument().getText(), lineStartOffset, " \t");
final int emptyLineEnd = CharArrayUtil.shiftForward(myDocumentModel.getDocument().getCharsSequence(), lineStartOffset, " \t");
final CharSequence spaces = myDocumentModel.getText(new TextRange(lineStartOffset, emptyLineEnd));
if (spaces != null) {
@@ -56,7 +56,7 @@ public class ChangesDiffCalculator {
myOldMarkup.document = beforeDocument;
myNewMarkup.document = currentDocument;
List<LineFragment> lineFragments = null;
List<LineFragment> lineFragments;
try {
lineFragments = myCompareProcessor.process(beforeDocument.getText(), currentDocument.getText());
}
@@ -87,8 +87,8 @@ public abstract class AbstractBlockAlignmentProcessor implements BlockAlignmentP
if (blocksCausedRealignment != null && blocksCausedRealignment.contains(context.targetBlock)) {
LOG.error(String.format("Formatting error - code block %s is set to be shifted right because of its alignment with "
+ "block %s more than once. I.e. moving the former block because of alignment algorithm causes "
+ "subsequent block to be shifted right as well - cyclic dependency. Document: %n%s",
offsetResponsibleBlock.getTextRange(), context.targetBlock.getTextRange(), context.document.getText()
+ "subsequent block to be shifted right as well - cyclic dependency",
offsetResponsibleBlock.getTextRange(), context.targetBlock.getTextRange()
));
blocksCausedRealignment.add(context.targetBlock);
return Result.UNABLE_TO_ALIGN_BACKWARD_BLOCK;
@@ -60,8 +60,7 @@ public class FormattingDocumentModelImpl implements FormattingDocumentModel {
LOG.error("Document is uncommitted");
}
if (!document.getText().equals(file.getText())) {
LOG.error(
"Document and psi file texts should be equal : \nDocument text:\n" + document.getText() + "\nFile text:\n" + file.getText());
LOG.error("Document and psi file texts should be equal");
}
return new FormattingDocumentModelImpl(document, file);
}
@@ -129,9 +129,9 @@ public class EditorUtil {
assert false : String.format(
"Target visual line: %d, mapped logical line: %d, visual lines range for the mapped logical line: [%s]-[%s], soft wraps for "
+ "the target logical line: %s, all soft wraps: %s, fold regions: %s%nDocument text: '%s'",
+ "the target logical line: %s, all soft wraps: %s, fold regions: %s",
line, resultLogLine, resVisStart, resVisEnd, softWraps, editor.getSoftWrapModel().getSoftWrapsForRange(0, document.getTextLength()),
Arrays.toString(editor.getFoldingModel().getAllFoldRegions()), editor.getDocument().getText()
Arrays.toString(editor.getFoldingModel().getAllFoldRegions())
);
return resVisEnd.column;
}
@@ -186,8 +186,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
if (!ignoreWrongMoves && !myEditor.offsetToLogicalPosition(myOffset).equals(myEditor.offsetToLogicalPosition(offset))) {
LOG.error(
"caret moved to wrong offset. Requested:" + offset + " but actual:" + myOffset
+ ". Soft wraps data: " + myEditor.getSoftWrapModel() + ", folding data: " + myEditor.getFoldingModel()
+ ", document:\n" + myEditor.getDocument().getText());
+ ". Soft wraps data: " + myEditor.getSoftWrapModel() + ", folding data: " + myEditor.getFoldingModel());
}
}
@@ -616,8 +616,9 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
if (Boolean.getBoolean(DEBUG_PROPERTY_NAME)) {
LOG.error(String.format(
"Unexpected exception occurred during performing '%s'. Current soft wraps cache: %n"
+ "%s%nDocument:%n%s%nFold regions: %s",
task, myDataMapper, myEditor.getDocument().getText(), Arrays.toString(myEditor.getFoldingModel().fetchTopLevel())), e);
+ "%s%nFold regions: %s",
task, myDataMapper, Arrays.toString(myEditor.getFoldingModel().fetchTopLevel())), e
);
}
myEditor.getFoldingModel().rebuild();
myDataMapper.release();