Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
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.