[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r615653769 ## File path: extensions/standard-processors/processors/HashContent.cpp ## @@ -84,6 +82,7 @@ void HashContent::onTrigger(core::ProcessContext *, core::ProcessSession *sessio } if (failOnEmpty_ && flowFile->getSize() == 0) { +logger_->log_trace("Failure as flow file is empty"); Review comment: Just change this to at least log_debug. -- 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: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r607787916 ## File path: libminifi/src/c2/ControllerSocketProtocol.cpp ## @@ -51,18 +49,13 @@ void ControllerSocketProtocol::initialize(core::controller::ControllerServicePro } if (nullptr == secure_context) { std::string secureStr; -bool is_secure = false; -if (configuration->get(Configure::nifi_remote_input_secure, secureStr) && org::apache::nifi::minifi::utils::StringUtils::StringToBool(secureStr, is_secure)) { +if (configuration->get(Configure::nifi_remote_input_secure, secureStr) && org::apache::nifi::minifi::utils::StringUtils::toBool(secureStr).value_or(false)) { secure_context = std::make_shared("ControllerSocketProtocolSSL", configuration); secure_context->onEnable(); } } - std::string value; - - if (configuration_->get("controller.socket.local.any.interface", limitStr)) { -utils::StringUtils::StringToBool(limitStr, anyInterface); - } + const bool anyInterface =(configuration_->get("controller.socket.local.any.interface", limitStr) && utils::StringUtils::toBool(limitStr).value_or(false)); Review comment: That also decreases the chance of depression as it eliminates a sad smile. ![image](https://user-images.githubusercontent.com/64011968/113708345-64ed1880-96e1-11eb-8a93-64acf82800cb.png) -- 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: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r607787916 ## File path: libminifi/src/c2/ControllerSocketProtocol.cpp ## @@ -51,18 +49,13 @@ void ControllerSocketProtocol::initialize(core::controller::ControllerServicePro } if (nullptr == secure_context) { std::string secureStr; -bool is_secure = false; -if (configuration->get(Configure::nifi_remote_input_secure, secureStr) && org::apache::nifi::minifi::utils::StringUtils::StringToBool(secureStr, is_secure)) { +if (configuration->get(Configure::nifi_remote_input_secure, secureStr) && org::apache::nifi::minifi::utils::StringUtils::toBool(secureStr).value_or(false)) { secure_context = std::make_shared("ControllerSocketProtocolSSL", configuration); secure_context->onEnable(); } } - std::string value; - - if (configuration_->get("controller.socket.local.any.interface", limitStr)) { -utils::StringUtils::StringToBool(limitStr, anyInterface); - } + const bool anyInterface =(configuration_->get("controller.socket.local.any.interface", limitStr) && utils::StringUtils::toBool(limitStr).value_or(false)); Review comment: That also decreases the chance of depression as it eliminates a sad smile. -- 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: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r607783909 ## File path: extensions/standard-processors/processors/HashContent.cpp ## @@ -84,6 +82,7 @@ void HashContent::onTrigger(core::ProcessContext *, core::ProcessSession *sessio } if (failOnEmpty_ && flowFile->getSize() == 0) { +logger_->log_trace("Failure as flow file is empty"); Review comment: Minor, but trace level logging seems misused here, most things loggged in this class seem clearly useful for debugging. -- 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: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r607779530 ## File path: extensions/standard-processors/processors/GetTCP.cpp ## @@ -130,7 +130,7 @@ void GetTCP::onSchedule(const std::shared_ptr , co } if (context->getProperty(StayConnected.getName(), value)) { -utils::StringUtils::StringToBool(value, stay_connected_); +stay_connected_ = utils::StringUtils::toBool(value).value_or(false); Review comment: I think that is not the right conclusion. As Feri said, you should move the default value assignment right before this check and make the "default" argument of `value_or` true. This should be equivalent but a bit less readable: ```c++ stay_connected_ = (!context->getProperty(StayConnected.getName(), value)) || utils::StringUtils::toBool(value).value_or(true); ``` -- 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: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1040: MINIFICPP-1329- Fix implementation and usages of string to bool
hunyadi-dev commented on a change in pull request #1040: URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r607752496 ## File path: extensions/mqtt/processors/AbstractMQTTProcessor.cpp ## @@ -146,7 +148,7 @@ void AbstractMQTTProcessor::onSchedule(const std::shared_ptr (this), connectionLost, msgReceived, msgDelivered); Review comment: What was the linter error? -- 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: us...@infra.apache.org