Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-716

Clearing a Document by removing all elements crashes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.0.1
    • 2.0.1
    • wtk
    • None

    Description

      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.

      Attachments

        Activity

          People

            grandinj Noel Grandin
            bvanmelle Bill van Melle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: