[ https://issues.apache.org/jira/browse/DAFFODIL-2660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Beckerle reassigned DAFFODIL-2660: --------------------------------------- Assignee: Mike Beckerle > prefixLengthType needs to evaluate asserts before using the prefix value > ------------------------------------------------------------------------ > > Key: DAFFODIL-2660 > URL: https://issues.apache.org/jira/browse/DAFFODIL-2660 > Project: Daffodil > Issue Type: Bug > Components: Back End, Diagnostics > Affects Versions: 3.2.1 > Reporter: Mike Beckerle > Assignee: Mike Beckerle > Priority: Major > > We want to use lengthKind 'prefixed' and avoid the complexity of > dfdl:outputValueCalc and dfdl:lengthKind 'explicit' with a length expression. > But... using prefixed is much less robust, because the prefix value is > currently used to pull data (when parsing) and assertions expressed on the > prefixLengthType seem to never be evaluated. > E.g., below we have a prefixed-length field named 'payload'. > The range is only 0 to 32768, but this assert never executes. > {code:java} > ... > <complexType> > <sequence> > <element name="payload" type="xs:hexBinary" > dfdl:lengthKind="prefixed" > dfdl:prefixIncludesPrefixLength="no" > dfdl:prefixLengthType="p8:bufferPayload"/> > </sequence> > </complexType> > ... > <simpleType name="bufferPayload"> > <annotation> > <appinfo source="http://www.ogf.org/dfdl/"> > <dfdl:assert>{ dfdl:checkConstraints(.) }</dfdl:assert> > </appinfo> > </annotation> > <restriction base="p8:unsignedLong"> > <minInclusive value="0"/> > <maxInclusive value="32768"/> > </restriction> > </simpleType> {code} > The assert needs to execute before the prefix value is used as a length. -- This message was sent by Atlassian Jira (v8.20.10#820010)