daffodil-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Adams (Jira)" <j...@apache.org>
Subject [jira] [Resolved] (DAFFODIL-2354) newVariableInstance leads to mark state exception
Date Thu, 06 Aug 2020 16:20:00 GMT

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

Josh Adams resolved DAFFODIL-2354.
----------------------------------
    Fix Version/s: 3.0.0
       Resolution: Fixed

This was fixed  as part of commit 779e9803ba7708d700c0205cbd690a179841b084

Commit cf57e0d04ed7414081febb0992e6ebdbb6cd708d has a test added for verification

> newVariableInstance leads to mark state exception
> -------------------------------------------------
>
>                 Key: DAFFODIL-2354
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2354
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 2.6.0
>            Reporter: Steve Lawrence
>            Priority: Critical
>             Fix For: 3.0.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The following schema uses newVariableInstance with the goal of parameterizing repeated
types. Note that this snippet does not even use the type and count variables, or parameterizes
anything, which is the intention. The ultimate goal is to have set the type and count variables
based on the type/count elements, and then use those variables in the choice rather than using
XPath to access the elements. Things were simplified to create the smallest test case.
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?> 
> <xs:schema
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/">
>   <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"
/>
>   <xs:annotation>
>     <xs:appinfo source="http://www.ogf.org/dfdl/">
>       <dfdl:format ref="GeneralFormat" />
>       <dfdl:defineVariable name="type" type="xs:int" />
>       <dfdl:defineVariable name="count" type="xs:int" />
>     </xs:appinfo>
>   </xs:annotation>
>   <xs:element name="file">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="records" maxOccurs="unbounded" dfdl:terminator="%NL;">
>           <xs:complexType>
>             <xs:sequence>
>               <xs:element name="type" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1"
/>
>               <xs:element name="count" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1"
/>
>               <xs:sequence>
>                 <xs:annotation>
>                   <xs:appinfo source="http://www.ogf.org/dfdl/">
>                     <dfdl:newVariableInstance ref="type" />
>                     <dfdl:newVariableInstance ref="count" />
>                   </xs:appinfo>
>                 </xs:annotation>
>                 <xs:sequence>
>                   <xs:choice dfdl:choiceDispatchKey="{ xs:string(./type) }">
>                     <xs:element name="int" type="xs:int" dfdl:choiceBranchKey="1"
maxOccurs="unbounded"
>                       dfdl:occursCountKind="expression" dfdl:occursCount="{ ../count
}"
>                       dfdl:lengthKind="explicit" dfdl:length="1" />
>                     <xs:element name="str" type="xs:string" dfdl:choiceBranchKey="2"
maxOccurs="unbounded"
>                       dfdl:occursCountKind="expression" dfdl:occursCount="{ ../count
}"
>                       dfdl:lengthKind="explicit" dfdl:length="1" />
>                   </xs:choice>
>                 </xs:sequence>
>               </xs:sequence>
>             </xs:sequence>
>           </xs:complexType>
>         </xs:element>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> {code}
> So each line has a type (either 1 for int or 2 for string) and a count, followed by count
occurrances of that type.
> This should parse data that looks something like this:
> {code}
> 1512345
> 26abcdef
> {code}
> However, trying to parse this data leads to a usage exception about the mark state being
messed up.
> Simply removing the newVariableInstance annotation allows things to work, so somehow
that is messing with state in a way that is unexpected.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message