Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Framework/src/CcdbDatabase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
#include <chrono>
#include <sstream>
#include <filesystem>
#include <unordered_set>
// boost
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/json_parser/error.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/foreach.hpp>
#include <utility>
Expand Down Expand Up @@ -568,7 +568,11 @@ boost::property_tree::ptree CcdbDatabase::getListingAsPtree(const std::string& p
std::stringstream listingAsStringStream{ getListingAsString(pathWithMetadata.str(), "application/json", latestOnly) };

boost::property_tree::ptree listingAsTree;
boost::property_tree::read_json(listingAsStringStream, listingAsTree);
try {
boost::property_tree::read_json(listingAsStringStream, listingAsTree);
} catch (const boost::property_tree::json_parser::json_parser_error&) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an error with support level, indicating that the listing did not have correct JSON format due to possibly malformed or missing reply from QCDB? The same comment for the other catch in the PR.

ILOG(Error, Support) << "Failed to parse json in CcdbDatabase::getListingAsPtree from data: " << listingAsStringStream.str() << ENDM;
}

return listingAsTree;
}
Expand Down Expand Up @@ -616,7 +620,12 @@ std::vector<std::string> CcdbDatabase::getPublishedObjectNames(std::string taskN
boost::property_tree::ptree pt;
stringstream ss;
ss << listing;
boost::property_tree::read_json(ss, pt);

try {
boost::property_tree::read_json(ss, pt);
} catch (const boost::property_tree::json_parser::json_parser_error&) {
ILOG(Error, Support) << "Failed to parse json in CcdbDatabase::getTimestampsForObject from data: " << ss.str() << ENDM;
}

BOOST_FOREACH (boost::property_tree::ptree::value_type& v, pt.get_child("objects")) {
assert(v.first.empty()); // array elements have no names
Expand Down
Loading