You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2026/08/31 18:37:21 UTC
[PR] WW-5711 fix(conversion): bound fraction digits when formatting BigDecimal [struts]
lukaszlenart opened a new pull request, #1887:
URL: https://github.com/apache/struts/pull/1887
`StringConverter` formatted `BigDecimal`, `Double` and `Float` with `maximumFractionDigits` set to `Integer.MAX_VALUE`.
That constant arrived with [WW-4871](https://issues.apache.org/jira/browse/WW-4871), which fixed round-trip precision loss for `double` and `float`. Both of those types are naturally bounded — the widest `double` needs 325 fraction digits (`Double.MIN_VALUE`) and the widest `float` needs 45 — so `Integer.MAX_VALUE` is far wider than WW-4871 required.
`BigDecimal` carries no such bound. `DecimalFormat` honours `maximumFractionDigits` literally and pads the fraction out to the value's full scale, so the length of the formatted output followed the scale of the value rather than its precision.
Bound the setting to 340 instead.
### Backward compatibility
Every `double` and `float` value still formats in full, so WW-4871's behaviour is preserved exactly. Every `BigDecimal` with a scale of 340 or less is also unchanged. A `BigDecimal` scaled beyond 340 is now rounded to that bound rather than padded out in full — the only observable difference.
The existing round-trip assertions are untouched and still pass: `testDoubleToStringConversionPL` pins `Double.MIN_VALUE` at 325 fraction digits, and `testBigDecimalToStringConversionPL` pins a value slightly wider than `double` at 326.
### Scope
Render side only. `NumberConverter.convertToBigDecimal` is unchanged in this PR.
### Testing
`mvn test -DskipAssembly -pl core` — 3301 tests, 0 failures.
Fixes [WW-5711](https://issues.apache.org/jira/browse/WW-5711)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5711 fix(conversion): bound fraction digits when formatting BigDecimal [struts]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #1887:
URL: https://github.com/apache/struts/pull/1887#issuecomment-5482860102
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1887) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1887&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1887&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1887&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1887&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1887&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1887)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5711 fix(conversion): bound fraction digits when formatting BigDecimal [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #1887:
URL: https://github.com/apache/struts/pull/1887
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org