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 76a23d921f NIFI-13545 Improve BootstrapListener getClusterStatus to
handle factory being null
76a23d921f is described below
commit 76a23d921f40068381faf54223fc0289d0181114
Author: Bryan Bende <[email protected]>
AuthorDate: Fri Jul 12 15:50:40 2024 -0400
NIFI-13545 Improve BootstrapListener getClusterStatus to handle factory
being null
Signed-off-by: Pierre Villard <[email protected]>
This closes #9078.
---
.../src/main/java/org/apache/nifi/BootstrapListener.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java
b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java
index 9b7705791b..55a5207d6d 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java
@@ -16,6 +16,8 @@
*/
package org.apache.nifi;
+import org.apache.nifi.cluster.ClusterDetailsFactory;
+import org.apache.nifi.cluster.ConnectionState;
import org.apache.nifi.controller.DecommissionTask;
import org.apache.nifi.controller.status.history.StatusHistoryDump;
import org.apache.nifi.diagnostics.DiagnosticsDump;
@@ -299,7 +301,13 @@ public class BootstrapListener {
}
private String getClusterStatus() {
- return
nifi.getServer().getClusterDetailsFactory().getConnectionState().name();
+ final ClusterDetailsFactory clusterDetailsFactory =
nifi.getServer().getClusterDetailsFactory();
+ if (clusterDetailsFactory == null) {
+ return ConnectionState.UNKNOWN.name();
+ }
+
+ final ConnectionState connectionState =
clusterDetailsFactory.getConnectionState();
+ return connectionState == null ? ConnectionState.UNKNOWN.name() :
connectionState.name();
}
private void decommission() throws InterruptedException {