NullPointerException when selecting across multiple text spans
--------------------------------------------------------------
Key: PIVOT-730
URL: https://issues.apache.org/jira/browse/PIVOT-730
Project: Pivot
Issue Type: Bug
Components: wtk
Affects Versions: 2.0.1
Reporter: Bill van Melle
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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira