jadams-tresys commented on a change in pull request #440:
URL: https://github.com/apache/incubator-daffodil/pull/440#discussion_r506582021



##########
File path: 
daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
##########
@@ -86,11 +86,15 @@ trait ChoiceTermRuntime1Mixin { self: ChoiceTermBase =>
     // in the arriving infoset for unparse.
     //
     val optDefaultBranch = {
-      val optEmpty: Option[Term] =
-        groupMembers.find { gm =>
+      val optEmpty: Option[Term] = {
+        val emptyBranches = groupMembers.filter { gm =>
           val ies = gm.identifyingEventsForChoiceBranch
           ies.pnes.isEmpty // empty event list makes it the default, not 
simply isOpen
         }
+        if (emptyBranches.length > 1)
+          SDW(WarnID.MultipleChoiceBranches, "Multiple choice branches are 
empty, defaulting to first empty branch")

Review comment:
       So its not that a branch with no elements won't be unparsed. What 
happened originally was I had this choice that had empty sequences that would 
simply call setVariable on different variables, depending on the branch. What I 
didn't realize was that on unparse, there is nothing in the infoset to 
determine which branch was taken and the choiceBranchKey is not evaluated, so 
it defaults to the first empty branch every time. This resulted in the multiple 
set variable error.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to