incorrect convertNumber behavior when integerOnly="true"
--------------------------------------------------------

                 Key: TRINIDAD-1421
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1421
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
            Reporter: Cale Scholl
            Priority: Minor


If you have

<af:inputText id="it1" label="Label 1">
   <af:convertNumber integerOnly="true" />
</af:inputText>

then entering a fractional value (i.e. 23.45) causes an error to be thrown, 
which is wrong; instead, just the integer part should be parsed and formatted.

When the converter is an instance of "TrIntegerConverter", it calls 
_decimalParse, which calls parseInt, and that is why we're seeing the error. 
The problem is in 
trinidad-impl\src\main\java\org\apache\myfaces\trinidadinternal\convert\NumberConverter.java
 -> _getTrNumberConverter:

      if(this.isIntegerOnly() && this.getPattern() == null && 
"number".equals(this.getType()))
      {
        outBuffer.append("new TrIntegerConverter(");
        outBuffer.append("null,null,0,");
        outBuffer.append(IntegerUtils.getString(Integer.MAX_VALUE));
        outBuffer.append(',');
        outBuffer.append(IntegerUtils.getString(Integer.MIN_VALUE));
        outBuffer.append(")");
      }

I think creating a TrIntegerConverter instance isn't appropriate under any 
circumstances, so we should probably just remove the above if-clause.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to