Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-744

Child element's length should be limited by length of parent

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • s14
    • None
    • None
    • None

      While testing Spin 10, I came across a test in scala-debug and could not find an associated test. The test defines a sequence with lengthKind = pattern. The sequence contains two elements, separated by a ',' and both with lengthKind='delimited'. Based on this statement in the spec:
      "On parsing, the length of an element with dfdl:lengthKind 'delimited' is determined by scanning the datastream for ... the end of an enclosing element designated by its known length" I would not expect the following error:

      [error] Test edu.illinois.ncsa.daffodil.section12.lengthKind.TestLengthKindPattern.testLengthKindPatternCompound failed: java.lang.Exception: Parse Error: The parsed length of the children was greater than that of the parent.
      [error] Schema context: element.ab Location line 21 column 86 in file:/tmp/daffodil_tmp_7189552609605246540.dfdl.xsd(no data location)
      [error]     at edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectSuccess(TDMLRunner.scala:559)
      [error]     at edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scala:445)
      [error]     at edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:394)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTestWithDataVolumes(TDMLRunner.scala:257)
      [error]     at edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:248)
      [error]     at edu.illinois.ncsa.daffodil.section12.lengthKind.TestLengthKindPattern.testLengthKindPatternCompound(TestLengthKindPattern.scala:53)
      [error]     ...

      I would expect the length of the second element to be 'delimited' by the length of the parent element.

      The test is testLengthKindPatternCompound in the following files:

      daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section12/lengthKind/PatternTests.tdml
      daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section12/lengthKind/TestLengthKindPatternDebug.scala

      Is the spec just misleading in that regard, and this test should be using lengthKind="endOfParent" instead of delimited?

              Unassigned Unassigned
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: