Mike Roberts created OLINGO-1290: ------------------------------------ Summary: Numeric values with more than 17 digits of precision cause error Key: OLINGO-1290 URL: https://issues.apache.org/jira/browse/OLINGO-1290 Project: Olingo Issue Type: Bug Components: odata4-client, odata4-commons Affects Versions: (Java) V4 4.5.0 Reporter: Mike Roberts
The IBM Cognos TM1 (OData compliant) REST API can return values such as this ... "@odata.context": "../$metadata#Cellsets('l8-ZO2wMAIABAAAg')/Cells(Value)", "value": [{ "Value": 70 }, { "Value": -0.043099999999995475 }] This causes the following error ... 2018-09-08 07:41:30,214 ERROR o.a.o.c.a.d.ClientEntitySetIterator [main] Error retrieving entities from EntitySet ... Caused by: org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The literal '-0.043099999999995475' has illegal content. at org.apache.olingo.commons.core.edm.primitivetype.EdmDouble.internalValueOfString(EdmDouble.java:80) ~[org.apache.olingo-odata-commons-core-4.5.0.jar:?] I investigated further and noted that the code uses a pattern ... private static final Pattern PATTERN = Pattern.compile( "(?:\\+|-)?\\p\{Digit}{1,17}(?:\\.\\p\{Digit}{1,17})?(?:(?:E|e)(?:\\+|-)?\\p\{Digit}{1,3})?"); .. which is the cause of this error because we have 18 digits after the decimal point. The TM1 architect contacted [~RalfHandl] who said ... "Olingo is too restrictive here, OData does not add any restrictions on representation of numbers on top of the JSON RFC." -- This message was sent by Atlassian JIRA (v7.6.3#76005)