You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Steve Lawrence (JIRA)" <ji...@apache.org> on 2019/02/01 13:14:00 UTC

[jira] [Created] (DAFFODIL-2062) NadaParser not optimized out

Steve Lawrence created DAFFODIL-2062:
----------------------------------------

             Summary: NadaParser not optimized out
                 Key: DAFFODIL-2062
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2062
             Project: Daffodil
          Issue Type: Bug
          Components: Front End
    Affects Versions: 2.3.0
            Reporter: Steve Lawrence


Assume the following schema:
{code:xml}
  <xs:element name="test">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="count" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1" />
        <xs:element name="record" dfdl:lengthKind="explicit" dfdl:length="2" maxOccurs="unbounded"
          dfdl:occursCountKind="expression" dfdl:occursCount="{ ../count }">
          <xs:complexType>
            <xs:sequence>
            <!--
              <xs:element name="value1" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" />
              <xs:element name="value2" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" />
            -->
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
{code}

This schema works if we uncomment the value1 and value2 elements. However, with them commented out, this schema should still work. The {{record}} element has an explciit length, so this should just skip over 2 bytes, count number of times. Instead, it results in the following exception:
{code}
org.apache.daffodil.exceptions.Abort: NadaParsers are all supposed to optimize out!
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
org.apache.daffodil.processors.parsers.NadaParser.parse(Parser.scala:150)
org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:76)
org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:70)
	at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
	at org.apache.daffodil.processors.parsers.NadaParser.parse(Parser.scala:150)
	at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:76)
{code}
So the empty sequence results in a NadaParser, which should have been optimized out.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)