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.12-plugins 
            Reporter: hongbing wang


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

        

Reply via email to