Victor Hu created OLINGO-1568: --------------------------------- Summary: Error serializing BigDecimal when passed certain BigDecimal values Key: OLINGO-1568 URL: https://issues.apache.org/jira/browse/OLINGO-1568 Project: Olingo Issue Type: Bug Components: odata4-client Affects Versions: (Java) V4 4.9.0, (Java) V4 4.8.0 Reporter: Victor Hu
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|http://docs.oasis-open.org/odata/odata-csdl-json/v4.01/odata-csdl-json-v4.01.html#sec_Scale]). 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 {code:java} new ClientObjectFactoryImpl().newPrimitiveValueBuilder().buildDecimal(new BigDecimal("0.04")).toString(); {code} {noformat} java.lang.IllegalArgumentException: org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value '0.04' does not match the facets' constraints.{noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007)