exceptionfactory commented on code in PR #11012:
URL: https://github.com/apache/nifi/pull/11012#discussion_r3003088020


##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java:
##########
@@ -298,16 +339,25 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
             }
         }
 
+        if (schema == null) {
+            getLogger().error("JSON schema not configured for {}", flowFile);
+            session.getProvenanceReporter().route(flowFile, REL_FAILURE);
+            session.transfer(flowFile, REL_FAILURE);
+            return;
+        }
+
+        final InputFormat inputFormat = 
context.getProperty(INPUT_FORMAT).asAllowableValue(InputFormat.class);
+        if (inputFormat == InputFormat.FLOW_FILE) {
+            validateFlowFile(session, flowFile);
+        } else {
+            validateJsonLines(session, flowFile);
+        }
+    }
+
+    void validateFlowFile(ProcessSession session, FlowFile flowFile) {

Review Comment:
   These should also be marked `final`, which may require a new FlowFile 
variable assignment in the method.
   
   ```suggestion
       void validateFlowFile(final ProcessSession session, final FlowFile 
flowFile) {
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to