hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r793988 - in /hadoop/common/branches/branch-0.20: CHANGES.txt src/core/org/apache/hadoop/fs/FsShell.java
Date Tue, 14 Jul 2009 17:39:47 GMT
Author: szetszwo
Date: Tue Jul 14 17:39:47 2009
New Revision: 793988

URL: http://svn.apache.org/viewvc?rev=793988&view=rev
Log:
HADOOP-6145. Fix FsShell rm/rmr error messages when there is a FNFE.  Contributed by Jakob
Homan

Modified:
    hadoop/common/branches/branch-0.20/CHANGES.txt
    hadoop/common/branches/branch-0.20/src/core/org/apache/hadoop/fs/FsShell.java

Modified: hadoop/common/branches/branch-0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20/CHANGES.txt?rev=793988&r1=793987&r2=793988&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20/CHANGES.txt Tue Jul 14 17:39:47 2009
@@ -172,6 +172,9 @@
     HADOOP-6141. Fix a few bugs in 0.20 test-patch.sh.  (Hong Tang via
     szetszwo)
 
+    HADOOP-6145. Fix FsShell rm/rmr error messages when there is a FNFE.
+    (Jakob Homan via szetszwo)
+
 Release 0.20.0 - 2009-04-15
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.20/src/core/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20/src/core/org/apache/hadoop/fs/FsShell.java?rev=793988&r1=793987&r2=793988&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20/src/core/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/common/branches/branch-0.20/src/core/org/apache/hadoop/fs/FsShell.java Tue Jul
14 17:39:47 2009
@@ -1045,7 +1045,16 @@
   /* delete a file */
   private void delete(Path src, FileSystem srcFs, boolean recursive, 
                       boolean skipTrash) throws IOException {
-    if (srcFs.isDirectory(src) && !recursive) {
+    FileStatus fs = null;
+    try {
+      fs = srcFs.getFileStatus(src);
+    } catch (FileNotFoundException fnfe) {
+      // Have to re-throw so that console output is as expected
+      throw new FileNotFoundException("cannot remove "
+          + src + ": No such file or directory.");
+    }
+
+    if (fs.isDir() && !recursive) {
       throw new IOException("Cannot remove directory \"" + src +
                             "\", use -rmr instead");
     }
@@ -1061,10 +1070,6 @@
     if (srcFs.delete(src, true)) {
       System.out.println("Deleted " + src);
     } else {
-      if (!srcFs.exists(src)) {
-        throw new FileNotFoundException("cannot remove "
-            + src + ": No such file or directory.");
-        }
       throw new IOException("Delete failed " + src);
     }
   }



Mime
View raw message