Skip to content

Commit 1703bbf

Browse files
CTMBNaraRitesh Ghodrao
authored andcommitted
Modules execution plan: fix NPE (prebid#3902)
1 parent dfa5abc commit 1703bbf

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/org/prebid/server/hooks/execution/HookStageExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.vertx.core.Vertx;
1010
import org.apache.commons.collections4.CollectionUtils;
1111
import org.apache.commons.collections4.ListUtils;
12+
import org.apache.commons.collections4.MapUtils;
1213
import org.apache.commons.collections4.map.DefaultedMap;
1314
import org.apache.commons.lang3.ObjectUtils;
1415
import org.apache.commons.lang3.StringUtils;
@@ -155,7 +156,7 @@ private static ExecutionPlan parseExecutionPlan(String executionPlan, JacksonMap
155156
}
156157

157158
private static ExecutionPlan validateExecutionPlan(ExecutionPlan plan, HookCatalog hookCatalog) {
158-
plan.getEndpoints().values().stream()
159+
MapUtils.emptyIfNull(plan.getEndpoints()).values().stream()
159160
.map(EndpointExecutionPlan::getStages)
160161
.map(Map::entrySet)
161162
.flatMap(Collection::stream)
@@ -412,8 +413,7 @@ private StageExecutionPlan effectiveStagePlanFrom(
412413
}
413414

414415
private static StageExecutionPlan stagePlanFrom(ExecutionPlan executionPlan, Endpoint endpoint, Stage stage) {
415-
return executionPlan
416-
.getEndpoints()
416+
return MapUtils.emptyIfNull(executionPlan.getEndpoints())
417417
.getOrDefault(endpoint, EndpointExecutionPlan.empty())
418418
.getStages()
419419
.getOrDefault(stage, StageExecutionPlan.empty());

src/main/java/org/prebid/server/hooks/execution/model/ExecutionPlan.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
import lombok.Value;
55
import org.prebid.server.model.Endpoint;
66

7-
import java.util.Collections;
87
import java.util.List;
98
import java.util.Map;
109

1110
@Value(staticConstructor = "of")
1211
public class ExecutionPlan {
1312

14-
private static final ExecutionPlan EMPTY = of(null, Collections.emptyMap());
13+
private static final ExecutionPlan EMPTY = of(null, null);
1514

1615
@JsonProperty("abtests")
1716
List<ABTest> abTests;

0 commit comments

Comments
 (0)