stevedlawrence opened a new pull request #321: Do not convert data values in 
postProcess after evaluating expressions
URL: https://github.com/apache/incubator-daffodil/pull/321
 
 
   After an expression is evaluated, the postProcess function is called to
   potentially modify the resulting value. One thing it does convert the
   result to a Long if the target type of an expression is an
   xs:unsignedLong. But this is simply a bug. If an xs:unsignedLong value
   is too large to fit in a Long then it is silently truncated.
   Additionally, now that we are more strict about elements containing
   values of the correct type, this means that an element will have a Long
   value when we expected a BigInt for xs:unsignedLong, which causes a
   casting exception in some cases.
   
   This removes these unnecessary conversions in postProcess, and instead
   just changes the function to a validation function, adding new checks
   that all underlying types are correct for their target type. This
   ensures that expression conversions do the right thing. And this
   actually discovered more cases where we weren't strict about types. The
   following fixes were made so types are consistent:
   
   - Infinity/NaN was always represented in the infoset as a Double type,
     even if the target type was xs:float. Switched to use the appropriate
     type for the primitive
   - Expressions did not convert types to BigInt's when the target type was
     an xs:unsignedLong, but would just convert them to Longs
   - fn:ceil always created a Float, even if the argument type was an
     xs:double
   - fn:year-from-dateTime did not allow conversion to the target type
   - fn:*-from-date* functions returned an xs:long instead of an xs:integer
     like the XPath spec requires.
   
   DAFFODIL-2276

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to