HDFS-7563. NFS gateway parseStaticMap NumberFormatException. Contributed by Yongjun Zhang
This commit is contained in:
parent
e7257acd8a
commit
892b1bb746
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue