nordfalk/jsyntaxpane

ReplaceDialog doesn't work correctly when Replace field is empty

Closed this issue · 3 comments

What steps will reproduce the problem?
1. In JSyntaxPane Tester enter some text
2. Open the Find and Replace dialog
3. Enter some search string into "Find" field (which occurs in the text you 
entered
4. Leave "Replace" field empty
5. Click on "Next" -> the text is found and selected
6. Click on "Replace" -> text selection is replaced with "null"
7. Click on "Replace All" -> NullPointerException on the console

What is the expected output? What do you see instead?
For step 6 I would expect the selection to be replaced with an empty string, 
i.e. to be effectively deleted. Instead it's replaced by "null"

For step 7 I would expect all occurences of the search string to be replaced by 
an empty string (i.e. to be removed from the text). Instead a 
NullPointerException occurs.


What version of the product are you using? On what operating system?
jsyntaxpane-0.9.5-b27


Additional information:
Beginning of stacktrace:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.util.regex.Matcher.appendReplacement(Matcher.java:699)
        at java.util.regex.Matcher.replaceAll(Matcher.java:813)
        at jsyntaxpane.actions.DocumentSearchData.doReplaceAll(DocumentSearchDat
a.java:133)
        at jsyntaxpane.actions.gui.ReplaceDialog.jBtnReplaceAllActionPerformed(R
eplaceDialog.java:258)
[...]

Original issue reported on code.google.com by martin.z...@consol.de on 7 Jul 2010 at 9:23

recreated with latest trunk.

Original comment by ayman.al...@gmail.com on 8 Jul 2010 at 1:16

  • Changed state: Accepted
  • Added labels: Component-UI, Priority-High, Type-Defect, Usability
fixed in r135

Original comment by ayman.al...@gmail.com on 8 Jul 2010 at 2:22

Original comment by ayman.al...@gmail.com on 8 Jul 2010 at 2:22

  • Changed state: Fixed