Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3-next-M7, 4.0.0-RC2
-
None
-
None
Description
Background Issue: https://issues.apache.org/jira/browse/MYFACES-3196
In the issue linked above, MyFaces was updated to check the ParsePosition after parsing. If the ParsePosition index differed from the length of the input, then that meant part of the string was not iterated though and there was likely a problem.
However this can become another issue when setParseIntegerOnly is set to true because it leaves the index just after the decimal point. See the example in the text.
setParseIntegerOnly : only affects parsing, e.g. if true, "3456.78" → 3456 (and leaves the parse position just after index 6) if false, "3456.78" → 3456.78 (and leaves the parse position just after index 8) This is independent of formatting. If you want to not show a decimal point where there might be no digits after the decimal point, use setDecimalSeparatorAlwaysShown.
This can unnecessarily throw a ParseException here: https://github.com/apache/myfaces/blob/e74edfdbfb0b666e7b6b065dfce2c81899ea1cc7/api/src/main/java/jakarta/faces/convert/NumberConverter.java#L204
While we can check for a decimal separator, but it differs between the various locales. I think it best to ignore the ParsePosition here when setParseIntegerOnly is true.
Attachments
Issue Links
- links to