You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Dan <da...@tipjarawards.com> on 2008/12/20 18:27:25 UTC

BUG? org.apache.ftpserver.command.impl.RNTO.execute(RNTO.java:134)

When doing a rename, consider the line:

LOG.info("File rename (" + session.getUser().getName() + ") "
                        + frFile.getAbsolutePath() + " -> " +
toFile.getAbsolutePath());

This log statement asks for the absolute path for the frFile. But this file
has just been moved. For the sake of the log statement you need to save the
value for frFile.getAbsolutePath() and then log it AFTER the rename has been
complete.

e.g.

            // now rename
		String logFrFileAbsolutePath = frFile.getAbsolutePath();

            if (frFile.move(toFile)) {
                session.write(LocalizedFtpReply.translate(session, request,
context,
                        FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY,
"RNTO",
                        toFileStr));

                LOG.info("File rename (" + session.getUser().getName() + ")
"
                        + logFrFileAbsolutePath + " -> " +
toFile.getAbsolutePath());

Let me know your thoughts, thanks

Dan


-----Original Message-----
From: Niklas Gustavsson [mailto:niklas@protocol7.com] 
Sent: December-19-08 4:45 PM
To: ftpserver-users@mina.apache.org
Subject: Re: Uploading: How to determine the file size

On Fri, Dec 19, 2008 at 10:28 PM, Dan <da...@tipjarawards.com> wrote:
> Then how can I implement storage quotas with this server without 
> having to wait until the file is uplaoded, and then to check if it's too
big?

You can not, and that's a limitation in FTP protocol so other servers would
have the same issue. You can of course track the size while uploading, and
break and reply with an error when the quota is reached.

/niklas