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

I'm using edtFTPj 1.5.5.
I'm using FTPClient to connect to an FTP server running on a Tandem system (Version 3.w TANDEM 29JUL2005)

Unfortunately, when I a do a directory listing, and the dir is empty, FTPClient throws an FTPException.
The reply code is 550, and the reply text is "\TANZA.$NODET.USSDCDRS.: not found". $NODET.USSDCDRS is the directory that I'm querying.

Here is an extract when I manually FTP to the server:
ftp> cd $NODET.USSDCDRS
250 CWD command successful.
ftp>
ftp> ls
200 PORT command successful.
150 Opening data connection for \TANZA.$NODET.USSDCDRS. (10.10.96.216,50843d) (0 bytes).
550 \TANZA.$NODET.USSDCDRS.: not found.
ftp>

Looking at the source for the dir() method in FTPCLient, I see that reply code 550 is handled specially, but unfortunately "NOT FOUND" is not one of the constants in DirectoryEmptyStrings, thus causing the exception, and not letting it go through as with 550 NO SUCH FILE OR DIRECTORY for instance.

I would like to know if I can just add "NOT FOUND" as one of the constants in DirectoryEmptyStrings and rebuilding the jar, or are there any other code I need to change? And can you guys maybe also add it for a future release in case somebody else runs into the same problem. Below is an extract from DirectoryEmptyStrings.java that I've changed:

/**
* Server string for Tandem indicating no files found (NOT_FOUND)
*/
final public static String NOT_FOUND = "NOT FOUND";

/**
* Constructor. Adds the fragments to match on
*/
public DirectoryEmptyStrings()
{
add(NO_FILES);
add(NO_SUCH_FILE_OR_DIR);
add(EMPTY_DIR);
add(NO_DATA_SETS_FOUND);
add(NOT_FOUND);
}

Any replies would be appreciated
Thanks

1 Answer

0 votes
by (162k points)
Yes, you can just add "NOT FOUND". You can also call getDirectoryEmptyMessages() and use the returned instance to add your message dynamically if you don't want to recompile.

Categories

...