You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/04/16 22:39:21 UTC

svn commit: r1468602 - in /commons/proper/io/trunk/src: changes/changes.xml main/java/org/apache/commons/io/FileUtils.java

Author: sebb
Date: Tue Apr 16 20:39:20 2013
New Revision: 1468602

URL: http://svn.apache.org/r1468602
Log:
IO-372 FileUtils.moveDirectory can produce misleading error message on failiure

Modified:
    commons/proper/io/trunk/src/changes/changes.xml
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java

Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1468602&r1=1468601&r2=1468602&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Tue Apr 16 20:39:20 2013
@@ -47,6 +47,9 @@ The <action> type attribute can be add,u
   <body>
     <!-- The release date is the date RC is cut -->
     <release version="2.5" date="2013-??-??" description="New features and bug fixes.">    
+      <action issue="IO-372" dev="sebb" type="fix">
+        FileUtils.moveDirectory can produce misleading error message on failiure 
+      </action>            
       <action issue="IO-375" dev="sebb" type="update">
         FilenameUtils.splitOnTokens(String text) check for '**' could be simplified 
       </action>            

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1468602&r1=1468601&r2=1468602&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Tue Apr 16 20:39:20 2013
@@ -2803,7 +2803,7 @@ public class FileUtils {
         }
         final boolean rename = srcDir.renameTo(destDir);
         if (!rename) {
-            if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
+            if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath() + File.pathSeparator)) {
                 throw new IOException("Cannot move directory: "+srcDir+" to a subdirectory of itself: "+destDir);
             }
             copyDirectory( srcDir, destDir );