adam-markovics commented on a change in pull request #1252:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1252#discussion_r816467499
##########
File path: libminifi/src/core/yaml/YamlConfiguration.cpp
##########
@@ -697,10 +689,21 @@ PropertyValue
YamlConfiguration::getValidatedProcessorPropertyForDefaultTypeInfo
if (defaultType == typeid(int64_t)) {
coercedValue = propertyValueNode.as<int64_t>();
} else if (defaultType == typeid(uint64_t)) {
- try {
- coercedValue = propertyValueNode.as<uint64_t>();
- } catch (...) {
- coercedValue = propertyValueNode.as<std::string>();
+ const auto uValue = propertyValueNode.as<uint64_t>(0);
+
+ // parsing uint64_t may have failed
+ if (uValue == 0) {
+ const auto sValue = propertyValueNode.as<std::string>();
+
+ // parsing uint64_t did not fail, the node was a 0
+ if (sValue == "0") {
+ coercedValue = uValue;
+ } else {
+ // parsing uint64_t really failed
+ coercedValue = sValue;
+ }
+ } else {
+ coercedValue = uValue;
Review comment:
This is a good alternative, thanks.
--
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]