hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r421189 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/DFSShell.java src/java/org/apache/hadoop/mapred/JobClient.java src/java/org/apache/hadoop/util/CopyFiles.java src/java/org/apache/hadoop/util/ToolBase.java
Date Wed, 12 Jul 2006 08:36:56 GMT
Author: cutting
Date: Wed Jul 12 01:36:53 2006
New Revision: 421189

URL: http://svn.apache.org/viewvc?rev=421189&view=rev
Log:
HADOOP-327.  Fix ToolBase to not call System.exit() when an exception is thrown.  Contributed
by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ToolBase.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=421189&r1=421188&r2=421189&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Jul 12 01:36:53 2006
@@ -21,6 +21,9 @@
  5. HADOOP-358.  Fix a NPE bug in Path.equals().
     (Frédéric Bertin via cutting)
 
+ 6. HADOOP-327.  Fix ToolBase to not call System.exit() when
+    exceptions are thrown.  (Hairong Kuang via cutting)
+
 
 Release 0.4.0 - 2006-06-28
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java?rev=421189&r1=421188&r2=421189&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java Wed Jul 12 01:36:53 2006
@@ -356,7 +356,7 @@
     /**
      * main() has some simple utility methods
      */
-    public static void main(String argv[]) throws IOException {
+    public static void main(String argv[]) throws Exception {
         new DFSShell().doMain(new Configuration(), argv);
     }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?rev=421189&r1=421188&r2=421189&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Wed Jul 12 01:36:53
2006
@@ -454,7 +454,7 @@
     
     /**
      */
-    public static void main(String argv[]) throws IOException {
+    public static void main(String argv[]) throws Exception {
         new JobClient().doMain(new Configuration(), argv);
     }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java?rev=421189&r1=421188&r2=421189&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java Wed Jul 12 01:36:53
2006
@@ -238,7 +238,7 @@
    * input files. The mapper actually copies the files allotted to it. And
    * the reduce is empty.
    */
-  public int run(String[] args) throws IOException {
+  public int run(String[] args) throws Exception {
     String srcPath = null;
     String destPath = null;
     boolean ignoreReadFailures = false;
@@ -392,7 +392,7 @@
     return exitCode;
   }
   
-  public static void main(String[] args) throws IOException {
+  public static void main(String[] args) throws Exception {
       new CopyFiles().doMain(
               new JobConf(new Configuration(), CopyFiles.class), 
               args);

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ToolBase.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ToolBase.java?rev=421189&r1=421188&r2=421189&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ToolBase.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ToolBase.java Wed Jul 12 01:36:53
2006
@@ -34,35 +34,47 @@
 /*************************************************************
  * This is a base class to support generic commonad options.
  * Generic command options allow a user to specify a namenode,
- * a job tracker etc. Generic options supported are
- * -conf <configuration file>     specify an application configuration file
- * -D <property=value>            use value for given property
- * -fs <local|namenode:port>      specify a namenode
- * -jt <local|jobtracker:port>    specify a job tracker
+ * a job tracker etc. Generic options supported are 
+ * <p>-conf <configuration file>     specify an application configuration file
+ * <p>-D <property=value>            use value for given property
+ * <p>-fs <local|namenode:port>      specify a namenode
+ * <p>-jt <local|jobtracker:port>    specify a job tracker
+ * <br>
+ * <p>The general command line syntax is
+ * <p>bin/hadoop command [genericOptions] [commandOptions]
  * 
- * The general command line syntax is
- * bin/hadoop command [genericOptions] [commandOptions]
- * 
- * For every tool that inherits from ToolBase, generic options are 
+ * <p>For every tool that inherits from ToolBase, generic options are 
  * handled by ToolBase while command options are passed to the tool.
  * Generic options handling is implemented using Common CLI.
  * 
- * Tools that inherit from ToolBase in Hadoop are
+ * <p>Tools that inherit from ToolBase in Hadoop are
  * DFSShell, DFSck, JobClient, and CopyFiles.
- * 
- * Examples using generic options are
- * bin/hadoop dfs -fs darwin:8020 -ls /data
+ * <br>
+ * <p>Examples using generic options are
+ * <p>bin/hadoop dfs -fs darwin:8020 -ls /data
+ * <p><blockquote><pre>
  *     list /data directory in dfs with namenode darwin:8020
- * bin/hadoop dfs -D fs.default.name=darwin:8020 -ls /data
+ * </pre></blockquote>
+ * <p>bin/hadoop dfs -D fs.default.name=darwin:8020 -ls /data
+ * <p><blockquote><pre>
  *     list /data directory in dfs with namenode darwin:8020
- * bin/hadoop dfs -conf hadoop-site.xml -ls /data
+ * </pre></blockquote>
+ * <p>bin/hadoop dfs -conf hadoop-site.xml -ls /data
+ * <p><blockquote><pre>
  *     list /data directory in dfs with conf specified in hadoop-site.xml
- * bin/hadoop job -D mapred.job.tracker=darwin:50020 -submit job.xml
+ * </pre></blockquote>
+ * <p>bin/hadoop job -D mapred.job.tracker=darwin:50020 -submit job.xml
+ * <p><blockquote><pre>
  *     submit a job to job tracker darwin:50020
- * bin/hadoop job -jt darwin:50020 -submit job.xml
+ * </pre></blockquote>
+ * <p>bin/hadoop job -jt darwin:50020 -submit job.xml
+ * <p><blockquote><pre>
  *     submit a job to job tracker darwin:50020
- * bin/hadoop job -jt local -submit job.xml
+ * </pre></blockquote>
+ * <p>bin/hadoop job -jt local -submit job.xml
+ * <p><blockquote><pre>
  *     submit a job to local runner
+ * </pre></blockquote>
  *        
  * @author hairong
  *
@@ -161,31 +173,15 @@
     }
 
     /**
-     * Execute a command
+     * Work as a main program: execute a command and handle exception if any
      * @param conf Application default configuration
      * @param args User-specified arguments
-     * @return Exit code
      * @throws Exception
      */
-    public int executeCommand(Configuration conf, String[] args) throws Exception {
+    public final void doMain(Configuration conf, String[] args) throws Exception {
         String [] commandOptions = parseGeneralOptions(conf, args);
         setConf(conf);
-        return this.run(commandOptions);
-    }
-    /**
-     * Work as a main program: execute a command and handle exception if any
-     * @param conf Application default configuration
-     * @param args User-specified arguments
-     */
-    public final void doMain(Configuration conf, String[] args) {
-        try {
-            System.exit(executeCommand(conf, args));
-        }
-        catch (Exception e) {
-            LOG.warn(e.getMessage());
-            e.printStackTrace();
-            System.exit(-1);
-        }
+        this.run(commandOptions);
     }
 
 }



Mime
View raw message