Sebb created NET-491:
------------------------

             Summary: FTPClient - confusing parameters to 
setFileStructure/setFileType/setTransferMode
                 Key: NET-491
                 URL: https://issues.apache.org/jira/browse/NET-491
             Project: Commons Net
          Issue Type: Improvement
            Reporter: Sebb


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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to