Example usage for org.apache.commons.net.ftp FTPSClient getReplyCode

List of usage examples for org.apache.commons.net.ftp FTPSClient getReplyCode

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPSClient getReplyCode.

Prototype

public int getReplyCode() 

Source Link

Document

Returns the integer value of the reply code of the last FTP reply.

Usage

From source file:org.mule.transport.ftps.FtpsMessageRequester.java

protected FTPFile findFileToProcess(FTPSClient client) throws Exception {
    //Checking if it is a file or a directory
    boolean isFile = connector.isFile(endpoint, client);
    FTPListParseEngine engine = client.initiateListParsing();
    FTPFile[] files = null;/* w  w  w. j  a  v  a 2  s  . c o  m*/
    while (engine.hasNext()) {
        files = engine.getNext(FTP_LIST_PAGE_SIZE);
        if (files == null) {
            break;
        }
        FilenameFilter filenameFilter = getFilenameFilter();
        for (int i = 0; i < files.length; i++) {
            FTPFile file = files[i];
            if (file.isFile() && isValid(file, filenameFilter)) {
                // only read the first one
                return file;
            }
        }
    }
    if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        throw new IOException("Ftp error: " + client.getReplyCode());
    }

    return null;
}