> We should check whether the parameter is a valid class name before passing it to java.
I agree, but I don't see a way to do that in the bin/hadoop script.
HADOOP-435 we discussed moving all the 'if [$COMMAND = ...]' logic into a Java class, so that bin/hadoop might always invoke something like org.apache.hadoop.util.ToolRunner, which contains the 'if ((command.equals(...)))' logic. This is another good reason to do that, since, once you're in Java, it's easy to detect if a command names a class or not, and generate a nice error message if it does not.
So I think the best fix for this is to (at long last) move the command dispatch from bin/hadoop into a Java class.