Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-6730

Use StandardCharsets instead of String overload in TextOutputFormat

    Details

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

      Description

      In TextOutputFormat.java, instead of:

      private static final String utf8 = "UTF-8";
      private static final byte[] newline;
      static {
        try {
          newline = "\n".getBytes(utf8);
        } catch (UnsupportedException uee) {
          threw new IllegalArgumentException("can't find " + utf8 + " encoding");
        }
      }
      

      Let's do something like:

      private static final byte[] newline = "\n".getBytes(StandardCharsets.UTF_8);
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user SahilKang opened a pull request:

          https://github.com/apache/hadoop/pull/114

          MAPREDUCE-6730 Use StandardCharsets instead of String overload

          Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/SahilKang/hadoop trunk

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/hadoop/pull/114.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #114


          commit f234dd88bce1189de9a5286eb7326453f9997d0a
          Author: Sahil Kang <sahil.kang@asilaycomputing.com>
          Date: 2016-07-11T04:32:57Z

          MAPREDUCE-6730 Use StandardCharsets

          Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user SahilKang opened a pull request: https://github.com/apache/hadoop/pull/114 MAPREDUCE-6730 Use StandardCharsets instead of String overload Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String). You can merge this pull request into a Git repository by running: $ git pull https://github.com/SahilKang/hadoop trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/hadoop/pull/114.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #114 commit f234dd88bce1189de9a5286eb7326453f9997d0a Author: Sahil Kang <sahil.kang@asilaycomputing.com> Date: 2016-07-11T04:32:57Z MAPREDUCE-6730 Use StandardCharsets Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user SahilKang closed the pull request at:

          https://github.com/apache/hadoop/pull/114

          Show
          githubbot ASF GitHub Bot added a comment - Github user SahilKang closed the pull request at: https://github.com/apache/hadoop/pull/114
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user SahilKang reopened a pull request:

          https://github.com/apache/hadoop/pull/114

          MAPREDUCE-6730 Use StandardCharsets instead of String overload

          Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/SahilKang/hadoop trunk

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/hadoop/pull/114.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #114


          commit f234dd88bce1189de9a5286eb7326453f9997d0a
          Author: Sahil Kang <sahil.kang@asilaycomputing.com>
          Date: 2016-07-11T04:32:57Z

          MAPREDUCE-6730 Use StandardCharsets

          Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user SahilKang reopened a pull request: https://github.com/apache/hadoop/pull/114 MAPREDUCE-6730 Use StandardCharsets instead of String overload Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String). You can merge this pull request into a Git repository by running: $ git pull https://github.com/SahilKang/hadoop trunk Alternatively you can review and apply these changes as the patch at: https://github.com/apache/hadoop/pull/114.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #114 commit f234dd88bce1189de9a5286eb7326453f9997d0a Author: Sahil Kang <sahil.kang@asilaycomputing.com> Date: 2016-07-11T04:32:57Z MAPREDUCE-6730 Use StandardCharsets Use String.getBytes(StandardCharsets.UTF_8) instead of String.getBytes(String).
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 21s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 mvninstall 7m 29s trunk passed
          +1 compile 0m 25s trunk passed
          +1 checkstyle 0m 17s trunk passed
          +1 mvnsite 0m 30s trunk passed
          +1 mvneclipse 0m 13s trunk passed
          +1 findbugs 0m 52s trunk passed
          +1 javadoc 0m 22s trunk passed
          +1 mvninstall 0m 22s the patch passed
          +1 compile 0m 22s the patch passed
          +1 javac 0m 22s the patch passed
          -1 checkstyle 0m 13s hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core: The patch generated 2 new + 10 unchanged - 2 fixed = 12 total (was 12)
          +1 mvnsite 0m 26s the patch passed
          +1 mvneclipse 0m 10s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 0m 55s the patch passed
          +1 javadoc 0m 20s the patch passed
          +1 unit 2m 3s hadoop-mapreduce-client-core in the patch passed.
          +1 asflicense 0m 15s The patch does not generate ASF License warnings.
          16m 17s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Issue MAPREDUCE-6730
          GITHUB PR https://github.com/apache/hadoop/pull/114
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux cf7f7ca484fd 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 95f2b98
          Default Java 1.8.0_101
          findbugs v3.0.0
          checkstyle https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/artifact/patchprocess/diff-checkstyle-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-core.txt
          Test Results https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/testReport/
          modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core
          Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/console
          Powered by Apache Yetus 0.3.0 http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 21s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 7m 29s trunk passed +1 compile 0m 25s trunk passed +1 checkstyle 0m 17s trunk passed +1 mvnsite 0m 30s trunk passed +1 mvneclipse 0m 13s trunk passed +1 findbugs 0m 52s trunk passed +1 javadoc 0m 22s trunk passed +1 mvninstall 0m 22s the patch passed +1 compile 0m 22s the patch passed +1 javac 0m 22s the patch passed -1 checkstyle 0m 13s hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core: The patch generated 2 new + 10 unchanged - 2 fixed = 12 total (was 12) +1 mvnsite 0m 26s the patch passed +1 mvneclipse 0m 10s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 0m 55s the patch passed +1 javadoc 0m 20s the patch passed +1 unit 2m 3s hadoop-mapreduce-client-core in the patch passed. +1 asflicense 0m 15s The patch does not generate ASF License warnings. 16m 17s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue MAPREDUCE-6730 GITHUB PR https://github.com/apache/hadoop/pull/114 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux cf7f7ca484fd 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 95f2b98 Default Java 1.8.0_101 findbugs v3.0.0 checkstyle https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/artifact/patchprocess/diff-checkstyle-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-core.txt Test Results https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/testReport/ modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/console Powered by Apache Yetus 0.3.0 http://yetus.apache.org This message was automatically generated.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user aajisaka commented on the issue:

          https://github.com/apache/hadoop/pull/114

          Hi @SahilKang, thank you for reporting this issue and creating the patch.

          Show
          githubbot ASF GitHub Bot added a comment - Github user aajisaka commented on the issue: https://github.com/apache/hadoop/pull/114 Hi @SahilKang, thank you for reporting this issue and creating the patch. Would you fix the checkstyle warnings? https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6651/artifact/patchprocess/diff-checkstyle-hadoop-mapreduce-project_hadoop-mapreduce-client_hadoop-mapreduce-client-core.txt Would you fix org.apache.hadoop.mapred.TextOutputFormat as well?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user SahilKang commented on the issue:

          https://github.com/apache/hadoop/pull/114

          @aajisaka, this latest commit should fix the two checkstyle warnings, and I'll send another patch soon with the analogous changes made to org.apache.hadoop.mapred.TextOutputFormat.

          Show
          githubbot ASF GitHub Bot added a comment - Github user SahilKang commented on the issue: https://github.com/apache/hadoop/pull/114 @aajisaka, this latest commit should fix the two checkstyle warnings, and I'll send another patch soon with the analogous changes made to org.apache.hadoop.mapred.TextOutputFormat.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user aajisaka commented on the issue:

          https://github.com/apache/hadoop/pull/114

          +1 pending Jenkins. Thanks @SahilKang for the update.

          Show
          githubbot ASF GitHub Bot added a comment - Github user aajisaka commented on the issue: https://github.com/apache/hadoop/pull/114 +1 pending Jenkins. Thanks @SahilKang for the update.
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 19s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 mvninstall 7m 41s trunk passed
          +1 compile 0m 25s trunk passed
          +1 checkstyle 0m 20s trunk passed
          +1 mvnsite 0m 30s trunk passed
          +1 mvneclipse 0m 14s trunk passed
          +1 findbugs 0m 50s trunk passed
          +1 javadoc 0m 21s trunk passed
          +1 mvninstall 0m 21s the patch passed
          +1 compile 0m 20s the patch passed
          +1 javac 0m 20s the patch passed
          +1 checkstyle 0m 13s hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core: The patch generated 0 new + 18 unchanged - 4 fixed = 18 total (was 22)
          +1 mvnsite 0m 26s the patch passed
          +1 mvneclipse 0m 10s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 0m 54s the patch passed
          +1 javadoc 0m 18s the patch passed
          +1 unit 2m 2s hadoop-mapreduce-client-core in the patch passed.
          +1 asflicense 0m 17s The patch does not generate ASF License warnings.
          16m 20s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Issue MAPREDUCE-6730
          GITHUB PR https://github.com/apache/hadoop/pull/114
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux e3892c39f5db 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 08e3338
          Default Java 1.8.0_101
          findbugs v3.0.0
          Test Results https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6658/testReport/
          modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core
          Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6658/console
          Powered by Apache Yetus 0.3.0 http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 19s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 7m 41s trunk passed +1 compile 0m 25s trunk passed +1 checkstyle 0m 20s trunk passed +1 mvnsite 0m 30s trunk passed +1 mvneclipse 0m 14s trunk passed +1 findbugs 0m 50s trunk passed +1 javadoc 0m 21s trunk passed +1 mvninstall 0m 21s the patch passed +1 compile 0m 20s the patch passed +1 javac 0m 20s the patch passed +1 checkstyle 0m 13s hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core: The patch generated 0 new + 18 unchanged - 4 fixed = 18 total (was 22) +1 mvnsite 0m 26s the patch passed +1 mvneclipse 0m 10s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 0m 54s the patch passed +1 javadoc 0m 18s the patch passed +1 unit 2m 2s hadoop-mapreduce-client-core in the patch passed. +1 asflicense 0m 17s The patch does not generate ASF License warnings. 16m 20s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue MAPREDUCE-6730 GITHUB PR https://github.com/apache/hadoop/pull/114 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux e3892c39f5db 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 08e3338 Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6658/testReport/ modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/6658/console Powered by Apache Yetus 0.3.0 http://yetus.apache.org This message was automatically generated.
          Hide
          ajisakaa Akira Ajisaka added a comment -

          Checking this in.

          Show
          ajisakaa Akira Ajisaka added a comment - Checking this in.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/hadoop/pull/114

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/hadoop/pull/114
          Hide
          ajisakaa Akira Ajisaka added a comment -

          Committed this to trunk, branch-2, and branch-2.8. Thanks Sahil Kang for the contribution!

          Show
          ajisakaa Akira Ajisaka added a comment - Committed this to trunk, branch-2, and branch-2.8. Thanks Sahil Kang for the contribution!
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-trunk-Commit #10213 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10213/)
          MAPREDUCE-6730. Use StandardCharsets instead of String overload in (aajisaka: rev 70c278115249898132490a89a548fd936c09f54b)

          • hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TextOutputFormat.java
          • hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/TextOutputFormat.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-trunk-Commit #10213 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10213/ ) MAPREDUCE-6730 . Use StandardCharsets instead of String overload in (aajisaka: rev 70c278115249898132490a89a548fd936c09f54b) hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TextOutputFormat.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/TextOutputFormat.java

            People

            • Assignee:
              ssk Sahil Kang
              Reporter:
              ssk Sahil Kang
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development