-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
None
Unparsing:
A schema was set up by dev for testing that contained a sequence of an optional array and a scalar. I added a sample unparsing test (impOptArrayThenScalar02 in daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section16/array_optional_elem/UnparseArrayImplicitOptionalElem.tdml) that uses an infoset that has the optional array not present. At first I used the following as the infoset:
<tdml:infoset xmlns="http://example.com">
|
<tdml:dfdlInfoset>
|
<r4>
|
<sca>3</sca>
|
</r4>
|
</tdml:dfdlInfoset>
|
The test failed with the following error:
[error] Test edu.illinois.ncsa.daffodil.section16.array_optional_elem.TestUnparseArrayOptionalElem.test_impOptArrayThenScalar02 failed: edu.illinois.ncsa.daffodil.tdml.TDMLException: output data length 0 for List() doesn't match expected value 1 for List(51)
|
When I added in an empty element for the non-present array, the test passed:
<tdml:infoset xmlns="http://example.com">
|
<tdml:dfdlInfoset>
|
<r4>
|
<opt/>
|
<sca>3</sca>
|
</r4>
|
</tdml:dfdlInfoset>
|
</tdml:infoset>
|
I wasn't sure if this was the beviour that we would expect, so I wrote up a parsing test case to see if the empty element is generated (impOptArrayThenScalar02b in daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section16/array_optional_elem/ArrayOptionalElem.tdml). My document is a single character, and I get the following error:
[error] Test edu.illinois.ncsa.daffodil.section16.array_optional_elem.TestArrayOptionalElem.test_impOptArrayThenScalar02b failed: edu.illinois.ncsa.daffodil.processors.ParseError: Parse Error: StringFixedLengthInBytesFixedWidthCharacters - Insufficient Bits in field: IndexOutOfBounds:
|
[error] null
|
[error] Schema context: One(element.sca) List(element.sca)
|
[error] Data location was preceding byte 1
|
[error] UTF-8 text starting at byte 0 is: (3)
|
[error] Data (hex) starting at byte 0 is: (0x33)
|