commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucian Chirita (JIRA)" <>
Subject [jira] Created: (BEANUTILS-351) FloatLocaleConverter cannot parse 0
Date Wed, 01 Jul 2009 12:08:47 GMT
FloatLocaleConverter cannot parse 0

                 Key: BEANUTILS-351
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Locale BeanUtils / Converters
    Affects Versions: 1.8.0
            Reporter: Lucian Chirita

FloatLocaleConverter fails to parse the "0" string, complaining that the value is not of type

Doing new LocaleConvertUtilsBean().convert("0", Float.class, Locale.US, null) results in the
following exception:

Exception in thread "main" org.apache.commons.beanutils.ConversionException: Supplied number
is not of type Float: 0
	at org.apache.commons.beanutils.locale.converters.FloatLocaleConverter.parse(
	at org.apache.commons.beanutils.locale.BaseLocaleConverter.convert(
	at org.apache.commons.beanutils.locale.LocaleConvertUtilsBean.convert(
	at Code.main(

Looking at the source of FloatLocaleConverter, line 221 which originally reads

if (posDouble < Float.MIN_VALUE || posDouble > Float.MAX_VALUE) {

should be changed to 

if ((posDouble > 0 && posDouble < Float.MIN_VALUE) || posDouble > Float.MAX_VALUE)

in order to fix the bug.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message