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

NPE on parsing XPath query with child axis and star name at beginning (regression from 1.6.x)

    XMLWordPrintableJSON

    Details

      Description

      When adding the following to org.apache.jackrabbit.spi.commons.query.xpath.QueryFormatTest:

          public void testChildStarName() throws Exception {
              checkStatement("//element(*, foo)[child::*/@bar = 'bla']");
          }
      

      a NullPointerException is thrown while parsing:

      java.lang.NullPointerException
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.visit(QueryFormat.java:351)
              at org.apache.jackrabbit.spi.commons.query.RelationQueryNode.accept(RelationQueryNode.java:115)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.visit(QueryFormat.java:317)
              at org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode.accept(LocationStepQueryNode.java:166)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.visit(QueryFormat.java:260)
              at org.apache.jackrabbit.spi.commons.query.PathQueryNode.accept(PathQueryNode.java:74)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.visit(QueryFormat.java:115)
              at org.apache.jackrabbit.spi.commons.query.QueryRootNode.accept(QueryRootNode.java:115)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.<init>(QueryFormat.java:75)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormat.toString(QueryFormat.java:95)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormatTest.checkStatement(QueryFormatTest.java:80)
              at org.apache.jackrabbit.spi.commons.query.xpath.QueryFormatTest.testChildStarName(QueryFormatTest.java:71)
      

      This is a regression from Jackrabbit 1.6.5, where a similar test does run, i.e. parsing does not throw exception.

      The same NPE happens when "child::" is dropped, i.e. when the query looks like this:

      "//element(*, foo)[*/@bar = 'bla']"
      

        Attachments

        1. xpathqueryparser.patch
          3 kB
          Jörg von Frantzius

          Activity

            People

            • Assignee:
              schans Bart van der Schans
              Reporter:
              jfrantzius Jörg von Frantzius
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: