Pivot
  1. Pivot
  2. PIVOT-730

NullPointerException when selecting across multiple text spans

    Details

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

        Activity

        Bill van Melle created issue -
        Sandro Martini made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Minor [ 4 ]
        Fix Version/s 2.0.1 [ 12315951 ]
        Hide
        Noel Grandin added a comment -

        Fixed in rev 1094574 and rev 1094603

        Show
        Noel Grandin added a comment - Fixed in rev 1094574 and rev 1094603
        Noel Grandin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Noel Grandin [ grandinj ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Noel Grandin
            Reporter:
            Bill van Melle
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development