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



##########
File path: libminifi/include/core/ConfigurableComponent.h
##########
@@ -216,16 +216,20 @@ bool ConfigurableComponent::getProperty(const std::string 
name, T &value) const{
 
    auto &&it = properties_.find(name);
    if (it != properties_.end()) {
-     Property item = it->second;
-     value = static_cast<T>(item.getValue());
-     if (item.getValue().getValue() != nullptr){
-       logger_->log_debug("Component %s property name %s value %s", name, 
item.getName(), item.getValue().to_string());
-       return true;
-     }
-     else{
+     const Property& item = it->second;
+     if (item.getValue().getValue() == nullptr) {
+       // empty value
+       if (item.getRequired()) {
+         logger_->log_debug("Component %s required property %s is empty", 
name, item.getName());
+         throw utils::RequiredPropertyMissingException("Required property is 
empty: " + item.getName());

Review comment:
       definitely, if I create a processor and mark a property required and it 
is not there, it is the fault of the processor scheduler and I should not 
handle its absence (should not catch the exception but let it up to the 
scheduler), on the other hand if I have an optional property and it is not 
there, tough luck but I'll have to manage its absence




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


Reply via email to