markap14 commented on a change in pull request #5126:
URL: https://github.com/apache/nifi/pull/5126#discussion_r645742746



##########
File path: 
nifi-nar-bundles/nifi-jolt-record-bundle/nifi-jolt-record-processors/src/main/java/org/apache/nifi/processors/jolt/record/JoltTransformRecord.java
##########
@@ -331,12 +331,16 @@ public void onTrigger(final ProcessContext context, 
ProcessSession session) thro
             } else {
 
                 final JoltTransform transform = getTransform(context, 
original);
-                final Record transformedFirstRecord = transform(firstRecord, 
transform);
+                final List<Record >transformedFirstRecords = 
transform(firstRecord, transform);
 
-                if (transformedFirstRecord == null) {
+                if (transformedFirstRecords == null) {
                     throw new ProcessException("Error transforming the first 
record");
                 }
 
+                final Record transformedFirstRecord = 
transformedFirstRecords.get(0);

Review comment:
       Is this guaranteed to contain records? Seems like this would make it 
easy to introduce a bug here. Generally it's a bad practice IMO to be adding 
`null` objects to a List - or to return `null` for a Collection. Would 
recommend always returning a (possibly empty) List and not adding the Record to 
the List at all if it's null. And then here just checking if 
`transformedFirstRecords.isEmpty()`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to