dan-s1 commented on code in PR #8038:
URL: https://github.com/apache/nifi/pull/8038#discussion_r1439064848
##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##########
@@ -112,11 +194,27 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
return;
}
- final boolean encode =
context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
+ // Decide if we should fail on 0-length content
+ final Boolean failOnZeroLengthContent =
context.getProperty(FAIL_ON_ZERO_LENGTH_CONTENT).asBoolean();
+
+ final boolean encode =
context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE.getValue());
final String encoding = context.getProperty(ENCODING).getValue();
- final StreamCallback callback = getStreamCallback(encode, encoding);
+
+ final Boolean singleLineOutput =
context.getProperty(SINGLE_LINE_OUTPUT).asBoolean();
+ final Integer 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,
Boolean.TRUE.equals(singleLineOutput) ? -1 : lineLength, lineSeparator);
Review Comment:
I am not sure its a major saving but changing this to an int and in the
other places I suggested would reduce the autoboxing conversion to only one
time in this statement.
```suggestion
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]