diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp index 753fd2dfc..aa41acbdc 100644 --- a/libprocessgroup/setup/cgroup_map_write.cpp +++ b/libprocessgroup/setup/cgroup_map_write.cpp @@ -183,10 +183,12 @@ static bool ReadDescriptorsFromFile(const std::string& file_name, return false; } - Json::Reader reader; + Json::CharReaderBuilder builder; + std::unique_ptr reader(builder.newCharReader()); Json::Value root; - if (!reader.parse(json_doc, root)) { - LOG(ERROR) << "Failed to parse cgroups description: " << reader.getFormattedErrorMessages(); + std::string errorMessage; + if (!reader->parse(&*json_doc.begin(), &*json_doc.end(), &root, &errorMessage)) { + LOG(ERROR) << "Failed to parse cgroups description: " << errorMessage; return false; } diff --git a/libprocessgroup/task_profiles.cpp b/libprocessgroup/task_profiles.cpp index 8d4ce2545..f13a6815c 100644 --- a/libprocessgroup/task_profiles.cpp +++ b/libprocessgroup/task_profiles.cpp @@ -425,10 +425,12 @@ bool TaskProfiles::Load(const CgroupMap& cg_map, const std::string& file_name) { return false; } - Json::Reader reader; + Json::CharReaderBuilder builder; + std::unique_ptr reader(builder.newCharReader()); Json::Value root; - if (!reader.parse(json_doc, root)) { - LOG(ERROR) << "Failed to parse task profiles: " << reader.getFormattedErrorMessages(); + std::string errorMessage; + if (!reader->parse(&*json_doc.begin(), &*json_doc.end(), &root, &errorMessage)) { + LOG(ERROR) << "Failed to parse task profiles: " << errorMessage; return false; }