aizu-m opened a new pull request, #144:
URL: https://github.com/apache/poi-xmlbeans/pull/144
xs:decimal with totalDigits=3, validated with XmlObject.validate():
<t:d>0.0001</t:d> -> no errors
<t:d>1.234</t:d> -> cvc-totalDigits-valid
Found while probing decimal facets with edge-case values.
JavaDecimalHolderEx.validateValue counts the digits of unscaledValue(). For
0.0001 that is "1" with scale 4, so the check sees one digit. The zeros between
the point and the first significant digit are never counted.
Part 2 defines totalDigits as i x 10^-n with |i| < 10^totalDigits and 0 <= n
<= totalDigits. 0.0001 is 1 x 10^-4, so it needs four digits. Xerces counts it
the same way. The streaming Validator and validate-on-set both go through
validateValue, so any value with more fractional precision than the facet
allows passes when it starts with 0.0.
Fix: for a non-zero value, count max(significant digits, fraction digits
after the absorbed trailing zeros). Zero and values with a non-zero integer
part are counted as before. The integer holders have no fraction, so this is
the only site. Regression test added; it fails on trunk and passes with the
fix, and the full test suite passes.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]