I upgraded to Velocity 1.6.2 from 1.3.1 and have run into an issue with
our existing code/templates. 

The NumberFormat class has format(double ..), format(long ..), and
format(Object ..) methods. The format(Object ..) method should be
invoked but instead is treated as a missing method.

Velocity 1.6.2 is incorrectly invoking invalidMethod() when the
overloaded java.text.DecimalFormat.format(Object value) method is called
with a Float wrapper. 

Here is some sample code.

Test.java
...
NumberFormat formatter = NumberFormat.getCurrencyInstance();
context.put("formatter", formatter);
context.put("aDouble", new Double(1.2f));
context.put("aFloat", new Float(1.2f));
...

Test.vm

formatted double is $formatter.format($aDouble)
formatted float is $formatter.format($aFloat)

Rendered text

formatted double is $1.20
formatted float is $formatter.format($aFloat) 


This behavior worked correctly in 1.3.1-rc2 so it appears to be an
issue, however, this would seem to be such common usage that I would
guess I am doing something wrong.

Can any shed some light on this problem?

Thanks,
Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to