This is an automated email from the ASF dual-hosted git repository.
olabusayo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new 154e6a1 Fix Legacy/SAX Discrepancy with NamespaceBindings
154e6a1 is described below
commit 154e6a1d8d96de8c8ecfb267cc8ccc6e6321cef9
Author: olabusayoT <[email protected]>
AuthorDate: Thu Oct 15 10:33:10 2020 -0400
Fix Legacy/SAX Discrepancy with NamespaceBindings
- fixes nullpointer exception by making sure that n stops when it is null,
and ensure we stop when the current mapping is equal to the TopScope, as there
is an issue with mininmizeScope (DAFFODIL-2282) and nsbStart doesn't always
have a mapping that'd equal nsbEnd
DAFFODIL-2383
---
.../main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala | 4 ++--
.../apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala
index d786db7..17224e4 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/SAXInfosetOutputter.scala
@@ -136,7 +136,7 @@ class SAXInfosetOutputter(xmlReader: DFDL.DaffodilXMLReader)
diElem.diParent.erd.minimizedScope
}
var n = nsbStart
- while (n != nsbEnd) {
+ while (n != nsbEnd && n != null && n != scala.xml.TopScope) {
val prefix = if (n.prefix == null) "" else n.prefix
val uri = if (n.uri == null) "" else n.uri
contentHandler.startPrefixMapping(prefix, uri)
@@ -153,7 +153,7 @@ class SAXInfosetOutputter(xmlReader: DFDL.DaffodilXMLReader)
.minimizedScope
}
var n = nsbStart
- while (n != nsbEnd) {
+ while (n != nsbEnd && n != null && n != scala.xml.TopScope) {
val prefix = if (n.prefix == null) "" else n.prefix
contentHandler.endPrefixMapping(prefix)
n = n.parent
diff --git
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
index 6e941d1..c85d4a4 100644
---
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
+++
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
@@ -292,7 +292,7 @@ class DaffodilTDMLDFDLProcessor private (private var dp:
DataProcessor) extends
val xri = dp.newXMLReaderInstance
val errorHandler = new DaffodilTDMLSAXErrorHandler()
val outputStream = new ByteArrayOutputStream()
- val saxHandler = new DaffodilOutputContentHandler(outputStream, pretty =
true)
+ val saxHandler = new DaffodilOutputContentHandler(outputStream, pretty =
false)
xri.setContentHandler(saxHandler)
xri.setErrorHandler(errorHandler)
xri.setProperty(XMLUtils.DAFFODIL_SAX_URN_BLOBDIRECTORY, blobDir)