Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
(Java) V4 4.5.0
-
None
-
None
Description
The IBM Cognos TM1 (OData compliant) REST API can return values such as this ...
"@odata.context": "../$metadata#Cellsets('l8-ZO2wMAIABAAAg')/Cells(Value)",
"value": [
,
{ "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}
p{Digit}{1,17}
)?(??:E|e)(?:\\+|-)?
p{Digit}
)?");
.. 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."