Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndw committed Oct 24, 2021
1 parent e6026ed commit f0889e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/main/scala/com/xmlcalabash/runtime/PrintingConsumer.scala
Expand Up @@ -26,7 +26,7 @@ class PrintingConsumer private(config: XMLCalabashRuntime, output: DeclareOutput
}

override def consume(port: String, message: Message): Unit = {
logger.debug(s"PrintingConsumer received message on ${port}")
logger.debug(s"Received message on ${port}")
message match {
case msg: XProcItemMessage =>
// Check that the message content type is allowed on the output port
Expand Down Expand Up @@ -60,6 +60,7 @@ class PrintingConsumer private(config: XMLCalabashRuntime, output: DeclareOutput
outstream.write(buf, 0, len)
len = instream.read(buf, 0, buf.length)
}
logger.debug(s"${outstream.toByteArray.length} byte message")
pos.write(outstream.toByteArray)
case msg: XdmValueItemMessage =>
val stream = new ByteArrayOutputStream()
Expand All @@ -73,7 +74,12 @@ class PrintingConsumer private(config: XMLCalabashRuntime, output: DeclareOutput
}

S9Api.serialize(config.config, msg.item, serializer)
pos.print(stream.toString("UTF-8"))
val content = stream.toString("UTF-8")
logger.debug(s"Message: ${content}")
pos.print(content)
if (!content.endsWith("\n")) {
pos.println()
}
case _ =>
throw new RuntimeException(s"Don't know how to print ${msg.item}")
}
Expand Down
Expand Up @@ -121,6 +121,8 @@ class CachingErrorListener(errors: Errors) extends ErrorListener with ErrorHandl
}

override def report(xmlProcessingError: XmlProcessingError): Unit = {
println("wat?")
if (showErrors) {
println(xmlProcessingError)
}
}
}

0 comments on commit f0889e7

Please sign in to comment.