Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.8k views
in Java FTP by
I am using the version 1.4.5 of the FTP client and have some troubles when using it with our SUN ftp server.
the dirDetails(String dirname) returns an error on following line:
drwxrwxr-x   2 rzwicklh clearusr     512 Dec  4  2003 TestFolder

whereas this line parses successfully:
drwxrwxr-x   5 rzwicklh clearusr     512 Nov 27  2003 TestFolder2


The exception is thrown in the UNIX file parser line 217:
lastModified = formatter1.parse(stamp.toString());

I guess the format string used for the formatter is incorrect: "MMM-dd-yyyy"

Thanks
Rainer

PS: Another hint: line 196 should be surrrounded by a try - catch to be able to rethrow the exception ex again. - But I do not really care about this

6 Answers

0 votes
by (162k points)
Weird. When I parse this line it seems to work fine.

Could you post the full stack trace? Thanks.

I am using the version 1.4.5 of the FTP client and have some troubles when using it with our SUN ftp server.
the dirDetails(String dirname) returns an error on following line:
drwxrwxr-x   2 rzwicklh clearusr     512 Dec  4  2003 TestFolder

0 votes
by
Thank you for the promt response.

Here is the stack trace from the parsing exception:
Caused by: java.text.ParseException: Unparseable date: "Dec-4-2003"
   at java.text.DateFormat.parse(DateFormat.java:335)
   at com.enterprisedt.net.ftp.UnixFileParser.parse(UnixFileParser.java:217)
   at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:185)
   at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:1816)
   at com.ftisoft.communication.ftp.FTPDirectoryMonitor.traverseDirectory(FTPDirectoryMonitor.java:312)
   ... 3 more


Rainer

PS: I had to do the change I proposed above to get the stack trace from the UNIX parser and not the one from the WINDOWS parser.
0 votes
by
I found the problem

My locale is de-at (language is German, Country is Austria). The expected date string would be: "Dez" in German whereas the FTP server returns the month info in english.

The parser needs to use a different locale to be able to parse the date correctly.

Can you please let me know if and when you could provide a fix for this?

Thanks
Rainer
0 votes
by (162k points)
Well, as it happens 1.4.5 introduced this feature.

FTPClient.setParserLocale shoudl do what you need.

I found the problem

My locale is de-at (language is German, Country is Austria). The expected date string would be: "Dez" in German whereas the FTP server returns the month info in english.

The parser needs to use a different locale to be able to parse the date correctly.

Can you please let me know if and when you could provide a fix for this?

Thanks
Rainer
0 votes
by
Thanks a lot for this information. This feature fixes my problem. Well done!
0 votes
by
Current time is on Local Machine:
Thu Dec 22 09:37:15 CST 2005


Remote Site in France (ahead in time)
-rwxrwxrwx 1 user group 6490 Dec 22 14:50 IN_106481.xml
-rwxrwxrwx 1 user group 6489 Dec 22 14:50 IN_106482.xml


Date is being parsed as 2004-12-22

I have tried using ftp.setParserLocale to France, but no Luck.

Please help.

Categories

...