szaszm commented on a change in pull request #1252:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1252#discussion_r814636591
##########
File path: libminifi/include/processors/ProcessorUtils.h
##########
@@ -47,10 +45,10 @@ class ProcessorUtils {
if (ptr == nullptr) {
ptr =
core::ClassLoader::getDefaultClassLoader().instantiate("ExecuteJavaClass",
uuid);
if (ptr != nullptr) {
- std::shared_ptr<core::Processor> processor =
std::dynamic_pointer_cast<core::Processor>(ptr);
- if (processor == nullptr) {
+ if (dynamic_cast<core::Processor*>(ptr.get()) == nullptr) {
throw std::runtime_error("Invalid return from the classloader");
}
+ auto processor =
std::unique_ptr<core::Processor>{dynamic_cast<core::Processor*>(ptr.release())};
Review comment:
The usage on line 60 would not be affected by moving from it here,
because there is a return statement on line 56. This function is convoluted.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]