瀏覽代碼

MAPREDUCE-826. harchive doesn't use ToolRunner / harchive returns 0 even if the job fails with exception (koji via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20@819836 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 15 年之前
父節點
當前提交
75bbd813f0
共有 2 個文件被更改,包括 11 次插入3 次删除
  1. 3 0
      CHANGES.txt
  2. 8 3
      src/tools/org/apache/hadoop/tools/HadoopArchives.java

+ 3 - 0
CHANGES.txt

@@ -10,6 +10,9 @@ Release 0.20.2 - Unreleased
     HADOOP-6231.  Allow caching of filesystem instances to be disabled on a
     per-instance basis (Tom White and Ben Slusky via mahadev)
 
+    MAPREDUCE-826. harchive doesn't use ToolRunner / harchive returns 0 even
+    if the job fails with exception (koji via mahadev)
+
 Release 0.20.1 - 2009-09-01
 
   INCOMPATIBLE CHANGES

+ 8 - 3
src/tools/org/apache/hadoop/tools/HadoopArchives.java

@@ -675,11 +675,16 @@ public class HadoopArchives implements Tool {
   public static void main(String[] args) {
     JobConf job = new JobConf(HadoopArchives.class);
     HadoopArchives harchives = new HadoopArchives(job);
-    try {
-      int res = harchives.run(args);
-      System.exit(res);
+    int ret = 0;
+
+    try{
+      ret = ToolRunner.run(harchives, args);
     } catch(Exception e) {
+      LOG.debug("Exception in archives  ", e);
+      System.err.println("Exception in archives");
       System.err.println(e.getLocalizedMessage());
+      System.exit(1);
     }
+    System.exit(ret);
   }
 }