Steve Lawrence created DAFFODIL-2162:
----------------------------------------

             Summary: direct dispatch choice that has an array branch causes 
abort during compilation
                 Key: DAFFODIL-2162
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2162
             Project: Daffodil
          Issue Type: Bug
          Components: Front End
            Reporter: Steve Lawrence
             Fix For: 2.4.0


This schema has a direct dispatch where a choice branch is an array:
{code:xml}
  <xs:include 
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />

  <xs:annotation>
    <xs:appinfo source="http://www.ogf.org/dfdl/";>
      <dfdl:format ref="ex:GeneralFormat"
          lengthKind="implicit"
          representation="binary" />
    </xs:appinfo>
  </xs:annotation>

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="index" type="xs:int" />
        <xs:choice dfdl:choiceDispatchKey="{ xs:string(./index) } ">
          <xs:element name="values1" type="xs:int" minOccurs="1" maxOccurs="2" 
dfdl:choiceBranchKey="1" />
          <xs:element name="values2" type="xs:int" dfdl:choiceBranchKey="2" />
        </xs:choice>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
{code}

{quote}
org.apache.daffodil.exceptions.Abort: Not to be called on choice branches.
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
org.apache.daffodil.exceptions.Assert$.usageError(Assert.scala:117)
org.apache.daffodil.dsom.ChoiceBranchImpliedSequence.emptyFormatFactory(SequenceGroup.scala:413)
org.apache.daffodil.dsom.AnnotatedMixin.$anonfun$formatAnnotation$1(AnnotatedSchemaComponent.scala:352)
        at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
        at org.apache.daffodil.exceptions.Assert$.usageError(Assert.scala:117)
        at 
org.apache.daffodil.dsom.ChoiceBranchImpliedSequence.emptyFormatFactory(SequenceGroup.scala:413)
        at 
org.apache.daffodil.dsom.AnnotatedMixin.$anonfun$formatAnnotation$1(AnnotatedSchemaComponent.scala:352
 ...
{quote}

If i remove the choice dispatch or change maxOccurs="1" the exception goes away.



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

Reply via email to