[
https://issues.apache.org/jira/browse/OLINGO-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15143385#comment-15143385
]
Michael Bolz commented on OLINGO-879:
-------------------------------------
Hi [~Michael.Burwig],
the {{"0.0"}} is a valid Edm.Decimal literal if not used as a _URI Literal_.
See: https://msdn.microsoft.com/en-us/library/dd541295.aspx
The {{validate}} method in the {{EdmDecimal}} differs between the {{default}}
and the {{URI}} literal kind for validation.
See:
{code}
private static boolean validateLiteral(final String value, final
EdmLiteralKind literalKind) {
final Matcher matcher = PATTERN.matcher(value);
return matcher.matches()
&& (literalKind == EdmLiteralKind.URI) != (matcher.group(3) == null);
}
{code}
Kind Regards,
Michael
> Edm.Decimal Literal Validation incorrect
> ----------------------------------------
>
> Key: OLINGO-879
> URL: https://issues.apache.org/jira/browse/OLINGO-879
> Project: Olingo
> Issue Type: Bug
> Components: odata2-core
> Affects Versions: V2 1.1.0
> Reporter: Michael Burwig
> Priority: Minor
>
> The regex pattern (see below) that is used in {{EdmDecimal.java}} to validate
> Edm.Decimal literals is not in accordance with:
> http://www.odata.org/documentation/odata-version-2-0/json-format/#PrimitiveTypes
> http://www.odata.org/documentation/odata-version-2-0/overview/#AbstractTypeSystem
> E.g. {{"0.0"}} is wrongfully recognized as a valid Edm.Decimal literal.
> {code:title=EdmDecimal.java|borderStyle=solid}
> private static final Pattern PATTERN =
>
> Pattern.compile("(?:\\+|-)?(?:0*(\\p{Digit}+?))(?:\\.(\\p{Digit}+?)0*)?M|m)?");
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)