Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.disconnect()


            for (IPath i : ls()) {
                res |= !i.delete();
            }
            res |= client.deleteFile(getPath());
            log.debug("ftp delete file " + getPath() + " reply code: " + client.getReplyCode() + ", reply string: " + client.getReplyString());
            client.disconnect();
            return !res;
        } else {
            try {
                return client.deleteFile(getPath());
            } finally {
View Full Code Here


        } else {
            try {
                return client.deleteFile(getPath());
            } finally {
                log.debug("ftp delete file " + getPath() + " reply code: " + client.getReplyCode() + ", reply string: " + client.getReplyString());
                client.disconnect();
            }
        }

    }
}
View Full Code Here

        }
        super.connect(client);

        int code = ftp.getReplyCode();
        if (!FTPReply.isPositiveCompletion(code)) {
            ftp.disconnect();
            throw new ConnectionRefusedException(code);
        }
        if (!ftp.login(getUsername(), getPassword())) {
            ftp.disconnect();
            throw new ConnectionRefusedException(ftp.getReplyCode());
View Full Code Here

        if (!FTPReply.isPositiveCompletion(code)) {
            ftp.disconnect();
            throw new ConnectionRefusedException(code);
        }
        if (!ftp.login(getUsername(), getPassword())) {
            ftp.disconnect();
            throw new ConnectionRefusedException(ftp.getReplyCode());
        }
        if (isBinaryMode()) {
            ftp.setFileType(FTP.BINARY_FILE_TYPE);
        }
View Full Code Here

            // success.
            reply = ftp.getReplyCode();

            if(!FTPReply.isPositiveCompletion(reply)) {
                try {
                    ftp.disconnect();
                } catch (IOException e) {
                    /**
                     * ftp.disconnect() is called only as additional clean-up here, so we choose to
                     * ignore possible exceptions
                     */
 
View Full Code Here

                PipeComponentUtils.failTransfer();               
            }
        } finally {
            if(ftp.isConnected()) {
                try {
                    ftp.disconnect();
                } catch(IOException f) {
                    // do nothing
                }
            }
        }
View Full Code Here

            // success.
            reply = ftp.getReplyCode();

            if(!FTPReply.isPositiveCompletion(reply)) {
                try {
                    ftp.disconnect();
                } catch(IOException e) {
                    /**
                     * ftp.disconnect() is called only as additional clean-up here, so we choose to
                     * ignore possible exceptions
                     */
 
View Full Code Here

                PipeComponentUtils.failTransfer();
            }
        } finally {
            if(ftp.isConnected()) {
                try {
                    ftp.disconnect();
                } catch(IOException f) {
                    // do nothing
                }
            }
        }
View Full Code Here

        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.retrieveFile(TEST_FILENAME, new ByteArrayOutputStream()));
        assertTrue(client1.deleteFile(TEST_FILENAME));
       
        assertTrue(client1.logout());
        client1.disconnect();

        FTPClient client2 = new FTPClient();
        client2.connect("localhost", port);

        assertTrue(client2.login(ANONYMOUS_USERNAME, ANONYMOUS_PASSWORD));
View Full Code Here

          res.setResponseCode("000"); // TODO
            res.setResponseMessage(ex.toString());
        } finally {
            if (ftp.isConnected()) {
                try {
                    ftp.disconnect();
                } catch (IOException ignored) {
                }
            }
            IOUtils.closeQuietly(input);
            IOUtils.closeQuietly(output);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.