]> source.dussan.org Git - jgit.git/commitdiff
IndexPack: Use byte limited form of getCachedBytes 59/1459/1
authorShawn O. Pearce <spearce@spearce.org>
Mon, 30 Aug 2010 18:01:33 +0000 (11:01 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 30 Aug 2010 18:40:01 +0000 (11:40 -0700)
Currently our algorithm requires that we have the delta base as
a contiguous byte array... but getCachedBytes() might not work
if the object is considered to be large by its underlying loader.
Use the limited form to obtain the object as a byte array instead.

Change-Id: I33f12a8811cb6a4a67396174733f209db8119b42
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java

index 2daa105c53929fdc1fa0985b0788b5d81df128c0..f5cdac98835c7a4b5bbc56d887e9caabe17a155e 100644 (file)
@@ -613,7 +613,7 @@ public class IndexPack {
                                missing.add(baseId);
                                continue;
                        }
-                       final byte[] data = ldr.getCachedBytes();
+                       final byte[] data = ldr.getCachedBytes(Integer.MAX_VALUE);
                        final int typeCode = ldr.getType();
                        final PackedObjectInfo oe;
 
@@ -870,7 +870,7 @@ public class IndexPack {
 
                try {
                        final ObjectLoader ldr = readCurs.open(id, type);
-                       final byte[] existingData = ldr.getCachedBytes();
+                       final byte[] existingData = ldr.getCachedBytes(Integer.MAX_VALUE);
                        if (!Arrays.equals(data, existingData)) {
                                throw new IOException(MessageFormat.format(JGitText.get().collisionOn, id.name()));
                        }