Skip to content

Commit

Permalink
Remove auto-refactor to reference static object mapper
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Aug 7, 2024
1 parent 5db78fa commit 9c0758c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions RFS/src/main/java/com/rfs/common/InvalidResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import java.util.stream.Collectors;

import com.fasterxml.jackson.databind.JsonNode;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.rfs.common.http.HttpResponse;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class InvalidResponse extends RfsException {
private static final Pattern unknownSetting = Pattern.compile("unknown setting \\[(.+)\\].+");
private static final ObjectMapper objectMapper = new ObjectMapper();
private final HttpResponse response;

public InvalidResponse(String message, HttpResponse response) {
Expand All @@ -30,7 +31,7 @@ public InvalidResponse(String message, HttpResponse response) {
public Set<String> getIllegalArguments() {
try {
var interimResults = new ArrayList<Map.Entry<String, String>>();
var bodyNode = OpenSearchClient.objectMapper.readTree(response.body);
var bodyNode = objectMapper.readTree(response.body);

var errorBody = Optional.ofNullable(bodyNode).map(node -> node.get("error"));

Expand Down
2 changes: 1 addition & 1 deletion RFS/src/main/java/com/rfs/common/OpenSearchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class OpenSearchClient {
private static final Logger logger = LogManager.getLogger(OpenSearchClient.class);
static final ObjectMapper objectMapper = new ObjectMapper();
private static final ObjectMapper objectMapper = new ObjectMapper();

static {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand Down

0 comments on commit 9c0758c

Please sign in to comment.