You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/10/31 09:25:17 UTC

[jira] Updated: (BEANUTILS-44) [beanutils] FloatLocaleConverter cannot parse negative values

     [ http://issues.apache.org/jira/browse/BEANUTILS-44?page=all ]

Henri Yandell updated BEANUTILS-44:
-----------------------------------

      Bugzilla Id:   (was: 33841)
    Fix Version/s: 1.8.0

I think this should be dealt with in 1.8.0. Refactoring heavily sounds good here.

> [beanutils] FloatLocaleConverter cannot parse negative values
> -------------------------------------------------------------
>
>                 Key: BEANUTILS-44
>                 URL: http://issues.apache.org/jira/browse/BEANUTILS-44
>             Project: Commons BeanUtils
>          Issue Type: Bug
>         Environment: Operating System: All
> Platform: All
>            Reporter: Paul Jenkins
>             Fix For: 1.8.0
>
>
> Problem found in Build 1.7
> LocaleBeanUtils.setProperty(bean, name, value);
> Does not handle negative values. When processing negative values the 
> FloatLocaleConverter.parse(value, pattern) throws a ConversionException because 
> of the following if test: -
> if(Math.abs(parsed.doubleValue() - parsed.floatValue()) > 
>                                           parsed.floatValue() * 0.00001) {
>   throw new ConversionException(...);
> }
> This test will always fail for a valid negative value because the 
> multiplication by 0.00001 will result in a negative value which will be less 
> then the abs subtraction.
> A solution to this problem would be to check Math.abs(parsed.floatValue() * 
> 0.00001)
> We also suffer from the previously reported problem of the locale converters 
> not supporting boolean to get round this problem we have to determine the 
> property type and call either LocaleBeanUtils.setProperty() or 
> BeanUtils.setProperty() this would be made easier if the: -
> protected Descriptor calculate(Object bean, String name) 
> method was made public.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org