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

Unparse: Diagnostic message when array has too many/too few elements unclear

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocking Blocking
    • 2.0.0
    • 1.1.0
    • Diagnostics
    • None

      I wrote a negative test for unparsing an array when occursCountKind="fixed." In this case, an array of size 1 is expected, but the infoset contains an array of 3 elements. The error:

      [error] Test edu.illinois.ncsa.daffodil.section16.array_optional_elem.TestUnparseArrayOptionalElemDebug.test_fixedUnparseArrayTooManyElements01 failed: edu.illinois.ncsa.daffodil.processors.unparsers.InfosetError: Infoset Error: No next element corresponding to WrappedArray({http://example.com}opt).
      [error] Schema context: Nope List()(no data location)

      The schema context is not entirely helpful, and the error message seems fairly low-level, instead of something the average user could decipher and address.

      See test:
      fixedUnparseArrayTooManyElements01
      In the following files:
      daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section16/array_optional_elem/UnparseArrayFixedOptionalElem.tdml
      daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section16/array_optional_elem/TestUnparseArrayOptionalElemDebug.scala
      daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section16/array_optional_elem/TestUnparseArrayOptionalElem.scala

      Additionally, I wrote another test where the input data has too few elements for the minOccurs value, and occursCountKind="fixed". The error message in this case is a little more accessible, but still could be more user-friendly:

      [error] Unparse Error: Expected Start Element event, but received: End(edu.illinois.ncsa.daffodil.processors.DIArray@4936e098).
      [error] Schema context: Nope List()
      [error] Data location was preceding byte 1

      Since the error is in fact an unparse error and the message is somewhat helpful, it is currently the expected error in this test. The test is passing and is not in scala-debug. If the error message gets improved, we will need to edit the test.
      Test fixedUnparseArrayTooFewElements01 in the same files as above.

              dthompson David Thompson
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 6 minutes
                  6m