am-c-p-p commented on a change in pull request #600: MINIFICPP-936: Add
canonical name check back into processor utils
URL: https://github.com/apache/nifi-minifi-cpp/pull/600#discussion_r297902862
##########
File path: libminifi/include/processors/ProcessorUtils.h
##########
@@ -22,20 +22,31 @@ class ProcessorUtils {
static inline std::shared_ptr<core::Processor> createProcessor(const
std::string &class_short_name, const std::string &canonicalName,
utils::Identifier &uuid,
const
std::shared_ptr<minifi::io::StreamFactory> &stream_factory) {
auto ptr =
core::ClassLoader::getDefaultClassLoader().instantiate(class_short_name, uuid);
+ // fallback to the canonical name if the short name does not work, then
attempt JNI bindings if they exist
if (ptr == nullptr) {
- ptr =
core::ClassLoader::getDefaultClassLoader().instantiate("ExecuteJavaClass",
uuid);
- if (ptr != nullptr) {
- std::shared_ptr<core::Processor> processor =
std::static_pointer_cast<core::Processor>(ptr);
- processor->initialize();
- processor->setProperty("NiFi Processor", canonicalName);
- processor->setStreamFactory(stream_factory);
- return processor;
+ ptr =
core::ClassLoader::getDefaultClassLoader().instantiate(canonicalName, uuid);
+ if (ptr == nullptr) {
+ ptr =
core::ClassLoader::getDefaultClassLoader().instantiate("ExecuteJavaClass",
uuid);
+ if (ptr != nullptr) {
Review comment:
Maybe check here `if (ptr == nullptr) return nullptr;`, since this check on
line 42 is only for checking `ptr` from line 29.
----------------------------------------------------------------
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]
With regards,
Apache Git Services