hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-3281) bin/hadoop script should check class name before running java
Date Thu, 01 May 2008 16:34:55 GMT

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

Doug Cutting commented on HADOOP-3281:
--------------------------------------

> 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.

In 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.

> bin/hadoop script should check class name before running java
> -------------------------------------------------------------
>
>                 Key: HADOOP-3281
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3281
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Edward J. Yoon
>             Fix For: 0.18.0
>
>         Attachments: 3281.patch
>
>
> When the first parameter ($1) cannot be matched with one of existing hadoop commnads,
the parameter will be considered as a class name and the script will pass it to java.  For
examples,
> {noformat}
> bash-3.2$ ./bin/hadoop -version
> java version "1.5.0_14"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
> bash-3.2$ ./bin/hadoop -help   
> Usage: java [-options] class [args...]
>            (to execute a class)
>    or  java [-options] -jar jarfile [args...]
>            (to execute a jar file)
> ...
> {noformat}
> The behavior above is confusing.  We should check whether the parameter is a valid class
name before passing it to java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message