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

NullPointerException when selecting across multiple text spans

    XMLWordPrintableJSON

Details

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

    Description

      I'm getting frequent NullPointerException's related to selecting in a TextPane. Here's a simple example:

      <Window maximized="true" xmlns:bxml="http://pivot.apache.org/bxml"
      xmlns="org.apache.pivot.wtk">
      <TextPane>
      <Document xmlns="org.apache.pivot.wtk.text">
      <Paragraph>
      <Span font="

      {bold:true}

      ">Important: </Span>
      <Span>I'm getting frequent NullPointerException's related to selecting in a TextPane. This is a simple example.</Span>
      <Span font="

      {italic:true,size:9}

      "> (Today @ 12:31p)</Span>
      </Paragraph>
      </Document>
      </TextPane>
      </Window>

      Reshape the window small enough that some or all of the italicized text is on at least the third line. Now try to select text from the plain part into the italicized part. A typical backtrace in my debugger reads:

      java.lang.NullPointerException
      at org.apache.pivot.wtk.skin.TextPaneSkin.updateSelection(TextPaneSkin.java:1138)
      at org.apache.pivot.wtk.skin.TextPaneSkin.selectionChanged(TextPaneSkin.java:1053)
      at org.apache.pivot.wtk.TextPane$TextPaneSelectionListenerList.selectionChanged(TextPane.java:190)
      at org.apache.pivot.wtk.TextPane.setSelection(TextPane.java:734)
      at org.apache.pivot.wtk.skin.TextPaneSkin.mouseMove(TextPaneSkin.java:630)
      at org.apache.pivot.wtk.Component$ComponentMouseListenerList.mouseMove(Component.java:433)
      at org.apache.pivot.wtk.Component.mouseMove(Component.java:2721)
      at org.apache.pivot.wtk.Container.mouseMove(Container.java:673)
      at org.apache.pivot.wtk.ApplicationContext$DisplayHost.processMouseMotionEvent(ApplicationContext.java:1048)
      at java.awt.Component.processEvent(Unknown Source)
      at org.apache.pivot.wtk.ApplicationContext$DisplayHost.processEvent(ApplicationContext.java:709)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at ... more awt stuff ...

      Similar errors occur if you start with the window wide, select text spanning the plain and italic parts, and then reshape the window narrower.

      Related bug without a fault: with the window wide, select text spanning the bold and plain parts. Reshape the window narrower. You'll get to widths where more text appears selected than should be and/or some of the text is blank.

      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: