[ 
https://issues.apache.org/jira/browse/OLINGO-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235276#comment-17235276
 ] 

Ramya Vasanth commented on OLINGO-1480:
---------------------------------------

In client scenarios when there is a Decimal with value 123456789012345678, 
users get an error The literal '123456789012345678' does not match the facets' 
constraints. It occurs in *_EdmDecimal.internalValueOfString()_* and caused by 
*EdmDecimal.validatePrecisionAndScale()* where we are checking the precision 
and scale using *_Constants.DEFAULT_PRECISION_*=40 and 
*_Constants.DEFAULT_SCALE=25._* The DEFAULT_PRECISION  and DEFAULT_SCALE are 
used in JsonDeserializer and JsonSerializer. 

The default Decimal precision and scale (40,25) is not enough for big decimal, 
and hence validation of '123456789012345678' failed.

The solution for this would be to take the scale/precision value from the 
BigDecimal if the value is a BigDecimal or else take the default 
scale/precision value.

This is fixed as part of the commit

https://git-wip-us.apache.org/repos/asf?p=olingo-odata4.git;a=commit;h=79bd10f430a8edf26c0a38c556f5a1d370efc079

> Error serializing BigDecimal when there is no Edm 
> Property(EdmAssistedSerializer)
> ---------------------------------------------------------------------------------
>
>                 Key: OLINGO-1480
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1480
>             Project: Olingo
>          Issue Type: Bug
>    Affects Versions: (Java) V4 4.7.1
>            Reporter: Ramya Vasanth
>            Priority: Major
>
> For dynamic properties the library sets a default scale and precision value 
> in EdmAssistedSerializer.
> When the database returns a BigDecimal (precision=0, scale=33): 
> 1.666666666666666666666666666666667 as result of a compute function($apply), 
> Olingo automatically translates it into EdmDecimal and when serializing in 
> EdmAssistedJsonSerializer there is a default precision of 40 and scale of 25 
> set, so the check in EdmDecimal fails and throws "The value does not match 
> facet constraints".
>  
> This can be fixed by changing the default scale value to scale value 
> specified in BigDecimal value.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to