From f660e5eaa3856a17f2e61391c4ed953e3a0708ea Mon Sep 17 00:00:00 2001 From: Surendra Singh Lilhore Date: Thu, 3 Jan 2019 18:58:03 +0530 Subject: [PATCH] HDFS-14163. Debug Admin Command Should Support Generic Options. Contributed by Ayush Saxena. --- .../java/org/apache/hadoop/hdfs/tools/DebugAdmin.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java index 2c327f4ebd..0921f6adcd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java @@ -51,6 +51,7 @@ import org.apache.hadoop.util.DataChecksum; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.Tool; +import org.apache.hadoop.util.ToolRunner; /** * This class implements debug operations on the HDFS command-line. @@ -458,11 +459,14 @@ private void printUsage() { if (!command.name.equals("help")) { System.out.println(command.usageText); } + System.out.println(); + ToolRunner.printGenericCommandUsage(System.out); } } - public static void main(String[] argsArray) throws IOException { + public static void main(String[] argsArray) throws Exception { DebugAdmin debugAdmin = new DebugAdmin(new Configuration()); - System.exit(debugAdmin.run(argsArray)); + int res = ToolRunner.run(debugAdmin, argsArray); + System.exit(res); } }