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

Olabusayo Kilo reassigned DAFFODIL-3085:
----------------------------------------

    Assignee: Olabusayo Kilo

> Abort when postfix separator is absent after optional element with 
> discriminator
> --------------------------------------------------------------------------------
>
>                 Key: DAFFODIL-3085
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-3085
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 4.1.0
>            Reporter: Olabusayo Kilo
>            Assignee: Olabusayo Kilo
>            Priority: Major
>
> In a postfix-separated sequence with separatorSuppressionPolicy="anyEmpty", 
> when an optional element contains a dfdl:discriminator that evaluates to true 
> and the element's content parses successfully but the postfix separator is 
> not present in the data, Daffodil aborts with an internal Assert.invariant 
> failure rather than producing a clean parse error.
> Minimal reproducing schema:
> {code:xml}
>  <xs:sequence dfdl:separator="//" dfdl:separatorPosition="postfix"> 
>   <xs:element name="foo" minOccurs="0"> 
>     <xs:complexType> 
>       <xs:sequence> 
>         <xs:sequence> 
>           <xs:annotation>
>             <xs:appinfo source="http://www.ogf.org/dfdl/";> 
>               <dfdl:discriminator test="{fn:true()}"/> 
>             </xs:appinfo>
>           </xs:annotation> 
>         </xs:sequence> 
>         <xs:element name="bar" type="xs:string" dfdl:length="1" 
> dfdl:lengthKind="explicit"/> 
>       </xs:sequence> 
>     </xs:complexType> 
>   </xs:element> 
>   <xs:element name="baz" type="xs:string" minOccurs="0" dfdl:length="1" 
> dfdl:lengthKind="explicit"/> 
>  </xs:sequence> 
> {code}
> With Input data "ABCD", we expect the parse error "Failed to find postfix 
> separator" but instead Daffodil is erroring out with an internal 
> abort/Assert.invariant failure.
> Turns out this was because when the discriminator evaluated to true it 
> resolved the inner PoU for foo (PostfixSeparatorHelper). The child then 
> parsed successfully, but sep.parse1 faied to find //. The 
> child-successful+sep-failed path in PostfixSeparatorHelper 
> intended to backtrack via resetToPointOfUncertainty(pou), but first checked 
> Assert.invariant(!pstate.isPointOfUncertaintyResolved(pou)). Since the 
> discriminator had already resolved that PoU, the invariant fired.
> The code should detect the resolved PoU and call resolvePointOfUncertainty() 
> instead of trying to reset, then proceed to signal the separator-not-found 
> failure normally.



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

Reply via email to