jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Reschke (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (JCR-1748) InvalidQueryException if search string contains escaped single quote
Date Sun, 21 Sep 2008 18:55:44 GMT

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


Mime
View raw message