tpalfy commented on code in PR #8686:
URL: https://github.com/apache/nifi/pull/8686#discussion_r1576346414


##########
nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/WriteJsonResult.java:
##########
@@ -165,19 +177,44 @@ public WriteResult writeRawRecord(final Record record) 
throws IOException {
         return WriteResult.of(incrementRecordCount(), attributes);
     }
 
+    private boolean isUseSerializeForm(final Record record, final RecordSchema 
writeSchema) {
+        final Optional<SerializedForm> serializedForm = 
record.getSerializedForm();
+        if (!serializedForm.isPresent()) {
+            return false;
+        }
+
+        final SerializedForm form = serializedForm.get();
+        if (!form.getMimeType().equals(getMimeType()) || 
!record.getSchema().equals(writeSchema)) {
+            return false;
+        }
+
+        final Object serialized = form.getSerialized();
+        String serializedString;
+
+        if (!(serialized instanceof String)) {
+            return false;
+        } else {
+            serializedString = (String) serialized;
+        }
+

Review Comment:
   I feel it's risky to remove the check for pretty formatting form the 
backport. A later backport of https://issues.apache.org/jira/browse/NIFI-12480 
is not straightforward, it's very possible this wouldn't be added back. I see 
no drawback in leaving it here.
   ```suggestion
           final boolean serializedPretty = serializedString.contains("\n");
           if (serializedPretty != this.prettyPrint) {
               return false;
           }
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to