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

Commit a0812a2

Browse files
authored
Fix NullPointerException when message field is a null (#202)
1 parent 584e319 commit a0812a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/scala/higherkindness/rules_scala/common/sbt-testing/JUnitXmlReporter.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ import scala.collection.mutable.ListBuffer
88
import scala.xml.{Elem, XML}
99

1010
class JUnitXmlReporter(tasksAndEvents: ListBuffer[(String, ListBuffer[Event])]) {
11-
private def escape(str: String): String =
12-
str.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
11+
private def escape(info: String): String = info match {
12+
case str: String =>
13+
str.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
14+
case _ => ""
15+
}
1316

1417
def result: Elem =
1518
XML.loadString(s"""<testsuites>

0 commit comments

Comments
 (0)