You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Xiao Chen (JIRA)" <ji...@apache.org> on 2016/08/08 19:19:20 UTC

[jira] [Commented] (HADOOP-13461) NPE in KeyProvider.rollNewVersion

    [ https://issues.apache.org/jira/browse/HADOOP-13461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15412303#comment-15412303 ] 

Xiao Chen commented on HADOOP-13461:
------------------------------------

Thanks [~coheig] 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
{code}
try {
  kp.rollNewVersion("unknown");
  assertTrue("should have thrown", false);
} catch (IOException e) {
  assertTrue(true);
}
{code}
to
{code}
try {
  kp.rollNewVersion("unknown");
  fail("should have thrown");
} catch (IOException e) {
  GenericTestUtils.assertExceptionContains("Can't find Metadata for key ", e);
}
{code}

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 [~ajisakaa] and [~eddyxu] for help. (Akira / Eddy, could you also help grant me committer permission so I can do it in the future? Thanks!)

> NPE in KeyProvider.rollNewVersion
> ---------------------------------
>
>                 Key: HADOOP-13461
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13461
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>            Reporter: Colm O hEigeartaigh
>            Priority: Minor
>             Fix For: 2.8.0, 2.7.3, 2.6.5, 3.0.0-alpha1
>
>         Attachments: HADOOP-13461.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org