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

My FTP-Server runs in German, and a directory listing is for example:

Gesamt 210
drwxrwx---   5 user1   notebook     512 Aug 25 12:47 .
drwxr-xr-x   9 root    sys          512 Jun 29 15:18 ..
-rw-r--r--   1 user1   notebook     156 Jun 29 15:11 .profile
-rw-r--r--   1 user1   notebook   14703 Aug 20 08:38 1789676859M.gif
-rw-r--r--   1 user1   notebook    8504 Aug 20 08:58 802638461M.gif
drwxrwx---   8 user1   notebook    1536 Okt  1 10:24 gbt


Germans write "October" as "Oktober", and I get the following error:

java.text.ParseException: Unparseable date: "Okt-1-2004-10:24"
    at java.text.DateFormat.parse(Unknown Source)
    at com.enterprisedt.net.ftp.UnixFileParser.parse(UnixFileParser.java:182)
    at com.enterprisedt.net.ftp.FTPFileFactory.parse(FTPFileFactory.java:159)
    at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:1735)


I imagine that your SimpleDateFormat uses the US locale. Can you provide the possibility to pass a locale to the UnixFileParser or FTPFileFactory? Or even better, observe the system's local language setting?

Thank you very much for your attention,
B. Dimitrov

2 Answers

0 votes
by
Hi,

I now tried to extend FTPFileParser myself and to parse the German dates, but it is not possible. In order to overwrite parse(), I need to instantiate FTPFiles, and the constructor for that class is package private.

Thank you,
B. Dimitrov
0 votes
by (162k points)
Hmm. We changed to US locale as a Russian guy wanted it. I guess the problem is more that you might be in one locale, talking to an FTP server that supplies names from a different locale.

We'll change it back to the default, and anyone who wants to change it can use Locale.setDefault()

I imagine that your SimpleDateFormat uses the US locale. Can you provide the possibility to pass a locale to the UnixFileParser or FTPFileFactory? Or even better, observe the system's local language setting?

Thank you very much for your attention,
B. Dimitrov

Categories

...