Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10329

Bad initialisation of StringBuffer in RequestHedgingProxyProvider.java

    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: ha
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      On line 167 of RequestHedgingProxyProvider.java, a StringBuilder is initialised like this:

      StringBuilder combinedInfo = new StringBuilder('[');
      

      This won't have the (presumably) desired effect of creating a StringBuilder containing the string "["; instead, it will create a StringBuilder with capacity 91 (the character code of '['). See here for an explanation.

      To fix this, pass a string literal instead of the character literal:

      StringBuilder combinedInfo = new StringBuilder("[");
      

        Issue Links

          Activity

          Hide
          linyiqun Yiqun Lin added a comment -

          Thanks Kihwal Lee for commit!

          Show
          linyiqun Yiqun Lin added a comment - Thanks Kihwal Lee for commit!
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-trunk-Commit #9671 (See https://builds.apache.org/job/Hadoop-trunk-Commit/9671/)
          HDFS-10329. Bad initialisation of StringBuffer in (kihwal: rev c6a2430b47692a72c500373d6fc1bce78652675b)

          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/RequestHedgingProxyProvider.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #9671 (See https://builds.apache.org/job/Hadoop-trunk-Commit/9671/ ) HDFS-10329 . Bad initialisation of StringBuffer in (kihwal: rev c6a2430b47692a72c500373d6fc1bce78652675b) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/RequestHedgingProxyProvider.java
          Hide
          kihwal Kihwal Lee added a comment -

          Thanks for reporting this, Max Schaefer and thanks for the patch, Yiqun Lin. The patch has been committed to trunk, branch-2 and branch-2.8.

          Show
          kihwal Kihwal Lee added a comment - Thanks for reporting this, Max Schaefer and thanks for the patch, Yiqun Lin . The patch has been committed to trunk, branch-2 and branch-2.8.
          Hide
          kihwal Kihwal Lee added a comment -

          +1

          Show
          kihwal Kihwal Lee added a comment - +1
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 13s 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 6m 38s trunk passed
          +1 compile 0m 41s trunk passed with JDK v1.8.0_92
          +1 compile 0m 41s trunk passed with JDK v1.7.0_95
          +1 checkstyle 0m 20s trunk passed
          +1 mvnsite 0m 52s trunk passed
          +1 mvneclipse 0m 14s trunk passed
          +1 findbugs 1m 54s trunk passed
          +1 javadoc 1m 7s trunk passed with JDK v1.8.0_92
          +1 javadoc 1m 47s trunk passed with JDK v1.7.0_95
          +1 mvninstall 0m 47s the patch passed
          +1 compile 0m 38s the patch passed with JDK v1.8.0_92
          +1 javac 0m 38s the patch passed
          +1 compile 0m 40s the patch passed with JDK v1.7.0_95
          +1 javac 0m 40s the patch passed
          +1 checkstyle 0m 18s the patch passed
          +1 mvnsite 0m 50s the patch passed
          +1 mvneclipse 0m 12s the patch passed
          +1 whitespace 0m 0s Patch has no whitespace issues.
          +1 findbugs 2m 9s the patch passed
          +1 javadoc 1m 5s the patch passed with JDK v1.8.0_92
          +1 javadoc 1m 41s the patch passed with JDK v1.7.0_95
          +1 unit 68m 30s hadoop-hdfs in the patch passed with JDK v1.8.0_92.
          -1 unit 70m 24s hadoop-hdfs in the patch failed with JDK v1.7.0_95.
          +1 asflicense 0m 20s Patch does not generate ASF License warnings.
          164m 4s



          Reason Tests
          JDK v1.7.0_95 Failed junit tests hadoop.hdfs.TestHFlush
            hadoop.hdfs.server.namenode.snapshot.TestOpenFilesWithSnapshot



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:fbe3e86
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12800776/HDFS-10329.001.patch
          JIRA Issue HDFS-10329
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux f13b2a62af8a 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 / 1a3f148
          Default Java 1.7.0_95
          Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_92 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_95
          findbugs v3.0.0
          unit https://builds.apache.org/job/PreCommit-HDFS-Build/15292/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs-jdk1.7.0_95.txt
          unit test logs https://builds.apache.org/job/PreCommit-HDFS-Build/15292/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs-jdk1.7.0_95.txt
          JDK v1.7.0_95 Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/15292/testReport/
          modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/15292/console
          Powered by Apache Yetus 0.2.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 13s 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 6m 38s trunk passed +1 compile 0m 41s trunk passed with JDK v1.8.0_92 +1 compile 0m 41s trunk passed with JDK v1.7.0_95 +1 checkstyle 0m 20s trunk passed +1 mvnsite 0m 52s trunk passed +1 mvneclipse 0m 14s trunk passed +1 findbugs 1m 54s trunk passed +1 javadoc 1m 7s trunk passed with JDK v1.8.0_92 +1 javadoc 1m 47s trunk passed with JDK v1.7.0_95 +1 mvninstall 0m 47s the patch passed +1 compile 0m 38s the patch passed with JDK v1.8.0_92 +1 javac 0m 38s the patch passed +1 compile 0m 40s the patch passed with JDK v1.7.0_95 +1 javac 0m 40s the patch passed +1 checkstyle 0m 18s the patch passed +1 mvnsite 0m 50s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s Patch has no whitespace issues. +1 findbugs 2m 9s the patch passed +1 javadoc 1m 5s the patch passed with JDK v1.8.0_92 +1 javadoc 1m 41s the patch passed with JDK v1.7.0_95 +1 unit 68m 30s hadoop-hdfs in the patch passed with JDK v1.8.0_92. -1 unit 70m 24s hadoop-hdfs in the patch failed with JDK v1.7.0_95. +1 asflicense 0m 20s Patch does not generate ASF License warnings. 164m 4s Reason Tests JDK v1.7.0_95 Failed junit tests hadoop.hdfs.TestHFlush   hadoop.hdfs.server.namenode.snapshot.TestOpenFilesWithSnapshot Subsystem Report/Notes Docker Image:yetus/hadoop:fbe3e86 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12800776/HDFS-10329.001.patch JIRA Issue HDFS-10329 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux f13b2a62af8a 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 / 1a3f148 Default Java 1.7.0_95 Multi-JDK versions /usr/lib/jvm/java-8-oracle:1.8.0_92 /usr/lib/jvm/java-7-openjdk-amd64:1.7.0_95 findbugs v3.0.0 unit https://builds.apache.org/job/PreCommit-HDFS-Build/15292/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs-jdk1.7.0_95.txt unit test logs https://builds.apache.org/job/PreCommit-HDFS-Build/15292/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs-jdk1.7.0_95.txt JDK v1.7.0_95 Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/15292/testReport/ modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs Console output https://builds.apache.org/job/PreCommit-HDFS-Build/15292/console Powered by Apache Yetus 0.2.0 http://yetus.apache.org This message was automatically generated.
          Hide
          linyiqun Yiqun Lin added a comment -

          Thanks Max Schaefer for reporting this. I checked for this, it's true that this line new StringBuilder('['); will just used the method java.lang.StringBuilder.StringBuilder(int capacity) rathan than java.lang.StringBuilder.StringBuilder(String str). Attach a simple patch from me to fix this.

          Show
          linyiqun Yiqun Lin added a comment - Thanks Max Schaefer for reporting this. I checked for this, it's true that this line new StringBuilder('['); will just used the method java.lang.StringBuilder.StringBuilder(int capacity) rathan than java.lang.StringBuilder.StringBuilder(String str) . Attach a simple patch from me to fix this.

            People

            • Assignee:
              linyiqun Yiqun Lin
              Reporter:
              xiemaisi Max Schaefer
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development