ソースを参照

HADOOP-320. Fix so that checksum files are correctly copied when the destination of a file copy is a directory. Contributed by Hairong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@440879 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 年 前
コミット
7fcc24c3fa
2 ファイル変更13 行追加2 行削除
  1. 4 0
      CHANGES.txt
  2. 9 2
      src/java/org/apache/hadoop/fs/FileSystem.java

+ 4 - 0
CHANGES.txt

@@ -129,6 +129,10 @@ Trunk (unreleased changes)
 32. HADOOP-507.  Fix an IllegalAccessException in DFS.
     (omalley via cutting)
 
+33. HADOOP-320.  Fix so that checksum files are correctly copied when
+    the destination of a file copy is a directory.
+    (Hairong Kuang via cutting)
+
 
 Release 0.5.0 - 2006-08-04
 

+ 9 - 2
src/java/org/apache/hadoop/fs/FileSystem.java

@@ -388,10 +388,17 @@ public abstract class FileSystem extends Configured {
       } else {
 
         boolean value = renameRaw(src, dst);
+        if (!value)
+          return false;
 
         Path checkFile = getChecksumFile(src);
-        if (exists(checkFile))
-          renameRaw(checkFile, getChecksumFile(dst)); // try to rename checksum
+        if (exists(checkFile)) { //try to rename checksum
+          if(isDirectory(dst)) {
+            renameRaw(checkFile, dst);
+          } else {
+            renameRaw(checkFile, getChecksumFile(dst)); 
+          }
+        }
 
         return value;
       }