Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2062

NadaParser not optimized out

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Front End
    • None

    Description

      Assume the following schema:

        <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>
      

      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:

      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)
      

      So the empty sequence results in a NadaParser, which should have been optimized out.

      Attachments

        Activity

          People

            dfthompson Dave Thompson
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: