Browse Source

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>
stable-4.1
Sebastian Schuberth 10 years ago
parent
commit
11c393a1d4
  1. 16
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BinaryDelta.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java
  3. 8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

16
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BinaryDelta.java

@ -255,8 +255,13 @@ public class BinaryDelta {
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 class BinaryDelta {
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.

8
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java

@ -390,15 +390,15 @@ public class ObjectToPack extends PackedObjectInfo {
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();
}

8
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

@ -1461,9 +1461,11 @@ public abstract class BaseReceivePack {
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;

Loading…
Cancel
Save