Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.4k views
in Java FTP by
hallo

i tested edtFTPj with two different ftp servers and when i call the dirDetails method i get an exception:

java.text.ParseException: Unparseable date: "-rw-rw-rw- 1"
   at java.text.DateFormat.parse(Unknown Source)
   at com.enterprisedt.net.ftp.WindowsFileParser.parse(WindowsFileParser.java:107)
   at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:200)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:2210)


and (zFTPd):
java.text.ParseException: Unparseable date: "dr--r--r-- 1"
   at java.text.DateFormat.parse(Unknown Source)
   at com.enterprisedt.net.ftp.WindowsFileParser.parse(WindowsFileParser.java:107)
   at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:200)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:2210)



ftp servers used:
- www.sambar.com
- http://zftpserver.serveftp.com/


the raw listing would look like:
ftp> dir
200 PORT Command successful.
125 File status okay; about to open data connection.
dr--r--r--   1     root   public      512 May 06 15:56 .
dr--r--r--   1     root   public      512 May 06 15:56 ..
-r--r--r--   1     root   public   287569 May 06 07:02 inter.zip
-r--r--r--   1     root   public   268116 May 06 07:01 ME403010.zip
-r--r--r--   1     root   public      670 May 06 07:01 ME10.xml.zip
-r--r--r--   1     root   public       31 May 06 07:27 unzip-inter.bat
226 Transfer complete, closing data connection.
FTP: 64d Bytes empfangen in 0.05Sekunden 22.04KB/s


some hints how to avoid this would be great. since i dont really need the date, only the size and the name :-)

thanks a lot

6 Answers

0 votes
by (162k points)
It is worth trying the UnixFileParser - there's a method in FTPClient that allows you to set it for use everywhere.
0 votes
by
I have the same problem,

using cerberus server 2.22

ftp listing looks like this:
drw-rw-rw-   1 user     group           0 May 15 00:15 .
drw-rw-rw-   1 user     group           0 May 15 00:15 ..
-rw-rw-rw-   1 user     group       19968 May 12 17:31 data presentaties.doc
-rw-rw-rw-   1 user     group         581 May 15 00:15 Shortcut to data presentaties.doc.lnk



Try to find a way to set the unixfile parser, Haven't find it uptill now. seemed like a good to report it too

YnzeAtZinhoDotNl
0 votes
by
Posted to soon,

the way to set the fileparser is (for people with the same problem)
   
ftp = new FTPClient();
FTPFileFactory fileFactory = new FTPFileFactory(new UnixFileParser());
ftp.setFTPFileFactory(fileFactory);


Although when I set htis I get the following parse error:

java.text.ParseException: Unparseable date: "May-15-2005-02:15"
   at java.text.DateFormat.parse(Unknown Source)
   at com.enterprisedt.net.ftp.UnixFileParser.parse(UnixFileParser.java:235)
   at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:188)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:2210)
   at gms.ftp.FtpServer.connect(FtpServer.java:107)
   at gms.ftp.FtpServer.<init>(FtpServer.java:41)
   at gms.ftp.FtpServer.main(FtpServer.java:47)


I have no idea how to solve this one, any help would be appreciated :)
0 votes
by (162k points)
Both listings shown work with the UnixFileParser - so you can set it explicitly via setFTPFileFactory.

You may also need to call setParserLocale if you & the server are in different locales.

hallo

i tested edtFTPj with two different ftp servers and when i call the dirDetails method i get an exception:

0 votes
by
ftp = new FTPClient();
FTPFileFactory fileFactory = new FTPFileFactory(new UnixFileParser());
ftp.setFTPFileFactory(fileFactory);
ftp.setParserLocale(Locale.US);
0 votes
by
The same with FileZilla Server but it works if I set locale.

Categories

...