|
37 | 37 | #include <chrono> |
38 | 38 | #include <sstream> |
39 | 39 | #include <filesystem> |
40 | | -#include <unordered_set> |
41 | 40 | // boost |
42 | 41 | #include <boost/property_tree/json_parser.hpp> |
| 42 | +#include <boost/property_tree/json_parser/error.hpp> |
43 | 43 | #include <boost/property_tree/ptree.hpp> |
44 | 44 | #include <boost/foreach.hpp> |
45 | 45 | #include <utility> |
@@ -568,7 +568,11 @@ boost::property_tree::ptree CcdbDatabase::getListingAsPtree(const std::string& p |
568 | 568 | std::stringstream listingAsStringStream{ getListingAsString(pathWithMetadata.str(), "application/json", latestOnly) }; |
569 | 569 |
|
570 | 570 | boost::property_tree::ptree listingAsTree; |
571 | | - boost::property_tree::read_json(listingAsStringStream, listingAsTree); |
| 571 | + try { |
| 572 | + boost::property_tree::read_json(listingAsStringStream, listingAsTree); |
| 573 | + } catch (const boost::property_tree::json_parser::json_parser_error&) { |
| 574 | + ILOG(Error, Support) << "Failed to parse json in CcdbDatabase::getListingAsPtree from data: " << listingAsStringStream.str() << ENDM; |
| 575 | + } |
572 | 576 |
|
573 | 577 | return listingAsTree; |
574 | 578 | } |
@@ -616,7 +620,12 @@ std::vector<std::string> CcdbDatabase::getPublishedObjectNames(std::string taskN |
616 | 620 | boost::property_tree::ptree pt; |
617 | 621 | stringstream ss; |
618 | 622 | ss << listing; |
619 | | - boost::property_tree::read_json(ss, pt); |
| 623 | + |
| 624 | + try { |
| 625 | + boost::property_tree::read_json(ss, pt); |
| 626 | + } catch (const boost::property_tree::json_parser::json_parser_error&) { |
| 627 | + ILOG(Error, Support) << "Failed to parse json in CcdbDatabase::getTimestampsForObject from data: " << ss.str() << ENDM; |
| 628 | + } |
620 | 629 |
|
621 | 630 | BOOST_FOREACH (boost::property_tree::ptree::value_type& v, pt.get_child("objects")) { |
622 | 631 | assert(v.first.empty()); // array elements have no names |
|
0 commit comments