adamdebreceni commented on a change in pull request #797:
URL: https://github.com/apache/nifi-minifi-cpp/pull/797#discussion_r443531079



##########
File path: libminifi/include/core/PropertyValue.h
##########
@@ -202,14 +196,50 @@ class PropertyValue : public state::response::ValueNode {
   auto operator=(const std::string &ref) -> typename std::enable_if<
   std::is_same<T, DataSizeValue >::value ||
   std::is_same<T, TimePeriodValue >::value, PropertyValue&>::type {
-    value_ = std::make_shared<T>(ref);
-    type_id = value_->getTypeIndex();
-    return *this;
+    validator_.clearValidationResult();
+    return WithAssignmentGuard(ref, [&] () -> PropertyValue& {
+      value_ = std::make_shared<T>(ref);
+      type_id = value_->getTypeIndex();
+      return *this;
+    });
+  }
+
+ private:
+  template<typename T>
+  T convertImpl(const char* const type_name) const {
+    if (!isValueUsable()) {
+      throw utils::InvalidValueException("Cannot convert invalid value");
+    }
+    T res;
+    if (value_->convertValue(res)) {
+      return res;
+    }
+    throw utils::ConversionException(std::string("Invalid conversion to ") + 
type_name + " for " + value_->getStringValue());
+  }

Review comment:
       if we can live with `uint64_t` being printed as `unsigned long` on some 
platforms and `unsigned __int64` on others (windows) I can make the change, but 
then the error message would be invalid, as we do not want to convert to 
`unsigned long` we want to convert to `uint64_t` that the two coincide is a 
platform dependent implementation detail




----------------------------------------------------------------
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