You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Scott O'Bryan (Commented) (JIRA)" <de...@myfaces.apache.org> on 2012/02/20 23:55:35 UTC

[jira] [Commented] (TRINIDAD-2165) TrNumberFormat of TrNumberConverter doesn't accept 0 for maximumFractionDigits or maximumIntegerDigits

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

Scott O'Bryan commented on TRINIDAD-2165:
-----------------------------------------

I think the component versions are probably wrong for this change.

                
> TrNumberFormat of TrNumberConverter doesn't accept 0 for maximumFractionDigits or maximumIntegerDigits
> ------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2165
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2165
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.10-plugins ,  2.0.3-plugins 
>            Reporter: hongbing wang
>         Attachments: NumberFormat.patch
>
>
> Also need the fix in 2.0.2.
> TrNumberconverter sets its _maxFractionDigits and _maxIntegerDigits to its _numberFormat and then gets then from _numberFormat when calling getAsString(). But TrNumberFormat ignores value of 0 in the following methods
> TrNumberFormat.prototype.setMaximumFractionDigits = function(number)
> {
>   //taken from the Apache Harmony project, but allow the number to be 0
>   if (number)
>   {
>     this._maxFractionDigits = number < 0 ? 0 : number;
>     if (this._maxFractionDigits < this._minFractionDigits)
>     {
>       this._minFractionDigits = this._maxFractionDigits;
>     }
>   }
> } 
> TrNumberFormat.prototype.setMaximumIntegerDigits = function(number)
> {
>   //taken from the Apache Harmony project, but allow the number to be 0
>   if (number)
>   {
>     this._maxIntegerDigits = number < 0 ? 0 : number;
>     if (this._minIntegerDigits > this._maxIntegerDigits)
>     {
>       this._minIntegerDigits = this._maxIntegerDigits;
>     }
>   }
> } 
> So the passed in value is not respected, instead the default value is used. Say for an input text component has a maxFactionDigits=0, user enters 2.66, TrNumberConverter will keep its value as 2.66, instead of 3 as user expects.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira