You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/05/13 13:45:40 UTC

[GitHub] [nifi] joewitt commented on a diff in pull request #6030: NIFI-9990 Improve FTP 550 file unavailable handling

joewitt commented on code in PR #6030:
URL: https://github.com/apache/nifi/pull/6030#discussion_r872417635


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java:
##########
@@ -321,13 +325,22 @@ public FlowFile getRemoteFile(final String remoteFileName, final FlowFile origFl
         FlowFile resultFlowFile;
         try (InputStream in = client.retrieveFileStream(remoteFileName)) {
             if (in == null) {
-                final String response = client.getReplyString();
-                // FTPClient doesn't throw exception if file not found.
-                // Instead, response string will contain: "550 Can't open <absolute_path>: No such file or directory"
-                if (response != null && response.trim().endsWith("No such file or directory")) {
-                    throw new FileNotFoundException(response);
+                final int replyCode = client.getReplyCode();
+
+                final String reply = client.getReplyString();
+                if (reply == null) {

Review Comment:
   I did not review the ftp client code but I'd imagine the reply code is extracted by it from the reply string.  Here we pull the code, then the string, then check if the string is null.  I suspect we want code extraction AFTER the null and/or empty check.



-- 
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-unsubscribe@nifi.apache.org

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