Skip to content

Commit

Permalink
fix(gofeatureflag): fix java.lang.NoClassDefFoundError (#839)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant authored Jun 20, 2024
1 parent 52bfdfe commit 6859fa6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.concurrent.TimeUnit;

import static dev.openfeature.sdk.Value.objectToValue;
import static org.apache.hc.core5.http.ContentType.APPLICATION_JSON;


/**
* GoFeatureFlagController is the layer to contact the APIs and get the data
Expand All @@ -54,6 +54,7 @@
@Slf4j
@SuppressWarnings({"checkstyle:NoFinalizer"})
public class GoFeatureFlagController {
public static final String APPLICATION_JSON = "application/json";
public static final ObjectMapper requestMapper = new ObjectMapper();
private static final ObjectMapper responseMapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand Down Expand Up @@ -136,7 +137,7 @@ public <T> EvaluationResponse<T> evaluateFlag(

Request.Builder reqBuilder = new Request.Builder()
.url(url)
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
.post(RequestBody.create(
requestMapper.writeValueAsBytes(goffRequest),
MediaType.get("application/json; charset=utf-8")));
Expand Down Expand Up @@ -215,7 +216,7 @@ public void sendEventToDataCollector(List<Event> eventsList) {

Request.Builder reqBuilder = new Request.Builder()
.url(url)
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
.post(RequestBody.create(
requestMapper.writeValueAsBytes(events),
MediaType.get("application/json; charset=utf-8")));
Expand Down Expand Up @@ -258,7 +259,7 @@ public ConfigurationChange configurationHasChanged() throws GoFeatureFlagExcepti

Request.Builder reqBuilder = new Request.Builder()
.url(url)
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
.get();

if (this.etag != null && !this.etag.isEmpty()) {
Expand Down

0 comments on commit 6859fa6

Please sign in to comment.