Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-578

QueryParser.parse(...) parses wrong the ".[@a=3 and @b=3 or @c=3]" XPath statement.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 0.9, 1.0, 1.0.1, 1.1
    • None
    • xpath
    • None

    Description

      1. What I do:

      import org.apache.jackrabbit.core.query.*;
      ...
      QueryRootNode n1, n2;
      String q1 = ".[(@a=3 and @b=3) or @c=3]";
      String q2 = ".[ @a=3 and @b=3 or @c=3]";
      n1 = QueryParser.parse( q1, "xpath", nsRegistry);
      n2 = QueryParser.parse( q2, "xpath", nsRegistry);
      System.out.println( n1.dump() );
      System.out.println( n2.dump() );

      2. What I expected to:
      I expect the QueryParser parse the both cases with the same result.
      So I expect to see on my console the same AQT dump (for the both n1 and n2 cases).

      3. What have I got:
      The QueryParser has parsed the q1 statement (in right way): 'OR' node has 2 operands, one of witch is 'AND' node with its 2 operands.
      However the q2 statement is parsed as an 'OR' node predicate with only 1 operand; this one operand is 'AND' node, having in its turn all the 3 relation (as its operands).
      The output is the following:
      ...
      + OrQueryNode
      + AndQueryNode
      + RelationQueryNode: Op: = Prop={}a Type=LONG Value=3
      + RelationQueryNode: Op: = Prop={}b Type=LONG Value=3
      + RelationQueryNode: Op: = Prop={}c Type=LONG Value=3
      ...
      + OrQueryNode
      + AndQueryNode
      + RelationQueryNode: Op: = Prop={}a Type=LONG Value=3
      + RelationQueryNode: Op: = Prop={}b Type=LONG Value=3
      + RelationQueryNode: Op: = Prop={}c Type=LONG Value=3

      4. Resume:
      I think the second case is parsed in a wrong way, because it's interpreted as tree operand 'AND' condition:
      "@a=3 and @b=3 and @c=3".

      Attachments

        Activity

          People

            jukkaz Jukka Zitting
            epox_spb Eugene Porubaev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: