Example usage for org.apache.commons.net.ftp FTPReply NEED_PASSWORD

List of usage examples for org.apache.commons.net.ftp FTPReply NEED_PASSWORD

Introduction

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

Prototype

int NEED_PASSWORD

To view the source code for org.apache.commons.net.ftp FTPReply NEED_PASSWORD.

Click Source Link

Usage

From source file:de.thischwa.pmcms.tool.connection.ftp.FtpConnectionManager.java

private void checkReply() {
    int replyCode = ftpClient.getReplyCode();

    // close connection, if dropped, so that isConnected() return false
    if (replyCode == FTPReply.SERVICE_NOT_AVAILABLE)
        close();//from  w ww .j a  va  2  s . c om

    logger.debug("[FTP] " + ftpClient.getReplyString());

    // throw exceptions depending on the replyCode, if is not positiv
    if (!FTPReply.isPositiveCompletion(replyCode)) {
        if (replyCode == FTPReply.CODE_503 || replyCode == FTPReply.NEED_PASSWORD
                || replyCode == FTPReply.NOT_LOGGED_IN)
            throw new ConnectionAuthentificationException(ftpClient.getReplyString());
        else
            throw new ConnectionRunningException(ftpClient.getReplyString());
    }
}