Skip to content

MINIFICPP-465 Implemented regex validation of properties#350

Closed
ai-christianson wants to merge 1 commit intoapache:masterfrom
ai-christianson:MINIFICPP-465
Closed

MINIFICPP-465 Implemented regex validation of properties#350
ai-christianson wants to merge 1 commit intoapache:masterfrom
ai-christianson:MINIFICPP-465

Conversation

@ai-christianson
Copy link
Contributor

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with MINIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

@ai-christianson ai-christianson changed the title Minificpp 465 mplemented regex validation of propertiesMINIFICPP-465 Implemented regex validation of properties May 31, 2018
@ai-christianson ai-christianson changed the title mplemented regex validation of propertiesMINIFICPP-465 Implemented regex validation of properties MINIFICPP-465 Implemented regex validation of properties May 31, 2018
#include <memory>
#include <vector>
#include <set>
#include <regex>
Copy link
Contributor

@phrocker phrocker May 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all versions of the compiler support regex. You'll need to handle the C and C++ paths. I think GetFile is an example.

}
logging::LOG_ERROR(logger_) << err_msg;
if (prop_pair.second.getValue().empty()) {
std::string reason("required property '");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a string stream here?

void YamlConfiguration::raiseComponentError(const std::string &component_name,
const std::string &yaml_section,
const std::string &reason) const {
std::string err_msg = "Unable to parse configuration file for component named '";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A string stream or the like may make this more readable.

REQUIRE(!rootFlowConfig->findProcessor("XYZ")->getUUIDStr().empty());
}

class DummyComponent : public core::ConfigurableComponent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's leave override out of libminifi/ and keep it in extensions due to compiler versioning.

if (!prop_regex_str.empty()) {
std::regex prop_regex(prop_regex_str);
if (!std::regex_match(prop_pair.second.getValue(), prop_regex)) {
std::string reason("property '");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment RE the readability. Stringstream may help with making this easier to read.

@ai-christianson ai-christianson force-pushed the MINIFICPP-465 branch 2 times, most recently from e354d27 to 150e112 Compare June 1, 2018 16:24
@ai-christianson
Copy link
Contributor Author

Fixed.

@ai-christianson
Copy link
Contributor Author

Build fails are timeouts after 52/53 passed unit tests; suspect possible travis environmental issue.

@ai-christianson
Copy link
Contributor Author

Rebased & all issues addressed. Ready for review.

@asfgit asfgit closed this in d5e5a4f Jul 31, 2018
nghiaxlee pushed a commit to nghiaxlee/nifi-minifi-cpp that referenced this pull request Jul 8, 2019
This closes apache#350.

Signed-off-by: Marc Parisi <phrocker@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants