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

Abort: Invariant broken: minReps.==(0L) when unparsing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.8.0
    • Unparsing
    • None

    Description

      If we have a schema with an array with occursCountKind="expression" and minOccurs greater than zero, and we unparse an infoset where there are zero occurrences, we get an abort assertion. This is not a valid infoset, but we should get an UnparseError instead of an abort.

      Schema:

        <simpleType name="oneNum" dfdl:lengthKind="explicit" dfdl:length="1">
          <restriction base="xs:int" />
        </simpleType>
      
        <element name="root">
          <complexType>
            <sequence>
              <element name="field1Occurs" type="ex:oneNum" />
              <element name="field1" type="ex:oneNum" minOccurs="1" maxOccurs="255"
                dfdl:occursCountKind="expression" dfdl:occursCount="{ ../field1Occurs }" />
              <element name="field2" type="ex:oneNum" minOccurs="1" maxOccurs="255"
                dfdl:occursCountKind="parsed" />
            </sequence>
          </complexType>
        </element>
      

      Infoset:

      <ex:root xmlns:ex="http://example.com">
        <field1Occurs>0</field1Occurs>
        <field2>1</field2>
        <field2>2</field2>
        <field2>3</field2>
        <field2>4</field2>
      </ex:root>
      

      Error:

      org.apache.daffodil.lib.exceptions.Abort: Invariant broken: minReps.==(0L)
      org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:159)
      org.apache.daffodil.unparsers.runtime1.OrderedUnseparatedSequenceUnparser.unparse(UnseparatedSequenceUnparsers.scala:159)
      org.apache.daffodil.runtime1.processors.unparsers.Unparser.unparse1(Unparser.scala:75)
      org.apache.daffodil.runtime1.processors.unparsers.Unparser.unparse1$(Unparser.scala:38)
      	at org.apache.daffodil.lib.exceptions.Assert$.abort(Assert.scala:159)
      	at org.apache.daffodil.unparsers.runtime1.OrderedUnseparatedSequenceUnparser.unparse(UnseparatedSequenceUnparsers.scala:159)
      	at org.apache.daffodil.runtime1.processors.unparsers.Unparser.unparse1(Unparser.scala:75)
      	at org.apache.daffodil.runtime1.processors.unparsers.Unparser.unparse1$(Unparser.scala:38)
      	at org.apache.daffodil.runtime1.processors.unparsers.CombinatorUnparser.unparse1(Unparser.scala:124)
      	at org.apache.daffodil.unparsers.runtime1.ElementUnparserBase.runContentUnparser(ElementUnparser.scala:181)
      	at org.apache.daffodil.unparsers.runtime1.ElementUnparserBase.unparse(ElementUnparser.scala:202)
      

      Attachments

        Activity

          People

            slawrence Steve Lawrence
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: