From 1ceb0eeaf43d15e845e3fc6796539ff7bbaabd1b Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Wed, 15 Feb 2012 22:23:20 +0000 Subject: [PATCH] HADOOP-8074. Small bug in hadoop error message for unknown commands. Contributed by Colin Patrick McCabe git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1244766 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/FsShell.java | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index e6fe6e5c47e..bbaee1f50b5 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -190,6 +190,9 @@ Release 0.23.2 - UNRELEASED Double.MAX_VALUE) to avoid making Ganglia's gmetad core. (Varun Kapoor via mattf) + HADOOP-8074. Small bug in hadoop error message for unknown commands. + (Colin Patrick McCabe via eli) + Release 0.23.1 - 2012-02-08 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java index 376ea79586b..4da32789e5c 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java @@ -269,7 +269,15 @@ public class FsShell extends Configured implements Tool { private void displayError(String cmd, String message) { for (String line : message.split("\n")) { - System.err.println(cmd.substring(1) + ": " + line); + System.err.println(cmd + ": " + line); + if (cmd.charAt(0) != '-') { + Command instance = null; + instance = commandFactory.getInstance("-" + cmd); + if (instance != null) { + System.err.println("Did you mean -" + cmd + "? This command " + + "begins with a dash."); + } + } } }