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

View File

@ -115,15 +115,20 @@ public static void addQuicklink(Service serviceSpec, String label,
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();
}
}