dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1505087231


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##########
@@ -112,9 +153,13 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
             return;
         }
 
-        final boolean encode = 
context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
-        final String encoding = context.getProperty(ENCODING).getValue();
-        final StreamCallback callback = getStreamCallback(encode, encoding);
+        final boolean encode = 
context.getProperty(MODE).getValue().equals(EncodingMode.ENCODE.getValue());
+        final EncodingType encoding = 
EncodingType.valueOf(context.getProperty(ENCODING).getValue());
+        final boolean singleLineOutput = 
context.getProperty(LINE_OUTPUT_MODE).getValue().equals(LineOutputMode.SINGLE_LINE.getValue());
+        final int lineLength = 
context.getProperty(ENCODED_LINE_LENGTH).evaluateAttributeExpressions(flowFile).asInteger();
+        final String lineSeparator = 
context.getProperty(ENCODED_LINE_SEPARATOR).evaluateAttributeExpressions(flowFile).getValue();
+
+        final StreamCallback callback = getStreamCallback(encode, encoding, 
(singleLineOutput ? -1 : lineLength), lineSeparator);

Review Comment:
   Sorry to drive you nuts on this but I thought the code reads better with the 
following changes (I did not realize this before).
   ```suggestion
           final boolean singleLineOutput = 
context.getProperty(LINE_OUTPUT_MODE).getValue().equals(LineOutputMode.SINGLE_LINE.getValue());
           final int lineLength = singleLineOutput ? -1 : 
context.getProperty(ENCODED_LINE_LENGTH).evaluateAttributeExpressions(flowFile).asInteger();
           final String lineSeparator = 
context.getProperty(ENCODED_LINE_SEPARATOR).evaluateAttributeExpressions(flowFile).getValue();
           final StreamCallback callback = getStreamCallback(encode, encoding, 
lineLength, lineSeparator);
   ```



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