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

Senen de Diego commented on OLINGO-1480:
----------------------------------------

I don't think this is solved. I get the same exception with 0.000 
(BigDecimal.valueOf(0L, 3)). That value has scale=3 and precision=1, which 
doesn't pass the condition in EdmDecimal.internalValueToString, because 
digits=3 and precision=1:
{code:java}
// code placeholder
          if ((precision == null || precision >= digits) && 
(bigDecimalValue.scale() <= (scale == null ? 0 : scale))) {
            result = bigDecimalValue.toPlainString();
          } else {
            throw new EdmPrimitiveTypeException("The value '" + value + "' does 
not match the facets' constraints.");
          }
 {code}

> 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.20.10#820010)

Reply via email to