Steve Lawrence created DAFFODIL-2891:
----------------------------------------
Summary: Abort: Invariant broken: minReps.==(0L) when unparsing
Key: DAFFODIL-2891
URL: https://issues.apache.org/jira/browse/DAFFODIL-2891
Project: Daffodil
Issue Type: Bug
Components: Unparsing
Reporter: Steve Lawrence
Assignee: Steve Lawrence
Fix For: 3.8.0
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:*
{code:xml}
<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>
{code}
*Infoset:*
{code:xml}
<ex:root xmlns:ex="http://example.com">
<field1Occurs>0</field1Occurs>
<field2>1</field2>
<field2>2</field2>
<field2>3</field2>
<field2>4</field2>
</ex:root>
{code}
*Error:*
{code}
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)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)