You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2021/08/02 18:30:52 UTC

[nifi] branch main updated: NIFI-8965: Fix duplicate code and typo in StandardFlowManager

This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 1ea47d6  NIFI-8965: Fix duplicate code and typo in StandardFlowManager
1ea47d6 is described below

commit 1ea47d6888c011275d71a0471b2cf5579313fa4f
Author: Mohammed Nadeem <na...@gmail.com>
AuthorDate: Sat Jul 31 13:13:53 2021 +0530

    NIFI-8965: Fix duplicate code and typo in StandardFlowManager
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #5265.
---
 .../org/apache/nifi/controller/flow/StandardFlowManager.java | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
index 0e8ba73..01b4871 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardFlowManager.java
@@ -211,7 +211,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
         final ProcessGroup rootGroup = getRootGroup();
         Port port = rootGroup.findOutputPort(id);
         if (port != null) {
-            throw new IllegalStateException("An Input Port already exists with ID " + id);
+            throw new IllegalStateException("An Output Port already exists with ID " + id);
         }
         port = rootGroup.findInputPort(id);
         if (port != null) {
@@ -317,7 +317,6 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
             .identifier(id)
             .type(type)
             .bundleCoordinate(coordinate)
-            .extensionManager(extensionManager)
             .controllerServiceProvider(flowController.getControllerServiceProvider())
             .processScheduler(processScheduler)
             .nodeTypeProvider(flowController)
@@ -344,7 +343,7 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
                 throw new ComponentLifeCycleException("Failed to invoke @OnAdded methods of " + procNode.getProcessor(), e);
             }
 
-            if (firstTimeAdded && flowController.isInitialized()) {
+            if (flowController.isInitialized()) {
                 try (final NarCloseable nc = NarCloseable.withComponentNarLoader(extensionManager, procNode.getProcessor().getClass(), procNode.getProcessor().getIdentifier())) {
                     ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, procNode.getProcessor());
                 }
@@ -360,9 +359,9 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
 
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls,
                                                  final boolean firstTimeAdded, final boolean register) {
-        if (type == null || id == null || bundleCoordinate == null) {
-            throw new NullPointerException();
-        }
+        requireNonNull(type);
+        requireNonNull(id);
+        requireNonNull(bundleCoordinate);
 
         // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
         final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
@@ -372,7 +371,6 @@ public class StandardFlowManager extends AbstractFlowManager implements FlowMana
             .identifier(id)
             .type(type)
             .bundleCoordinate(bundleCoordinate)
-            .extensionManager(flowController.getExtensionManager())
             .controllerServiceProvider(flowController.getControllerServiceProvider())
             .processScheduler(processScheduler)
             .nodeTypeProvider(flowController)