]> source.dussan.org Git - jgit.git/commitdiff
Do not concatenate strings as arguments to StringBuilder.append() 23/47523/1
authorSebastian Schuberth <sschuberth@gmail.com>
Fri, 8 May 2015 09:04:27 +0000 (11:04 +0200)
committerSebastian Schuberth <sschuberth@gmail.com>
Fri, 8 May 2015 09:26:25 +0000 (11:26 +0200)
That more or less defeats the purpose of using a StringBuilder.

Change-Id: I519f7bf1c9b6670e63c3714210f834ee845dc69f
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BinaryDelta.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

index 97092cd5ebd543ebc1d7ebc07b897ca0aa4ae2b1..2565931e050da5915beaeaa1d88baede3130ef80 100644 (file)
@@ -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.
index 33cb6af1e2d55024bf8b48c0737ea97eb171a822..a0896577f3007befd37bf010b6efbf1502b0d185 100644 (file)
@@ -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();
        }
index cf6b2fd3d0f12077487fb6e186381da96aa55837..36ea647c0c6670c5749bea15af7f43c2a03741f8 100644 (file)
@@ -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;