Steve Lawrence created DAFFODIL-1964:
----------------------------------------

             Summary: Unparsing ArrayCombinator assertion failure
                 Key: DAFFODIL-1964
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1964
             Project: Daffodil
          Issue Type: Bug
          Components: Back End, Unparsing
    Affects Versions: 2.1.0
            Reporter: Steve Lawrence
             Fix For: 2.2.0


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

The schema looks something like this:
{code}
...
<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>
...
{code}

With XML that looks like this:
{code}
<foo>...</foo>
{code}

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:

{code}
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)
... 
{code}

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.




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

Reply via email to