You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2023/02/22 15:17:00 UTC

[jira] [Closed] (DAFFODIL-2562) Optional element at end of choice branch triggers unparse error

     [ https://issues.apache.org/jira/browse/DAFFODIL-2562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Thompson closed DAFFODIL-2562.
-----------------------------------

Verified the specified commits are included in the latest pull from the daffodil repository.

Verified, via review, change identified in the ticket and commit comments were implemented. 

Verified the affected daffodil subproject sbt test suites executed successfully, including the uncommented and added tests.

Rolled commit back to a pre-fix commit, uncommented the test "test_dispatch_group_choice()" and verified it failed as expected.

> Optional element at end of choice branch triggers unparse error
> ---------------------------------------------------------------
>
>                 Key: DAFFODIL-2562
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2562
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 3.2.0
>            Reporter: Josh Adams
>            Priority: Major
>             Fix For: 3.5.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Given the following schema:
> {{    <xs:group name="groupOfChoice">
>       <xs:sequence>
>         <xs:element name="key" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1" />
>         <xs:choice dfdl:choiceDispatchKey="{ ./ex:key }">
>           <xs:sequence dfdl:choiceBranchKey="a">
>             <xs:element name="elt_a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" />
>           </xs:sequence>
>           <xs:sequence dfdl:choiceBranchKey="b">
>             <xs:element name="elt_b" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" />
>             <xs:element name="elt_c" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3"
>               minOccurs="0" maxOccurs="1" dfdl:occursCountKind="expression" dfdl:occursCount="{ if (fn:exists(../ex:elt_b)) then 1 else 0 }" />
>           </xs:sequence>
>         </xs:choice>
>       </xs:sequence>
>     </xs:group>}}
> During unparse, the element following this group (the next element after elt_c) will have an invalid ERD and will trigger an unparse error.
> I've spent a fair amount of time looking at this, but was unable to find the root cause of this issue.  I'm thinking that it must be something where the various stacks tracking the current element and next element are some how getting out of sync and when we are looking for the element after elt_c, Daffodil still thinks it is withing the choice containing elt_c.
> I will open a pull request with the test for this bug.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)