Community
Participate
Working Groups
When formatting the following XML document the formatter throws an exception and aborts. (This nonsensical document is obviously boiled down from a much larger document) <?xml version="1.0" encoding="utf-8"?> <a> < <!-- b --> </a> "Format" did not complete normally. Please see the log for more information. Overlapping text edits (the log does not contain a stacktrace... but it's 100% reproducible for me.) Eclipse 3.7: eclipse.buildId=I20110613-1736 java.version=1.6.0_26 java.vendor=Apple Inc. BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US Framework arguments: -product org.eclipse.platform.ide Command-line arguments: -product org.eclipse.platform.ide -data {omitted} -dev {omitted} -os macosx -ws cocoa -arch x86_64 -consoleLog
Hi Tor, Thanks for your bug report. I haven't been able to reproduce this myself. I think I might need some more info. Have you changed any of the formatting settings for XML files (Preferences > XML > XML Files > Editor)? Wer any formatting characters lost when pasting the example into the bug description (if so, would it be possible to attach the example file to the defect to preserve original formatting)?
Created attachment 201187 [details] Screenshot showing my formatting settings Yes, I have customized the XML formatting settings. The bug didn't reproduce with the settings I actually use, which are the exact settings shown in the screenshot except for Format Comments and Align Final Bracket, but when I added those two settings to my formatting settings then the bug starts reproducing. (Version: Indigo Release, Build id: 20110615-0604). I paste -exactly- the string shown in the bug description which begins with "<?xml" and ends with "</a>" and it's all shown in the editor; I then hit Ctrl-Shift-F (on Mac) and that opens the "Problem Occurred" dialog with the formatting exception which seems to point to the comment formatting as the culprit: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:121) at java.util.Collections.indexedBinarySearch(Collections.java:319) at java.util.Collections.binarySearch(Collections.java:307) at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:796) at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:781) at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:335) at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.indentIfNotAlreadyIndented(DefaultXMLPartitionFormatter.java:1247) at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatCommentStart(DefaultXMLPartitionFormatter.java:1127) at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatComment(DefaultXMLPartitionFormatter.java:1018) at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:457)
Thanks, Tor. I was able to reproduce with your example and by modifying the formatting preferences. It looks like a combination of "Format comments" and "Clear all blank lines" is causing the problem.
Created attachment 201438 [details] patch The problem was the formatter had two contributions to formatting the trailing whitespace in the text region containing the entity reference.
Created attachment 201441 [details] patch with unit test Previous attachment was missing my unit test.
Code released for 3_3_maintenance and HEAD.
I have it , too!
(In reply to comment #7) > I have it , too! eclipse-jee-indigo-win32-x86_64