Commons Digester
  1. Commons Digester
  2. DIGESTER-64

[digester] SetNestedPropertiesRule causes StackOverflowError

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      when setnestedpropertiesrule encounters something like:
      <foo>
      <bar>
      <foo>
      <bar>
      </bar>
      </foo>
      </bar>
      </foo>
      where it is added as a rule with a pattern of "*/foo/bar" it will end up calling
      SetNestedPropertiesRule$AnyChildRules.match in an infinite loop (see line 290)

        Activity

        Hide
        Simon Kitching added a comment -

        Yep, this is definitely a bug - and definitely my fault too. Too much
        optimisation, assuming that this rule will only be used on a "leaf" node

        I've created unit tests to duplicate the problem. I've also created a fix
        simply by removing all the optimisation attempted in the current version. But
        I'm not happy with this because 99% of the time it will be applied to a "leaf"
        node.

        I hope to have something to commit soonish. If anyone else wants to work on
        this, please contact me and I can provide the code I have so far.

        Thanks for the bug report James.

        Show
        Simon Kitching added a comment - Yep, this is definitely a bug - and definitely my fault too. Too much optimisation, assuming that this rule will only be used on a "leaf" node I've created unit tests to duplicate the problem. I've also created a fix simply by removing all the optimisation attempted in the current version. But I'm not happy with this because 99% of the time it will be applied to a "leaf" node. I hope to have something to commit soonish. If anyone else wants to work on this, please contact me and I can provide the code I have so far. Thanks for the bug report James.
        Hide
        Simon Kitching added a comment -

        Well, I've committed the simple fix (remove the optimisations that were causing
        the problem). The downside is that it now runs more slowly in the "normal" usecase.

        I'll try to revisit this sometime to implement optimisation correctly, but in
        the meantime the rule does at least work correctly now when invoked "re-entrantly".

        Show
        Simon Kitching added a comment - Well, I've committed the simple fix (remove the optimisations that were causing the problem). The downside is that it now runs more slowly in the "normal" usecase. I'll try to revisit this sometime to implement optimisation correctly , but in the meantime the rule does at least work correctly now when invoked "re-entrantly".

          People

          • Assignee:
            Unassigned
            Reporter:
            James L. Pine
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development