Commons JXPath
  1. Commons JXPath
  2. JXPATH-31

Problem with Pointer asPath method using dynamic beans

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0 Final
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      Hi,

      I noticed a strange behaviour of asPath, when I use dynamic beans (with
      DynamicPropertyHandler).

      Considering a dynamic property "properties", which contains a Vector with 5
      Objects (Strings in my case), using iteratePointers (works now ) returns a
      strange path using the asPath method on the returned pointers:

      [@name='properties'][1]
      [@name='properties'][2]
      [@name='properties'][3]
      [@name='properties'][4]
      [@name='properties'][5]

      This path leads (of course) to an error, when I invoke the context.getValue
      method with it. I attached a testcase.

      Also I noticed, that in some cases im my application the "index" begins with 2
      instead of 1. But I could not reproduce this in a simple testcase. It looks like
      this:

      [@name='properties'][2]
      [@name='properties'][3]
      [@name='properties'][4]
      [@name='properties'][5]

      Perhaps you'll face this behaviour too.

      Thanx
      Markus

        Activity

        Hide
        Dmitri Plotnikov added a comment -

        There were two problems: one with DynamicPropertyPointer - it generated an
        incorrect path. Once that was fixed, I discovered another: paths generated (now
        correctly) by those pointers were not interpreted correctly. That problem was
        with the PredicateContext, which failed to treat paths like "foo[@name='bar']
        [2]" correctly: instead of taking the first collection for name 'bar' and
        extracting the second element, it was in fact looking for a second collection
        named 'bar'.

        I could not reproduce the other issue: with iterations starting at #2.

        Show
        Dmitri Plotnikov added a comment - There were two problems: one with DynamicPropertyPointer - it generated an incorrect path. Once that was fixed, I discovered another: paths generated (now correctly) by those pointers were not interpreted correctly. That problem was with the PredicateContext, which failed to treat paths like "foo [@name='bar'] [2] " correctly: instead of taking the first collection for name 'bar' and extracting the second element, it was in fact looking for a second collection named 'bar'. I could not reproduce the other issue: with iterations starting at #2.
        Hide
        Markus Menner added a comment -

        Created an attachment (id=1963)
        Testcase for COM-83

        Show
        Markus Menner added a comment - Created an attachment (id=1963) Testcase for COM-83

          People

          • Assignee:
            Unassigned
            Reporter:
            Markus Menner
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development