From: Shawn O. Pearce Date: Fri, 2 Jul 2010 23:56:31 +0000 (-0700) Subject: Remove pointless size test in PackFile decompress X-Git-Tag: v0.9.1~157^2~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe9860a4441d606eb6d56da24197eb1797f275dc;p=jgit.git 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 --- 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 dc1fff4bc5..40bb07100c 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));