You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2016/05/05 00:54:12 UTC

[jira] [Closed] (NET-583) FTPClient.getReplyString() returns wrong value after connect()

     [ https://issues.apache.org/jira/browse/NET-583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb closed NET-583.
--------------------

> FTPClient.getReplyString() returns wrong value after connect()
> --------------------------------------------------------------
>
>                 Key: NET-583
>                 URL: https://issues.apache.org/jira/browse/NET-583
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.3
>            Reporter: Holger Rehn
>             Fix For: 3.5
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> If the FTPClient's automatic server encoding detection is enabled, a FEAT command is issued in method _connectAction_() [indirectly via hasFeature(String)]. After that, the _replyCode and _replyLines fields are stored back to their previous values in _connectAction_(), but the _newReplyString flag isn't set to true. Because of that, you will then get back the reply to the FEAT command from getReplyString(), instead of the server's welcome message. Furthermore, you may get back a reply code that doesn't match that reply string. We have encountered a case when we got back reply code 220 after FTPClient.connect(), but reply string was "530 Not logged in.".
> This error can easily be fixed by adding the following line to FTPClient.java around line 944:
> _newReplyString = true;
> Patch:
> ===================================================================
> --- src/org/apache/commons/net/ftp/FTPClient.java
> +++ src/org/apache/commons/net/ftp/FTPClient.java	(working copy)
> @@ -941,6 +941,7 @@
>             _replyLines.clear();
>             _replyLines.addAll(oldReplyLines);
>             _replyCode = oldReplyCode;
> +           _newReplyString = true;
>         }
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)