summaryrefslogtreecommitdiffstats
path: root/vespaclient-java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-23 16:07:43 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2023-11-23 16:12:51 +0100
commitef535f6c51393d945d9fe07de38de224d5ae443f (patch)
tree2f5976537a200aebbf6644b8e1ef93f2c669319d /vespaclient-java
parentf966346429c85fc31c8ea962b518e02a19f77f46 (diff)
jackson 2.16 changes some of its default settings so we consolidate our use of the ObjectMapper.
Unless special options are used, use a common instance, or create via factory metod.
Diffstat (limited to 'vespaclient-java')
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClient.java5
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java5
2 files changed, 4 insertions, 6 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClient.java b/vespaclient-java/src/main/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClient.java
index 8bb3bda1cb4..6e688c7737e 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClient.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClient.java
@@ -1,9 +1,9 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.filedistribution.status;
+import ai.vespa.json.Jackson;
import ai.vespa.util.http.hc5.VespaHttpClientBuilder;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import io.airlift.airline.Command;
import io.airlift.airline.HelpOption;
import io.airlift.airline.Option;
@@ -102,10 +102,9 @@ public class FileDistributionStatusClient {
}
String parseAndGenerateOutput(String json) {
- ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode;
try {
- jsonNode = objectMapper.readTree(json);
+ jsonNode = Jackson.mapper().readTree(json);
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java b/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
index 2ea38a75ea0..223d62ea323 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
@@ -1,7 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespaget;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import ai.vespa.json.Jackson;
import com.yahoo.document.DataType;
import com.yahoo.document.Document;
import com.yahoo.document.DocumentId;
@@ -182,9 +182,8 @@ public class DocumentRetrieverTest {
documentRetriever.retrieveDocuments();
verify(mockedSession, times(3)).syncSend(any());
- ObjectMapper m = new ObjectMapper();
@SuppressWarnings("unchecked")
- List<Map<String, Object>> feed = m.readValue(outContent.toByteArray(), List.class);
+ List<Map<String, Object>> feed = Jackson.mapper().readValue(outContent.toByteArray(), List.class);
assertEquals(DOC_ID_1, feed.get(0).get("id"));
assertEquals(DOC_ID_2, feed.get(1).get("id"));
assertEquals(DOC_ID_3, feed.get(2).get("id"));