[
https://issues.apache.org/jira/browse/OLINGO-788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexandre Boudnik resolved OLINGO-788.
--------------------------------------
Resolution: Fixed
relaxed patterns in EdmDouble and EdmSingle. Same changes have been made for
one of my customers and deployed in production for about 6 months already.
> Numbers having more than 17 digits in mantissa can't be parsed
> --------------------------------------------------------------
>
> Key: OLINGO-788
> URL: https://issues.apache.org/jira/browse/OLINGO-788
> Project: Olingo
> Issue Type: Bug
> Components: odata4-commons
> Affects Versions: (Java) V4 4.0.0-beta-03, (Java) V4 4.0.0
> Environment: any OS
> Reporter: Alexandre Boudnik
> Assignee: Alexandre Boudnik
> Priority: Critical
> Labels: easyfix
> Fix For: (Java) V4 4.1.0
>
> Attachments: OLINGO-788.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> The regex in
> {{lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDouble.java}}
> is too strict and thus it prevents parsing numbers having move than 17
> digits before or after decimal point even they are just denormalized and have
> less then 17 meaningful digits, like 0.000001234567890123456 or
> 1234567890123456000000.0
> Take in mind that
> http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/abnf/odata-abnf-construction-rules.txt
> does not contain the following definitions (no limitations there):
> {code}
> decimalValue = [SIGN] 1*DIGIT ["." 1*DIGIT]
> doubleValue = decimalValue [ "e" [SIGN] 1*DIGIT ] / nanInfinity ; IEEE 754
> binary64 floating-point number (15-17 decimal digits)
> singleValue = doubleValue ; IEEE 754
> binary32 floating-point number (6-9 decimal digits)
> nanInfinity = 'NaN' / '-INF' / 'INF'
> {code}
> As I understand, regex in {{EdmDouble}} is used to prevent exception when the
> literal get parsed by {{new BigDecimal(String)}}. In not normalized literals
> zeroes may surround the significant digits. The maximum number of those can’t
> exceed 17 (9 for {{EdmSingle}}), and decimal point symbol could be either
> within the sequence of them or not. It makes impossible to perform format
> check using one regex.
> If number of significant digits in literal will exceed the capacity of
> {{double}} it would be checked by comparing of parsed {{BigDecimal}} and
> {{double}} value extracted from it. Same is for {{float}}.
> For formal point of view we do not have need to restrict literals by
> normalized decimal values, and thus regex for {{EdmDouble}} and {{EdmSingle}}
> should be relaxed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)