DRILL-8430: Create JacksonUtils (#2800)
diff --git a/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java b/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java
index 794983e..4c65eb3 100644
--- a/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java
+++ b/common/src/main/java/org/apache/drill/common/scanner/BuildTimeScan.java
@@ -32,6 +32,7 @@
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.scanner.persistence.ScanResult;
+import org.apache.drill.common.util.JacksonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +48,7 @@
private static final Logger logger = LoggerFactory.getLogger(BuildTimeScan.class);
private static final String REGISTRY_FILE = "META-INF/drill-module-scan/registry.json";
- private static final ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT);
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper().enable(INDENT_OUTPUT);
private static final ObjectReader reader = mapper.readerFor(ScanResult.class);
private static final ObjectWriter writer = mapper.writerFor(ScanResult.class);
diff --git a/common/src/main/java/org/apache/drill/common/util/JacksonUtils.java b/common/src/main/java/org/apache/drill/common/util/JacksonUtils.java
new file mode 100644
index 0000000..e0cb0de
--- /dev/null
+++ b/common/src/main/java/org/apache/drill/common/util/JacksonUtils.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.common.util;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+
+/**
+ * Utility class which contain methods for interacting with Jackson.
+ */
+public final class JacksonUtils {
+
+ private JacksonUtils() {}
+
+ /**
+ * Creates a new instance of the Jackson {@link ObjectMapper}.
+ * @return an {@link ObjectMapper} instance
+ */
+ public static ObjectMapper createObjectMapper() {
+ return createJsonMapperBuilder().build();
+ }
+
+ /**
+ * Creates a new instance of the Jackson {@link ObjectMapper}.
+ * @param factory a {@link JsonFactory} instance
+ * @return an {@link ObjectMapper} instance
+ */
+ public static ObjectMapper createObjectMapper(final JsonFactory factory) {
+ return createJsonMapperBuilder(factory).build();
+ }
+
+ /**
+ * Creates a new instance of the Jackson {@link JsonMapper.Builder}.
+ * @return an {@link JsonMapper.Builder} instance
+ */
+ public static JsonMapper.Builder createJsonMapperBuilder() {
+ return JsonMapper.builder();
+ }
+
+ /**
+ * Creates a new instance of the Jackson {@link JsonMapper.Builder}.
+ * @param factory a {@link JsonFactory} instance
+ * @return an {@link JsonMapper.Builder} instance
+ */
+ public static JsonMapper.Builder createJsonMapperBuilder(final JsonFactory factory) {
+ return JsonMapper.builder(factory);
+ }
+}
diff --git a/common/src/test/java/org/apache/drill/test/DrillTest.java b/common/src/test/java/org/apache/drill/test/DrillTest.java
index f009d2a..19efad6 100644
--- a/common/src/test/java/org/apache/drill/test/DrillTest.java
+++ b/common/src/test/java/org/apache/drill/test/DrillTest.java
@@ -23,6 +23,7 @@
import java.util.List;
import org.apache.drill.common.util.DrillStringUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -37,11 +38,10 @@
public class DrillTest extends BaseTest {
- protected static final ObjectMapper objectMapper;
+ private static final ObjectMapper objectMapper = JacksonUtils.createObjectMapper();
static {
System.setProperty("line.separator", "\n");
- objectMapper = new ObjectMapper();
}
static final SystemManager manager = new SystemManager();
diff --git a/contrib/format-log/src/test/java/org/apache/drill/exec/store/log/TestLogReader.java b/contrib/format-log/src/test/java/org/apache/drill/exec/store/log/TestLogReader.java
index 02f5d82..7d55f59 100644
--- a/contrib/format-log/src/test/java/org/apache/drill/exec/store/log/TestLogReader.java
+++ b/contrib/format-log/src/test/java/org/apache/drill/exec/store/log/TestLogReader.java
@@ -29,6 +29,7 @@
import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.common.logical.FormatPluginConfig;
import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.record.metadata.SchemaBuilder;
import org.apache.drill.exec.record.metadata.TupleMetadata;
@@ -735,7 +736,7 @@
*/
@Test
public void testPluginSerialization() throws IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
assertTrue(mapper.canSerialize(LogFormatPlugin.class));
LogFormatConfig sampleConfig = dateOnlyConfig();
diff --git a/contrib/format-pcapng/src/test/java/org/apache/drill/exec/persistent/store/pcap/TestPcapWithPersistentStore.java b/contrib/format-pcapng/src/test/java/org/apache/drill/exec/persistent/store/pcap/TestPcapWithPersistentStore.java
index 9fee14a..b44d297 100644
--- a/contrib/format-pcapng/src/test/java/org/apache/drill/exec/persistent/store/pcap/TestPcapWithPersistentStore.java
+++ b/contrib/format-pcapng/src/test/java/org/apache/drill/exec/persistent/store/pcap/TestPcapWithPersistentStore.java
@@ -18,6 +18,7 @@
package org.apache.drill.exec.persistent.store.pcap;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList;
import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet;
import org.apache.curator.framework.CuratorFramework;
@@ -43,6 +44,7 @@
import static org.junit.Assert.assertTrue;
public class TestPcapWithPersistentStore extends TestWithZookeeper {
+
/**
* DRILL-7828
* Note: If this test breaks you are probably breaking backward and forward compatibility. Verify with the community
@@ -54,10 +56,10 @@
try (CuratorFramework curator = createCurator()) {
curator.start();
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.registerSubtypes(PcapFormatConfig.class, PcapngFormatConfig.class);
+ ObjectMapper testMapper = JacksonUtils.createObjectMapper();
+ testMapper.registerSubtypes(PcapFormatConfig.class, PcapngFormatConfig.class);
PersistentStoreConfig<FileSystemConfig> storeConfig =
- PersistentStoreConfig.newJacksonBuilder(objectMapper, FileSystemConfig.class).name("type").build();
+ PersistentStoreConfig.newJacksonBuilder(testMapper, FileSystemConfig.class).name("type").build();
try (ZookeeperClient zkClient = new ZookeeperClient(curator,
diff --git a/contrib/storage-drill/src/main/java/org/apache/drill/exec/store/drill/plugin/DrillStoragePlugin.java b/contrib/storage-drill/src/main/java/org/apache/drill/exec/store/drill/plugin/DrillStoragePlugin.java
index b4c77ef..ff5e6bd 100644
--- a/contrib/storage-drill/src/main/java/org/apache/drill/exec/store/drill/plugin/DrillStoragePlugin.java
+++ b/contrib/storage-drill/src/main/java/org/apache/drill/exec/store/drill/plugin/DrillStoragePlugin.java
@@ -18,7 +18,6 @@
package org.apache.drill.exec.store.drill.plugin;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.calcite.plan.Convention;
import org.apache.calcite.plan.RelOptRule;
import org.apache.calcite.schema.SchemaPlus;
@@ -96,7 +95,7 @@
@Override
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- DrillScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<DrillScanSpec>() {
+ DrillScanSpec scanSpec = selection.getListWith(new TypeReference<DrillScanSpec>() {
});
return new DrillGroupScan(userName, drillConfig, scanSpec);
}
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidRecordReader.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidRecordReader.java
index 6ae735b..69ed0b9 100755
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidRecordReader.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidRecordReader.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ops.FragmentContext;
import org.apache.drill.exec.ops.OperatorContext;
import org.apache.drill.exec.physical.impl.OutputMutator;
@@ -51,7 +52,7 @@
public class DruidRecordReader extends AbstractRecordReader {
private static final Logger logger = LoggerFactory.getLogger(DruidRecordReader.class);
- private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectMapper objectMapper = JacksonUtils.createObjectMapper();
private final DruidStoragePlugin plugin;
private final DruidSubScan.DruidSubScanSpec scanSpec;
private final List<String> columns;
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidStoragePlugin.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidStoragePlugin.java
index 45ee0a2..b7479fb 100755
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidStoragePlugin.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/DruidStoragePlugin.java
@@ -18,7 +18,6 @@
package org.apache.drill.exec.store.druid;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.drill.common.JSONOptions;
import org.apache.drill.exec.ops.OptimizerRulesContext;
@@ -59,7 +58,7 @@
@Override
public DruidGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- DruidScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<DruidScanSpec>() {});
+ DruidScanSpec scanSpec = selection.getListWith(new TypeReference<DruidScanSpec>() {});
return new DruidGroupScan(userName, this, scanSpec, null, -1);
}
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/common/DruidFilterBase.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/common/DruidFilterBase.java
index 481357b..b521635 100755
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/common/DruidFilterBase.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/common/DruidFilterBase.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
public class DruidFilterBase implements DruidFilter {
- private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectMapper objectMapper = JacksonUtils.createObjectMapper();
public String toJson() {
try {
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/druid/ScanQueryBuilder.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/druid/ScanQueryBuilder.java
index df00ca2..e7e8502 100644
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/druid/ScanQueryBuilder.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/druid/ScanQueryBuilder.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.druid.common.DruidFilter;
import java.math.BigInteger;
@@ -33,7 +34,7 @@
import static org.apache.drill.exec.store.druid.common.DruidConstants.INTERVAL_DIMENSION_NAME;
public class ScanQueryBuilder {
- private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectMapper objectMapper = JacksonUtils.createObjectMapper();
public ScanQueryBuilder() {}
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidAdminClient.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidAdminClient.java
index 09c99fc..4859f30 100755
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidAdminClient.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidAdminClient.java
@@ -20,6 +20,7 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.druid.druid.SimpleDatasourceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,7 +35,7 @@
private static final Logger logger = LoggerFactory.getLogger(DruidAdminClient.class);
private static final String DATASOURCES_BASE_URI = "/druid/coordinator/v1/datasources?simple";
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper();
private final String coordinatorAddress;
private final RestClient restClient;
diff --git a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidQueryClient.java b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidQueryClient.java
index fe82650..e6ba771 100755
--- a/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidQueryClient.java
+++ b/contrib/storage-druid/src/main/java/org/apache/drill/exec/store/druid/rest/DruidQueryClient.java
@@ -21,6 +21,7 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.druid.druid.DruidScanResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +36,7 @@
private static final Logger logger = LoggerFactory.getLogger(DruidQueryClient.class);
private static final String QUERY_BASE_URI = "/druid/v2";
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper();
private final RestClient restClient;
private final String queryUrl;
diff --git a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidStoragePluginConfigTest.java b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidStoragePluginConfigTest.java
index 354b23c..3e3f549 100644
--- a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidStoragePluginConfigTest.java
+++ b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidStoragePluginConfigTest.java
@@ -20,6 +20,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.io.Resources;
import org.junit.Test;
@@ -34,7 +35,7 @@
@Test
public void testDruidStoragePluginConfigSuccessfullyParsed()
throws URISyntaxException, IOException {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
JsonNode storagePluginJson = mapper.readTree(new File(
Resources.getResource("bootstrap-storage-plugins.json").toURI()));
DruidStoragePluginConfig druidStoragePluginConfig =
@@ -54,7 +55,7 @@
+ " \"brokerAddress\" : \"http://localhost:8082\",\n"
+ " \"coordinatorAddress\": \"http://localhost:8081\",\n"
+ " \"enabled\" : false\n" + " }\n" + " }\n" + "}\n";
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
JsonNode storagePluginJson = mapper.readTree(druidConfigStr);
DruidStoragePluginConfig druidStoragePluginConfig =
mapper.treeToValue(storagePluginJson.get("storage").get("druid"), DruidStoragePluginConfig.class);
diff --git a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidTestSuite.java b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidTestSuite.java
index 92d3c34..d35f0c1 100644
--- a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidTestSuite.java
+++ b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/DruidTestSuite.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.categories.DruidStorageTest;
import org.apache.drill.categories.SlowTest;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.druid.rest.DruidQueryClientTest;
import org.apache.drill.shaded.guava.com.google.common.io.Resources;
import org.junit.BeforeClass;
@@ -46,7 +47,7 @@
public class DruidTestSuite {
private static final Logger logger = LoggerFactory.getLogger(DruidTestSuite.class);
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper();
private static DruidStoragePluginConfig druidStoragePluginConfig = null;
diff --git a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/TestDataGenerator.java b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/TestDataGenerator.java
index 3b96db7..2d009f7 100644
--- a/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/TestDataGenerator.java
+++ b/contrib/storage-druid/src/test/java/org/apache/drill/exec/store/druid/TestDataGenerator.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.io.Resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +44,7 @@
private static final OkHttpClient httpClient = new OkHttpClient();
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper();
private static final String RESPONSE_SUCCESS = "SUCCESS";
diff --git a/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java b/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
index 8244505..23be77f 100644
--- a/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
+++ b/contrib/storage-elasticsearch/src/main/java/org/apache/drill/exec/store/elasticsearch/ElasticsearchStorageConfig.java
@@ -24,11 +24,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.apache.drill.common.PlanStringBuilder;
import org.apache.drill.common.logical.StoragePluginConfig;
import org.apache.drill.common.logical.security.PlainCredentialsProvider;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.security.CredentialProviderUtils;
import org.apache.drill.common.logical.security.CredentialsProvider;
import org.apache.drill.exec.store.security.UsernamePasswordCredentials;
@@ -45,7 +45,7 @@
public class ElasticsearchStorageConfig extends StoragePluginConfig {
public static final String NAME = "elastic";
- private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().writerFor(List.class);
+ private static final ObjectWriter OBJECT_WRITER = JacksonUtils.createObjectMapper().writerFor(List.class);
private static final String HOSTS = "hosts";
diff --git a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsLimitPushdown.java b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsLimitPushdown.java
index b644285..0b6f95b 100644
--- a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsLimitPushdown.java
+++ b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsLimitPushdown.java
@@ -20,6 +20,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.common.util.DrillFileUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.oauth.PersistentTokenTable;
import org.apache.drill.exec.store.StoragePluginRegistry;
@@ -56,7 +57,7 @@
String oauthJson = Files.asCharSource(DrillFileUtils.getResourceAsFile("/tokens/oauth_tokens.json"), Charsets.UTF_8).read();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
Map<String,String> tokenMap = mapper.readValue(oauthJson, Map.class);
String clientID = tokenMap.get("client_id");
diff --git a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsQueries.java b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsQueries.java
index 2410311..df72b01 100644
--- a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsQueries.java
+++ b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsQueries.java
@@ -21,6 +21,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.common.util.DrillFileUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.oauth.PersistentTokenTable;
import org.apache.drill.exec.physical.rowSet.RowSet;
@@ -73,7 +74,7 @@
String oauthJson = Files.asCharSource(DrillFileUtils.getResourceAsFile("/tokens/oauth_tokens.json"), Charsets.UTF_8).read();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
Map<String,String> tokenMap = mapper.readValue(oauthJson, Map.class);
clientID = tokenMap.get("client_id");
diff --git a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsWriter.java b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsWriter.java
index 2b06de1..d819cce 100644
--- a/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsWriter.java
+++ b/contrib/storage-googlesheets/src/test/java/org/apache/drill/exec/store/googlesheets/TestGoogleSheetsWriter.java
@@ -22,6 +22,7 @@
import org.apache.drill.categories.RowSetTest;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.common.util.DrillFileUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.oauth.PersistentTokenTable;
import org.apache.drill.exec.physical.rowSet.RowSet;
import org.apache.drill.exec.record.metadata.SchemaBuilder;
@@ -75,7 +76,7 @@
String oauthJson = Files.asCharSource(DrillFileUtils.getResourceAsFile("/tokens/oauth_tokens.json"), Charsets.UTF_8).read();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
Map<String,String> tokenMap = mapper.readValue(oauthJson, Map.class);
String clientID = tokenMap.get("client_id");
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseStoragePlugin.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseStoragePlugin.java
index 64797a3..4d1e05e 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseStoragePlugin.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseStoragePlugin.java
@@ -29,12 +29,11 @@
import org.apache.drill.exec.store.AbstractStoragePlugin;
import org.apache.drill.exec.store.SchemaConfig;
import org.apache.drill.exec.store.StoragePluginOptimizerRule;
+import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.Connection;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet;
public class HBaseStoragePlugin extends AbstractStoragePlugin {
private static final HBaseConnectionManager hbaseConnectionManager = HBaseConnectionManager.INSTANCE;
@@ -61,7 +60,7 @@
@Override
public HBaseGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- HBaseScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<HBaseScanSpec>() {});
+ HBaseScanSpec scanSpec = selection.getListWith(new TypeReference<HBaseScanSpec>() {});
return new HBaseGroupScan(userName, this, scanSpec, null);
}
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
index 1ce138c..863f96a 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePlugin.java
@@ -28,7 +28,6 @@
import java.util.stream.Collectors;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.commons.lang3.StringEscapeUtils;
@@ -99,7 +98,7 @@
@Override
public HiveScan getPhysicalScan(String userName, JSONOptions selection, List<SchemaPath> columns, SessionOptionManager options) throws IOException {
- HiveReadEntry hiveReadEntry = selection.getListWith(new ObjectMapper(), new TypeReference<HiveReadEntry>(){});
+ HiveReadEntry hiveReadEntry = selection.getListWith(new TypeReference<HiveReadEntry>(){});
try {
Map<String, String> confProperties = new HashMap<>();
if (options != null) {
diff --git a/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaStoragePlugin.java b/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaStoragePlugin.java
index 7fb53ce..d376bb2 100644
--- a/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaStoragePlugin.java
+++ b/contrib/storage-kafka/src/main/java/org/apache/drill/exec/store/kafka/KafkaStoragePlugin.java
@@ -34,7 +34,6 @@
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet;
public class KafkaStoragePlugin extends AbstractStoragePlugin {
@@ -82,7 +81,7 @@
@Override
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- KafkaScanSpec kafkaScanSpec = selection.getListWith(new ObjectMapper(),
+ KafkaScanSpec kafkaScanSpec = selection.getListWith(
new TypeReference<KafkaScanSpec>() {
});
return new KafkaGroupScan(this, kafkaScanSpec, null, -1);
diff --git a/contrib/storage-kudu/src/main/java/org/apache/drill/exec/store/kudu/KuduStoragePlugin.java b/contrib/storage-kudu/src/main/java/org/apache/drill/exec/store/kudu/KuduStoragePlugin.java
index fea8197..4b36653 100644
--- a/contrib/storage-kudu/src/main/java/org/apache/drill/exec/store/kudu/KuduStoragePlugin.java
+++ b/contrib/storage-kudu/src/main/java/org/apache/drill/exec/store/kudu/KuduStoragePlugin.java
@@ -27,7 +27,6 @@
import org.apache.kudu.client.KuduClient;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
public class KuduStoragePlugin extends AbstractStoragePlugin {
@@ -60,7 +59,7 @@
@Override
public KuduGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- KuduScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<KuduScanSpec>() {});
+ KuduScanSpec scanSpec = selection.getListWith(new TypeReference<KuduScanSpec>() {});
return new KuduGroupScan(this, scanSpec, null);
}
diff --git a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoStoragePlugin.java b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoStoragePlugin.java
index cb0fb27..7b78e24 100644
--- a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoStoragePlugin.java
+++ b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoStoragePlugin.java
@@ -18,7 +18,6 @@
package org.apache.drill.exec.store.mongo;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
@@ -155,7 +154,7 @@
@Override
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- MongoScanSpec mongoScanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<MongoScanSpec>() {
+ MongoScanSpec mongoScanSpec = selection.getListWith(new TypeReference<MongoScanSpec>() {
});
return new MongoGroupScan(userName, this, mongoScanSpec, null, false);
}
diff --git a/contrib/storage-opentsdb/src/main/java/org/apache/drill/exec/store/openTSDB/OpenTSDBStoragePlugin.java b/contrib/storage-opentsdb/src/main/java/org/apache/drill/exec/store/openTSDB/OpenTSDBStoragePlugin.java
index c83a4e5..e9ade66 100644
--- a/contrib/storage-opentsdb/src/main/java/org/apache/drill/exec/store/openTSDB/OpenTSDBStoragePlugin.java
+++ b/contrib/storage-opentsdb/src/main/java/org/apache/drill/exec/store/openTSDB/OpenTSDBStoragePlugin.java
@@ -18,7 +18,6 @@
package org.apache.drill.exec.store.openTSDB;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.drill.common.JSONOptions;
import org.apache.drill.exec.server.DrillbitContext;
@@ -56,7 +55,7 @@
@Override
public OpenTSDBGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException {
- OpenTSDBScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<OpenTSDBScanSpec>() {
+ OpenTSDBScanSpec scanSpec = selection.getListWith(new TypeReference<OpenTSDBScanSpec>() {
});
return new OpenTSDBGroupScan(this, scanSpec, null);
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
index 372bbe6..62d04e3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
@@ -42,6 +42,7 @@
import org.apache.drill.common.config.DrillProperties;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.coord.ClusterCoordinator;
import org.apache.drill.exec.coord.zk.ZKClusterCoordinator;
@@ -107,7 +108,7 @@
public class DrillClient implements Closeable, ConnectionThrottle {
private static Logger logger = LoggerFactory.getLogger(DrillClient.class);
public static final String DEFAULT_CLIENT_NAME = "Apache Drill Java client";
- private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectMapper objectMapper = JacksonUtils.createObjectMapper();
private final DrillConfig config;
private UserClient client;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
index 6c84c06..076227b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
@@ -18,6 +18,7 @@
package org.apache.drill.exec.expr.fn.registry;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
import org.apache.drill.shaded.guava.com.google.common.collect.Sets;
import org.apache.drill.common.AutoCloseables;
@@ -87,7 +88,7 @@
private static final String REGISTRY_PATH = "registry";
private static final Logger logger = LoggerFactory.getLogger(RemoteFunctionRegistry.class);
- private static final ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT);
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper().enable(INDENT_OUTPUT);
private final TransientStoreListener unregistrationListener;
private int retryAttempts;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
index 0b07213..cd46b0a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/AvgWidthMergedStatistic.java
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.record.MajorTypeSerDe;
import org.apache.drill.exec.vector.NullableFloat8Vector;
import org.apache.drill.exec.vector.ValueVector;
@@ -128,10 +129,11 @@
private long getRowCount(String colName) {
byte[] typeAsBytes = types.getStat(colName);
int type = -1;
- ObjectMapper mapper = new ObjectMapper();
- SimpleModule deModule = new SimpleModule("StatisticsSerDeModeule") //
- .addDeserializer(TypeProtos.MajorType.class, new MajorTypeSerDe.De());
- mapper.registerModule(deModule);
+ SimpleModule deModule = new SimpleModule("StatisticsSerDeModule") //
+ .addDeserializer(TypeProtos.MajorType.class, new MajorTypeSerDe.De());
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(deModule)
+ .build();
try {
type = mapper.readValue(typeAsBytes, TypeProtos.MajorType.class).getMinorType().getNumber();
} catch (IOException ex) {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
index ad77b21..f8701c0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/statistics/NDVMergedStatistic.java
@@ -30,6 +30,7 @@
import java.util.List;
import java.util.Map;
import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.record.MajorTypeSerDe;
import org.apache.drill.exec.server.options.OptionManager;
import org.apache.drill.exec.vector.NullableBigIntVector;
@@ -176,10 +177,11 @@
private long getRowCount(String colName) {
byte[] typeAsBytes = types.getStat(colName);
int type = -1;
- ObjectMapper mapper = new ObjectMapper();
SimpleModule deModule = new SimpleModule("StatisticsSerDeModule") //
- .addDeserializer(TypeProtos.MajorType.class, new MajorTypeSerDe.De());
- mapper.registerModule(deModule);
+ .addDeserializer(TypeProtos.MajorType.class, new MajorTypeSerDe.De());
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(deModule)
+ .build();
try {
type = mapper.readValue(typeAsBytes, TypeProtos.MajorType.class).getMinorType().getNumber();
} catch (IOException ex) {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStatsTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStatsTable.java
index 70f3e16..bfb58cb 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStatsTable.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStatsTable.java
@@ -41,6 +41,7 @@
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.common.logical.FormatPluginConfig;
import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ops.QueryContext;
import org.apache.drill.exec.physical.PhysicalPlan;
import org.apache.drill.exec.planner.logical.DrillTable;
@@ -465,12 +466,13 @@
* {@link TableStatistics} from/to JSON
*/
public static ObjectMapper getMapper() {
- ObjectMapper mapper = new ObjectMapper();
SimpleModule deModule = new SimpleModule("StatisticsSerDeModule")
.addSerializer(TypeProtos.MajorType.class, new MajorTypeSerDe.Se())
.addDeserializer(TypeProtos.MajorType.class, new MajorTypeSerDe.De())
.addDeserializer(SchemaPath.class, new SchemaPath.De());
- mapper.registerModule(deModule);
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(deModule)
+ .build();
mapper.registerSubtypes(new NamedType(NumericEquiDepthHistogram.class, "numeric-equi-depth"));
return mapper;
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
index 5042c43..233414c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillValuesRelBase.java
@@ -35,6 +35,7 @@
import org.apache.calcite.util.NlsString;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.util.GuavaUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.vector.complex.fn.BasicJsonOutput;
import org.apache.drill.exec.vector.complex.fn.JsonOutput;
import org.joda.time.DateTime;
@@ -50,7 +51,7 @@
*/
public abstract class DrillValuesRelBase extends Values implements DrillRelNode {
- private static final ObjectMapper MAPPER = new ObjectMapper();
+ private static final ObjectMapper MAPPER = JacksonUtils.createObjectMapper();
protected final String content;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DescribeSchemaHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DescribeSchemaHandler.java
index cee39eb..515d130 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DescribeSchemaHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DescribeSchemaHandler.java
@@ -17,10 +17,12 @@
*/
package org.apache.drill.exec.planner.sql.handlers;
+import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.SerializableString;
import com.fasterxml.jackson.core.io.CharacterEscapes;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.SchemaFactory;
import org.apache.drill.shaded.guava.com.google.common.base.Joiner;
import org.slf4j.Logger;
@@ -50,8 +52,8 @@
private static final Logger logger = LoggerFactory.getLogger(DescribeSchemaHandler.class);
@SuppressWarnings("serial")
- private static final ObjectMapper mapper = new ObjectMapper(
- new ObjectMapper().getFactory().setCharacterEscapes(new CharacterEscapes() {
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper(
+ new JsonFactory().setCharacterEscapes(new CharacterEscapes() {
@Override
public int[] getEscapeCodesForAscii() {
// add standard set of escaping characters
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/metadata/schema/PathSchemaProvider.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/metadata/schema/PathSchemaProvider.java
index fe2d920..d704fd8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/metadata/schema/PathSchemaProvider.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/metadata/schema/PathSchemaProvider.java
@@ -23,6 +23,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.util.ImpersonationUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -52,7 +53,8 @@
public static final ObjectWriter WRITER;
static {
- ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT).configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ ObjectMapper mapper = JacksonUtils.createObjectMapper().enable(INDENT_OUTPUT)
+ .configure(JsonParser.Feature.ALLOW_COMMENTS, true);
READER = mapper.readerFor(SchemaContainer.class);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
index 492d4de..f242f77 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
@@ -31,6 +31,7 @@
import com.google.protobuf.Parser;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.DrillBuf;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.proto.BitControl.CustomMessage;
import org.apache.drill.exec.proto.BitControl.FinishedReceiver;
import org.apache.drill.exec.proto.BitControl.FragmentStatus;
@@ -465,17 +466,18 @@
private final ObjectReader reader;
public JacksonSerDe(Class<MSG> clazz) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
writer = mapper.writerFor(clazz);
reader = mapper.readerFor(clazz);
}
public JacksonSerDe(Class<MSG> clazz, JsonSerializer<MSG> serializer, JsonDeserializer<MSG> deserializer) {
- ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
- mapper.registerModule(module);
module.addSerializer(clazz, serializer);
module.addDeserializer(clazz, deserializer);
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(module)
+ .build();
writer = mapper.writerFor(clazz);
reader = mapper.readerFor(clazz);
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/InboundImpersonationManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/InboundImpersonationManager.java
index 40ea0a3..69acf78 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/InboundImpersonationManager.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/InboundImpersonationManager.java
@@ -21,6 +21,7 @@
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.annotations.VisibleForTesting;
import org.apache.drill.shaded.guava.com.google.common.collect.Sets;
import org.apache.drill.common.exceptions.DrillRuntimeException;
@@ -58,7 +59,7 @@
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(InboundImpersonationManager.class);
private static final String STAR = "*";
- private static final ObjectMapper impersonationPolicyMapper = new ObjectMapper();
+ private static final ObjectMapper impersonationPolicyMapper = JacksonUtils.createObjectMapper();
private List<ImpersonationPolicy> impersonationPolicies;
private String policiesString; // used to test if policies changed
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/JacksonSerializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/JacksonSerializer.java
index d870561..99ccbe6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/JacksonSerializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/serialization/JacksonSerializer.java
@@ -22,12 +22,19 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.base.Objects;
public class JacksonSerializer<T> implements InstanceSerializer<T> {
+ private static final ObjectMapper DEFAULT_MAPPER = JacksonUtils.createObjectMapper();
private final ObjectReader reader;
private final ObjectWriter writer;
+ public JacksonSerializer(final Class<T> klazz) {
+ this.reader = DEFAULT_MAPPER.readerFor(klazz);
+ this.writer = DEFAULT_MAPPER.writer();
+ }
+
public JacksonSerializer(final ObjectMapper mapper, final Class<T> klazz) {
this.reader = mapper.readerFor(klazz);
this.writer = mapper.writer();
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/PersistedOptionValue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/PersistedOptionValue.java
index d670c40..6a35f19 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/PersistedOptionValue.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/PersistedOptionValue.java
@@ -25,9 +25,9 @@
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -316,7 +316,7 @@
}
if (value == null) {
- logger.error("Invalid json stored {}.", new ObjectMapper().writeValueAsString(node));
+ logger.error("Invalid json stored {}.", JacksonUtils.createObjectMapper().writeValueAsString(node));
}
return new PersistedOptionValue(value);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
index b0838da..8576d2f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
@@ -30,6 +30,7 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile;
import org.apache.drill.exec.proto.UserBitShared.MinorFragmentProfile;
@@ -54,7 +55,7 @@
private static final String ESTIMATED_LABEL = " (Estimated)";
private static final String NOT_AVAILABLE_LABEL = "Not Available";
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProfileWrapper.class);
- private static final ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT);
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper().enable(INDENT_OUTPUT);
private final QueryProfile profile;
private final String id;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/DrillbitPluginRegistryContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/DrillbitPluginRegistryContext.java
index fc75f82..4565b55 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/DrillbitPluginRegistryContext.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/DrillbitPluginRegistryContext.java
@@ -20,6 +20,7 @@
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.common.config.LogicalPlanPersistence;
import org.apache.drill.common.scanner.persistence.ScanResult;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.server.DrillbitContext;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -44,7 +45,7 @@
// to handle HOCON format in the override file
LogicalPlanPersistence persistence = new LogicalPlanPersistence(drillbitContext.getConfig(),
drillbitContext.getClasspathScan(),
- new ObjectMapper(new HoconFactory()));
+ JacksonUtils.createObjectMapper(new HoconFactory()));
hoconMapper = persistence.getMapper();
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/parser/JsonStructureParser.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/parser/JsonStructureParser.java
index 4d33403..f9bc515 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/parser/JsonStructureParser.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/parser/JsonStructureParser.java
@@ -25,6 +25,7 @@
import java.util.function.Function;
import org.apache.commons.collections4.IterableUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.easy.json.parser.MessageParser.MessageContextException;
import org.apache.drill.exec.store.easy.json.parser.RootParser.EmbeddedArrayParser;
import org.apache.drill.exec.store.easy.json.parser.RootParser.EmbeddedObjectParser;
@@ -160,7 +161,7 @@
private JsonStructureParser(JsonStructureParserBuilder builder) {
this.options = Preconditions.checkNotNull(builder.options);
this.errorFactory = Preconditions.checkNotNull(builder.errorFactory);
- ObjectMapper mapper = new ObjectMapper()
+ ObjectMapper mapper = JacksonUtils.createObjectMapper()
.configure(JsonParser.Feature.ALLOW_COMMENTS, true)
.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
.configure(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS.mappedFeature(),
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/reader/BaseJsonProcessor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/reader/BaseJsonProcessor.java
index 4b61863..b842d77 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/reader/BaseJsonProcessor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/reader/BaseJsonProcessor.java
@@ -22,6 +22,7 @@
import java.io.IOException;
import java.io.InputStream;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.easy.json.JsonProcessor;
import com.fasterxml.jackson.core.JsonLocation;
@@ -69,7 +70,7 @@
* @return Default json mapper
*/
public static ObjectMapper getDefaultMapper() {
- return new ObjectMapper().configure(
+ return JacksonUtils.createObjectMapper().configure(
JsonParser.Feature.ALLOW_COMMENTS, true).configure(
JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/http/oauth/OAuthUtils.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/http/oauth/OAuthUtils.java
index b7c09f6..5f4bd1e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/http/oauth/OAuthUtils.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/http/oauth/OAuthUtils.java
@@ -26,6 +26,7 @@
import okhttp3.Response;
import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.logical.security.CredentialsProvider;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.store.security.oauth.OAuthTokenCredentials;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,6 +37,7 @@
public class OAuthUtils {
private static final Logger logger = LoggerFactory.getLogger(OAuthUtils.class);
+ private static final ObjectMapper MAPPER = JacksonUtils.createObjectMapper();
/**
* Crafts a POST request to obtain an access token.
@@ -144,8 +146,7 @@
}
logger.debug("Response: {}", responseBody);
- ObjectMapper mapper = new ObjectMapper();
- Map<String, Object> parsedJson = mapper.readValue(responseBody, Map.class);
+ Map<String, Object> parsedJson = MAPPER.readValue(responseBody, Map.class);
if (parsedJson.containsKey("access_token")) {
accessToken = (String) parsedJson.get("access_token");
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java
index 983e150..53240d8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java
@@ -32,6 +32,7 @@
import org.apache.drill.common.JSONOptions;
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.common.logical.StoragePluginConfig;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.physical.base.AbstractGroupScan;
import org.apache.drill.exec.planner.logical.DynamicDrillTable;
import org.apache.drill.exec.server.DrillbitContext;
@@ -65,7 +66,7 @@
throws IOException {
MockTableSelection tableSelection = selection.getWith(
- new ObjectMapper(),
+ JacksonUtils.createObjectMapper(),
MockTableSelection.class
);
List<MockScanEntry> readEntries = tableSelection.getEntries();
@@ -152,7 +153,7 @@
MockTableDef mockTableDefn;
try {
String json = Resources.toString(url, Charsets.UTF_8);
- final ObjectMapper mapper = new ObjectMapper();
+ final ObjectMapper mapper = JacksonUtils.createObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
mockTableDefn = mapper.readValue(json, MockTableDef.class);
} catch (JsonParseException e) {
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java
index 4e294e5..a9202bc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java
@@ -29,6 +29,7 @@
import org.apache.drill.common.collections.Collectors;
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.common.util.DrillVersionInfo;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.serialization.PathSerDe;
import org.apache.drill.exec.store.TimedCallable;
import org.apache.drill.exec.store.dfs.MetadataContext;
@@ -531,13 +532,14 @@
JsonFactory jsonFactory = new JsonFactory();
jsonFactory.configure(Feature.AUTO_CLOSE_TARGET, false);
jsonFactory.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
- ObjectMapper mapper = new ObjectMapper(jsonFactory);
SimpleModule module = new SimpleModule();
module.addSerializer(Path.class, new PathSerDe.Se());
if (parquetMetadata instanceof Metadata_V4.FileMetadata) {
module.addSerializer(ColumnMetadata_v4.class, new ColumnMetadata_v4.Serializer());
}
- mapper.registerModule(module);
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder(jsonFactory)
+ .addModule(module)
+ .build();
OutputStream os = fs.create(p);
mapper.writerWithDefaultPrettyPrinter().writeValue(os, parquetMetadata);
os.flush();
@@ -556,7 +558,7 @@
Stopwatch timer = logger.isDebugEnabled() ? Stopwatch.createStarted() : null;
Path metadataParentDir = Path.getPathWithoutSchemeAndAuthority(path.getParent());
String metadataParentDirPath = metadataParentDir.toUri().getPath();
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
final SimpleModule serialModule = new SimpleModule();
serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De());
@@ -729,14 +731,15 @@
}
}
// Read the existing metadataSummary cache file to get the metadataSummary
- ObjectMapper mapper = new ObjectMapper();
final SimpleModule serialModule = new SimpleModule();
serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De());
serialModule.addKeyDeserializer(ColumnTypeMetadata_v4.Key.class, new ColumnTypeMetadata_v4.Key.DeSerializer());
AfterburnerModule module = new AfterburnerModule();
module.setUseOptimizedBeanDeserializer(true);
- mapper.registerModule(serialModule);
- mapper.registerModule(module);
+ ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(serialModule)
+ .addModule(module)
+ .build();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
InputStream is = fs.open(summaryFile);
return mapper.readValue(is, Metadata_V4.MetadataSummary.class);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
index 668306e..da48c6e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
@@ -83,6 +83,10 @@
return new StoreConfigBuilder<>(new ProtoSerializer<>(readSchema, writeSchema));
}
+ public static <V> StoreConfigBuilder<V> newJacksonBuilder(Class<V> clazz) {
+ return new StoreConfigBuilder<>(new JacksonSerializer<>(clazz));
+ }
+
public static <V> StoreConfigBuilder<V> newJacksonBuilder(ObjectMapper mapper, Class<V> clazz) {
return new StoreConfigBuilder<>(new JacksonSerializer<>(mapper, clazz));
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControls.java b/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControls.java
index 3543253..728c26c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControls.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControls.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.shaded.guava.com.google.common.annotations.VisibleForTesting;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.exceptions.UserException;
@@ -47,7 +48,7 @@
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExecutionControls.class);
// used to map JSON specified injections to POJOs
- public static final ObjectMapper controlsOptionMapper = new ObjectMapper();
+ public static final ObjectMapper controlsOptionMapper = JacksonUtils.createObjectMapper();
static {
controlsOptionMapper.addMixInAnnotations(Injection.class, InjectionMixIn.class);
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java
index 2e3a0d0..54fee8c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java
@@ -20,7 +20,9 @@
import java.util.ArrayList;
import java.util.List;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.physical.base.FragmentRoot;
import org.apache.drill.exec.planner.PhysicalPlanReader;
import org.apache.drill.exec.planner.fragment.Wrapper;
@@ -29,12 +31,12 @@
import org.apache.drill.exec.proto.ExecProtos;
import org.apache.drill.exec.server.options.OptionList;
import org.apache.drill.exec.work.foreman.ForemanSetupException;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
public class QueryWorkUnit {
+ private static final ObjectMapper MAPPER = JacksonUtils.createObjectMapper();
+
/**
* Definition of a minor fragment that contains the (unserialized) fragment operator
* tree and the (partially built) fragment. Allows the resource manager to apply
@@ -149,10 +151,9 @@
String jsonString = "<<malformed JSON>>";
stringBuilder.append(" fragment_json: ");
- final ObjectMapper objectMapper = new ObjectMapper();
try {
- final Object json = objectMapper.readValue(planFragment.getFragmentJson(), Object.class);
- jsonString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
+ final Object json = MAPPER.readValue(planFragment.getFragmentJson(), Object.class);
+ jsonString = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(json);
} catch (final Exception e) {
// we've already set jsonString to a fallback value
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index 2021635..3cdc961 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -18,6 +18,7 @@
package org.apache.drill.exec.work.foreman;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.work.filter.RuntimeFilterRouter;
import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
import org.apache.drill.shaded.guava.com.google.common.collect.Lists;
@@ -100,7 +101,7 @@
public enum ProfileOption { SYNC, ASYNC, NONE }
- private static final ObjectMapper MAPPER = new ObjectMapper();
+ private static final ObjectMapper MAPPER = JacksonUtils.createObjectMapper();
private final QueryId queryId;
private final String queryIdString;
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestPathSerialization.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestPathSerialization.java
index fd697f5..532a567 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestPathSerialization.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestPathSerialization.java
@@ -18,7 +18,9 @@
package org.apache.drill.exec;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.serialization.PathSerDe;
import org.apache.drill.exec.store.schedule.CompleteFileWork;
import org.apache.drill.test.DrillTest;
@@ -39,9 +41,10 @@
SimpleModule module = new SimpleModule();
module.addSerializer(Path.class, new PathSerDe.Se());
- objectMapper.registerModule(module);
+ ObjectMapper testMapper = JacksonUtils.createObjectMapper();
+ testMapper.registerModule(module);
- CompleteFileWork.FileWorkImpl bean = objectMapper.readValue(jsonString, CompleteFileWork.FileWorkImpl.class);
+ CompleteFileWork.FileWorkImpl bean = testMapper.readValue(jsonString, CompleteFileWork.FileWorkImpl.class);
assertThat(bean.getStart() == 1, equalTo( true ));
assertThat(bean.getLength() == 2, equalTo( true ));
@@ -53,10 +56,11 @@
CompleteFileWork.FileWorkImpl fileWork = new CompleteFileWork.FileWorkImpl(5, 6, new Path("/tmp"));
SimpleModule module = new SimpleModule();
module.addSerializer(Path.class, new PathSerDe.Se());
- objectMapper.registerModule(module);
+ ObjectMapper testMapper = JacksonUtils.createObjectMapper();
+ testMapper.registerModule(module);
CompleteFileWork.FileWorkImpl bean =
- objectMapper.readValue(objectMapper.writeValueAsString(fileWork), CompleteFileWork.FileWorkImpl.class);
+ testMapper.readValue(testMapper.writeValueAsString(fileWork), CompleteFileWork.FileWorkImpl.class);
assertThat(bean.getStart() == 5, equalTo( true ));
assertThat(bean.getLength() == 6, equalTo( true ));
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/options/PersistedOptionValueTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/server/options/PersistedOptionValueTest.java
index 04b7bb9..1f82f14 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/options/PersistedOptionValueTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/options/PersistedOptionValueTest.java
@@ -19,7 +19,6 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.common.util.DrillFileUtils;
import org.apache.drill.exec.serialization.JacksonSerializer;
import org.apache.drill.test.BaseTest;
@@ -46,7 +45,7 @@
private void testHelper(String booleanOptionFile, String doubleOptionFile,
String longOptionFile, String stringOptionFile) throws IOException {
- JacksonSerializer serializer = new JacksonSerializer<>(new ObjectMapper(), PersistedOptionValue.class);
+ JacksonSerializer serializer = new JacksonSerializer<>(PersistedOptionValue.class);
String booleanOptionJson = DrillFileUtils.getResourceAsString(booleanOptionFile);
String doubleOptionJson = DrillFileUtils.getResourceAsString(doubleOptionFile);
String longOptionJson = DrillFileUtils.getResourceAsString(longOptionFile);
@@ -97,8 +96,8 @@
public void testForwardCompatibility() throws IOException {
final String name = "myOption";
- JacksonSerializer realSerializer = new JacksonSerializer<>(new ObjectMapper(), PersistedOptionValue.class);
- JacksonSerializer mockSerializer = new JacksonSerializer<>(new ObjectMapper(), MockPersistedOptionValue.class);
+ JacksonSerializer realSerializer = new JacksonSerializer<>(PersistedOptionValue.class);
+ JacksonSerializer mockSerializer = new JacksonSerializer<>(MockPersistedOptionValue.class);
final String stringContent = "val1";
PersistedOptionValue stringValue =
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestRestJson.java b/exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestRestJson.java
index 5449a3c..b432511 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestRestJson.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestRestJson.java
@@ -28,6 +28,7 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.proto.UserBitShared.QueryType;
import org.apache.drill.exec.store.easy.text.TextFormatConfig;
@@ -81,7 +82,7 @@
.readTimeout(TIMEOUT, TimeUnit.SECONDS)
.build();
- private final ObjectMapper mapper = new ObjectMapper();
+ private final ObjectMapper mapper = JacksonUtils.createObjectMapper();
private final FileVerifier verifier = new FileVerifier("/rest");
@BeforeClass
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestInfoSchema.java b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestInfoSchema.java
index 469462e..7619ea0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestInfoSchema.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestInfoSchema.java
@@ -21,6 +21,7 @@
import org.apache.drill.categories.SqlTest;
import org.apache.drill.common.exceptions.UserRemoteException;
import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.physical.rowSet.DirectRowSet;
import org.apache.drill.exec.physical.rowSet.RowSet;
import org.apache.drill.exec.physical.rowSet.RowSetBuilder;
@@ -63,7 +64,7 @@
@Category(SqlTest.class)
public class TestInfoSchema extends ClusterTest {
private static final String TEST_SUB_DIR = "testSubDir";
- private static final ObjectMapper mapper = new ObjectMapper().enable(INDENT_OUTPUT);
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper().enable(INDENT_OUTPUT);
@BeforeClass
public static void setupFiles() throws Exception {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetReaderConfig.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetReaderConfig.java
index f44a56a..18c4b25 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetReaderConfig.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetReaderConfig.java
@@ -21,6 +21,7 @@
import org.apache.drill.categories.ParquetTest;
import org.apache.drill.categories.UnlikelyTest;
import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.server.options.SessionOptionManager;
import org.apache.drill.exec.server.options.SystemOptionManager;
@@ -40,7 +41,7 @@
@Test
public void testDefaultsDeserialization() throws Exception {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
ParquetReaderConfig readerConfig = ParquetReaderConfig.builder().build(); // all defaults
String value = mapper.writeValueAsString(readerConfig);
assertEquals(ParquetReaderConfig.getDefaultInstance(), readerConfig); // compare with default instance
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/PStoreTestUtil.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/PStoreTestUtil.java
index d814551..b8b9acd 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/PStoreTestUtil.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/PStoreTestUtil.java
@@ -26,13 +26,11 @@
import java.util.Map;
import java.util.Map.Entry;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
public class PStoreTestUtil {
public static void test(PersistentStoreProvider provider) throws Exception {
PersistentStore<String> store = provider.getOrCreateStore(
- PersistentStoreConfig.newJacksonBuilder(new ObjectMapper(), String.class)
+ PersistentStoreConfig.newJacksonBuilder(String.class)
.name("sys.test")
.build()
);
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestLocalPersistentStore.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestLocalPersistentStore.java
index b26ccca..42dbf92 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestLocalPersistentStore.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestLocalPersistentStore.java
@@ -17,7 +17,6 @@
*/
package org.apache.drill.exec.store.sys;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.drill.categories.UnlikelyTest;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.exec.store.dfs.DrillFileSystem;
@@ -51,7 +50,7 @@
public TemporaryFolder root = new TemporaryFolder();
private static final PersistentStoreConfig<String> DEFAULT_STORE_CONFIG = PersistentStoreConfig
- .newJacksonBuilder(new ObjectMapper(), String.class)
+ .newJacksonBuilder(String.class)
.name("local-test-store")
.build();
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestPStoreProviders.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestPStoreProviders.java
index a90d947..89819e0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestPStoreProviders.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/sys/TestPStoreProviders.java
@@ -17,7 +17,6 @@
*/
package org.apache.drill.exec.store.sys;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.curator.framework.CuratorFramework;
import org.apache.drill.categories.FlakyTest;
import org.apache.drill.categories.SlowTest;
@@ -123,7 +122,7 @@
curator.start();
PersistentStoreConfig<PersistedOptionValue> storeConfig =
- PersistentStoreConfig.newJacksonBuilder(new ObjectMapper(), PersistedOptionValue.class).name("sys.test").build();
+ PersistentStoreConfig.newJacksonBuilder(PersistedOptionValue.class).name("sys.test").build();
try (ZookeeperClient zkClient = new ZookeeperClient(curator,
PathUtils.join("/", storeConfig.getName()), CreateMode.PERSISTENT)) {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
index 5a29f2a..bf880c4 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
@@ -36,9 +36,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
public class TestRepeated extends BaseTest {
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestRepeated.class);
@@ -238,8 +235,6 @@
map.end();
}
- final ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
-
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
final JsonWriter jsonWriter = new JsonWriter(stream, true, true);
final FieldReader reader = mapVector.getChild("col", MapVector.class).getReader();
diff --git a/exec/java-exec/src/test/java/org/apache/drill/test/PhysicalOpUnitTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/test/PhysicalOpUnitTestBase.java
index 8d20789..e2ed409 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/test/PhysicalOpUnitTestBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/test/PhysicalOpUnitTestBase.java
@@ -20,6 +20,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.calcite.rel.RelFieldCollation;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.coord.ClusterCoordinator;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.ops.AccountingDataTunnel;
@@ -374,7 +375,7 @@
* @return The {@link org.apache.drill.exec.store.easy.json.JSONRecordReader} corresponding to each given jsonBatch.
*/
public static Iterator<RecordReader> getJsonReadersFromBatchString(List<String> jsonBatches, FragmentContext fragContext, List<SchemaPath> columnsToRead) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
List<RecordReader> readers = new ArrayList<>();
for (String batchJason : jsonBatches) {
JsonNode records;
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/record/metadata/TupleMetadata.java b/exec/vector/src/main/java/org/apache/drill/exec/record/metadata/TupleMetadata.java
index 6a25a56..674ece6 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/record/metadata/TupleMetadata.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/record/metadata/TupleMetadata.java
@@ -23,9 +23,9 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.exec.record.MaterializedField;
/**
@@ -56,8 +56,8 @@
})
public interface TupleMetadata extends Propertied, Iterable<ColumnMetadata> {
- ObjectWriter WRITER = new ObjectMapper().writerFor(TupleMetadata.class);
- ObjectReader READER = new ObjectMapper().readerFor(TupleMetadata.class);
+ ObjectWriter WRITER = JacksonUtils.createObjectMapper().writerFor(TupleMetadata.class);
+ ObjectReader READER = JacksonUtils.createObjectMapper().readerFor(TupleMetadata.class);
String IS_STRICT_SCHEMA_PROP = DRILL_PROP_PREFIX + "strict";
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java b/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java
index 19ff04b..d0e149f 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java
@@ -21,15 +21,13 @@
import java.util.List;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
public class JsonStringArrayList<E> extends ArrayList<E> {
- private static ObjectMapper mapper;
-
- static {
- mapper = new ObjectMapper();
- mapper.registerModule(SerializationModule.getModule());
- }
+ private static final ObjectMapper mapper = JacksonUtils.createJsonMapperBuilder()
+ .addModule(SerializationModule.getModule())
+ .build();
@Override
public boolean equals(Object obj) {
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java b/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java
index 337858f..3fcecb4 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java
@@ -24,6 +24,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.joda.JodaModule;
+import org.apache.drill.common.util.JacksonUtils;
/*
* Simple class that extends the regular java.util.HashMap but overrides the
@@ -31,7 +32,7 @@
*/
public class JsonStringHashMap<K, V> extends LinkedHashMap<K, V> {
- private static final ObjectMapper mapper = new ObjectMapper()
+ private static final ObjectMapper mapper = JacksonUtils.createObjectMapper()
.registerModule(SerializationModule.getModule())
.registerModule(new JodaModule());
diff --git a/logical/src/main/java/org/apache/drill/common/JSONOptions.java b/logical/src/main/java/org/apache/drill/common/JSONOptions.java
index 5bfdb56..9bdafaa 100644
--- a/logical/src/main/java/org/apache/drill/common/JSONOptions.java
+++ b/logical/src/main/java/org/apache/drill/common/JSONOptions.java
@@ -25,6 +25,7 @@
import org.apache.drill.common.JSONOptions.Se;
import org.apache.drill.common.config.LogicalPlanPersistence;
import org.apache.drill.common.exceptions.LogicalPlanParsingException;
+import org.apache.drill.common.util.JacksonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,6 +52,7 @@
public class JSONOptions {
private final static Logger logger = LoggerFactory.getLogger(JSONOptions.class);
+ private final static ObjectMapper DEFAULT_MAPPER = JacksonUtils.createObjectMapper();
private JsonNode root;
private JsonLocation location;
@@ -130,6 +132,10 @@
return mapper.treeAsTokens(root).readValueAs(t);
}
+ public <T> T getListWith(TypeReference<T> t) throws IOException {
+ return getListWith(DEFAULT_MAPPER, t);
+ }
+
public JsonNode path(String name) {
return root.path(name);
}
diff --git a/logical/src/main/java/org/apache/drill/common/config/LogicalPlanPersistence.java b/logical/src/main/java/org/apache/drill/common/config/LogicalPlanPersistence.java
index 719e838..903b8f0 100644
--- a/logical/src/main/java/org/apache/drill/common/config/LogicalPlanPersistence.java
+++ b/logical/src/main/java/org/apache/drill/common/config/LogicalPlanPersistence.java
@@ -28,6 +28,7 @@
import org.apache.drill.common.logical.data.LogicalOperator;
import org.apache.drill.common.scanner.persistence.ScanResult;
import org.apache.drill.common.logical.security.CredentialsProvider;
+import org.apache.drill.common.util.JacksonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +46,7 @@
private final ObjectMapper mapper;
public LogicalPlanPersistence(DrillConfig conf, ScanResult scanResult) {
- this(conf, scanResult, new ObjectMapper());
+ this(conf, scanResult, JacksonUtils.createObjectMapper());
}
public LogicalPlanPersistence(DrillConfig conf, ScanResult scanResult, ObjectMapper mapper) {
diff --git a/logical/src/main/java/org/apache/drill/common/util/AbstractDynamicBean.java b/logical/src/main/java/org/apache/drill/common/util/AbstractDynamicBean.java
index 5765a5e..0814d18 100644
--- a/logical/src/main/java/org/apache/drill/common/util/AbstractDynamicBean.java
+++ b/logical/src/main/java/org/apache/drill/common/util/AbstractDynamicBean.java
@@ -69,8 +69,8 @@
private static synchronized ObjectMapper getMapper(){
- if(MAPPER == null){
- ObjectMapper mapper = new ObjectMapper();
+ if (MAPPER == null) {
+ ObjectMapper mapper = JacksonUtils.createObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
mapper.configure(Feature.ALLOW_COMMENTS, true);
diff --git a/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/ColumnStatistics.java b/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/ColumnStatistics.java
index 5fbb85a..b909280 100644
--- a/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/ColumnStatistics.java
+++ b/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/ColumnStatistics.java
@@ -28,6 +28,7 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.metastore.util.TableMetadataUtils;
import java.io.IOException;
@@ -66,13 +67,13 @@
@JsonPropertyOrder({"statistics", "comparator"})
public class ColumnStatistics<T> {
- private static final ObjectWriter OBJECT_WRITER = new ObjectMapper()
- .registerModule(new JodaModule())
- .writerFor(ColumnStatistics.class);
+ private static final ObjectMapper MAPPER = JacksonUtils.createJsonMapperBuilder()
+ .addModule(new JodaModule())
+ .build();
- private static final ObjectReader OBJECT_READER = new ObjectMapper()
- .registerModule(new JodaModule())
- .readerFor(ColumnStatistics.class);
+ private static final ObjectWriter OBJECT_WRITER = MAPPER.writerFor(ColumnStatistics.class);
+
+ private static final ObjectReader OBJECT_READER = MAPPER.readerFor(ColumnStatistics.class);
private final Map<String, StatisticsHolder<?>> statistics;
private final Comparator<T> valueComparator;
diff --git a/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/StatisticsHolder.java b/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/StatisticsHolder.java
index ffbe3ac..a7964a7 100644
--- a/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/StatisticsHolder.java
+++ b/metastore/metastore-api/src/main/java/org/apache/drill/metastore/statistics/StatisticsHolder.java
@@ -25,6 +25,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
+import org.apache.drill.common.util.JacksonUtils;
import java.io.IOException;
import java.util.Objects;
@@ -38,8 +39,9 @@
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class StatisticsHolder<T> {
- private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().writerFor(StatisticsHolder.class);
- private static final ObjectReader OBJECT_READER = new ObjectMapper().readerFor(StatisticsHolder.class);
+ private static final ObjectMapper OBJECT_MAPPER = JacksonUtils.createObjectMapper();
+ private static final ObjectWriter OBJECT_WRITER = OBJECT_MAPPER.writerFor(StatisticsHolder.class);
+ private static final ObjectReader OBJECT_READER = OBJECT_MAPPER.readerFor(StatisticsHolder.class);
private final T statisticsValue;
private final BaseStatisticsKind<?> statisticsKind;
diff --git a/metastore/rdbms-metastore/src/main/java/org/apache/drill/metastore/rdbms/util/ConverterUtil.java b/metastore/rdbms-metastore/src/main/java/org/apache/drill/metastore/rdbms/util/ConverterUtil.java
index e1f2ae7..e8bd423 100644
--- a/metastore/rdbms-metastore/src/main/java/org/apache/drill/metastore/rdbms/util/ConverterUtil.java
+++ b/metastore/rdbms-metastore/src/main/java/org/apache/drill/metastore/rdbms/util/ConverterUtil.java
@@ -20,6 +20,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.drill.common.util.JacksonUtils;
import org.apache.drill.metastore.rdbms.exception.RdbmsMetastoreException;
import java.io.IOException;
@@ -31,7 +32,7 @@
*/
public class ConverterUtil {
- private static final ObjectMapper MAPPER = new ObjectMapper();
+ private static final ObjectMapper MAPPER = JacksonUtils.createObjectMapper();
private static final TypeReference<List<String>> LIST_STRING_TYPE_REF = new TypeReference<List<String>>() {
};