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

Akira AJISAKA commented on HADOOP-11545:
----------------------------------------

Thanks [~brahmareddy] for updating the patch. Some comments are below.
{code}
+  private boolean checkArgs(int index, String[] args) {
+    if (index == args.length) {
+      printCredShellUsage();
+
+    }
+    return false;
+  }
{code}
1. The method always returns false, so {{init()}} does not return -1 if the 
length of args is wrong. I'm thinking it is sufficient to add the code into 
{{init()}} as follows:
{code}
if (i == args.length - 1) {
  printCredShellUsage();
  return -1;
}
{code}

{code}
-        "delete <alias> [-provider] [-f] [-help]";
+        "delete <alias> [-i][-provider provider-path]";
{code}
2. "-i" is not supported, so would you remove "-i" and keep "-f"?

{code}
-    public static final String USAGE = "create <alias> [-provider] [-help]";
+    public static final String USAGE =
+        "create <alias> [-v value][-provider provider-path]";
{code}
3. "-v" should be undocumented. The option is used only by test.
4. Would you add a test to confirm the return value of {{init()}} as specified 
by passing right/wrong arguments?

> ArrayIndexOutOfBoundsException is thrown with hadoop credential list -provider
> ------------------------------------------------------------------------------
>
>                 Key: HADOOP-11545
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11545
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 2.6.0
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-11545-002.patch, HADOOP-11545-003.patch, 
> HADOOP-11545-004.patch, HADOOP-11545-005.patch, HDFS-11545-001.patch
>
>
> Scenario:
> ========
> Please run the following command . dn't give the provider path.
> {noformat}
> [hdfs@host194 bin]$ ./hadoop credential list -provider
> java.lang.ArrayIndexOutOfBoundsException: 2
>         at 
> org.apache.hadoop.security.alias.CredentialShell.init(CredentialShell.java:117)
>         at 
> org.apache.hadoop.security.alias.CredentialShell.run(CredentialShell.java:63)
>         at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
>         at 
> org.apache.hadoop.security.alias.CredentialShell.main(CredentialShell.java:427)
> {noformat}



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

Reply via email to