fgerlits commented on a change in pull request #1040:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r620140801



##########
File path: extensions/sftp/processors/SFTPProcessorBase.cpp
##########
@@ -180,7 +180,7 @@ void 
SFTPProcessorBase::parseCommonPropertiesOnSchedule(const std::shared_ptr<co
   if (!context->getProperty(SendKeepaliveOnTimeout.getName(), value)) {
     logger_->log_error("Send Keep Alive On Timeout attribute is missing or 
invalid");
   } else {
-    utils::StringUtils::StringToBool(value, use_keepalive_on_timeout_);
+    use_keepalive_on_timeout_ = 
utils::StringUtils::toBool(value).value_or(false);

Review comment:
       the `SendKeepaliveOnTimeout` property defaults to true, so this should 
probably be `value_or(true)`

##########
File path: extensions/mqtt/processors/PublishMQTT.cpp
##########
@@ -64,7 +64,14 @@ void PublishMQTT::onSchedule(const 
std::shared_ptr<core::ProcessContext> &contex
     logger_->log_debug("PublishMQTT: max flow segment size [%" PRIu64 "]", 
max_seg_size_);
   }
   value = "";
-  if (context->getProperty(Retain.getName(), value) && !value.empty() && 
org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, retain_)) {
+
+  const auto retain_parsed = [&] () -> utils::optional<bool> {
+    std::string property_value;
+    if (!context->getProperty(CleanSession.getName(), value)) return 
utils::nullopt;

Review comment:
       here too, `value` should be `property_value`

##########
File path: extensions/mqtt/processors/AbstractMQTTProcessor.cpp
##########
@@ -85,10 +86,17 @@ void AbstractMQTTProcessor::onSchedule(const 
std::shared_ptr<core::ProcessContex
     logger_->log_debug("AbstractMQTTProcessor: PassWord [%s]", passWord_);
   }
   value = "";
-  if (context->getProperty(CleanSession.getName(), value) && !value.empty() &&
-      org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, 
cleanSession_)) {
+
+  const auto cleanSession_parsed = [&] () -> utils::optional<bool> {
+    std::string property_value;
+    if (!context->getProperty(CleanSession.getName(), value)) return 
utils::nullopt;

Review comment:
       typo: `value` should be `property_value`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to