HBASE-11499 AsyncProcess.buildDetailedErrorMessage concatenates strings using + in a loop (Mike Drob)

This commit is contained in:
stack 2014-07-13 21:48:06 -07:00
parent fc57363404
commit a6fd48ba12
1 changed files with 8 additions and 7 deletions

View File

@ -1407,23 +1407,24 @@ class AsyncProcess {
}
private String buildDetailedErrorMsg(String string, int index) {
String error = string + "; called for " + index +
", actionsInProgress " + actionsInProgress.get() + "; replica gets: ";
StringBuilder error = new StringBuilder(128);
error.append(string).append("; called for ").append(index).append(", actionsInProgress ")
.append(actionsInProgress.get()).append("; replica gets: ");
if (replicaGetIndices != null) {
for (int i = 0; i < replicaGetIndices.length; ++i) {
error += replicaGetIndices[i] + ", ";
error.append(replicaGetIndices[i]).append(", ");
}
} else {
error += (hasAnyReplicaGets ? "all" : "none");
error.append(hasAnyReplicaGets ? "all" : "none");
}
error += "; results ";
error.append("; results ");
if (results != null) {
for (int i = 0; i < results.length; ++i) {
Object o = results[i];
error += ((o == null) ? "null" : o.toString()) + ", ";
error.append(((o == null) ? "null" : o.toString())).append(", ");
}
}
return error;
return error.toString();
}
@Override