You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Lucian Chirita (JIRA)" <ji...@apache.org> on 2009/07/01 14:08:47 UTC

[jira] Created: (BEANUTILS-351) FloatLocaleConverter cannot parse 0

FloatLocaleConverter cannot parse 0
-----------------------------------

                 Key: BEANUTILS-351
                 URL: https://issues.apache.org/jira/browse/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 Float.

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(FloatLocaleConverter.java:222)
	at org.apache.commons.beanutils.locale.BaseLocaleConverter.convert(BaseLocaleConverter.java:232)
	at org.apache.commons.beanutils.locale.LocaleConvertUtilsBean.convert(LocaleConvertUtilsBean.java:285)
	at Code.main(Code.java:65)

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.


[jira] Resolved: (BEANUTILS-351) FloatLocaleConverter cannot parse 0

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BEANUTILS-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved BEANUTILS-351.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.8.1
         Assignee: Niall Pemberton

Fixed thanks

http://svn.apache.org/viewvc?view=rev&revision=800988

> FloatLocaleConverter cannot parse 0
> -----------------------------------
>
>                 Key: BEANUTILS-351
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-351
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Locale BeanUtils / Converters
>    Affects Versions: 1.8.0
>            Reporter: Lucian Chirita
>            Assignee: Niall Pemberton
>             Fix For: 1.8.1
>
>
> FloatLocaleConverter fails to parse the "0" string, complaining that the value is not of type Float.
> 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(FloatLocaleConverter.java:222)
> 	at org.apache.commons.beanutils.locale.BaseLocaleConverter.convert(BaseLocaleConverter.java:232)
> 	at org.apache.commons.beanutils.locale.LocaleConvertUtilsBean.convert(LocaleConvertUtilsBean.java:285)
> 	at Code.main(Code.java:65)
> 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.