jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Launay (JIRA) <j...@apache.org>
Subject [jira] Updated: (JCR-1650) XPathQueryBuilder may not handle multiple jcr:deref correctly
Date Mon, 16 Jun 2008 08:53:45 GMT

     [ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sébastien Launay updated JCR-1650:
----------------------------------

    Attachment: jackrabbit-1.4.x-fix-multiple-jcr-deref-2008-06-16.patch

Patch for the 1.4 branch containing:
 * additional tests for reproducing this bug in DerefTest test case.
 * a fix by rewriting NAryQueryNode#removeOperand(QueryNode) without relying on Object#equals(Object)
but on reference comparison.

> XPathQueryBuilder may not handle multiple jcr:deref correctly
> -------------------------------------------------------------
>
>                 Key: JCR-1650
>                 URL: https://issues.apache.org/jira/browse/JCR-1650
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: xpath
>    Affects Versions: core 1.4.5
>            Reporter: Sébastien Launay
>         Attachments: jackrabbit-1.4.x-fix-multiple-jcr-deref-2008-06-16.patch
>
>
> If you have the following tree (inspired from DerefTest) :
> + people
>    + carl (worksfor -> company/microsoft)
>    + frank (worksfor -> company/microsoft)
> + company
>     + microsoft (eotm -> carl)
> The following queries will be translated to :
> testroot/people/frank/jcr:deref(@worksfor, '*')/jcr:deref(@eotm, '*')
> + Root node
> + Select properties: *
>   + PathQueryNode
>     + LocationStepQueryNode:  NodeTest={}testroot Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}people Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}frank Descendants=false Index=NONE
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
> => Matching carl node
> testroot/people/frank/jcr:deref(@worksfor, '*')/jcr:deref(@eotm, '*')[@jcr:uuid]
> + Root node
> + Select properties: *
>   + PathQueryNode
>     + LocationStepQueryNode:  NodeTest={}testroot Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}people Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}frank Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest=* Descendants=false Index=NONE
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
>       + RelationQueryNode: Op: NOT NULL Prop=@{http://www.jcp.org/jcr/1.0}uuid
> => Not matching carl node
> testroot/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm, '*')[@jcr:uuid]
> + Root node
> + Select properties: *
>   + PathQueryNode
>     + LocationStepQueryNode:  NodeTest={}testroot Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}people Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}frank Descendants=false Index=NONE
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
>       + RelationQueryNode: Op: NOT NULL Prop=@{http://www.jcp.org/jcr/1.0}uuid
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
>       + RelationQueryNode: Op: NOT NULL Prop=@{http://www.jcp.org/jcr/1.0}uuid
> => Matching carl node
> testroot/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm, '*')
> + Root node
> + Select properties: *
>   + PathQueryNode
>     + LocationStepQueryNode:  NodeTest={}testroot Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}people Descendants=false Index=NONE
>     + LocationStepQueryNode:  NodeTest={}frank Descendants=false Index=NONE
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
>       + RelationQueryNode: Op: NOT NULL Prop=@{http://www.jcp.org/jcr/1.0}uuid
>     + DerefQueryNode:  NodeTest=* Descendants=false Index=NONE
> => Matching carl node
> This is because XPathQueryBuilder calls NAryQueryNode#removeOperand(QueryNode)
> in order to replace current LocationStepQueryNode with a DerefQueryNode.
> NAryQueryNode#removeOperand(QueryNode) uses internally a List and thus
> relies on Object#equals(Object) for retrieving the object to remove.
> But the equals method is redefined for every QueryNode with a different semantic.
> Then, the call to NAryQueryNode#removeOperand(QueryNode) will not remove the
> wanted operand but the first operand returning true after calling equals in
> ArrayList#remove(Object).

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