Skip to content

Commit

Permalink
Fix Nullpointer on empty auction context (#3618)
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenmllr authored Dec 16, 2024
1 parent 00e391c commit 3029de2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public <T> Future<Void> processEvent(T event) {
}

final AuctionContext auctionContext = contextAndType.getLeft();
final String eventType = contextAndType.getRight();
if (auctionContext == null) {
return Future.succeededFuture();
}

final BidRequest bidRequest = auctionContext.getBidRequest();
final TimeoutContext timeoutContext = auctionContext.getTimeoutContext();
final PrivacyContext privacyContext = auctionContext.getPrivacyContext();
Expand All @@ -134,7 +139,7 @@ public <T> Future<Void> processEvent(T event) {
}

final AgmaEvent agmaEvent = AgmaEvent.builder()
.eventType(contextAndType.getRight())
.eventType(eventType)
.accountCode(accountCode)
.requestId(bidRequest.getId())
.app(bidRequest.getApp())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ public void setUp() {
target = new AgmaAnalyticsReporter(properties, versionProvider, jacksonMapper, clock, httpClient, vertx);
}

@Test
public void processEventShouldNotSendAnythingWhenAuctionContextIsNull() {
// given
final AuctionEvent auctionEvent = AuctionEvent.builder()
.auctionContext(null)
.build();

// when
final Future<Void> result = target.processEvent(auctionEvent);

// then
verifyNoInteractions(httpClient);
assertThat(result.succeeded()).isTrue();
}

@Test
public void processEventShouldSendEventWhenEventIsAuctionEvent() {
// given
Expand Down

0 comments on commit 3029de2

Please sign in to comment.