Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13320

Fix arguments check in documentation for WordCount v2.0

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: documentation
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      This issue is affecting the documentation page, so the code is not covered by any tests. It's actually visible on the page:
      https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Example:_WordCount_v2.0
      On the Example: WordCount v2.0

      The actual arguments check is wrong, as it's never printing the message of the correct usage. So, running the code with no parameters, as in the following example:

      yarn jar /var/tmp/WordCount.jar task0.WordCount2
      

      I have got the following exception message in output:

      Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
          at java.util.ArrayList.rangeCheck(ArrayList.java:635)
          at java.util.ArrayList.get(ArrayList.java:411)
          at task0.WordCount2.main(WordCount2.java:131)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
          at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      

      Intead than the expected friendly message:

       Usage: wordcount <in> <out> [-skip skipPatternFile]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                niccolo.becchi niccolo becchi
                Reporter:
                niccolo.becchi niccolo becchi
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: