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

FtpSession does not allow list or listNames without a path

    XMLWordPrintable

    Description

    org.springframework.integration.ftp.session.FtpSession requires a path be passed to both the "list" and "listNames" methods. The path must have text.

    The underlying Apache FTP client allows a file listing to be performed without a path (so it is performed in the default folder after logging in to the ftp server). The FTP protocol also does allow a "LIST" command to be performed without an explicit folder path.

    I am currently integrating with two commercial FTP servers that require LIST to be performed without a folder path, but I can't achieve that with the current version of FTPSession.

    I'm happy to make the code enhancement myself and perform a pull request. For reference I would change lines 66 to 75 to be:

        public FTPFile[] list() throws IOException {
            return ftpClient.listFiles();
        }
    
        @Override
        public FTPFile[] list(String path) throws IOException {
            if (StringUtils.hasText(path)) {
                return ftpClient.listFiles(path);
            }
    
            return list();
        }
    
        public String[] listNames() throws IOException {
            return ftpClient.listNames();
        }
    
        @Override
        public String[] listNames(String path) throws IOException {
            if ( StringUtils.hasText(path) ) {
                return ftpClient.listNames(path);
            }
    
            return listNames();
        }
    

      Attachments

        Issue Links

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            chris_samcat Chris Gillespie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.5d
                0.5d
                Remaining:
                Remaining Estimate - 0.5d
                0.5d
                Logged:
                Time Spent - Not Specified
                Not Specified