Lukasz Lenart created WW-5836:
---------------------------------
Summary: Number tag and localized text arguments do not bound
integer digits when formatting BigDecimal
Key: WW-5836
URL: https://issues.apache.org/jira/browse/WW-5836
Project: Struts 2
Issue Type: Bug
Components: Core
Reporter: Lukasz Lenart
WW-5828 bounded the number of integer digits {{StringConverter}} emits when it
formats a {{BigDecimal}}, falling back to {{BigDecimal.toString()}} past the
bound so that the length of the output follows the precision of the value
rather than its scale.
Two other places in core format a {{BigDecimal}} without going through
{{StringConverter}}, and neither applies the same bound:
* the {{number}} tag formats the value it finds on the stack with
{{NumberFormat}} directly;
* message arguments passed to {{getText(key, args)}} (also reached from the
{{text}} tag with {{param}}, and from validator {{messageParams}}) are
formatted by {{MessageFormat}}, which delegates numeric arguments to the locale
{{NumberFormat}}.
Apply the WW-5828 bound to both paths, sharing the bound rather than
duplicating the constant. For message arguments the bound has to be applied
through the formatter, not by substituting the argument, since a number-typed
message element rejects a {{String}} argument. Values within the bound must
render byte-identically to today, including {{currency}} and typed message
elements.
Same fix on the 6.x line.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)