Skip to content

Commit

Permalink
try fixing joda time problem by using ObjectMapper's that have the jo…
Browse files Browse the repository at this point in the history
…da time module enabled
  • Loading branch information
FieteO committed Mar 20, 2024
1 parent b0405ba commit dbb81a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.cassandrareaper.service.RingRange;
import io.cassandrareaper.storage.IDistributedStorage;
import io.cassandrareaper.storage.OpType;
import io.dropwizard.jackson.Jackson;

import java.io.IOError;
import java.io.IOException;
Expand Down Expand Up @@ -180,8 +181,9 @@ public static CompactionStats parseCompactionStats(String json) throws IOExcepti

private static <T> T parseJson(String json, TypeReference<T> ref) throws IOException {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Jdk8Module());
// ObjectMapper mapper = new ObjectMapper();
// mapper.registerModule(new Jdk8Module());
ObjectMapper mapper = Jackson.newObjectMapper();
return mapper.readValue(json, ref);
} catch (IOException e) {
LOG.error("Error parsing json", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.google.common.collect.Maps;

import org.slf4j.Logger;
Expand Down Expand Up @@ -127,7 +128,7 @@ public static Response doHttpCall(

private static <T> T parseJSON(String json, TypeReference<T> ref) {
try {
return new ObjectMapper().readValue(json, ref);
return new ObjectMapper().registerModule(new JodaModule()).readValue(json, ref);
} catch (IOException e) {
LOG.error("error parsing json", e);
throw new RuntimeException(e);
Expand Down

0 comments on commit dbb81a4

Please sign in to comment.