Преглед изворни кода

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.
     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)
     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
 Release 0.17.0 - 2008-05-18
 
 
   INCOMPATIBLE CHANGES
   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
    * 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 start the start in the file
    * @param len the length in the file
    * @param len the length in the file
    * @return block locations for this segment of file
    * @return block locations for this segment of file
    * @throws IOException
    * @throws IOException
    */
    */
   @Override
   @Override
-  public BlockLocation[] getFileBlockLocations(Path f, long start,
+  public BlockLocation[] getFileBlockLocations(FileStatus file, long start,
       long len) throws IOException {
       long len) throws IOException {
     // need to look up the file in the underlying fs
     // need to look up the file in the underlying fs
     // look up the index 
     // look up the index 
     
     
     // make sure this is a prt of this har filesystem
     // make sure this is a prt of this har filesystem
-    Path p = makeQualified(f);
+    Path p = makeQualified(file.getPath());
     Path harPath = getPathInHar(p);
     Path harPath = getPathInHar(p);
     String line = fileStatusInIndex(harPath);
     String line = fileStatusInIndex(harPath);
     if (line == null)  {
     if (line == null)  {
-      throw new FileNotFoundException("File " + f + " not found");
+      throw new FileNotFoundException("File " + file.getPath() + " not found");
     }
     }
     HarStatus harStatus = new HarStatus(line);
     HarStatus harStatus = new HarStatus(line);
-    if (harStatus.isDir()) 
+    if (harStatus.isDir()) {
       return new BlockLocation[0];
       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());
         harStatus.getStartIndex(), harStatus.getLength());
   }
   }