Author: nextgens
Date: 2007-11-27 16:08:01 +0000 (Tue, 27 Nov 2007)
New Revision: 15967

Modified:
   trunk/freenet/src/freenet/support/io/FileUtil.java
Log:
FileUtil: add a sanity check to prevent silly bugs

Modified: trunk/freenet/src/freenet/support/io/FileUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FileUtil.java  2007-11-27 16:03:12 UTC 
(rev 15966)
+++ trunk/freenet/src/freenet/support/io/FileUtil.java  2007-11-27 16:08:01 UTC 
(rev 15967)
@@ -147,7 +147,8 @@
         public static boolean renameTo(File orig, File dest) {
             // Try an atomic rename
             // Shall we prevent symlink-race-conditions here ?
-            
+            if(orig.equals(dest))
+                throw new IllegalArgumentException("Huh? the two file 
descriptors are the same!");
             if (!orig.renameTo(dest)) {
                 // Not supported on some systems (Windows)
                 if (!dest.delete()) {


Reply via email to