kamalchopra / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

setText() throws null pointer exception if there are highlights in the text #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the find/replace dialog with the "Highlight" option to create some 
highlights in the text
2. Call setText()

What is the expected output? What do you see instead?

The following exception is thrown:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at jsyntaxpane.components.Markers.markAll(Markers.java:129)
at jsyntaxpane.actions.gui.ReplaceDialog.updateHighlights
(ReplaceDialog.java:66)
at jsyntaxpane.actions.gui.ReplaceDialog.caretUpdate
(ReplaceDialog.java:290)
at javax.swing.text.JTextComponent.fireCaretUpdate(JTextComponent.java:391)
at javax.swing.text.JTextComponent$MutableCaretEvent.fire
(JTextComponent.java:4387)
at javax.swing.text.JTextComponent$MutableCaretEvent.stateChanged
(JTextComponent.java:4409)
at javax.swing.text.DefaultCaret.fireStateChanged(DefaultCaret.java:782)
at javax.swing.text.DefaultCaret.changeCaretPosition
(DefaultCaret.java:1257)
at javax.swing.text.DefaultCaret.handleSetDot(DefaultCaret.java:1153)
at javax.swing.text.DefaultCaret.setDot(DefaultCaret.java:1134)
at javax.swing.text.DefaultCaret$Handler.removeUpdate
(DefaultCaret.java:1777)
at javax.swing.text.AbstractDocument.fireRemoveUpdate
(AbstractDocument.java:243)
at jsyntaxpane.SyntaxDocument.fireRemoveUpdate(SyntaxDocument.java:98)
at javax.swing.text.AbstractDocument.handleRemove
(AbstractDocument.java:608)
at javax.swing.text.AbstractDocument.remove(AbstractDocument.java:576)
at javax.swing.JEditorPane.setText(JEditorPane.java:1493)
at my code

What version of the product are you using? On what operating system?

r124 from the repository on Win XP.

Original issue reported on code.google.com by komoku on 12 Feb 2010 at 6:38

GoogleCodeExporter commented 9 years ago
I was not able o exactly recreate the issue with latest r128 code, but it did 
one 
throw an NPE after setText and some undoes.
That issue should not happen now.

Fixed in r129.

Original comment by ayman.al...@gmail.com on 5 May 2010 at 7:15