I have a template with a pojo in the context with a method called
thumbResource(String, String)
When I parse the template with an null for the second parameter
$myPojo.thumbResource(main, null)
it throws the exception.
Debugging it in eclipse is just says :
java.lang.IllegalArgumentException: wrong number of arguments
It is thrown in the method.invoke method below ASTMethod.java
try
{
/*
* get the returned object. It may be null, and that is
* valid for something declared with a void return type.
* Since the caller is expecting something to be returned,
* as long as things are peachy, we can return an empty
* String so ASTReference() correctly figures out that
* all is well.
*/
Object obj = method.invoke(o, params);
if (obj == null)
{
if( method.getReturnType() == Void.TYPE)
{
return "";
}
}
return obj;
}
catch( InvocationTargetException ite )
{
return handleInvocationException(o, context,
ite.getTargetException());
}
/** Can also be thrown by method invocation **/
catch( IllegalArgumentException t )
{
return handleInvocationException(o, context, t);
}
I will try to debug it further.
Thanks
On 9 November 2016 at 16:09, Claude Brisson <[email protected]> wrote:
> I cannot reproduce it.
>
> Is the thumbResource() method overloaded?
>
> Do you have the full stacktrace?
>
>
> On 09/11/2016 16:50, Greg Huber wrote:
>
>> Hello,
>>
>> I am getting an error when a parameter on a method name is null, it says
>> "wrong number of arguments at"
>>
>> eg :
>>
>> $entry.filePath == null
>>
>> $myPojo.thumbResource($entry.name, $entry.filePath)
>>
>> I get an exception :
>>
>> java.lang.IllegalArgumentException: wrong number of arguments at..
>>
>>
>>
>> public String thumbResource(String name, String filePath) {
>> ...
>> }
>>
>> I have tried to debug it but it seems to originate in the ASTMethod class.
>> If i change the variable to be blanks it works ok.
>>
>>
>>
>>
>>
>>
>>
>>
>> On 9 November 2016 at 14:50, Claude Brisson <[email protected]> wrote:
>>
>> A new test build of Velocity Engine 2.0 is available.
>>>
>>> No determination as to the quality ('alpha,' 'beta,' or 'GA') of Velocity
>>> Engine 2.0 has been made, and at this time it is simply a "test build".
>>> We
>>> welcome any comments you may have, and will take all feedback into
>>> account
>>> if a quality vote is called for this build.
>>>
>>> Release notes:
>>>
>>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>>> ine/2.0/release-notes.html
>>>
>>> Distribution:
>>>
>>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-engine/2.0/
>>>
>>> Maven 2 staging repository:
>>>
>>> * https://repository.apache.org/content/repositories/orgapache
>>> velocity-1011/
>>>
>>> A vote regarding the quality of this test build will be initiated within
>>> the next couple of days.
>>>
>>>
>>> Regards,
>>>
>>> Claude
>>>
>>>
>>> On 07/11/2016 11:06, Claude Brisson wrote:
>>>
>>> The test build of Velocity Engine 2.0 is available.
>>>>
>>>> No determination as to the quality ('alpha,' 'beta,' or 'GA') of
>>>> Velocity
>>>> Engine 2.0 has been made, and at this time it is simply a "test build".
>>>> We
>>>> welcome any comments you may have, and will take all feedback into
>>>> account
>>>> if a quality vote is called for this build.
>>>>
>>>> Release notes:
>>>>
>>>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>>>> ine/2.0/release-notes.html
>>>>
>>>> Distribution:
>>>>
>>>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>>>> ine/2.0/
>>>>
>>>> Maven 2 staging repository:
>>>>
>>>> * https://repository.apache.org/content/repositories/orgapache
>>>> velocity-1010/
>>>>
>>>> A vote regarding the quality of this test build will be initiated within
>>>> the next couple of days.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Claude
>>>>
>>>>
>>>>
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>