This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 160807 - IllegalArgumentException: Illegal group reference
Summary: IllegalArgumentException: Illegal group reference
Status: RESOLVED DUPLICATE of bug 119819
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@editor
URL: http://statistics.netbeans.org/except...
Keywords: NETFIX, SIMPLEFIX
Depends on:
Blocks:
 
Reported: 2009-03-21 22:18 UTC by sgtgarcia
Modified: 2009-04-16 10:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 10891


Attachments
stacktrace (2.91 KB, text/plain)
2009-03-21 22:19 UTC, sgtgarcia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sgtgarcia 2009-03-21 22:18:58 UTC
Build: NetBeans IDE Dev (Build 200902231810)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Linux, 2.6.27-13-generic, i386

User Comments:
rptmaestro: This error occured while I was performing a search and replace in a sql file

GUEST: Doing a "find and replace" using regular expressions. I wasn't sure how to put newline characters ("\n") in the "Replace With:" box. I tried \n, which just rendered "n", then i tried $n, which resulted in this error.

sgtgarcia: Search and replace in file whith regular expression in search

GUEST: Search and replace using regexp

mschovanek: to reproduce:
-----------
1) in a editor window invoke Find & Replace
2) check Regular Expressions box
3) find: a replace: ${a}
ERROR: IDE throws the IAE

We should improve the way how IDE handles this RE errors. Eg. in FCS build user can easily miss it.

GUEST: Doing a search and replace with $$ in the replacement text

petiex: find replace with regular expressions



Stacktrace: 
java.lang.IllegalArgumentException: Illegal group reference
        at java.util.regex.Matcher.appendReplacement(Matcher.java:713)
        at java.util.regex.Matcher.replaceFirst(Matcher.java:861)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceImpl(DocumentFinder.java:253)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult(DocumentFinder.java:312)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findReplaceInBlock(EditorFindSupport.java:596)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.replaceAll(EditorFindSupport.java:779)
Comment 1 sgtgarcia 2009-03-21 22:19:06 UTC
Created attachment 78586 [details]
stacktrace
Comment 2 Vitezslav Stejskal 2009-03-23 17:21:58 UTC
Ideally the dialog should verify entered regex patterns and clearly communicate errors to the user without crashing.
Comment 3 Jiri Kovalsky 2009-03-30 14:22:00 UTC
Vita Stejskal agreed that he would review and integrate a patch for this issue contributed by the NetFIX [1] team.

[1] http://wiki.netbeans.org/NetFIX
Comment 4 Alexei Mokeev 2009-04-16 10:34:51 UTC
Pure duplicate of 119819

*** This issue has been marked as a duplicate of 119819 ***