You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/01/07 03:01:18 UTC

[nifi] branch main updated: NIFI-11031: Fix logic error in GenerateRecord for nullPercentage

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 4f77a17d19 NIFI-11031: Fix logic error in GenerateRecord for nullPercentage
4f77a17d19 is described below

commit 4f77a17d19c3e6ab5f85d0c836dbbca6cc703711
Author: Matthew Burgess <ma...@apache.org>
AuthorDate: Fri Jan 6 17:53:54 2023 -0500

    NIFI-11031: Fix logic error in GenerateRecord for nullPercentage
    
    This closes #6830
    
    Signed-off-by: David Handermann <ex...@apache.org>
---
 .../main/java/org/apache/nifi/processors/standard/GenerateRecord.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java
index 08b7d51b9c..39f441aa5f 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateRecord.java
@@ -296,7 +296,7 @@ public class GenerateRecord extends AbstractProcessor {
     }
 
     private Object generateValueFromRecordField(RecordField recordField, Faker faker, int nullPercentage) {
-        if (recordField.isNullable() && faker.number().numberBetween(0, 100) <= nullPercentage) {
+        if (recordField.isNullable() && faker.number().numberBetween(0, 100) < nullPercentage) {
             return null;
         }
         switch (recordField.getDataType().getFieldType()) {