You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Yuliya Polyeno (JIRA)" <ji...@apache.org> on 2012/07/06 15:59:34 UTC

[jira] [Created] (NET-472) FTPClient doesn't remember __dataConnectionMode

Yuliya Polyeno created NET-472:
----------------------------------

             Summary: FTPClient doesn't remember __dataConnectionMode
                 Key: NET-472
                 URL: https://issues.apache.org/jira/browse/NET-472
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
            Reporter: Yuliya Polyeno
            Priority: Minor


There is an issue with FTPClient.

1) When you create FTPClient in constructor you invoke __initDefaults() which would set __dataConnectionMode into ACTIVE_LOCAL_DATA_CONNECTION_MODE.

2) if you try after creation set up __dataConnectionMode into PASSIVE_LOCAL_DATA_CONNECTION_MODE it will be overridden when you would invoke connect() method because connect method again will invoke __initDefaults() which will override my setup, the same will happen when you disconect() because it will invoke __initDefaults() again.

I believe this is wrong behavior I don't need to switch on passive mode every time after connect. It should be only done when I create FTPClient.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (NET-472) FTPClient doesn't remember __dataConnectionMode

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437278#comment-13437278 ] 

Sebb commented on NET-472:
--------------------------

The same consideration applies to some other variables that have setters:

__fileType           = FTP.ASCII_FILE_TYPE;
__fileStructure      = FTP.FILE_STRUCTURE;
__fileFormat         = FTP.NON_PRINT_TEXT_FORMAT;
__fileTransferMode   = FTP.STREAM_TRANSFER_MODE;
__bufferSize         = Util.DEFAULT_COPY_BUFFER_SIZE;

There does not seem to be any particular reason to initialise them anywhere except the ctor (or in the variable declarations)

__initDefaults() should probably be reserved for items that must be reset when the connection state changes, for example __systemName is a cached value that is connection-specific.
                
> FTPClient doesn't remember __dataConnectionMode
> -----------------------------------------------
>
>                 Key: NET-472
>                 URL: https://issues.apache.org/jira/browse/NET-472
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>
> There is an issue with FTPClient.
> 1) When you create FTPClient in constructor you invoke __initDefaults() which would set __dataConnectionMode into ACTIVE_LOCAL_DATA_CONNECTION_MODE.
> 2) if you try after creation set up __dataConnectionMode into PASSIVE_LOCAL_DATA_CONNECTION_MODE it will be overridden when you would invoke connect() method because connect method again will invoke __initDefaults() which will override my setup, the same will happen when you disconect() because it will invoke __initDefaults() again.
> I believe this is wrong behavior I don't need to switch on passive mode every time after connect. It should be only done when I create FTPClient.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (NET-472) FTPClient doesn't remember __dataConnectionMode

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-472:
---------------------

    Issue Type: Improvement  (was: Bug)
    
> FTPClient doesn't remember __dataConnectionMode
> -----------------------------------------------
>
>                 Key: NET-472
>                 URL: https://issues.apache.org/jira/browse/NET-472
>             Project: Commons Net
>          Issue Type: Improvement
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>
> There is an issue with FTPClient.
> 1) When you create FTPClient in constructor you invoke __initDefaults() which would set __dataConnectionMode into ACTIVE_LOCAL_DATA_CONNECTION_MODE.
> 2) if you try after creation set up __dataConnectionMode into PASSIVE_LOCAL_DATA_CONNECTION_MODE it will be overridden when you would invoke connect() method because connect method again will invoke __initDefaults() which will override my setup, the same will happen when you disconect() because it will invoke __initDefaults() again.
> I believe this is wrong behavior I don't need to switch on passive mode every time after connect. It should be only done when I create FTPClient.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (NET-472) FTPClient doesn't remember __dataConnectionMode

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437282#comment-13437282 ] 

Sebb commented on NET-472:
--------------------------

Having looked further at the code, I'm not 100% sure the __dataConnectionMode can be remembered safely.

This is because it is also used for remote connect modes, which are only settable after the connection is established.

If the code uses enterRemoteActiveMode or enterRemotePassiveMode and fails to reset the mode afterwards using enterLocalActiveMode or enterLocalPassiveMode, then the client will be in an unusable state.

Changing the behaviour will break any user code that relies on the initial setting of the __dataConnectionMode.

In fact this is true of the other fields as well, so I think the behaviour needs to be retained.

If the code is ever redesigned, it would make sense to only reset fields when necessary, but this should only be done for a major release (and possibly only when changing package name/Maven coords)

                
> FTPClient doesn't remember __dataConnectionMode
> -----------------------------------------------
>
>                 Key: NET-472
>                 URL: https://issues.apache.org/jira/browse/NET-472
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>
> There is an issue with FTPClient.
> 1) When you create FTPClient in constructor you invoke __initDefaults() which would set __dataConnectionMode into ACTIVE_LOCAL_DATA_CONNECTION_MODE.
> 2) if you try after creation set up __dataConnectionMode into PASSIVE_LOCAL_DATA_CONNECTION_MODE it will be overridden when you would invoke connect() method because connect method again will invoke __initDefaults() which will override my setup, the same will happen when you disconect() because it will invoke __initDefaults() again.
> I believe this is wrong behavior I don't need to switch on passive mode every time after connect. It should be only done when I create FTPClient.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (NET-472) FTPClient doesn't remember __dataConnectionMode

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-472.
----------------------

    Resolution: Later

Consider for a later redesign
                
> FTPClient doesn't remember __dataConnectionMode
> -----------------------------------------------
>
>                 Key: NET-472
>                 URL: https://issues.apache.org/jira/browse/NET-472
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>
> There is an issue with FTPClient.
> 1) When you create FTPClient in constructor you invoke __initDefaults() which would set __dataConnectionMode into ACTIVE_LOCAL_DATA_CONNECTION_MODE.
> 2) if you try after creation set up __dataConnectionMode into PASSIVE_LOCAL_DATA_CONNECTION_MODE it will be overridden when you would invoke connect() method because connect method again will invoke __initDefaults() which will override my setup, the same will happen when you disconect() because it will invoke __initDefaults() again.
> I believe this is wrong behavior I don't need to switch on passive mode every time after connect. It should be only done when I create FTPClient.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira