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

WebHDFS truncate throws NullPointerException if newLength is not provided

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.1
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: webhdfs
    • Labels:
      None
    • Environment:

      Centos6

    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      $ curl -X POST "http://namenode:50070/webhdfs/v1/foo?op=truncate"
      {"RemoteException":{"exception":"NullPointerException","javaClassName":"java.lang.NullPointerException","message":null}}

      We should change newLength to be a required parameter in the webhdfs documentation (https://hadoop.apache.org/docs/r2.7.1/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#New_Length), and throw an IllegalArgumentException if isn't provided.

      1. HDFS-9302_00.patch
        1 kB
        Jagadesh Kiran N
      2. HDFS-9302_01.patch
        1 kB
        Jagadesh Kiran N

        Issue Links

          Activity

          Hide
          hitliuyi Yi Liu added a comment -

          Karthik Palaniappan, thanks for reporting this, it's better to return a better exception and error msg to user if there is no newLength.
          This can be done by checking whether newLength is null string (NewLengthParam#DEFAULT) in NamenodeWebHdfsMethods, feel free to upload a patch to fix it.

          In the document, the newLength is already a required parameter, for any optional parameter, there is []

          Show
          hitliuyi Yi Liu added a comment - Karthik Palaniappan , thanks for reporting this, it's better to return a better exception and error msg to user if there is no newLength . This can be done by checking whether newLength is null string (NewLengthParam#DEFAULT) in NamenodeWebHdfsMethods , feel free to upload a patch to fix it. In the document, the newLength is already a required parameter, for any optional parameter, there is []
          Hide
          jagadesh.kiran Jagadesh Kiran N added a comment -

          Hi , i would like to work on this issue, Karthik Palaniappan if you have already started, please assign it to you

          Show
          jagadesh.kiran Jagadesh Kiran N added a comment - Hi , i would like to work on this issue, Karthik Palaniappan if you have already started, please assign it to you
          Hide
          jagadesh.kiran Jagadesh Kiran N added a comment -

          Attached the patch Yi Liu ,please review

          Show
          jagadesh.kiran Jagadesh Kiran N added a comment - Attached the patch Yi Liu ,please review
          Hide
          hadoopqa Hadoop QA added a comment -



          -1 overall



          Vote Subsystem Runtime Comment
          -1 pre-patch 17m 56s Pre-patch trunk has 1 extant Findbugs (version 3.0.0) warnings.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 tests included 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 javac 7m 46s There were no new javac warning messages.
          +1 javadoc 10m 22s There were no new javadoc warning messages.
          +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings.
          +1 checkstyle 1m 24s There were no new checkstyle issues.
          -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.
          +1 install 1m 31s mvn install still works.
          +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse.
          +1 findbugs 2m 33s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
          +1 native 3m 16s Pre-build of native portion
          -1 hdfs tests 50m 0s Tests failed in hadoop-hdfs.
              95m 49s  



          Reason Tests
          Failed unit tests hadoop.hdfs.server.datanode.TestDataNodeHotSwapVolumes
            hadoop.hdfs.shortcircuit.TestShortCircuitCache



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12769001/HDFS-9302_00.patch
          Optional Tests javadoc javac unit findbugs checkstyle
          git revision trunk / c28e16b
          Pre-patch Findbugs warnings https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/trunkFindbugsWarningshadoop-hdfs.html
          whitespace https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/whitespace.txt
          hadoop-hdfs test log https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/testrun_hadoop-hdfs.txt
          Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/13226/testReport/
          Java 1.7.0_55
          uname Linux asf904.gq1.ygridcore.net 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
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/13226/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment -1 pre-patch 17m 56s Pre-patch trunk has 1 extant Findbugs (version 3.0.0) warnings. +1 @author 0m 0s The patch does not contain any @author tags. -1 tests included 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 javac 7m 46s There were no new javac warning messages. +1 javadoc 10m 22s There were no new javadoc warning messages. +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 1m 24s There were no new checkstyle issues. -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix. +1 install 1m 31s mvn install still works. +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse. +1 findbugs 2m 33s The patch does not introduce any new Findbugs (version 3.0.0) warnings. +1 native 3m 16s Pre-build of native portion -1 hdfs tests 50m 0s Tests failed in hadoop-hdfs.     95m 49s   Reason Tests Failed unit tests hadoop.hdfs.server.datanode.TestDataNodeHotSwapVolumes   hadoop.hdfs.shortcircuit.TestShortCircuitCache Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12769001/HDFS-9302_00.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / c28e16b Pre-patch Findbugs warnings https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/trunkFindbugsWarningshadoop-hdfs.html whitespace https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/whitespace.txt hadoop-hdfs test log https://builds.apache.org/job/PreCommit-HDFS-Build/13226/artifact/patchprocess/testrun_hadoop-hdfs.txt Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/13226/testReport/ Java 1.7.0_55 uname Linux asf904.gq1.ygridcore.net 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 Console output https://builds.apache.org/job/PreCommit-HDFS-Build/13226/console This message was automatically generated.
          Hide
          hitliuyi Yi Liu added a comment -

          Looks good, Jagadesh.
          Just a small nit, +1 after addressing

          • please put the check above the code comment "// We treat each rest request as a separate client."
          Show
          hitliuyi Yi Liu added a comment - Looks good, Jagadesh. Just a small nit, +1 after addressing please put the check above the code comment "// We treat each rest request as a separate client."
          Hide
          jagadesh.kiran Jagadesh Kiran N added a comment -

          Thanks Yi Liu for your review, i have updated the patch as per your comments please review

          Show
          jagadesh.kiran Jagadesh Kiran N added a comment - Thanks Yi Liu for your review, i have updated the patch as per your comments please review
          Hide
          ajisakaa Akira Ajisaka added a comment -

          LGTM, +1.

          Show
          ajisakaa Akira Ajisaka added a comment - LGTM, +1.
          Hide
          hitliuyi Yi Liu added a comment -

          OK, thanks Jagadesh, Akira, will commit shortly.

          Show
          hitliuyi Yi Liu added a comment - OK, thanks Jagadesh, Akira, will commit shortly.
          Hide
          hitliuyi Yi Liu added a comment -

          Committed to trunk and branch-2.

          Show
          hitliuyi Yi Liu added a comment - Committed to trunk and branch-2.
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-trunk-Commit #8717 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8717/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8717 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8717/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk #2536 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2536/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2536 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2536/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #606 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/606/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #606 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/606/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk #1329 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1329/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #1329 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1329/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #593 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/593/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #593 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/593/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk #2483 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2483/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2483 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2483/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #545 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/545/)
          HDFS-9302. WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7)

          • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
          • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #545 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/545/ ) HDFS-9302 . WebHDFS throws NullPointerException if newLength is not (yliu: rev 6ff6663f64476eab5612ae9eb409104f44c6e6c7) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
          Hide
          Karthik Palaniappan Karthik Palaniappan added a comment -

          Thanks for fixing this so quickly--it turns out the JIRA emails all ended up in my Junk folder :/

          +1 on the patch!

          Show
          Karthik Palaniappan Karthik Palaniappan added a comment - Thanks for fixing this so quickly--it turns out the JIRA emails all ended up in my Junk folder :/ +1 on the patch!

            People

            • Assignee:
              jagadesh.kiran Jagadesh Kiran N
              Reporter:
              Karthik Palaniappan Karthik Palaniappan
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development