diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java index 8171669bc..534c82731 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java @@ -267,7 +267,7 @@ private String[] extractFileLines(final Charset[] csGuess) { final TemporaryBuffer[] tmp = new TemporaryBuffer[getParentCount() + 1]; try { for (int i = 0; i < tmp.length; i++) - tmp[i] = new TemporaryBuffer.LocalFile(); + tmp[i] = new TemporaryBuffer.Heap(Integer.MAX_VALUE); for (final HunkHeader h : getHunks()) h.extractFileLines(tmp); @@ -281,11 +281,6 @@ private String[] extractFileLines(final Charset[] csGuess) { return r; } catch (IOException ioe) { throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe); - } finally { - for (final TemporaryBuffer b : tmp) { - if (b != null) - b.destroy(); - } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java index 7b4847352..383c1f8fe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java @@ -139,14 +139,10 @@ public void parse(final InputStream is) throws IOException { } private static byte[] readFully(final InputStream is) throws IOException { - final TemporaryBuffer b = new TemporaryBuffer.LocalFile(); - try { - b.copy(is); - b.close(); - return b.toByteArray(); - } finally { - b.destroy(); - } + TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE); + b.copy(is); + b.close(); + return b.toByteArray(); } /**