Steve Lawrence created DAFFODIL-3097:
----------------------------------------

             Summary: xs:unsignedLong incorrectly converted to Long for 
intermediate calculations
                 Key: DAFFODIL-3097
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-3097
             Project: Daffodil
          Issue Type: Task
          Components: Back End
            Reporter: Steve Lawrence
             Fix For: 4.3.0


This schema snippet:

{code:xml}
  <element name="foo" type="xs:unsignedLong" dfdl:inputValueCalc="{
    xs:unsignedLong(9223372036854775808) + xs:unsignedLong(1)
  }" />
{code}

Fails with the following error:

{code}
[error] Schema Definition Error: Cannot convert '9223372036854775808' from 
UnsignedLong type to Long (Value '9223372036854775808' is out of range for 
type: xs:long).
{code}

This schema fails with the same error:
{code:xml}
  <element name="foo" type="xs:integer" dfdl:inputValueCalc="{ 
xs:integer(xs:unsignedLong(9223372036854775808))}" />
{code}

None of these expressions should require converting the xs:unsignedLong to a 
Long, but it seems we do that somewhere. When the unsignedLong value is too 
large for a Long (9223372036854775808 is one more than MaxLong) that conversion 
fails. We should never convert an unsignedLong to a Long for intermediate 
calculations.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to