On 9/2/07, Tomáš Procházka <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I have question related ConvertUtilsBeans class.
>
> Why all Converters has defined default value, only BigDecimalConverter and 
> BigIntegerConverter not?  When I need populate any bean with BigDecimal it's 
> fail on this if value is "". For example forms in Strus framework. When I 
> have Integer field and user send empty string BeanBindings convert it to 0, 
> but when I jave BigDecimal field get only:
>
> org.apache.commons.beanutils.ConversionException


I believe it was a mistake when BigDecimal / BigInteger converters
were added that they didn't provide a default value and wasn't
subsequently changed for compatibility reasons. You can simply
register instances of those converters with default values yourself to
overcome this:

Converter converter = new BigDecimalConverter(new BigDecimal("0.0"));
ConvertUtils.register(converter, BigDecimal.class);

Niall


> --
> Tomas Prochazka

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

Reply via email to