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

Clearing a Document by removing all elements crashes

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.1
    • Component/s: wtk
    • Labels:
      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

            • Assignee:
              grandinj Noel Grandin
              Reporter:
              bvanmelle Bill van Melle

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment