Commons Digester
  1. Commons Digester
  2. DIGESTER-71

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


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

      Operating System: All
      Platform: All


      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


        Emmanuel Bourg created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 8244 12340206
        Henri Yandell made changes -
        Component/s Digester [ 12311111 ]
        Affects Version/s unspecified [ 12311647 ]
        Key COM-55 DIGESTER-71
        Assignee Jakarta Commons Developers Mailing List [ ]
        Project Commons [ 12310458 ] Commons Digester [ 12310471 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


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


            • Created: