[
https://issues.apache.org/jira/browse/OLINGO-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17492070#comment-17492070
]
Morten Basboll commented on OLINGO-1549:
----------------------------------------
I am experiencing the same issue in V4 4.9.0. The error is thrown from
EdmDecimal.java at line 249. Here is the code snippet:
final int digits = bigDecimalValue.scale() >= 0
? Math.max(bigDecimalValue.precision(), bigDecimalValue.scale())
: bigDecimalValue.precision() - bigDecimalValue.scale();
if ((precision == null || precision >= digits) &&
(bigDecimalValue.scale() <= (scale == null ? 0 : scale))) {
result = bigDecimalValue.toPlainString();
} else {
{color:#ffab00} throw new EdmPrimitiveTypeException("The value '" +
value + "' does not match the facets' constraints.");{color}
}
I don't understand the logic here. Any positive value less the 0.1 will always
have a precision that is less than the total number of digits when the leading
zeros after the decimal are included. Why should that throw an exception?
> cannot create amount smaller than 0.10
> --------------------------------------
>
> Key: OLINGO-1549
> URL: https://issues.apache.org/jira/browse/OLINGO-1549
> Project: Olingo
> Issue Type: Question
> Components: odata4-client
> Affects Versions: (Java) V4 4.8.0
> Reporter: wim wintmolders
> Priority: Major
>
> The following throws an exception
> {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}
> Not sure if I'm doing anything wrong, but any number above 0.09 does work.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)