1
0
Kaynağa Gözat

HADOOP-3012. dfs -mv file to user home directory throws exception if
the user home directory does not exist. (Mahadev Konar via dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@639369 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 17 yıl önce
ebeveyn
işleme
13ecce9910

+ 3 - 0
CHANGES.txt

@@ -319,6 +319,9 @@ Trunk (unreleased changes)
     HADOOP-3025. ChecksumFileSystem supports the delete method with 
     the recursive flag. (Mahadev Konar via dhruba)
 
+    HADOOP-3012. dfs -mv file to user home directory throws exception if 
+    the user home directory does not exist. (Mahadev Konar via dhruba)
+
 Release 0.16.2 - Unreleased
 
   BUG FIXES

+ 1 - 1
src/java/org/apache/hadoop/fs/FsShell.java

@@ -855,7 +855,6 @@ public class FsShell extends Configured implements Tool {
         try {
           dstFstatus = dstFs.getFileStatus(dst);
         } catch(IOException e) {
-          //hide this
         }
         if((srcFstatus!= null) && (dstFstatus!= null)) {
           if (srcFstatus.isDir()  && !dstFstatus.isDir()) {
@@ -863,6 +862,7 @@ public class FsShell extends Configured implements Tool {
                 + dst + " with directory " + srcs[i]);
           }
         }
+        throw new IOException("Failed to rename " + srcs[i] + " to " + dst);
       }
     }
   }

+ 7 - 0
src/test/org/apache/hadoop/dfs/TestDFSShell.java

@@ -307,6 +307,13 @@ public class TestDFSShell extends TestCase {
       argv = new String[3];
       argv[0] = "-mv";
       argv[1] = "/testfile";
+      argv[2] = "file";
+      ret = ToolRunner.run(shell, argv);
+      assertTrue("mv failed to rename", ret == -1);
+      out.reset();
+      argv = new String[3];
+      argv[0] = "-mv";
+      argv[1] = "/testfile";
       argv[2] = "/testfiletest";
       ret = ToolRunner.run(shell, argv);
       returned = out.toString();