Skip to content

fix AXIS2-6041 (totalDigits Facet of XSD type short incorrectly treat… #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

sndurkin
Copy link
Contributor

…ed in databinding)

This change builds on commit bb10ab2, which fixed compare(BigInteger, String) for AXIS2-5724, to fix the other variations for int, long, and short.

These variations seem to be invoked by the generated Java code when using different base types, such as the following:

<xsd:simpleType name="MyType">
  <xsd:restriction base="xsd:int">
    <xsd:totalDigits value="1"/>
  </xsd:restriction>
</xsd:simpleType>

This change also adds test cases for the variations.

…ed in databinding)

This change builds on commit bb10ab2, which fixed `compare(BigInteger,
String)` for AXIS2-5724, to fix the other variations for `int`, `long`,
and `short`.

These variations seem to be invoked by the generated Java code when
using different base types, such as the following:

    <xsd:simpleType name="MyType">
      <xsd:restriction base="xsd:int">
        <xsd:totalDigits value="1"/>
      </xsd:restriction>
    </xsd:simpleType>

This change also adds test cases for the variations.
@sndurkin
Copy link
Contributor Author

Here's the (truncated) output of running ConverterUtilTest with the new tests before my changes:

$ mvn test -Dtest=org.apache.axis2.databinding.utils.ConverterUtilTest
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.axis2.databinding.utils.ConverterUtilTest
...
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   ConverterUtilTest.testCompareIntIsGreaterThanOrEqualToTotalDigitsFacetRestriction:612 » NumberFormat For input string: "10.0"
[ERROR]   ConverterUtilTest.testCompareIntIsLessThanTotalDigitsFacetRestriction:605 » NumberFormat For input string: "10.0"
[ERROR]   ConverterUtilTest.testCompareLongIsGreaterThanOrEqualToTotalDigitsFacetRestriction:598 » NumberFormat For input string: "10.0"
[ERROR]   ConverterUtilTest.testCompareLongIsLessThanTotalDigitsFacetRestriction:591 » NumberFormat For input string: "10.0"
[ERROR]   ConverterUtilTest.testCompareShortIsGreaterThanOrEqualToTotalDigitsFacetRestriction:626 » NumberFormat For input string: "10.0"
[ERROR]   ConverterUtilTest.testCompareShortIsLessThanTotalDigitsFacetRestriction:619 » NumberFormat For input string: "10.0"
[INFO]
[ERROR] Tests run: 20, Failures: 0, Errors: 6, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

And output after:

$ mvn test -Dtest=org.apache.axis2.databinding.utils.ConverterUtilTest
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.axis2.databinding.utils.ConverterUtilTest
[INFO] Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.222 s -- in org.apache.axis2.databinding.utils.ConverterUtilTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 20, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

@robertlazarski robertlazarski merged commit c7fffd0 into apache:master Feb 11, 2025
@sndurkin sndurkin deleted the AXIS2-6041 branch February 11, 2025 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants