Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1568

Error serializing BigDecimal when passed certain BigDecimal values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • (Java) V4 4.8.0, (Java) V4 4.9.0
    • (Java) V4 4.10.0
    • odata4-client
    • None

    Description

      This is a refiling OLINGO-1549 except categorized as a bug.

      This bug was introduced with the change made in OLINGO-1480 to allow for larger precision/scale values when passed in as a BigDecimal as they can exceed the default precision of 40 and scale of 25.

      However, this broke insertions for values ranging from ]0.0, 0.1[ as their BigDecimal representations have precision less than scale (which is not allowed according to the OData CSDL).

      This also breaks insertions for BigDecimal values that do not specify precision - an arbitrary precision in BigDecimal is represented as 0 versus the arbitrary precision representation of null in OData.

      The following throws an exception due to this bug

      new ClientObjectFactoryImpl().newPrimitiveValueBuilder().buildDecimal(new BigDecimal("0.04")).toString();
      
      java.lang.IllegalArgumentException: org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value '0.04' does not match the facets' constraints.

       

      Attachments

        Issue Links

          Activity

            People

              mirbo mibo
              vhu Victor Hu
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m