Array arguments in method calls are wrapped with an extra array
---------------------------------------------------------------
Key: VELOCITY-642
URL: https://issues.apache.org/jira/browse/VELOCITY-642
Project: Velocity
Issue Type: Bug
Components: Engine
Affects Versions: 1.6-beta1
Reporter: Ilkka Priha
Velocity 1.6 b2 wraps array arguments of method calls with an extra array
causing the calls to fail and making this version incompatible with previous
versions.
A simple template, like this, demonstrates the behavior:
#set ($_array = [ 1, 2, 3 ])
$test.arrayTest($_array.toArray())
Depending on the signature of test.arrayTest() , the template prints:
public String arrayTest(Object[] array)
{
return java.util.Arrays.deepToString((Object[]) array);
}
[[1, 2, 3]]
public String arrayTest(Object... array)
{
return java.util.Arrays.deepToString(array);
}
[[1, 2, 3]]
public String arrayTest(Object array)
{
return java.util.Arrays.deepToString((Object[]) array);
}
[1, 2, 3]
Actually, I noticed later that the argument doesn't have to be an array, this
version of Velocity seems to wrap any argument into an array if the method
expects an array. So maybe this is a feature and not a bug, but it should
detect already correct array arguments and leave them intact to keep existing
templates working.
-- Ilkka
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]