You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2022/02/15 21:57:00 UTC

[jira] [Created] (DAFFODIL-2660) prefixLengthType needs to evaluate asserts before using the prefix value

Mike Beckerle created DAFFODIL-2660:
---------------------------------------

             Summary: 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
    Affects Versions: 3.2.1
            Reporter: Mike Beckerle
             Fix For: 3.3.0


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.1#820001)