adamdebreceni commented on code in PR #1479:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1479#discussion_r1050585818
##########
extensions/standard-processors/processors/HashContent.cpp:
##########
@@ -50,18 +52,24 @@ void HashContent::onSchedule(core::ProcessContext *context,
core::ProcessSession
std::string value;
attrKey_ = (context->getProperty(HashAttribute.getName(), value)) ? value :
"Checksum";
- algoName_ = (context->getProperty(HashAlgorithm.getName(), value)) ? value :
"SHA256";
if (context->getProperty(FailOnEmpty.getName(), value)) {
failOnEmpty_ = utils::StringUtils::toBool(value).value_or(false);
} else {
failOnEmpty_ = false;
}
- std::transform(algoName_.begin(), algoName_.end(), algoName_.begin(),
::toupper);
-
- // Erase '-' to make sha-256 and sha-1 work, too
- algoName_.erase(std::remove(algoName_.begin(), algoName_.end(), '-'),
algoName_.end());
+ {
+ auto algo_name = (context->getProperty(HashAlgorithm.getName(), value)) ?
value : "SHA256";
+ std::transform(algo_name.begin(), algo_name.end(), algo_name.begin(),
::toupper);
Review Comment:
not necessary but, should we touch-up the `onSchedule`? I don't think
repeating the default values is necessary if they are already added to the
property definition, we could use `StringUtils::toLower`, the `'-'`-removal
could be achieved by `StringUtils::replaceAll`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]