YARN-8819. Fix findbugs warnings in YarnServiceUtils

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Vidura Mudalige 2018-09-27 21:40:13 +05:30 committed by Akira Ajisaka
parent cdf5d58364
commit b85ee0d75d
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
1 changed files with 11 additions and 6 deletions

View File

@ -115,15 +115,20 @@ public class YarnServiceUtils {
private static String getComponentArrayJson(String componentName, int count, private static String getComponentArrayJson(String componentName, int count,
String endpointSuffix) { String endpointSuffix) {
String component = "\\\"" + componentName + "\\\":"; String component = "\\\"" + componentName + "\\\":";
String array = "["; StringBuilder array = new StringBuilder();
array.append("[");
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
array = array + "\\\"" + componentName + "-" + i array.append("\\\"");
+ endpointSuffix + "\\\""; array.append(componentName);
array.append("-");
array.append(i);
array.append(endpointSuffix);
array.append("\\\"");
if (i != count - 1) { if (i != count - 1) {
array = array + ","; array.append(",");
} }
} }
array = array + "]"; array.append("]");
return component + array; return component + array.toString();
} }
} }