Skip to content

Commit

Permalink
Core: Fix source text in jackson error output (#3121)
Browse files Browse the repository at this point in the history
  • Loading branch information
And1sS committed May 7, 2024
1 parent e4b97d0 commit e895d45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -17,7 +18,9 @@ public final class ObjectMapperProvider {
MAPPER = JsonMapper.builder().configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true)
.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN).build()
.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN)
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build()
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.registerModule(new BlackbirdModule())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2652,8 +2652,7 @@ public void shouldPopulateBidResponseExtension() {
ExtBidderError.of(3, "Failed to decode: Cannot deserialize value"
+ " of type `com.iab.openrtb.response.Response` from Array value "
+ "(token `JsonToken.START_ARRAY`)\n"
+ " at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION`"
+ " disabled); line: 1, column: 1]"))),
+ " at [Source: (String)\"[]\"; line: 1, column: 1]"))),
entry("cache", singletonList(ExtBidderError.of(999, "cacheError"))));

assertThat(responseExt.getResponsetimemillis()).hasSize(2)
Expand Down Expand Up @@ -3151,7 +3150,7 @@ public void shouldThrowExceptionWhenNativeRequestIsInvalid() throws JsonProcessi
.extracting(error -> error.get(bidder1))
.extracting(extBidderErrors -> extBidderErrors.get(0))
.isEqualTo(ExtBidderError.of(3, "No content to map due to end-of-input\n"
+ " at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]"));
+ " at [Source: (String)\"\"; line: 1, column: 0]"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,8 @@ public void makeBidsShouldReturnEmptyBidderWithErrorWhenResponseCantBeParsed() {
assertThat(result.getErrors()).hasSize(1)
.containsExactly(BidderError.badServerResponse(
"Failed to decode: Unexpected end-of-input: expected close marker"
+ " for Object (start marker at [Source: REDACTED "
+ "(`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); "
+ "line: 1, column: 1])\n"
+ " at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled);"
+ " line: 1, column: 2]"));
+ " for Object (start marker at [Source: (String)\"{\"; line: 1, column: 1])\n"
+ " at [Source: (String)\"{\"; line: 1, column: 2]"));
}

private static BidderCall<BidRequest> givenHttpCall(String body) {
Expand Down

0 comments on commit e895d45

Please sign in to comment.