Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/191#discussion_r151568175
  
    --- Diff: extensions/http-curl/sitetosite/PeersEntity.h ---
    @@ -35,73 +41,82 @@ class PeersEntity {
      public:
     
       static bool parse(const std::shared_ptr<logging::Logger> &logger, const 
std::string &entity, uuid_t id, std::vector<PeerStatus> &peer_statuses) {
    -
    -    Json::Reader reader;
    -    Json::Value root;
         try {
    -      if (reader.parse(entity, root)) {
    -        if (root.isMember("peers") && root["peers"].size() > 0) {
    -          for (const auto &peer : root["peers"]) {
    +      rapidjson::Document root;
    +      rapidjson::ParseResult ok = root.Parse(entity.c_str());
     
    -            std::string hostname;
    -            int port = 0, flowFileCount = 0;
    -            bool secure = false;
    +      if (!ok) {
    +          std::stringstream ss;
    +          ss << "Failed to parse archive lens stack from JSON string with 
reason: "
    +             << rapidjson::GetParseError_En(ok.Code())
    +             << " at offset " << ok.Offset();
    +          std::string exception_msg = ss.str();
    +  
    +          throw Exception(ExceptionType::GENERAL_EXCEPTION, 
exception_msg.c_str());
    --- End diff --
    
    Thanks for doing this. I was noticing this a few days ago.


---

Reply via email to