From 8af0a46549501826e719c6baecf5755b20a811e3 Mon Sep 17 00:00:00 2001 From: Nissim Shiman Date: Tue, 28 Apr 2026 14:01:37 +0000 Subject: [PATCH] NIFI-15779 Allow error message to appear on controller service ui when service is enabling but not valid --- .../ControllerServiceNotValidException.java | 26 ------------------- .../StandardControllerServiceProvider.java | 18 +++++++------ 2 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/ControllerServiceNotValidException.java diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/ControllerServiceNotValidException.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/ControllerServiceNotValidException.java deleted file mode 100644 index 5ac890604eb4..000000000000 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/ControllerServiceNotValidException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.controller.service; - -/** - * Thrown when attempting to enable a Controller Service that is not valid - */ -public class ControllerServiceNotValidException extends RuntimeException { - public ControllerServiceNotValidException(final String message) { - super(message); - } -} diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java index b30726958421..fa83ee0ee1dc 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java @@ -36,6 +36,7 @@ import org.apache.nifi.registry.flow.FlowRegistryClientNode; import org.apache.nifi.registry.flow.mapping.VersionedComponentStateLookup; import org.apache.nifi.reporting.BulletinRepository; +import org.apache.nifi.reporting.ComponentType; import org.apache.nifi.reporting.Severity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -281,13 +282,12 @@ public void enableControllerServices(final Collection ser future.get(30, TimeUnit.SECONDS); logger.debug("{} enabled with state [{}]", controllerServiceNode, controllerServiceNode.getState()); - } catch (final ControllerServiceNotValidException e) { - logger.warn("Failed to enable service {} because it is not currently valid", controllerServiceNode); } catch (Exception e) { logger.error("Failed to enable {}", controllerServiceNode, e); if (this.bulletinRepo != null) { - this.bulletinRepo.addBulletin(BulletinFactory.createBulletin("Controller Service", - Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); + this.bulletinRepo.addBulletin(BulletinFactory.createBulletin(controllerServiceNode.getProcessGroupIdentifier(), + controllerServiceNode.getIdentifier(), ComponentType.CONTROLLER_SERVICE, controllerServiceNode.getName(), + "Controller Service", Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); } } } @@ -369,8 +369,9 @@ private void enableControllerServices(final Collection se } if (this.bulletinRepo != null) { - this.bulletinRepo.addBulletin(BulletinFactory.createBulletin("Controller Service", - Severity.ERROR.name(), "Could not enable " + controllerServiceNode + " due to " + e)); + this.bulletinRepo.addBulletin(BulletinFactory.createBulletin(controllerServiceNode.getProcessGroupIdentifier(), + controllerServiceNode.getIdentifier(), ComponentType.CONTROLLER_SERVICE, controllerServiceNode.getName(), + "Controller Service", Severity.ERROR.name(), "Could not enable " + controllerServiceNode + " due to " + e)); } break; @@ -379,8 +380,9 @@ private void enableControllerServices(final Collection se } catch (Exception e) { logger.error("Failed to enable {}", controllerServiceNode, e); if (this.bulletinRepo != null) { - this.bulletinRepo.addBulletin(BulletinFactory.createBulletin("Controller Service", - Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); + this.bulletinRepo.addBulletin(BulletinFactory.createBulletin(controllerServiceNode.getProcessGroupIdentifier(), + controllerServiceNode.getIdentifier(), ComponentType.CONTROLLER_SERVICE, controllerServiceNode.getName(), + "Controller Service", Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); } } }