From b941de80dbe15a20a0eaea795d1282cf36306c30 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Fri, 30 Sep 2016 11:21:22 +0300
Subject: [PATCH] MAINT-6783 Xml parser warnings should show the file name

---
 indra/llcommon/llinitparam.cpp | 7 ++++++-
 indra/llcommon/llinitparam.h   | 1 +
 indra/llcommon/llsdparam.h     | 1 +
 indra/llui/llxuiparser.h       | 4 +++-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp
index aa2f4eb289b..1d104cf55df 100644
--- a/indra/llcommon/llinitparam.cpp
+++ b/indra/llcommon/llinitparam.cpp
@@ -193,7 +193,12 @@ namespace LLInitParam
 		{
 			if (!silent)
 			{
-				p.parserWarning(llformat("Failed to parse parameter \"%s\"", p.getCurrentElementName().c_str()));
+				std::string file_name = p.getCurrentFileName();
+				if(!file_name.empty())
+				{
+					file_name = "in file: " + file_name;
+				}
+				p.parserWarning(llformat("Failed to parse parameter \"%s\" %s", p.getCurrentElementName().c_str(), file_name.c_str()));
 			}
 			return false;
 		}
diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h
index c65b05f610a..f1f4226c409 100644
--- a/indra/llcommon/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -551,6 +551,7 @@ namespace LLInitParam
 		}
 
 		virtual std::string getCurrentElementName() = 0;
+		virtual std::string getCurrentFileName() = 0;
 		virtual void parserWarning(const std::string& message);
 		virtual void parserError(const std::string& message);
 		void setParseSilently(bool silent) { mParseSilently = silent; }
diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h
index 09f1bdf1e3f..93910b70ae9 100644
--- a/indra/llcommon/llsdparam.h
+++ b/indra/llcommon/llsdparam.h
@@ -66,6 +66,7 @@ typedef LLInitParam::Parser parser_t;
 	}
 
 	/*virtual*/ std::string getCurrentElementName();
+	/*virtual*/ std::string getCurrentFileName(){ return LLStringUtil::null; }
 
 private:
 	void writeSDImpl(LLSD& sd, 
diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h
index ad2a39cab7f..bb11a23938d 100644
--- a/indra/llui/llxuiparser.h
+++ b/indra/llui/llxuiparser.h
@@ -60,7 +60,7 @@ class LLXSDWriter : public LLInitParam::Parser
 	void writeXSD(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace);
 
 	/*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; }
-
+	/*virtual*/ std::string getCurrentFileName() { return LLStringUtil::null; }
 	LLXSDWriter();
 	~LLXSDWriter();
 
@@ -98,6 +98,7 @@ LOG_CLASS(LLXUIParser);
 	typedef LLInitParam::Parser::name_stack_t name_stack_t;
 
 	/*virtual*/ std::string getCurrentElementName();
+	/*virtual*/ std::string getCurrentFileName() { return mCurFileName; }
 	/*virtual*/ void parserWarning(const std::string& message);
 	/*virtual*/ void parserError(const std::string& message);
 
@@ -200,6 +201,7 @@ LOG_CLASS(LLSimpleXUIParser);
 	virtual ~LLSimpleXUIParser();
 
 	/*virtual*/ std::string getCurrentElementName();
+	/*virtual*/ std::string getCurrentFileName() { return mCurFileName; }
 	/*virtual*/ void parserWarning(const std::string& message);
 	/*virtual*/ void parserError(const std::string& message);
 
-- 
GitLab