Commons Digester
  1. Commons Digester
  2. DIGESTER-71

CallMethodRule rule can't be used to call no arg methods

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      The digester's CallMethodRule rule can't be used to call methods taking no
      argument. The main issue is the semantic of the constructor, a paramCount of 0
      doesn't stand for "no argument" but for "pass the tag body as argument", thus
      preventing the call of no arg methods on the parent objet.

      One could expect CallMethodRule to behave like Class.getMethod(), that is, a
      null or empty Class[] array means we are looking for a no argument method.
      Currently the decision is not made on the value of paramTypes but on the value
      of paramCount. If paramType is empty or null it's forced to an array with a
      single String.class element :

      in the constructor :

      if (paramTypes == null) {
      this.paramTypes = new Class[paramCount];

      and later in end() :

      if (paramTypes.length == 0)

      { paramTypes = new Class[1]; paramTypes[0] = "abc".getClass(); }

      Fixing this issue is just a matter of letting paramTypes untouched till the
      method.invoke() call.

      1. ASF.LICENSE.NOT.GRANTED--CallMethodRule-noargfix.txt
        7 kB
        Emmanuel Bourg
      2. ASF.LICENSE.NOT.GRANTED--Test5.xml
        0.4 kB
        Emmanuel Bourg
      3. ASF.LICENSE.NOT.GRANTED--tmp.txt
        2 kB
        Michael Marrotte

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Emmanuel Bourg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development