diff options
author | Jacob Keeler <jacob.keeler@livioradio.com> | 2018-07-17 10:01:00 -0400 |
---|---|---|
committer | Jacob Keeler <jacob.keeler@livioradio.com> | 2018-07-17 10:01:00 -0400 |
commit | 6d27cf465aad85ea50b6ded14b3adda212866540 (patch) | |
tree | c445fe9e623789baf4d3ecebc5b47cd2180764c7 | |
parent | 1319595787ea2a131193bb994bcdba48710e08e4 (diff) | |
download | sdl_core-feature/include_deprecated_warnings.tar.gz |
Fix uses of deprecated methods in projectfeature/include_deprecated_warnings
-rw-r--r-- | src/components/application_manager/src/rpc_handler_impl.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc index 42894a36a8..2ee7a23707 100644 --- a/src/components/application_manager/src/rpc_handler_impl.cc +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -214,9 +214,12 @@ bool RPCHandlerImpl::ConvertMessageToSO( message.function_id(), message.type(), message.correlation_id()); + + rpc::ValidationReport report("RPC"); + if (!conversion_result || !mobile_so_factory().attachSchema(output, true) || - ((output.validate() != smart_objects::Errors::OK))) { + ((output.validate(&report) != smart_objects::Errors::OK))) { LOG4CXX_WARN(logger_, "Failed to parse string to smart object :" << message.json_message()); @@ -226,6 +229,9 @@ bool RPCHandlerImpl::ConvertMessageToSO( message.function_id(), message.correlation_id(), mobile_apis::Result::INVALID_DATA)); + + (*response)[strings::msg_params][strings::info] = + rpc::PrettyFormat(report); app_manager_.GetRPCService().ManageMobileCommand( response, commands::Command::SOURCE_SDL); return false; @@ -275,8 +281,18 @@ bool RPCHandlerImpl::ConvertMessageToSO( LOG4CXX_WARN(logger_, "Failed to attach schema to object."); return false; } - if (output.validate() != smart_objects::Errors::OK) { - LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI"); + + rpc::ValidationReport report("RPC"); + + if (output.validate(&report) != smart_objects::Errors::OK) { + LOG4CXX_ERROR(logger_, + "Incorrect parameter from HMI" + << rpc::PrettyFormat(report)); + + output.erase(strings::msg_params); + output[strings::params][hmi_response::code] = + hmi_apis::Common_Result::INVALID_DATA; + output[strings::msg_params][strings::info] = rpc::PrettyFormat(report); return false; } break; |