Remove the use of + when using StringBuilder (1 of 2)

Change-Id: I010b487de26c5a16b3dfda41130d7ea91b1587e8
This commit is contained in:
Matt Baker 2013-12-08 19:59:00 -07:00
parent 8e19090765
commit b2a7d239bd
12 changed files with 29 additions and 26 deletions

View File

@ -66,7 +66,7 @@ public class ParameterizedString {
// "${parameter[.functions...]}" -> "parameter[.functions...]"
final Parameter p = new Parameter(pattern.substring(b + 2, e));
raw.append("{" + prs.size() + "}");
raw.append("{").append(prs.size()).append("}");
prs.add(p);
ops.add(p);

View File

@ -48,7 +48,8 @@ public class ServerPlannedIFrameLinker extends AbstractLinker {
}
for (CompilationResult r : artifacts.find(CompilationResult.class)) {
table.append(r.getStrongName() + "\n");
table.append(r.getStrongName());
table.append("\n");
for (SortedMap<SelectionProperty, String> p : r.getPropertyMap()) {
for (Map.Entry<SelectionProperty, String> e : p.entrySet()) {
table.append(" ");

View File

@ -100,8 +100,8 @@ public class Permutation {
// Prevents mixed mode security in IE6/7.
s.append("f.src=\"javascript:''\";");
s.append("f.id=n;");
s.append("f.style.cssText"
+ "='position:absolute;width:0;height:0;border:none';");
s.append("f.style.cssText)")
.append("='position:absolute;width:0;height:0;border:none';");
s.append("f.tabIndex=-1;");
s.append("d.body.appendChild(f);");

View File

@ -169,7 +169,7 @@ class ProjectBasicAuthFilter implements Filter {
if (sc == SC_UNAUTHORIZED) {
StringBuilder v = new StringBuilder();
v.append(LIT_BASIC);
v.append("realm=\"" + REALM_NAME + "\"");
v.append("realm=\"").append(REALM_NAME).append("\"");
setHeader(WWW_AUTHENTICATE, v.toString());
} else if (containsHeader(WWW_AUTHENTICATE)) {
setHeader(WWW_AUTHENTICATE, null);

View File

@ -293,7 +293,7 @@ class ProjectDigestFilter implements Filter {
if (sc == SC_UNAUTHORIZED) {
StringBuilder v = new StringBuilder();
v.append("Digest");
v.append(" realm=\"" + REALM_NAME + "\"");
v.append(" realm=\"").append(REALM_NAME).append("\"");
String url = urlProvider.get();
if (url == null) {
@ -303,14 +303,14 @@ class ProjectDigestFilter implements Filter {
}
}
if (url != null && !url.isEmpty()) {
v.append(", domain=\"" + url + "\"");
v.append(", domain=\"").append(url).append("\"");
}
v.append(", qop=\"auth\"");
if (stale != null) {
v.append(", stale=" + stale);
v.append(", stale=").append(stale);
}
v.append(", nonce=\"" + newNonce() + "\"");
v.append(", nonce=\"").append(newNonce()).append("\"");
setHeader(WWW_AUTHENTICATE, v.toString());
} else if (containsHeader(WWW_AUTHENTICATE)) {

View File

@ -323,7 +323,7 @@ class HttpPluginServlet extends HttpServlet
String sectionTitle, StringBuilder md, String prefix,
int nameOffset) throws IOException {
if (!entries.isEmpty()) {
md.append("## " + sectionTitle + " ##\n");
md.append("## ").append(sectionTitle).append(" ##\n");
for(JarEntry entry : entries) {
String rsrc = entry.getName().substring(prefix.length());
String entryTitle;

View File

@ -43,7 +43,7 @@ class XrdsServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
final StringBuilder r = new StringBuilder();
r.append("<?xml version=\"1.0\" encoding=\"" + ENC + "\"?>");
r.append("<?xml version=\"1.0\" encoding=\"").append(ENC).append("\"?>");
r.append("<xrds:XRDS");
r.append(" xmlns:xrds=\"xri://$xrds\"");
r.append(" xmlns:openid=\"http://openid.net/xmlns/1.0\"");
@ -51,7 +51,8 @@ class XrdsServlet extends HttpServlet {
r.append("<XRD>");
r.append("<Service priority=\"1\">");
r.append("<Type>http://specs.openid.net/auth/2.0/return_to</Type>");
r.append("<URI>" + url.get() + OpenIdServiceImpl.RETURN_URL + "</URI>");
r.append("<URI>").append(url.get()).append(OpenIdServiceImpl.RETURN_URL)
.append("</URI>");
r.append("</Service>");
r.append("</XRD>");
r.append("</xrds:XRDS>");

View File

@ -323,10 +323,11 @@ public class ChangeUtil {
ChangeMessage cmsg = new ChangeMessage(
new ChangeMessage.Key(changeId, messageUUID(db.get())),
user().getAccountId(), TimeUtil.nowTs(), patchSetId);
StringBuilder msgBuf =
new StringBuilder("Patch Set " + patchSetId.get() + ": Reverted");
StringBuilder msgBuf = new StringBuilder();
msgBuf.append("Patch Set ").append(patchSetId.get()).append(": Reverted");
msgBuf.append("\n\n");
msgBuf.append("This patchset was reverted in change: " + change.getKey().get());
msgBuf.append("This patchset was reverted in change: ")
.append(change.getKey().get());
cmsg.setMessage(msgBuf.toString());
ins.setMessage(cmsg).insert();

View File

@ -252,12 +252,12 @@ public class CherryPickChange {
new ChangeMessage.Key(
patchSetId.getParentKey(), ChangeUtil.messageUUID(db)),
currentUser.getAccountId(), TimeUtil.nowTs(), patchSetId);
StringBuilder msgBuf =
new StringBuilder("Patch Set " + patchSetId.get()
+ ": Cherry Picked");
StringBuilder msgBuf = new StringBuilder();
msgBuf.append("Patch Set ").append(patchSetId.get())
.append(": Cherry Picked");
msgBuf.append("\n\n");
msgBuf.append("This patchset was cherry picked to change: "
+ dest.getKey().get());
msgBuf.append("This patchset was cherry picked to change: ")
.append(dest.getKey().get());
cmsg.setMessage(msgBuf.toString());
return cmsg;
}

View File

@ -268,17 +268,18 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
case REJECT:
if (msg.length() > 0) msg.append("; ");
msg.append("blocked by " + lbl.label);
msg.append("blocked by ").append(lbl.label);
continue;
case NEED:
if (msg.length() > 0) msg.append("; ");
msg.append("needs " + lbl.label);
msg.append("needs ").append(lbl.label);
continue;
case IMPOSSIBLE:
if (msg.length() > 0) msg.append("; ");
msg.append("needs " + lbl.label + " (check project access)");
msg.append("needs ").append(lbl.label)
.append(" (check project access)");
continue;
default:

View File

@ -750,8 +750,7 @@ public class MergeOp {
// dependencies.
//
StringBuilder m = new StringBuilder();
m.append("Change cannot be merged due"
+ " to unsatisfiable dependencies.\n");
m.append("Change cannot be merged due to unsatisfiable dependencies.\n");
m.append("\n");
m.append("The following dependency errors were found:\n");
m.append("\n");

View File

@ -271,7 +271,7 @@ public class SubmoduleOp {
msgbuf.append("\nProject: ");
msgbuf.append(me.getKey().getParentKey().get());
msgbuf.append(" " + me.getValue().getName());
msgbuf.append(" ").append(me.getValue().getName());
msgbuf.append("\n");
if (modules.size() == 1 && msg != null) {
msgbuf.append(msg);