You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Axelsson (JIRA)" <ji...@apache.org> on 2012/07/13 09:01:35 UTC

[jira] [Created] (NET-475) FtpClient sends REST when calling listFiles

Thomas Axelsson created NET-475:
-----------------------------------

             Summary: FtpClient sends REST when calling listFiles
                 Key: NET-475
                 URL: https://issues.apache.org/jira/browse/NET-475
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.1, 3.0.1
         Environment: Windows Vista Enterprise SP2
Java SE 1.6
            Reporter: Thomas Axelsson


First setting a restart offset and then requesting a directory listing makes FtpClient send REST, LIST. The correct behavior should be to send only LIST and send REST on the first file transfer operation.

Versions 3.1 and 3.0.1 of commons-net have shown this behavior in our software.

Following is a minimal sample, tested with version 3.1:

{code}
package test;

import java.io.PrintWriter;

import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.ftp.FTPClient;

public class Test {

	public static void main(String[] args) throws Exception {
		FTPClient client = new FTPClient();
		client.addProtocolCommandListener(new PrintCommandListener(
				new PrintWriter(System.out), true));
		
		client.connect(Server.ip);
		client.login(Server.username, Server.password);
		
        client.setRestartOffset(10);
        
        client.listFiles("");
	}
	
}
{code}

Output:
{code}
220 Welcome to FTP service.
USER *******
331 Please specify the password.
PASS *******
230 Login successful.
SYST
215 UNIX Type: L8
PORT 10,43,92,50,230,56
200 PORT command successful. Consider using PASV.
REST 10
350 Restart position accepted (10).
LIST 
150 Here comes the directory listing.
226 Directory send OK.
{code}

--
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-475) FtpClient sends REST when calling listFiles

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

Sebb commented on NET-475:
--------------------------

The obvious fix is to only set the restart offset immediately before a file transfer.

On further reflection, does it make sense to change NET to delay the sending of REST until the next file transfer?
It seems more natural to me to set the offset immediately before starting the transfer.

So the only change required is to clarify that setRestartOffset() should only be called immediately before a file transfer.
                
> FtpClient sends REST when calling listFiles
> -------------------------------------------
>
>                 Key: NET-475
>                 URL: https://issues.apache.org/jira/browse/NET-475
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0.1, 3.1
>         Environment: Windows Vista Enterprise SP2
> Java SE 1.6
>            Reporter: Thomas Axelsson
>              Labels: LIST, REST, listFiles, offset, restart, setRestartOffset
>
> First setting a restart offset and then requesting a directory listing makes FtpClient send REST, LIST. The correct behavior should be to send only LIST and send REST on the first file transfer operation.
> Versions 3.1 and 3.0.1 of commons-net have shown this behavior in our software.
> Following is a minimal sample, tested with version 3.1:
> {code}
> package test;
> import java.io.PrintWriter;
> import org.apache.commons.net.PrintCommandListener;
> import org.apache.commons.net.ftp.FTPClient;
> public class Test {
> 	public static void main(String[] args) throws Exception {
> 		FTPClient client = new FTPClient();
> 		client.addProtocolCommandListener(new PrintCommandListener(
> 				new PrintWriter(System.out), true));
> 		
> 		client.connect(Server.ip);
> 		client.login(Server.username, Server.password);
> 		
>         client.setRestartOffset(10);
>         
>         client.listFiles("");
> 	}
> 	
> }
> {code}
> Output:
> {code}
> 220 Welcome to FTP service.
> USER *******
> 331 Please specify the password.
> PASS *******
> 230 Login successful.
> SYST
> 215 UNIX Type: L8
> PORT 10,43,92,50,230,56
> 200 PORT command successful. Consider using PASV.
> REST 10
> 350 Restart position accepted (10).
> LIST 
> 150 Here comes the directory listing.
> 226 Directory send OK.
> {code}

--
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-475) FtpClient sends REST when calling listFiles

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

Sebb resolved NET-475.
----------------------

       Resolution: Fixed
    Fix Version/s: 3.2

Clarified Javadoc:

URL: http://svn.apache.org/viewvc?rev=1361522&view=rev
Log:
NET-475 FtpClient sends REST when calling listFiles

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
                
> FtpClient sends REST when calling listFiles
> -------------------------------------------
>
>                 Key: NET-475
>                 URL: https://issues.apache.org/jira/browse/NET-475
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0.1, 3.1
>         Environment: Windows Vista Enterprise SP2
> Java SE 1.6
>            Reporter: Thomas Axelsson
>              Labels: LIST, REST, listFiles, offset, restart, setRestartOffset
>             Fix For: 3.2
>
>
> First setting a restart offset and then requesting a directory listing makes FtpClient send REST, LIST. The correct behavior should be to send only LIST and send REST on the first file transfer operation.
> Versions 3.1 and 3.0.1 of commons-net have shown this behavior in our software.
> Following is a minimal sample, tested with version 3.1:
> {code}
> package test;
> import java.io.PrintWriter;
> import org.apache.commons.net.PrintCommandListener;
> import org.apache.commons.net.ftp.FTPClient;
> public class Test {
> 	public static void main(String[] args) throws Exception {
> 		FTPClient client = new FTPClient();
> 		client.addProtocolCommandListener(new PrintCommandListener(
> 				new PrintWriter(System.out), true));
> 		
> 		client.connect(Server.ip);
> 		client.login(Server.username, Server.password);
> 		
>         client.setRestartOffset(10);
>         
>         client.listFiles("");
> 	}
> 	
> }
> {code}
> Output:
> {code}
> 220 Welcome to FTP service.
> USER *******
> 331 Please specify the password.
> PASS *******
> 230 Login successful.
> SYST
> 215 UNIX Type: L8
> PORT 10,43,92,50,230,56
> 200 PORT command successful. Consider using PASV.
> REST 10
> 350 Restart position accepted (10).
> LIST 
> 150 Here comes the directory listing.
> 226 Directory send OK.
> {code}

--
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