From 86330ca2ad35fb8308e6452d5f21e4277f55e162 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 27 Feb 2018 14:12:10 +0900 Subject: [PATCH] Patch: Open TemporaryBuffer in try-with-resource Change-Id: I90bff8d49ecc37b8c10ce909cd3ac563205b641c Signed-off-by: David Pursehouse --- org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 class Patch { } 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(); + } } /**