Fixed #8906 (Encoding error in XML message: info attribute)
This commit is contained in:
parent
af639e9848
commit
7a40b85531
|
@ -396,7 +396,7 @@ std::string ErrorLogger::ErrorMessage::toXML() const
|
||||||
printer.PushAttribute("file", (*it).getfile().c_str());
|
printer.PushAttribute("file", (*it).getfile().c_str());
|
||||||
printer.PushAttribute("line", std::max((*it).line,0));
|
printer.PushAttribute("line", std::max((*it).line,0));
|
||||||
if (!it->getinfo().empty())
|
if (!it->getinfo().empty())
|
||||||
printer.PushAttribute("info", it->getinfo().c_str());
|
printer.PushAttribute("info", fixInvalidChars(it->getinfo()).c_str());
|
||||||
printer.CloseElement(false);
|
printer.CloseElement(false);
|
||||||
}
|
}
|
||||||
for (std::string::size_type pos = 0; pos < mSymbolNames.size();) {
|
for (std::string::size_type pos = 0; pos < mSymbolNames.size();) {
|
||||||
|
|
|
@ -197,6 +197,7 @@ private:
|
||||||
|
|
||||||
void ToXmlV2Locations() const {
|
void ToXmlV2Locations() const {
|
||||||
std::list<ErrorLogger::ErrorMessage::FileLocation> locs = { fooCpp5, barCpp8 };
|
std::list<ErrorLogger::ErrorMessage::FileLocation> locs = { fooCpp5, barCpp8 };
|
||||||
|
locs.back().setinfo("ä");
|
||||||
ErrorMessage msg(locs, emptyString, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
ErrorMessage msg(locs, emptyString, Severity::error, "Programming error.\nVerbose error", "errorId", false);
|
||||||
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results version=\"2\">\n");
|
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results version=\"2\">\n");
|
||||||
header += " <cppcheck version=\"";
|
header += " <cppcheck version=\"";
|
||||||
|
@ -206,7 +207,7 @@ private:
|
||||||
ASSERT_EQUALS(" </errors>\n</results>", ErrorLogger::ErrorMessage::getXMLFooter());
|
ASSERT_EQUALS(" </errors>\n</results>", ErrorLogger::ErrorMessage::getXMLFooter());
|
||||||
std::string message(" <error id=\"errorId\" severity=\"error\"");
|
std::string message(" <error id=\"errorId\" severity=\"error\"");
|
||||||
message += " msg=\"Programming error.\" verbose=\"Verbose error\">\n";
|
message += " msg=\"Programming error.\" verbose=\"Verbose error\">\n";
|
||||||
message += " <location file=\"bar.cpp\" line=\"8\"/>\n";
|
message += " <location file=\"bar.cpp\" line=\"8\" info=\"\\303\\244\"/>\n";
|
||||||
message += " <location file=\"foo.cpp\" line=\"5\"/>\n </error>";
|
message += " <location file=\"foo.cpp\" line=\"5\"/>\n </error>";
|
||||||
ASSERT_EQUALS(message, msg.toXML());
|
ASSERT_EQUALS(message, msg.toXML());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue