commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manco <megust...@yahoo.com>
Subject [VFS] FileObject moveTo() - when destination exists, gives wrong error msg
Date Wed, 01 Jun 2005 23:25:36 GMT
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!
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message