HDFS-11233. Fix javac warnings related to the deprecated APIs after upgrading Jackson. Contributed by Yiqun Lin.
This commit is contained in:
parent
c6a3923245
commit
2d4731c067
|
@ -37,7 +37,7 @@ import java.io.IOException;
|
||||||
public class DiskBalancerWorkItem {
|
public class DiskBalancerWorkItem {
|
||||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(DiskBalancerWorkItem.class);
|
new ObjectMapper().readerFor(DiskBalancerWorkItem.class);
|
||||||
|
|
||||||
private long startTime;
|
private long startTime;
|
||||||
private long secondsElapsed;
|
private long secondsElapsed;
|
||||||
|
|
|
@ -43,9 +43,9 @@ public class DiskBalancerWorkStatus {
|
||||||
private static final ObjectMapper MAPPER_WITH_INDENT_OUTPUT =
|
private static final ObjectMapper MAPPER_WITH_INDENT_OUTPUT =
|
||||||
new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
|
new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
private static final ObjectReader READER_WORKSTATUS =
|
private static final ObjectReader READER_WORKSTATUS =
|
||||||
new ObjectMapper().reader(DiskBalancerWorkStatus.class);
|
new ObjectMapper().readerFor(DiskBalancerWorkStatus.class);
|
||||||
private static final ObjectReader READER_WORKENTRY = new ObjectMapper()
|
private static final ObjectReader READER_WORKENTRY = new ObjectMapper()
|
||||||
.reader(defaultInstance().constructCollectionType(List.class,
|
.readerFor(defaultInstance().constructCollectionType(List.class,
|
||||||
DiskBalancerWorkEntry.class));
|
DiskBalancerWorkEntry.class));
|
||||||
|
|
||||||
private final List<DiskBalancerWorkEntry> currentState;
|
private final List<DiskBalancerWorkEntry> currentState;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.apache.hadoop.hdfs.protocol.DatanodeAdminProperties;
|
||||||
@InterfaceStability.Unstable
|
@InterfaceStability.Unstable
|
||||||
public final class CombinedHostsFileReader {
|
public final class CombinedHostsFileReader {
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(DatanodeAdminProperties.class);
|
new ObjectMapper().readerFor(DatanodeAdminProperties.class);
|
||||||
private static final JsonFactory JSON_FACTORY = new JsonFactory();
|
private static final JsonFactory JSON_FACTORY = new JsonFactory();
|
||||||
|
|
||||||
private CombinedHostsFileReader() {
|
private CombinedHostsFileReader() {
|
||||||
|
|
|
@ -526,7 +526,7 @@ class JsonUtilClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String namesInJson = (String) json.get("XAttrNames");
|
final String namesInJson = (String) json.get("XAttrNames");
|
||||||
ObjectReader reader = new ObjectMapper().reader(List.class);
|
ObjectReader reader = new ObjectMapper().readerFor(List.class);
|
||||||
final List<Object> xattrs = reader.readValue(namesInJson);
|
final List<Object> xattrs = reader.readValue(namesInJson);
|
||||||
final List<String> names =
|
final List<String> names =
|
||||||
Lists.newArrayListWithCapacity(json.keySet().size());
|
Lists.newArrayListWithCapacity(json.keySet().size());
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class WebHdfsFileSystem extends FileSystem
|
||||||
private String restCsrfCustomHeader;
|
private String restCsrfCustomHeader;
|
||||||
private Set<String> restCsrfMethodsToIgnore;
|
private Set<String> restCsrfMethodsToIgnore;
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(Map.class);
|
new ObjectMapper().readerFor(Map.class);
|
||||||
|
|
||||||
private DFSOpsCountStatistics storageStatistics;
|
private DFSOpsCountStatistics storageStatistics;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ import static org.apache.hadoop.hdfs.web.oauth2.Utils.notNull;
|
||||||
public class ConfRefreshTokenBasedAccessTokenProvider
|
public class ConfRefreshTokenBasedAccessTokenProvider
|
||||||
extends AccessTokenProvider {
|
extends AccessTokenProvider {
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(Map.class);
|
new ObjectMapper().readerFor(Map.class);
|
||||||
|
|
||||||
public static final String OAUTH_REFRESH_TOKEN_KEY
|
public static final String OAUTH_REFRESH_TOKEN_KEY
|
||||||
= "dfs.webhdfs.oauth2.refresh.token";
|
= "dfs.webhdfs.oauth2.refresh.token";
|
||||||
|
|
|
@ -56,7 +56,7 @@ import static org.apache.hadoop.hdfs.web.oauth2.Utils.notNull;
|
||||||
public abstract class CredentialBasedAccessTokenProvider
|
public abstract class CredentialBasedAccessTokenProvider
|
||||||
extends AccessTokenProvider {
|
extends AccessTokenProvider {
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(Map.class);
|
new ObjectMapper().readerFor(Map.class);
|
||||||
|
|
||||||
public static final String OAUTH_CREDENTIAL_KEY
|
public static final String OAUTH_CREDENTIAL_KEY
|
||||||
= "dfs.webhdfs.oauth2.credential";
|
= "dfs.webhdfs.oauth2.credential";
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class FsVolumeImpl implements FsVolumeSpi {
|
||||||
private static final ObjectWriter WRITER =
|
private static final ObjectWriter WRITER =
|
||||||
new ObjectMapper().writerWithDefaultPrettyPrinter();
|
new ObjectMapper().writerWithDefaultPrettyPrinter();
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(BlockIteratorState.class);
|
new ObjectMapper().readerFor(BlockIteratorState.class);
|
||||||
|
|
||||||
private final FsDatasetImpl dataset;
|
private final FsDatasetImpl dataset;
|
||||||
private final String storageID;
|
private final String storageID;
|
||||||
|
|
|
@ -77,7 +77,7 @@ import java.util.TreeSet;
|
||||||
*/
|
*/
|
||||||
public abstract class Command extends Configured implements Closeable {
|
public abstract class Command extends Configured implements Closeable {
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(HashMap.class);
|
new ObjectMapper().readerFor(HashMap.class);
|
||||||
static final Logger LOG = LoggerFactory.getLogger(Command.class);
|
static final Logger LOG = LoggerFactory.getLogger(Command.class);
|
||||||
private Map<String, String> validArgs = new HashMap<>();
|
private Map<String, String> validArgs = new HashMap<>();
|
||||||
private URI clusterURI;
|
private URI clusterURI;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class JsonNodeConnector implements ClusterConnector {
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
LoggerFactory.getLogger(JsonNodeConnector.class);
|
LoggerFactory.getLogger(JsonNodeConnector.class);
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(DiskBalancerCluster.class);
|
new ObjectMapper().readerFor(DiskBalancerCluster.class);
|
||||||
private final URL clusterURI;
|
private final URL clusterURI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class DiskBalancerCluster {
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
LoggerFactory.getLogger(DiskBalancerCluster.class);
|
LoggerFactory.getLogger(DiskBalancerCluster.class);
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(DiskBalancerCluster.class);
|
new ObjectMapper().readerFor(DiskBalancerCluster.class);
|
||||||
private final Set<String> exclusionList;
|
private final Set<String> exclusionList;
|
||||||
private final Set<String> inclusionList;
|
private final Set<String> inclusionList;
|
||||||
private ClusterConnector clusterConnector;
|
private ClusterConnector clusterConnector;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.io.IOException;
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class DiskBalancerVolume {
|
public class DiskBalancerVolume {
|
||||||
private static final ObjectReader READER =
|
private static final ObjectReader READER =
|
||||||
new ObjectMapper().reader(DiskBalancerVolume.class);
|
new ObjectMapper().readerFor(DiskBalancerVolume.class);
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
private long capacity;
|
private long capacity;
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class NodePlan {
|
||||||
public String toJson() throws IOException {
|
public String toJson() throws IOException {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
JavaType planType = mapper.constructType(NodePlan.class);
|
JavaType planType = mapper.constructType(NodePlan.class);
|
||||||
return mapper.writerWithType(planType)
|
return mapper.writerFor(planType)
|
||||||
.writeValueAsString(this);
|
.writeValueAsString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class TestJsonUtil {
|
||||||
System.out.println("fstatus = " + fstatus);
|
System.out.println("fstatus = " + fstatus);
|
||||||
final String json = JsonUtil.toJsonString(status, true);
|
final String json = JsonUtil.toJsonString(status, true);
|
||||||
System.out.println("json = " + json.replace(",", ",\n "));
|
System.out.println("json = " + json.replace(",", ",\n "));
|
||||||
ObjectReader reader = new ObjectMapper().reader(Map.class);
|
ObjectReader reader = new ObjectMapper().readerFor(Map.class);
|
||||||
final HdfsFileStatus s2 =
|
final HdfsFileStatus s2 =
|
||||||
JsonUtilClient.toFileStatus((Map<?, ?>) reader.readValue(json), true);
|
JsonUtilClient.toFileStatus((Map<?, ?>) reader.readValue(json), true);
|
||||||
final FileStatus fs2 = toFileStatus(s2, parent);
|
final FileStatus fs2 = toFileStatus(s2, parent);
|
||||||
|
@ -159,7 +159,7 @@ public class TestJsonUtil {
|
||||||
public void testToAclStatus() throws IOException {
|
public void testToAclStatus() throws IOException {
|
||||||
String jsonString =
|
String jsonString =
|
||||||
"{\"AclStatus\":{\"entries\":[\"user::rwx\",\"user:user1:rw-\",\"group::rw-\",\"other::r-x\"],\"group\":\"supergroup\",\"owner\":\"testuser\",\"stickyBit\":false}}";
|
"{\"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);
|
Map<?, ?> json = reader.readValue(jsonString);
|
||||||
|
|
||||||
List<AclEntry> aclSpec =
|
List<AclEntry> aclSpec =
|
||||||
|
@ -219,7 +219,7 @@ public class TestJsonUtil {
|
||||||
String jsonString =
|
String jsonString =
|
||||||
"{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," +
|
"{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," +
|
||||||
"{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}";
|
"{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}";
|
||||||
ObjectReader reader = new ObjectMapper().reader(Map.class);
|
ObjectReader reader = new ObjectMapper().readerFor(Map.class);
|
||||||
Map<?, ?> json = reader.readValue(jsonString);
|
Map<?, ?> json = reader.readValue(jsonString);
|
||||||
XAttr xAttr1 = (new XAttr.Builder()).setNameSpace(XAttr.NameSpace.USER).
|
XAttr xAttr1 = (new XAttr.Builder()).setNameSpace(XAttr.NameSpace.USER).
|
||||||
setName("a1").setValue(XAttrCodec.decodeValue("0x313233")).build();
|
setName("a1").setValue(XAttrCodec.decodeValue("0x313233")).build();
|
||||||
|
@ -245,7 +245,7 @@ public class TestJsonUtil {
|
||||||
String jsonString =
|
String jsonString =
|
||||||
"{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," +
|
"{\"XAttrs\":[{\"name\":\"user.a1\",\"value\":\"0x313233\"}," +
|
||||||
"{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}";
|
"{\"name\":\"user.a2\",\"value\":\"0x313131\"}]}";
|
||||||
ObjectReader reader = new ObjectMapper().reader(Map.class);
|
ObjectReader reader = new ObjectMapper().readerFor(Map.class);
|
||||||
Map<?, ?> json = reader.readValue(jsonString);
|
Map<?, ?> json = reader.readValue(jsonString);
|
||||||
|
|
||||||
// Get xattr: user.a2
|
// Get xattr: user.a2
|
||||||
|
|
Loading…
Reference in New Issue