Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2888

Incorrect out of range warning with constant dfdl:length and length/minLength/maxLength facets

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.9.0
    • Front End
    • None

    Description

      Say we have a schema like this:

        <element name="file" dfdl:lengthKind="explicit" dfdl:length="16" dfdl:lengthUnits="bits">
          <simpleType>
            <restriction base="xs:string">
              <maxLength value="2" />
            </restriction>
          </simpleType>
        </element>
      

      So we have a 2-byte constant length string and we specify maxLength should be 2. However, because we specify the length in bits, the value of dfdl:length is greater than the value of maxLength and so we output a warning:

      [warn] Schema Definition Warning: Explicit dfdl:length of 16 is out of range for facet maxLength='2'. (id: facetExplicitLengthOutOfRange)

      The issue is this check does not take into account the units of length. It also does not take into account the character set of the data. For example, 1-byte of the X-DFDL-BITS-MSBF character set has a minLength of 8 characters in the infoset.

      There are other things to consider, for example, maybe we have a string with dfdl:length="3" with units of bytes, but we always expect to have 1 character of padding removed, so our maxLength wants to be 2. We would get a warning here too.

      Maybe some false positives are okay, but we can probably improve the logic to avoid false positives in some cases at least to take into account units and charsets? Or maybe this warning isn't really that helpful, and the compelxity needed to get it right is not worth it, and should be removed?

      Attachments

        Issue Links

          Activity

            People

              slawrence Steve Lawrence
              slawrence Steve Lawrence
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: