arpadboda commented on a change in pull request #797:
URL: https://github.com/apache/nifi-minifi-cpp/pull/797#discussion_r445648023
##########
File path: libminifi/include/core/ConfigurableComponent.h
##########
@@ -215,18 +215,23 @@ 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 {
- logger_->log_warn("Component %s property name %s, empty value", name,
item.getName());
- return false;
- }
+ 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::internal::RequiredPropertyMissingException("Required
property is empty: " + item.getName());
Review comment:
I think the it just adds a secondary safety net, processors are already
prepared to handle configuration errors (and throwing exceptions in
onSchedule), so I don't mind this change.
----------------------------------------------------------------
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]