Clearing a Document by removing all elements crashes
----------------------------------------------------

                 Key: PIVOT-716
                 URL: https://issues.apache.org/jira/browse/PIVOT-716
             Project: Pivot
          Issue Type: Bug
          Components: wtk
    Affects Versions: 2.0.1
            Reporter: Bill van Melle
            Priority: Critical


In version 2.0, I could clear a Document by doing 

   doc.remove(0, doc.getLength());

In the current trunk, this causes a crash:

java.lang.IndexOutOfBoundsException: offset+characterCount>this.characterCount 
offset=0 characterCount=38 this.characterCount=0
        at org.apache.pivot.wtk.text.Element.getRange(Element.java:263)
        at org.apache.pivot.wtk.text.Element.getRange(Element.java:39)
        at 
org.apache.pivot.wtk.TextPane$RangeRemovedEdit.<init>(TextPane.java:122)
        at org.apache.pivot.wtk.TextPane$2.rangeRemoved(TextPane.java:268)
        at 
org.apache.pivot.wtk.text.Node$NodeListenerList.rangeRemoved(Node.java:66)
        at org.apache.pivot.wtk.text.Node.rangeRemoved(Node.java:217)
        at org.apache.pivot.wtk.text.Element.remove(Element.java:454)

Example available on request, but you should be able to reproduce it by taking 
the code from  https://issues.apache.org/jira/browse/PIVOT-715, add a suitable 
id to the Document node, and write code to do the remove call shown above.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to