icu icon indicating copy to clipboard operation
icu copied to clipboard

ICU-22303 Support parsing infinity/NaN when decimal pattern match is required

Open stevedlawrence opened this issue 2 years ago • 5 comments

If a DecimalFormat pattern contains a decimal point and setDecimalPatternMatchRequired is true, then DecimalFormat parse() fails to parse infinity/NaN representations. This is because infinfity/NAn parsing does not set the HAS_DECIMAL_SEPARATOR_FLAG and so the RequireDecimalSeparatorValidator fails.

This modifies the RequireDecimalSeparatorValidator so that it does not fail if the INFINITY or NAN flags are set, making it so decimal separators are not required if the infinity/NaN representations are parsed.

Checklist
  • [X] Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22303
  • [X] Required: The PR title must be prefixed with a JIRA Issue number.
  • [X] Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • [X] Required: Each commit message must be prefixed with a JIRA Issue number.
  • [X] Issue accepted (done by Technical Committee after discussion)
  • [X] Tests included, if applicable
  • [ ] API docs and/or User Guide docs changed or added, if applicable

stevedlawrence avatar Apr 13 '23 22:04 stevedlawrence

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 13 '23 22:04 CLAassistant

Notice: the branch changed across the force-push!

  • icu4c/source/test/intltest/numfmtst.cpp is different
  • icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/RequireDecimalSeparatorValidator.java is no longer changed in the branch
  • icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java is now changed in the branch
  • icu4j/main/core/src/main/java/com/ibm/icu/impl/number/parse/RequireDecimalSeparatorValidator.java is now changed in the branch
  • icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java is no longer changed in the branch

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

FYI, this PR had some merge conflicts due to the mavenization of the repo. I rebased onto the latest main branch with no changes needed and force pushed to resolve the conflicts.

stevedlawrence avatar Oct 27 '23 21:10 stevedlawrence

Notice: the branch changed across the force-push!

  • icu4c/source/test/intltest/numfmtst.cpp is different
  • icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

FYI, this PR was quite a bit behind main so I rebased it onto the latest master.

stevedlawrence avatar May 20 '24 12:05 stevedlawrence