Browse Source

Remove pointless size test in PackFile decompress

Now that any large objects are forced through a streaming loader
when its bigger than getStreamFileThreshold(), and that threshold
is pegged at Integer.MAX_VALUE as its largest size, we will never
be able to reach this code path where we threw OutOfMemoryError.

Robin pointed out that we probably should include a message here,
but the code is effectively unreachable, so there isn't any value
in adding a message at this point.

So remove it.

Change-Id: Ie611d005622e38a75537f1350246df0ab89dd500
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 14 years ago
parent
commit
fe9860a444
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java

2
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java

@ -277,8 +277,6 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
private final byte[] decompress(final long position, final long totalSize,
final WindowCursor curs) throws IOException, DataFormatException {
if (totalSize > Integer.MAX_VALUE)
throw new OutOfMemoryError();
final byte[] dstbuf = new byte[(int) totalSize];
if (curs.inflate(this, position, dstbuf, 0) != totalSize)
throw new EOFException(MessageFormat.format(JGitText.get().shortCompressedStreamAt, position));

Loading…
Cancel
Save