aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2009-12-28 16:54:43 +0100
committerRobin Rosenberg <robin.rosenberg@dewire.com>2009-12-28 16:54:43 +0100
commitdb9f8126db23ba90be62777f26a692c7adbb10d9 (patch)
tree4b642c02b1327e8a5367cf8af7935673c3aefa17 /org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
parent2086fdaedd5e71621470865c34ad075d2668af99 (diff)
downloadjgit-db9f8126db23ba90be62777f26a692c7adbb10d9.tar.gz
jgit-db9f8126db23ba90be62777f26a692c7adbb10d9.zip
Get rid of a duplicate constant for SHA-1 length
Since Constants.OBJECT_ID_LENGTH is a compile time constant we can be sure that it will always be inlined. The same goes for the associated constant STR_LEN which is now refactored to the Constant class and given a name better suited for wider use. Change-Id: I03f52131e64edcd0aa74bbbf36e7d42faaf4a698 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
index 13c54201c6..9d9174111b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
@@ -73,7 +73,7 @@ public final class AbbreviatedObjectId {
*/
public static final AbbreviatedObjectId fromString(final byte[] buf,
final int offset, final int end) {
- if (end - offset > AnyObjectId.STR_LEN)
+ if (end - offset > Constants.OBJECT_ID_STRING_LENGTH)
throw new IllegalArgumentException("Invalid id");
return fromHexString(buf, offset, end);
}
@@ -86,7 +86,7 @@ public final class AbbreviatedObjectId {
* @return the converted object id.
*/
public static final AbbreviatedObjectId fromString(final String str) {
- if (str.length() > AnyObjectId.STR_LEN)
+ if (str.length() > Constants.OBJECT_ID_STRING_LENGTH)
throw new IllegalArgumentException("Invalid id: " + str);
final byte[] b = Constants.encodeASCII(str);
return fromHexString(b, 0, b.length);
@@ -167,7 +167,7 @@ public final class AbbreviatedObjectId {
/** @return true if this ObjectId is actually a complete id. */
public boolean isComplete() {
- return length() == AnyObjectId.RAW_LEN * 2;
+ return length() == Constants.OBJECT_ID_STRING_LENGTH;
}
/** @return a complete ObjectId; null if {@link #isComplete()} is false */
@@ -231,7 +231,7 @@ public final class AbbreviatedObjectId {
* @return string form of the abbreviation, in lower case hexadecimal.
*/
public final String name() {
- final char[] b = new char[AnyObjectId.STR_LEN];
+ final char[] b = new char[Constants.OBJECT_ID_STRING_LENGTH];
AnyObjectId.formatHexChar(b, 0, w1);
if (nibbles <= 8)