exceptionfactory commented on code in PR #10405:
URL: https://github.com/apache/nifi/pull/10405#discussion_r2487880127
##########
nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java:
##########
@@ -327,6 +350,101 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
}
}
+ private boolean handleCompletionPreCommit(final FileTransfer transfer,
Review Comment:
This method is very complex with deep nesting and a number of return
statements at various levels. The catch-all for `RuntimeException` also seems
problematic. I recommend refactoring to a single return statement, and looking
for some opportunities to break out some elements to separate methods.
##########
nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java:
##########
@@ -403,4 +521,47 @@ public long getLastUsed() {
return this.lastUsed;
}
}
+
+
+ /**
+ * Helper to route a FlowFile with provided relationship, set failure
reason attribute, optionally penalize,
+ * record provenance route, perform cleanup of the FileTransfer, and
return true to indicate routing occurred.
+ */
+ private boolean routeWithCleanup(final ProcessSession session,
+ final FlowFile flowFile,
+ final Map<String, String> baseAttributes,
+ final Relationship relationship,
+ final boolean penalize,
+ final FileTransfer transfer,
+ final boolean closeConnection,
+ final
BlockingQueue<FileTransferIdleWrapper> transferQueue,
+ final String host,
+ final int port) {
+ return routeWithCleanupReason(session, flowFile, baseAttributes,
relationship, penalize, transfer, closeConnection, transferQueue, host, port,
relationship.getName());
+ }
Review Comment:
This method seems unnecessary since the signature is so similar to the other
method, recommend removing.
--
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]