You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Ruslan Romanov (JIRA)" <ji...@apache.org> on 2008/09/21 12:21:44 UTC

[jira] Created: (JCR-1748) InvalidQueryException if search string contains escaped single quote

InvalidQueryException if search string contains escaped single quote
--------------------------------------------------------------------

                 Key: JCR-1748
                 URL: https://issues.apache.org/jira/browse/JCR-1748
             Project: Jackrabbit
          Issue Type: Bug
            Reporter: Ruslan Romanov


If you try to perform a search like this

//element(*, nt:base)[jcr:contains(., 'get\'em all')]

you get this exception

javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 71.  Encountered: <EOF> after : "\'] return $v"


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1748) InvalidQueryException if search string contains escaped single quote

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke resolved JCR-1748.
---------------------------------

    Resolution: Invalid

What makes you think that the backslash can be used for escaping here?

See JSR 170, Section 6.6.4.9:

"However, the apostrophe (') and quotation
mark(") must be escaped according to the standard rules of XPath
with regard to string literals: If the literal is delimited by
apostrophes, two adjacent apostrophes within the literal are
interpreted as a single apostrophe. Similarly, if the literal is
delimited by quotation marks, two adjacent quotation marks within
the literal are interpreted as one quotation mark."

Thus you need to use:

  //element(*, nt:base)[jcr:contains(., 'get''em all')] 

or simply

  //element(*, nt:base)[jcr:contains(., "get'em all")] 

(check http://people.apache.org/~mreutegg/jcr-query-translator/translator.html -- this is really helpful for debugging query syntax)

> InvalidQueryException if search string contains escaped single quote
> --------------------------------------------------------------------
>
>                 Key: JCR-1748
>                 URL: https://issues.apache.org/jira/browse/JCR-1748
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: query
>            Reporter: Ruslan Romanov
>
> If you try to perform a search like this
> //element(*, nt:base)[jcr:contains(., 'get\'em all')]
> you get this exception
> javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 74.  Encountered: <EOF> after : "\')] return $v"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1748) InvalidQueryException if search string contains escaped single quote

Posted by "Ruslan Romanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruslan Romanov updated JCR-1748:
--------------------------------

    Description: 
If you try to perform a search like this

//element(*, nt:base)[jcr:contains(., 'get\'em all')]

you get this exception

javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 74.  Encountered: <EOF> after : "\')] return $v"

  was:
If you try to perform a search like this

//element(*, nt:base)[jcr:contains(., 'get\'em all')]

you get this exception

javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 71.  Encountered: <EOF> after : "\'] return $v"



> InvalidQueryException if search string contains escaped single quote
> --------------------------------------------------------------------
>
>                 Key: JCR-1748
>                 URL: https://issues.apache.org/jira/browse/JCR-1748
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: query
>            Reporter: Ruslan Romanov
>
> If you try to perform a search like this
> //element(*, nt:base)[jcr:contains(., 'get\'em all')]
> you get this exception
> javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 74.  Encountered: <EOF> after : "\')] return $v"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1748) InvalidQueryException if search string contains escaped single quote

Posted by "Ruslan Romanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruslan Romanov updated JCR-1748:
--------------------------------

    Component/s: query

> InvalidQueryException if search string contains escaped single quote
> --------------------------------------------------------------------
>
>                 Key: JCR-1748
>                 URL: https://issues.apache.org/jira/browse/JCR-1748
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: query
>            Reporter: Ruslan Romanov
>
> If you try to perform a search like this
> //element(*, nt:base)[jcr:contains(., 'get\'em all')]
> you get this exception
> javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 71.  Encountered: <EOF> after : "\'] return $v"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.