Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/85#discussion_r114375962
  
    --- Diff: libminifi/src/core/yaml/YamlConfiguration.cpp ---
    @@ -538,14 +561,62 @@ void YamlConfiguration::parsePropertiesNodeYaml(
           std::string rawValueString = propertyValueNode.as<std::string>();
           if (!processor->setProperty(propertyName, rawValueString)) {
             logger_->log_warn(
    -            "Received property %s with value %s but is not one of the 
properties for %s",
    -            propertyName.c_str(), rawValueString.c_str(),
    -            processor->getName().c_str());
    +            "Received property %s with value %s but it is not one of the 
properties for %s",
    +            propertyName,
    +            rawValueString,
    +            processor->getName());
           }
         }
       }
     }
     
    +std::string YamlConfiguration::getOrGenerateId(
    +    YAML::Node *yamlNode,
    +    std::string idField) {
    +  std::string id;
    +  YAML::Node node = yamlNode->as<YAML::Node>();
    +
    +  if (node[idField]) {
    +    if (YAML::NodeType::Scalar == node[idField].Type()) {
    +      id = node[idField].as<std::string>();
    +    } else {
    +      throw std::invalid_argument(
    +          "getOrGenerateId: idField is expected to reference YAML::Node "
    +              "of YAML::NodeType::Scalar.");
    +    }
    +  } else {
    +    uuid_t uuid;
    +    uuid_generate(uuid);
    +    char uuid_str[37];
    +    uuid_unparse(uuid, uuid_str);
    +    id = uuid_str;
    +    logger_->log_debug("Generating random ID: id => [%s]", id);
    +  }
    +  return id;
    +}
    +
    +void YamlConfiguration::checkRequiredField(
    --- End diff --
    
    Sorry, the double reply was likely confusing. I'm good with the function 
itself. The code that I'm looking at in our third party directory returns a Node
    template <typename Key>
      const Node operator[](const Key& key) const;
    
    The exception I reference is below and throws an InvalidNode if the node is 
invalid some how. Is this also handled?
    `template <typename Key>
    inline const Node Node::operator[](const Key& key) const {
      if (!m_isValid)
        throw InvalidNode();
      EnsureNodeExists();
      detail::node* value = static_cast<const detail::node&>(*m_pNode)
                                .get(detail::to_value(key), m_pMemory);
      if (!value) {
        return Node(ZombieNode);
      }
      return Node(*value, m_pMemory);
    }`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to