From b85ee0d75d450f1c695cec1bebac627f66a97c98 Mon Sep 17 00:00:00 2001 From: Vidura Mudalige Date: Thu, 27 Sep 2018 21:40:13 +0530 Subject: [PATCH] YARN-8819. Fix findbugs warnings in YarnServiceUtils Signed-off-by: Akira Ajisaka --- .../runtimes/yarnservice/YarnServiceUtils.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/runtimes/yarnservice/YarnServiceUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/runtimes/yarnservice/YarnServiceUtils.java index 26402dafb11..d69840abb90 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/runtimes/yarnservice/YarnServiceUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/runtimes/yarnservice/YarnServiceUtils.java @@ -115,15 +115,20 @@ public class YarnServiceUtils { private static String getComponentArrayJson(String componentName, int count, String endpointSuffix) { String component = "\\\"" + componentName + "\\\":"; - String array = "["; + StringBuilder array = new StringBuilder(); + array.append("["); for (int i = 0; i < count; i++) { - array = array + "\\\"" + componentName + "-" + i - + endpointSuffix + "\\\""; + array.append("\\\""); + array.append(componentName); + array.append("-"); + array.append(i); + array.append(endpointSuffix); + array.append("\\\""); if (i != count - 1) { - array = array + ","; + array.append(","); } } - array = array + "]"; - return component + array; + array.append("]"); + return component + array.toString(); } }