I have a security model that checks when  you request a file that you
actually have permissions to look at that file, that it exists etc. And my
"files" are actually tied to a database model.

After a move the frFile is no longer valid and therefore my security model
throws an exception (as it should) when a request is made for
getAbsolutePath() on it.

Dan 

-----Original Message-----
From: David Latorre [mailto:[email protected]] 
Sent: December-22-08 4:01 AM
To: [email protected]
Subject: Re: BUG?
org.apache.ftpserver.command.impl.RNTO.execute(RNTO.java:134)

Hello Dan,

 So are you using a custom FileSystem?  What are your restrictions then?
eg,  Can you get the absolute path of a non-existent file?
 Maybe we have overlooked something here.  Actually I meant that either our
NativeFtpFile nor java.io.File objects have their paths changed as a result
of moving a file - sorry for the misleading answer! But it could be the case
that your FtpFile does, is that so?




2008/12/22 Dan <[email protected]>

> One of the nice features of the ftp server is its abstraction of the 
> "file system". I don't use a java.io.File object.
>
> Dan
>
> -----Original Message-----
> From: David Latorre [mailto:[email protected]]
> Sent: December-21-08 6:08 PM
> To: [email protected]
> Subject: Re: BUG?
> org.apache.ftpserver.command.impl.RNTO.execute(RNTO.java:134)
>
> Hello Dan,
> AFAIK, moving a file doesn't change the path in the java.io.File 
> object (The same way you can get the absolute path for a non-existent 
> file).
>
>
>
>
> 2008/12/21 Daniel Frank <[email protected]>
>
> > 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
> >
> >
>
>

Reply via email to