diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkItem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkItem.java index 0cdd10710c9..505273ec979 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkItem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkItem.java @@ -37,7 +37,7 @@ import java.io.IOException; public class DiskBalancerWorkItem { private static final ObjectMapper MAPPER = new ObjectMapper(); private static final ObjectReader READER = - new ObjectMapper().reader(DiskBalancerWorkItem.class); + new ObjectMapper().readerFor(DiskBalancerWorkItem.class); private long startTime; private long secondsElapsed; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkStatus.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkStatus.java index 452ab27fadc..af34c49dd12 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkStatus.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancerWorkStatus.java @@ -43,9 +43,9 @@ public class DiskBalancerWorkStatus { private static final ObjectMapper MAPPER_WITH_INDENT_OUTPUT = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final ObjectReader READER_WORKSTATUS = - new ObjectMapper().reader(DiskBalancerWorkStatus.class); + new ObjectMapper().readerFor(DiskBalancerWorkStatus.class); private static final ObjectReader READER_WORKENTRY = new ObjectMapper() - .reader(defaultInstance().constructCollectionType(List.class, + .readerFor(defaultInstance().constructCollectionType(List.class, DiskBalancerWorkEntry.class)); private final List currentState; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/CombinedHostsFileReader.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/CombinedHostsFileReader.java index 668d56ee8ac..8da5655eda5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/CombinedHostsFileReader.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/CombinedHostsFileReader.java @@ -48,7 +48,7 @@ import org.apache.hadoop.hdfs.protocol.DatanodeAdminProperties; @InterfaceStability.Unstable public final class CombinedHostsFileReader { private static final ObjectReader READER = - new ObjectMapper().reader(DatanodeAdminProperties.class); + new ObjectMapper().readerFor(DatanodeAdminProperties.class); private static final JsonFactory JSON_FACTORY = new JsonFactory(); private CombinedHostsFileReader() { diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java index 3690a861340..246f2424bdb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java @@ -526,7 +526,7 @@ class JsonUtilClient { } final String namesInJson = (String) json.get("XAttrNames"); - ObjectReader reader = new ObjectMapper().reader(List.class); + ObjectReader reader = new ObjectMapper().readerFor(List.class); final List xattrs = reader.readValue(namesInJson); final List names = Lists.newArrayListWithCapacity(json.keySet().size()); diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java index fbb4bd6e6e0..26cfc019672 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java @@ -152,7 +152,7 @@ public class WebHdfsFileSystem extends FileSystem private String restCsrfCustomHeader; private Set restCsrfMethodsToIgnore; private static final ObjectReader READER = - new ObjectMapper().reader(Map.class); + new ObjectMapper().readerFor(Map.class); private DFSOpsCountStatistics storageStatistics; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/ConfRefreshTokenBasedAccessTokenProvider.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/ConfRefreshTokenBasedAccessTokenProvider.java index f90ca193c67..c6ebdd67eb8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/ConfRefreshTokenBasedAccessTokenProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/ConfRefreshTokenBasedAccessTokenProvider.java @@ -56,7 +56,7 @@ import static org.apache.hadoop.hdfs.web.oauth2.Utils.notNull; public class ConfRefreshTokenBasedAccessTokenProvider extends AccessTokenProvider { private static final ObjectReader READER = - new ObjectMapper().reader(Map.class); + new ObjectMapper().readerFor(Map.class); public static final String OAUTH_REFRESH_TOKEN_KEY = "dfs.webhdfs.oauth2.refresh.token"; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/CredentialBasedAccessTokenProvider.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/CredentialBasedAccessTokenProvider.java index 8c0ddd40ceb..5c629e01658 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/CredentialBasedAccessTokenProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/CredentialBasedAccessTokenProvider.java @@ -56,7 +56,7 @@ import static org.apache.hadoop.hdfs.web.oauth2.Utils.notNull; public abstract class CredentialBasedAccessTokenProvider extends AccessTokenProvider { private static final ObjectReader READER = - new ObjectMapper().reader(Map.class); + new ObjectMapper().readerFor(Map.class); public static final String OAUTH_CREDENTIAL_KEY = "dfs.webhdfs.oauth2.credential"; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java index 97bb09b9be6..c317715f366 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java @@ -106,7 +106,7 @@ public class FsVolumeImpl implements FsVolumeSpi { private static final ObjectWriter WRITER = new ObjectMapper().writerWithDefaultPrettyPrinter(); private static final ObjectReader READER = - new ObjectMapper().reader(BlockIteratorState.class); + new ObjectMapper().readerFor(BlockIteratorState.class); private final FsDatasetImpl dataset; private final String storageID; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java index cee37e5b66e..22fd5beca7e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java @@ -77,7 +77,7 @@ import java.util.TreeSet; */ public abstract class Command extends Configured implements Closeable { private static final ObjectReader READER = - new ObjectMapper().reader(HashMap.class); + new ObjectMapper().readerFor(HashMap.class); static final Logger LOG = LoggerFactory.getLogger(Command.class); private Map validArgs = new HashMap<>(); private URI clusterURI; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/connectors/JsonNodeConnector.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/connectors/JsonNodeConnector.java index 323938acc94..838511ba82b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/connectors/JsonNodeConnector.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/connectors/JsonNodeConnector.java @@ -38,7 +38,7 @@ public class JsonNodeConnector implements ClusterConnector { private static final Logger LOG = LoggerFactory.getLogger(JsonNodeConnector.class); private static final ObjectReader READER = - new ObjectMapper().reader(DiskBalancerCluster.class); + new ObjectMapper().readerFor(DiskBalancerCluster.class); private final URL clusterURI; /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerCluster.java index 1b178293ebb..2f54141cda6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerCluster.java @@ -73,7 +73,7 @@ public class DiskBalancerCluster { private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerCluster.class); private static final ObjectReader READER = - new ObjectMapper().reader(DiskBalancerCluster.class); + new ObjectMapper().readerFor(DiskBalancerCluster.class); private final Set exclusionList; private final Set inclusionList; private ClusterConnector clusterConnector; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerVolume.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerVolume.java index ccaa7d99106..47a925c1525 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerVolume.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/datamodel/DiskBalancerVolume.java @@ -33,7 +33,7 @@ import java.io.IOException; @JsonIgnoreProperties(ignoreUnknown = true) public class DiskBalancerVolume { private static final ObjectReader READER = - new ObjectMapper().reader(DiskBalancerVolume.class); + new ObjectMapper().readerFor(DiskBalancerVolume.class); private String path; private long capacity; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/NodePlan.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/NodePlan.java index 153536a5f5e..c72bb1f4c13 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/NodePlan.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/NodePlan.java @@ -166,7 +166,7 @@ public class NodePlan { public String toJson() throws IOException { ObjectMapper mapper = new ObjectMapper(); JavaType planType = mapper.constructType(NodePlan.class); - return mapper.writerWithType(planType) + return mapper.writerFor(planType) .writeValueAsString(this); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestJsonUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestJsonUtil.java index 94cec8596bd..5a3d451bef0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestJsonUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestJsonUtil.java @@ -71,7 +71,7 @@ public class TestJsonUtil { System.out.println("fstatus = " + fstatus); final String json = JsonUtil.toJsonString(status, true); System.out.println("json = " + json.replace(",", ",\n ")); - ObjectReader reader = new ObjectMapper().reader(Map.class); + ObjectReader reader = new ObjectMapper().readerFor(Map.class); final HdfsFileStatus s2 = JsonUtilClient.toFileStatus((Map) reader.readValue(json), true); final FileStatus fs2 = toFileStatus(s2, parent); @@ -159,7 +159,7 @@ public class TestJsonUtil { public void testToAclStatus() throws IOException { String jsonString = "{\"AclStatus\":{\"entries\":[\"user::rwx\",\"user:user1:rw-\",\"group::rw-\",\"other::r-x\"],\"group\":\"supergroup\",\"owner\":\"testuser\",\"stickyBit\":false}}"; - ObjectReader reader = new ObjectMapper().reader(Map.class); + ObjectReader reader = new ObjectMapper().readerFor(Map.class); Map json = reader.readValue(jsonString); List aclSpec = @@ -219,7 +219,7 @@ public class TestJsonUtil { String jsonString = "{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," + "{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}"; - ObjectReader reader = new ObjectMapper().reader(Map.class); + ObjectReader reader = new ObjectMapper().readerFor(Map.class); Map json = reader.readValue(jsonString); XAttr xAttr1 = (new XAttr.Builder()).setNameSpace(XAttr.NameSpace.USER). setName("a1").setValue(XAttrCodec.decodeValue("0x313233")).build(); @@ -245,7 +245,7 @@ public class TestJsonUtil { String jsonString = "{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," + "{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}"; - ObjectReader reader = new ObjectMapper().reader(Map.class); + ObjectReader reader = new ObjectMapper().readerFor(Map.class); Map json = reader.readValue(jsonString); // Get xattr: user.a2