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 e74991e  NIFI-9727 - IndexOutOfBoundsException in 
CorrelationAttributePartitioner
e74991e is described below

commit e74991e7059adfd5528e615131590a2e98c2b836
Author: Paul Grey <[email protected]>
AuthorDate: Fri Feb 25 10:06:59 2022 -0500

    NIFI-9727 - IndexOutOfBoundsException in CorrelationAttributePartitioner
    
    This closes #5804
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../queue/clustered/partition/CorrelationAttributePartitioner.java  | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
index beadaae..54f01e6 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
@@ -70,10 +70,6 @@ public class CorrelationAttributePartitioner implements 
FlowFilePartitioner {
 
     private int findIndex(final long hash, final int partitions) {
         final Random random = new Random(hash);
-        int index = random.nextInt();
-        while (index < 0 && index >= partitions) {
-            index = random.nextInt();
-        }
-        return index;
+        return random.nextInt(partitions);
     }
 }

Reply via email to