Do not concatenate strings as arguments to StringBuilder.append()

That more or less defeats the purpose of using a StringBuilder.

Change-Id: I519f7bf1c9b6670e63c3714210f834ee845dc69f
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
This commit is contained in:
Sebastian Schuberth 2015-05-08 11:04:27 +02:00
parent 926ad4296e
commit 11c393a1d4
3 changed files with 21 additions and 11 deletions

View File

@ -255,8 +255,13 @@ public static String format(byte[] delta, boolean includeHeader) {
shift += 7;
} while ((c & 0x80) != 0);
if (includeHeader)
r.append("DELTA( BASE=" + baseLen + " RESULT=" + resLen + " )\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (includeHeader) {
r.append("DELTA( BASE="); //$NON-NLS-1$
r.append(baseLen);
r.append(" RESULT="); //$NON-NLS-1$
r.append(resLen);
r.append(" )\n"); //$NON-NLS-1$
}
while (deltaPtr < delta.length) {
final int cmd = delta[deltaPtr++] & 0xff;
@ -285,8 +290,11 @@ public static String format(byte[] delta, boolean includeHeader) {
if (copySize == 0)
copySize = 0x10000;
r.append(" COPY (" + copyOffset + ", " + copySize + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
r.append(" COPY ("); //$NON-NLS-1$
r.append(copyOffset);
r.append(", "); //$NON-NLS-1$
r.append(copySize);
r.append(")\n"); //$NON-NLS-1$
} else if (cmd != 0) {
// Anything else the data is literal within the delta
// itself.

View File

@ -390,15 +390,15 @@ public String toString() {
if (isEdge())
buf.append(" edge");
if (getDeltaDepth() > 0)
buf.append(" depth=" + getDeltaDepth());
buf.append(" depth=").append(getDeltaDepth());
if (isDeltaRepresentation()) {
if (getDeltaBase() != null)
buf.append(" base=inpack:" + getDeltaBase().name());
buf.append(" base=inpack:").append(getDeltaBase().name());
else
buf.append(" base=edge:" + getDeltaBaseId().name());
buf.append(" base=edge:").append(getDeltaBaseId().name());
}
if (isWritten())
buf.append(" offset=" + getOffset());
buf.append(" offset=").append(getOffset());
buf.append("]");
return buf.toString();
}

View File

@ -1461,9 +1461,11 @@ protected void sendStatusReport(final boolean forClient,
case REJECTED_MISSING_OBJECT:
if (cmd.getMessage() == null)
r.append("missing object(s)"); //$NON-NLS-1$
else if (cmd.getMessage().length() == Constants.OBJECT_ID_STRING_LENGTH)
r.append("object " + cmd.getMessage() + " missing"); //$NON-NLS-1$ //$NON-NLS-2$
else
else if (cmd.getMessage().length() == Constants.OBJECT_ID_STRING_LENGTH) {
r.append("object "); //$NON-NLS-1$
r.append(cmd.getMessage());
r.append(" missing"); //$NON-NLS-1$
} else
r.append(cmd.getMessage());
break;