You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Allen Wittenauer (JIRA)" <ji...@apache.org> on 2014/09/14 21:16:34 UTC

[jira] [Comment Edited] (HADOOP-11092) hadoop shell commands should print usage if not given a class

    [ https://issues.apache.org/jira/browse/HADOOP-11092?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14133353#comment-14133353 ] 

Allen Wittenauer edited comment on HADOOP-11092 at 9/14/14 7:16 PM:
--------------------------------------------------------------------

This breaks stuff.

The big problem is that the patch assumes that every main method that one could call in the java code is documented in the shell code.  This is definitely incorrect.  In fact, the code has in the usage section:

{code}
   echo " or"
   echo "  CLASSNAME            run the class named CLASSNAME"
{code}

In other words, that catchall at the end is meant to be a class.  Thus why one throws a java error when one gives a broken subcommand.

That said, what could be done here is that the code check for periods. If the catch-all doesn't contain a period, there is a 99% likelihood that it isn't a class but a typo.  


was (Author: aw):
This breaks stuff.

The big problem is that the patch assumes that every main method that one could call in the java code is documented in the hdfs subcommand.  This is definitely incorrect.  In fact, the code has in the usage section:

{code}
   echo " or"
   echo "  CLASSNAME            run the class named CLASSNAME"
{code}

In other words, that catchall at the end is meant to be a class.  Thus why one throws a java error when one gives a broken subcommand.

That said, what could be done here is that the code check for periods. If the catch-all doesn't contain a period, there is a 99% likelihood that it isn't a class but a typo.  

> hadoop shell commands should print usage if not given a class
> -------------------------------------------------------------
>
>                 Key: HADOOP-11092
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11092
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: scripts
>            Reporter: Bruno Mahé
>              Labels: bigtop, noob
>         Attachments: HDFS-2565.patch, HDFS-2565.patch
>
>
> [root@bigtop-fedora-15 ~]# hdfs foobar
> Exception in thread "main" java.lang.NoClassDefFoundError: foobar
> Caused by: java.lang.ClassNotFoundException: foobar
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> Could not find the main class: foobar. Program will exit.
> Instead of loading any class, it would be nice to explain the command is not valid and to call print_usage()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)