Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.2k views
in Java FTP by (200 points)
Hello,
I use edtftpj-1.5.4.jar inside java project.
When i try to put a file to a remote host,
i get the following exception when i check if file exists :

com.enterprisedt.net.ftp.FTPException: Unable to determine if file 'xxx' exists.

The error line is : boolean existfile=ftpclient.exists('xxx');

I made a little search in the forum and found :

http://www.enterprisedt.com/forums/view ... rmine+file

I applied the patch with no success.

Is someone have a solution ?

Thanks a lot.

Samatar

4 Answers

0 votes
by (51.6k points)
Please call FTPClient.getLastReply() immediately after calling FTPClient.exists() to obtain the response-code and message returned when the test for the file was performed, and then post these to the forums so that we can see what server is telling us.

- Hans (EnterpriseDT)
0 votes
by (200 points)
Hi Hans, thanks a lot,
Please see below the replay code & text

2007/10/02 13:58:08 - Envoi fichiers via FTP 1 - Replay code :250
2007/10/02 13:58:08 - Envoi fichiers via FTP 1 - Replay text :CWD command successful.
2007/10/02 13:58:08 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : PDI a rencontr
0 votes
by (200 points)
a little bit more

2007/10/02 14:12:42 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : Last Replay --------------------->
2007/10/02 14:12:42 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : Last Replay :com.enterprisedt.net.ftp.FTPReply@5dcec6
2007/10/02 14:12:42 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : Last Replay code :250
2007/10/02 14:12:42 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : Last Replay text :CWD command successful.
2007/10/02 14:12:42 - Envoi fichiers via FTP 1 - ERROR (version 2.5.2, build 42 from 2007/10/01 17:22:08) : Last Replay <---------------------
0 votes
by (51.6k points)
That reply is not at all what I expected. The final FTP command that is sent before the exception is thrown is "RETR", so it's strange if you get a "250 CWD command successful" response since this appears to be a response to a "CWD" command. Is it possible for you to link the edtFTPj source into your code and a modification?

If so, please change the last three lines in the FTPClient.exists(String) method from:
String msg = "Unable to determine if file '" + remoteFile + "' exists.";
log.warn(msg);
throw new FTPException(msg);

to
String msg = "Unable to determine if file '" + remoteFile + "' exists: "
   + lastReply.getReplyCode() + " " + lastReply.getReplyText();
log.warn(msg);
throw new FTPException(msg);

and then post the output.

- Hans (EnterpriseDT)

Categories

...