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 05fab92e8..da123a7c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java @@ -152,10 +152,10 @@ public void parse(final InputStream is) throws IOException { } private static byte[] readFully(final InputStream is) throws IOException { - TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE); - b.copy(is); - b.close(); - return b.toByteArray(); + try (TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE)) { + b.copy(is); + return b.toByteArray(); + } } /**