Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Labels:
      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

        Activity

        Michele Vivoda created issue -
        Hide
        Michele Vivoda added a comment -

        Test case:

        XML

        <xml/>

        XPATH

        //following-sibling::node()

        Show
        Michele Vivoda added a comment - Test case: XML <xml/> XPATH //following-sibling::node()
        Hide
        Matt Benson added a comment -

        This one was obvious enough that just a claim of an NPE was good enough. I've committed essentially the fix you've suggested, rev 617893. Thanks!

        Show
        Matt Benson added a comment - This one was obvious enough that just a claim of an NPE was good enough. I've committed essentially the fix you've suggested, rev 617893. Thanks!
        Matt Benson made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s 1.3 [ 12312253 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Michele Vivoda added a comment -

        Hi,

        I just compiled JXPath and got back the NPE, code was the same as when bug was opened. After a while I think I sorted it out:

        Patch was applied with a typo, using [parent] instead than [actualParent] / [useParent].

        then Emmanuel Bourg removed the check that was actually useless, revision 652903 and bug is back

        So I would apply the initial proposal, as written in the bug description.

        http://mail-archives.apache.org/mod_mbox/commons-commits/200805.mbox/%3C20080502204633.322742388A08@eris.apache.org%3E

        Show
        Michele Vivoda added a comment - Hi, I just compiled JXPath and got back the NPE, code was the same as when bug was opened. After a while I think I sorted it out: Patch was applied with a typo, using [parent] instead than [actualParent] / [useParent] . then Emmanuel Bourg removed the check that was actually useless, revision 652903 and bug is back So I would apply the initial proposal, as written in the bug description. http://mail-archives.apache.org/mod_mbox/commons-commits/200805.mbox/%3C20080502204633.322742388A08@eris.apache.org%3E
        Michele Vivoda made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Emmanuel Bourg added a comment -

        Michele, do you think you could provide a patch with a test case please? If you are used to git you can also fork the repository on Github and send a pull request.

        https://github.com/apache/commons-jxpath

        Show
        Emmanuel Bourg added a comment - Michele, do you think you could provide a patch with a test case please? If you are used to git you can also fork the repository on Github and send a pull request. https://github.com/apache/commons-jxpath
        Hide
        Michele Vivoda added a comment -

        Done !

        Show
        Michele Vivoda added a comment - Done !
        Hide
        Michele Vivoda added a comment - - edited

        Hi Emmanuel Bourg , I did the pull request some time ago but is still there.

        https://github.com/apache/commons-jxpath/pulls

        Show
        Michele Vivoda added a comment - - edited Hi Emmanuel Bourg , I did the pull request some time ago but is still there. https://github.com/apache/commons-jxpath/pulls

          People

          • Assignee:
            Unassigned
            Reporter:
            Michele Vivoda
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development