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

cannot use trace when doing streaming parse calls

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.0, 3.2.1
    • None
    • Back End, Debugger
    • None

    Description

      I am using SAPI and writing a streaming message parser. It calls the dp.parse repeatedly to parse the data, grabbing one message at a time from the data stream.

      I need to enable tracing so I can see why a parse fails on the 4th message.

      But this does not work:

      dp = pf.onPath("/")
      .withValidationMode(ValidationMode.Off)
      .withDebuggerRunner(new TraceDebuggerRunner())
      .withDebugging(true)
      

      Each call to parse calls notifyDebugging, which calls setDebugging, which checks that the position of the data input stream is bitPos0b == 0. But in a streaming situation, the bitPos0b won't be zero except when parsing at the start of the stream.

      Backtrace:

      java.lang.IllegalStateException: Must call before any access to data
      
      	at org.apache.daffodil.io.DataInputStreamImplMixin.setDebugging(DataInputStreamImplMixin.scala:28)
      	at org.apache.daffodil.io.DataInputStreamImplMixin.setDebugging$(DataInputStreamImplMixin.scala:27)
      	at org.apache.daffodil.io.InputSourceDataInputStream.setDebugging(InputSourceDataInputStream.scala:786)
      	at org.apache.daffodil.processors.parsers.PState.notifyDebugging(PState.scala:452)
      	at org.apache.daffodil.processors.DataProcessor.parse(DataProcessor.scala:444)
      	at org.apache.daffodil.sapi.DataProcessor.parse(Daffodil.scala:747)
      	at com.owlcyberdefense.p8.MessageParser.parse(MessageParser.scala:66)
      

      It is also questionable if this Java IllegalStateException should be getting thrown all the way to top level here. Since this is SAPI, this is probably Ok, but I would have expected Daffodil to issue an invariant failed here. This bug is an internal Daffodil issue, and not something SAPI uses should be having to think about catching.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: