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

exceptionfactory 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 ea8e2f7229 NIFI-15395 Clearing Bulletins with no component returns a 
200 (#10700)
ea8e2f7229 is described below

commit ea8e2f7229345a3a9ffa99dc1beced56f8ea97f0
Author: Pierre Villard <[email protected]>
AuthorDate: Tue Dec 30 15:31:53 2025 +0100

    NIFI-15395 Clearing Bulletins with no component returns a 200 (#10700)
    
    - Changed throwing an IllegalArgumentException to returning an entity with 
0 cleared bulletins for null or empty components
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../java/org/apache/nifi/web/StandardNiFiServiceFacade.java   | 11 +++++++----
 .../org/apache/nifi/web/StandardNiFiServiceFacadeTest.java    |  8 +++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
index 6cb0c7dc83..c469f10024 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
@@ -7461,15 +7461,18 @@ public class StandardNiFiServiceFacade implements 
NiFiServiceFacade {
         if (fromTimestamp == null) {
             throw new IllegalArgumentException("From timestamp must be 
specified");
         }
+
+        // Create the response entity
+        final ClearBulletinsForGroupResultsEntity entity = new 
ClearBulletinsForGroupResultsEntity();
+
+        // If no components are specified, return success with 0 bulletins 
cleared
         if (componentIds == null || componentIds.isEmpty()) {
-            throw new IllegalArgumentException("Component IDs must be 
specified");
+            entity.setBulletinsCleared(0);
+            return entity;
         }
 
         // Clear bulletins for all components specified
         final int totalBulletinsCleared = 
bulletinRepository.clearBulletinsForComponents(componentIds, fromTimestamp);
-
-        // Create the response entity
-        final ClearBulletinsForGroupResultsEntity entity = new 
ClearBulletinsForGroupResultsEntity();
         entity.setBulletinsCleared(totalBulletinsCleared);
 
         return entity;
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java
 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java
index f068301db4..943f913df2 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/StandardNiFiServiceFacadeTest.java
@@ -1660,8 +1660,10 @@ public class StandardNiFiServiceFacadeTest {
         MockTestBulletinRepository bulletinRepository = new 
MockTestBulletinRepository();
         serviceFacade.setBulletinRepository(bulletinRepository);
 
-        assertThrows(IllegalArgumentException.class, () -> {
-            serviceFacade.clearBulletinsForComponents(processGroupId, 
fromTimestamp, emptyComponentIds);
-        });
+        ClearBulletinsForGroupResultsEntity result = 
serviceFacade.clearBulletinsForComponents(
+                processGroupId, fromTimestamp, emptyComponentIds);
+
+        assertNotNull(result);
+        assertEquals(0, result.getBulletinsCleared());
     }
 }

Reply via email to