Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4046

FtpRemoteFileTemplate exists() command not working as intended.

    XMLWordPrintable

    Details

    • Type: Defect
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 4.2.6
    • Fix Version/s: 4.1.9, 4.3 GA, 4.2.7
    • Component/s: FTP/SFTP Support
    • Labels:
    • Environment:
      Development machine is CentOS 7.
      Tested against Docker container running PureFTPD as well as OpenVMS ftp server implementation.

      Description

      When attempting to use org.springframework.integration.ftp.session.FtpRemoteFileTemplate we are running into issues with how this template determines if a file exists on a remote FTP server.

      It seems that if we try to use the template.send() method with a FileExistsMode.FAIL the method will *ALWAYS* fail as the template thinks all remote files exist. Please see the referenced github repository for a code example of the problem (you will need a FTP server to connect to for testing).

      The "exists" method on the FtpRemoteFileTemplate is using a feature of org.apache.commons.net.ftp.FTPClient that does not work as documented by Apache. This exists method is using a FtpClient.getStatus() call against a remote path to determine if the file exists.

      We have tested the FTP Protocol's "STATUS" command against a couple FTP server implementations. These tests have shown that the STATUS command always returns the same information disregarding the provided path. Attached you will find the related output from these tests.

      We are requesting that the exists() command on FtpRemoteFileTemplate be fixed. Ideally it should not use the getStatus() call to determine file existence. We will also open a related ticket with Apache commons-net regarding their functionality.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            clarkstuth Clark Stuth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: