balazsgerner commented on code in PR #8295:
URL: https://github.com/apache/nifi/pull/8295#discussion_r1467525114
##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java:
##########
@@ -517,331 +526,328 @@ public void onTrigger(final ProcessContext context,
final ProcessSession session
/*
* Then
*/
- try {
- final FlowFile flowFileCopy = flowFile;
- session.read(flowFile, new InputStreamCallback() {
- @Override
- public void process(final InputStream in) throws IOException {
- final ObjectMetadata objectMetadata = new ObjectMetadata();
- objectMetadata.setContentLength(ff.getSize());
-
- final String contentType =
context.getProperty(CONTENT_TYPE)
- .evaluateAttributeExpressions(ff).getValue();
- if (contentType != null) {
- objectMetadata.setContentType(contentType);
- attributes.put(S3_CONTENT_TYPE, contentType);
- }
+ final FlowFile flowFileCopy = session.clone(flowFile);
Review Comment:
Cloning the flowfile was only used as a workaround for an issue which
occurred during unit test execution.
If the inputstream of the flowfile was open, the
`session.putAllAttributes(flowFile, attributes)` call threw exception, because
the inputstream was already in use. I agree that the cloning is not needed,
after some examination, I managed to eliminate the need for that.
See 73f49bbc
--
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]