Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in Java FTP by (160 points)
Hi.


On AS400(OS/400), dirDetails() method is not working.

import java.io.IOException;
import java.text.ParseException;

import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.net.ftp.FTPException;
import com.enterprisedt.net.ftp.FTPFile;
import com.enterprisedt.net.ftp.FTPFileFactory;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.util.debug.Level; 
import com.enterprisedt.util.debug.Logger;

public static void main(String[] arg) throws IOException, FTPException, java.text.ParseException {
   
   String host = "host"; 
   String username = "username"; 
   String password = "password";
   String chdir = "chdir";

   com.enterprisedt.util.debug.Logger.setLevel(com.enterprisedt.util.debug.Level.DEBUG);

   FTPClient client = new FTPClient(); 

   client.setRemoteHost(host); 
   client.connect();
   client.login(username, password);
   client.setType(FTPTransferType.ASCII);
   client.chdir(chdir);

   //Don't work OS/400 directory listing parser.: 
   FTPFile[] files = client.dirDetails("/"); 
   System.out.println("RESULT " + files.length);
   
}


DEBUG [FTPClient] 25 Jun 2012 17:18:58.484 : Class: com.enterprisedt.net.ftp.FTPClient
Location: file:/lib/edtftpj-pro-4.1.0.jar
Version: 4.1.0
Build timestamp: 21-Jan-2011 09:20:16 EST
Java version: 1.6.0_21
CLASSPATH: D:\
OS name: Windows XP
OS arch: x86
OS version: 5.1

DEBUG [FTPClient] 25 Jun 2012 17:18:58.484 : Connecting to /host:21
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:58.531 : 220-QTCP at host.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:58.671 : 220 Connection will close if idle more than 10 minutes.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:58.671 : ---> USER username
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:58.687 : 331 Enter password.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:58.687 : ---> PASS ********
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.031 : 230 username logged on.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.031 : ---> TYPE A
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.031 : 200 Representation type is ASCII nonprint.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.031 : ---> CWD /chdir/
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.046 : 250-NAMEFMT set to 1.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.046 : 250 "/chdir" is current directory.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.046 : ---> SYST
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.046 : 215 OS/400 is the remote operating system. The TCP/IP version is "V5R4M0".
WARN [FTPFileFactory] 25 Jun 2012 17:18:59.062 : Unknown SYST ' OS/400 is the remote operating system. The TCP/IP version is "V5R4M0".' - defaulting to Unix parsing
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.062 : ---> PWD
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.062 : 257 "/chdir" is current directory.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.062 : ---> PASV
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.062 : 227 Entering Passive Mode (XXX.XXX.XXX.XXX,40,170).
INFO [FTPControlSocket] 25 Jun 2012 17:18:59.062 : Substituting server supplied IP (XXX.XXX.XXX.XXX) with remote host IP (XXX.XXX.XXX.XXX)
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.078 : ---> LIST /
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.187 : 125 List started.
DEBUG [FTPControlSocket] 25 Jun 2012 17:18:59.484 : 250 List completed.
DEBUG [UnixFileParser] 25 Jun 2012 17:18:59.484 : Not in UNIX format
DEBUG [UnixFileParser] 25 Jun 2012 17:18:59.484 : Not in UNIX format
DEBUG [WindowsFileParser] 25 Jun 2012 17:18:59.484 : Not in Windows format
DEBUG [VMSFileParser] 25 Jun 2012 17:18:59.484 : Not in VMS format
DEBUG [NetwareFileParser] 25 Jun 2012 17:18:59.484 : Not in Netware format
WARN [FTPFileFactory] 25 Jun 2012 17:18:59.484 : Could not detect format. Using default UNIX

RESULT 0

3 Answers

0 votes
by (162k points)
You need to explicitly set the OS400Parser - it isn't automatically detected at present. You need to set a new instance of FTPFileFactory in FTPClient.
0 votes
by (160 points)
Could you include "automatic detact for OS400Parser", next ver.?
0 votes
by (162k points)
We will put it down as a to do.

Categories

...