You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Paul Nicolucci (JIRA)" <de...@myfaces.apache.org> on 2011/09/07 20:17:10 UTC

[jira] [Commented] (MYFACES-1890) Numberconverter has issue with bigdecimal

    [ https://issues.apache.org/jira/browse/MYFACES-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099167#comment-13099167 ] 

Paul Nicolucci commented on MYFACES-1890:
-----------------------------------------

I've run into an issue where this fix does not work.  When dealing with a composite component:

  valueBinding.getType(facesContext.getElContext());

returns java.lang.Object since the MapELResolver.getType returns Object.class in accordance with the EL Spec, the JavaDoc can be found here:

http://java.sun.com/javaee/5/docs/api/javax/el/MapELResolver.html

The fix was made in the following JIRA issue for the TomCat EL: 
https://issues.apache.org/bugzilla/show_bug.cgi?id=51177

So in the case of a composite component the MyFaces Implementation still has an issue.  I just wanted to make a note on this issue, I can open another JIRA issue if needed.

Could a context parameter be added to set df.setParseBigDecimal(true); so that we can avoid the problem faced here.  I think the only reason this was not made the default behavior was to keep some samples from failing or existing applications that depend on the behavior from failing.

I'm willing to create,test and contribute the fix.  Please let me know what your thoughts are on this issue.

Thanks,

Paul Nicolucci

> Numberconverter has issue with bigdecimal
> -----------------------------------------
>
>                 Key: MYFACES-1890
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1890
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions:  1.2.0, 1.2.2, 1.2.3
>            Reporter: Matthias Weßendorf
>            Assignee: Matthias Weßendorf
>             Fix For: 1.2.10, 2.0.3
>
>
> Due to a potential bug in BigDecimal there is a bug, when you use BigDecimal
> with a NumberConverter.
> Like
> <tr:inputText value="#{bean.number}" ...>
>   <tr:convertNumber />
> </tr:inputText>
> For instance, when the entered value is "333.111" the actual stored value is 333.1109999999999899955582804977893829345703125
> There is a mathematic explanation for that in here:
> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira