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

infoset nodes removed by InfosetWalker tha are still needed, null pointer exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.5.0
    • Back End
    • None

    Description

      Functions in SequenceChildParseResultHelper.scala and SeparatedSequenceChildParseResultHelper.scala call the maybeMostRecentlyAddedChild() function, which has a purpose of getting the child that was most recently added to the infoset and inspecting it element to determine things nil/normal/missing representation and determine the parse status. This seems to usually be used when dealing with postfix separators, but there may be other cases and more specific circumstances needed.

      However, in some cases it is possible that the InfosetWalker has already walked and remove elements from the Infoset because it thinks they aren't needed anymore. But this function does actually still need them, which can lead to null exceptions.

      Fortunately, the InfosetWalker only removes infoset elements periodically depending on a number of factors, so it's fairly rare that this case actually happens. But when it does it appears very random. To reliably cause the issue, we can force the infoset walker to remove elements as soon as it thinks it's possible by setting the InfosetWalker minSkip value to zero. After doing that, the below schema and data reliably reproduce the issue.

      Data:

      |classificiation;body1;body1;body3;|
      

      Schema:

      <?xml version="1.0" encoding="UTF-8"?> 
      
      <schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/">
      
        <include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
      
        <annotation>
          <appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format xmlns="" ref="GeneralFormat" lengthKind="delimited" />
          </appinfo>
        </annotation>
      
        <element name="file">
          <complexType>
            <sequence dfdl:initiator="|" dfdl:terminator="|" dfdl:separator=";">
              <element name="first" type="xs:string" />
              <sequence dfdl:separator=";" dfdl:separatorPosition="postfix">
                <element name="field" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
              </sequence>
            </sequence>
          </complexType>
        </element>
      
      </schema>
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: