Commons JXPath
  1. Commons JXPath
  2. JXPATH-105

BasicNodeSet.getNodes() returns values instead of nodes ?

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.3
    • Labels:
      None
    • Environment:

      ALL

      Description

      In BasicNodeSet the method getNodes()
      adds the values instead of the nodes, using

      nodes.add(pointer.getValue());

      instead of what I think correct:

      nodes.add(pointer.getNode());

      Michele Vivoda

        Activity

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

        Do you have any code that triggers bad behavior attributable to this possible problem?

        Show
        Matt Benson added a comment - Do you have any code that triggers bad behavior attributable to this possible problem?
        Hide
        Michele Vivoda added a comment -

        No, I just went through the code and saw it as a possible bug. From the documentation one would expect the method to return nodes and not values. I think also that the private member

        {nodes}

        would be just a duplicate of

        {values}

        with the current code. If this is ok, getNodes() could return getValues() to be more clear.

        Show
        Michele Vivoda added a comment - No, I just went through the code and saw it as a possible bug. From the documentation one would expect the method to return nodes and not values. I think also that the private member {nodes} would be just a duplicate of {values} with the current code. If this is ok, getNodes() could return getValues() to be more clear.
        Hide
        Matt Benson added a comment -

        No, actually I think you're probably correct, but this code, though part of the API, seems to be virtually unexercised, so I have to create a testcase for BasicNodeSet and go from there. Thanks!

        Show
        Matt Benson added a comment - No, actually I think you're probably correct, but this code, though part of the API, seems to be virtually unexercised, so I have to create a testcase for BasicNodeSet and go from there. Thanks!
        Matt Benson committed 603646 (1 file)
        Reviews: none

        [JXPATH-105] getNodes() returned values instead of nodes

        Hide
        Matt Benson added a comment -

        I have committed this fix but still need to add a test to demonstrate the difference. The only place in JXPath where the node and value are not the same is in XML models.

        Show
        Matt Benson added a comment - I have committed this fix but still need to add a test to demonstrate the difference. The only place in JXPath where the node and value are not the same is in XML models.
        Matt Benson committed 604239 (1 file)
        Hide
        Matt Benson added a comment -

        Added test rev 604239

        Show
        Matt Benson added a comment - Added test rev 604239
        Matt Benson made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.3 [ 12312253 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development