Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Fix NullPointerException when message field is a null #202

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import scala.collection.mutable.ListBuffer
import scala.xml.{Elem, XML}

class JUnitXmlReporter(tasksAndEvents: ListBuffer[(String, ListBuffer[Event])]) {
private def escape(str: String): String =
str.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
private def escape(info: String): String = info match {
case str: String =>
str.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
case _ => ""
borkaehw marked this conversation as resolved.
Show resolved Hide resolved
}

def result: Elem =
XML.loadString(s"""<testsuites>
Expand Down