Author: jlowe Date: Thu Feb 6 23:09:41 2014 New Revision: 1565474 URL: http://svn.apache.org/r1565474 Log: HADOOP-10112. har file listing doesn't work with wild card. Contributed by Brandon Li
Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1565474&r1=1565473&r2=1565474&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt Thu Feb 6 23:09:41 2014 @@ -21,6 +21,9 @@ Release 0.23.11 - UNRELEASED HADOOP-10146. Workaround JDK7 Process fd close bug (daryn) + HADOOP-10112. har file listing doesn't work with wild card (Brandon Li via + jlowe) + Release 0.23.10 - 2013-12-09 INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java?rev=1565474&r1=1565473&r2=1565474&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java (original) +++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java Thu Feb 6 23:09:41 2014 @@ -614,15 +614,20 @@ public class HarFileSystem extends Filte */ @Override public FileStatus getFileStatus(Path f) throws IOException { - HarStatus hstatus = getFileHarStatus(f); + Path p = makeQualified(f); + if (p.toUri().getPath().length() < archivePath.toString().length()) { + // still in the source file system + return fs.getFileStatus(new Path(p.toUri().getPath())); + } + + HarStatus hstatus = getFileHarStatus(p); return toFileStatus(hstatus, null); } private HarStatus getFileHarStatus(Path f) throws IOException { // get the fs DataInputStream for the underlying file // look up the index. - Path p = makeQualified(f); - Path harPath = getPathInHar(p); + Path harPath = getPathInHar(f); if (harPath == null) { throw new IOException("Invalid file name: " + f + " in " + uri); } @@ -716,6 +721,11 @@ public class HarFileSystem extends Filte // to the client List<FileStatus> statuses = new ArrayList<FileStatus>(); Path tmpPath = makeQualified(f); + if (tmpPath.toUri().getPath().length() < archivePath.toString().length()) { + // still in the source file system + return fs.listStatus(new Path(tmpPath.toUri().getPath())); + } + Path harPath = getPathInHar(tmpPath); HarStatus hstatus = metadata.archive.get(harPath); if (hstatus == null) {