nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phroc...@apache.org
Subject nifi-minifi-cpp git commit: MINIFICPP-630 - Make ExecutionPlan::runNextProcessor safer
Date Thu, 04 Oct 2018 16:37:06 GMT
Repository: nifi-minifi-cpp
Updated Branches:
  refs/heads/master 575e8913f -> 7e802afb7


MINIFICPP-630 - Make ExecutionPlan::runNextProcessor safer

This closes #410.

Signed-off-by: Marc Parisi <phrocker@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/7e802afb
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/7e802afb
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/7e802afb

Branch: refs/heads/master
Commit: 7e802afb740931091924a47e4752e17aabbf3e20
Parents: 575e891
Author: Arpad Boda <aboda@hortonworks.com>
Authored: Thu Oct 4 14:21:13 2018 +0200
Committer: Marc Parisi <phrocker@apache.org>
Committed: Thu Oct 4 12:36:51 2018 -0400

----------------------------------------------------------------------
 libminifi/src/capi/Plan.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7e802afb/libminifi/src/capi/Plan.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/capi/Plan.cpp b/libminifi/src/capi/Plan.cpp
index 595a01a..1502f18 100644
--- a/libminifi/src/capi/Plan.cpp
+++ b/libminifi/src/capi/Plan.cpp
@@ -145,8 +145,11 @@ bool ExecutionPlan::runNextProcessor(std::function<void(const std::shared_ptr<co
   }
 
   location++;
-  std::shared_ptr<core::Processor> processor = processor_queue_.at(location);
-  std::shared_ptr<core::ProcessContext> context = processor_contexts_.at(location);
+  if (location >= processor_queue_.size()) {
+    return false;
+  }
+  std::shared_ptr<core::Processor> processor = processor_queue_[location];
+  std::shared_ptr<core::ProcessContext> context = processor_contexts_[location];
   std::shared_ptr<core::ProcessSessionFactory> factory = std::make_shared<core::ProcessSessionFactory>(context);
   factories_.push_back(factory);
   if (std::find(configured_processors_.begin(), configured_processors_.end(), processor)
== configured_processors_.end()) {
@@ -165,7 +168,7 @@ bool ExecutionPlan::runNextProcessor(std::function<void(const std::shared_ptr<co
   }
   current_session->commit();
   current_flowfile_ = current_session->get();
-  return location + 1 < processor_queue_.size();
+  return true;
 }
 
 std::set<provenance::ProvenanceEventRecord*> ExecutionPlan::getProvenanceRecords()
{


Mime
View raw message