diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java index 9d2576127..b6da244e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java @@ -210,7 +210,7 @@ public class LockFile { requireLock(); try { final BufferedOutputStream b; - b = new BufferedOutputStream(os, Constants.OBJECT_ID_LENGTH * 2 + 1); + b = new BufferedOutputStream(os, Constants.OBJECT_ID_STRING_LENGTH + 1); id.copyTo(b); b.write('\n'); b.flush(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java index 447acac8a..704cbc052 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java @@ -83,7 +83,7 @@ public abstract class RefWriter { */ public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); - final char[] tmp = new char[Constants.OBJECT_ID_LENGTH * 2]; + final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { // Historically HEAD has never been published through @@ -137,7 +137,7 @@ public abstract class RefWriter { w.write('\n'); } - final char[] tmp = new char[Constants.OBJECT_ID_LENGTH * 2]; + final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (r.getStorage() != Ref.Storage.PACKED) continue; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java index abfeefaa1..b394f34bb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java @@ -72,12 +72,12 @@ public class ReflogReader { Entry(byte[] raw, int pos) { oldId = ObjectId.fromString(raw, pos); - pos += Constants.OBJECT_ID_LENGTH * 2; + pos += Constants.OBJECT_ID_STRING_LENGTH; if (raw[pos++] != ' ') throw new IllegalArgumentException( "Raw log message does not parse as log entry"); newId = ObjectId.fromString(raw, pos); - pos += Constants.OBJECT_ID_LENGTH * 2; + pos += Constants.OBJECT_ID_STRING_LENGTH; if (raw[pos++] != ' ') { throw new IllegalArgumentException( "Raw log message does not parse as log entry"); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java index 92d07e128..db1312ca3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java @@ -179,7 +179,7 @@ public class BundleWriter { w.write(TransportBundle.V2_BUNDLE_SIGNATURE); w.write('\n'); - final char[] tmp = new char[Constants.OBJECT_ID_LENGTH * 2]; + final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final RevCommit a : assume) { w.write('-'); a.copyTo(tmp, w); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 6aa64cc46..d87395c1c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -882,7 +882,7 @@ public class ReceivePack { case REJECTED_MISSING_OBJECT: if (cmd.getMessage() == null) r.append("missing object(s)"); - else if (cmd.getMessage().length() == 2 * Constants.OBJECT_ID_LENGTH) + else if (cmd.getMessage().length() == Constants.OBJECT_ID_STRING_LENGTH) r.append("object " + cmd.getMessage() + " missing"); else r.append(cmd.getMessage()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index dfbd891b0..6a6053d94 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -70,7 +70,7 @@ class RefAdvertiser { private final StringBuilder tmpLine = new StringBuilder(100); - private final char[] tmpId = new char[2 * Constants.OBJECT_ID_LENGTH]; + private final char[] tmpId = new char[Constants.OBJECT_ID_STRING_LENGTH]; private final Set capablities = new LinkedHashSet(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java index de1c7de01..6a010fb4e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java @@ -308,7 +308,7 @@ abstract class WalkRemoteObjectDatabase { void writeRef(final String name, final ObjectId value) throws IOException { final ByteArrayOutputStream b; - b = new ByteArrayOutputStream(Constants.OBJECT_ID_LENGTH * 2 + 1); + b = new ByteArrayOutputStream(Constants.OBJECT_ID_STRING_LENGTH + 1); value.copyTo(b); b.write('\n');