From: Gunnar Beutner Date: Mon, 28 Sep 2015 04:55:44 +0000 (+0200) Subject: Fix incorrect location info for validators X-Git-Tag: v2.4.0~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed14dd7b4eedde81a343d4933fae8b8b61c32470;p=icinga2 Fix incorrect location info for validators refs #9088 --- diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index a4b11fdb8..1dafd7c67 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -1118,7 +1118,8 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& subvalidator_prefix = name; m_Impl << (type_check ? "\t" : "") << (indent ? "\t" : "") << "\t\t" << "location.push_back(akey);" << std::endl - << (type_check ? "\t" : "") << (indent ? "\t" : "") << "\t\t" << "TIValidate" << subvalidator_prefix << "_" << i << "(object, akey, avalue, location, utils);" << std::endl; + << (type_check ? "\t" : "") << (indent ? "\t" : "") << "\t\t" << "TIValidate" << subvalidator_prefix << "_" << i << "(object, akey, avalue, location, utils);" << std::endl + << (type_check ? "\t" : "") << (indent ? "\t" : "") << "\t\t" << "location.pop_back();" << std::endl; if (rule.Type == "Array") m_Impl << (type_check ? "\t" : "") << "\t\t\t" << "anum++;" << std::endl; @@ -1150,8 +1151,6 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& << (type_check ? "\t" : "") << "\t\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_cast(this), location, \"Required index '" << index << "' is not set.\"));" << std::endl; } } - - m_Impl << (type_check ? "\t" : "") << (indent ? "\t" : "") << "\t\t" << "location.pop_back();" << std::endl; } m_Impl << (type_check ? "\t" : "") << "\t\t" << "return;" << std::endl; @@ -1223,6 +1222,7 @@ void ClassCompiler::HandleValidator(const Validator& validator, const ClassDebug << "\t" << "std::vector location;" << std::endl << "\t" << "location.push_back(\"" << it->second.Name << "\");" << std::endl << "\t" << "TIValidate" << it->first.first << it->first.second << "(this, value, location, utils);" << std::endl + << "\t" << "location.pop_back();" << std::endl << "}" << std::endl << std::endl; }