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 183115 - java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0 ? ^
Summary: java.util.regex.PatternSyntaxException: Dangling meta character '?' near inde...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
: 182595 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-29 18:12 UTC by sunbiz
Modified: 2011-11-09 17:56 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 156721


Attachments
stacktrace (2.53 KB, text/plain)
2010-03-29 18:12 UTC, sunbiz
Details
Added regex checking... also fixes #182595 (1.73 KB, patch)
2010-03-30 03:32 UTC, sunbiz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2010-03-29 18:12:02 UTC
Build: NetBeans IDE Dev (Build 100329-6c9dc7e53361)
VM: Java HotSpot(TM) Client VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b07
OS: Windows Server 2008

User Comments:
GUEST: I put a: '*' in the "Matching Rows: box in the data browser under services sql command

GUEST: Execute a query. Then type in a '?' in the "Matching Rows" field. Exception is thrown.

GUEST: I put a ? in the Matching Rows text box in the mysql

sunbiz: 1.) Write select query on database and get results
2.) In mathing characters type ? and exception is thrown




Stacktrace: 
java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0
?
^
   at java.util.regex.Pattern.error(Pattern.java:1713)
   at java.util.regex.Pattern.sequence(Pattern.java:1878)
   at java.util.regex.Pattern.expr(Pattern.java:1752)
   at java.util.regex.Pattern.compile(Pattern.java:1460)
   at java.util.regex.Pattern.<init>(Pattern.java:1133)
   at java.util.regex.Pattern.compile(Pattern.java:847)
Comment 1 sunbiz 2010-03-29 18:12:06 UTC
Created attachment 96262 [details]
stacktrace
Comment 2 sunbiz 2010-03-29 22:46:50 UTC
Should be NetFIXable [1]. Can do similar to #182595. Is that fine, then I attach a patch??

[1] http://wiki.netbeans.org/NetFIX
Comment 3 sunbiz 2010-03-30 03:32:25 UTC
Created attachment 96294 [details]
Added regex checking... also fixes #182595
Comment 4 Jiri Rechtacek 2010-03-30 15:11:34 UTC
Saptarshi, could you describe in detail how to reproduce the problem? I need to know how it happens to make a unit test that part of code. Thanks for the patch, I will review it then. Thanks
Comment 5 Jiri Rechtacek 2010-03-30 15:12:19 UTC
*** Bug 182595 has been marked as a duplicate of this bug. ***
Comment 6 sunbiz 2010-03-30 15:22:56 UTC
Steps to reproduce:
1.) Open Execute command on a SQL connection
2.) select * from <column-name> ... this will return rows
3.) You will see the matching rows field
4.) Type one of the pattern characters i.e * or \ in this field 

The exception is thrown...
Comment 7 Jiri Rechtacek 2010-03-31 13:16:59 UTC
Saptarshi, thanks for the steps. Now I see why I didn't reproduce this, on GTK (my default L&F) Matching Rows are not visible at all, I have to run IDE with other L&F - I filed issue 183264. I review your patch and it didn't work for me, some characters still throwing the exception. I fixed it in another way, using http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#quote%28java.lang.String%29 

Fixed in core-main/rev/8e5ea5fb080e
Comment 8 Quality Engineering 2010-04-02 04:57:28 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8e5ea5fb080e
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #183115: java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0 ? ^
Comment 9 Jiri Kovalsky 2010-04-02 09:14:27 UTC
OK, I have removed the issue from the NetFIX Pool. Thanks for your attempt Saptarshi anyway!
Comment 10 sunbiz 2010-04-02 14:23:29 UTC
yea... silly me. But thanks Jiri for reviewing
Comment 11 Jiri Rechtacek 2011-11-09 17:56:05 UTC
A better fix applied in core-main/rev/294c1c857218