1
0
فهرست منبع

HADOOP-3496. Fix failure in TestHarFileSystem.testArchives due to change in HADOOP-3095.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@663865 13f79535-47bb-0310-9956-ffa450edef68
Thomas White 17 سال پیش
والد
کامیت
bc0a5704dd
2فایلهای تغییر یافته به همراه12 افزوده شده و 6 حذف شده
  1. 3 0
      CHANGES.txt
  2. 9 6
      src/java/org/apache/hadoop/fs/HarFileSystem.java

+ 3 - 0
CHANGES.txt

@@ -486,6 +486,9 @@ Trunk (unreleased changes)
     HADOOP-3240. Fix a testcase to not create files in the current directory.
     Instead the file is created in the test directory (Mahadev Konar via ddas)
 
+    HADOOP-3496.  Fix failure in TestHarFileSystem.testArchives due to change
+    in HADOOP-3095.  (tomwhite)
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

+ 9 - 6
src/java/org/apache/hadoop/fs/HarFileSystem.java

@@ -318,29 +318,32 @@ public class HarFileSystem extends FilterFileSystem {
   
   /**
    * get block locations from the underlying fs
-   * @param f the input path for the blocks
+   * @param file the input filestatus to get block locations
    * @param start the start in the file
    * @param len the length in the file
    * @return block locations for this segment of file
    * @throws IOException
    */
   @Override
-  public BlockLocation[] getFileBlockLocations(Path f, long start,
+  public BlockLocation[] getFileBlockLocations(FileStatus file, long start,
       long len) throws IOException {
     // need to look up the file in the underlying fs
     // look up the index 
     
     // make sure this is a prt of this har filesystem
-    Path p = makeQualified(f);
+    Path p = makeQualified(file.getPath());
     Path harPath = getPathInHar(p);
     String line = fileStatusInIndex(harPath);
     if (line == null)  {
-      throw new FileNotFoundException("File " + f + " not found");
+      throw new FileNotFoundException("File " + file.getPath() + " not found");
     }
     HarStatus harStatus = new HarStatus(line);
-    if (harStatus.isDir()) 
+    if (harStatus.isDir()) {
       return new BlockLocation[0];
-    return fs.getFileBlockLocations(new Path(archivePath, harStatus.getPartName()), 
+    }
+    FileStatus fsFile = fs.getFileStatus(new Path(archivePath,
+        harStatus.getPartName()));
+    return fs.getFileBlockLocations(fsFile, 
         harStatus.getStartIndex(), harStatus.getLength());
   }