From 8f1ba7f84c219b56383f144183282f110ff4abe7 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 30 Mar 2015 14:55:41 +0200 Subject: [PATCH] Fix incorrect validator for strings fixes #8907 --- tools/mkclass/classcompiler.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index 798ca25dc..1cd9b0514 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -721,7 +721,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& if (fieldType.GetRealType() == "Value") { if (rule.Type == "String") - m_Impl << "\t\t" << "if (value.IsScalar())" << std::endl + m_Impl << "\t\t" << "if (value.IsEmpty() || value.IsScalar())" << std::endl << "\t\t\t" << "return;" << std::endl; else if (rule.Type == "Number") { m_Impl << "\t\t" << "try {" << std::endl @@ -829,14 +829,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string& << "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid attribute: \" + key));" << std::endl << "\t" << "else" << std::endl; - m_Impl << (!static_known_attribute ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), boost::assign::list_of("; - - if (validatorType == ValidatorField) - m_Impl << "\"" << field << "\""; - else - m_Impl << "key"; - - m_Impl << "), \"Invalid type.\"));" << std::endl; + m_Impl << (!static_known_attribute ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast(object), location, \"Invalid type.\"));" << std::endl; } m_Impl << "}" << std::endl << std::endl; -- 2.40.0