Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
8244
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.