Merge "Remove the use of + when using StringBuilder (2 of 2)"

This commit is contained in:
Shawn Pearce
2013-12-09 05:03:32 +00:00
committed by Gerrit Code Review
11 changed files with 48 additions and 43 deletions

View File

@@ -519,9 +519,9 @@ public class CommitValidators {
PersonIdent who, IdentifiedUser currentUser, String canonicalWebUrl) {
StringBuilder sb = new StringBuilder();
sb.append("\n");
sb.append("ERROR: In commit " + c.name() + "\n");
sb.append("ERROR: " + type + " email address " + who.getEmailAddress()
+ "\n");
sb.append("ERROR: In commit ").append(c.name()).append("\n");
sb.append("ERROR: ").append(type).append(" email address ")
.append(who.getEmailAddress()).append("\n");
sb.append("ERROR: does not match your user account.\n");
sb.append("ERROR:\n");
if (currentUser.getEmailAddresses().isEmpty()) {
@@ -529,14 +529,14 @@ public class CommitValidators {
} else {
sb.append("ERROR: The following addresses are currently registered:\n");
for (String address : currentUser.getEmailAddresses()) {
sb.append("ERROR: " + address + "\n");
sb.append("ERROR: ").append(address).append("\n");
}
}
sb.append("ERROR:\n");
if (canonicalWebUrl != null) {
sb.append("ERROR: To register an email address, please visit:\n");
sb.append("ERROR: " + canonicalWebUrl + "#" + PageLinks.SETTINGS_CONTACT
+ "\n");
sb.append("ERROR: ").append(canonicalWebUrl).append("#")
.append(PageLinks.SETTINGS_CONTACT).append("\n");
}
sb.append("\n");
return new CommitValidationMessage(sb.toString(), false);

View File

@@ -226,9 +226,9 @@ public abstract class ChangeEmail extends NotificationEmail {
StringBuilder detail = new StringBuilder();
if (patchSetInfo != null) {
detail.append(patchSetInfo.getMessage().trim() + "\n");
detail.append(patchSetInfo.getMessage().trim()).append("\n");
} else {
detail.append(change.getSubject().trim() + "\n");
detail.append(change.getSubject().trim()).append("\n");
}
if (patchSet != null) {
@@ -238,7 +238,8 @@ public abstract class ChangeEmail extends NotificationEmail {
if (Patch.COMMIT_MSG.equals(p.getNewName())) {
continue;
}
detail.append(p.getChangeType().getCode() + " " + p.getNewName() + "\n");
detail.append(p.getChangeType().getCode())
.append(" ").append(p.getNewName()).append("\n");
}
detail.append(MessageFormat.format("" //
+ "{0,choice,0#0 files|1#1 file|1<{0} files} changed, " //

View File

@@ -177,8 +177,9 @@ public class SmtpEmailSender implements EmailSender {
for (Address addr : rcpt) {
if (!client.addRecipient(addr.email)) {
String error = client.getReplyString();
rejected.append("Server " + smtpHost + " rejected recipient "
+ addr + ": " + error);
rejected.append("Server ").append(smtpHost)
.append(" rejected recipient ").append(addr)
.append(": ").append(error);
}
}

View File

@@ -170,19 +170,19 @@ public class PatchListLoader extends CacheLoader<PatchListKey, PatchList> {
hdr.append("diff --git");
if (aCommit != null) {
hdr.append(" a/" + Patch.COMMIT_MSG);
hdr.append(" a/").append(Patch.COMMIT_MSG);
} else {
hdr.append(" " + FileHeader.DEV_NULL);
hdr.append(" ").append(FileHeader.DEV_NULL);
}
hdr.append(" b/" + Patch.COMMIT_MSG);
hdr.append(" b/").append(Patch.COMMIT_MSG);
hdr.append("\n");
if (aCommit != null) {
hdr.append("--- a/" + Patch.COMMIT_MSG + "\n");
hdr.append("--- a/").append(Patch.COMMIT_MSG).append("\n");
} else {
hdr.append("--- " + FileHeader.DEV_NULL + "\n");
hdr.append("--- ").append(FileHeader.DEV_NULL).append("\n");
}
hdr.append("+++ b/" + Patch.COMMIT_MSG + "\n");
hdr.append("+++ b/").append(Patch.COMMIT_MSG).append("\n");
Text aText =
aCommit != null ? Text.forCommit(db, reader, aCommit) : Text.EMPTY;

View File

@@ -89,7 +89,7 @@ public class Text extends RawText {
private static void appendPersonIdent(StringBuilder b, String field,
PersonIdent person) {
if (person != null) {
b.append(field + ": ");
b.append(field).append(": ");
if (person.getName() != null) {
b.append(" ");
b.append(person.getName());
@@ -103,7 +103,7 @@ public class Text extends RawText {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZ");
sdf.setTimeZone(person.getTimeZone());
b.append(field + "Date: ");
b.append(field).append("Date: ");
b.append(sdf.format(person.getWhen()));
b.append("\n");
}