[
https://issues.apache.org/jira/browse/DAFFODIL-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826152#comment-16826152
]
Josh Adams commented on DAFFODIL-2083:
--------------------------------------
I've created a pull request
(https://github.com/apache/incubator-daffodil/pull/212) that fixes the very
unhelpful Assert error message, but I think this test is broken anyway. I've
included an updated version that seems to work as intended, using dynamic
separators that don't clash with the separators specified in the record
sequence. It doesn't round trip though, as it doesn't add in the appropriate
escape chars (") on unparse around 'smith, jr.'
> abort in parser runtime - invariant failed with dynamic separator test
> ----------------------------------------------------------------------
>
> Key: DAFFODIL-2083
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2083
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 2.3.0
> Reporter: Michael Beckerle
> Assignee: Josh Adams
> Priority: Major
> Fix For: 2.4.0
>
>
> This TDML contains a test named "nameDOB_test2".
> It is a test that uses an expression for dynamic computing the separator from
> the first part of the record.
> This test results in
> {code:java}
> org.apache.daffodil.exceptions.Abort: Invariant broken:
> MPState.this.delimitersLocalIndexStack.length.==(1)
> org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
> org.apache.daffodil.processors.parsers.MPState.verifyFinalState(PState.scala:141)
> org.apache.daffodil.processors.parsers.PState.verifyFinalState(PState.scala:345)
> org.apache.daffodil.processors.DataProcessor.doParse(Runtime.scala:238){code}
> The TDML is:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <testSuite suiteName="NameDOB"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fn="http://www.w3.org/2005/xpath-functions"
> xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
> xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
> xmlns:ex="http://example.com"
> defaultRoundTrip="onePass">
>
> <tdml:defineSchema name="test2" elementFormDefault="unqualified">
> <xs:include
> schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
> <dfdl:defineEscapeScheme name="eb1">
> <dfdl:escapeScheme
> escapeKind="escapeBlock"
> escapeBlockStart="""
> escapeBlockEnd='"'
> escapeEscapeCharacter='\'
> generateEscapeBlock="whenNeeded"
> extraEscapedCharacters=""
> />
> </dfdl:defineEscapeScheme>
> <dfdl:format ref="tns:GeneralFormat" escapeSchemeRef="tns:eb1"
> separator="" initiator=""
> terminator="" leadingSkip='0' textTrimKind="none"
> initiatedContent="no"
> alignment="implicit" alignmentUnits="bits" trailingSkip="0"
> ignoreCase="no"
> separatorPosition="infix" occursCountKind="implicit"
> emptyValueDelimiterPolicy="both" representation="text"
> textNumberRep="standard"
> lengthKind="delimited" encoding="ASCII" />
>
> <xs:element name="file2"
> dfdl:initiator="sep,last,middle,first,DOB%NL;%WSP*;">
> <xs:complexType>
> <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="postfix">
> <xs:element name="record" maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence dfdl:separator="| // %HT; ,">
> <xs:element name="sep" type="xs:string"/>
> <xs:sequence dfdl:separator='{ ./sep }'>
> <xs:element name="lastName" type="xs:string" />
> <xs:element name="middleName" type="xs:string" />
> <xs:element name="firstName" type="xs:string" />
> <xs:element name="DOB" type="xs:date"
> dfdl:calendarPattern="MM/dd/yyyy"
> dfdl:calendarPatternKind="explicit"/>
> </xs:sequence>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> </tdml:defineSchema>
>
> <tdml:parserTestCase name="nameDOB_test2" root="file2"
> model="test2"
> roundTrip="onePass">
> <tdml:document><![CDATA[sep,last,middle,first,DOB
> ,|"smith, jr.",robert,brandon,03/24/1988
> |,johnson|john|henry|01/23/1986
> [SEP],jones[SEP]arya[SEP]cat[SEP]02/19/1986
> ]]></tdml:document>
> <tdml:infoset>
> <tdml:dfdlInfoset>
> <ex:file2>
> <record>
> <lastName>smith, jr.</lastName>
> <middleName>robert</middleName>
> <firstName>brandon</firstName>
> <DOB>1988-03-24</DOB>
> </record>
> <record>
> <lastName>johnson</lastName>
> <middleName>john</middleName>
> <firstName>henry</firstName>
> <DOB>1986-01-23</DOB>
> </record>
> <record>
> <lastName>jones</lastName>
> <middleName>arya</middleName>
> <firstName>cat</firstName>
> <DOB>1986-02-19</DOB>
> </record>
> </ex:file2>
> </tdml:dfdlInfoset>
> </tdml:infoset>
> </tdml:parserTestCase>
>
>
> </testSuite>{code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)