YARN-9553. Fix NPE in EntityGroupFSTimelineStore#getEntityTimelines. Contributed by Prabhu Joseph.
This commit is contained in:
parent
30c6dd92e1
commit
f1552f6edb
|
@ -1115,6 +1115,11 @@ public class EntityGroupFSTimelineStore extends CompositeService
|
|||
LOG.debug("getEntityTimelines type={} ids={}", entityType, entityIds);
|
||||
TimelineEvents returnEvents = new TimelineEvents();
|
||||
List<EntityCacheItem> relatedCacheItems = new ArrayList<>();
|
||||
|
||||
if (entityIds == null || entityIds.isEmpty()) {
|
||||
return returnEvents;
|
||||
}
|
||||
|
||||
for (String entityId : entityIds) {
|
||||
LOG.debug("getEntityTimeline type={} id={}", entityType, entityId);
|
||||
List<TimelineStore> stores
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.hadoop.yarn.server.timeline.EntityGroupFSTimelineStore.AppStat
|
|||
import org.apache.hadoop.yarn.server.timeline.TimelineReader.Field;
|
||||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -379,6 +380,16 @@ public class TestEntityGroupFSTimelineStore extends TimelineStoreTestUtils {
|
|||
assertFalse(fs.exists(clusterTimeStampDir1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullCheckGetEntityTimelines() throws Exception {
|
||||
try {
|
||||
store.getEntityTimelines("YARN_APPLICATION", null, null, null, null,
|
||||
null);
|
||||
} catch (NullPointerException e) {
|
||||
Assert.fail("NPE when getEntityTimelines called with Null EntityIds");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPluginRead() throws Exception {
|
||||
// Verify precondition
|
||||
|
|
Loading…
Reference in New Issue