diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java index e995cb6cc6f..428e8353ed5 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java @@ -578,8 +578,8 @@ public class ShellBasedIdMapping implements IdMappingServiceProvider { // We know the line is fine to parse without error checking like this // since it matched the regex above. String firstComponent = lineMatcher.group(1); - int remoteId = Integer.parseInt(lineMatcher.group(2)); - int localId = Integer.parseInt(lineMatcher.group(3)); + int remoteId = parseId(lineMatcher.group(2)); + int localId = parseId(lineMatcher.group(3)); if (firstComponent.equals("uid")) { uidMapping.put(localId, remoteId); } else { diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java index ec8ac1d4971..857c7068673 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestShellBasedIdMapping.java @@ -55,7 +55,9 @@ public class TestShellBasedIdMapping { "uid 13 302\n" + "gid\t11\t201\n" + // Tabs instead of spaces. "\n" + // Entirely empty line. - "gid 12 202"; + "gid 12 202\n" + + "uid 4294967294 123\n" + + "gid 4294967295 321"; OutputStream out = new FileOutputStream(tempStaticMapFile); out.write(staticMapFileContents.getBytes()); out.close(); @@ -71,6 +73,10 @@ public class TestShellBasedIdMapping { assertEquals(10000, (int)parsedMap.uidMapping.get(10001)); // Ensure pass-through of unmapped IDs works. assertEquals(1000, (int)parsedMap.uidMapping.get(1000)); + + assertEquals(-2, (int)parsedMap.uidMapping.get(123)); + assertEquals(-1, (int)parsedMap.gidMapping.get(321)); + } @Test diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 85254022d6e..8117383e2a2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -636,6 +636,9 @@ Release 2.7.0 - UNRELEASED HDFS-7456. De-duplicate AclFeature instances with same AclEntries do reduce memory footprint of NameNode (vinayakumarb) + HDFS-7563. NFS gateway parseStaticMap NumberFormatException + (Yongjun Zhang via brandonli) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES