MATH-1688: Reject malformed grouping separators in ComplexFormat - #330
efegokdemir wants to merge 2 commits into
Conversation
Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #330 +/- ##
============================================
+ Coverage 86.54% 87.17% +0.63%
+ Complexity 9787 89 -9698
============================================
Files 532 499 -33
Lines 35516 33469 -2047
Branches 6194 5834 -360
============================================
- Hits 30738 29178 -1560
+ Misses 3518 3165 -353
+ Partials 1260 1126 -134 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This change does not pass the code style checks. Please run this using a JDK lower than 27 so you can use the default maven goal and pass all the checks. It should pass with: |
Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
|
Applied the requested style correction in commit Validation with JDK 21.0.12.1:
The correction commit is SSH-signed and DCO-signed. Please re-check the PR when convenient. |
Summary
Fixes MATH-1688 by preventing the default
ComplexFormatparser from silently accepting malformed grouping separators as part of numeric values.Changes
ComplexFormat.NumberFormatinstances remain unchanged.Testing
mvn -pl commons-math-legacy -am -Dtest=ComplexFormatTest -Dsurefire.failIfNoSpecifiedTests=false -Djacoco.skip=true test— passed (44 tests).git diff --check— passed.mvn -pl commons-math-legacy -am -DskipTests -Djacoco.skip=true verify— blocked by the repository's SpotBugs plugin, which does not support the JDK 27 class-file version (Unsupported class file major version 71).Notes
The issue was reproduced on the current upstream branch before the change: malformed inputs such as
,,7+,,,2iand7,,8were accepted. The fix is limited toComplexFormatdefaults and does not alter caller-supplied number formats.AI assistance was used during investigation and implementation; the change was reviewed and validated by the submitter.