NIFI-6017 - ArrayIndexOutOfBounds Load Balancer CorrelationAttributePartitioner
authorDorian Bugeja <dorian.bugeja@cerberus.io>
Tue, 12 Feb 2019 21:22:43 +0000 (22:22 +0100)
committerMark Payne <markap14@hotmail.com>
Wed, 13 Feb 2019 13:53:19 +0000 (08:53 -0500)
Signed-off-by: Mark Payne <markap14@hotmail.com>
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java

index 12560d4..7529098 100644 (file)
@@ -36,7 +36,7 @@ public class CorrelationAttributePartitioner implements FlowFilePartitioner {
         // implementation, but it's not clear at this point.
         final int index;
         if (partitions.length < 3) {
-            index = hash % partitions.length;
+            index = Math.floorMod(hash, partitions.length);
         } else {
             index = Hashing.consistentHash(hash, partitions.length);
         }