YARN-9744. RollingLevelDBTimelineStore.getEntityByTime fails with NPE. Contributed by Prabhu Joseph.
This commit is contained in:
parent
0b507d2ddf
commit
b4097b96a3
@ -793,39 +793,42 @@ private TimelineEntities getEntityByTime(byte[] base, String entityType,
|
|||||||
entity = getEntity(entityId, entityType, startTime, queryFields,
|
entity = getEntity(entityId, entityType, startTime, queryFields,
|
||||||
iterator, key, kp.getOffset());
|
iterator, key, kp.getOffset());
|
||||||
}
|
}
|
||||||
// determine if the retrieved entity matches the provided secondary
|
|
||||||
// filters, and if so add it to the list of entities to return
|
if (entity != null) {
|
||||||
boolean filterPassed = true;
|
// determine if the retrieved entity matches the provided secondary
|
||||||
if (secondaryFilters != null) {
|
// filters, and if so add it to the list of entities to return
|
||||||
for (NameValuePair filter : secondaryFilters) {
|
boolean filterPassed = true;
|
||||||
Object v = entity.getOtherInfo().get(filter.getName());
|
if (secondaryFilters != null) {
|
||||||
if (v == null) {
|
for (NameValuePair filter : secondaryFilters) {
|
||||||
Set<Object> vs = entity.getPrimaryFilters()
|
Object v = entity.getOtherInfo().get(filter.getName());
|
||||||
.get(filter.getName());
|
if (v == null) {
|
||||||
if (vs == null || !vs.contains(filter.getValue())) {
|
Set<Object> vs = entity.getPrimaryFilters()
|
||||||
|
.get(filter.getName());
|
||||||
|
if (vs == null || !vs.contains(filter.getValue())) {
|
||||||
|
filterPassed = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (!v.equals(filter.getValue())) {
|
||||||
filterPassed = false;
|
filterPassed = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (!v.equals(filter.getValue())) {
|
|
||||||
filterPassed = false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (filterPassed) {
|
||||||
if (filterPassed) {
|
if (entity.getDomainId() == null) {
|
||||||
if (entity.getDomainId() == null) {
|
entity.setDomainId(DEFAULT_DOMAIN_ID);
|
||||||
entity.setDomainId(DEFAULT_DOMAIN_ID);
|
|
||||||
}
|
|
||||||
if (checkAcl == null || checkAcl.check(entity)) {
|
|
||||||
// Remove primary filter and other info if they are added for
|
|
||||||
// matching secondary filters
|
|
||||||
if (addPrimaryFilters) {
|
|
||||||
entity.setPrimaryFilters(null);
|
|
||||||
}
|
}
|
||||||
if (addOtherInfo) {
|
if (checkAcl == null || checkAcl.check(entity)) {
|
||||||
entity.setOtherInfo(null);
|
// Remove primary filter and other info if they are added for
|
||||||
|
// matching secondary filters
|
||||||
|
if (addPrimaryFilters) {
|
||||||
|
entity.setPrimaryFilters(null);
|
||||||
|
}
|
||||||
|
if (addOtherInfo) {
|
||||||
|
entity.setOtherInfo(null);
|
||||||
|
}
|
||||||
|
entities.addEntity(entity);
|
||||||
}
|
}
|
||||||
entities.addEntity(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user