Browse Source

Merge -r 598779:598780 from trunk to 0.15 branch. Fixes HADOOP-2129.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/branches/branch-0.15@599082 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 17 years ago
parent
commit
f0c890dfb9
2 changed files with 19 additions and 14 deletions
  1. 9 0
      CHANGES.txt
  2. 10 14
      src/java/org/apache/hadoop/dfs/DistributedFileSystem.java

+ 9 - 0
CHANGES.txt

@@ -1,6 +1,15 @@
 Hadoop Change Log
 
 
+Branch 0.15 (unreleased)
+
+  BUG FIXES
+
+    HADOOP-2129.  Fix so that distcp works correctly when source is
+    HDFS but not the default filesystem.  HDFS paths returned by the
+    listStatus() method are now fully-qualified.  (cutting)
+
+
 Release 0.15.1 - 2007-11-27
 
   INCOMPATIBLE CHANGES

+ 10 - 14
src/java/org/apache/hadoop/dfs/DistributedFileSystem.java

@@ -160,21 +160,17 @@ public class DistributedFileSystem extends FileSystem {
     return dfs.getContentLength(getPathName(f));
   }
 
-  public FileStatus[] listStatus(Path f) throws IOException {
-    return dfs.listPaths(getPathName(f));
-  }
-
-  public Path[] listPaths(Path f) throws IOException {
-    DFSFileInfo info[] = dfs.listPaths(getPathName(f));
-    if (info == null) {
-      return new Path[0];
-    } else {
-      Path results[] = new DfsPath[info.length];
-      for (int i = 0; i < info.length; i++) {
-        results[i] = new DfsPath(info[i], this);
-      }
-      return results;
+  public FileStatus[] listStatus(Path p) throws IOException {
+    DFSFileInfo[] infos = dfs.listPaths(getPathName(p));
+    if (infos == null) return null;
+    FileStatus[] stats = new FileStatus[infos.length];
+    for (int i = 0; i < infos.length; i++) {
+      DFSFileInfo f = (DFSFileInfo)infos[i];
+      stats[i] = new FileStatus(f.getLen(), f.isDir(), f.getReplication(),
+                                f.getBlockSize(), f.getModificationTime(),
+                                new DfsPath(f, this)); // fully-qualify path
     }
+    return stats;
   }
 
   public boolean mkdirs(Path f) throws IOException {