Menu

#6 Error 226 uploading a file

open
nobody
7
2015-01-22
2014-01-13
No

I'm uploading a file to a server and the return code is 226 and message "Transfer complete" but the library throws an exception. The exception is:

it.sauronsoftware.ftp4j.FTPException [code=226, message= Transfer complete.]
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2794)
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2586)
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2457)

I think the problem is in the code:

...
} finally {
                // Data transfer command reply.
                r = communication.readFTPReply();
                touchAutoNoopTimer();
                if (r.getCode() != 150 && r.getCode() != 125) {
                    throw new FTPException(r);
                }
                // Consumes the result reply of the transfer.
                r = communication.readFTPReply();
                if (!wasAborted && r.getCode() != 226) {
                    throw new FTPException(r);
                }
...

Discussion


Log in to post a comment.