[ 
https://issues.apache.org/jira/browse/DAFFODIL-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mike Beckerle updated DAFFODIL-2624:
------------------------------------
    Labels: Beginner  (was: )

> cannot use trace when doing streaming parse calls
> -------------------------------------------------
>
>                 Key: DAFFODIL-2624
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2624
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, Debugger
>    Affects Versions: 2.7.0, 3.2.1
>            Reporter: Mike Beckerle
>            Priority: Major
>              Labels: Beginner
>             Fix For: 3.5.0
>
>
> 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:
> {code:java}
> dp = pf.onPath("/")
> .withValidationMode(ValidationMode.Off)
> .withDebuggerRunner(new TraceDebuggerRunner())
> .withDebugging(true)
> {code}
> 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:
> {code}
> 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)
> {code}
> 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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to