[
https://issues.apache.org/jira/browse/TRINIDAD-1374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666324#action_12666324
]
Yee-Wah Lee commented on TRINIDAD-1374:
---------------------------------------
trinidad-api\src\main\java\org\apache\myfaces\trinidad\convert\NumberConverter.java
getAsObject() does:
if("currency".equals(type))
{
params = new Object[] {label, getPattern(),
fmt.format(_EXAMPLE_CURRENCY)};
}
else if("percent".equals(type))
{
params = new Object[] {label, getPattern(),
fmt.format(_EXAMPLE_PERCENT)};
}
else
{
params = new Object[] {label, getPattern()};
}
Then getConvertMessage() does:
if (_PATTERN_TYPE == type)
{
convMsgDet = _getRawConvertPatternMessageDetail();
msgId = CONVERT_PATTERN_MESSAGE_ID;
}
else if(_NUMBER_TYPE == type)
{
convMsgDet = _getRawConvertNumberMessageDetail();
msgId = CONVERT_NUMBER_MESSAGE_ID;
}
else if(_CURRENCY_TYPE == type)
{
convMsgDet = _getRawConvertCurrencyMessageDetail();
msgId = CONVERT_CURRENCY_MESSAGE_ID;
}
else if(_PERCENT_TYPE == type)
{
convMsgDet = _getRawConvertPercentMessageDetail();
msgId = CONVERT_PERCENT_MESSAGE_ID;
}
where CONVERT_PATTERN_MESSAGE_ID is given by:
{"org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN_detail",
"The format of the number must match this pattern: {2}"}
The problem is that {2} should be {1}, since in the constructed param array
params = new Object[] {label, getPattern()};
the pattern is at index 1.
Furthermore, getAsObject() should check for _PATTERN_TYPE first.
> NumberConverter with type='number' and pattern set gives malformed error
> ------------------------------------------------------------------------
>
> Key: TRINIDAD-1374
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1374
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components
> Reporter: Yee-Wah Lee
> Priority: Minor
>
> 1. Add an inputText with child numberConverter that has type='number' and a
> pattern set.
> e.g.
> <tr:inputText value="99.99" label="number converter1">
> <f:facet name="help">
> <tr:outputText value="type='number' integerOnly='true' -
> This will result in fraction part to be omitted"/>
> </f:facet>
> <f:convertNumber type="number" pattern="0.0"/>
> </tr:inputText>
> 2. Run the jspx and type in malformed input.
> 3. submit the page, the error message for the component is:
> The format of the number must match this pattern: {2}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.