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 "Yongjun Zhang (JIRA)" <ji...@apache.org> on 2014/12/30 06:19:13 UTC
[jira] [Resolved] (HADOOP-11453) Invalid mapping can be inserted to
nfs's id-name map
[ https://issues.apache.org/jira/browse/HADOOP-11453?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yongjun Zhang resolved HADOOP-11453.
------------------------------------
Resolution: Invalid
> Invalid mapping can be inserted to nfs's id-name map
> ----------------------------------------------------
>
> Key: HADOOP-11453
> URL: https://issues.apache.org/jira/browse/HADOOP-11453
> Project: Hadoop Common
> Issue Type: Bug
> Components: nfs
> Reporter: Yongjun Zhang
> Assignee: Yongjun Zhang
>
> See pasted code below from {{ShellBasedIdMapping#updateMapInternal}}, LineA could return null value when the entry is not in the static mapping. Since {{map}} allows null key, so it's possible that lineB would add entry <null, value> to the {{map}}. This is not the desired behavior.
> {code}
> final Integer key = staticMapping.get(parseId(nameId[1])); <====lineA
> final String value = nameId[0];
> if (map.containsKey(key)) {
> final String prevValue = map.get(key);
> if (value.equals(prevValue)) {
> // silently ignore equivalent entries
> continue;
> }
> reportDuplicateEntry(
> "Got multiple names associated with the same id: ",
> key, value, key, prevValue);
> continue;
> }
> if (map.containsValue(value)) {
> final Integer prevKey = map.inverse().get(value);
> reportDuplicateEntry(
> "Got multiple ids associated with the same name: ",
> key, value, prevKey, value);
> continue;
> }
> map.put(key, value); <==== lineB
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)