Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in edtFTPj by (180 points)

On VMS FTP servers file names contain version information, thus special handling needs to be done, e.g. when performing an existence check. E.g. a VMS file name looks like this:


That's why we subclassed com.enterprisedt.net.ftp.FileTransferClient in our application (VmsFileTransferClient), overriding methods like directoryList() and exists(). Since edtFTPj 2.5.0, however, the class FTPClient performs an own existence check in FTPClient.existsFile(), which is sophisticated, but does not work with file names on VMS FTP servers. There is no chance for us to subclass and override FTPClient analogous to FileTransferClient, because FTPClient is instantiated in FileTransferClient's constructor into a private field inaccessible by other classes, including our VmsFileTransferClient.

So we cannot upgrade to edtFTPj 2.5.0 (currently we use 2.4.0). With 2.5.0 we run into this exception:

Caused by: com.enterprisedt.net.ftp.FTPException: File MYFILE.EDI;1 not found.
        at com.enterprisedt.net.ftp.FTPInputStream.<init>(FTPInputStream.java:90)
        at com.enterprisedt.net.ftp.FTPInputStream.<init>(FTPInputStream.java:74)
        at com.enterprisedt.net.ftp.FileTransferClient.downloadStream(FileTransferClient.java:814)
        at com.tsystems.cc4.common.transport.ftp.VmsFileTransferClient.downloadStream(VmsFileTransferClient.java:100)

A possible solution for this would be to add another constructor in FileTransferClient that accepts a given FTPClient instance. Like this our VmsFileTransferClient could inject a VmsFTPClient that subclasses FTPClient and overrides existsFile() for usage with VMS FTP.


by (161k points)
Why don't you add the new constructor, make sure it works for you, and send us the change?  We can add it to the codebase.
by (180 points)
Ok, I added the new contructor, compiled with Java 7 and successfully tested it for our case. Here's the changed code of FileTransferClient:

public class FileTransferClient implements FileTransferClientInterface {
     * Default constructor
    public FileTransferClient() {
        this(new FTPClient());
     * Constructs an instance with a given FTPClient.
     * @param ftpClient FTPClient to use
    public FileTransferClient(FTPClient ftpClient) {
        this.ftpClient = ftpClient;
        advancedFTPSettings = new AdvancedFTPSettings(masterContext);
        advancedSettings = new AdvancedGeneralSettings(masterContext);
        statistics = new FileStatistics();

Please log in or register to answer this question.