DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8244>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8244

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

           Summary: CallMethodRule rule can't be used to call no arg methods
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Digester
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to