From cd38c8e913ef72f13a93e3aeb3fa3d74fc56926e Mon Sep 17 00:00:00 2001 From: Matthew D Jones <matthew.d.jones@tessella.com> Date: Mon, 19 Oct 2015 14:52:28 +0100 Subject: [PATCH] Re #13729 Started boost::property_tree->jsoncpp in script repo code --- .../src/ScriptRepositoryImpl.cpp | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp index 25ecd1465d4..2f8d0a7f220 100644 --- a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp +++ b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp @@ -49,13 +49,11 @@ using Mantid::Kernel::NetworkProxy; #include <Poco/DateTimeFormatter.h> // from boost -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/json_parser.hpp> #include <boost/foreach.hpp> #include <boost/algorithm/string.hpp> #include <boost/regex.hpp> -using boost::property_tree::ptree; +#include <json/json.h> namespace Mantid { namespace API { @@ -822,19 +820,16 @@ void ScriptRepositoryImpl::upload(const std::string &file_path, std::string detail; std::string published_date; - ptree pt; - try { - read_json(answer, pt); - info = pt.get<std::string>("message", ""); - detail = pt.get<std::string>("detail", ""); - published_date = pt.get<std::string>("pub_date", ""); - std::string cmd = pt.get<std::string>("shell", ""); - if (!cmd.empty()) - detail.append("\nFrom Command: ").append(cmd); - - } catch (boost::property_tree::json_parser_error &ex) { + Json::Value pt; + if (!Json::Reader::parse(answer, pt)) { throw ScriptRepoException("Bad answer from the Server", ex.what()); } + info = pt.get<std::string>("message", ""); + detail = pt.get<std::string>("detail", ""); + published_date = pt.get<std::string>("pub_date", ""); + std::string cmd = pt.get<std::string>("shell", ""); + if (!cmd.empty()) + detail.append("\nFrom Command: ").append(cmd); if (info == "success") { g_log.notice() << "ScriptRepository:" << file_path << " uploaded!" -- GitLab