[
https://issues.apache.org/jira/browse/DAFFODIL-2672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Steve Lawrence updated DAFFODIL-2672:
-------------------------------------
Fix Version/s: (was: 3.4.0)
> type unions don't get proper length
> -----------------------------------
>
> Key: DAFFODIL-2672
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2672
> Project: Daffodil
> Issue Type: Bug
> Components: Middle "End"
> Affects Versions: 3.2.1
> Reporter: Mike Beckerle
> Priority: Minor
>
> Consider this:
>
>
> {code:java}
> <dfdl:format ... lengthKind="implicit".../>
> <element name="seconds" type="tns:second"
> dfdl:lengthKind="explicit" dfdl:length="6"
> dfdl:lengthUnits="bits" dfdl:alignment="1"
> dfdl:alignmentUnits="bits"/>
> <simpleType name="second">
> <union>
> <simpleType>
> <restriction base="tns:checkedInt">
> <maxInclusive value="59"/>
> </restriction>
> </simpleType>
> <simpleType>
> <restriction base="tns:checkedInt">
> <enumeration value="63"/>
> </restriction>
> </simpleType>
> </union>
> </simpleType> {code}
> The above, the parser ends up going for a 32-bit integer, when the intention
> is for it to parse a 6 bit integer.
>
> This, however, works:
>
> {code:java}
> <element name="seconds" type="tns:second"
> dfdl:lengthUnits="bits" dfdl:alignment="1"
> dfdl:alignmentUnits="bits"/>
> <simpleType name="second" dfdl:lengthKind="explicit" dfdl:length="6">
> <union>
> <simpleType>
> <restriction base="tns:checkedInt">
> <maxInclusive value="59"/>
> </restriction>
> </simpleType>
> <simpleType>
> <restriction base="tns:checkedInt">
> <enumeration value="63"/>
> </restriction>
> </simpleType>
> </union>
> </simpleType> {code}
> So it seems that the combining of properties when the type is a union does
> not propagate the element's properties and combine them with the properties
> on each of the union types. Rather, the simpleType ends up ignoring the
> element's properties which specify explicit length of 6 bits, and instead
> takes the default format length of 32 (because this is a xs:unsignedInt
> ultimately).
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)