From 6d6c60bfe3759a2b22fde7e84b7b3880d69fa0f3 Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Thu, 5 Jan 2017 13:31:49 +0100
Subject: [PATCH] junitloggers: escaped special characters in verdict message
 (Bug 509855)

Change-Id: I076d51adc19c73096c06928cf15e8cb973725e1b
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 loggerplugins/JUnitLogger/JUnitLogger.cc   | 2 +-
 loggerplugins/JUnitLogger2/JUnitLogger2.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/loggerplugins/JUnitLogger/JUnitLogger.cc b/loggerplugins/JUnitLogger/JUnitLogger.cc
index 46e8f7839..4d72bccc2 100644
--- a/loggerplugins/JUnitLogger/JUnitLogger.cc
+++ b/loggerplugins/JUnitLogger/JUnitLogger.cc
@@ -177,7 +177,7 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event,
         (now - then) / 1000000.0,
         verdict_name[tct.verdict()],
         (tct.reason().lengthof() > 0 ? ", reason: " : ""),
-        (const char*)tct.reason());
+        (const char*)escape_xml_element(tct.reason()));
 
       fprintf(file_stream_, "  <testcase classname='%s' name='%s' time='%f'>\n",
         (const char*)tct.name().module__name(),
diff --git a/loggerplugins/JUnitLogger2/JUnitLogger2.cc b/loggerplugins/JUnitLogger2/JUnitLogger2.cc
index afbf88bc4..a8e81bef4 100644
--- a/loggerplugins/JUnitLogger2/JUnitLogger2.cc
+++ b/loggerplugins/JUnitLogger2/JUnitLogger2.cc
@@ -151,7 +151,7 @@ void JUnitLogger2::log(const TitanLoggerApi::TitanLogEvent& event,
 
         case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseFinished: {
           const TitanLoggerApi::TestcaseType& tct = tcev.testcaseFinished();
-          testcase.reason = tct.reason();
+          testcase.reason = escape_xml_element(tct.reason());
           testcase.module_name = tct.name().module__name();
           
           const TitanLoggerApi::TimestampType& ts = event.timestamp();
-- 
GitLab