Author: cdouglas
Date: Fri Aug 21 22:50:10 2009
New Revision: 806746

URL: http://svn.apache.org/viewvc?rev=806746&view=rev
Log:
HDFS-538. Per the contract elucidated in HADOOP-6201, throw
FileNotFoundException from FileSystem::listStatus rather than returning
null. Contributed by Jakob Homan.

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/lib/hadoop-core-0.21.0-dev.jar
    hadoop/hdfs/trunk/lib/hadoop-core-test-0.21.0-dev.jar
    hadoop/hdfs/trunk/lib/hadoop-mapred-0.21.0-dev.jar
    hadoop/hdfs/trunk/lib/hadoop-mapred-test-0.21.0-dev.jar
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
    
hadoop/hdfs/trunk/src/test/hdfs-with-mr/org/apache/hadoop/fs/DistributedFSCheck.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Aug 21 22:50:10 2009
@@ -2,6 +2,12 @@
 
 Trunk (unreleased changes)
 
+  INCOMPATIBLE CHANGES
+
+    HDFS-538. Per the contract elucidated in HADOOP-6201, throw
+    FileNotFoundException from FileSystem::listStatus rather than returning
+    null. (Jakob Homan via cdouglas)
+
   NEW FEATURES
 
     HDFS-436. Introduce AspectJ framework for HDFS code and tests.

Modified: hadoop/hdfs/trunk/lib/hadoop-core-0.21.0-dev.jar
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/lib/hadoop-core-0.21.0-dev.jar?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
Binary files - no diff available.

Modified: hadoop/hdfs/trunk/lib/hadoop-core-test-0.21.0-dev.jar
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/lib/hadoop-core-test-0.21.0-dev.jar?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
Binary files - no diff available.

Modified: hadoop/hdfs/trunk/lib/hadoop-mapred-0.21.0-dev.jar
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/lib/hadoop-mapred-0.21.0-dev.jar?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
Binary files - no diff available.

Modified: hadoop/hdfs/trunk/lib/hadoop-mapred-test-0.21.0-dev.jar
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/lib/hadoop-mapred-test-0.21.0-dev.jar?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
--- 
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java 
(original)
+++ 
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java 
Fri Aug 21 22:50:10 2009
@@ -258,7 +258,9 @@
   @Override
   public FileStatus[] listStatus(Path p) throws IOException {
     FileStatus[] infos = dfs.listPaths(getPathName(p));
-    if (infos == null) return null;
+    if (infos == null) 
+      throw new FileNotFoundException("File " + p + " does not exist.");
+    
     FileStatus[] stats = new FileStatus[infos.length];
     for (int i = 0; i < infos.length; i++) {
       stats[i] = makeQualified(infos[i]);

Modified: 
hadoop/hdfs/trunk/src/test/hdfs-with-mr/org/apache/hadoop/fs/DistributedFSCheck.java
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs-with-mr/org/apache/hadoop/fs/DistributedFSCheck.java?rev=806746&r1=806745&r2=806746&view=diff
==============================================================================
--- 
hadoop/hdfs/trunk/src/test/hdfs-with-mr/org/apache/hadoop/fs/DistributedFSCheck.java
 (original)
+++ 
hadoop/hdfs/trunk/src/test/hdfs-with-mr/org/apache/hadoop/fs/DistributedFSCheck.java
 Fri Aug 21 22:50:10 2009
@@ -21,6 +21,7 @@
 import java.io.BufferedReader;
 import java.io.DataInputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -132,9 +133,13 @@
       return;
     }
     
-    FileStatus children[] = fs.listStatus(rootFile);
-    if (children == null)
+    FileStatus [] children = null;
+    try {
+      children = fs.listStatus(rootFile);
+    } catch (FileNotFoundException fnfe ){
       throw new IOException("Could not get listing for " + rootFile);
+    }
+
     for (int i = 0; i < children.length; i++)
       listSubtree(children[i], writer);
   }


Reply via email to