diff --git a/Framework/src/CcdbDatabase.cxx b/Framework/src/CcdbDatabase.cxx index 3393f4ffc5..46bbe0636b 100644 --- a/Framework/src/CcdbDatabase.cxx +++ b/Framework/src/CcdbDatabase.cxx @@ -37,9 +37,9 @@ #include #include #include -#include // boost #include +#include #include #include #include @@ -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&) { + ILOG(Error, Support) << "Failed to parse json in CcdbDatabase::getListingAsPtree from data: " << listingAsStringStream.str() << ENDM; + } return listingAsTree; } @@ -616,7 +620,12 @@ std::vector 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