diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2019-01-21 14:19:29 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2019-01-21 14:19:29 +0900 |
commit | a0f69ff387b392226da542b3e5d96b03db6001a8 (patch) | |
tree | f755f2f0f35c9f482bb7527d83b5b93b4f135e96 /org.eclipse.jgit | |
parent | f5614e03f153757a18274723f5bb5c8a0b7a8323 (diff) | |
download | jgit-a0f69ff387b392226da542b3e5d96b03db6001a8.tar.gz jgit-a0f69ff387b392226da542b3e5d96b03db6001a8.zip |
IO: Open TemporaryBuffer.Heap in try-with-resource
Change-Id: I78a947fd1263b47b3df17bcc6e9b32497e68dd4a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java index e88e7a38c6..a07a4fd1a5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java @@ -203,12 +203,13 @@ public class IO { if (last < 0) return ByteBuffer.wrap(out, 0, pos); - @SuppressWarnings("resource" /* java 7 */) - TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE); - tmp.write(out); - tmp.write(last); - tmp.copy(in); - return ByteBuffer.wrap(tmp.toByteArray()); + try (TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap( + Integer.MAX_VALUE)) { + tmp.write(out); + tmp.write(last); + tmp.copy(in); + return ByteBuffer.wrap(tmp.toByteArray()); + } } /** |