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

FTPClient - confusing parameters to setFileStructure/setFileType/setTransferMode

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • FTP
    • None

    Description

      The methods setFileStructure/setFileType/setTransferMode all have int parameters which are defined in the FTP class.

      However, not all the integers are valid for all the parameters, for example:

      ftpClient.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE)

      is not valid - the second parameter should be one of the _FORMAT - or a byte size if the first parameter is FTP.LOCAL_FILE_TYPE.

      The parameters are used to look up an entry in the private _modes string, so garbage values should be detected there.

      The example above shows that not all errors are currently detected.

      It might be possible to implement some basic additional checks to help catch errors.

      Using enums looks to be impossible, as the example shows.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: