[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4087) Regexp Query.SUBJECT_PATTERN may be improved for JBSEAM-3032
Julien Kronegg (JIRA)
jira-events at lists.jboss.org
Wed Apr 8 04:10:23 EDT 2009
Regexp Query.SUBJECT_PATTERN may be improved for JBSEAM-3032
------------------------------------------------------------
Key: JBSEAM-4087
URL: https://jira.jboss.org/jira/browse/JBSEAM-4087
Project: Seam
Issue Type: Quality Risk
Components: Framework
Environment: https://jira.jboss.org/jira/browse/JBSEAM-3032
http://fisheye.jboss.org/browse/Seam/trunk/src/main/org/jboss/seam/framework/Query.java?r=10341
Reporter: Julien Kronegg
The regexp Pattern Query.SUBJECT_PATTERN has been added for JBSEAM-3032:
private static final Pattern SUBJECT_PATTERN = Pattern.compile("^select (\\w+((\\s+|\\.)\\w+)*)\\s+from", Pattern.CASE_INSENSITIVE);
This pattern should be improved because it will not match queries such as:
select vehicle1.person from Vehicle vehicle1
select vehicle2.person, vehicle2.color from Vehicle vehicle2
select vehicle3.person from Vehicle vehicle3 where vehicle3.id in (select c.id from Cars c)
select vehicle4 . person from Vehicle vehicle4
The following pattern will accept all of the above queries:
Pattern.compile("^select\\s+(\\w+(?:\\s*\\.\\s*\\w+)*?)(?:\\s*,\\s*(\\w+(?:\\s*\\.\\s*\\w+)*?))*?\\s+from", Pattern.CASE_INSENSITIVE);
The test case http://fisheye.jboss.org/browse/Seam/trunk/src/test/unit/org/jboss/seam/test/unit/QueryTest.java?r=10260 should also be completed by the queries above.
Notes:
- the priority has been set the same JBSEAM-3032
- the original pattern matches in about 300 ns while the proposed pattern matches in 2300 ns
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list