You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Niklas Gustavsson <ni...@protocol7.com> on 2007/01/19 17:30:00 UTC

[net] FTP reply list never cleared

Hi

When using the net Java 5 branch, the replies returned from the server 
is stored in a list that is not emptied between commands. This means 
that when for example printing the replies with a 
ProtocolCommandListener you will get the full history of replies rather 
than the last one. The following patch seems to work:

Index: src/main/java/org/apache/commons/net/ftp/FTP.java
===================================================================
--- src/main/java/org/apache/commons/net/ftp/FTP.java   (revision 497851)
+++ src/main/java/org/apache/commons/net/ftp/FTP.java   (working copy)
@@ -266,7 +266,7 @@
          int length;

          _newReplyString = true;
-        //_replyLines. setSize(0);
+        _replyLines.clear();

          String line = _controlInput_.readLine();




/niklas


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [net] FTP reply list never cleared

Posted by Rory Winston <rw...@eircom.net>.
Hi Niklas

Thanks for this, I will apply the patch.

Cheers
Rory


Niklas Gustavsson wrote:
> Hi
>
> When using the net Java 5 branch, the replies returned from the server 
> is stored in a list that is not emptied between commands. This means 
> that when for example printing the replies with a 
> ProtocolCommandListener you will get the full history of replies 
> rather than the last one. The following patch seems to work:
>
> Index: src/main/java/org/apache/commons/net/ftp/FTP.java
> ===================================================================
> --- src/main/java/org/apache/commons/net/ftp/FTP.java   (revision 497851)
> +++ src/main/java/org/apache/commons/net/ftp/FTP.java   (working copy)
> @@ -266,7 +266,7 @@
>          int length;
>
>          _newReplyString = true;
> -        //_replyLines. setSize(0);
> +        _replyLines.clear();
>
>          String line = _controlInput_.readLine();
>
>
>
>
> /niklas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org