From e9c98548e9e79ebcc627d5ca1797063e134bfeb7 Mon Sep 17 00:00:00 2001 From: zhuqi Date: Tue, 16 Mar 2021 12:50:29 +0800 Subject: [PATCH] YARN-10689. Fix the finding bugs in extractFloatValueFromWeightConfig. (#2760) Signed-off-by: Akira Ajisaka --- .../scheduler/capacity/CapacitySchedulerConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java index 5b2906062f..ce3c0cb3e0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java @@ -775,7 +775,7 @@ private float extractFloatValueFromWeightConfig(String configureValue) { if (!configuredWeightAsCapacity(configureValue)) { return -1f; } else { - return Float.valueOf( + return Float.parseFloat( configureValue.substring(0, configureValue.indexOf(WEIGHT_SUFFIX))); } }