MAPREDUCE-3930. Fixed an NPE while accessing the AM page/webservice for a task attempt without an assigned container. (Contributed by Robert Joseph Evans)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1294901 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2012-02-28 23:50:47 +00:00
parent ffdf980b20
commit 137aa0763f
3 changed files with 19 additions and 1 deletions

View File

@ -203,6 +203,10 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3816. capacity scheduler web ui bar graphs for used capacity wrong
(tgraves via bobby)
MAPREDUCE-3930. Fixed an NPE while accessing the AM page/webservice for a
task attempt without an assigned container. (Robert Joseph Evans via
sseth)
Release 0.23.1 - 2012-02-17
INCOMPATIBLE CHANGES

View File

@ -142,7 +142,7 @@ public class ConverterUtils {
}
public static String toString(ContainerId cId) {
return cId.toString();
return cId == null ? null : cId.toString();
}
public static NodeId toNodeId(String nodeIdStr) {

View File

@ -22,6 +22,7 @@ import static org.junit.Assert.*;
import java.net.URISyntaxException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.URL;
import org.junit.Test;
@ -35,4 +36,17 @@ public class TestConverterUtils {
assertEquals(expectedPath, actualPath);
}
@Test
public void testContainerId() throws URISyntaxException {
ContainerId id = BuilderUtils.newContainerId(0, 0, 0, 0);
String cid = ConverterUtils.toString(id);
assertEquals("container_0_0000_00_000000", cid);
ContainerId gen = ConverterUtils.toContainerId(cid);
assertEquals(gen, id);
}
@Test
public void testContainerIdNull() throws URISyntaxException {
assertNull(ConverterUtils.toString((ContainerId)null));
}
}