You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sl...@apache.org on 2023/02/01 16:02:24 UTC
[daffodil] branch main updated: Only update debug setting on change
This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new d06722c94 Only update debug setting on change
d06722c94 is described below
commit d06722c94ddfcd691480002f09c24b1829272157
Author: Mike McGann <mm...@owlcyberdefense.com>
AuthorDate: Wed Feb 1 09:06:01 2023 -0500
Only update debug setting on change
Daffodil currently throws an unhandled exception when attempting a streaming
parse with tracing enabled. When the debug setting is changed, an exception
is thrown if processing has already started on the input. In a streaming
context, this setting is applied on each infoset and causes an exception
to be thrown the second time the debug setting is set. This update only
checks and sets the debug setting if the value has changed.
DAFFODIL-2624
---
.../scala/org/apache/daffodil/cliTest/TestCLIParsing.scala | 13 +++++++++++++
.../org/apache/daffodil/io/DataInputStreamImplMixin.scala | 6 ++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cliTest/TestCLIParsing.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cliTest/TestCLIParsing.scala
index 35f44c932..315557908 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cliTest/TestCLIParsing.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cliTest/TestCLIParsing.scala
@@ -590,6 +590,19 @@ class TestCLIparsing {
} (ExitCode.LeftOverData)
}
+ @Test def test_XXX_CLI_Parsing_Stream_03(): Unit = {
+ val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/CLI/cli_schema_02.dfdl.xsd")
+
+ runCLI(args"--trace parse --stream -s $schema") { cli =>
+ cli.send("123", inputDone = true)
+ cli.expect("<a>1</a>")
+ cli.expect("bitPosition: 8")
+ cli.expect("<a>2</a>")
+ cli.expect("bitPosition: 16")
+ cli.expect("<a>3</a>")
+ } (ExitCode.Success)
+ }
+
@Test def test_CLI_Parsing_XCatalog_Resolution_Failure(): Unit = {
val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/CLI/xcatalog_import_failure.dfdl.xsd")
val xcatalog = path("daffodil-cli/src/test/resources/org/apache/daffodil/CLI/xcatalog_invalid.xml")
diff --git a/daffodil-io/src/main/scala/org/apache/daffodil/io/DataInputStreamImplMixin.scala b/daffodil-io/src/main/scala/org/apache/daffodil/io/DataInputStreamImplMixin.scala
index d683776d5..ad8e2176d 100644
--- a/daffodil-io/src/main/scala/org/apache/daffodil/io/DataInputStreamImplMixin.scala
+++ b/daffodil-io/src/main/scala/org/apache/daffodil/io/DataInputStreamImplMixin.scala
@@ -25,8 +25,10 @@ trait DataInputStreamImplMixin extends DataInputStream
with LocalBufferMixin {
override def setDebugging(setting: Boolean): Unit = {
- if (bitPos0b > 0) throw new IllegalStateException("Must call before any access to data")
- cst.debugging = setting
+ if (setting != cst.debugging) {
+ if (bitPos0b > 0) throw new IllegalStateException("Must call before any access to data")
+ cst.debugging = setting
+ }
}
final override def isAligned(bitAlignment1b: Int): Boolean = {