[VFS] FileObject moveTo() - when destination exists, gives wrong error msg

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[VFS] FileObject moveTo() - when destination exists, gives wrong error msg

manco
Hi,
 
I am doing some testing on my file transfer lib which is built on top of VFS.
 
Specifically I am testing the   mv/moveTo, and I noticed if the Destination file
already exists i get and error,  as expected,  but the error is wrong:
 
Message:  Destination "file://C:/srcfile.ext" already existent.
 
The problem is it lists the Source filename, it should list the destination filename.

 
 
// code adapted from Shell.java
      private void mv(FileObject srcFo, FileObject dstFo) throws Exception
    {
        if (dstFo.exists() && dstFo.getType() == FileType.FOLDER)
        {
            dstFo = dstFo.resolveFile(srcFo.getName().getBaseName());
        }
        if(onMoveOverwrite && dstFo.exists())
        {
          dstFo.delete();
        }
        try {
          srcFo.moveTo(dstFo);
        } catch (Exception ex) {
          logger.error("mv: src: " + srcFo.getName()
                       + " dest: " + dstFo.getName()
                       + " msg: " + ex.getMessage());
          throw (ex);
        }
    } // endof mv

actual erorr output:
 
[main] ERROR - mv: src: file://C:/TEMP/Remote/IN/restore.verify
dest: file://C:/TEMP/local/APPEND/restore.verify
msg: Destination "file://C:/TEMP/Remote/IN/restore.verify" already existent.

 
Thanks,
Manco

               
---------------------------------
Discover Yahoo!
 Get on-the-go sports scores, stock quotes, news & more. Check it out!
Reply | Threaded
Open this post in threaded view
|

Re: [VFS] FileObject moveTo() - when destination exists, gives wrong error msg

Mario Ivankovits
manco wrote:
>The problem is it lists the Source filename, it should list the destination filename.
>  
Should be fixed now!

Thanks!
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]