HDFS-15347. Replace the deprecated method shaHex. Contributed by bianqi.
This commit is contained in:
parent
c784ba370e
commit
cb64e993c2
|
@ -399,7 +399,7 @@ public class DiskBalancer {
|
|||
|
||||
if ((planID == null) ||
|
||||
(planID.length() != sha1Length) ||
|
||||
!DigestUtils.shaHex(plan.getBytes(Charset.forName("UTF-8")))
|
||||
!DigestUtils.sha1Hex(plan.getBytes(Charset.forName("UTF-8")))
|
||||
.equalsIgnoreCase(planID)) {
|
||||
LOG.error("Disk Balancer - Invalid plan hash.");
|
||||
throw new DiskBalancerException("Invalid or mis-matched hash.",
|
||||
|
|
|
@ -94,7 +94,7 @@ public class CancelCommand extends Command {
|
|||
String dataNodeAddress = plan.getNodeName() + ":" + plan.getPort();
|
||||
Preconditions.checkNotNull(dataNodeAddress);
|
||||
ClientDatanodeProtocol dataNode = getDataNodeProxy(dataNodeAddress);
|
||||
String planHash = DigestUtils.shaHex(planData);
|
||||
String planHash = DigestUtils.sha1Hex(planData);
|
||||
try {
|
||||
dataNode.cancelDiskBalancePlan(planHash);
|
||||
} catch (DiskBalancerException ex) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ExecuteCommand extends Command {
|
|||
String dataNodeAddress = plan.getNodeName() + ":" + plan.getPort();
|
||||
Preconditions.checkNotNull(dataNodeAddress);
|
||||
ClientDatanodeProtocol dataNode = getDataNodeProxy(dataNodeAddress);
|
||||
String planHash = DigestUtils.shaHex(planData);
|
||||
String planHash = DigestUtils.sha1Hex(planData);
|
||||
try {
|
||||
dataNode.submitDiskBalancerPlan(planHash, DiskBalancerCLI.PLAN_VERSION,
|
||||
planFile, planData, skipDateCheck);
|
||||
|
|
|
@ -642,7 +642,7 @@ public class TestDiskBalancer {
|
|||
|
||||
node = cluster.getDataNodes().get(dataNodeIndex);
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
|
||||
// Submit the plan and wait till the execution is done.
|
||||
node.submitDiskBalancerPlan(planID, 1, PLAN_FILE, planJson,
|
||||
|
@ -740,7 +740,7 @@ public class TestDiskBalancer {
|
|||
reconfigThread.start();
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
diskBalancer.submitPlan(planID, 1, PLAN_FILE, planJson, false);
|
||||
|
||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||
|
|
|
@ -317,7 +317,7 @@ public class TestDiskBalancerRPC {
|
|||
plan = new NodePlan(node.getDataNodeName(), node.getDataNodePort());
|
||||
planner.balanceVolumeSet(node, node.getVolumeSets().get("DISK"), plan);
|
||||
planVersion = 1;
|
||||
planHash = DigestUtils.shaHex(plan.toJson());
|
||||
planHash = DigestUtils.sha1Hex(plan.toJson());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class TestDiskBalancerWithMockMover {
|
|||
private void executeSubmitPlan(NodePlan plan, DiskBalancer balancer,
|
||||
int version) throws IOException {
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
balancer.submitPlan(planID, version, PLAN_FILE, planJson, false);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ public class TestDiskBalancerWithMockMover {
|
|||
NodePlan plan = mockMoverHelper.getPlan();
|
||||
DiskBalancer balancer = mockMoverHelper.getBalancer();
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
|
||||
thrown.expect(DiskBalancerException.class);
|
||||
thrown.expect(new DiskBalancerResultVerifier(DiskBalancerException
|
||||
|
@ -232,7 +232,7 @@ public class TestDiskBalancerWithMockMover {
|
|||
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
char repChar = planID.charAt(0);
|
||||
repChar++;
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class TestDiskBalancerWithMockMover {
|
|||
|
||||
|
||||
String planJson = plan.toJson();
|
||||
String planID = DigestUtils.shaHex(planJson);
|
||||
String planID = DigestUtils.sha1Hex(planJson);
|
||||
balancer.cancelPlan(planID);
|
||||
|
||||
DiskBalancerWorkStatus status = balancer.queryWorkStatus();
|
||||
|
|
Loading…
Reference in New Issue