Hadoop Common
  1. Hadoop Common
  2. HADOOP-462

DFSShell throws out arrayoutofbounds exceptions if the number of arguments is not right

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: None
    • Labels:
      None

      Description

      All the DFSShell commands do not check for the number of arguments. In DFSShell.run(), the args length is not checked before calling copyfromlocal, movefromlocal, copytolocal, and some others as well. This throws out arrrayoutofbounds exception in case lesser number of arguments is specified.

      1. dfsshell.patch.3
        15 kB
        dhruba borthakur

        Activity

        Hide
        dhruba borthakur added a comment -

        This patch ensures that a user does not see a java-stack trace if he/she encounters an error with DFSShell. Instead, an error message shouls get displayed.

        Show
        dhruba borthakur added a comment - This patch ensures that a user does not see a java-stack trace if he/she encounters an error with DFSShell. Instead, an error message shouls get displayed.
        Hide
        dhruba borthakur added a comment -

        Enhanced DFSShell to handle error conditions better. A user of DFSShell does not have to grind his/her teeth trying to decipher a java stack trace.

        Show
        dhruba borthakur added a comment - Enhanced DFSShell to handle error conditions better. A user of DFSShell does not have to grind his/her teeth trying to decipher a java stack trace.
        Hide
        Doug Cutting added a comment -

        Overall, this looks like a good change.

        In DFSShell.run(), instead of adding a 'exitCode=0' to every clause, why not change the 'else' clause to 'return -1'? That would save about 15 lines. Why the double-semicolons? And the 'else' clause you add is formatted non-standardly.

        There's a typo in the javadoc for setQuietMode().

        Show
        Doug Cutting added a comment - Overall, this looks like a good change. In DFSShell.run(), instead of adding a 'exitCode=0' to every clause, why not change the 'else' clause to 'return -1'? That would save about 15 lines. Why the double-semicolons? And the 'else' clause you add is formatted non-standardly. There's a typo in the javadoc for setQuietMode().
        Hide
        dhruba borthakur added a comment -

        Hi Doug,

        I am looking at it and will get back to you shortly.

        Thanks,
        dhruba

        Show
        dhruba borthakur added a comment - Hi Doug, I am looking at it and will get back to you shortly. Thanks, dhruba
        Hide
        dhruba borthakur added a comment -

        A new version of the patch with Doug's code review comments incorporated. This supercedes the earlier patch that was submitted.

        Show
        dhruba borthakur added a comment - A new version of the patch with Doug's code review comments incorporated. This supercedes the earlier patch that was submitted.
        Hide
        dhruba borthakur added a comment -

        Submitted patch with Doug's code review comments.

        Show
        dhruba borthakur added a comment - Submitted patch with Doug's code review comments.
        Hide
        Doug Cutting added a comment -

        You're still sometimes placing 'else' and 'catch' clauses on a new line, rather than on the same line as the preceding close brace.

        This could all really stand to be replaced by a commons-cli, but that's for another day...

        Show
        Doug Cutting added a comment - You're still sometimes placing 'else' and 'catch' clauses on a new line, rather than on the same line as the preceding close brace. This could all really stand to be replaced by a commons-cli, but that's for another day...
        Hide
        dhruba borthakur added a comment -

        I was not aware about the coding style for the exception catch statement. Fixed as per Doug's comments. This patch supercedes earlier attachments.

        Show
        dhruba borthakur added a comment - I was not aware about the coding style for the exception catch statement. Fixed as per Doug's comments. This patch supercedes earlier attachments.
        Hide
        dhruba borthakur added a comment -

        Changed coding style of catch-exception statements.

        Show
        dhruba borthakur added a comment - Changed coding style of catch-exception statements.
        Hide
        Doug Cutting added a comment -

        I just committed this. Thanks, Dhruba.

        Show
        Doug Cutting added a comment - I just committed this. Thanks, Dhruba.

          People

          • Assignee:
            dhruba borthakur
            Reporter:
            Mahadev konar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development