Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-113

NullPointerException in ChildContext when document only contains an empty root node

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.4
    • None

    Description

      In ChildContext I get a NullPointerException, the error appears in method prepare()

          iterator = (startFromParentLocation ? parent.getParent() : parent).childIterator(nodeTest,
                      reverse, startFromParentLocation ? parent : null);
      

      should be changed in my opinion to

      final NodePointer actualParent = startFromParentLocation ? parent.getParent() : parent;
              iterator = actualParent==null ? null : actualParent.childIterator(nodeTest,
                      reverse, startFromParentLocation ? parent : null);
      

      The tests triggering the error are testIssue172_CountFollowingSiblingNode and testIssue172_CountPrecedingSiblingNode

      Attachments

        Activity

          People

            britter Benedikt Ritter
            vivodamichele@hotmail.com Michele Vivoda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: