Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.5k views
in Java FTP by (240 points)
Hi,

We are using edtftpj-pro.jar (edtftpj-pro-4.1.0).

We are trying to get list of directory using dirDetails() method on OS/400 as below. This method returns an array of FTPFile object.
The getname() method of this FTPFile object does not return the complete name of the file if the filename has spaces in its name.
e.g., if my os/400 directory has file with space in its name(e.g., lists this.xml) and on executing dirDetails() method on that folder,
we observed that the rawfield is fine where as name is not proper.
So when we invoked getRaw() method on the returned FTPFile object we got the data as below which is correct.
INDSF 60546 06/25/12 08:57:02 *STMF /UNIP19IBD4/temp/Lists this.xml
whereas getName() method on the same object returned:
Lists(This is incorrrect as the complete file name is Lists this.xml)

This method works fine for Windows and Linux i.e., even though filename contains spaces in its name, dirDetails() method returns its name properly.
Can anyone help us on the same as we are using the getName() method of FTPFile object for our processing.

Thank you.
Regards
- Priti

6 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 or SSLFTPClient.
0 votes
by (240 points)
Hi,

We are already creating an instance of FTPFileFactory by using following code:
String className="com.enterprisedt.net.ftp.OS400FileParser";
FileFactory fileFactory=new FTPFileFactory(FTPFileParser)Class.forName(className).newInstance());

and setting this fileFactory by using below method of SSLFTPClient client
setFTPFileFactory(fileFactory));

and still it does not work. Please advice.

Thank you.
Regards
- Priti
0 votes
by (162k points)
We'll need to see the EDT log file at the DEBUG level to see why this is happening. Can you also send us a directory listing so we can see what it is trying to parse?
0 votes
by (240 points)
Log :

INFO [SSLFTPClient] 27 Jun 2012 10:30:25.570 : edtFTPj - PRO version
DEBUG [FTPClient] 27 Jun 2012 10:30:25.740 : Class: com.magicsoftware.ibolt.ftpwrapper.IBFTPClient
Location: file:/D:/Development/iBolt3.2TBD1/edtftpj-wrapper/bin/
Version: 4.1.0
Build timestamp: 9-Feb-2012 17:00:40 EST
Java version: 1.6.0_21
CLASSPATH: D:\eclipse\plugins\org.junit4_4.3.1\junit.jar;D:\Development\iBolt3.2TBD1\edtftpj-wrapper\bin;D:\iBOLT\iBOLT3.3_Latest\java\lib\ibolt-commons.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\log-commons-logging.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\log4j-1.2.16.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\edtftpj-pro.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\license.jar
OS name: Windows 7
OS arch: x86
OS version: 6.1

INFO [LicensePropertiesBase] 27 Jun 2012 10:30:25.890 : Licence expiry date: 31 Dec 9999
INFO [LicensePropertiesBase] 27 Jun 2012 10:30:25.890 : Production licence
DEBUG [ProFTPClient] 27 Jun 2012 10:30:25.890 : Class: com.magicsoftware.ibolt.ftpwrapper.IBFTPClient
Location: file:/D:/Development/iBolt3.2TBD1/edtftpj-wrapper/bin/
Version: 4.1.0
Build timestamp: 9-Feb-2012 17:00:40 EST
Java version: 1.6.0_21
CLASSPATH: D:\eclipse\plugins\org.junit4_4.3.1\junit.jar;D:\Development\iBolt3.2TBD1\edtftpj-wrapper\bin;D:\iBOLT\iBOLT3.3_Latest\java\lib\ibolt-commons.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\log-commons-logging.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\log4j-1.2.16.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\edtftpj-pro.jar;D:\iBOLT\iBOLT3.3_Latest\java\lib\license.jar
OS name: Windows 7
OS arch: x86
OS version: 6.1

DEBUG [CryptixProperties] 27 Jun 2012 10:30:26.470 : Successfully loaded the CryptixEDT properties file
INFO [puretls] 27 Jun 2012 10:30:26.650 : PureTLS debug level=0
DEBUG [SSLFTPClient] 27 Jun 2012 10:30:26.662 : Setting custom validator to com.enterprisedt.net.ftp.ssl.SSLFTPStandardValidator
log4j:WARN No appenders could be found for logger (com.magicsoftware.ibolt.ftpwrapper.IBFTPClient).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
DEBUG [SSLFTPClient] 27 Jun 2012 10:30:26.703 : Turned server validation off
DEBUG [SSLFTPClient] 27 Jun 2012 10:30:26.703 : Created explicit FTPS client.
DEBUG [SSLFTPClient] 27 Jun 2012 10:30:26.704 : Connecting to 10.1.4.215:21
DEBUG [StreamSocketFactory] 27 Jun 2012 10:30:26.772 : Connecting to 10.1.4.215:21 via standard socket
DEBUG [SSLSocket] 27 Jun 2012 10:30:27.138 : Timeout=0
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:27.458 : 220-QTCP at power6.mse.corp.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.003 : 220 Connection will close if idle more than 5 minutes.
DEBUG [SSLFTPControlSocket] 27 Jun 2012 10:30:28.013 : DISABLE_CONTROL_SSL_CLOSURE=false
DEBUG [SSLFTPControlSocket] 27 Jun 2012 10:30:28.013 : DISABLE_CONTROL_WAIT_ON_CLOSE=false
DEBUG [SSLFTPControlSocket] 27 Jun 2012 10:30:28.013 : ALLOW_BASIC_CONSTRAINTS_IN_NON_CA=false
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.013 : ---> USER indsf
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.354 : 331 Enter password.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.354 : ---> PASS ********
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.684 : 230 INDSF logged on.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:28.685 : ---> TYPE I
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:29.021 : 200 Representation type is binary IMAGE.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:29.022 : ---> SYST
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:29.361 : 215 OS/400 is the remote operating system. The TCP/IP version is "V6R1M0".
DEBUG [MVSFileParser] 27 Jun 2012 10:30:29.460 : Ignoring the set locale.
DEBUG [FTPClient] 27 Jun 2012 10:30:29.460 : Set new FTPFileFactory: com.enterprisedt.net.ftp.OS400FileParser
DEBUG [MVSFileParser] 27 Jun 2012 10:30:30.849 : Ignoring the set locale.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:30.849 : ---> PWD
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:31.201 : 257 "QGPL" is current library.
DEBUG [FTPClient] 27 Jun 2012 10:30:31.201 : setupDirDetails(//UNIP19IBD4/temp) returning: QGPL///UNIP19IBD4/temp
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:31.201 : ---> PASV
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:31.541 : 227 Entering Passive Mode (10,1,4,215,218,249).
INFO [FTPControlSocket] 27 Jun 2012 10:30:31.541 : Substituting server supplied IP (10.1.4.215) with remote host IP (10.1.4.215)
DEBUG [StreamSocketFactory] 27 Jun 2012 10:30:31.541 : Connecting to 10.1.4.215:56057 via standard socket
DEBUG [SSLFTPControlSocket] 27 Jun 2012 10:30:31.881 : Creating FTPPassiveDataSocket
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:31.891 : ---> LIST //UNIP19IBD4/temp
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:32.232 : 125-NAMEFMT set to 1.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:32.232 : 125 List started.
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:32.782 : 250 List completed.
DEBUG [OS400FileParser] 27 Jun 2012 10:30:32.802 : Swapping to alternate format (found date in future)
DEBUG [OS400FileParser] 27 Jun 2012 10:30:32.802 : Swapping to alternate format (found date in future)
DEBUG [OS400FileParser] 27 Jun 2012 10:30:32.802 : Swapping to alternate format (found date in future)
DEBUG [OS400FileParser] 27 Jun 2012 10:30:32.802 : Swapping to alternate format (found date in future)
DEBUG [OS400FileParser] 27 Jun 2012 10:30:32.812 : Swapping to alternate format (found date in future)
quiting...
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:57.511 : ---> QUIT
DEBUG [FTPControlSocket] 27 Jun 2012 10:30:57.850 : 221 QUIT subcommand received.


Following are the files in Directory on FTP :

File name: kill all.log
File name: Lists this.xml
File name: Lists this.priti
File name: mgerror test.priti

After Doing dirDetails :
i.e FTPFile[] files= client.dirDetails("//UNIP19IBD4/temp");
files array returns following listing.

Directory Listing :

[INDSF 6853 06/25/12 08:56:43 *STMF /UNIP19IBD4/temp/kill all.log
Name=/UNIP19IBD4/temp/kill,Size=6853,Permissions=null,Owner=INDSF,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=06-01-0014 08:56, INDSF 60546 06/25/12 08:57:02 *STMF /UNIP19IBD4/temp/Lists this.xml
Name=/UNIP19IBD4/temp/Lists,Size=60546,Permissions=null,Owner=INDSF,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=06-01-0014 08:57, INDSF 60546 06/25/12 08:58:37 *STMF /UNIP19IBD4/temp/Lists this.priti
Name=/UNIP19IBD4/temp/Lists,Size=60546,Permissions=null,Owner=INDSF,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=06-01-0014 08:58, INDSF 972 06/25/12 08:58:49 *STMF /UNIP19IBD4/temp/mgerror test.priti
Name=/UNIP19IBD4/temp/mgerror,Size=972,Permissions=null,Owner=INDSF,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=06-01-0014 08:58, INDSF 8192 06/25/12 09:52:43 *DIR /UNIP19IBD4/temp/my dir/
Name=/UNIP19IBD4/temp/my,Size=8192,Permissions=null,Owner=INDSF,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=06-01-0014 09:52]


From above listing you can see that.
rawfield contains the complete file name i.e. "/UNIP19IBD4/temp/kill all.log" but the "Name" field contains incomplete file name
i.
0 votes
by (240 points)
Hi Team,

We are waiting for your reply.
Can anybody suggest solution on above scenario.

Thanks,
Priti
0 votes
by (162k points)
Hi, we've identified the problem and will have a fix for you soon.

Categories

...