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

Commit 39e6f32

Browse files
committed
Fix NullPointerException when message field is a null
1 parent 584e319 commit 39e6f32

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ 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: Any): String = info match {
12+
case str: String => str.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
13+
case _ => ""
14+
}
1315

1416
def result: Elem =
1517
XML.loadString(s"""<testsuites>

0 commit comments

Comments
 (0)