You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Sébastien Launay (JIRA)" <ji...@apache.org> on 2008/06/16 10:35:46 UTC
[jira] Created: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
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
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.
[jira] Updated: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger updated JCR-1650:
----------------------------------
Component/s: jackrabbit-spi-commons
Affects Version/s: 1.4
Affects jackrabbit-core in 1.4.x and jackrabbit-spi-commons in trunk.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, 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.
[jira] Resolved: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger resolved JCR-1650.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.5
Fixed in trunk at revision: 668086
Thank you for providing a patch and the detailed analysis.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, core 1.4.5
> Reporter: Sébastien Launay
> Fix For: 1.5
>
> 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.
[jira] Updated: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-1650:
-------------------------------
Fix Version/s: (was: 1.5)
core 1.4.6
Merged to the 1.4 branch in revision 700143. This fix will be included in jackrabbit-core 1.4.6.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, core 1.4.5
> Reporter: Sébastien Launay
> Fix For: core 1.4.6
>
> 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.
[jira] Commented: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Sébastien Launay (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635406#action_12635406 ]
Sébastien Launay commented on JCR-1650:
---------------------------------------
Thanks for the merge.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, core 1.4.5
> Reporter: Sébastien Launay
> Fix For: core 1.4.6
>
> 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.
[jira] Updated: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Sébastien Launay (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Issue Comment Edited: (JCR-1650) XPathQueryBuilder may not
handle multiple jcr:deref correctly
Posted by "Sébastien Launay (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605233#action_12605233 ]
yabon edited comment on JCR-1650 at 6/16/08 2:42 AM:
----------------------------------------------------------------
I think this is the same bug as JCR-1075.
was (Author: yabon):
I think this is the same bug.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, core 1.4.5
> Reporter: Sébastien Launay
> Fix For: 1.5
>
> 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.
[jira] Commented: (JCR-1650) XPathQueryBuilder may not handle
multiple jcr:deref correctly
Posted by "Sébastien Launay (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635370#action_12635370 ]
Sébastien Launay commented on JCR-1650:
---------------------------------------
I would like to have this fix backported to the 1.4 branch, possibly in the next release (1.4.6) as the 1.5 is not planned to be released soon.
> 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: jackrabbit-spi-commons, xpath
> Affects Versions: 1.4, core 1.4.5
> Reporter: Sébastien Launay
> Fix For: 1.5
>
> 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.