You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Josh Adams (JIRA)" <ji...@apache.org> on 2019/02/14 12:32:00 UTC
[jira] [Resolved] (DAFFODIL-2062) NadaParser not optimized out
[ https://issues.apache.org/jira/browse/DAFFODIL-2062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Josh Adams resolved DAFFODIL-2062.
----------------------------------
Resolution: Fixed
Assignee: Dave Thompson (was: Josh Adams)
Fix Version/s: 2.4.0
This has been fixed in commit 34c862b632ccad77a2745c32b7be32d1cf382501
> NadaParser not optimized out
> ----------------------------
>
> Key: DAFFODIL-2062
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2062
> Project: Daffodil
> Issue Type: Bug
> Components: Front End
> Affects Versions: 2.3.0
> Reporter: Steve Lawrence
> Assignee: Dave Thompson
> Priority: Major
> Fix For: 2.4.0
>
>
> Assume the following schema:
> {code:xml}
> <xs:element name="test">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="count" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1" />
> <xs:element name="record" dfdl:lengthKind="explicit" dfdl:length="2" maxOccurs="unbounded"
> dfdl:occursCountKind="expression" dfdl:occursCount="{ ../count }">
> <xs:complexType>
> <xs:sequence>
> <!--
> <xs:element name="value1" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" />
> <xs:element name="value2" dfdl:lengthKind="explicit" dfdl:length="1" type="xs:string" />
> -->
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> {code}
> This schema works if we uncomment the value1 and value2 elements. However, with them commented out, this schema should still work. The {{record}} element has an explciit length, so this should just skip over 2 bytes, count number of times. Instead, it results in the following exception:
> {code}
> org.apache.daffodil.exceptions.Abort: NadaParsers are all supposed to optimize out!
> org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
> org.apache.daffodil.processors.parsers.NadaParser.parse(Parser.scala:150)
> org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:76)
> org.apache.daffodil.processors.parsers.Parser.parse1$(Parser.scala:70)
> at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
> at org.apache.daffodil.processors.parsers.NadaParser.parse(Parser.scala:150)
> at org.apache.daffodil.processors.parsers.Parser.parse1(Parser.scala:76)
> {code}
> So the empty sequence results in a NadaParser, which should have been optimized out.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)