Commons Net
  1. Commons Net
  2. NET-366

FTPClientConfig: setServerLanguageCode and setShortMonthNames do not work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 3.0
    • Component/s: FTP
    • Labels:
      None

      Description

      The methods setServerLanguageCode and setShortMonthNames of FTPClientConfig do not work.

      The reason for this is, that the config object is not passed to ConfigurableFTPFileEntryParserImpl.configure.

      The reason for this can be found in class UnixFTPEntryParser:

      public UnixFTPEntryParser()
      {
          this(null);
      }
      
      public UnixFTPEntryParser(FTPClientConfig config)
      {
          super(REGEX);
          configure(config);
      }
      

      The contructor UnixFTPEntryParser(FTPClientConfig config) is never called from outside this class. It is only called once, by the other constructor UnixFTPEntryParser().

      Therefore in UnixFTPEntryParser(FTPClientConfig config) the parameter config is always null.

      So the settings of serverLanguageCode and shortMonthNames will never be passed to ConfigurableFTPFileEntryParserImpl.configure.

      This can be fixed by changing class DefaultFTPFileEntryParserFactory.

      Change from

      public FTPFileEntryParser createUnixFTPEntryParser()
      {
          return new UnixFTPEntryParser();
      }
      

      to

      public FTPFileEntryParser createUnixFTPEntryParser()
      {
          return new UnixFTPEntryParser(config);
      }
      

      Then the config object will be passed to UnixFTPEntryParser.

        Activity

        Hide
        Sebb added a comment -

        Thanks. There were other places where the config was not passed on. All have been fixed (hopefully).

        Show
        Sebb added a comment - Thanks. There were other places where the config was not passed on. All have been fixed (hopefully).

          People

          • Assignee:
            Unassigned
            Reporter:
            Johannes Katelaan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development