From dev-return-19160-apmail-jackrabbit-dev-archive=jackrabbit.apache.org@jackrabbit.apache.org Mon Jun 16 08:36:19 2008 Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 29297 invoked from network); 16 Jun 2008 08:36:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jun 2008 08:36:19 -0000 Received: (qmail 75927 invoked by uid 500); 16 Jun 2008 08:36:20 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 75889 invoked by uid 500); 16 Jun 2008 08:36:20 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 75878 invoked by uid 99); 16 Jun 2008 08:36:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 01:36:20 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 08:35:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7DF9B234C141 for ; Mon, 16 Jun 2008 01:35:46 -0700 (PDT) Message-ID: <1970920048.1213605346514.JavaMail.jira@brutus> Date: Mon, 16 Jun 2008 01:35:46 -0700 (PDT) From: =?utf-8?Q?S=C3=A9bastien_Launay_=28JIRA=29?= To: dev@jackrabbit.apache.org Subject: [jira] Created: (JCR-1650) XPathQueryBuilder may not handle multiple jcr:deref correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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=C3=A9bastien 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=3D{}testroot Descendants=3Dfalse Ind= ex=3DNONE + LocationStepQueryNode: NodeTest=3D{}people Descendants=3Dfalse Index= =3DNONE + LocationStepQueryNode: NodeTest=3D{}frank Descendants=3Dfalse Index= =3DNONE + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE =3D> Matching carl node testroot/people/frank/jcr:deref(@worksfor, '*')/jcr:deref(@eotm, '*')[@jcr:= uuid] + Root node + Select properties: * + PathQueryNode + LocationStepQueryNode: NodeTest=3D{}testroot Descendants=3Dfalse Ind= ex=3DNONE + LocationStepQueryNode: NodeTest=3D{}people Descendants=3Dfalse Index= =3DNONE + LocationStepQueryNode: NodeTest=3D{}frank Descendants=3Dfalse Index= =3DNONE + LocationStepQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + RelationQueryNode: Op: NOT NULL Prop=3D@{http://www.jcp.org/jcr/1.0= }uuid =3D> Not matching carl node testroot/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,= '*')[@jcr:uuid] + Root node + Select properties: * + PathQueryNode + LocationStepQueryNode: NodeTest=3D{}testroot Descendants=3Dfalse Ind= ex=3DNONE + LocationStepQueryNode: NodeTest=3D{}people Descendants=3Dfalse Index= =3DNONE + LocationStepQueryNode: NodeTest=3D{}frank Descendants=3Dfalse Index= =3DNONE + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + RelationQueryNode: Op: NOT NULL Prop=3D@{http://www.jcp.org/jcr/1.0= }uuid + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + RelationQueryNode: Op: NOT NULL Prop=3D@{http://www.jcp.org/jcr/1.0= }uuid =3D> Matching carl node testroot/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,= '*') + Root node + Select properties: * + PathQueryNode + LocationStepQueryNode: NodeTest=3D{}testroot Descendants=3Dfalse Ind= ex=3DNONE + LocationStepQueryNode: NodeTest=3D{}people Descendants=3Dfalse Index= =3DNONE + LocationStepQueryNode: NodeTest=3D{}frank Descendants=3Dfalse Index= =3DNONE + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE + RelationQueryNode: Op: NOT NULL Prop=3D@{http://www.jcp.org/jcr/1.0= }uuid + DerefQueryNode: NodeTest=3D* Descendants=3Dfalse Index=3DNONE =3D> Matching carl node This is because XPathQueryBuilder calls NAryQueryNode#removeOperand(QueryNo= de) 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 sem= antic. Then, the call to NAryQueryNode#removeOperand(QueryNode) will not remove th= e wanted operand but the first operand returning true after calling equals in ArrayList#remove(Object). --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.