From fe9860a4441d606eb6d56da24197eb1797f275dc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 2 Jul 2010 16:56:31 -0700 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/storage/file/PackFile.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java index dc1fff4bc..40bb07100 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java @@ -277,8 +277,6 @@ public class PackFile implements Iterable { 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));