Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-609

DefaultUnixFTPFileEntryParserFactory Issue (leading spaces removal configuration)

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4, 3.5
    • 3.6
    • FTP
    • None

    Description

      I have an issue when calling listFiles() method on a FTP server.
      The FTPFileEntry parser fail to parse the entry by adding a non existing leading space in the filename.

      In the FTP library, a boolean field is existing to remove the leading spaces and needs to be set to true (in my case).

      The issue is in the file DefaultUnixFTPFileEntryParserFactory.java (L124-L128) :

      if (parser == null) { // Now try for aliases
                  String ukey = key.toUpperCase(java.util.Locale.ENGLISH);
                  if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0)
                  { // FTPClientConfig.SYST_UNIX = "UNIX"
                      parser = new UnixFTPEntryParser(config, false);
                  }
                  else if  (ukey.indexOf(FTPClientConfig.SYST_UNIX_TRIM_LEADING) >= 0)
                  { // FTPClientConfig.SYST_UNIX_TRIM_LEADING = "UNIX_LTRIM"
                      parser = new UnixFTPEntryParser(config, true);
                  }
                  // ...
      }
      

      I think the issue is that the else if condition is unreachable because if second condition is true, the first condition is matching too :
      FTPClientConfig.SYST_UNIX = "UNIX"
      FTPClientConfig.SYST_UNIX_TRIM_LEADING = "UNIX_LTRIM"

      I think the issue is related to the commit on NET-566 (commit: http://svn.apache.org/viewvc?view=revision&revision=1652696)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Tqup3 Tqup3
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment