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

Unparsing ArrayCombinator assertion failure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 2.2.0
    • Back End, Unparsing
    • None

    Description

      A user reported an error when unparsing in the array combinator.

      The schema looks something like this:

      ...
      <xs:sequence>
        <xs:element name="foo" ... />
        <xs:element name="bar" minOccurs="1" maxOccurs="6" dfdl:occursCountKind="implicit">
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo source="http://www.ogf.org/dfdl/">
                  <dfdl:discriminator>{ expression }</dfdl:discriminator>
                </xs:appinfo>
              </xs:annotation>
              <xs:sequence dfdl:hiddenGroupRef="hiddenGrouPRef" />
              <xs:group ref="someGroupWithRequiredElement"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      ...
      

      With XML that looks like this:

      <foo>...</foo>
      

      So the bar element is an array that requires at least one instance, but the infoset has zero instances. Trying to unparse this resultsin the following:

      org.apache.daffodil.exceptions.Abort: Invariant broken: event.isStart.&&(event.node.isInstanceOf[org.apache.daffodil.infoset.DIArray])
      org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
      org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
      org.apache.daffodil.processors.unparsers.ArrayCombinatorUnparser.unparse(ElementKindUnparsers.scala:254)
      org.apache.daffodil.processors.unparsers.Unparser$class.unparse1(Unparser.scala:72)
      ... 
      

      The expected result is to return an UnaparseError about expecting a start array event but not getting one. I think the assertion just needs to be changed to an UnparseError, since there is clearly a case where the assertion doesn't hold.

      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: