[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-3888) QueryParser to restrictive, does not allow hash sign (#) in string literal

Norman Richards (JIRA) jira-events at lists.jboss.org
Fri Jan 16 14:32:04 EST 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Norman Richards closed JBSEAM-3888.
-----------------------------------

    Fix Version/s: 2.1.2.CR1
       Resolution: Done


Thanks.  I've fixed this in trunk.  Even though the parsing mechanism here is quite poor, I'm hesitant to make any large changes to the way it works.  Instead, I've made the minimum change I could to allow non-expression uses of # without changing the overall mechanism.  Please let me know if it it works for you.

> QueryParser to restrictive, does not allow hash sign (#) in string literal
> --------------------------------------------------------------------------
>
>                 Key: JBSEAM-3888
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3888
>             Project: Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1.GA
>         Environment: jboss-seam-2.0.2.SP1, hibernate-entitymanager-3.4.0.GA, spring-2.5.6
>            Reporter: David Rosell
>            Assignee: Norman Richards
>             Fix For: 2.1.2.CR1
>
>
> The QueryParser are to restrictive when validating a query expression.
> It is not possible to use a hash sign (#) in a String literal query expression.
> An IllegalArgumentException are thrown for this query:
> String ejbql = "SELECT s FROM Service s WHERE s.name = 'DB#CORE' ";
> Query q = em.createQuery(ejbql);
> Rather than using:
>       StringTokenizer tokens = new StringTokenizer(ejbql, "#}", true);
> it would be better to be more precise in selecting what should be processed, use regexp and splitting the ejbql expression for #{...} instead.
> Exception stacktrace:
> java.lang.IllegalArgumentException: missing { after # in query fragment
> 	at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:52)
> 	at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:33)
> 	at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:66)
> 	at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.jboss.seam.ioc.spring.SeamManagedEntityManagerFactory$SeamManagedPersistenceContextHandler.invoke(SeamManagedEntityManagerFactory.java:142)
> 	at $Proxy71.createQuery(Unknown Source)
> 	at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
> 	at $Proxy58.createQuery(Unknown Source)
> 	at com.ford.volvocars.r2r.db.jpa.GenericDaoJpa.executeJpaQuery(GenericDaoJpa.java:40)

-- 
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