YARN-2813. Fixed NPE from MemoryTimelineStore.getDomains. Contributed by Zhijie Shen
This commit is contained in:
parent
d698ed1d6f
commit
e26be1d85c
|
@ -845,6 +845,8 @@ Release 2.6.0 - UNRELEASED
|
||||||
FatalEventDispatcher try to transition RM to StandBy at the same time.
|
FatalEventDispatcher try to transition RM to StandBy at the same time.
|
||||||
(Rohith Sharmaks via jianhe)
|
(Rohith Sharmaks via jianhe)
|
||||||
|
|
||||||
|
YARN-2813. Fixed NPE from MemoryTimelineStore.getDomains. (Zhijie Shen via xgong)
|
||||||
|
|
||||||
Release 2.5.2 - UNRELEASED
|
Release 2.5.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -241,6 +241,10 @@ public class MemoryTimelineStore
|
||||||
public TimelineDomains getDomains(String owner)
|
public TimelineDomains getDomains(String owner)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<TimelineDomain> domains = new ArrayList<TimelineDomain>();
|
List<TimelineDomain> domains = new ArrayList<TimelineDomain>();
|
||||||
|
Set<TimelineDomain> domainsOfOneOwner = domainsByOwner.get(owner);
|
||||||
|
if (domainsOfOneOwner == null) {
|
||||||
|
return new TimelineDomains();
|
||||||
|
}
|
||||||
for (TimelineDomain domain : domainsByOwner.get(owner)) {
|
for (TimelineDomain domain : domainsByOwner.get(owner)) {
|
||||||
TimelineDomain domainToReturn = createTimelineDomain(
|
TimelineDomain domainToReturn = createTimelineDomain(
|
||||||
domain.getId(),
|
domain.getId(),
|
||||||
|
|
|
@ -946,6 +946,10 @@ public class TimelineStoreTestUtils {
|
||||||
assertEquals(2, actualDomains.getDomains().size());
|
assertEquals(2, actualDomains.getDomains().size());
|
||||||
verifyDomainInfo(domain3, actualDomains.getDomains().get(0));
|
verifyDomainInfo(domain3, actualDomains.getDomains().get(0));
|
||||||
verifyDomainInfo(domain1, actualDomains.getDomains().get(1));
|
verifyDomainInfo(domain1, actualDomains.getDomains().get(1));
|
||||||
|
|
||||||
|
// owner without any domain
|
||||||
|
actualDomains = store.getDomains("owner_4");
|
||||||
|
assertEquals(0, actualDomains.getDomains().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyDomainInfo(
|
private static void verifyDomainInfo(
|
||||||
|
|
Loading…
Reference in New Issue