Author: imario
Date: Mon Jun 20 23:14:15 2005
New Revision: 191629

URL: http://svn.apache.org/viewcvs?rev=191629&view=rev
Log:
Changed moveTo to delete the destination if it is existent. This is to archive 
the same behavior as with copyFrom.

Modified:
    
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
    
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
    jakarta/commons/proper/vfs/trunk/xdocs/todo.xml

Modified: 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java?rev=191629&r1=191628&r2=191629&view=diff
==============================================================================
--- 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
 (original)
+++ 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
 Mon Jun 20 23:14:15 2005
@@ -267,6 +267,7 @@
 
     /**
      * Move this file.
+     * <p>If the destFile exists, it is deleted first</b> 
      *
      * @param destFile the New filename.
      * @throws FileSystemException If this file is read-only, or if the source 
file does not exist,

Modified: 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java?rev=191629&r1=191628&r2=191629&view=diff
==============================================================================
--- 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
 (original)
+++ 
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
 Mon Jun 20 23:14:15 2005
@@ -881,15 +881,19 @@
         }
     }
 
+    /**
+     * Moves (rename) the file to another one
+     */
     public void moveTo(FileObject destFile) throws FileSystemException
     {
         if (!isWriteable())
         {
             throw new 
FileSystemException("vfs.provider/rename-read-only.error", getName());
         }
-        if (destFile.getType() != FileType.IMAGINARY)
+        if (destFile.exists())
         {
-            throw new 
FileSystemException("vfs.provider/rename-dest-exists.error", 
destFile.getName());
+            destFile.delete(Selectors.SELECT_ALL);
+            // throw new 
FileSystemException("vfs.provider/rename-dest-exists.error", 
destFile.getName());
         }
 
         if (canRenameTo(destFile))

Modified: jakarta/commons/proper/vfs/trunk/xdocs/todo.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/xdocs/todo.xml?rev=191629&r1=191628&r2=191629&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/xdocs/todo.xml (original)
+++ jakarta/commons/proper/vfs/trunk/xdocs/todo.xml Mon Jun 20 23:14:15 2005
@@ -19,6 +19,7 @@
                 <ul>
                     <li>Remove internal caching of states from fileObject and 
allow it to be decorated with a caching instance</li>
                     <li>Provide a hook for authentication.</li>
+                    <li>moveTo should handle a directory move if it moves from 
a different filesystem.</li>
                 </ul>
             </subsection>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to