Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.2, 2.6.4
    • Fix Version/s: 2.9.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None

      Description

      When KeyProvider.rollNewVersion(String name) is called, it first gets the metadata for the given name. The javadoc states that the getMetadata(String name) method can return null if the key doesn't exist. However rollNewVersion throws a NPE if the returned metadata is null.

      1. HADOOP-13461.patch
        3 kB
        Colm O hEigeartaigh

        Activity

        Hide
        xiaochen Xiao Chen added a comment -

        Thanks Colm O hEigeartaigh for reporting the issue and providing a fix. The fix looks good.

        Nits in the test:

        • We usually assert an exception by Assert.fail after the line where an exception is expected, and then verify the exception caught is what we wanted. So in this case, we can change
          try {
            kp.rollNewVersion("unknown");
            assertTrue("should have thrown", false);
          } catch (IOException e) {
            assertTrue(true);
          }
          

          to

          try {
            kp.rollNewVersion("unknown");
            fail("should have thrown");
          } catch (IOException e) {
            GenericTestUtils.assertExceptionContains("Can't find Metadata for key ", e);
          }
          

        We usually use Affect / Target versions when filing a jira. Fix Versions are used to track where the jira is actually committed, and are set by committers at check-in time. Please correct it, and refer to https://wiki.apache.org/hadoop/HowToContribute for details.

        And I see you cannot assign the jira to yourself now. Sorry about the inconvenience, there are jira permission requirements need to be set. I can't do that yet, ping Akira Ajisaka and Lei (Eddy) Xu for help. (Akira / Eddy, could you also help grant me committer permission so I can do it in the future? Thanks!)

        Show
        xiaochen Xiao Chen added a comment - Thanks Colm O hEigeartaigh for reporting the issue and providing a fix. The fix looks good. Nits in the test: We usually assert an exception by Assert.fail after the line where an exception is expected, and then verify the exception caught is what we wanted. So in this case, we can change try { kp.rollNewVersion( "unknown" ); assertTrue( "should have thrown" , false ); } catch (IOException e) { assertTrue( true ); } to try { kp.rollNewVersion( "unknown" ); fail( "should have thrown" ); } catch (IOException e) { GenericTestUtils.assertExceptionContains( "Can't find Metadata for key " , e); } We usually use Affect / Target versions when filing a jira. Fix Versions are used to track where the jira is actually committed, and are set by committers at check-in time. Please correct it, and refer to https://wiki.apache.org/hadoop/HowToContribute for details. And I see you cannot assign the jira to yourself now. Sorry about the inconvenience, there are jira permission requirements need to be set. I can't do that yet, ping Akira Ajisaka and Lei (Eddy) Xu for help. (Akira / Eddy, could you also help grant me committer permission so I can do it in the future? Thanks!)
        Hide
        eddyxu Lei (Eddy) Xu added a comment -

        Xiao Chen Done.

        Show
        eddyxu Lei (Eddy) Xu added a comment - Xiao Chen Done.
        Hide
        coheigea Colm O hEigeartaigh added a comment -

        Resubmitting patch following feedback.

        Show
        coheigea Colm O hEigeartaigh added a comment - Resubmitting patch following feedback.
        Hide
        coheigea Colm O hEigeartaigh added a comment -

        Thanks Xiao Chen, I've removed the FixVersion(s) field, and changed Affects Versions(s) to 2.7.2 + 2.6.4. I've also made the fixes you suggested and reattached the patch.

        Colm.

        Show
        coheigea Colm O hEigeartaigh added a comment - Thanks Xiao Chen , I've removed the FixVersion(s) field, and changed Affects Versions(s) to 2.7.2 + 2.6.4. I've also made the fixes you suggested and reattached the patch. Colm.
        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 appears to include 1 new or modified test files.
        +1 mvninstall 6m 33s trunk passed
        +1 compile 6m 44s trunk passed
        +1 checkstyle 0m 24s trunk passed
        +1 mvnsite 0m 56s trunk passed
        +1 mvneclipse 0m 13s trunk passed
        +1 findbugs 1m 18s trunk passed
        +1 javadoc 0m 44s trunk passed
        +1 mvninstall 0m 36s the patch passed
        +1 compile 6m 41s the patch passed
        +1 javac 6m 41s the patch passed
        -0 checkstyle 0m 23s hadoop-common-project/hadoop-common: The patch generated 1 new + 29 unchanged - 0 fixed = 30 total (was 29)
        +1 mvnsite 0m 52s the patch passed
        +1 mvneclipse 0m 13s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 1m 25s the patch passed
        +1 javadoc 0m 45s the patch passed
        -1 unit 7m 35s hadoop-common in the patch failed.
        +1 asflicense 0m 21s The patch does not generate ASF License warnings.
        37m 16s



        Reason Tests
        Failed junit tests hadoop.net.TestDNS



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12822760/HADOOP-13461.patch
        JIRA Issue HADOOP-13461
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux af7f2c5cfa18 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 / 82c9e06
        Default Java 1.8.0_101
        findbugs v3.0.0
        checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/artifact/patchprocess/diff-checkstyle-hadoop-common-project_hadoop-common.txt
        unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/testReport/
        modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT 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 appears to include 1 new or modified test files. +1 mvninstall 6m 33s trunk passed +1 compile 6m 44s trunk passed +1 checkstyle 0m 24s trunk passed +1 mvnsite 0m 56s trunk passed +1 mvneclipse 0m 13s trunk passed +1 findbugs 1m 18s trunk passed +1 javadoc 0m 44s trunk passed +1 mvninstall 0m 36s the patch passed +1 compile 6m 41s the patch passed +1 javac 6m 41s the patch passed -0 checkstyle 0m 23s hadoop-common-project/hadoop-common: The patch generated 1 new + 29 unchanged - 0 fixed = 30 total (was 29) +1 mvnsite 0m 52s the patch passed +1 mvneclipse 0m 13s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 25s the patch passed +1 javadoc 0m 45s the patch passed -1 unit 7m 35s hadoop-common in the patch failed. +1 asflicense 0m 21s The patch does not generate ASF License warnings. 37m 16s Reason Tests Failed junit tests hadoop.net.TestDNS Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12822760/HADOOP-13461.patch JIRA Issue HADOOP-13461 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux af7f2c5cfa18 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 / 82c9e06 Default Java 1.8.0_101 findbugs v3.0.0 checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/artifact/patchprocess/diff-checkstyle-hadoop-common-project_hadoop-common.txt unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10210/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        xiaochen Xiao Chen added a comment -

        Thanks Colm O hEigeartaigh, could you fix the checkstyle? Other than that LGTM.

        Also, thanks Eddy and Akira for your help!

        Show
        xiaochen Xiao Chen added a comment - Thanks Colm O hEigeartaigh , could you fix the checkstyle? Other than that LGTM. Also, thanks Eddy and Akira for your help!
        Hide
        coheigea Colm O hEigeartaigh added a comment -

        OK latest patch fixes checkstyle.

        Show
        coheigea Colm O hEigeartaigh added a comment - OK latest patch fixes checkstyle.
        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 appears to include 1 new or modified test files.
        +1 mvninstall 8m 21s trunk passed
        +1 compile 7m 50s trunk passed
        +1 checkstyle 0m 24s trunk passed
        +1 mvnsite 1m 6s trunk passed
        +1 mvneclipse 0m 14s trunk passed
        +1 findbugs 1m 36s trunk passed
        +1 javadoc 0m 50s trunk passed
        +1 mvninstall 0m 47s the patch passed
        +1 compile 7m 50s the patch passed
        +1 javac 7m 50s the patch passed
        +1 checkstyle 0m 24s the patch passed
        +1 mvnsite 0m 54s the patch passed
        +1 mvneclipse 0m 12s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 1m 37s the patch passed
        +1 javadoc 0m 45s the patch passed
        +1 unit 8m 11s hadoop-common in the patch passed.
        +1 asflicense 0m 20s The patch does not generate ASF License warnings.
        42m 59s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12823007/HADOOP-13461.patch
        JIRA Issue HADOOP-13461
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux e55ba062b992 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 / d00d3ad
        Default Java 1.8.0_101
        findbugs v3.0.0
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10220/testReport/
        modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10220/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT 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 appears to include 1 new or modified test files. +1 mvninstall 8m 21s trunk passed +1 compile 7m 50s trunk passed +1 checkstyle 0m 24s trunk passed +1 mvnsite 1m 6s trunk passed +1 mvneclipse 0m 14s trunk passed +1 findbugs 1m 36s trunk passed +1 javadoc 0m 50s trunk passed +1 mvninstall 0m 47s the patch passed +1 compile 7m 50s the patch passed +1 javac 7m 50s the patch passed +1 checkstyle 0m 24s the patch passed +1 mvnsite 0m 54s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 37s the patch passed +1 javadoc 0m 45s the patch passed +1 unit 8m 11s hadoop-common in the patch passed. +1 asflicense 0m 20s The patch does not generate ASF License warnings. 42m 59s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12823007/HADOOP-13461.patch JIRA Issue HADOOP-13461 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux e55ba062b992 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 / d00d3ad Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10220/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10220/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        xiaochen Xiao Chen added a comment -

        +1 to the latest patch.

        Show
        xiaochen Xiao Chen added a comment - +1 to the latest patch.
        Hide
        xiaochen Xiao Chen added a comment -

        I have committed this to trunk and branch-2. Thanks for the contribution, Colm O hEigeartaigh!

        Show
        xiaochen Xiao Chen added a comment - I have committed this to trunk and branch-2. Thanks for the contribution, Colm O hEigeartaigh !
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Hadoop-trunk-Commit #10257 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10257/)
        HADOOP-13461. NPE in KeyProvider.rollNewVersion. Contributed by Colm O (xiao: rev e83be44af530d57d9c49cd989d030052548a068b)

        • hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java
        • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestKeyProvider.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-trunk-Commit #10257 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10257/ ) HADOOP-13461 . NPE in KeyProvider.rollNewVersion. Contributed by Colm O (xiao: rev e83be44af530d57d9c49cd989d030052548a068b) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestKeyProvider.java

          People

          • Assignee:
            coheigea Colm O hEigeartaigh
            Reporter:
            coheigea Colm O hEigeartaigh
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development