浏览代码

HADOOP-11150. hadoop command should show the reason on failure by invalid COMMAND or CLASSNAME (Masatake Iwasaki via aw)

Allen Wittenauer 10 年之前
父节点
当前提交
aee68b67f3

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -138,6 +138,9 @@ Trunk (Unreleased)
     HADOOP-11025. hadoop-daemons.sh should just call hdfs directly (Masatake
     Iwasaki via aw)
 
+    HADOOP-11150. hadoop command should show the reason on failure by 
+    invalid COMMAND or CLASSNAME (Masatake Iwasaki via aw)
+
   BUG FIXES
 
     HADOOP-9451. Fault single-layer config if node group topology is enabled.

+ 3 - 0
hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh

@@ -286,6 +286,9 @@ function hadoop_validate_classname
   shift 1
 
   if [[ ! ${class} =~ \. ]]; then
+    # assuming the arg is typo of command if it does not conatain ".".
+    # class belonging to no package is not allowed as a result.
+    hadoop_error "ERROR: ${class} is not COMMAND nor fully qualified CLASSNAME."
     return 1
   fi
   return 0